Fix typo in last commit.

Rearrange bits in writelabel() a bit for improved readability.
This commit is contained in:
Poul-Henning Kamp 2003-01-26 11:41:37 +00:00
parent 0dbb100b9b
commit 80baf8ced8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=109878
2 changed files with 178 additions and 172 deletions

View File

@ -359,7 +359,6 @@ makelabel(const char *type, const char *name, struct disklabel *lp)
int
writelabel(int f, const char *boot, struct disklabel *lp)
{
int flag;
#ifdef __alpha__
u_long *p, sum;
int i;
@ -376,13 +375,21 @@ writelabel(int f, const char *boot, struct disklabel *lp)
Warning("write to disk label supressed - label was as follows:");
display(stdout, lp);
return (0);
} else {
}
setbootflag(lp);
lp->d_magic = DISKMAGIC;
lp->d_magic2 = DISKMAGIC;
lp->d_checksum = 0;
lp->d_checksum = dkcksum(lp);
if (rflag) {
if (!rflag) {
if (ioctl(f, DIOCWDINFO, lp) < 0) {
l_perror("ioctl DIOCWDINFO");
return (1);
}
return (0);
}
/*
* First set the kernel disk label,
* then write a label to the raw disk.
@ -458,11 +465,6 @@ writelabel(int f, const char *boot, struct disklabel *lp)
return(1);
}
#endif
} else if (ioctl(f, DIOCWDINFO, lp) < 0) {
l_perror("ioctl DIOCWDINFO");
return (1);
}
}
return (0);
}
@ -1682,7 +1684,7 @@ 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%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",
"\t\t(to read label)",
" disklabel -w [-r] [-n] disk type [ packid ]",
@ -1697,15 +1699,16 @@ usage(void)
" disklabel -w -B [-n] [ -b boot1 [ -s boot2 ] ] disk type [ packid ]",
"\t\t(to write label and boot program)",
" disklabel -R -B [-n] [ -b boot1 [ -s boot2 ] ] disk protofile [ type ]",
"\t\t(to restore label and boot program)",
"\t\t(to restore label and boot program)"
#else
" disklabel -B [-n] [ -b bootprog ] disk [ type ]",
"\t\t(to install boot program with existing on-disk label)",
" disklabel -w -B [-n] [ -b bootprog ] disk type [ packid ]",
"\t\t(to write label and install boot program)",
" disklabel -R -B [-n] [ -b bootprog ] disk protofile [ type ]",
"\t\t(to restore label and install boot program)",
"\t\t(to restore label and install boot program)"
#endif
);
#else
fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
"usage: disklabel [-r] disk", "(to read label)",

View File

@ -359,7 +359,6 @@ makelabel(const char *type, const char *name, struct disklabel *lp)
int
writelabel(int f, const char *boot, struct disklabel *lp)
{
int flag;
#ifdef __alpha__
u_long *p, sum;
int i;
@ -376,13 +375,21 @@ writelabel(int f, const char *boot, struct disklabel *lp)
Warning("write to disk label supressed - label was as follows:");
display(stdout, lp);
return (0);
} else {
}
setbootflag(lp);
lp->d_magic = DISKMAGIC;
lp->d_magic2 = DISKMAGIC;
lp->d_checksum = 0;
lp->d_checksum = dkcksum(lp);
if (rflag) {
if (!rflag) {
if (ioctl(f, DIOCWDINFO, lp) < 0) {
l_perror("ioctl DIOCWDINFO");
return (1);
}
return (0);
}
/*
* First set the kernel disk label,
* then write a label to the raw disk.
@ -458,11 +465,6 @@ writelabel(int f, const char *boot, struct disklabel *lp)
return(1);
}
#endif
} else if (ioctl(f, DIOCWDINFO, lp) < 0) {
l_perror("ioctl DIOCWDINFO");
return (1);
}
}
return (0);
}
@ -1682,7 +1684,7 @@ 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%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",
"\t\t(to read label)",
" disklabel -w [-r] [-n] disk type [ packid ]",
@ -1697,15 +1699,16 @@ usage(void)
" disklabel -w -B [-n] [ -b boot1 [ -s boot2 ] ] disk type [ packid ]",
"\t\t(to write label and boot program)",
" disklabel -R -B [-n] [ -b boot1 [ -s boot2 ] ] disk protofile [ type ]",
"\t\t(to restore label and boot program)",
"\t\t(to restore label and boot program)"
#else
" disklabel -B [-n] [ -b bootprog ] disk [ type ]",
"\t\t(to install boot program with existing on-disk label)",
" disklabel -w -B [-n] [ -b bootprog ] disk type [ packid ]",
"\t\t(to write label and install boot program)",
" disklabel -R -B [-n] [ -b bootprog ] disk protofile [ type ]",
"\t\t(to restore label and install boot program)",
"\t\t(to restore label and install boot program)"
#endif
);
#else
fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
"usage: disklabel [-r] disk", "(to read label)",