- dbg("unlinking %s", filename);
- return unlink(filename);
-}
-
-struct sysfs_class_device *get_class_dev(char *device_name)
-{
- char dev_path[SYSFS_PATH_MAX];
- struct sysfs_class_device *class_dev;
-
- strcpy(dev_path, sysfs_path);
- strcat(dev_path, device_name);
-
- dbg("looking at %s", dev_path);
-
- /* open up the sysfs class device for this thing... */
- class_dev = sysfs_open_class_device(dev_path);
- if (class_dev == NULL) {
- dbg ("sysfs_open_class_device failed");
- return NULL;
- }
- dbg("class_dev->name = %s", class_dev->name);
-
- return class_dev;
-}
-
-static int add_device(char *device, char *subsystem)
-{
- struct sysfs_class_device *class_dev;
- struct device_attr attr;
- //char *name;
- int major;
- int minor;
- char type;
- //int mode;
- int retval = -EINVAL;
-
- /* for now, the block layer is the only place where block devices are */
- if (strcmp(subsystem, "block") == 0)
- type = 'b';
- else
- type = 'c';
-
- class_dev = get_class_dev(device);
- if (class_dev == NULL)
- goto exit;
-
- retval = namedev_name_device(class_dev, &attr);
- if (retval)
- return retval;
-
- retval = get_major_minor(class_dev, &major, &minor);
- if (retval) {
- dbg ("get_major_minor failed");
- goto exit;
- }
-
- sysfs_close_class_device(class_dev);
-
- return create_node(attr.name, type, major, minor, attr.mode);
-
-exit:
- return retval;
-}
-
-static int remove_device(char *device)
-{
- char *name;
- int retval = 0;
-
- name = get_name(device, 0, 0);
- if (name == NULL) {
- dbg ("get_name failed");
- retval = -ENODEV;
- goto exit;
- }
-
- return delete_node(name);
-
-exit:
- return retval;
-}
-
-static int udev_init(void)
-{
- int retval;
-
- retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX);
- dbg("sysfs_path = %s", sysfs_path);
- return retval;
-}
-
-int main(int argc, char *argv[])