]> err.no Git - systemd/commitdiff
[PATCH] correct enum device_type
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Sat, 12 Mar 2005 20:41:57 +0000 (21:41 +0100)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 06:53:17 +0000 (23:53 -0700)
namedev.c
udev.c
udev.h
udev_add.c
udev_remove.c
udev_utils.c
udevtest.c

index cd1f2de989ea1036319479c3e7374a33d3270e4e..fd1cf0458a27f7c533967624b91f264e74a9243c 100644 (file)
--- 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 bf2eb373f82765b6ec77c10f0c43f68c5b465d07..8ce813fbf516cffdfba0fdece3f73abd35ee9459 100644 (file)
--- 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 7eb07bf125c375d7eeed2b68cbcd5bf80caa0151..6e41bb5d26770d288d1e522b3a76454be7eb6d39 100644 (file)
--- a/udev.h
+++ b/udev.h
 #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];
index 42b8d2104c0e6a83c3e47ac1f575004dbdb131de..bf5feb1b2d61cc387f03db5c768db98692b17470 100644 (file)
@@ -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);
index c3a7880b496cb2a9d25554a5e5a59b92daef83c5..a81d20c98c7a3f1aaf7878177262479d96438f7a 100644 (file)
@@ -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) {
index afa9790fdc6aa17fc0e85bb0b02cf230745dbf97..b650096593308f7e0e7e6c67ff64c5895940cc55 100644 (file)
@@ -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, '/');
index 5ce257005804460dbaf35cfd3bcb0a6d74cf0294..1e0037978beca92797abad2a628f7cb32fb4ef7d 100644 (file)
@@ -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;
        }