diff options
author | Karel Zak | 2010-03-10 15:41:40 +0100 |
---|---|---|
committer | Karel Zak | 2010-03-10 15:41:40 +0100 |
commit | 3069624180bac35f1cd468249ddb9dfc91d1b7b1 (patch) | |
tree | 7bc8f8ed5fa6ca4bd95530156b1073072c894a0b /shlibs/blkid/src/probe.c | |
parent | libblkid: reset BLKID_TINY_DEV flag in blkid_probe_set_device (diff) | |
download | kernel-qcow2-util-linux-3069624180bac35f1cd468249ddb9dfc91d1b7b1.tar.gz kernel-qcow2-util-linux-3069624180bac35f1cd468249ddb9dfc91d1b7b1.tar.xz kernel-qcow2-util-linux-3069624180bac35f1cd468249ddb9dfc91d1b7b1.zip |
liblkid: move getsize.c code to lib/
.. and cleanup blkdev_get_size() usage in libblkid.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/blkid/src/probe.c')
-rw-r--r-- | shlibs/blkid/src/probe.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/shlibs/blkid/src/probe.c b/shlibs/blkid/src/probe.c index 6e8513d22..4ca215b08 100644 --- a/shlibs/blkid/src/probe.c +++ b/shlibs/blkid/src/probe.c @@ -591,9 +591,13 @@ int blkid_probe_set_device(blkid_probe pr, int fd, pr->mode = sb.st_mode; - if (S_ISBLK(sb.st_mode)) - blkdev_get_size(fd, (unsigned long long *) &pr->size); - else if (S_ISCHR(sb.st_mode)) + if (S_ISBLK(sb.st_mode)) { + if (blkdev_get_size(fd, (unsigned long long *) &pr->size)) { + DBG(DEBUG_LOWPROBE, printf( + "failed to get device size\n")); + goto err; + } + } else if (S_ISCHR(sb.st_mode)) pr->size = 1; /* UBI devices are char... */ else if (S_ISREG(sb.st_mode)) pr->size = sb.st_size; /* regular file */ @@ -975,7 +979,11 @@ dev_t blkid_probe_get_devno(blkid_probe pr) * blkid_probe_get_size: * @pr: probe * - * Returns: block device (or file) size in bytes or -1 in case of error. + * This function returns size of probing area as defined by blkid_probe_set_device(). + * If the size of the probing area is unrestricted then this function returns + * the real size of device. See also blkid_get_dev_size(). + * + * Returns: size in bytes or -1 in case of error. */ blkid_loff_t blkid_probe_get_size(blkid_probe pr) { |