| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: main.c,v 1.19 2008/07/20 01:20:22 lukem Exp $ */ | | 1 | /* $NetBSD: main.c,v 1.20 2009/05/04 18:09:04 mhitch Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2006 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2006 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Julio M. Merino Vidal. | | 8 | * by Julio M. Merino Vidal. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -66,27 +66,27 @@ | | | @@ -66,27 +66,27 @@ |
66 | #endif | | 66 | #endif |
67 | | | 67 | |
68 | #include <sys/cdefs.h> | | 68 | #include <sys/cdefs.h> |
69 | #ifndef lint | | 69 | #ifndef lint |
70 | __COPYRIGHT("@(#) Copyright (c) 1987, 1993\ | | 70 | __COPYRIGHT("@(#) Copyright (c) 1987, 1993\ |
71 | The Regents of the University of California. All rights reserved."); | | 71 | The Regents of the University of California. All rights reserved."); |
72 | #endif /* not lint */ | | 72 | #endif /* not lint */ |
73 | | | 73 | |
74 | #ifndef lint | | 74 | #ifndef lint |
75 | #if 0 | | 75 | #if 0 |
76 | static char sccsid[] = "@(#)disklabel.c 8.4 (Berkeley) 5/4/95"; | | 76 | static char sccsid[] = "@(#)disklabel.c 8.4 (Berkeley) 5/4/95"; |
77 | /* from static char sccsid[] = "@(#)disklabel.c 1.2 (Symmetric) 11/28/85"; */ | | 77 | /* from static char sccsid[] = "@(#)disklabel.c 1.2 (Symmetric) 11/28/85"; */ |
78 | #else | | 78 | #else |
79 | __RCSID("$NetBSD: main.c,v 1.19 2008/07/20 01:20:22 lukem Exp $"); | | 79 | __RCSID("$NetBSD: main.c,v 1.20 2009/05/04 18:09:04 mhitch Exp $"); |
80 | #endif | | 80 | #endif |
81 | #endif /* not lint */ | | 81 | #endif /* not lint */ |
82 | | | 82 | |
83 | #include <sys/param.h> | | 83 | #include <sys/param.h> |
84 | #include <sys/file.h> | | 84 | #include <sys/file.h> |
85 | #include <sys/stat.h> | | 85 | #include <sys/stat.h> |
86 | #include <sys/wait.h> | | 86 | #include <sys/wait.h> |
87 | #define DKTYPENAMES | | 87 | #define DKTYPENAMES |
88 | #define FSTYPENAMES | | 88 | #define FSTYPENAMES |
89 | | | 89 | |
90 | #include <ctype.h> | | 90 | #include <ctype.h> |
91 | #include <err.h> | | 91 | #include <err.h> |
92 | #include <errno.h> | | 92 | #include <errno.h> |
| @@ -539,27 +539,27 @@ write_label(int f) | | | @@ -539,27 +539,27 @@ write_label(int f) |
539 | if (lab.d_type == DTYPE_SMD && lab.d_flags & D_BADSECT && | | 539 | if (lab.d_type == DTYPE_SMD && lab.d_flags & D_BADSECT && |
540 | lab.d_secsize == 512) { | | 540 | lab.d_secsize == 512) { |
541 | /* Write the label to the odd sectors of the last track! */ | | 541 | /* Write the label to the odd sectors of the last track! */ |
542 | daddr_t alt; | | 542 | daddr_t alt; |
543 | int i; | | 543 | int i; |
544 | uint8_t sec0[512]; | | 544 | uint8_t sec0[512]; |
545 | | | 545 | |
546 | if (pread(f, sec0, 512, 0) < 512) { | | 546 | if (pread(f, sec0, 512, 0) < 512) { |
547 | warn("read master label to write alternates"); | | 547 | warn("read master label to write alternates"); |
548 | return 0; | | 548 | return 0; |
549 | } | | 549 | } |
550 | | | 550 | |
551 | alt = lab.d_ncylinders * lab.d_secpercyl - lab.d_nsectors; | | 551 | alt = lab.d_ncylinders * lab.d_secpercyl - lab.d_nsectors; |
552 | for (i = 1; i < 11 && i < lab.d_nsectors; i += 2) { | | 552 | for (i = 1; i < 11 && (uint32_t)i < lab.d_nsectors; i += 2) { |
553 | if (pwrite(f, sec0, 512, (off_t)(alt + i) * 512) < 512) | | 553 | if (pwrite(f, sec0, 512, (off_t)(alt + i) * 512) < 512) |
554 | warn("alternate label %d write", i/2); | | 554 | warn("alternate label %d write", i/2); |
555 | } | | 555 | } |
556 | } | | 556 | } |
557 | #endif /* __vax__ */ | | 557 | #endif /* __vax__ */ |
558 | | | 558 | |
559 | return 0; | | 559 | return 0; |
560 | } | | 560 | } |
561 | | | 561 | |
562 | int | | 562 | int |
563 | writelabel(int f, struct disklabel *lp) | | 563 | writelabel(int f, struct disklabel *lp) |
564 | { | | 564 | { |
565 | if (lp != &lab) | | 565 | if (lp != &lab) |