-/*
- * the major/minor of a device is stored in a file called "dev"
- * The number is stored in decimal values in the format: M:m
- */
-static int get_major_minor(struct sysfs_class_device *class_dev, struct udevice *udev)
-{
- struct sysfs_attribute *attr = NULL;
-
- attr = sysfs_get_classdev_attr(class_dev, "dev");
- if (attr == NULL)
- goto error;
- dbg("dev='%s'", attr->value);
-
- if (sscanf(attr->value, "%u:%u", &udev->major, &udev->minor) != 2)
- goto error;
- dbg("found major=%d, minor=%d", udev->major, udev->minor);
-
- return 0;
-error:
- return -1;
-}
-
-static int create_path(char *file)
-{
- char p[NAME_SIZE];
- char *pos;
- int retval;
- struct stat stats;
-
- strfieldcpy(p, file);
- pos = strchr(p+1, '/');
- while (1) {
- pos = strchr(pos+1, '/');
- if (pos == NULL)
- break;
- *pos = 0x00;
- if (stat(p, &stats)) {
- selinux_setfscreatecon(p, S_IFDIR);
- retval = mkdir(p, 0755);
- if (retval != 0) {
- dbg("mkdir(%s) failed with error '%s'",
- p, strerror(errno));
- return retval;
- }
- dbg("created '%s'", p);
- } else {
- selinux_setfilecon(p, S_IFDIR);
- }
- *pos = '/';
- }
- return 0;
-}
-
-static int make_node(char *file, int major, int minor, unsigned int mode, uid_t uid, gid_t gid)