X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=udev.c;h=069cecf973193212f82a89a7c0743e6d256a83fc;hp=c9461469e54273561da1ba0cc1f9fc740c735974;hb=e5e322bc627a07d29a07e08f7c96bd644a3ae057;hpb=56a8a624eef99f5324b54fad466b144aa4f882c2 diff --git a/udev.c b/udev.c index c9461469e..069cecf97 100644 --- a/udev.c +++ b/udev.c @@ -32,11 +32,12 @@ #include #include "libsysfs/sysfs/libsysfs.h" +#include "udev_libc_wrapper.h" #include "udev.h" #include "udev_utils.h" #include "udev_sysfs.h" #include "udev_version.h" -#include "namedev.h" +#include "udev_rules.h" #include "logging.h" @@ -99,7 +100,7 @@ int main(int argc, char *argv[], char *envp[]) struct sysfs_class_device *class_dev; struct sysfs_device *devices_dev; struct udevice udev; - char path[SYSFS_PATH_MAX]; + char path[PATH_SIZE]; const char *error; const char *action; const char *devpath; @@ -153,18 +154,19 @@ int main(int argc, char *argv[], char *envp[]) if (udev_log) setenv("UDEV_LOG", "1", 1); - if (udev.type == BLOCK || udev.type == CLASS || udev.type == NET) { + if (udev.type == DEV_BLOCK || udev.type == DEV_CLASS || udev.type == DEV_NET) { if (strcmp(action, "add") == 0) { /* wait for sysfs and possibly add node */ dbg("udev add"); /* skip subsystems without "dev", but handle net devices */ - if (udev.type != NET && subsystem_expect_no_dev(udev.subsystem)) { + if (udev.type != DEV_NET && subsystem_expect_no_dev(udev.subsystem)) { dbg("don't care about '%s' devices", udev.subsystem); goto hotplug; } - snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, udev.devpath); + snprintf(path, sizeof(path), "%s%s", sysfs_path, udev.devpath); + path[sizeof(path)-1] = '\0'; class_dev = wait_class_device_open(path); if (class_dev == NULL) { dbg ("open class device failed"); @@ -175,7 +177,7 @@ int main(int argc, char *argv[], char *envp[]) wait_for_class_device(class_dev, &error); /* init rules */ - namedev_init(); + udev_rules_init(); /* name, create node, store in db */ retval = udev_add_device(&udev, class_dev); @@ -201,12 +203,13 @@ int main(int argc, char *argv[], char *envp[]) if (udev_dev_d) udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); } - } else if (udev.type == PHYSDEV) { + } else if (udev.type == DEV_DEVICE) { if (strcmp(action, "add") == 0) { /* wait for sysfs */ dbg("devices add"); - snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, devpath); + snprintf(path, sizeof(path), "%s%s", sysfs_path, devpath); + path[sizeof(path)-1] = '\0'; devices_dev = wait_devices_device_open(path); if (!devices_dev) { dbg("devices device unavailable (probably remove has beaten us)");