summaryrefslogtreecommitdiffstats
path: root/sbin/bsdlabel
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2007-12-09 22:58:49 +0000
committermarcel <marcel@FreeBSD.org>2007-12-09 22:58:49 +0000
commit9bdadf99dec1c31457922c49dd8c33ba68c82204 (patch)
treef226008fa1b4ba44e9a2347806fd7178c3afacf5 /sbin/bsdlabel
parent2f8a94b8fec936548bcd831e5afb947311d31666 (diff)
downloadFreeBSD-src-9bdadf99dec1c31457922c49dd8c33ba68c82204.zip
FreeBSD-src-9bdadf99dec1c31457922c49dd8c33ba68c82204.tar.gz
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.
Diffstat (limited to 'sbin/bsdlabel')
-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 bcba125..6854450 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;
OpenPOWER on IntegriCloud