CVS commit: src/sys/arch/x68k/stand/newdisk
Module Name:src Committed By: minoura Date: Sat Jun 23 08:48:16 UTC 2012 Modified Files: src/sys/arch/x68k/stand/newdisk: newdisk.c Log Message: Change to the 2-clauses license. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x68k/stand/newdisk/newdisk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x68k/stand/newdisk/newdisk.c diff -u src/sys/arch/x68k/stand/newdisk/newdisk.c:1.9 src/sys/arch/x68k/stand/newdisk/newdisk.c:1.10 --- src/sys/arch/x68k/stand/newdisk/newdisk.c:1.9 Wed May 4 11:44:25 2011 +++ src/sys/arch/x68k/stand/newdisk/newdisk.c Sat Jun 23 08:48:15 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: newdisk.c,v 1.9 2011/05/04 11:44:25 tsutsui Exp $ */ +/* $NetBSD: newdisk.c,v 1.10 2012/06/23 08:48:15 minoura Exp $ */ /*- * Copyright (c) 1999 Minoura Makoto @@ -12,11 +12,6 @@ * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in the *documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - *must display the following acknowledgement: - * This product includes software developed by Minoura Makoto. - * 4. The name of the author may not be used to endorse or promote products - *derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
CVS commit: src/sys/arch/x68k/stand/newdisk
Module Name:src Committed By: tsutsui Date: Wed May 4 11:44:25 UTC 2011 Modified Files: src/sys/arch/x68k/stand/newdisk: Makefile newdisk.c Log Message: WARNSfy to avoid further botch. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x68k/stand/newdisk/Makefile cvs rdiff -u -r1.8 -r1.9 src/sys/arch/x68k/stand/newdisk/newdisk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x68k/stand/newdisk/Makefile diff -u src/sys/arch/x68k/stand/newdisk/Makefile:1.2 src/sys/arch/x68k/stand/newdisk/Makefile:1.3 --- src/sys/arch/x68k/stand/newdisk/Makefile:1.2 Wed Dec 12 01:49:56 2001 +++ src/sys/arch/x68k/stand/newdisk/Makefile Wed May 4 11:44:25 2011 @@ -1,5 +1,6 @@ -# $NetBSD: Makefile,v 1.2 2001/12/12 01:49:56 tv Exp $ +# $NetBSD: Makefile,v 1.3 2011/05/04 11:44:25 tsutsui Exp $ +WARNS?= 4 PROG= newdisk CPPFLAGS+= -DMBOOT=\/usr/mdec/mboot\ DPADD+= ${LIBUTIL} Index: src/sys/arch/x68k/stand/newdisk/newdisk.c diff -u src/sys/arch/x68k/stand/newdisk/newdisk.c:1.8 src/sys/arch/x68k/stand/newdisk/newdisk.c:1.9 --- src/sys/arch/x68k/stand/newdisk/newdisk.c:1.8 Fri Apr 29 06:00:33 2011 +++ src/sys/arch/x68k/stand/newdisk/newdisk.c Wed May 4 11:44:25 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: newdisk.c,v 1.8 2011/04/29 06:00:33 isaki Exp $ */ +/* $NetBSD: newdisk.c,v 1.9 2011/05/04 11:44:25 tsutsui Exp $ */ /*- * Copyright (c) 1999 Minoura Makoto @@ -41,14 +41,16 @@ #include stdio.h #include stdlib.h #include string.h +#include err.h #include fcntl.h #include unistd.h #include util.h #include sys/param.h #include sys/disklabel.h #include sys/dkio.h +#include sys/ioctl.h -char *mboot = MBOOT; +const char *mboot = MBOOT; char dev[MAXPATHLEN]; char buf[4096 + 1];
CVS commit: src/sys/arch/x68k/stand/newdisk
Module Name:src Committed By: isaki Date: Fri Apr 29 05:59:53 UTC 2011 Modified Files: src/sys/arch/x68k/stand/newdisk: newdisk.c Log Message: - use getprogname() instead of argv[0] - remove an extra decl. of optind To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x68k/stand/newdisk/newdisk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x68k/stand/newdisk/newdisk.c diff -u src/sys/arch/x68k/stand/newdisk/newdisk.c:1.6 src/sys/arch/x68k/stand/newdisk/newdisk.c:1.7 --- src/sys/arch/x68k/stand/newdisk/newdisk.c:1.6 Fri Apr 29 05:43:51 2011 +++ src/sys/arch/x68k/stand/newdisk/newdisk.c Fri Apr 29 05:59:53 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: newdisk.c,v 1.6 2011/04/29 05:43:51 isaki Exp $ */ +/* $NetBSD: newdisk.c,v 1.7 2011/04/29 05:59:53 isaki Exp $ */ /*- * Copyright (c) 1999 Minoura Makoto @@ -48,7 +48,6 @@ #include sys/disklabel.h #include sys/dkio.h -char *prog; char *mboot = MBOOT; char dev[MAXPATHLEN]; char buf[4096 + 1]; @@ -65,7 +64,7 @@ { fprintf(stderr, Usage: %s [-v] [-n] [-f] [-c] [-m /usr/mdec/mboot] - /dev/rsdXc\n, prog); + /dev/rsdXc\n, getprogname()); exit(1); /* NOTREACHED */ } @@ -73,12 +72,10 @@ int main(int argc, char *argv[]) { - extern int optind; int ch; int fd; struct disklabel label; - prog = argv[0]; while ((ch = getopt(argc, argv, vnfcm:p)) != -1) { switch (ch) { case 'v':
CVS commit: src/sys/arch/x68k/stand/newdisk
Module Name:src Committed By: isaki Date: Fri Apr 29 06:00:33 UTC 2011 Modified Files: src/sys/arch/x68k/stand/newdisk: newdisk.c Log Message: Add a missing printf argument.. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x68k/stand/newdisk/newdisk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x68k/stand/newdisk/newdisk.c diff -u src/sys/arch/x68k/stand/newdisk/newdisk.c:1.7 src/sys/arch/x68k/stand/newdisk/newdisk.c:1.8 --- src/sys/arch/x68k/stand/newdisk/newdisk.c:1.7 Fri Apr 29 05:59:53 2011 +++ src/sys/arch/x68k/stand/newdisk/newdisk.c Fri Apr 29 06:00:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: newdisk.c,v 1.7 2011/04/29 05:59:53 isaki Exp $ */ +/* $NetBSD: newdisk.c,v 1.8 2011/04/29 06:00:33 isaki Exp $ */ /*- * Copyright (c) 1999 Minoura Makoto @@ -116,7 +116,7 @@ err(1, reading %s, dev); if (strncmp(buf, X68SCSI1, 8) == 0 !force) errx(1, %s is already marked. - Use -f to overwrite the existing mark.); + Use -f to overwrite the existing mark., dev); if (check_only) return 0;
CVS commit: src/sys/arch/x68k/stand/newdisk
Module Name:src Committed By: isaki Date: Fri Apr 29 05:43:52 UTC 2011 Modified Files: src/sys/arch/x68k/stand/newdisk: newdisk.c Log Message: Fix indent and style. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x68k/stand/newdisk/newdisk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x68k/stand/newdisk/newdisk.c diff -u src/sys/arch/x68k/stand/newdisk/newdisk.c:1.5 src/sys/arch/x68k/stand/newdisk/newdisk.c:1.6 --- src/sys/arch/x68k/stand/newdisk/newdisk.c:1.5 Sat Mar 14 21:04:17 2009 +++ src/sys/arch/x68k/stand/newdisk/newdisk.c Fri Apr 29 05:43:51 2011 @@ -1,3 +1,5 @@ +/* $NetBSD: newdisk.c,v 1.6 2011/04/29 05:43:51 isaki Exp $ */ + /*- * Copyright (c) 1999 Minoura Makoto * All rights reserved. @@ -61,144 +63,146 @@ void usage(void) { -fprintf(stderr, - Usage: %s [-v] [-n] [-f] [-c] [-m /usr/mdec/mboot] - /dev/rsdXc\n, prog); -exit(1); -/* NOTREACHED */ + fprintf(stderr, + Usage: %s [-v] [-n] [-f] [-c] [-m /usr/mdec/mboot] + /dev/rsdXc\n, prog); + exit(1); + /* NOTREACHED */ } int main(int argc, char *argv[]) { -extern int optind; -int ch; -int fd; -struct disklabel label; - -prog = argv[0]; -while ((ch = getopt(argc, argv, vnfcm:p)) != -1) { - switch (ch) { - case 'v': - verbose = 1; - break; - case 'n': - dry_run = 1; - break; - case 'f': - force = 1; - break; - case 'c': - check_only = 1; - break; - case 'm': - mboot = optarg; - break; - case 'p': - mark_only = 1; - break; - default: - usage(); + extern int optind; + int ch; + int fd; + struct disklabel label; + + prog = argv[0]; + while ((ch = getopt(argc, argv, vnfcm:p)) != -1) { + switch (ch) { + case 'v': + verbose = 1; + break; + case 'n': + dry_run = 1; + break; + case 'f': + force = 1; + break; + case 'c': + check_only = 1; + break; + case 'm': + mboot = optarg; + break; + case 'p': + mark_only = 1; + break; + default: + usage(); + } } -} -argc -= optind; -argv += optind; - -if (argc != 1) - usage(); - -fd = opendisk(argv[0], O_RDONLY, dev, MAXPATHLEN, 0); -if (fd 0) - err(1, opening %s, dev); -if (access(mboot, R_OK) 0) - err(1, checking %s, mboot); - -if (read(fd, buf, 512) 0) - err(1, reading %s, dev); -if (strncmp(buf, X68SCSI1, 8) == 0 - !force) - errx(1, %s is already marked. Use -f to overwrite the existing mark.); -if (check_only) - return 0; + argc -= optind; + argv += optind; -if (verbose) - fprintf(stderr, Inspecting %s... , dev); + if (argc != 1) + usage(); -if (ioctl(fd, DIOCGDINFO, label) 0) - err(1, inspecting %s, dev); -close(fd); -if (label.d_secsize != 512) - errx(1, This type of disk is not supported by NetBSD.); - -if (verbose) - fprintf(stderr, total number of sector is %d.\n, label.d_secperunit); - -if (verbose) - fprintf(stderr, Building disk mark... ); -memset(buf, 0, 3072); -#define n label.d_secperunit -sprintf(buf, X68SCSI1%c%c%c%c%c%c%c%c%s, - 2, 0, - (n/16777216)%256, (n/65536)%256, (n/256)%256, n%256, - 1, 0, copyright); -#undef n -if (verbose) - fprintf(stderr, done.\n); + fd = opendisk(argv[0], O_RDONLY, dev, MAXPATHLEN, 0); + if (fd 0) + err(1, opening %s, dev); + if (access(mboot, R_OK) 0) + err(1, checking %s, mboot); + + if (read(fd, buf, 512) 0) + err(1, reading %s, dev); + if (strncmp(buf, X68SCSI1, 8) == 0 !force) + errx(1, %s is already marked. + Use -f to overwrite the existing mark.); + if (check_only) + return 0; + + if (verbose) + fprintf(stderr, Inspecting %s... , dev); -if (verbose) - fprintf(stderr, Merging %s... , mboot); -fd = open(mboot, O_RDONLY); -if (fd 0) - err(1, opening %s, mboot); -if (read(fd, buf+1024, 1024) 0) - err(1, reading %s, mboot); -close(fd); -if (verbose) - fprintf(stderr, done.\n); + if (ioctl(fd, DIOCGDINFO, label) 0) + err(1, inspecting %s, dev); + close(fd); + if (label.d_secsize != 512) + errx(1, This type of disk is not supported by NetBSD.); -if (!mark_only) { if (verbose) - fprintf(stderr, Creating an empty partition table... ); -#define n (label.d_secperunit/2) - sprintf(buf+2048, - X68K%c%c%c%c%c%c%c%c%c%c%c%c, - 0, 0, 0, 32, - (n/16777215)%256, (n/65536)%256, (n/256)%256, n%256, - (n/16777215)%256, (n/65536)%256, (n/256)%256, n%256); + fprintf(stderr, total number of sector is %d.\n, + label.d_secperunit); + + if (verbose) + fprintf(stderr, Building disk mark... ); + memset(buf, 0, 3072); +#define n label.d_secperunit + sprintf(buf, X68SCSI1%c%c%c%c%c%c%c%c%s, + 2, 0, + (n/16777216)%256, (n/65536)%256, (n/256)%256, n%256, + 1, 0, copyright); #undef n if (verbose) - fprintf(stderr, done.\n); -} + fprintf(stderr, done.\n); -if (dry_run) { - char filename[MAXPATHLEN] =