summaryrefslogtreecommitdiff
path: root/udev.c
diff options
context:
space:
mode:
authorgreg@kroah.com <greg@kroah.com>2003-07-18 22:48:28 -0700
committerGreg KH <gregkh@suse.de>2005-04-26 21:01:39 -0700
commit185a35a403cc37b3943bc68aa61745ff2b6ed17b (patch)
tree0b7869535745092d1b99bd8e4179ff8c8718c363 /udev.c
parent28972fe8a9a314761aacd16bf19f89dbaf5a9282 (diff)
[PATCH] add initial libsysfs support...
needs lots more cleanup, but is much nicer than doing this by hand...
Diffstat (limited to 'udev.c')
-rw-r--r--udev.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/udev.c b/udev.c
index bf170d1651..dc5f5b8d89 100644
--- a/udev.c
+++ b/udev.c
@@ -50,7 +50,8 @@ static char *get_device(void)
temp = getenv("DEVPATH");
if (temp == NULL)
return NULL;
- strcpy(device, SYSFS_ROOT);
+ strcpy(device, "");
+// strcpy(device, SYSFS_ROOT);
strcat(device, temp);
return device;
@@ -198,14 +199,14 @@ static int delete_node(char *name)
return unlink(filename);
}
-static int add_device(char *device, char type)
+static int add_device(char *device, char type, struct device_attr *attr)
{
char *name;
int major;
int minor;
int mode;
int retval = -EINVAL;
-
+#if 0
retval = get_major_minor(device, &major, &minor);
if (retval) {
dbg ("get_major_minor failed");
@@ -225,8 +226,8 @@ static int add_device(char *device, char type)
retval = -EINVAL;
goto exit;
}
-
- return create_node(name, type, major, minor, mode);
+#endif
+ return create_node(attr->name, type, attr->major, attr->minor, attr->mode);
exit:
return retval;
@@ -252,6 +253,7 @@ exit:
int main(int argc, char *argv[])
{
+ struct device_attr attr;
char *subsystem;
char *action;
char *device;
@@ -290,8 +292,12 @@ int main(int argc, char *argv[])
}
dbg("looking at %s", device);
+ retval = namedev_name_device(device, &attr);
+ if (retval)
+ return retval;
+
if (strcmp(action, "add") == 0)
- return add_device(device, type);
+ return add_device(device, type, &attr);
if (strcmp(action, "remove") == 0)
return remove_device(device);