From e6764498e7592f216a1895eacc485448fa4a1660 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 12 Mar 2005 21:41:57 +0100 Subject: [PATCH] [PATCH] correct enum device_type --- namedev.c | 4 ++-- udev.c | 6 +++--- udev.h | 12 ++++++------ udev_add.c | 10 +++++----- udev_remove.c | 2 +- udev_utils.c | 8 ++++---- udevtest.c | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/namedev.c b/namedev.c index cd1f2de98..fd1cf0458 100644 --- a/namedev.c +++ b/namedev.c @@ -698,7 +698,7 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d dbg_parse("remove event should be ignored"); } /* apply all_partitions option only at a main block device */ - if (dev->partitions && udev->type == BLOCK && udev->kernel_number[0] == '\0') { + if (dev->partitions && udev->type == DEV_BLOCK && udev->kernel_number[0] == '\0') { udev->partitions = dev->partitions; dbg("creation of partition nodes requested"); } @@ -753,7 +753,7 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d strlcpy(udev->config_file, dev->config_file, sizeof(udev->config_file)); udev->config_line = dev->config_line; - if (udev->type != NET) + if (udev->type != DEV_NET) dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", udev->name, udev->owner, udev->group, udev->mode, udev->partitions); diff --git a/udev.c b/udev.c index bf2eb373f..8ce813fbf 100644 --- a/udev.c +++ b/udev.c @@ -154,13 +154,13 @@ 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; } @@ -203,7 +203,7 @@ 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"); diff --git a/udev.h b/udev.h index 7eb07bf12..6e41bb5d2 100644 --- a/udev.h +++ b/udev.h @@ -48,24 +48,24 @@ #define DEFAULT_PARTITIONS_COUNT 15 enum device_type { - UNKNOWN, - CLASS, - BLOCK, - NET, - PHYSDEV, + DEV_UNKNOWN, + DEV_CLASS, + DEV_BLOCK, + DEV_NET, + DEV_DEVICE, }; struct udevice { char devpath[PATH_SIZE]; char subsystem[NAME_SIZE]; + enum device_type type; char name[PATH_SIZE]; char devname[PATH_SIZE]; struct list_head symlink_list; char owner[USER_SIZE]; char group[USER_SIZE]; mode_t mode; - char type; dev_t devt; char tmp_node[PATH_SIZE]; diff --git a/udev_add.c b/udev_add.c index 42b8d2104..bf5feb1b2 100644 --- a/udev_add.c +++ b/udev_add.c @@ -70,10 +70,10 @@ int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mo create: switch (udev->type) { - case BLOCK: + case DEV_BLOCK: mode |= S_IFBLK; break; - case CLASS: + case DEV_CLASS: mode |= S_IFCHR; break; default: @@ -268,7 +268,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) char *pos; int retval = 0; - if (udev->type == BLOCK || udev->type == CLASS) { + if (udev->type == DEV_BLOCK || udev->type == DEV_CLASS) { udev->devt = get_devt(class_dev); if (!udev->devt) { dbg("no dev-file found, do nothing"); @@ -283,7 +283,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) selinux_init(); - if (udev->type == BLOCK || udev->type == CLASS) { + if (udev->type == DEV_BLOCK || udev->type == DEV_CLASS) { retval = create_node(udev, class_dev); if (retval != 0) goto exit; @@ -296,7 +296,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) snprintf(udev->devname, sizeof(udev->devname), "%s/%s", udev_root, udev->name); udev->devname[sizeof(udev->devname)-1] = '\0'; - } else if (udev->type == NET) { + } else if (udev->type == DEV_NET) { /* look if we want to change the name of the netif */ if (strcmp(udev->name, udev->kernel_name) != 0) { retval = rename_net_if(udev); diff --git a/udev_remove.c b/udev_remove.c index c3a7880b4..a81d20c98 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -143,7 +143,7 @@ int udev_remove_device(struct udevice *udev) { const char *temp; - if (udev->type != BLOCK && udev->type != CLASS) + if (udev->type != DEV_BLOCK && udev->type != DEV_CLASS) return 0; if (udev_db_get_device(udev, udev->devpath) == 0) { diff --git a/udev_utils.c b/udev_utils.c index afa9790fd..b65009659 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -53,13 +53,13 @@ int udev_init_device(struct udevice *udev, const char* devpath, const char *subs no_trailing_slash(udev->devpath); if (strncmp(udev->devpath, "/block/", 7) == 0) - udev->type = BLOCK; + udev->type = DEV_BLOCK; else if (strncmp(udev->devpath, "/class/net/", 11) == 0) - udev->type = NET; + udev->type = DEV_NET; else if (strncmp(udev->devpath, "/class/", 7) == 0) - udev->type = CLASS; + udev->type = DEV_CLASS; else if (strncmp(udev->devpath, "/devices/", 9) == 0) - udev->type = PHYSDEV; + udev->type = DEV_DEVICE; /* get kernel name */ pos = strrchr(udev->devpath, '/'); diff --git a/udevtest.c b/udevtest.c index 5ce257005..1e0037978 100644 --- a/udevtest.c +++ b/udevtest.c @@ -92,7 +92,7 @@ int main(int argc, char *argv[], char *envp[]) udev_init_device(&udev, devpath, subsystem); /* 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)) { info("don't care about '%s' devices", udev.subsystem); return 2; } -- 2.30.2