summaryrefslogtreecommitdiffstats
path: root/fdisk/fdisk.c
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:26:02 +0100
committerKarel Zak2006-12-07 00:26:02 +0100
commit0e6f4a203d8715710ff09683390be2897cca3804 (patch)
tree982a4e50be23b6c30245c61bfed170c592b34e41 /fdisk/fdisk.c
parentImported from util-linux-2.11u tarball. (diff)
downloadkernel-qcow2-util-linux-0e6f4a203d8715710ff09683390be2897cca3804.tar.gz
kernel-qcow2-util-linux-0e6f4a203d8715710ff09683390be2897cca3804.tar.xz
kernel-qcow2-util-linux-0e6f4a203d8715710ff09683390be2897cca3804.zip
Imported from util-linux-2.11v tarball.
Diffstat (limited to 'fdisk/fdisk.c')
-rw-r--r--fdisk/fdisk.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index 1ff518411..a1d84e561 100644
--- a/fdisk/fdisk.c
+++ b/fdisk/fdisk.c
@@ -1269,7 +1269,9 @@ change_sysid(void) {
origsys = sys = get_sysid(i);
- if (!sys && !sgi_label && !sun_label)
+ /* if changing types T to 0 is allowed, then
+ the reverse change must be allowed, too */
+ if (!sys && !sgi_label && !sun_label && !get_nr_sects(p))
printf(_("Partition %d does not exist yet!\n"), i + 1);
else while (1) {
sys = read_hex (get_sys_types());
@@ -1304,7 +1306,7 @@ change_sysid(void) {
"partition 11 as entire volume (6)"
"as IRIX expects it.\n\n"));
if (sys == origsys)
- break;
+ break;
if (sun_label) {
sun_change_sysid(i, sys);
} else
@@ -2316,12 +2318,17 @@ main(int argc, char **argv) {
* fdisk -l [-b sectorsize] [-u] device ...
* fdisk -s [partition] ...
* fdisk [-b sectorsize] [-u] device
+ *
+ * Options -C, -H, -S set the geometry.
+ *
*/
- while ((c = getopt(argc, argv, "b:lsuvV")) != -1) {
+ while ((c = getopt(argc, argv, "b:C:H:lsS:uvV")) != -1) {
switch (c) {
case 'b':
- /* ugly: this sector size is really per device,
- so cannot be combined with multiple disks */
+ /* Ugly: this sector size is really per device,
+ so cannot be combined with multiple disks,
+ and te same goes for the C/H/S options.
+ */
sector_size = atoi(optarg);
if (sector_size != 512 && sector_size != 1024 &&
sector_size != 2048)
@@ -2329,6 +2336,19 @@ main(int argc, char **argv) {
sector_offset = 2;
user_set_sector_size = 1;
break;
+ case 'C':
+ user_cylinders = atoi(optarg);
+ break;
+ case 'H':
+ user_heads = atoi(optarg);
+ if (user_heads <= 0 || user_heads >= 256)
+ user_heads = 0;
+ break;
+ case 'S':
+ user_sectors = atoi(optarg);
+ if (user_sectors <= 0 || user_sectors >= 64)
+ user_sectors = 0;
+ break;
case 'l':
optl = 1;
break;