-#include "logging.h"
-#include "udev_utils.h"
-#include "list.h"
-
-
-void udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem)
-{
- memset(udev, 0x00, sizeof(struct udevice));
-
- if (devpath)
- strfieldcpy(udev->devpath, devpath);
- if (subsystem)
- strfieldcpy(udev->subsystem, subsystem);
-
- if (strcmp(udev->subsystem, "block") == 0)
- udev->type = BLOCK;
- else if (strcmp(udev->subsystem, "net") == 0)
- udev->type = NET;
- else 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;
-
- 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;