From 9b6ef1d534b424dd26d7a441516a7f6659815bda Mon Sep 17 00:00:00 2001 From: mananth Date: Mon, 8 Mar 2004 06:23:29 +0000 Subject: Remove "unsigned" declarations for prototype compatibility per Lev's suggestion --- ChangeLog | 4 ++ cmd/systool.c | 36 +++++----- include/libsysfs.h | 161 ++++++++++++++++++++++---------------------- lib/sysfs_bus.c | 24 +++---- lib/sysfs_class.c | 39 ++++++----- lib/sysfs_device.c | 40 ++++++----- lib/sysfs_dir.c | 57 ++++++++-------- lib/sysfs_driver.c | 25 ++++--- lib/sysfs_utils.c | 46 ++++++------- test/get_bus_devices_list.c | 2 +- test/test.c | 18 ++--- test/test_bus.c | 24 +++---- test/test_class.c | 31 +++++---- test/test_dir.c | 48 ++++++------- test/test_driver.c | 28 ++++---- test/test_root.c | 28 ++++---- test/test_utils.c | 42 ++++++------ test/testout.c | 8 +-- 18 files changed, 326 insertions(+), 335 deletions(-) diff --git a/ChangeLog b/ChangeLog index a9e3871..06c494a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ +03/08/2004 - Ananth Mavinakayanahalli + * Remove "unsigned" declarations for prototype + compatibility per Lev Makhlis' suggestion + 03/08/2004 - Lev Makhlis * Changes for C++ compatibility diff --git a/cmd/systool.c b/cmd/systool.c index 2db73c5..696d96e 100644 --- a/cmd/systool.c +++ b/cmd/systool.c @@ -35,10 +35,10 @@ /* Command Options */ static int show_options = 0; /* bitmask of show options */ -static unsigned char *attribute_to_show = NULL; /* show value for this attribute */ -static unsigned char *device_to_show = NULL; /* show only this bus device */ +static char *attribute_to_show = NULL; /* show value for this attribute */ +static char *device_to_show = NULL; /* show only this bus device */ struct pci_access *pacc = NULL; -unsigned char *show_bus = NULL; +char *show_bus = NULL; static void show_device(struct sysfs_device *device, int level); static void show_class_device(struct sysfs_class_device *dev, int level); @@ -54,13 +54,13 @@ static void show_class_device(struct sysfs_class_device *dev, int level); #define SHOW_ALL 0xff -static unsigned char cmd_options[] = "aA:b:c:CdDhpPr:v"; +static char cmd_options[] = "aA:b:c:CdDhpPr:v"; /* * binary_files - defines existing sysfs binary files. These files will be * printed in hex. */ -static unsigned char *binary_files[] = { +static char *binary_files[] = { "config", "data" }; @@ -112,9 +112,9 @@ static void indent(int level) * remove_end_newline: removes newline on the end of an attribute value * @value: string to remove newline from */ -static void remove_end_newline(unsigned char *value) +static void remove_end_newline(char *value) { - unsigned char *p = value + (strlen(value) - 1); + char *p = value + (strlen(value) - 1); if (p != NULL && *p == '\n') *p = '\0'; @@ -127,7 +127,7 @@ static void remove_end_newline(unsigned char *value) static void show_device_children(struct sysfs_device *device, int level) { struct sysfs_device *temp_device = NULL, *child = NULL; - unsigned int flag = 1; + int flag = 1; temp_device = sysfs_open_device_tree(device->path); if (temp_device) { @@ -270,7 +270,7 @@ static void show_device(struct sysfs_device *device, int level) { struct dlist *attributes = NULL; unsigned int vendor_id, device_id; - unsigned char buf[128], value[256], path[SYSFS_PATH_MAX]; + char buf[128], value[256], path[SYSFS_PATH_MAX]; if (device != NULL) { indent(level); @@ -414,7 +414,7 @@ static void show_device_tree(struct sysfs_device *root, int level) * @busname: bus to print. * returns 0 with success or 1 with error. */ -static int show_sysfs_bus(unsigned char *busname) +static int show_sysfs_bus(char *busname) { struct sysfs_bus *bus = NULL; struct sysfs_device *curdev = NULL; @@ -530,7 +530,7 @@ static void show_class_device(struct sysfs_class_device *dev, int level) * @classname: class to print. * returns 0 with success and 1 with error. */ -static int show_sysfs_class(unsigned char *classname) +static int show_sysfs_class(char *classname) { struct sysfs_class *cls = NULL; struct sysfs_class_device *cur = NULL; @@ -565,7 +565,7 @@ static int show_sysfs_class(unsigned char *classname) * @rootname: device root to print. * returns 0 with success and 1 with error. */ -static int show_sysfs_root(unsigned char *rootname) +static int show_sysfs_root(char *rootname) { struct sysfs_root_device *root = NULL; struct sysfs_device *device = NULL; @@ -606,9 +606,9 @@ static int show_sysfs_root(unsigned char *rootname) */ static int show_default_info(void) { - unsigned char subsys[SYSFS_NAME_LEN]; + char subsys[SYSFS_NAME_LEN]; struct dlist *list = NULL; - unsigned char *cur = NULL; + char *cur = NULL; int retval = 0; strcpy(subsys, SYSFS_BUS_NAME); @@ -644,12 +644,12 @@ static int show_default_info(void) /* MAIN */ int main(int argc, char *argv[]) { -/* unsigned char *show_bus = NULL;*/ - unsigned char *show_class = NULL; - unsigned char *show_root = NULL; +/* char *show_bus = NULL;*/ + char *show_class = NULL; + char *show_root = NULL; int retval = 0; int opt; - unsigned char *pci_id_file = "/usr/local/share/pci.ids"; + char *pci_id_file = "/usr/local/share/pci.ids"; while((opt = getopt(argc, argv, cmd_options)) != EOF) { switch(opt) { diff --git a/include/libsysfs.h b/include/libsysfs.h index 095792b..c6dff1e 100644 --- a/include/libsysfs.h +++ b/include/libsysfs.h @@ -54,22 +54,22 @@ */ struct sysfs_attribute { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; - unsigned char *value; + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; + char *value; unsigned short len; /* value length */ unsigned short method; /* show and store */ }; struct sysfs_link { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; - unsigned char target[SYSFS_PATH_MAX]; + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; + char target[SYSFS_PATH_MAX]; }; struct sysfs_directory { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; /* Private: for internal use only */ struct dlist *subdirs; @@ -78,8 +78,8 @@ struct sysfs_directory { }; struct sysfs_driver { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; /* Private: for internal use only */ struct dlist *devices; @@ -87,11 +87,11 @@ struct sysfs_driver { }; struct sysfs_device { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char bus_id[SYSFS_NAME_LEN]; - unsigned char bus[SYSFS_NAME_LEN]; - unsigned char driver_name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; + char name[SYSFS_NAME_LEN]; + char bus_id[SYSFS_NAME_LEN]; + char bus[SYSFS_NAME_LEN]; + char driver_name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; /* Private: for internal use only */ struct sysfs_device *parent; @@ -100,8 +100,8 @@ struct sysfs_device { }; struct sysfs_root_device { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; /* Private: for internal use only */ struct dlist *devices; @@ -109,8 +109,8 @@ struct sysfs_root_device { }; struct sysfs_bus { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; /* Private: for internal use only */ struct dlist *drivers; @@ -119,9 +119,9 @@ struct sysfs_bus { }; struct sysfs_class_device { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char classname[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; + char name[SYSFS_NAME_LEN]; + char classname[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; /* Private: for internal use only */ struct sysfs_class_device *parent; @@ -131,8 +131,8 @@ struct sysfs_class_device { }; struct sysfs_class { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; /* Private: for internal use only */ struct dlist *devices; @@ -146,49 +146,47 @@ extern "C" { /* * Function Prototypes */ -extern int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len); -extern int sysfs_remove_trailing_slash(unsigned char *path); -extern int sysfs_get_name_from_path(const unsigned char *path, - unsigned char *name, size_t len); -extern int sysfs_path_is_dir(const unsigned char *path); -extern int sysfs_path_is_link(const unsigned char *path); -extern int sysfs_path_is_file(const unsigned char *path); -extern int sysfs_get_link(const unsigned char *path, unsigned char *target, - size_t len); -extern struct dlist *sysfs_open_subsystem_list(unsigned char *name); -extern struct dlist *sysfs_open_bus_devices_list(unsigned char *name); +extern int sysfs_get_mnt_path(char *mnt_path, size_t len); +extern int sysfs_remove_trailing_slash(char *path); +extern int sysfs_get_name_from_path(const char *path, char *name, size_t len); +extern int sysfs_path_is_dir(const char *path); +extern int sysfs_path_is_link(const char *path); +extern int sysfs_path_is_file(const char *path); +extern int sysfs_get_link(const char *path, char *target, size_t len); +extern struct dlist *sysfs_open_subsystem_list(char *name); +extern struct dlist *sysfs_open_bus_devices_list(char *name); extern void sysfs_close_list(struct dlist *list); /* sysfs directory and file access */ extern void sysfs_close_attribute(struct sysfs_attribute *sysattr); -extern struct sysfs_attribute *sysfs_open_attribute(const unsigned char *path); +extern struct sysfs_attribute *sysfs_open_attribute(const char *path); extern int sysfs_read_attribute(struct sysfs_attribute *sysattr); -extern int sysfs_read_attribute_value(const unsigned char *attrpath, - unsigned char *value, size_t vsize); +extern int sysfs_read_attribute_value(const char *attrpath, + char *value, size_t vsize); extern int sysfs_write_attribute(struct sysfs_attribute *sysattr, - const unsigned char *new_value, size_t len); -extern unsigned char *sysfs_get_value_from_attributes(struct dlist *attr, - const unsigned char *name); + const char *new_value, size_t len); +extern char *sysfs_get_value_from_attributes(struct dlist *attr, + const char *name); extern int sysfs_refresh_dir_attributes(struct sysfs_directory *sysdir); extern int sysfs_refresh_dir_links(struct sysfs_directory *sysdir); extern int sysfs_refresh_dir_subdirs(struct sysfs_directory *sysdir); extern void sysfs_close_directory(struct sysfs_directory *sysdir); -extern struct sysfs_directory *sysfs_open_directory(const unsigned char *path); +extern struct sysfs_directory *sysfs_open_directory(const char *path); extern int sysfs_read_dir_attributes(struct sysfs_directory *sysdir); extern int sysfs_read_dir_links(struct sysfs_directory *sysdir); extern int sysfs_read_dir_subdirs(struct sysfs_directory *sysdir); extern int sysfs_read_directory(struct sysfs_directory *sysdir); extern int sysfs_read_all_subdirs(struct sysfs_directory *sysdir); extern struct sysfs_directory *sysfs_get_subdirectory - (struct sysfs_directory *dir, unsigned char *subname); + (struct sysfs_directory *dir, char *subname); extern void sysfs_close_link(struct sysfs_link *ln); -extern struct sysfs_link *sysfs_open_link(const unsigned char *lnpath); -extern struct sysfs_link *sysfs_get_directory_link(struct sysfs_directory *dir, - unsigned char *linkname); +extern struct sysfs_link *sysfs_open_link(const char *lnpath); +extern struct sysfs_link *sysfs_get_directory_link + (struct sysfs_directory *dir, char *linkname); extern struct sysfs_link *sysfs_get_subdirectory_link - (struct sysfs_directory *dir, unsigned char *linkname); + (struct sysfs_directory *dir, char *linkname); extern struct sysfs_attribute *sysfs_get_directory_attribute - (struct sysfs_directory *dir, unsigned char *attrname); + (struct sysfs_directory *dir, char *attrname); extern struct dlist *sysfs_get_dir_attributes(struct sysfs_directory *dir); extern struct dlist *sysfs_get_dir_links(struct sysfs_directory *dir); extern struct dlist *sysfs_get_dir_subdirs(struct sysfs_directory *dir); @@ -196,84 +194,83 @@ 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 *bus_name, const unsigned char *drv_name); -extern struct sysfs_driver *sysfs_open_driver_path(const unsigned char *path); + (const char *bus_name, const char *drv_name); +extern struct sysfs_driver *sysfs_open_driver_path(const char *path); extern struct sysfs_attribute *sysfs_get_driver_attr - (struct sysfs_driver *drv, const unsigned char *name); + (struct sysfs_driver *drv, const char *name); extern struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver); extern struct dlist *sysfs_get_driver_devices(struct sysfs_driver *driver); extern struct dlist *sysfs_refresh_driver_devices(struct sysfs_driver *driver); extern struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver); extern struct sysfs_device *sysfs_get_driver_device - (struct sysfs_driver *driver, const unsigned char *name); + (struct sysfs_driver *driver, const char *name); extern struct dlist *sysfs_refresh_driver_attributes - (struct sysfs_driver *driver); -extern struct sysfs_attribute *sysfs_open_driver_attr(const unsigned char *bus, - const unsigned char *drv, const unsigned char *attrib); + (struct sysfs_driver *driver); +extern struct sysfs_attribute *sysfs_open_driver_attr + (const char *bus, const char *drv, const char *attrib); /* generic sysfs device access */ extern void sysfs_close_root_device(struct sysfs_root_device *root); -extern struct sysfs_root_device *sysfs_open_root_device - (const unsigned char *name); +extern struct sysfs_root_device *sysfs_open_root_device(const char *name); extern struct dlist *sysfs_get_root_devices(struct sysfs_root_device *root); extern void sysfs_close_device_tree(struct sysfs_device *device); -extern struct sysfs_device *sysfs_open_device_tree(const unsigned char *path); +extern struct sysfs_device *sysfs_open_device_tree(const char *path); extern void sysfs_close_device(struct sysfs_device *dev); extern struct sysfs_device *sysfs_open_device - (const unsigned char *bus, const unsigned char *bus_id); + (const char *bus, const 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_device *sysfs_open_device_path(const char *path); extern int sysfs_get_device_bus(struct sysfs_device *dev); extern struct sysfs_attribute *sysfs_get_device_attr - (struct sysfs_device *dev, const unsigned char *name); + (struct sysfs_device *dev, const char *name); extern struct dlist *sysfs_get_device_attributes(struct sysfs_device *device); extern struct dlist *sysfs_refresh_device_attributes - (struct sysfs_device *device); -extern struct sysfs_attribute *sysfs_open_device_attr(const unsigned char *bus, - const unsigned char *bus_id, const unsigned char *attrib); + (struct sysfs_device *device); +extern struct sysfs_attribute *sysfs_open_device_attr(const char *bus, + const char *bus_id, const char *attrib); /* generic sysfs bus access */ extern void sysfs_close_bus(struct sysfs_bus *bus); -extern struct sysfs_bus *sysfs_open_bus(const unsigned char *name); -extern struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, - unsigned char *id); +extern struct sysfs_bus *sysfs_open_bus(const char *name); +extern struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, + char *id); extern struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus, - unsigned char *drvname); + char *drvname); extern struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus); extern struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus); extern struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus); extern struct dlist *sysfs_refresh_bus_attributes(struct sysfs_bus *bus); -extern struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, - unsigned char *attrname); -extern int sysfs_find_driver_bus(const unsigned char *driver, - unsigned char *busname, size_t bsize); +extern struct sysfs_attribute *sysfs_get_bus_attribute + (struct sysfs_bus *bus, char *attrname); +extern int sysfs_find_driver_bus(const char *driver, char *busname, + size_t bsize); /* generic sysfs class access */ extern void sysfs_close_class_device(struct sysfs_class_device *dev); extern struct sysfs_class_device *sysfs_open_class_device_path - (const unsigned char *path); + (const char *path); extern struct sysfs_class_device *sysfs_open_class_device - (const unsigned char *classname, const unsigned char *name); + (const char *classname, const char *name); extern struct sysfs_device *sysfs_get_classdev_device - (struct sysfs_class_device *clsdev); + (struct sysfs_class_device *clsdev); extern struct sysfs_driver *sysfs_get_classdev_driver - (struct sysfs_class_device *clsdev); + (struct sysfs_class_device *clsdev); extern struct sysfs_class_device *sysfs_get_classdev_parent - (struct sysfs_class_device *clsdev); + (struct sysfs_class_device *clsdev); extern void sysfs_close_class(struct sysfs_class *cls); -extern struct sysfs_class *sysfs_open_class(const unsigned char *name); +extern struct sysfs_class *sysfs_open_class(const char *name); extern struct dlist *sysfs_get_class_devices(struct sysfs_class *cls); extern struct sysfs_class_device *sysfs_get_class_device - (struct sysfs_class *cls, unsigned char *name); + (struct sysfs_class *cls, char *name); extern struct dlist *sysfs_get_classdev_attributes (struct sysfs_class_device *cdev); extern struct dlist *sysfs_refresh_classdev_attributes (struct sysfs_class_device *cdev); extern struct sysfs_attribute *sysfs_get_classdev_attr - (struct sysfs_class_device *clsdev, const unsigned char *name); + (struct sysfs_class_device *clsdev, const char *name); extern struct sysfs_attribute *sysfs_open_classdev_attr - (const unsigned char *classname, const unsigned char *dev, - const unsigned char *attrib); + (const char *classname, const char *dev, + const char *attrib); /** * sort_list: sorter function to keep list elements sorted in alphabetical diff --git a/lib/sysfs_bus.c b/lib/sysfs_bus.c index 89105b9..b852570 100644 --- a/lib/sysfs_bus.c +++ b/lib/sysfs_bus.c @@ -44,7 +44,7 @@ static int bus_device_id_equal(void *a, void *b) if (a == NULL || b == NULL) return 0; - if (strcmp(((unsigned char *)a), ((struct sysfs_device *)b)->bus_id) + if (strcmp(((char *)a), ((struct sysfs_device *)b)->bus_id) == 0) return 1; return 0; @@ -61,7 +61,7 @@ static int bus_driver_name_equal(void *a, void *b) if (a == NULL || b == NULL) return 0; - if (strcmp(((unsigned char *)a), ((struct sysfs_driver *)b)->name) == 0) + if (strcmp(((char *)a), ((struct sysfs_driver *)b)->name) == 0) return 1; return 0; } @@ -102,7 +102,7 @@ struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus) struct sysfs_device *bdev = NULL; struct sysfs_directory *devdir = NULL; struct sysfs_link *curl = NULL; - unsigned char path[SYSFS_PATH_MAX]; + char path[SYSFS_PATH_MAX]; if (bus == NULL) { errno = EINVAL; @@ -151,7 +151,7 @@ struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus) struct sysfs_driver *driver = NULL; struct sysfs_directory *drvdir = NULL; struct sysfs_directory *cursub = NULL; - unsigned char path[SYSFS_PATH_MAX]; + char path[SYSFS_PATH_MAX]; if (bus == NULL) { errno = EINVAL; @@ -193,10 +193,10 @@ struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus) * sysfs_open_bus: opens specific bus and all its devices on system * returns sysfs_bus structure with success or NULL with error. */ -struct sysfs_bus *sysfs_open_bus(const unsigned char *name) +struct sysfs_bus *sysfs_open_bus(const char *name) { struct sysfs_bus *bus = NULL; - unsigned char buspath[SYSFS_PATH_MAX]; + char buspath[SYSFS_PATH_MAX]; if (name == NULL) { errno = EINVAL; @@ -239,8 +239,7 @@ struct sysfs_bus *sysfs_open_bus(const unsigned char *name) * @id: bus_id for device * returns struct sysfs_device reference or NULL if not found. */ -struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, - unsigned char *id) +struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, char *id) { if (bus == NULL || id == NULL) { errno = EINVAL; @@ -264,7 +263,7 @@ struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, * returns struct sysfs_driver reference or NULL if not found. */ struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus, - unsigned char *drvname) + char *drvname) { if (bus == NULL || drvname == NULL) { errno = EINVAL; @@ -338,7 +337,7 @@ struct dlist *sysfs_refresh_bus_attributes(struct sysfs_bus *bus) * returns reference to sysfs_attribute if found or NULL if not found */ struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, - unsigned char *attrname) + char *attrname) { struct dlist *attrlist = NULL; @@ -360,10 +359,9 @@ struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, * @bsize: buffer size * returns 0 with success, -1 with error */ -int sysfs_find_driver_bus(const unsigned char *driver, unsigned char *busname, - size_t bsize) +int sysfs_find_driver_bus(const char *driver, char *busname, size_t bsize) { - unsigned char subsys[SYSFS_PATH_MAX], *bus = NULL, *curdrv = NULL; + char subsys[SYSFS_PATH_MAX], *bus = NULL, *curdrv = NULL; struct dlist *buslist = NULL, *drivers = NULL; if (driver == NULL || busname == NULL) { diff --git a/lib/sysfs_class.c b/lib/sysfs_class.c index 28d891f..26892b2 100644 --- a/lib/sysfs_class.c +++ b/lib/sysfs_class.c @@ -38,7 +38,7 @@ static int class_name_equal(void *a, void *b) if (a == NULL || b == NULL) return 0; - if (strcmp(((unsigned char *)a), ((struct sysfs_class_device *)b)->name) + if (strcmp(((char *)a), ((struct sysfs_class_device *)b)->name) == 0) return 1; @@ -105,7 +105,7 @@ static struct sysfs_class *alloc_class(void) */ static void set_classdev_classname(struct sysfs_class_device *cdev) { - unsigned char *c = NULL, *e = NULL; + char *c = NULL, *e = NULL; int count = 0; c = strstr(cdev->path, SYSFS_CLASS_NAME); @@ -134,8 +134,7 @@ static void set_classdev_classname(struct sysfs_class_device *cdev) * @path: path to class device. * returns struct sysfs_class_device with success and NULL with error. */ -struct sysfs_class_device *sysfs_open_class_device_path - (const unsigned char *path) +struct sysfs_class_device *sysfs_open_class_device_path(const char *path) { struct sysfs_class_device *cdev = NULL; @@ -220,10 +219,10 @@ struct dlist *sysfs_get_class_devices(struct sysfs_class *cls) * sysfs_open_class: opens specific class and all its devices on system * returns sysfs_class structure with success or NULL with error. */ -struct sysfs_class *sysfs_open_class(const unsigned char *name) +struct sysfs_class *sysfs_open_class(const char *name) { struct sysfs_class *cls = NULL; - unsigned char classpath[SYSFS_PATH_MAX]; + char classpath[SYSFS_PATH_MAX]; if (name == NULL) { errno = EINVAL; @@ -276,7 +275,7 @@ struct sysfs_class *sysfs_open_class(const unsigned char *name) * @name: class name of the device */ struct sysfs_class_device *sysfs_get_class_device(struct sysfs_class *cls, - unsigned char *name) + char *name) { if (cls == NULL || name == NULL) { errno = EINVAL; @@ -303,7 +302,7 @@ struct sysfs_device *sysfs_get_classdev_device (struct sysfs_class_device *clsdev) { struct sysfs_link *devlink = NULL; - unsigned char devpath[SYSFS_PATH_MAX]; + char devpath[SYSFS_PATH_MAX]; if (clsdev == NULL) { errno = EINVAL; @@ -362,7 +361,7 @@ struct sysfs_driver *sysfs_get_classdev_driver (struct sysfs_class_device *clsdev) { struct sysfs_link *drvlink = NULL; - unsigned char drvpath[SYSFS_PATH_MAX]; + char drvpath[SYSFS_PATH_MAX]; if (clsdev == NULL) { errno = EINVAL; @@ -417,7 +416,7 @@ struct sysfs_driver *sysfs_get_classdev_driver */ static int get_blockdev_parent(struct sysfs_class_device *clsdev) { - unsigned char parent_path[SYSFS_PATH_MAX], *c = NULL; + char parent_path[SYSFS_PATH_MAX], *c = NULL; strcpy(parent_path, clsdev->path); c = strstr(parent_path, SYSFS_BLOCK_NAME); @@ -497,8 +496,8 @@ struct sysfs_class_device *sysfs_get_classdev_parent * @psize: size of "path" * Returns 0 on SUCCESS or -1 on error */ -static int get_classdev_path(const unsigned char *classname, - const unsigned char *clsdev, unsigned char *path, size_t len) +static int get_classdev_path(const char *classname, const char *clsdev, + char *path, size_t len) { if (classname == NULL || clsdev == NULL || path == NULL) { errno = EINVAL; @@ -532,9 +531,9 @@ static int get_classdev_path(const unsigned char *classname, * Call sysfs_close_class_device() to close the class device */ struct sysfs_class_device *sysfs_open_class_device - (const unsigned char *classname, const unsigned char *name) + (const char *classname, const char *name) { - unsigned char devpath[SYSFS_PATH_MAX]; + char devpath[SYSFS_PATH_MAX]; struct sysfs_class_device *cdev = NULL; if (classname == NULL || name == NULL) { @@ -617,7 +616,7 @@ struct dlist *sysfs_refresh_classdev_attributes * returns sysfs_attribute reference with success or NULL with error */ struct sysfs_attribute *sysfs_get_classdev_attr - (struct sysfs_class_device *clsdev, const unsigned char *name) + (struct sysfs_class_device *clsdev, const char *name) { struct sysfs_attribute *cur = NULL; struct sysfs_directory *sdir = NULL; @@ -635,7 +634,7 @@ struct sysfs_attribute *sysfs_get_classdev_attr attrlist = sysfs_get_classdev_attributes(clsdev); if (attrlist != NULL) { cur = sysfs_get_directory_attribute(clsdev->directory, - (unsigned char *)name); + (char *)name); if (cur != NULL) return cur; } @@ -651,7 +650,7 @@ struct sysfs_attribute *sysfs_get_classdev_attr if ((sysfs_path_is_dir(sdir->path)) != 0) continue; cur = sysfs_get_directory_attribute(sdir, - (unsigned char *)name); + (char *)name); if (cur == NULL) continue; } @@ -670,11 +669,11 @@ struct sysfs_attribute *sysfs_get_classdev_attr * A call to sysfs_close_attribute() is required to close the * attribute returned and to free memory */ -struct sysfs_attribute *sysfs_open_classdev_attr(const unsigned char *classname, - const unsigned char *dev, const unsigned char *attrib) +struct sysfs_attribute *sysfs_open_classdev_attr(const char *classname, + const char *dev, const char *attrib) { struct sysfs_attribute *attribute = NULL; - unsigned char path[SYSFS_PATH_MAX]; + char path[SYSFS_PATH_MAX]; if (classname == NULL || dev == NULL || attrib == NULL) { errno = EINVAL; diff --git a/lib/sysfs_device.c b/lib/sysfs_device.c index edb2a40..97dab32 100644 --- a/lib/sysfs_device.c +++ b/lib/sysfs_device.c @@ -31,8 +31,8 @@ static int get_dev_driver(struct sysfs_device *dev) { struct dlist *drvlist = NULL; - unsigned char path[SYSFS_PATH_MAX], devpath[SYSFS_PATH_MAX]; - unsigned char *drv = NULL, *c = NULL; + char path[SYSFS_PATH_MAX], devpath[SYSFS_PATH_MAX]; + char *drv = NULL, *c = NULL; if (dev == NULL) { errno = EINVAL; @@ -82,8 +82,8 @@ static int get_dev_driver(struct sysfs_device *dev) */ int sysfs_get_device_bus(struct sysfs_device *dev) { - unsigned char subsys[SYSFS_NAME_LEN], path[SYSFS_PATH_MAX]; - unsigned char target[SYSFS_PATH_MAX], *bus = NULL, *c = NULL; + char subsys[SYSFS_NAME_LEN], path[SYSFS_PATH_MAX]; + char target[SYSFS_PATH_MAX], *bus = NULL, *c = NULL; struct dlist *buslist = NULL; if (dev == NULL) { @@ -194,7 +194,7 @@ static struct sysfs_device *alloc_device(void) * @name: name of root * returns struct sysfs_directory with success and NULL with error */ -static struct sysfs_directory *open_device_dir(const unsigned char *path) +static struct sysfs_directory *open_device_dir(const char *path) { struct sysfs_directory *rdir = NULL; @@ -223,7 +223,7 @@ static struct sysfs_directory *open_device_dir(const unsigned char *path) * @path: path to device, this is the /sys/devices/ path * returns sysfs_device structure with success or NULL with error */ -struct sysfs_device *sysfs_open_device_path(const unsigned char *path) +struct sysfs_device *sysfs_open_device_path(const char *path) { struct sysfs_device *dev = NULL; @@ -278,7 +278,7 @@ struct sysfs_device *sysfs_open_device_path(const unsigned char *path) * returns struct sysfs_device and its children with success or NULL with * error. */ -struct sysfs_device *sysfs_open_device_tree(const unsigned char *path) +struct sysfs_device *sysfs_open_device_tree(const char *path) { struct sysfs_device *rootdev = NULL, *new = NULL; struct sysfs_directory *cur = NULL; @@ -380,10 +380,10 @@ struct dlist *sysfs_get_root_devices(struct sysfs_root_device *root) * @name: name of /sys/devices/root to open * returns struct sysfs_root_device if success and NULL with error */ -struct sysfs_root_device *sysfs_open_root_device(const unsigned char *name) +struct sysfs_root_device *sysfs_open_root_device(const char *name) { struct sysfs_root_device *root = NULL; - unsigned char rootpath[SYSFS_PATH_MAX]; + char rootpath[SYSFS_PATH_MAX]; if (name == NULL) { errno = EINVAL; @@ -479,7 +479,7 @@ struct dlist *sysfs_refresh_device_attributes(struct sysfs_device *device) * returns sysfs_attribute reference with success or NULL with error. */ struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, - const unsigned char *name) + const char *name) { struct dlist *attrlist = NULL; @@ -492,8 +492,7 @@ struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, if (attrlist == NULL) return NULL; - return sysfs_get_directory_attribute(dev->directory, - (unsigned char *)name); + return sysfs_get_directory_attribute(dev->directory, (char *)name); } /** @@ -504,10 +503,10 @@ struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, * @psize: size of "path" * Returns 0 on success -1 on failure */ -static int get_device_absolute_path(const unsigned char *device, - const unsigned char *bus, unsigned char *path, size_t psize) +static int get_device_absolute_path(const char *device, const char *bus, + char *path, size_t psize) { - unsigned char bus_path[SYSFS_PATH_MAX]; + char bus_path[SYSFS_PATH_MAX]; if (device == NULL || path == NULL) { errno = EINVAL; @@ -549,8 +548,7 @@ static int get_device_absolute_path(const unsigned char *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, - const unsigned char *bus_id) +struct sysfs_device *sysfs_open_device(const char *bus, const char *bus_id) { char sysfs_path[SYSFS_PATH_MAX]; struct sysfs_device *device = NULL; @@ -583,7 +581,7 @@ struct sysfs_device *sysfs_open_device(const unsigned char *bus, */ struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev) { - unsigned char ppath[SYSFS_PATH_MAX], *tmp = NULL; + char ppath[SYSFS_PATH_MAX], *tmp = NULL; if (dev == NULL) { errno = EINVAL; @@ -640,11 +638,11 @@ struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev) * A call to sysfs_close_attribute() is required to close * the attribute returned and free memory. */ -struct sysfs_attribute *sysfs_open_device_attr(const unsigned char *bus, - const unsigned char *bus_id, const unsigned char *attrib) +struct sysfs_attribute *sysfs_open_device_attr(const char *bus, + const char *bus_id, const char *attrib) { struct sysfs_attribute *attribute = NULL; - unsigned char devpath[SYSFS_PATH_MAX]; + char devpath[SYSFS_PATH_MAX]; if (bus == NULL || bus_id == NULL || attrib == NULL) { errno = EINVAL; diff --git a/lib/sysfs_dir.c b/lib/sysfs_dir.c index 253f986..da7d85a 100644 --- a/lib/sysfs_dir.c +++ b/lib/sysfs_dir.c @@ -58,7 +58,7 @@ static int dir_attribute_name_equal(void *a, void *b) if (a == NULL || b == NULL) return 0; - if (strcmp(((unsigned char *)a), ((struct sysfs_attribute *)b)->name) + if (strcmp(((char *)a), ((struct sysfs_attribute *)b)->name) == 0) return 1; return 0; @@ -75,7 +75,7 @@ static int dir_link_name_equal(void *a, void *b) if (a == NULL || b == NULL) return 0; - if (strcmp(((unsigned char *)a), ((struct sysfs_link *)b)->name) + if (strcmp(((char *)a), ((struct sysfs_link *)b)->name) == 0) return 1; return 0; @@ -92,7 +92,7 @@ static int dir_subdir_name_equal(void *a, void *b) if (a == NULL || b == NULL) return 0; - if (strcmp(((unsigned char *)a), ((struct sysfs_directory *)b)->name) + if (strcmp(((char *)a), ((struct sysfs_directory *)b)->name) == 0) return 1; return 0; @@ -126,7 +126,7 @@ static struct sysfs_attribute *alloc_attribute(void) * @path: path to attribute. * returns sysfs_attribute struct with success and NULL with error. */ -struct sysfs_attribute *sysfs_open_attribute(const unsigned char *path) +struct sysfs_attribute *sysfs_open_attribute(const char *path) { struct sysfs_attribute *sysattr = NULL; struct stat fileinfo; @@ -171,7 +171,7 @@ struct sysfs_attribute *sysfs_open_attribute(const unsigned char *path) * returns 0 with success and -1 with error. */ int sysfs_write_attribute(struct sysfs_attribute *sysattr, - const unsigned char *new_value, size_t len) + const char *new_value, size_t len) { int fd; int length; @@ -259,8 +259,8 @@ int sysfs_write_attribute(struct sysfs_attribute *sysattr, */ int sysfs_read_attribute(struct sysfs_attribute *sysattr) { - unsigned char *fbuf = NULL; - unsigned char *vbuf = NULL; + char *fbuf = NULL; + char *vbuf = NULL; ssize_t length = 0; long pgsize = 0; int fd; @@ -276,7 +276,7 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) return -1; } pgsize = sysconf(_SC_PAGESIZE); - fbuf = (unsigned char *)calloc(1, pgsize+1); + fbuf = (char *)calloc(1, pgsize+1); if (fbuf == NULL) { dprintf("calloc failed\n"); return -1; @@ -304,7 +304,7 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) } sysattr->len = length; close(fd); - vbuf = (unsigned char *)realloc(fbuf, length+1); + vbuf = (char *)realloc(fbuf, length+1); if (vbuf == NULL) { dprintf("realloc failed\n"); free(fbuf); @@ -324,8 +324,8 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) * @vsize: size of value buffer * returns 0 with success and -1 with error. */ -int sysfs_read_attribute_value(const unsigned char *attrpath, - unsigned char *value, size_t vsize) +int sysfs_read_attribute_value(const char *attrpath, + char *value, size_t vsize) { struct sysfs_attribute *attr = NULL; size_t length = 0; @@ -361,10 +361,9 @@ int sysfs_read_attribute_value(const unsigned char *attrpath, * attribute name, return its value * @attr: attribute to search * @name: name to look for - * returns unsigned char * value - could be NULL + * returns char * value - could be NULL */ -unsigned char *sysfs_get_value_from_attributes(struct dlist *attr, - const unsigned char *name) +char *sysfs_get_value_from_attributes(struct dlist *attr, const char *name) { struct sysfs_attribute *cur = NULL; @@ -464,7 +463,7 @@ int sysfs_read_all_subdirs(struct sysfs_directory *sysdir) * @path: path of directory to open. * returns: struct sysfs_directory * with success and NULL on error. */ -struct sysfs_directory *sysfs_open_directory(const unsigned char *path) +struct sysfs_directory *sysfs_open_directory(const char *path) { struct sysfs_directory *sdir = NULL; @@ -499,7 +498,7 @@ struct sysfs_directory *sysfs_open_directory(const unsigned char *path) * @path: path of link to open. * returns: struct sysfs_link * with success and NULL on error. */ -struct sysfs_link *sysfs_open_link(const unsigned char *linkpath) +struct sysfs_link *sysfs_open_link(const char *linkpath) { struct sysfs_link *ln = NULL; @@ -530,8 +529,7 @@ struct sysfs_link *sysfs_open_link(const unsigned char *linkpath) * @path: path to attribute * returns 0 with success and -1 with error. */ -static int add_attribute(struct sysfs_directory *sysdir, - const unsigned char *path) +static int add_attribute(struct sysfs_directory *sysdir, const char *path) { struct sysfs_attribute *attr = NULL; @@ -563,8 +561,7 @@ static int add_attribute(struct sysfs_directory *sysdir, * @path: path to subdirectory * returns 0 with success and -1 with error. */ -static int add_subdirectory(struct sysfs_directory *sysdir, - const unsigned char *path) +static int add_subdirectory(struct sysfs_directory *sysdir, const char *path) { struct sysfs_directory *subdir = NULL; @@ -586,7 +583,7 @@ static int add_subdirectory(struct sysfs_directory *sysdir, * @path: path to link * returns 0 with success and -1 with error. */ -static int add_link(struct sysfs_directory *sysdir, const unsigned char *path) +static int add_link(struct sysfs_directory *sysdir, const char *path) { struct sysfs_link *ln = NULL; @@ -611,7 +608,7 @@ int sysfs_read_dir_attributes(struct sysfs_directory *sysdir) { DIR *dir = NULL; struct dirent *dirent = NULL; - unsigned char file_path[SYSFS_PATH_MAX]; + char file_path[SYSFS_PATH_MAX]; int retval = 0; if (sysdir == NULL) { @@ -650,7 +647,7 @@ int sysfs_read_dir_links(struct sysfs_directory *sysdir) { DIR *dir = NULL; struct dirent *dirent = NULL; - unsigned char file_path[SYSFS_PATH_MAX]; + char file_path[SYSFS_PATH_MAX]; int retval = 0; if (sysdir == NULL) { @@ -692,7 +689,7 @@ int sysfs_read_dir_subdirs(struct sysfs_directory *sysdir) { DIR *dir = NULL; struct dirent *dirent = NULL; - unsigned char file_path[SYSFS_PATH_MAX]; + char file_path[SYSFS_PATH_MAX]; int retval = 0; if (sysdir == NULL) { @@ -732,7 +729,7 @@ int sysfs_read_directory(struct sysfs_directory *sysdir) DIR *dir = NULL; struct dirent *dirent = NULL; struct stat astats; - unsigned char file_path[SYSFS_PATH_MAX]; + char file_path[SYSFS_PATH_MAX]; int retval = 0; if (sysdir == NULL) { @@ -871,10 +868,10 @@ int sysfs_refresh_dir_subdirs(struct sysfs_directory *sysdir) * returns sysfs_attribute if found and NULL if not found */ struct sysfs_attribute *sysfs_get_directory_attribute - (struct sysfs_directory *dir, unsigned char *attrname) + (struct sysfs_directory *dir, char *attrname) { struct sysfs_attribute *attr = NULL; - unsigned char new_path[SYSFS_PATH_MAX]; + char new_path[SYSFS_PATH_MAX]; if (dir == NULL || attrname == NULL) { errno = EINVAL; @@ -917,7 +914,7 @@ struct sysfs_attribute *sysfs_get_directory_attribute * returns reference to sysfs_link if found and NULL if not found */ struct sysfs_link *sysfs_get_directory_link - (struct sysfs_directory *dir, unsigned char *linkname) + (struct sysfs_directory *dir, char *linkname) { if (dir == NULL || linkname == NULL) { errno = EINVAL; @@ -942,7 +939,7 @@ struct sysfs_link *sysfs_get_directory_link * returns reference to subdirectory or NULL if not found */ struct sysfs_directory *sysfs_get_subdirectory(struct sysfs_directory *dir, - unsigned char *subname) + char *subname) { struct sysfs_directory *sub = NULL, *cursub = NULL; @@ -984,7 +981,7 @@ struct sysfs_directory *sysfs_get_subdirectory(struct sysfs_directory *dir, * returns reference to link or NULL if not found */ struct sysfs_link *sysfs_get_subdirectory_link(struct sysfs_directory *dir, - unsigned char *linkname) + char *linkname) { struct sysfs_directory *cursub = NULL; struct sysfs_link *ln = NULL; diff --git a/lib/sysfs_driver.c b/lib/sysfs_driver.c index 04b54a8..9b9bec0 100644 --- a/lib/sysfs_driver.c +++ b/lib/sysfs_driver.c @@ -79,7 +79,7 @@ static struct sysfs_driver *alloc_driver(void) * @path: path to driver directory * returns struct sysfs_driver with success and NULL with error */ -struct sysfs_driver *sysfs_open_driver_path(const unsigned char *path) +struct sysfs_driver *sysfs_open_driver_path(const char *path) { struct sysfs_driver *driver = NULL; @@ -168,7 +168,7 @@ struct dlist *sysfs_refresh_driver_attributes(struct sysfs_driver *driver) * returns sysfs_attribute reference on success or NULL with error */ struct sysfs_attribute *sysfs_get_driver_attr(struct sysfs_driver *drv, - const unsigned char *name) + const char *name) { struct dlist *attrlist = NULL; @@ -181,8 +181,7 @@ struct sysfs_attribute *sysfs_get_driver_attr(struct sysfs_driver *drv, if (attrlist == NULL) return NULL; - return sysfs_get_directory_attribute(drv->directory, - (unsigned char *)name); + return sysfs_get_directory_attribute(drv->directory, (char *)name); } /** @@ -292,7 +291,7 @@ struct dlist *sysfs_refresh_driver_devices(struct sysfs_driver *driver) * Returns a sysfs_device if found, NULL otherwise */ struct sysfs_device *sysfs_get_driver_device(struct sysfs_driver *driver, - const unsigned char *name) + const char *name) { struct sysfs_device *device = NULL; struct dlist *devlist = NULL; @@ -325,8 +324,8 @@ struct sysfs_device *sysfs_get_driver_device(struct sysfs_driver *driver, * @psize: size of "path" * Returns 0 on success and -1 on error */ -static int get_driver_path(const unsigned char *bus, - const unsigned char *drv, unsigned char *path, size_t psize) +static int get_driver_path(const char *bus, const char *drv, + char *path, size_t psize) { if (bus == NULL || drv == NULL || path == NULL) { errno = EINVAL; @@ -358,11 +357,11 @@ static int get_driver_path(const unsigned char *bus, * A call to sysfs_close_attribute() is required to close the * attribute returned and to free memory */ -struct sysfs_attribute *sysfs_open_driver_attr(const unsigned char *bus, - const unsigned char *drv, const unsigned char *attrib) +struct sysfs_attribute *sysfs_open_driver_attr(const char *bus, + const char *drv, const char *attrib) { struct sysfs_attribute *attribute = NULL; - unsigned char path[SYSFS_PATH_MAX]; + char path[SYSFS_PATH_MAX]; if (bus == NULL || drv == NULL || attrib == NULL) { errno = EINVAL; @@ -397,10 +396,10 @@ struct sysfs_attribute *sysfs_open_driver_attr(const unsigned char *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 *bus_name, - const unsigned char *drv_name) +struct sysfs_driver *sysfs_open_driver(const char *bus_name, + const char *drv_name) { - unsigned char path[SYSFS_PATH_MAX]; + char path[SYSFS_PATH_MAX]; struct sysfs_driver *driver = NULL; if (drv_name == NULL || bus_name == NULL) { diff --git a/lib/sysfs_utils.c b/lib/sysfs_utils.c index b7295d6..58967d2 100644 --- a/lib/sysfs_utils.c +++ b/lib/sysfs_utils.c @@ -25,8 +25,8 @@ static int sort_char(void *new, void *old) { - return ((strncmp((unsigned char *)new, (unsigned char *)old, - strlen((unsigned char *)new))) < 0 ? 1 : 0); + return ((strncmp((char *)new, (char *)old, + strlen((char *)new))) < 0 ? 1 : 0); } /** @@ -34,9 +34,9 @@ static int sort_char(void *new, void *old) * @path: Path to look for the trailing '/' * Returns 0 on success 1 on error */ -int sysfs_remove_trailing_slash(unsigned char *path) +int sysfs_remove_trailing_slash(char *path) { - unsigned char *c = NULL; + char *c = NULL; if (path == NULL) { errno = EINVAL; @@ -60,8 +60,8 @@ int sysfs_remove_trailing_slash(unsigned char *path) * @len: size of mnt_path * returns 0 with success and -1 with error. */ -static int sysfs_get_fs_mnt_path(const unsigned char *fs_type, - unsigned char *mnt_path, size_t len) +static int sysfs_get_fs_mnt_path(const char *fs_type, + char *mnt_path, size_t len) { FILE *mnt; struct mntent *mntent; @@ -107,7 +107,7 @@ static int sysfs_get_fs_mnt_path(const unsigned char *fs_type, * @len: size of mnt_path * returns 0 with success and -1 with error. */ -int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len) +int sysfs_get_mnt_path(char *mnt_path, size_t len) { char *sysfs_path = NULL; int ret = 0; @@ -133,11 +133,11 @@ int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len) * @name: where to put name * @len: size of name */ -int sysfs_get_name_from_path(const unsigned char *path, unsigned char *name, +int sysfs_get_name_from_path(const char *path, char *name, size_t len) { - unsigned char tmp[SYSFS_PATH_MAX]; - unsigned char *n = NULL; + char tmp[SYSFS_PATH_MAX]; + char *n = NULL; if (path == NULL || name == NULL || len == 0) { errno = EINVAL; @@ -169,12 +169,12 @@ int sysfs_get_name_from_path(const unsigned char *path, unsigned char *name, * @target: where to put name * @len: size of name */ -int sysfs_get_link(const unsigned char *path, unsigned char *target, size_t len) +int sysfs_get_link(const char *path, char *target, size_t len) { - unsigned char devdir[SYSFS_PATH_MAX]; - unsigned char linkpath[SYSFS_PATH_MAX]; - unsigned char temp_path[SYSFS_PATH_MAX]; - unsigned char *d = NULL, *s = NULL; + char devdir[SYSFS_PATH_MAX]; + char linkpath[SYSFS_PATH_MAX]; + char temp_path[SYSFS_PATH_MAX]; + char *d = NULL, *s = NULL; int slashes = 0, count = 0; if (path == NULL || target == NULL || len == 0) { @@ -282,10 +282,10 @@ void sysfs_close_list(struct dlist *list) * @name: name of the subsystem, eg., "bus", "class", "devices" * Returns a dlist of supported names or NULL if subsystem not supported */ -struct dlist *sysfs_open_subsystem_list(unsigned char *name) +struct dlist *sysfs_open_subsystem_list(char *name) { - unsigned char sysfs_path[SYSFS_PATH_MAX], *subsys_name = NULL; - unsigned char *c = NULL; + char sysfs_path[SYSFS_PATH_MAX], *subsys_name = NULL; + char *c = NULL; struct sysfs_directory *dir = NULL, *cur = NULL; struct dlist *list = NULL; @@ -354,9 +354,9 @@ out: * @name: name of the subsystem, eg., "pci", "scsi", "usb" * Returns a dlist of supported names or NULL if subsystem not supported */ -struct dlist *sysfs_open_bus_devices_list(unsigned char *name) +struct dlist *sysfs_open_bus_devices_list(char *name) { - unsigned char sysfs_path[SYSFS_PATH_MAX], *device_name = NULL; + char sysfs_path[SYSFS_PATH_MAX], *device_name = NULL; struct sysfs_directory *dir = NULL; struct sysfs_link *cur = NULL; struct dlist *list = NULL; @@ -412,7 +412,7 @@ struct dlist *sysfs_open_bus_devices_list(unsigned char *name) * @path: path to validate * Returns 0 if path points to dir, 1 otherwise */ -int sysfs_path_is_dir(const unsigned char *path) +int sysfs_path_is_dir(const char *path) { struct stat astats; @@ -435,7 +435,7 @@ int sysfs_path_is_dir(const unsigned char *path) * @path: path to validate * Returns 0 if path points to link, 1 otherwise */ -int sysfs_path_is_link(const unsigned char *path) +int sysfs_path_is_link(const char *path) { struct stat astats; @@ -458,7 +458,7 @@ int sysfs_path_is_link(const unsigned char *path) * @path: path to validate * Returns 0 if path points to file, 1 otherwise */ -int sysfs_path_is_file(const unsigned char *path) +int sysfs_path_is_file(const char *path) { struct stat astats; diff --git a/test/get_bus_devices_list.c b/test/get_bus_devices_list.c index 2548470..b828ef0 100644 --- a/test/get_bus_devices_list.c +++ b/test/get_bus_devices_list.c @@ -33,7 +33,7 @@ static void print_usage(void) int main(int argc, char *argv[]) { struct dlist *name = NULL; - unsigned char *cur = NULL; + char *cur = NULL; if (argc != 2) { print_usage(); diff --git a/test/test.c b/test/test.c index 98a4b9e..0f845c9 100644 --- a/test/test.c +++ b/test/test.c @@ -196,7 +196,7 @@ int (*func_table[81])(int) = { test_sysfs_open_classdev_attr, }; -unsigned char *dir_paths[] = { +char *dir_paths[] = { val_dir_path, val_root_dev_path, val_class_dev_path, @@ -206,18 +206,18 @@ unsigned char *dir_paths[] = { NULL }; -unsigned char *file_paths[] = { +char *file_paths[] = { val_file_path, val_write_attr_path, NULL }; -unsigned char *link_paths[] = { +char *link_paths[] = { val_link_path, NULL }; -static int path_is_dir(const unsigned char *path) +static int path_is_dir(const char *path) { struct stat astats; @@ -232,7 +232,7 @@ direrr: return 1; } -static int path_is_file(const unsigned char *path) +static int path_is_file(const char *path) { struct stat astats; @@ -247,7 +247,7 @@ fileerr: return 1; } -static int path_is_link(const unsigned char *path) +static int path_is_link(const char *path) { struct stat astats; @@ -267,9 +267,9 @@ linkerr: */ static int check_header(void) { - unsigned char *var_path = NULL; - unsigned char path1[SYSFS_PATH_MAX]; - unsigned int i = 0; + char *var_path = NULL; + char path1[SYSFS_PATH_MAX]; + int i = 0; for (i = 0; dir_paths[i] != NULL; i++) { var_path = dir_paths[i]; diff --git a/test/test_bus.c b/test/test_bus.c index 8bd04af..aaca5a6 100644 --- a/test/test_bus.c +++ b/test/test_bus.c @@ -25,20 +25,20 @@ * this will test the bus related functions provided by libsysfs. * * extern void sysfs_close_bus(struct sysfs_bus *bus); - * extern struct sysfs_bus *sysfs_open_bus(const unsigned char *name); + * extern struct sysfs_bus *sysfs_open_bus(const char *name); * extern struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, - * unsigned char *id); + * char *id); * extern struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus, - * unsigned char *drvname); + * char *drvname); * extern struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus); * extern struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus); * extern struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus); * extern struct dlist *sysfs_refresh_bus_attributes(struct sysfs_bus *bus); * extern struct sysfs_attribute *sysfs_get_bus_attribute * (struct sysfs_bus *bus, - * unsigned char *attrname); - * extern int sysfs_find_driver_bus(const unsigned char *driver, - * unsigned char *busname, size_t bsize); + * char *attrname); + * extern int sysfs_find_driver_bus(const char *driver, + * char *busname, size_t bsize); ****************************************************************************** */ @@ -79,7 +79,7 @@ int test_sysfs_close_bus(int flag) } /** - * extern struct sysfs_bus *sysfs_open_bus(const unsigned char *name); + * extern struct sysfs_bus *sysfs_open_bus(const char *name); * * flag: * 0 - name -> valid @@ -138,7 +138,7 @@ int test_sysfs_open_bus(int flag) /** * extern struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, - * unsigned char *id); + * char *id); * * flag: * 0 : bus -> valid, id -> valid @@ -240,7 +240,7 @@ int test_sysfs_get_bus_device(int flag) /** * extern struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus, - * unsigned char *drvname); + * char *drvname); * * flag: * 0 : bus -> valid, drvname -> valid @@ -595,7 +595,7 @@ int test_sysfs_refresh_bus_attributes(int flag) /** * extern struct sysfs_attribute *sysfs_get_bus_attribute * (struct sysfs_bus *bus, - * unsigned char *attrname); + * char *attrname); * flag: * 0 : bus -> valid, attrname -> valid * 1 : bus -> valid, attrname -> invalid @@ -696,8 +696,8 @@ int test_sysfs_get_bus_attribute(int flag) } /** - * extern int sysfs_find_driver_bus(const unsigned char *driver, - * unsigned char *busname, size_t bsize); + * extern int sysfs_find_driver_bus(const char *driver, + * char *busname, size_t bsize); * * flag: * 0: driver -> valid, busname -> valid, size ->valid. diff --git a/test/test_class.c b/test/test_class.c index 85cb3a1..2f6ef72 100644 --- a/test/test_class.c +++ b/test/test_class.c @@ -26,9 +26,9 @@ * * extern void sysfs_close_class_device(struct sysfs_class_device *dev); * extern struct sysfs_class_device *sysfs_open_class_device_path - * (const unsigned char *path); + * (const char *path); * extern struct sysfs_class_device *sysfs_open_class_device - * (const unsigned char *class, const unsigned char *name); + * (const char *classname, const char *name); * extern struct sysfs_device *sysfs_get_classdev_device * (struct sysfs_class_device *clsdev); * extern struct sysfs_driver *sysfs_get_classdev_driver @@ -36,20 +36,19 @@ * extern struct sysfs_class_device *sysfs_get_classdev_parent * (struct sysfs_class_device *clsdev); * extern void sysfs_close_class(struct sysfs_class *cls); - * extern struct sysfs_class *sysfs_open_class(const unsigned char *name); + * extern struct sysfs_class *sysfs_open_class(const char *name); * extern struct dlist *sysfs_get_class_devices(struct sysfs_class *cls); * extern struct sysfs_class_device *sysfs_get_class_device - * (struct sysfs_class *class, unsigned char *name); + * (struct sysfs_class *cls, char *name); * extern struct dlist *sysfs_get_classdev_attributes * (struct sysfs_class_device *cdev); * extern struct dlist *sysfs_refresh_classdev_attributes * (struct sysfs_class_device *cdev); * extern struct sysfs_attribute *sysfs_get_classdev_attr - * (struct sysfs_class_device *clsdev, const unsigned char *name); + * (struct sysfs_class_device *clsdev, const char *name); * extern struct sysfs_attribute *sysfs_open_classdev_attr - * (const unsigned char *classname, - * const unsigned char *dev, - * const unsigned char *attrib); + * (const char *classname, + * const char *dev, const char *attrib); ***************************************************************************** */ @@ -94,7 +93,7 @@ int test_sysfs_close_class_device(int flag) /** * extern struct sysfs_class_device *sysfs_open_class_device_path - * (const unsigned char *path); + * (const char *path); * flag: * 0: path -> valid * 1: path -> invalid @@ -152,7 +151,7 @@ int test_sysfs_open_class_device_path(int flag) /** * extern struct sysfs_class_device *sysfs_open_class_device - * (const unsigned char *class, const unsigned char *name); + * (const char *class, const char *name); * * flag: * 0: class -> valid , name -> valid @@ -479,7 +478,7 @@ int test_sysfs_close_class(int flag) } /** - * extern struct sysfs_class *sysfs_open_class(const unsigned char *name); + * extern struct sysfs_class *sysfs_open_class(const char *name); * * flag: * 0: name -> valid @@ -603,7 +602,7 @@ int test_sysfs_get_class_devices(int flag) /** * extern struct sysfs_class_device *sysfs_get_class_device - * (struct sysfs_class *class, unsigned char *name); + * (struct sysfs_class *class, char *name); * * flag: * 0: class -> valid, name -> valid @@ -830,7 +829,7 @@ int test_sysfs_refresh_classdev_attributes(int flag) /** * extern struct sysfs_attribute *sysfs_get_classdev_attr - * (struct sysfs_class_device *clsdev, const unsigned char *name); + * (struct sysfs_class_device *clsdev, const char *name); * * flag: * 0: clsdev -> valid, name -> valid @@ -940,9 +939,9 @@ int test_sysfs_get_classdev_attr(int flag) /** * extern struct sysfs_attribute *sysfs_open_classdev_attr - * (const unsigned char *classname, - * const unsigned char *dev, - * const unsigned char *attrib); + * (const char *classname, + * const char *dev, + * const char *attrib); * flag: * 0: classname -> valid, dev -> valid, attrib -> valid * 1: classname -> valid, dev -> valid, attrib -> invalid diff --git a/test/test_dir.c b/test/test_dir.c index 1e0b79b..a6cdc41 100644 --- a/test/test_dir.c +++ b/test/test_dir.c @@ -26,35 +26,35 @@ * * extern void sysfs_close_attribute(struct sysfs_attribute *sysattr); * extern struct sysfs_attribute *sysfs_open_attribute - * (const unsigned char *path); + * (const char *path); * extern int sysfs_read_attribute(struct sysfs_attribute *sysattr); - * extern int sysfs_read_attribute_value(const unsigned char *attrpath, - * unsigned char *value, size_t vsize); + * extern int sysfs_read_attribute_value(const char *attrpath, + * char *value, size_t vsize); * extern int sysfs_write_attribute(struct sysfs_attribute *sysattr, - * const unsigned char *new_value, size_t len); - * extern unsigned char *sysfs_get_value_from_attributes(struct dlist *attr, - * const unsigned char * name); + * const char *new_value, size_t len); + * extern char *sysfs_get_value_from_attributes(struct dlist *attr, + * const char * name); * extern int sysfs_refresh_dir_attributes(struct sysfs_directory *sysdir); * extern int sysfs_refresh_dir_links(struct sysfs_directory *sysdir); * extern int sysfs_refresh_dir_subdirs(struct sysfs_directory *sysdir); * extern void sysfs_close_directory(struct sysfs_directory *sysdir); * extern struct sysfs_directory *sysfs_open_directory - * (const unsigned char *path); + * (const char *path); * extern int sysfs_read_dir_attributes(struct sysfs_directory *sysdir); * extern int sysfs_read_dir_links(struct sysfs_directory *sysdir); * extern int sysfs_read_dir_subdirs(struct sysfs_directory *sysdir); * extern int sysfs_read_directory(struct sysfs_directory *sysdir); * extern int sysfs_read_all_subdirs(struct sysfs_directory *sysdir); * extern struct sysfs_directory *sysfs_get_subdirectory - * (struct sysfs_directory *dir, unsigned char *subname); + * (struct sysfs_directory *dir, char *subname); * extern void sysfs_close_link(struct sysfs_link *ln); - * extern struct sysfs_link *sysfs_open_link(const unsigned char *lnpath); + * extern struct sysfs_link *sysfs_open_link(const char *lnpath); * extern struct sysfs_link *sysfs_get_directory_link - * (struct sysfs_directory *dir, unsigned char *linkname); + * (struct sysfs_directory *dir, char *linkname); * extern struct sysfs_link *sysfs_get_subdirectory_link - * (struct sysfs_directory *dir, unsigned char *linkname); + * (struct sysfs_directory *dir, char *linkname); * extern struct sysfs_attribute *sysfs_get_directory_attribute - * (struct sysfs_directory *dir, unsigned char *attrname); + * (struct sysfs_directory *dir, char *attrname); * extern struct dlist *sysfs_get_dir_attributes(struct sysfs_directory *dir); * extern struct dlist *sysfs_get_dir_links(struct sysfs_directory *dir); * extern struct dlist *sysfs_get_dir_subdirs(struct sysfs_directory *dir); @@ -101,7 +101,7 @@ int test_sysfs_close_attribute(int flag) /** * extern struct sysfs_attribute *sysfs_open_attribute - * (const unsigned char *path); + * (const char *path); * * flag: * 0: path -> valid @@ -221,8 +221,8 @@ int test_sysfs_read_attribute(int flag) } /** - * extern int sysfs_read_attribute_value(const unsigned char *attrpath, - * unsigned char *value, size_t vsize); + * extern int sysfs_read_attribute_value(const char *attrpath, + * char *value, size_t vsize); * * flag: * 0: attrpath -> valid, value -> valid @@ -294,7 +294,7 @@ int test_sysfs_read_attribute_value(int flag) /** * extern int sysfs_write_attribute(struct sysfs_attribute *sysattr, - * const unsigned char *new_value, size_t len); + * const char *new_value, size_t len); * * flag: * 0: sysattr -> valid, new_value -> valid, len -> valid; @@ -418,8 +418,8 @@ int test_sysfs_write_attribute(int flag) } /** - * extern unsigned char *sysfs_get_value_from_attributes(struct dlist *attr, - * const unsigned char * name); + * extern char *sysfs_get_value_from_attributes(struct dlist *attr, + * const char * name); * * flag: * 0: attr -> valid, name -> valid @@ -775,7 +775,7 @@ int test_sysfs_close_directory(int flag) /** * extern struct sysfs_directory *sysfs_open_directory - * (const unsigned char *path); + * (const char *path); * * flag: * 0: path -> valid @@ -1131,7 +1131,7 @@ int test_sysfs_read_all_subdirs(int flag) /** * extern struct sysfs_directory *sysfs_get_subdirectory - * (struct sysfs_directory *dir, unsigned char *subname); + * (struct sysfs_directory *dir, char *subname); * * flag: * 0: dir -> valid, subname -> valid @@ -1251,7 +1251,7 @@ int test_sysfs_close_link(int flag) } /** - * extern struct sysfs_link *sysfs_open_link(const unsigned char *lnpath); + * extern struct sysfs_link *sysfs_open_link(const char *lnpath); * * flag: * 0: lnpath -> valid; @@ -1308,7 +1308,7 @@ int test_sysfs_open_link(int flag) /** * extern struct sysfs_link *sysfs_get_directory_link - * (struct sysfs_directory *dir, unsigned char *linkname); + * (struct sysfs_directory *dir, char *linkname); * * flag: * 0: dir -> valid, linkname -> valid @@ -1405,7 +1405,7 @@ int test_sysfs_get_directory_link(int flag) /** * extern struct sysfs_link *sysfs_get_subdirectory_link - * (struct sysfs_directory *dir, unsigned char *linkname); + * (struct sysfs_directory *dir, char *linkname); * * flag: * 0: dir -> valid, linkname -> valid @@ -1496,7 +1496,7 @@ int test_sysfs_get_subdirectory_link(int flag) /** * extern struct sysfs_attribute *sysfs_get_directory_attribute - * (struct sysfs_directory *dir, unsigned char *attrname); + * (struct sysfs_directory *dir, char *attrname); * * flag: * 0: dir -> valid, attrname -> valid diff --git a/test/test_driver.c b/test/test_driver.c index c0287be..2c7fafa 100644 --- a/test/test_driver.c +++ b/test/test_driver.c @@ -26,11 +26,11 @@ * * extern void sysfs_close_driver(struct sysfs_driver *driver); * extern struct sysfs_driver *sysfs_open_driver - * (const unsigned char *bus_name, const unsigned char *drv_name); + * (const char *bus_name, const char *drv_name); * extern struct sysfs_driver *sysfs_open_driver_path - * (const unsigned char *path); + * (const char *path); * extern struct sysfs_attribute *sysfs_get_driver_attr - * (struct sysfs_driver *drv, const unsigned char *name); + * (struct sysfs_driver *drv, const char *name); * extern struct dlist *sysfs_get_driver_attributes * (struct sysfs_driver *driver); * extern struct dlist *sysfs_get_driver_devices(struct sysfs_driver *driver); @@ -38,12 +38,12 @@ * (struct sysfs_driver *driver); * extern struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver); * extern struct sysfs_device *sysfs_get_driver_device - * (struct sysfs_driver *driver, const unsigned char *name); + * (struct sysfs_driver *driver, const char *name); * extern struct dlist *sysfs_refresh_driver_attributes * (struct sysfs_driver *driver); * extern struct sysfs_attribute *sysfs_open_driver_attr - * (const unsigned char *bus, const unsigned char *drv, - * const unsigned char *attrib); + * (const char *bus, const char *drv, + * const char *attrib); * ****************************************************************************** */ @@ -82,7 +82,7 @@ int test_sysfs_close_driver(int flag) /** * extern struct sysfs_driver *sysfs_open_driver_path - * (const unsigned char *path); + * (const char *path); * * flag: * 0: path -> valid @@ -141,7 +141,7 @@ int test_sysfs_open_driver_path(int flag) /** * extern struct sysfs_driver *sysfs_open_driver - * (const unsigned char *bus_name, const unsigned char *drv_name); + * (const char *bus_name, const char *drv_name); * * flag: * 0: path -> valid, name -> valid @@ -235,7 +235,7 @@ int test_sysfs_open_driver(int flag) /** * extern struct sysfs_attribute *sysfs_get_driver_attr - * (struct sysfs_driver *drv, const unsigned char *name); + * (struct sysfs_driver *drv, const char *name); * * flag: * 0: drv -> valid, name -> valid @@ -354,7 +354,7 @@ int test_sysfs_get_driver_attributes(int flag) { struct sysfs_driver *driver = NULL; struct dlist *list = NULL; - unsigned char *drv = NULL; + char *drv = NULL; switch (flag) { case 0: @@ -427,7 +427,7 @@ int test_sysfs_get_driver_devices(int flag) { struct sysfs_driver *driver = NULL; struct dlist *list = NULL; - unsigned char *drv = NULL; + char *drv = NULL; switch (flag) { case 0: @@ -624,7 +624,7 @@ int test_sysfs_get_driver_links(int flag) /** * extern struct sysfs_device *sysfs_get_driver_device - * (struct sysfs_driver *driver, const unsigned char *name); + * (struct sysfs_driver *driver, const char *name); * * flag: * 0: driver -> valid, name -> valid @@ -786,8 +786,8 @@ int test_sysfs_refresh_driver_attributes(int flag) /** * extern struct sysfs_attribute *sysfs_open_driver_attr - * (const unsigned char *bus, const unsigned char *drv, - * const unsigned char *attrib); + * (const char *bus, const char *drv, + * const char *attrib); * * flag: * 0: bus -> valid, drv -> valid, attrib -> valid diff --git a/test/test_root.c b/test/test_root.c index d532970..122b36d 100644 --- a/test/test_root.c +++ b/test/test_root.c @@ -26,25 +26,25 @@ * * extern void sysfs_close_root_device(struct sysfs_root_device *root); * extern struct sysfs_root_device *sysfs_open_root_device - * (const unsigned char *name); + * (const char *name); * 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, const unsigned char *bus_id); + * (const char *bus, const 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); + * (const char *path); * extern struct sysfs_attribute *sysfs_get_device_attr - * (struct sysfs_device *dev, const unsigned char *name); + * (struct sysfs_device *dev, const char *name); * extern struct dlist *sysfs_get_device_attributes * (struct sysfs_device *device); * extern struct dlist *sysfs_refresh_device_attributes * (struct sysfs_device *device); * extern struct sysfs_attribute *sysfs_open_device_attr - * (const unsigned char *bus, - * const unsigned char *bus_id, - * const unsigned char *attrib); + * (const char *bus, + * const char *bus_id, + * const char *attrib); * ****************************************************************************** */ @@ -89,7 +89,7 @@ int test_sysfs_close_root_device(int flag) /** * extern struct sysfs_root_device *sysfs_open_root_device - * (const unsigned char *name); + * (const char *name); * * flag: * 0: name -> valid @@ -254,7 +254,7 @@ int test_sysfs_close_device(int flag) /** * extern struct sysfs_device *sysfs_open_device - * (const unsigned char *bus, const unsigned char *bus_id); + * (const char *bus, const char *bus_id); * * flag: * 0: bus -> valid, bus_id -> valid @@ -415,7 +415,7 @@ int test_sysfs_get_device_parent(int flag) /** * extern struct sysfs_device *sysfs_open_device_path - * (const unsigned char *path); + * (const char *path); * * flag: * 0: path -> valid @@ -473,7 +473,7 @@ int test_sysfs_open_device_path(int flag) /** * extern struct sysfs_attribute *sysfs_get_device_attr - * (struct sysfs_device *dev, const unsigned char *name); + * (struct sysfs_device *dev, const char *name); * * flag: * 0: dev -> valid, name -> valid @@ -715,9 +715,9 @@ int test_sysfs_refresh_device_attributes(int flag) /** * extern struct sysfs_attribute *sysfs_open_device_attr - * (const unsigned char *bus, - * const unsigned char *bus_id, - * const unsigned char *attrib); + * (const char *bus, + * const char *bus_id, + * const char *attrib); * * flag: * 0: bus -> valid, bus_id -> valid, attrib -> valid diff --git a/test/test_utils.c b/test/test_utils.c index 3d970d5..56746be 100644 --- a/test/test_utils.c +++ b/test/test_utils.c @@ -24,17 +24,17 @@ *************************************************************************** * this will test the utility functions provided by libsysfs. * - * extern int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len); - * extern int sysfs_remove_trailing_slash(unsigned char *path); - * extern int sysfs_get_name_from_path(const unsigned char *path, - * unsigned char *name, size_t len); - * extern int sysfs_path_is_dir(const unsigned char *path); - * extern int sysfs_path_is_link(const unsigned char *path); - * extern int sysfs_path_is_file(const unsigned char *path); - * extern int sysfs_get_link(const unsigned char *path, unsigned char *target, + * extern int sysfs_get_mnt_path(char *mnt_path, size_t len); + * extern int sysfs_remove_trailing_slash(char *path); + * extern int sysfs_get_name_from_path(const char *path, + * char *name, size_t len); + * extern int sysfs_path_is_dir(const char *path); + * extern int sysfs_path_is_link(const char *path); + * extern int sysfs_path_is_file(const char *path); + * extern int sysfs_get_link(const char *path, char *target, * size_t len); - * extern struct dlist *sysfs_open_subsystem_list(unsigned char *name); - * extern struct dlist *sysfs_open_bus_devices_list(unsigned char *name); + * extern struct dlist *sysfs_open_subsystem_list(char *name); + * extern struct dlist *sysfs_open_bus_devices_list(char *name); * extern void sysfs_close_list(struct dlist *list); * * @@ -45,7 +45,7 @@ #include /** - * extern int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len); + * extern int sysfs_get_mnt_path(char *mnt_path, size_t len); * * flag: * 0: mnt_path -> valid, len -> valid @@ -126,7 +126,7 @@ int test_sysfs_get_mnt_path(int flag) } /** - * extern int sysfs_remove_trailing_slash(unsigned char *path); + * extern int sysfs_remove_trailing_slash(char *path); * * flag: * 0: path -> valid @@ -182,8 +182,8 @@ int test_sysfs_remove_trailing_slash(int flag) } /** - * extern int sysfs_get_name_from_path(const unsigned char *path, - * unsigned char *name, size_t len); + * extern int sysfs_get_name_from_path(const char *path, + * char *name, size_t len); * * flag: * 0: path -> valid, name -> valid, len -> valid @@ -254,7 +254,7 @@ int test_sysfs_get_name_from_path(int flag) } /** - * extern int sysfs_path_is_dir(const unsigned char *path); + * extern int sysfs_path_is_dir(const char *path); * * flag: * 0: path -> valid @@ -311,7 +311,7 @@ int test_sysfs_path_is_dir(int flag) } /** - * extern int sysfs_path_is_link(const unsigned char *path); + * extern int sysfs_path_is_link(const char *path); * * flag: * 0: path -> valid @@ -368,7 +368,7 @@ int test_sysfs_path_is_link(int flag) } /** - * extern int sysfs_path_is_file(const unsigned char *path); + * extern int sysfs_path_is_file(const char *path); * * flag: * 0: path -> valid @@ -424,8 +424,8 @@ int test_sysfs_path_is_file(int flag) } /** - * extern int sysfs_get_link(const unsigned char *path, - * unsigned char *target, size_t len); + * extern int sysfs_get_link(const char *path, + * char *target, size_t len); * * flag: * 0: path -> valid, target -> valid @@ -498,7 +498,7 @@ int test_sysfs_get_link(int flag) } /** - * extern struct dlist *sysfs_open_subsystem_list(unsigned char *name); + * extern struct dlist *sysfs_open_subsystem_list(char *name); * * flag: * 0: name -> valid @@ -560,7 +560,7 @@ int test_sysfs_open_subsystem_list(int flag) } /** - * extern struct dlist *sysfs_open_bus_devices_list(unsigned char *name); + * extern struct dlist *sysfs_open_bus_devices_list(char *name); * * flag: * 0: name -> valid diff --git a/test/testout.c b/test/testout.c index 711db00..547f9d8 100644 --- a/test/testout.c +++ b/test/testout.c @@ -26,9 +26,9 @@ #include -static void remove_end_newline(unsigned char *value) +static void remove_end_newline(char *value) { - unsigned char *p = value + (strlen(value) - 1); + char *p = value + (strlen(value) - 1); if (p != NULL && *p == '\n') *p = '\0'; @@ -178,9 +178,9 @@ void show_class_device_list(struct dlist *devlist) void show_list(struct dlist *list) { if (list != NULL) { - unsigned char *name = NULL; + char *name = NULL; - dlist_for_each_data(list, name, unsigned char) + dlist_for_each_data(list, name, char) dbg_print("%s\n", name); } } -- cgit v1.2.1