From: Karel Zak Date: Thu, 26 Feb 2009 14:28:11 +0000 (+0100) Subject: partx: don't duplicate lib/blkdev.c code X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d518f34204043e798300893d19e81a7a377a316;p=util-linux partx: don't duplicate lib/blkdev.c code Signed-off-by: Karel Zak --- diff --git a/partx/partx.c b/partx/partx.c index f911c57a..86507422 100644 --- a/partx/partx.c +++ b/partx/partx.c @@ -42,7 +42,8 @@ #include #endif #include -#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",