-static char *get_action(void)
-{
- char *action;
-
- action = getenv("ACTION");
- return action;
-}
-
-
-static char *get_device(void)
-{
- static char device[255];
- char *temp;
-
- temp = getenv("DEVPATH");
- if (temp == NULL)
- return NULL;
- strcpy(device, SYSFS_ROOT);
- strcat(device, temp);
-
- 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 (char *dev, int *major, int *minor)
-{
- char filename[255];
- char line[20];
- char temp[3];
- int fd;
- int retval = 0;
-
- /* add the dev file to the directory and see if it's present */
- strncpy(filename, dev, sizeof(filename));
- strncat(filename, DEV_FILE, sizeof(filename));
- fd = open(filename, O_RDONLY);
- if (fd < 0) {
- dbg("Can't open %s", filename);
- return -ENODEV;
- }
-
- /* get the major/minor */
- retval = read(fd, line, sizeof(line));
- if (retval < 0) {
- dbg("read error on %s", dev);
- goto exit;
- }
-
- temp[0] = line[0];
- temp[1] = line[1];
- temp[2] = 0x00;
- *major = (int)strtol(&temp[0], NULL, 16);
-
- temp[0] = line[2];
- temp[1] = line[3];
- temp[2] = 0x00;
- *minor = (int)strtol(&temp[0], NULL, 16);
-
- dbg("found major = %d, minor = %d", *major, *minor);
-
- retval = 0;
-exit:
- close(fd);
- 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)