summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2005-03-12 21:41:57 +0100
committerGreg KH <gregkh@suse.de>2005-04-26 23:53:17 -0700
commite6764498e7592f216a1895eacc485448fa4a1660 (patch)
tree11c81e7174f0bcb5774568f569985589584fbc19
parent319112e295bbf1ed5d86389190abbe24ce251b14 (diff)
[PATCH] correct enum device_type
-rw-r--r--namedev.c4
-rw-r--r--udev.c6
-rw-r--r--udev.h12
-rw-r--r--udev_add.c10
-rw-r--r--udev_remove.c2
-rw-r--r--udev_utils.c8
-rw-r--r--udevtest.c2
7 files changed, 22 insertions, 22 deletions
diff --git a/namedev.c b/namedev.c
index cd1f2de989..fd1cf0458a 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 bf2eb373f8..8ce813fbf5 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 7eb07bf125..6e41bb5d26 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 42b8d2104c..bf5feb1b2d 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 c3a7880b49..a81d20c98c 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 afa9790fdc..b650096593 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 5ce2570058..1e0037978b 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;
}