summaryrefslogtreecommitdiffstats
path: root/sbin/fdisk
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2009-01-14 21:08:19 +0000
committerluigi <luigi@FreeBSD.org>2009-01-14 21:08:19 +0000
commitecf6d10e653a9a64cad4bd2029b6d2f561bcc153 (patch)
tree281373325cf6c854b9c63f82af1558ecc12106c0 /sbin/fdisk
parent0181d688119c32044f6738434330908d4c88839e (diff)
downloadFreeBSD-src-ecf6d10e653a9a64cad4bd2029b6d2f561bcc153.zip
FreeBSD-src-ecf6d10e653a9a64cad4bd2029b6d2f561bcc153.tar.gz
more changes from Christoph:
pass a pointer instead of an index to print_part() so it does not depend on a static variable. Submitted by: Christoph Mallon MFC after: 3 days
Diffstat (limited to 'sbin/fdisk')
-rw-r--r--sbin/fdisk/fdisk.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c
index fc310fd..cfa8884 100644
--- a/sbin/fdisk/fdisk.c
+++ b/sbin/fdisk/fdisk.c
@@ -217,7 +217,7 @@ static struct part_type
};
static void print_s0(void);
-static void print_part(int i);
+static void print_part(const struct dos_partition *);
static void init_sector0(unsigned long start);
static void init_boot(void);
static void change_part(int i);
@@ -445,20 +445,19 @@ print_s0(void)
print_params();
printf("Information from DOS bootblock is:\n");
- for (i = 1; i <= NDOSPART; i++)
- printf("%d: ", i), print_part(i);
+ for (i = 1; i <= NDOSPART; i++) {
+ printf("%d: ", i);
+ print_part(&mboot.parts[i - 1]);
+ }
}
static struct dos_partition mtpart;
static void
-print_part(int i)
+print_part(const struct dos_partition *partp)
{
- struct dos_partition *partp;
u_int64_t part_mb;
- partp = &mboot.parts[i - 1];
-
if (!bcmp(partp, &mtpart, sizeof (struct dos_partition))) {
printf("<UNUSED>\n");
return;
@@ -546,18 +545,18 @@ change_part(int i)
struct dos_partition *partp = &mboot.parts[i - 1];
printf("The data for partition %d is:\n", i);
- print_part(i);
+ print_part(partp);
if (u_flag && ok("Do you want to change it?")) {
int tmp;
if (i_flag) {
- bzero(partp, sizeof (*partp));
- if (i == 1) {
- init_sector0(1);
- printf("\nThe static data for the slice 1 has been reinitialized to:\n");
- print_part(i);
- }
+ bzero(partp, sizeof (*partp));
+ if (i == 1) {
+ init_sector0(1);
+ printf("\nThe static data for the slice 1 has been reinitialized to:\n");
+ print_part(partp);
+ }
}
do {
@@ -594,7 +593,7 @@ change_part(int i)
} else
dos(partp);
- print_part(i);
+ print_part(partp);
} while (!ok("Are we happy with this entry?"));
}
}
OpenPOWER on IntegriCloud