diff options
author | mananth <mananth> | 2003-08-29 10:28:55 +0000 |
---|---|---|
committer | mananth <mananth> | 2003-08-29 10:28:55 +0000 |
commit | 1422dedd5c721400e07de988a407aeefbecafea3 (patch) | |
tree | 30450ee7fba9aed9dec82b4b989c5df5e3e22cde | |
parent | d842e8ef5b56187ff4fc4dcec5269fe137c8fc74 (diff) | |
download | sysfsutils-1422dedd5c721400e07de988a407aeefbecafea3.tar.gz |
Removed sysfs_driver ref from sysfs_device.
Fixed a few bugs in commands
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | cmd/lsbus.c | 4 | ||||
-rw-r--r-- | cmd/systool.c | 6 | ||||
-rw-r--r-- | include/libsysfs.h | 2 | ||||
-rw-r--r-- | lib/sysfs_bus.c | 3 | ||||
-rw-r--r-- | lib/sysfs_class.c | 4 | ||||
-rw-r--r-- | lib/sysfs_device.c | 5 |
7 files changed, 17 insertions, 11 deletions
@@ -1,4 +1,8 @@ +08/28/2003 - Ananth Mavinakayanahalli <ananth@in.ibm.com> + * Removed sysfs_driver reference from sysfs_device struct + * Fixed a few bugs in the commands. + 08/19/2003 - Daniel Stekloff <dsteklof@us.ibm.com> * Integrated Eric Bohm's dlist patch * Integrated Eric Bohm's follow on patch adding dlist_for_each diff --git a/cmd/lsbus.c b/cmd/lsbus.c index 2a98150..7f92021 100644 --- a/cmd/lsbus.c +++ b/cmd/lsbus.c @@ -221,9 +221,9 @@ void print_device(struct sysfs_device *device) & (SHOW_ATTRIBUTES | SHOW_ATTRIBUTE_VALUE | SHOW_ALL_ATTRIB_VALUES))) print_device_attributes(device->directory); - if (device->driver != NULL) + if (device->driver_name != NULL) fprintf (stdout, "\tDriver: %s\n", - device->driver->name); + device->driver_name); } } diff --git a/cmd/systool.c b/cmd/systool.c index 1f22373..7d482e0 100644 --- a/cmd/systool.c +++ b/cmd/systool.c @@ -246,10 +246,10 @@ void show_device(struct sysfs_device *device, int level) & (SHOW_ATTRIBUTES | SHOW_ATTRIBUTE_VALUE | SHOW_ALL_ATTRIB_VALUES))) show_attributes(device->directory, (level+4)); - if (device->driver != NULL) { + if (isalnum(device->driver_name[0])) { indent(level+4); fprintf (stdout, "Driver: %s\n", - device->driver->name); + device->driver_name); } } } @@ -416,6 +416,8 @@ void show_class_device(struct sysfs_class_device *dev, int level) & (SHOW_ATTRIBUTES | SHOW_ATTRIBUTE_VALUE | SHOW_ALL_ATTRIB_VALUES))) { show_attributes(dev->directory, (level+4)); + if (dev->directory->subdirs == NULL) + return; dlist_for_each_data(dev->directory->subdirs, cur, struct sysfs_directory) { indent(level+4); diff --git a/include/libsysfs.h b/include/libsysfs.h index c8df636..5dcbcaa 100644 --- a/include/libsysfs.h +++ b/include/libsysfs.h @@ -80,12 +80,12 @@ struct sysfs_driver { }; struct sysfs_device { - struct sysfs_driver *driver; struct sysfs_device *parent; struct dlist *children; unsigned char name[SYSFS_NAME_LEN]; unsigned char bus_id[SYSFS_NAME_LEN]; unsigned char bus_name[SYSFS_NAME_LEN]; + unsigned char driver_name[SYSFS_NAME_LEN]; /* for internal use only */ struct sysfs_directory *directory; diff --git a/lib/sysfs_bus.c b/lib/sysfs_bus.c index 908da5c..7e03b4a 100644 --- a/lib/sysfs_bus.c +++ b/lib/sysfs_bus.c @@ -260,7 +260,8 @@ static void link_bus_devices_to_drivers(struct sysfs_bus *bus) struct sysfs_driver) { if ((match_bus_device_to_driver(drv, dev->bus_id)) != 0) { - dev->driver = drv; + strncpy(dev->driver_name, drv->name, + SYSFS_NAME_LEN); drv->device = dev; } } diff --git a/lib/sysfs_class.c b/lib/sysfs_class.c index 211d41f..710d55c 100644 --- a/lib/sysfs_class.c +++ b/lib/sysfs_class.c @@ -171,7 +171,9 @@ struct sysfs_class_device *sysfs_open_class_device(const unsigned char *path) if (sdev != NULL) { cdev->sysdevice = sdev; if (cdev->driver != NULL) - sdev->driver = cdev->driver; + strncpy(sdev->driver_name, + cdev->driver->name, + SYSFS_NAME_LEN); } } else if (strncmp(curl->name, SYSFS_DRIVERS_NAME, 6) == 0) { diff --git a/lib/sysfs_device.c b/lib/sysfs_device.c index abdbd69..f179e37 100644 --- a/lib/sysfs_device.c +++ b/lib/sysfs_device.c @@ -74,10 +74,7 @@ struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, } dlist_for_each_data(dev->directory->attributes, cur, struct sysfs_attribute) { - if ((sysfs_get_name_from_path(cur->path, attrname, - SYSFS_NAME_LEN)) != 0) - continue; - if (strcmp(name, attrname) != 0) + if (strcmp(cur->name, attrname) != 0) continue; return cur; |