- char *action;
-
- action = getenv("ACTION");
- if (action != NULL && strlen(action) > ACTION_SIZE)
- action[ACTION_SIZE-1] = '\0';
-
- return action;
-}
-
-char *get_devpath(void)
-{
- char *devpath;
-
- devpath = getenv("DEVPATH");
- if (devpath != NULL && strlen(devpath) > DEVPATH_SIZE)
- devpath[DEVPATH_SIZE-1] = '\0';
-
- return devpath;
+ memset(udev, 0x00, sizeof(struct udevice));
+
+ if (devpath)
+ strfieldcpy(udev->devpath, devpath);
+ if (subsystem)
+ strfieldcpy(udev->subsystem, subsystem);
+ if (action)
+ strfieldcpy(udev->action, action);
+
+ if (strcmp(udev->subsystem, "block") == 0)
+ udev->type = 'b';
+ else if (strcmp(udev->subsystem, "net") == 0)
+ udev->type = 'n';
+ else if (strncmp(udev->devpath, "/block/", 7) == 0)
+ udev->type = 'b';
+ else if (strncmp(udev->devpath, "/class/net/", 11) == 0)
+ udev->type = 'n';
+ else if (strncmp(udev->devpath, "/class/", 7) == 0)
+ udev->type = 'c';