- char *pos;
-
- memset(udev, 0x00, sizeof(struct udevice));
- INIT_LIST_HEAD(&udev->symlink_list);
-
- if (subsystem)
- strlcpy(udev->subsystem, subsystem, sizeof(udev->subsystem));
-
- if (devpath) {
- strlcpy(udev->devpath, devpath, sizeof(udev->devpath));
- no_trailing_slash(udev->devpath);
-
- if (strncmp(udev->devpath, "/block/", 7) == 0)
- udev->type = BLOCK;
- else if (strncmp(udev->devpath, "/class/net/", 11) == 0)
- udev->type = NET;
- else if (strncmp(udev->devpath, "/class/", 7) == 0)
- udev->type = CLASS;
- else if (strncmp(udev->devpath, "/devices/", 9) == 0)
- udev->type = PHYSDEV;
-
- /* get kernel name */
- pos = strrchr(udev->devpath, '/');
- if (pos) {
- strlcpy(udev->kernel_name, &pos[1], sizeof(udev->kernel_name));
- dbg("kernel_name='%s'", udev->kernel_name);
-
- /* Some block devices have '!' in their name, change that to '/' */
- pos = udev->kernel_name;
- while (pos[0] != '\0') {
- if (pos[0] == '!')
- pos[0] = '/';
- pos++;