- if (devpath)
- strfieldcpy(udev->devpath, devpath);
- if (subsystem)
- strfieldcpy(udev->subsystem, subsystem);
-
- 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';
-
- udev->mode = 0660;
- strcpy(udev->owner, "root");
- strcpy(udev->group, "root");
-}
-
-int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, unsigned int sublevel)
-{
- static unsigned int kversion = 0;
- static unsigned int kpatchlevel;
- static unsigned int ksublevel;
-
- if (kversion == 0) {
- struct utsname uts;
- if (uname(&uts) != 0)
- return -1;
-
- if (sscanf (uts.release, "%u.%u.%u", &kversion, &kpatchlevel, &ksublevel) != 3) {
- kversion = 0;
- return -1;
- }
- }
-
- if (kversion >= version && kpatchlevel >= patchlevel && ksublevel >= sublevel)
- return 1;
- else
- return 0;
-}
-
-int create_path(const char *path)
-{
- char p[NAME_SIZE];
- char *pos;
- struct stat stats;
-
- strcpy (p, path);
- pos = strrchr(p, '/');
- if (pos == p || pos == NULL)
- return 0;
-
- while (pos[-1] == '/')
- pos--;
-
- pos[0] = '\0';
-
- dbg("stat '%s'\n", p);
- if (stat (p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR)
- return 0;
-
- if (create_path (p) != 0)
- return -1;
-
- dbg("mkdir '%s'\n", p);
- return mkdir(p, 0755);
-}
-
-int parse_get_pair(char **orig_string, char **left, char **right)
-{
- char *temp;
- char *string = *orig_string;
-
- if (!string)
- return -ENODEV;
-
- /* eat any whitespace */
- while (isspace(*string) || *string == ',')
- ++string;
-
- /* split based on '=' */
- temp = strsep(&string, "=");
- *left = temp;
- if (!string)
- return -ENODEV;
-
- /* take the right side and strip off the '"' */
- while (isspace(*string))
- ++string;
- if (*string == '"')
- ++string;
- else
- return -ENODEV;
-
- temp = strsep(&string, "\"");
- if (!string || *temp == '\0')
- return -ENODEV;
- *right = temp;
- *orig_string = string;
-