diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2008-07-24 01:15:07 +0200 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2008-07-24 01:15:07 +0200 |
commit | 098fa6b1201bd66bc8fcb54b103ff241e3136dca (patch) | |
tree | 09904b63e53f7e7bbc083cd111833200aeae7c92 /disk-utils/fsck.cramfs.c | |
parent | 6b0054a2c6dddb43155220cac13848df98d74423 (diff) | |
download | util-linux-old-098fa6b1201bd66bc8fcb54b103ff241e3136dca.tar.gz |
disk-utils: clean up code, use blkdev_* functions
[kzak@redhat.com: split the original patch to small patches]
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/fsck.cramfs.c')
-rw-r--r-- | disk-utils/fsck.cramfs.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/disk-utils/fsck.cramfs.c b/disk-utils/fsck.cramfs.c index 2a63ac90..2d082efb 100644 --- a/disk-utils/fsck.cramfs.c +++ b/disk-utils/fsck.cramfs.c @@ -56,8 +56,7 @@ #include "cramfs.h" #include "nls.h" - -#define BLKGETSIZE _IO(0x12,96) /* return device size */ +#include "blkdev.h" static const char *progname = "cramfsck"; @@ -152,10 +151,11 @@ static void test_super(int *start, size_t *length) { die(FSCK_ERROR, 1, "open failed: %s", filename); } if (S_ISBLK(st.st_mode)) { - if (ioctl(fd, BLKGETSIZE, length) < 0) { + unsigned long long bytes; + if (blkdev_get_size(fd, &bytes)) { die(FSCK_ERROR, 1, "ioctl failed: unable to determine device size: %s", filename); } - *length = *length * 512; + *length = bytes; } else if (S_ISREG(st.st_mode)) { *length = st.st_size; |