summaryrefslogtreecommitdiff
path: root/extras/volume_id/udev_volume_id.c
diff options
context:
space:
mode:
Diffstat (limited to 'extras/volume_id/udev_volume_id.c')
-rw-r--r--extras/volume_id/udev_volume_id.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c
index e88445054b..6b62db0775 100644
--- a/extras/volume_id/udev_volume_id.c
+++ b/extras/volume_id/udev_volume_id.c
@@ -24,8 +24,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <string.h>
#include <ctype.h>
-#include <linux/fs.h>
#include <sys/ioctl.h>
#include "../../libsysfs/sysfs/libsysfs.h"
@@ -34,6 +34,8 @@
#include "volume_id.h"
#include "dasdlabel.h"
+#define BLKGETSIZE64 _IOR(0x12,114,size_t)
+
#ifdef LOG
unsigned char logname[LOGNAME_SIZE];
void log_message(int level, const char *format, ...)
@@ -73,16 +75,6 @@ static struct volume_id *open_classdev(struct sysfs_class_device *class_dev)
return vid;
}
-static unsigned long long get_size(struct volume_id *vid)
-{
- unsigned long long size;
-
- if (ioctl(vid->fd, BLKGETSIZE64, &size) != 0)
- size = 0;
-
- return size;
-}
-
static char *usage_id_name(enum volume_id_usage usage)
{
switch(usage) {
@@ -181,7 +173,8 @@ int main(int argc, char *argv[])
if (vid == NULL)
goto exit;
- size = get_size(vid);
+ if (ioctl(vid->fd, BLKGETSIZE64, &size) != 0)
+ size = 0;
if (volume_id_probe(vid, VOLUME_ID_ALL, 0, size) == 0)
goto print;