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");
}
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);
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;
}
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");
#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];
create:
switch (udev->type) {
- case BLOCK:
+ case DEV_BLOCK:
mode |= S_IFBLK;
break;
- case CLASS:
+ case DEV_CLASS:
mode |= S_IFCHR;
break;
default:
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");
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;
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);
{
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) {
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, '/');
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;
}