mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-24 21:34:08 +03:00
[PATCH] correct enum device_type
This commit is contained in:
parent
319112e295
commit
e6764498e7
@ -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);
|
||||
|
||||
|
6
udev.c
6
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");
|
||||
|
12
udev.h
12
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];
|
||||
|
10
udev_add.c
10
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);
|
||||
|
@ -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) {
|
||||
|
@ -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, '/');
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user