dbg_parse("remove event should be ignored");
}
/* apply all_partitions option only at a main block device */
- if (dev->partitions && udev->type == 'b' && udev->kernel_number[0] == '\0') {
+ if (dev->partitions && udev->type == BLOCK && udev->kernel_number[0] == '\0') {
udev->partitions = dev->partitions;
dbg("creation of partition nodes requested");
}
strfieldcpy(udev->config_file, dev->config_file);
udev->config_line = dev->config_line;
- if (udev->type != 'n')
+ if (udev->type != 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);
dbg("udev add");
/* skip subsystems without "dev", but handle net devices */
- if (udev.type != 'n' && subsystem_expect_no_dev(udev.subsystem)) {
+ if (udev.type != NET && subsystem_expect_no_dev(udev.subsystem)) {
dbg("don't care about '%s' devices", udev.subsystem);
goto hotplug;
}
#define DEFAULT_PARTITIONS_COUNT 15
+enum device_type {
+ UNKNOWN,
+ CLASS,
+ BLOCK,
+ NET,
+ PHYSDEV,
+};
+
struct udevice {
char devpath[DEVPATH_SIZE];
char subsystem[SUBSYSTEM_SIZE];
create:
switch (udev->type) {
- case 'b':
+ case BLOCK:
mode |= S_IFBLK;
break;
- case 'c':
- case 'u':
+ case CLASS:
mode |= S_IFCHR;
break;
- case 'p':
- mode |= S_IFIFO;
- break;
default:
dbg("unknown node type %c\n", udev->type);
return -EINVAL;
char *pos;
int retval = 0;
- if (udev->type == 'b' || udev->type == 'c') {
+ if (udev->type == BLOCK || udev->type == CLASS) {
udev->devt = get_devt(class_dev);
if (!udev->devt) {
dbg("no dev-file found, do nothing");
selinux_init();
- if (udev->type == 'b' || udev->type == 'c') {
+ if (udev->type == BLOCK || udev->type == CLASS) {
retval = create_node(udev, class_dev);
if (retval != 0)
goto exit;
snprintf(udev->devname, NAME_SIZE, "%s/%s", udev_root, udev->name);
udev->devname[NAME_SIZE-1] = '\0';
- } else if (udev->type == 'n') {
+ } else if (udev->type == 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;
int retval;
- if (udev->type != 'b' && udev->type != 'c')
+ if (udev->type != BLOCK && udev->type != CLASS)
return 0;
retval = udev_db_get_device(udev);
strfieldcpy(udev->subsystem, subsystem);
if (strcmp(udev->subsystem, "block") == 0)
- udev->type = 'b';
+ udev->type = BLOCK;
else if (strcmp(udev->subsystem, "net") == 0)
- udev->type = 'n';
+ udev->type = NET;
else if (strncmp(udev->devpath, "/block/", 7) == 0)
- udev->type = 'b';
+ udev->type = BLOCK;
else if (strncmp(udev->devpath, "/class/net/", 11) == 0)
- udev->type = 'n';
+ udev->type = NET;
else if (strncmp(udev->devpath, "/class/", 7) == 0)
- udev->type = 'c';
+ udev->type = CLASS;
udev->mode = 0660;
strcpy(udev->owner, "root");
udev_init_device(&udev, devpath, subsystem);
/* skip subsystems without "dev", but handle net devices */
- if (udev.type != 'n' && subsystem_expect_no_dev(udev.subsystem)) {
+ if (udev.type != NET && subsystem_expect_no_dev(udev.subsystem)) {
info("don't care about '%s' devices", udev.subsystem);
return 2;
}