aboutsummaryrefslogtreecommitdiff
path: root/sbin/bsdlabel/bsdlabel.c
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2007-12-09 22:58:49 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2007-12-09 22:58:49 +0000
commitd5718812ea4005431fe60a0e9fb2abbdf473bf73 (patch)
treef226008fa1b4ba44e9a2347806fd7178c3afacf5 /sbin/bsdlabel/bsdlabel.c
parent3959198cc519ef850557ac1eab43b14204f5b9d1 (diff)
downloadsrc-d5718812ea4005431fe60a0e9fb2abbdf473bf73.tar.gz
src-d5718812ea4005431fe60a0e9fb2abbdf473bf73.zip
Allow bsdlabel to operate on labels that have at most 26 partitions
by virtue of there not being any (lower-case) letters avaliable for more partitions.
Notes
Notes: svn path=/head/; revision=174501
Diffstat (limited to 'sbin/bsdlabel/bsdlabel.c')
-rw-r--r--sbin/bsdlabel/bsdlabel.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c
index bcba1253751d..6854450d0999 100644
--- a/sbin/bsdlabel/bsdlabel.c
+++ b/sbin/bsdlabel/bsdlabel.c
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
#include <sys/disk.h>
#define DKTYPENAMES
#define FSTYPENAMES
+#define MAXPARTITIONS 26
#include <sys/disklabel.h>
#include <unistd.h>
@@ -94,6 +95,7 @@ static void usage(void);
static struct disklabel *getvirginlabel(void);
#define DEFEDITOR _PATH_VI
+#define DEFPARTITIONS 8
static char *dkname;
static char *specname;
@@ -301,7 +303,7 @@ fixlabel(struct disklabel *lp)
struct partition *dp;
int i;
- for (i = 0; i < MAXPARTITIONS; i++) {
+ for (i = 0; i < lp->d_npartitions; i++) {
if (i == RAW_PART)
continue;
if (lp->d_partitions[i].p_size)
@@ -1392,7 +1394,7 @@ checklabel(struct disklabel *lp)
}
}
}
- for (; i < MAXPARTITIONS; i++) {
+ for (; i < lp->d_npartitions; i++) {
part = 'a' + i;
pp = &lp->d_partitions[i];
if (pp->p_size || pp->p_offset)
@@ -1457,7 +1459,7 @@ getvirginlabel(void)
loclab.d_ntracks = 255;
loclab.d_secpercyl = loclab.d_ntracks * loclab.d_nsectors;
loclab.d_ncylinders = loclab.d_secperunit / loclab.d_secpercyl;
- loclab.d_npartitions = MAXPARTITIONS;
+ loclab.d_npartitions = DEFPARTITIONS;
/* Various (unneeded) compat stuff */
loclab.d_rpm = 3600;