diff options
author | Karel Zak | 2009-02-26 15:28:11 +0100 |
---|---|---|
committer | Karel Zak | 2009-02-26 15:58:28 +0100 |
commit | 0d518f34204043e798300893d19e81a7a377a316 (patch) | |
tree | 6051c5f0efc188364c05df28a7514b7452fa1a42 /partx/partx.c | |
parent | partx: convert hard sector size to 512-byte sectors (diff) | |
download | kernel-qcow2-util-linux-0d518f34204043e798300893d19e81a7a377a316.tar.gz kernel-qcow2-util-linux-0d518f34204043e798300893d19e81a7a377a316.tar.xz kernel-qcow2-util-linux-0d518f34204043e798300893d19e81a7a377a316.zip |
partx: don't duplicate lib/blkdev.c code
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'partx/partx.c')
-rw-r--r-- | partx/partx.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/partx/partx.c b/partx/partx.c index f911c57a4..86507422a 100644 --- a/partx/partx.c +++ b/partx/partx.c @@ -42,7 +42,8 @@ #include <linux/compiler.h> #endif #include <linux/blkpg.h> -#define BLKGETSIZE _IO(0x12,96) /* return device size */ + +#include "blkdev.h" #include "partx.h" #include "crc32.h" @@ -99,7 +100,7 @@ int force_gpt=0; int main(int argc, char **argv){ int fd, fd2, c, i, j, k, n; - long size; + unsigned long long size; struct hd_geometry g; struct slice all; struct blkpg_ioctl_arg a; @@ -240,11 +241,11 @@ main(int argc, char **argv){ } all.start = g.start; - if(ioctl(fd2, BLKGETSIZE, &size)) { - perror("BLKGETSIZE"); + if (blkdev_get_sectors(fd2, &size) != 0) { + perror("partx"); exit(1); } - all.size = size; + all.size = (unsigned int) size; if (verbose) printf("device %s: start %d size %d\n", |