-static int hotplug_mode;
-
-void log_message (int level, const char *format, ...)
-{
- va_list args;
-
- if (!debug && level == LOG_DEBUG)
- return;
-
- va_start (args, format);
- if (!hotplug_mode || use_stderr) {
- vfprintf(stderr, format, args);
- } else {
- static int logging_init = 0;
- static unsigned char logname[32];
- if (!logging_init) {
- /*
- * klibc does not have LOG_PID.
- */
- snprintf(logname, 32, "scsi_id[%d]", getpid());
- openlog (logname, 0, LOG_DAEMON);
- logging_init = 1;
- }
-
- vsyslog(level, format, args);
- }
- va_end (args);
- return;
-}
-
-static int sysfs_get_actual_dev(const char *sysfs_path, char *dev, int len)
-{
- dprintf("%s\n", sysfs_path);
- strncpy(dev, sysfs_path, len);
- strncat(dev, "/device", len);
- if (sysfs_get_link(dev, dev, len)) {
- if (!hotplug_mode)
- log_message(LOG_WARNING, "%s: %s\n", dev,
- strerror(errno));
- return -1;
- }
- return 0;
-}
-
-/*
- * sysfs_is_bus: Given the sysfs_path to a device, return 1 if sysfs_path
- * is on bus, 0 if not on bus, and < 0 on error
- */
-static int sysfs_is_bus(const char *sysfs_path, const char *bus)
-{
- char bus_dev_name[SYSFS_PATH_MAX];
- char bus_id[SYSFS_NAME_LEN];
- struct stat stat_buf;
- ino_t dev_inode;
-
- dprintf("%s\n", sysfs_path);
-
- if (sysfs_get_name_from_path(sysfs_path, bus_id, SYSFS_NAME_LEN))
- return -1;
-
- snprintf(bus_dev_name, MAX_NAME_LEN, "%s/%s/%s/%s/%s", sysfs_mnt_path,
- SYSFS_BUS_NAME, bus, SYSFS_DEVICES_NAME, bus_id);
-
- if (stat(sysfs_path, &stat_buf))
- return -1;
- dev_inode = stat_buf.st_ino;
-
- if (stat(bus_dev_name, &stat_buf)) {
- if (errno == ENOENT)
- return 0;
- else
- return -1;
- }
- if (dev_inode == stat_buf.st_ino)
- return 1;
- else
- return 0;
-}
-
-static int get_major_minor(const char *devpath, int *major, int *minor)
+static int reformat_serial;
+static int export;
+static char vendor_str[64];
+static char model_str[64];
+static char vendor_enc_str[256];
+static char model_enc_str[256];
+static char revision_str[16];
+static char type_str[16];
+
+static void log_fn(struct udev *udev, int priority,
+ const char *file, int line, const char *fn,
+ const char *format, va_list args)