-#include "namedev.h"
-#include "libsysfs/libsysfs.h"
-
-
-static char sysfs_path[SYSFS_PATH_MAX];
-
-static char *get_action(void)
-{
- char *action;
-
- action = getenv("ACTION");
- return action;
-}
-
-
-static char *get_device(void)
-{
- char *device;
-
- device = getenv("DEVPATH");
- return device;
-}
-
-/*
- * Right now the major/minor of a device is stored in a file called
- * "dev" in sysfs.
- * The number is stored as:
- * MMmm
- * MM is the major
- * mm is the minor
- * The value is in hex.
- * Yes, this will probably change when we go to a bigger major/minor
- * range, and will have to be changed at that time.
- */
-static int get_major_minor(struct sysfs_class_device *class_dev, int *major, int *minor)
-{
- char temp[3];
- int retval = 0;
-
- char *dev;
-
- dev = sysfs_get_value_from_attributes(class_dev->directory->attributes, "dev");
- if (dev == NULL)
- return -ENODEV;
-
- dbg("dev = %s", dev);
-
- temp[0] = dev[0];
- temp[1] = dev[1];
- temp[2] = 0x00;
- *major = (int)strtol(&temp[0], NULL, 16);
-
- temp[0] = dev[2];
- temp[1] = dev[3];
- temp[2] = 0x00;
- *minor = (int)strtol(&temp[0], NULL, 16);
-
- dbg("found major = %d, minor = %d", *major, *minor);
-
- retval = 0;
- return retval;
-}
-
-/*
- * Here would go a call to the naming deamon, to get the name we want to have
- * for this device. But for now, let's just default to whatever the kernel is
- * calling the device as that will keep the "old-style" naming policy
- */
-static char *get_name(char *dev, int major, int minor)
-{
- static char name[100];
- char *temp;
-
- temp = strrchr(dev, '/');
- if (temp == NULL)
- return NULL;
- strncpy(name, &temp[1], sizeof(name));
-
- dbg("name is %s", name);
-
- return &name[0];
-}
-
-/*
- * We also want to add some permissions here, and possibly some symlinks
- */
-static int create_node(char *name, char type, int major, int minor, int mode)
-{
- char *argv[7];
- char mode_string[100];
- char type_string[3];
- char major_string[20];
- char minor_string[20];
- char filename[255];
- int retval = 0;