summaryrefslogtreecommitdiff
path: root/fdisk
diff options
context:
space:
mode:
authorLuciano Chavez <lnx1138@us.ibm.com>2007-03-08 21:07:52 -0600
committerKarel Zak <kzak@redhat.com>2007-06-26 13:21:25 +0200
commit653872612c2249dd892f5f2f6cc9b1e3abd24b45 (patch)
tree2e2c476c91891dcd582f5bb84585f4e1be0e135c /fdisk
parent9f70f8b143d591b44b57454bf346bc291875dd75 (diff)
downloadutil-linux-old-653872612c2249dd892f5f2f6cc9b1e3abd24b45.tar.gz
sfdisk: setting default geometry values
The cfdisk and fdisk set defaults for heads and sectors in order to handle a situation when the get_geometry() ends up with zeroes for the disk geometry for device-mapper devices. This patch add same functionally to sfdisk. You know that a dmsetup setgeometry of the the dm device can be used to circumvent the issue but users may not immediately realize they need to do that.
Diffstat (limited to 'fdisk')
-rw-r--r--fdisk/sfdisk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index 79e9c20e..baacc077 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -469,8 +469,8 @@ get_cylindersize(char *dev, int fd, int silent) {
R = get_geometry(dev, fd, silent);
- B.heads = (U.heads ? U.heads : R.heads);
- B.sectors = (U.sectors ? U.sectors : R.sectors);
+ B.heads = (U.heads ? U.heads : R.heads ? R.heads : 255);
+ B.sectors = (U.sectors ? U.sectors : R.sectors ? R.sectors : 63);
B.cylinders = (U.cylinders ? U.cylinders : R.cylinders);
B.cylindersize = B.heads * B.sectors;