Remove #if checks for NUMBOOT==0, it's not relevant for any architecture
and if we get such an architecture, we can just avoid using the relevant options.
This commit is contained in:
parent
b04b95ab47
commit
a9595c8217
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=109887
@ -149,7 +149,6 @@ char part_size_type[MAX_NUM_PARTS];
|
|||||||
char part_offset_type[MAX_NUM_PARTS];
|
char part_offset_type[MAX_NUM_PARTS];
|
||||||
int part_set[MAX_NUM_PARTS];
|
int part_set[MAX_NUM_PARTS];
|
||||||
|
|
||||||
#if NUMBOOT > 0
|
|
||||||
int installboot; /* non-zero if we should install a boot program */
|
int installboot; /* non-zero if we should install a boot program */
|
||||||
char *bootbuf; /* pointer to buffer with remainder of boot prog */
|
char *bootbuf; /* pointer to buffer with remainder of boot prog */
|
||||||
int bootsize; /* size of remaining boot program */
|
int bootsize; /* size of remaining boot program */
|
||||||
@ -157,7 +156,6 @@ char *xxboot; /* primary boot */
|
|||||||
char *bootxx; /* secondary boot */
|
char *bootxx; /* secondary boot */
|
||||||
char boot0[MAXPATHLEN];
|
char boot0[MAXPATHLEN];
|
||||||
char boot1[MAXPATHLEN];
|
char boot1[MAXPATHLEN];
|
||||||
#endif
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
UNSPEC, EDIT, READ, RESTORE, WRITE, WRITEBOOT
|
UNSPEC, EDIT, READ, RESTORE, WRITE, WRITEBOOT
|
||||||
@ -178,7 +176,6 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
while ((ch = getopt(argc, argv, OPTIONS)) != -1)
|
while ((ch = getopt(argc, argv, OPTIONS)) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
#if NUMBOOT > 0
|
|
||||||
case 'B':
|
case 'B':
|
||||||
++installboot;
|
++installboot;
|
||||||
break;
|
break;
|
||||||
@ -189,7 +186,6 @@ main(int argc, char *argv[])
|
|||||||
case 's':
|
case 's':
|
||||||
bootxx = optarg;
|
bootxx = optarg;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
case 'n':
|
case 'n':
|
||||||
disable_write = 1;
|
disable_write = 1;
|
||||||
@ -218,7 +214,6 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
#if NUMBOOT > 0
|
|
||||||
if (installboot) {
|
if (installboot) {
|
||||||
rflag++;
|
rflag++;
|
||||||
if (op == UNSPEC)
|
if (op == UNSPEC)
|
||||||
@ -228,10 +223,6 @@ main(int argc, char *argv[])
|
|||||||
op = READ;
|
op = READ;
|
||||||
xxboot = bootxx = 0;
|
xxboot = bootxx = 0;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (op == UNSPEC)
|
|
||||||
op = READ;
|
|
||||||
#endif
|
|
||||||
if (argc < 1)
|
if (argc < 1)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
@ -272,7 +263,6 @@ main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RESTORE:
|
case RESTORE:
|
||||||
#if NUMBOOT > 0
|
|
||||||
if (installboot && argc == 3) {
|
if (installboot && argc == 3) {
|
||||||
makelabel(argv[2], 0, &lab);
|
makelabel(argv[2], 0, &lab);
|
||||||
argc--;
|
argc--;
|
||||||
@ -285,7 +275,6 @@ main(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
bzero((char *)&lab, sizeof(lab));
|
bzero((char *)&lab, sizeof(lab));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
usage();
|
usage();
|
||||||
if (!(t = fopen(argv[1], "r")))
|
if (!(t = fopen(argv[1], "r")))
|
||||||
@ -311,7 +300,6 @@ main(int argc, char *argv[])
|
|||||||
error = writelabel(f, bootarea, lp);
|
error = writelabel(f, bootarea, lp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if NUMBOOT > 0
|
|
||||||
case WRITEBOOT:
|
case WRITEBOOT:
|
||||||
{
|
{
|
||||||
struct disklabel tlab;
|
struct disklabel tlab;
|
||||||
@ -326,7 +314,6 @@ main(int argc, char *argv[])
|
|||||||
error = writelabel(f, bootarea, lp);
|
error = writelabel(f, bootarea, lp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
exit(error);
|
exit(error);
|
||||||
}
|
}
|
||||||
@ -407,7 +394,6 @@ writelabel(int f, const char *boot, struct disklabel *lp)
|
|||||||
warn("write");
|
warn("write");
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
#if NUMBOOT > 0
|
|
||||||
/*
|
/*
|
||||||
* Output the remainder of the disklabel
|
* Output the remainder of the disklabel
|
||||||
*/
|
*/
|
||||||
@ -415,7 +401,6 @@ writelabel(int f, const char *boot, struct disklabel *lp)
|
|||||||
warn("write");
|
warn("write");
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,10 +475,8 @@ makebootarea(char *boot, struct disklabel *dp, int f)
|
|||||||
struct disklabel *lp;
|
struct disklabel *lp;
|
||||||
char *p;
|
char *p;
|
||||||
int b;
|
int b;
|
||||||
#if NUMBOOT > 0
|
|
||||||
char *dkbasename;
|
char *dkbasename;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
#endif
|
|
||||||
#ifdef __alpha__
|
#ifdef __alpha__
|
||||||
u_long *bootinfo;
|
u_long *bootinfo;
|
||||||
int n;
|
int n;
|
||||||
@ -511,7 +494,6 @@ makebootarea(char *boot, struct disklabel *dp, int f)
|
|||||||
lp = (struct disklabel *)
|
lp = (struct disklabel *)
|
||||||
(boot + (LABELSECTOR * dp->d_secsize) + LABELOFFSET);
|
(boot + (LABELSECTOR * dp->d_secsize) + LABELOFFSET);
|
||||||
bzero((char *)lp, sizeof *lp);
|
bzero((char *)lp, sizeof *lp);
|
||||||
#if NUMBOOT > 0
|
|
||||||
/*
|
/*
|
||||||
* If we are not installing a boot program but we are installing a
|
* If we are not installing a boot program but we are installing a
|
||||||
* label on disk then we must read the current bootarea so we don't
|
* label on disk then we must read the current bootarea so we don't
|
||||||
@ -647,7 +629,6 @@ makebootarea(char *boot, struct disklabel *dp, int f)
|
|||||||
}
|
}
|
||||||
#endif /* NUMBOOT > 1 */
|
#endif /* NUMBOOT > 1 */
|
||||||
(void)close(b);
|
(void)close(b);
|
||||||
#endif /* NUMBOOT > 0 */
|
|
||||||
/*
|
/*
|
||||||
* Make sure no part of the bootstrap is written in the area
|
* Make sure no part of the bootstrap is written in the area
|
||||||
* reserved for the label.
|
* reserved for the label.
|
||||||
@ -1626,7 +1607,6 @@ Warning(const char *fmt, ...)
|
|||||||
void
|
void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
#if NUMBOOT > 0
|
|
||||||
fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
|
fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
|
||||||
"usage: disklabel [-r] disk",
|
"usage: disklabel [-r] disk",
|
||||||
"\t\t(to read label)",
|
"\t\t(to read label)",
|
||||||
@ -1652,15 +1632,5 @@ usage(void)
|
|||||||
"\t\t(to restore label and install boot program)"
|
"\t\t(to restore label and install boot program)"
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
#else
|
|
||||||
fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
|
|
||||||
"usage: disklabel [-r] disk", "(to read label)",
|
|
||||||
" disklabel -w [-r] [-n] disk type [ packid ]",
|
|
||||||
"\t\t(to write label)",
|
|
||||||
" disklabel -e [-r] [-n] disk",
|
|
||||||
"\t\t(to edit label)",
|
|
||||||
" disklabel -R [-r] [-n] disk protofile",
|
|
||||||
"\t\t(to restore label)");
|
|
||||||
#endif
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,6 @@ char part_size_type[MAX_NUM_PARTS];
|
|||||||
char part_offset_type[MAX_NUM_PARTS];
|
char part_offset_type[MAX_NUM_PARTS];
|
||||||
int part_set[MAX_NUM_PARTS];
|
int part_set[MAX_NUM_PARTS];
|
||||||
|
|
||||||
#if NUMBOOT > 0
|
|
||||||
int installboot; /* non-zero if we should install a boot program */
|
int installboot; /* non-zero if we should install a boot program */
|
||||||
char *bootbuf; /* pointer to buffer with remainder of boot prog */
|
char *bootbuf; /* pointer to buffer with remainder of boot prog */
|
||||||
int bootsize; /* size of remaining boot program */
|
int bootsize; /* size of remaining boot program */
|
||||||
@ -157,7 +156,6 @@ char *xxboot; /* primary boot */
|
|||||||
char *bootxx; /* secondary boot */
|
char *bootxx; /* secondary boot */
|
||||||
char boot0[MAXPATHLEN];
|
char boot0[MAXPATHLEN];
|
||||||
char boot1[MAXPATHLEN];
|
char boot1[MAXPATHLEN];
|
||||||
#endif
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
UNSPEC, EDIT, READ, RESTORE, WRITE, WRITEBOOT
|
UNSPEC, EDIT, READ, RESTORE, WRITE, WRITEBOOT
|
||||||
@ -178,7 +176,6 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
while ((ch = getopt(argc, argv, OPTIONS)) != -1)
|
while ((ch = getopt(argc, argv, OPTIONS)) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
#if NUMBOOT > 0
|
|
||||||
case 'B':
|
case 'B':
|
||||||
++installboot;
|
++installboot;
|
||||||
break;
|
break;
|
||||||
@ -189,7 +186,6 @@ main(int argc, char *argv[])
|
|||||||
case 's':
|
case 's':
|
||||||
bootxx = optarg;
|
bootxx = optarg;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
case 'n':
|
case 'n':
|
||||||
disable_write = 1;
|
disable_write = 1;
|
||||||
@ -218,7 +214,6 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
#if NUMBOOT > 0
|
|
||||||
if (installboot) {
|
if (installboot) {
|
||||||
rflag++;
|
rflag++;
|
||||||
if (op == UNSPEC)
|
if (op == UNSPEC)
|
||||||
@ -228,10 +223,6 @@ main(int argc, char *argv[])
|
|||||||
op = READ;
|
op = READ;
|
||||||
xxboot = bootxx = 0;
|
xxboot = bootxx = 0;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (op == UNSPEC)
|
|
||||||
op = READ;
|
|
||||||
#endif
|
|
||||||
if (argc < 1)
|
if (argc < 1)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
@ -272,7 +263,6 @@ main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RESTORE:
|
case RESTORE:
|
||||||
#if NUMBOOT > 0
|
|
||||||
if (installboot && argc == 3) {
|
if (installboot && argc == 3) {
|
||||||
makelabel(argv[2], 0, &lab);
|
makelabel(argv[2], 0, &lab);
|
||||||
argc--;
|
argc--;
|
||||||
@ -285,7 +275,6 @@ main(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
bzero((char *)&lab, sizeof(lab));
|
bzero((char *)&lab, sizeof(lab));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
usage();
|
usage();
|
||||||
if (!(t = fopen(argv[1], "r")))
|
if (!(t = fopen(argv[1], "r")))
|
||||||
@ -311,7 +300,6 @@ main(int argc, char *argv[])
|
|||||||
error = writelabel(f, bootarea, lp);
|
error = writelabel(f, bootarea, lp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if NUMBOOT > 0
|
|
||||||
case WRITEBOOT:
|
case WRITEBOOT:
|
||||||
{
|
{
|
||||||
struct disklabel tlab;
|
struct disklabel tlab;
|
||||||
@ -326,7 +314,6 @@ main(int argc, char *argv[])
|
|||||||
error = writelabel(f, bootarea, lp);
|
error = writelabel(f, bootarea, lp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
exit(error);
|
exit(error);
|
||||||
}
|
}
|
||||||
@ -407,7 +394,6 @@ writelabel(int f, const char *boot, struct disklabel *lp)
|
|||||||
warn("write");
|
warn("write");
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
#if NUMBOOT > 0
|
|
||||||
/*
|
/*
|
||||||
* Output the remainder of the disklabel
|
* Output the remainder of the disklabel
|
||||||
*/
|
*/
|
||||||
@ -415,7 +401,6 @@ writelabel(int f, const char *boot, struct disklabel *lp)
|
|||||||
warn("write");
|
warn("write");
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,10 +475,8 @@ makebootarea(char *boot, struct disklabel *dp, int f)
|
|||||||
struct disklabel *lp;
|
struct disklabel *lp;
|
||||||
char *p;
|
char *p;
|
||||||
int b;
|
int b;
|
||||||
#if NUMBOOT > 0
|
|
||||||
char *dkbasename;
|
char *dkbasename;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
#endif
|
|
||||||
#ifdef __alpha__
|
#ifdef __alpha__
|
||||||
u_long *bootinfo;
|
u_long *bootinfo;
|
||||||
int n;
|
int n;
|
||||||
@ -511,7 +494,6 @@ makebootarea(char *boot, struct disklabel *dp, int f)
|
|||||||
lp = (struct disklabel *)
|
lp = (struct disklabel *)
|
||||||
(boot + (LABELSECTOR * dp->d_secsize) + LABELOFFSET);
|
(boot + (LABELSECTOR * dp->d_secsize) + LABELOFFSET);
|
||||||
bzero((char *)lp, sizeof *lp);
|
bzero((char *)lp, sizeof *lp);
|
||||||
#if NUMBOOT > 0
|
|
||||||
/*
|
/*
|
||||||
* If we are not installing a boot program but we are installing a
|
* If we are not installing a boot program but we are installing a
|
||||||
* label on disk then we must read the current bootarea so we don't
|
* label on disk then we must read the current bootarea so we don't
|
||||||
@ -647,7 +629,6 @@ makebootarea(char *boot, struct disklabel *dp, int f)
|
|||||||
}
|
}
|
||||||
#endif /* NUMBOOT > 1 */
|
#endif /* NUMBOOT > 1 */
|
||||||
(void)close(b);
|
(void)close(b);
|
||||||
#endif /* NUMBOOT > 0 */
|
|
||||||
/*
|
/*
|
||||||
* Make sure no part of the bootstrap is written in the area
|
* Make sure no part of the bootstrap is written in the area
|
||||||
* reserved for the label.
|
* reserved for the label.
|
||||||
@ -1626,7 +1607,6 @@ Warning(const char *fmt, ...)
|
|||||||
void
|
void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
#if NUMBOOT > 0
|
|
||||||
fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
|
fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
|
||||||
"usage: disklabel [-r] disk",
|
"usage: disklabel [-r] disk",
|
||||||
"\t\t(to read label)",
|
"\t\t(to read label)",
|
||||||
@ -1652,15 +1632,5 @@ usage(void)
|
|||||||
"\t\t(to restore label and install boot program)"
|
"\t\t(to restore label and install boot program)"
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
#else
|
|
||||||
fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
|
|
||||||
"usage: disklabel [-r] disk", "(to read label)",
|
|
||||||
" disklabel -w [-r] [-n] disk type [ packid ]",
|
|
||||||
"\t\t(to write label)",
|
|
||||||
" disklabel -e [-r] [-n] disk",
|
|
||||||
"\t\t(to edit label)",
|
|
||||||
" disklabel -R [-r] [-n] disk protofile",
|
|
||||||
"\t\t(to restore label)");
|
|
||||||
#endif
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user