diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | include/libsysfs.h | 4 | ||||
-rw-r--r-- | lib/sysfs_class.c | 5 | ||||
-rw-r--r-- | lib/sysfs_device.c | 6 | ||||
-rw-r--r-- | lib/sysfs_driver.c | 6 | ||||
-rw-r--r-- | test/get_device.c | 2 |
6 files changed, 18 insertions, 9 deletions
@@ -1,5 +1,9 @@ 01/07/2003 - Ananth Mavinakayanahalli <ananth@in.ibm.com> + * Modified parameter order for "open" functions to make them + consistent + +01/07/2003 - Ananth Mavinakayanahalli <ananth@in.ibm.com> * Added additional CFLAGS for building lib and apps 01/07/2003 - Ananth Mavinakayanahalli <ananth@in.ibm.com> diff --git a/include/libsysfs.h b/include/libsysfs.h index 6d3cbcd..451830f 100644 --- a/include/libsysfs.h +++ b/include/libsysfs.h @@ -190,7 +190,7 @@ extern struct dlist *sysfs_get_dir_subdirs(struct sysfs_directory *dir); /* sysfs driver access */ extern void sysfs_close_driver(struct sysfs_driver *driver); extern struct sysfs_driver *sysfs_open_driver - (const unsigned char *drv_name, const unsigned char *bus_name); + (const unsigned char *bus_name, const unsigned char *drv_name); extern struct sysfs_driver *sysfs_open_driver_path(const unsigned char *path); extern struct sysfs_attribute *sysfs_get_driver_attr (struct sysfs_driver *drv, const unsigned char *name); @@ -212,7 +212,7 @@ extern struct sysfs_root_device *sysfs_open_root_device extern struct dlist *sysfs_get_root_devices(struct sysfs_root_device *root); extern void sysfs_close_device(struct sysfs_device *dev); extern struct sysfs_device *sysfs_open_device - (const unsigned char *bus_id, const unsigned char *bus); + (const unsigned char *bus, const unsigned char *bus_id); extern struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev); extern struct sysfs_device *sysfs_open_device_path(const unsigned char *path); extern struct sysfs_attribute *sysfs_get_device_attr diff --git a/lib/sysfs_class.c b/lib/sysfs_class.c index 160ca05..600be00 100644 --- a/lib/sysfs_class.c +++ b/lib/sysfs_class.c @@ -425,6 +425,11 @@ static int get_blockdev_parent(struct sysfs_class_device *clsdev) strcpy(parent_path, clsdev->path); c = strstr(parent_path, SYSFS_BLOCK_NAME); + if (c == NULL) { + dprintf("Class device %s does not belong to BLOCK subsystem\n", + clsdev->name); + return 1; + } c += strlen(SYSFS_BLOCK_NAME); if (*c == '/') c++; diff --git a/lib/sysfs_device.c b/lib/sysfs_device.c index e58526f..6365276 100644 --- a/lib/sysfs_device.c +++ b/lib/sysfs_device.c @@ -481,17 +481,17 @@ static int get_device_absolute_path(const unsigned char *device, /** * sysfs_open_device: open a device by id (use the "bus" subsystem) + * @bus: bus the device belongs to * @bus_id: bus_id of the device to open - has to be the "bus_id" in * /sys/bus/xxx/devices - * @bus: bus the device belongs to * returns struct sysfs_device if found, NULL otherwise * NOTE: * 1. Use sysfs_close_device to close the device * 2. Bus the device is on must be supplied * Use sysfs_find_device_bus to get the bus name */ -struct sysfs_device *sysfs_open_device(const unsigned char *bus_id, - const unsigned char *bus) +struct sysfs_device *sysfs_open_device(const unsigned char *bus, + const unsigned char *bus_id) { char sysfs_path[SYSFS_PATH_MAX]; struct sysfs_device *device = NULL; diff --git a/lib/sysfs_driver.c b/lib/sysfs_driver.c index a4440cf..636219a 100644 --- a/lib/sysfs_driver.c +++ b/lib/sysfs_driver.c @@ -391,12 +391,12 @@ struct sysfs_attribute *sysfs_open_driver_attr(const unsigned char *bus, /** * sysfs_open_driver: open driver by name, given its bus - * @drv_name: Name of the driver * @bus_name: Name of the bus + * @drv_name: Name of the driver * Returns the sysfs_driver reference on success and NULL on failure */ -struct sysfs_driver *sysfs_open_driver(const unsigned char *drv_name, - const unsigned char *bus_name) +struct sysfs_driver *sysfs_open_driver(const unsigned char *bus_name, + const unsigned char *drv_name) { unsigned char path[SYSFS_PATH_MAX]; struct sysfs_driver *driver = NULL; diff --git a/test/get_device.c b/test/get_device.c index 9b2545a..5498f87 100644 --- a/test/get_device.c +++ b/test/get_device.c @@ -41,7 +41,7 @@ int main(int argc, char *argv[]) return 1; } - device = sysfs_open_device(argv[2], argv[1]); + device = sysfs_open_device(argv[1], argv[2]); if (device == NULL) { fprintf(stdout, "Device %s not found on bus %s\n", argv[2], argv[1]); |