Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/fdisk Allow -1 values in the -s <sysid>/<start>/<size> ...
details: https://anonhg.NetBSD.org/src/rev/351553565467
branches: trunk
changeset: 328310:351553565467
user: christos <christos%NetBSD.org@localhost>
date: Sun Mar 30 22:18:13 2014 +0000
description:
Allow -1 values in the -s <sysid>/<start>/<size> indicate use the previous
values. For example:
fdisk -f -i /dev/rsd0d # initialize mbr and create an msdos partition.
fdisk -f -u -0 -a -s 169/-1/-1 /dev/rsd0d # converts the msdos partition
to a netbsd one, and makes it active.
diffstat:
sbin/fdisk/fdisk.c | 23 ++++++++++++++++-------
1 files changed, 16 insertions(+), 7 deletions(-)
diffs (44 lines):
diff -r a1dae3a7fe2e -r 351553565467 sbin/fdisk/fdisk.c
--- a/sbin/fdisk/fdisk.c Sun Mar 30 21:52:09 2014 +0000
+++ b/sbin/fdisk/fdisk.c Sun Mar 30 22:18:13 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdisk.c,v 1.146 2014/03/10 15:42:51 jakllsch Exp $ */
+/* $NetBSD: fdisk.c,v 1.147 2014/03/30 22:18:13 christos Exp $ */
/*
* Mach Operating System
@@ -39,7 +39,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fdisk.c,v 1.146 2014/03/10 15:42:51 jakllsch Exp $");
+__RCSID("$NetBSD: fdisk.c,v 1.147 2014/03/30 22:18:13 christos Exp $");
#endif /* not lint */
#define MBRPTYPENAMES
@@ -2027,11 +2027,20 @@
tmp_bootmenu[0] = 0;
#endif
- if (!s_flag && partp != NULL) {
- /* values not specified, default to current ones */
- sysid = partp->mbrp_type;
- start = offset + le32toh(partp->mbrp_start);
- size = le32toh(partp->mbrp_size);
+ if (partp != NULL) {
+ if (!s_flag) {
+ /* values not specified, default to current ones */
+ sysid = partp->mbrp_type;
+ start = offset + le32toh(partp->mbrp_start);
+ size = le32toh(partp->mbrp_size);
+ } else {
+ if (sysid == -1)
+ sysid = partp->mbrp_type;
+ if (start == (daddr_t)0xffffffff)
+ start = offset + le32toh(partp->mbrp_start);
+ if (size == (daddr_t)0xffffffff)
+ size = le32toh(partp->mbrp_size);
+ }
}
/* creating a new partition, default to free space */
Home |
Main Index |
Thread Index |
Old Index