summaryrefslogtreecommitdiffstats
path: root/fdisk/fdisk.c
diff options
context:
space:
mode:
authorDavidlohr Bueso2012-04-04 19:01:24 +0200
committerKarel Zak2012-04-10 12:21:16 +0200
commit64128b705c2137706bb7ed3a15d3803509e0a63e (patch)
tree388b8384852de4bb4f90ddfad39f65fabfd6e171 /fdisk/fdisk.c
parentfsck: don't free fstab table on parse failure (diff)
downloadkernel-qcow2-util-linux-64128b705c2137706bb7ed3a15d3803509e0a63e.tar.gz
kernel-qcow2-util-linux-64128b705c2137706bb7ed3a15d3803509e0a63e.tar.xz
kernel-qcow2-util-linux-64128b705c2137706bb7ed3a15d3803509e0a63e.zip
fdisk: move kernel geometry into blkdev
This is a more generic place for this ioctl. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Diffstat (limited to 'fdisk/fdisk.c')
-rw-r--r--fdisk/fdisk.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index 8893a0174..126efb378 100644
--- a/fdisk/fdisk.c
+++ b/fdisk/fdisk.c
@@ -954,19 +954,6 @@ get_topology(int fd) {
}
static void
-get_kernel_geometry(int fd) {
-#ifdef HDIO_GETGEO
- struct hd_geometry geometry;
-
- if (!ioctl(fd, HDIO_GETGEO, &geometry)) {
- kern_heads = geometry.heads;
- kern_sectors = geometry.sectors;
- /* never use geometry.cylinders - it is truncated */
- }
-#endif
-}
-
-static void
get_partition_table_geometry(void) {
unsigned char *bufp = MBRbuffer;
struct partition *p;
@@ -1057,7 +1044,7 @@ get_geometry(int fd, struct geom *g) {
kern_heads = kern_sectors = 0;
pt_heads = pt_sectors = 0;
- get_kernel_geometry(fd);
+ blkdev_get_geometry(fd, &kern_heads, &kern_sectors);
get_partition_table_geometry();
heads = user_heads ? user_heads :