summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-06-03 21:24:39 +0000
committerbrian <brian@FreeBSD.org>1997-06-03 21:24:39 +0000
commit864e7b2e639558a3660503c025d27b41cb9e37ac (patch)
tree147ca1e3ad4272a61add2f664070ee22aa349807
parent99eae7b7b1d0dfe2463f468406efaea5f7258df8 (diff)
downloadFreeBSD-src-864e7b2e639558a3660503c025d27b41cb9e37ac.zip
FreeBSD-src-864e7b2e639558a3660503c025d27b41cb9e37ac.tar.gz
Number partitions 1-4, not 0-3.
Any existing config files (using the -f option) will need to be changed although using the old files will usually result in an error (partition 0 is invalid).
-rw-r--r--sbin/fdisk/fdisk.826
-rw-r--r--sbin/fdisk/fdisk.c34
-rw-r--r--sbin/i386/fdisk/fdisk.826
-rw-r--r--sbin/i386/fdisk/fdisk.c34
4 files changed, 60 insertions, 60 deletions
diff --git a/sbin/fdisk/fdisk.8 b/sbin/fdisk/fdisk.8
index a43a85a..70b0f8c 100644
--- a/sbin/fdisk/fdisk.8
+++ b/sbin/fdisk/fdisk.8
@@ -9,7 +9,7 @@
.Op Fl i
.Op Fl u
.Op Fl a
-.Op Fl 0123
+.Op Fl 1234
.Op Ar disk
.Bl -tag -width time
.Nm fdisk
@@ -66,7 +66,7 @@ is given.
Change the active partition only. Ignored if
.Fl f
is given.
-.It Fl 0123
+.It Fl 1234
Operate on a single fdisk entry only. Ignored if
.Fl f
is given.
@@ -133,19 +133,19 @@ An example follows:
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
- The data for partition 0 is:
+ The data for partition 1 is:
sysid 165,(FreeBSD/NetBSD/386BSD)
start 495, size 380160 (185 Meg), flag 0
beg: cyl 1/ sector 1/ head 0;
end: cyl 768/ sector 33/ head 14
- The data for partition 1 is:
+ The data for partition 2 is:
sysid 164,(unknown)
start 378180, size 2475 (1 Meg), flag 0
beg: cyl 764/ sector 1/ head 0;
end: cyl 768/ sector 33/ head 14
- The data for partition 2 is:
- <UNUSED>
The data for partition 3 is:
+ <UNUSED>
+ The data for partition 4 is:
sysid 99,(ISC UNIX, other System V/386, GNU HURD or Mach)
start 380656, size 224234 (109 Meg), flag 80
beg: cyl 769/ sector 2/ head 0;
@@ -330,7 +330,7 @@ Example (all of these are equivalent), for a disk with 1019 cylinders,
.Xc
Set the partition given by
.Ar partition
-(0-3) to type
+(1-4) to type
.Ar type ,
starting at sector
.Ar start
@@ -363,18 +363,18 @@ Note: the start offset will be rounded upwards to a head boundary if
necessary, and the end offset will be rounded downwards to a cylinder
boundary if necessary.
.Pp
-Example: to clear partition 3 and mark it as unused:
+Example: to clear partition 4 and mark it as unused:
.Pp
.nf
- p 3 0 0 0
+ p 4 0 0 0
.fi
.Pp
-Example: to set partition 0 to a FreeBSD partition, starting at sector 1
+Example: to set partition 1 to a FreeBSD partition, starting at sector 1
for 2503871 sectors (note: these numbers will be rounded upwards and
downwards to correspond to head and cylinder boundaries):
.Pp
.nf
- p 0 165 1 2503871
+ p 1 165 1 2503871
.fi
.It Xo
.Ic a
@@ -385,10 +385,10 @@ Make
the active partition. Can occur anywhere in the config file, but only
one must be present.
.Pp
-Example: to make partition 0 the active partition:
+Example: to make partition 1 the active partition:
.Pp
.nf
- a 0
+ a 1
.fi
.El
diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c
index 8e3e267..7a4c819 100644
--- a/sbin/fdisk/fdisk.c
+++ b/sbin/fdisk/fdisk.c
@@ -246,9 +246,6 @@ main(int argc, char *argv[])
else { register int flag;
for ( ; (flag = *token++) ; ) {
switch (flag) {
- case '0':
- partition = 0;
- break;
case '1':
partition = 1;
break;
@@ -258,6 +255,9 @@ main(int argc, char *argv[])
case '3':
partition = 3;
break;
+ case '4':
+ partition = 4;
+ break;
case 'a':
a_flag = 1;
break;
@@ -376,7 +376,7 @@ main(int argc, char *argv[])
printf("Warning: BIOS sector numbering starts with sector 1\n");
printf("Information from DOS bootblock is:\n");
if (partition == -1)
- for (i = 0; i < NDOSPART; i++)
+ for (i = 1; i <= NDOSPART; i++)
change_part(i);
else
change_part(partition);
@@ -406,7 +406,7 @@ main(int argc, char *argv[])
exit(0);
usage:
- printf("fdisk {-a|-i|-u} [-f <config file> [-t] [-v]] [-{0,1,2,3}] [disk]\n");
+ printf("fdisk {-a|-i|-u} [-f <config file> [-t] [-v]] [-{1,2,3,4}] [disk]\n");
return(1);
}
@@ -418,7 +418,7 @@ int i;
print_params();
printf("Information from DOS bootblock is:\n");
if (which == -1)
- for (i = 0; i < NDOSPART; i++)
+ for (i = 1; i <= NDOSPART; i++)
printf("%d: ", i), print_part(i);
else
print_part(which);
@@ -432,7 +432,7 @@ print_part(int i)
struct dos_partition *partp;
u_int64_t part_mb;
- partp = ((struct dos_partition *) &mboot.parts) + i;
+ partp = ((struct dos_partition *) &mboot.parts) + i - 1;
if (!bcmp(partp, &mtpart, sizeof (struct dos_partition))) {
printf("<UNUSED>\n");
@@ -490,7 +490,7 @@ unsigned long size = disksecs - start;
static void
change_part(int i)
{
-struct dos_partition *partp = ((struct dos_partition *) &mboot.parts) + i;
+struct dos_partition *partp = ((struct dos_partition *) &mboot.parts) + i - 1;
printf("The data for partition %d is:\n", i);
print_part(i);
@@ -500,9 +500,9 @@ struct dos_partition *partp = ((struct dos_partition *) &mboot.parts) + i;
if (i_flag) {
bzero((char *)partp, sizeof (struct dos_partition));
- if (i == 3) {
+ if (i == 4) {
init_sector0(1);
- printf("\nThe static data for the DOS partition 3 has been reinitialized to:\n");
+ printf("\nThe static data for the DOS partition 4 has been reinitialized to:\n");
print_part(i);
}
}
@@ -563,7 +563,7 @@ static void
change_active(int which)
{
int i;
-int active = 3, tmp;
+int active = 4, tmp;
struct dos_partition *partp = ((struct dos_partition *) &mboot.parts);
if (a_flag && which != -1)
@@ -575,8 +575,8 @@ struct dos_partition *partp = ((struct dos_partition *) &mboot.parts);
while (!ok("Are you happy with this choice"));
for (i = 0; i < NDOSPART; i++)
partp[i].dp_flag = 0;
- if (active >= 0 && active < NDOSPART)
- partp[active].dp_flag = ACTIVE;
+ if (active > 0 && active <= NDOSPART)
+ partp[active-1].dp_flag = ACTIVE;
}
void
@@ -1087,13 +1087,13 @@ process_partition(command)
break;
}
partition = command->args[0].arg_val;
- if (partition < 0 || partition > 3)
+ if (partition < 1 || partition > 4)
{
fprintf(stderr, "%s: ERROR line %d: invalid partition number %d\n",
name, current_line_number, partition);
break;
}
- partp = ((struct dos_partition *) &mboot.parts) + partition;
+ partp = ((struct dos_partition *) &mboot.parts) + partition - 1;
bzero((char *)partp, sizeof (struct dos_partition));
partp->dp_typ = command->args[1].arg_val;
partp->dp_start = command->args[2].arg_val;
@@ -1198,7 +1198,7 @@ process_active(command)
break;
}
partition = command->args[0].arg_val;
- if (partition < 0 || partition > 3)
+ if (partition < 1 || partition > 4)
{
fprintf(stderr, "%s: ERROR line %d: invalid partition number %d\n",
name, current_line_number, partition);
@@ -1210,7 +1210,7 @@ process_active(command)
partp = ((struct dos_partition *) &mboot.parts);
for (i = 0; i < NDOSPART; i++)
partp[i].dp_flag = 0;
- partp[partition].dp_flag = ACTIVE;
+ partp[partition-1].dp_flag = ACTIVE;
status = 1;
break;
diff --git a/sbin/i386/fdisk/fdisk.8 b/sbin/i386/fdisk/fdisk.8
index a43a85a..70b0f8c 100644
--- a/sbin/i386/fdisk/fdisk.8
+++ b/sbin/i386/fdisk/fdisk.8
@@ -9,7 +9,7 @@
.Op Fl i
.Op Fl u
.Op Fl a
-.Op Fl 0123
+.Op Fl 1234
.Op Ar disk
.Bl -tag -width time
.Nm fdisk
@@ -66,7 +66,7 @@ is given.
Change the active partition only. Ignored if
.Fl f
is given.
-.It Fl 0123
+.It Fl 1234
Operate on a single fdisk entry only. Ignored if
.Fl f
is given.
@@ -133,19 +133,19 @@ An example follows:
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
- The data for partition 0 is:
+ The data for partition 1 is:
sysid 165,(FreeBSD/NetBSD/386BSD)
start 495, size 380160 (185 Meg), flag 0
beg: cyl 1/ sector 1/ head 0;
end: cyl 768/ sector 33/ head 14
- The data for partition 1 is:
+ The data for partition 2 is:
sysid 164,(unknown)
start 378180, size 2475 (1 Meg), flag 0
beg: cyl 764/ sector 1/ head 0;
end: cyl 768/ sector 33/ head 14
- The data for partition 2 is:
- <UNUSED>
The data for partition 3 is:
+ <UNUSED>
+ The data for partition 4 is:
sysid 99,(ISC UNIX, other System V/386, GNU HURD or Mach)
start 380656, size 224234 (109 Meg), flag 80
beg: cyl 769/ sector 2/ head 0;
@@ -330,7 +330,7 @@ Example (all of these are equivalent), for a disk with 1019 cylinders,
.Xc
Set the partition given by
.Ar partition
-(0-3) to type
+(1-4) to type
.Ar type ,
starting at sector
.Ar start
@@ -363,18 +363,18 @@ Note: the start offset will be rounded upwards to a head boundary if
necessary, and the end offset will be rounded downwards to a cylinder
boundary if necessary.
.Pp
-Example: to clear partition 3 and mark it as unused:
+Example: to clear partition 4 and mark it as unused:
.Pp
.nf
- p 3 0 0 0
+ p 4 0 0 0
.fi
.Pp
-Example: to set partition 0 to a FreeBSD partition, starting at sector 1
+Example: to set partition 1 to a FreeBSD partition, starting at sector 1
for 2503871 sectors (note: these numbers will be rounded upwards and
downwards to correspond to head and cylinder boundaries):
.Pp
.nf
- p 0 165 1 2503871
+ p 1 165 1 2503871
.fi
.It Xo
.Ic a
@@ -385,10 +385,10 @@ Make
the active partition. Can occur anywhere in the config file, but only
one must be present.
.Pp
-Example: to make partition 0 the active partition:
+Example: to make partition 1 the active partition:
.Pp
.nf
- a 0
+ a 1
.fi
.El
diff --git a/sbin/i386/fdisk/fdisk.c b/sbin/i386/fdisk/fdisk.c
index 8e3e267..7a4c819 100644
--- a/sbin/i386/fdisk/fdisk.c
+++ b/sbin/i386/fdisk/fdisk.c
@@ -246,9 +246,6 @@ main(int argc, char *argv[])
else { register int flag;
for ( ; (flag = *token++) ; ) {
switch (flag) {
- case '0':
- partition = 0;
- break;
case '1':
partition = 1;
break;
@@ -258,6 +255,9 @@ main(int argc, char *argv[])
case '3':
partition = 3;
break;
+ case '4':
+ partition = 4;
+ break;
case 'a':
a_flag = 1;
break;
@@ -376,7 +376,7 @@ main(int argc, char *argv[])
printf("Warning: BIOS sector numbering starts with sector 1\n");
printf("Information from DOS bootblock is:\n");
if (partition == -1)
- for (i = 0; i < NDOSPART; i++)
+ for (i = 1; i <= NDOSPART; i++)
change_part(i);
else
change_part(partition);
@@ -406,7 +406,7 @@ main(int argc, char *argv[])
exit(0);
usage:
- printf("fdisk {-a|-i|-u} [-f <config file> [-t] [-v]] [-{0,1,2,3}] [disk]\n");
+ printf("fdisk {-a|-i|-u} [-f <config file> [-t] [-v]] [-{1,2,3,4}] [disk]\n");
return(1);
}
@@ -418,7 +418,7 @@ int i;
print_params();
printf("Information from DOS bootblock is:\n");
if (which == -1)
- for (i = 0; i < NDOSPART; i++)
+ for (i = 1; i <= NDOSPART; i++)
printf("%d: ", i), print_part(i);
else
print_part(which);
@@ -432,7 +432,7 @@ print_part(int i)
struct dos_partition *partp;
u_int64_t part_mb;
- partp = ((struct dos_partition *) &mboot.parts) + i;
+ partp = ((struct dos_partition *) &mboot.parts) + i - 1;
if (!bcmp(partp, &mtpart, sizeof (struct dos_partition))) {
printf("<UNUSED>\n");
@@ -490,7 +490,7 @@ unsigned long size = disksecs - start;
static void
change_part(int i)
{
-struct dos_partition *partp = ((struct dos_partition *) &mboot.parts) + i;
+struct dos_partition *partp = ((struct dos_partition *) &mboot.parts) + i - 1;
printf("The data for partition %d is:\n", i);
print_part(i);
@@ -500,9 +500,9 @@ struct dos_partition *partp = ((struct dos_partition *) &mboot.parts) + i;
if (i_flag) {
bzero((char *)partp, sizeof (struct dos_partition));
- if (i == 3) {
+ if (i == 4) {
init_sector0(1);
- printf("\nThe static data for the DOS partition 3 has been reinitialized to:\n");
+ printf("\nThe static data for the DOS partition 4 has been reinitialized to:\n");
print_part(i);
}
}
@@ -563,7 +563,7 @@ static void
change_active(int which)
{
int i;
-int active = 3, tmp;
+int active = 4, tmp;
struct dos_partition *partp = ((struct dos_partition *) &mboot.parts);
if (a_flag && which != -1)
@@ -575,8 +575,8 @@ struct dos_partition *partp = ((struct dos_partition *) &mboot.parts);
while (!ok("Are you happy with this choice"));
for (i = 0; i < NDOSPART; i++)
partp[i].dp_flag = 0;
- if (active >= 0 && active < NDOSPART)
- partp[active].dp_flag = ACTIVE;
+ if (active > 0 && active <= NDOSPART)
+ partp[active-1].dp_flag = ACTIVE;
}
void
@@ -1087,13 +1087,13 @@ process_partition(command)
break;
}
partition = command->args[0].arg_val;
- if (partition < 0 || partition > 3)
+ if (partition < 1 || partition > 4)
{
fprintf(stderr, "%s: ERROR line %d: invalid partition number %d\n",
name, current_line_number, partition);
break;
}
- partp = ((struct dos_partition *) &mboot.parts) + partition;
+ partp = ((struct dos_partition *) &mboot.parts) + partition - 1;
bzero((char *)partp, sizeof (struct dos_partition));
partp->dp_typ = command->args[1].arg_val;
partp->dp_start = command->args[2].arg_val;
@@ -1198,7 +1198,7 @@ process_active(command)
break;
}
partition = command->args[0].arg_val;
- if (partition < 0 || partition > 3)
+ if (partition < 1 || partition > 4)
{
fprintf(stderr, "%s: ERROR line %d: invalid partition number %d\n",
name, current_line_number, partition);
@@ -1210,7 +1210,7 @@ process_active(command)
partp = ((struct dos_partition *) &mboot.parts);
for (i = 0; i < NDOSPART; i++)
partp[i].dp_flag = 0;
- partp[partition].dp_flag = ACTIVE;
+ partp[partition-1].dp_flag = ACTIVE;
status = 1;
break;
OpenPOWER on IntegriCloud