summaryrefslogtreecommitdiff
path: root/extras/volume_id/udev_volume_id.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-09-18 23:22:27 -0700
committerGreg KH <gregkh@suse.de>2005-04-26 21:37:01 -0700
commit9e8a3a095d955538acbdf28dba02582f6b2330e5 (patch)
tree2ef40834b44ef1d030ba73314d5c4ebad00d0848 /extras/volume_id/udev_volume_id.c
parentcdc60e8afb06a0688e4b9f166625d4d0b8805e68 (diff)
[PATCH] volume-id build fix and update
Let's try it another way: We define BLKGETSIZE64 in udev-volume_id.c now, cause including <fs.h> does also not work with klibc. This hopefully fixes your compile problem too. Also included is an update to udev_volume_id with the latest fixes for volume_id. It adds a simple logging file to map the debug function, that we can use exactly the same files in HAL and udev.
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;