Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/distrib/utils/sysinst/arch/x68k Pull up rev. 1.6:



details:   https://anonhg.NetBSD.org/src/rev/4a2dc00841ea
branches:  netbsd-1-5
changeset: 488296:4a2dc00841ea
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Jun 27 21:42:42 2000 +0000

description:
Pull up rev. 1.6:
Use newdisk(8) instead of built-in version.

diffstat:

 distrib/utils/sysinst/arch/x68k/md.c |  114 +++-------------------------------
 1 files changed, 10 insertions(+), 104 deletions(-)

diffs (142 lines):

diff -r 58a8e75b939c -r 4a2dc00841ea distrib/utils/sysinst/arch/x68k/md.c
--- a/distrib/utils/sysinst/arch/x68k/md.c      Tue Jun 27 21:41:40 2000 +0000
+++ b/distrib/utils/sysinst/arch/x68k/md.c      Tue Jun 27 21:42:42 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.5 1999/11/27 14:03:22 minoura Exp $ */
+/*     $NetBSD: md.c,v 1.5.4.1 2000/06/27 21:42:42 thorpej Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -67,9 +67,7 @@
 
 /* prototypes */
 static int md_newdisk __P((void));
-#define COPYRIGHT "NetBSD/x68k SCSI primary boot. "            \
-                 "(C) 1999 by The NetBSD Foundation, Inc. "    \
-                 "Written by sysinst."
+
 
 int
 md_get_info(void)
@@ -142,106 +140,6 @@
        return 1;
 }
 
-#ifndef DEBUG
-static int
-md_newdisk(void)
-{
-       int mbootfd;
-       char devname[100];
-       int fd;
-       char buf[1024];
-       size_t size = dlsize + 64;
-
-       snprintf(devname, 100, "/dev/r%sc", diskdev);
-       fd = open(devname, O_WRONLY);
-       if (fd < 0) {
-               endwin();
-               fprintf(stderr, "Can't open %s\n", devname);
-               exit(1);
-       }
-
-       msg_display(MSG_newdisk, diskdev, diskdev);
-
-       /* Write disk mark */
-       memset(buf, 0, 1024);
-       sprintf(buf, "X68SCSI1%c%c%c%c%c%c%c%c%s",
-               2, 0,
-               (size>>24)&0xff, (size>>16)&0xff, (size>>8)&0xff, size&0xff,
-               1, 0, COPYRIGHT);
-       lseek(fd, 0, SEEK_SET);
-       if (write(fd, buf, 1024) < 0) {
-               endwin();
-               close(fd);
-               fprintf(stderr, "Can't write mark on %s\n", devname);
-               exit(1);
-       }
-
-       /* Write primary boot */
-       memset(buf, 0, 1024);
-       mbootfd = open("/usr/mdec/mboot", O_RDONLY);
-       if (mbootfd < 0) {
-               endwin();
-               close(fd);
-               fprintf(stderr, "Can't read mboot.\n");
-               exit(1);
-       }
-       if (read(mbootfd, buf, 1024) < 0) {
-               endwin();
-               close(fd);
-               close(mbootfd);
-               fprintf(stderr, "Can't read mboot.\n");
-               exit(1);
-       }
-       close(mbootfd);
-       if (write(fd, buf, 1024) != 1024) {
-               endwin();
-               close(fd);
-               fprintf(stderr, "Can't write mboot.\n");
-               exit(1);
-       }
-
-       /* Create empty partition map */
-#ifdef notyet
-       memset(&md_disklabel, 0, sizeof(md_disklabel));
-       sprintf((char*) md_disklabel, "X68K%c%c%c%c%c%c%c%c%c%c%c%c",
-               0, 0, 0, 32,
-               (size>>24)&0xff, (size>>16)&0xff, (size>>8)&0xff, size&0xff,
-               (size>>24)&0xff, (size>>16)&0xff, (size>>8)&0xff, size&0xff);
-       if (write(fd, md_disklabel, 1024) < 0) {
-               endwin();
-               close(fd);
-               fprintf(stderr, "Can't create partition table.\n");
-               exit(1);
-       }
-#else
-       memset(buf, 0, 1024);
-       sprintf(buf, "X68K%c%c%c%c%c%c%c%c%c%c%c%c",
-               0, 0, 0, 32,
-               (size>>24)&0xff, (size>>16)&0xff, (size>>8)&0xff, size&0xff,
-               (size>>24)&0xff, (size>>16)&0xff, (size>>8)&0xff, size&0xff);
-       if (write(fd, buf, 1024) < 0) {
-               endwin();
-               close(fd);
-               fprintf(stderr, "Can't create partition table.\n");
-               exit(1);
-       }
-#endif
-
-       close (fd);
-
-       return 0;
-}
-#else
-static int
-md_newdisk(fd, size, buf)
-       int fd;
-       size_t size;
-       char *buf;
-{
-       return 0;
-}
-#endif
-
 #ifdef notyet
 static int
 md_check_partitions(void)
@@ -300,6 +198,14 @@
 }
 #endif
 
+static int
+md_newdisk(void)
+{
+       msg_display(MSG_newdisk, diskdev, diskdev);
+
+       return run_prog(1, 1, MSG_NONE, "/usr/mdec/newdisk -v %s", diskdev);
+}
+
 /*
  * hook called before writing new disklabel.
  */



Home | Main Index | Thread Index | Old Index