#include <sys/ioctl.h>
#include "../../libsysfs/sysfs/libsysfs.h"
-#include "../../udev_lib.h"
+#include "../../udev_utils.h"
#include "../../logging.h"
#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, ...)
{
va_list args;
" -d disk label from main device\n"
"\n";
static const char short_options[] = "htlud";
- char sysfs_path[SYSFS_PATH_MAX];
+ char sysfs_mnt_path[SYSFS_PATH_MAX];
char dev_path[SYSFS_PATH_MAX];
struct sysfs_class_device *class_dev = NULL;
struct sysfs_class_device *class_dev_parent = NULL;
unsigned long long size;
int rc = 1;
+ logging_init("udev_volume_id");
+
while (1) {
int option;
goto exit;
}
- if (sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX) != 0) {
+ if (sysfs_get_mnt_path(sysfs_mnt_path, SYSFS_PATH_MAX) != 0) {
printf("error getting sysfs mount path\n");
goto exit;
}
- strfieldcpy(dev_path, sysfs_path);
+ strfieldcpy(dev_path, sysfs_mnt_path);
strfieldcat(dev_path, devpath);
class_dev = sysfs_open_class_device_path(dev_path);
if (class_dev_parent != NULL)
vid = open_classdev(class_dev_parent);
else
- vid = open_classdev(class_dev_parent);
+ vid = open_classdev(class_dev);
if (vid == NULL)
goto exit;
if (vid != NULL)
volume_id_close(vid);
+ logging_close();
+
exit(rc);
}