diff options
author | mananth <mananth> | 2003-10-15 12:45:43 +0000 |
---|---|---|
committer | mananth <mananth> | 2003-10-15 12:45:43 +0000 |
commit | a7f04eab974502d3bd7180f0aff35d97901106ed (patch) | |
tree | d1d86b09a9c6fcaf5c724642ffdeb517c804de78 /lib | |
parent | 4b726c94f0fcc8d16278fb4b20fab6ca8a4c177d (diff) | |
download | sysfsutils-a7f04eab974502d3bd7180f0aff35d97901106ed.tar.gz |
Change ver to 0.3.0
Remove perror usage
Fix warnings
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sysfs_block.c | 16 | ||||
-rw-r--r-- | lib/sysfs_bus.c | 2 | ||||
-rw-r--r-- | lib/sysfs_class.c | 4 | ||||
-rw-r--r-- | lib/sysfs_device.c | 4 | ||||
-rw-r--r-- | lib/sysfs_dir.c | 13 | ||||
-rw-r--r-- | lib/sysfs_driver.c | 1 |
6 files changed, 12 insertions, 28 deletions
diff --git a/lib/sysfs_block.c b/lib/sysfs_block.c index 4f72e1c..60a3949 100644 --- a/lib/sysfs_block.c +++ b/lib/sysfs_block.c @@ -20,16 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ - -/* - * NOTES: - * Write functions to: - * Device major/minor given a device - * As of now, only the "block" device has writable attribs. - * Library has to take care of navigating to the attribute - * (may be at various directory levels) - */ - #include "libsysfs.h" #include "sysfs.h" @@ -151,7 +141,7 @@ static int get_all_block_devices(struct sysfs_block_device *block) default: /* these are the partitions */ part = alloc_block_partition(); if (part == NULL) { - perror("calloc"); + dprintf("calloc failed\n"); return -1; } part->directory = cur; @@ -187,7 +177,7 @@ struct sysfs_block_device *sysfs_open_block_device(unsigned char *name) block = alloc_block_device(); if (block == NULL) { - perror("calloc"); + dprintf("calloc failed\n"); return NULL; } strcpy(block->name, name); @@ -278,9 +268,7 @@ struct dlist *sysfs_get_partition_attributes */ struct dlist *sysfs_get_queue_attributes(struct sysfs_block_device *block) { - struct dlist *list = NULL; struct sysfs_directory *dir = NULL; - unsigned int found = 0; dlist_for_each_data(block->directory->subdirs, dir, struct sysfs_directory) { diff --git a/lib/sysfs_bus.c b/lib/sysfs_bus.c index 4d42c29..19fc275 100644 --- a/lib/sysfs_bus.c +++ b/lib/sysfs_bus.c @@ -289,7 +289,7 @@ struct sysfs_bus *sysfs_open_bus(const unsigned char *name) bus = alloc_bus(); if (bus == NULL) { - perror("malloc"); + dprintf("calloc failed\n"); return NULL; } strcpy(bus->name, name); diff --git a/lib/sysfs_class.c b/lib/sysfs_class.c index 4183f85..37c5243 100644 --- a/lib/sysfs_class.c +++ b/lib/sysfs_class.c @@ -153,7 +153,7 @@ struct sysfs_class_device *sysfs_open_class_device(const unsigned char *path) } cdev = alloc_class_device(); if (cdev == NULL) { - perror("malloc"); + dprintf("calloc failed\n"); return NULL; } if ((sysfs_get_name_from_path(path, cdev->name, SYSFS_NAME_LEN)) != 0) { @@ -264,7 +264,7 @@ struct sysfs_class *sysfs_open_class(const unsigned char *name) cls = alloc_class(); if (cls == NULL) { - perror("calloc"); + dprintf("calloc failed\n"); return NULL; } strcpy(cls->name, name); diff --git a/lib/sysfs_device.c b/lib/sysfs_device.c index 16270cb..e212056 100644 --- a/lib/sysfs_device.c +++ b/lib/sysfs_device.c @@ -117,7 +117,6 @@ struct sysfs_device *sysfs_open_device(const unsigned char *path) { struct sysfs_device *dev = NULL; struct sysfs_directory *sdir = NULL; - unsigned char *p = NULL; if (path == NULL) { errno = EINVAL; @@ -305,7 +304,7 @@ struct sysfs_root_device *sysfs_open_root_device(const unsigned char *name) root = (struct sysfs_root_device *)calloc (1, sizeof(struct sysfs_root_device)); if (root == NULL) { - perror("calloc"); + dprintf("calloc failure\n"); return NULL; } rootdir = open_root_device_dir(name); @@ -355,7 +354,6 @@ struct sysfs_device *sysfs_open_device_by_id(const unsigned char *bus_id, { char sysfs_path[SYSFS_PATH_MAX], device_path[SYSFS_PATH_MAX]; struct sysfs_device *device = NULL; - struct stat astats; if (bus_id == NULL || bus == NULL) { errno = EINVAL; diff --git a/lib/sysfs_dir.c b/lib/sysfs_dir.c index 796a592..77375f0 100644 --- a/lib/sysfs_dir.c +++ b/lib/sysfs_dir.c @@ -149,7 +149,7 @@ struct sysfs_attribute *sysfs_open_attribute(const unsigned char *path) } strncpy(sysattr->path, path, sizeof(sysattr->path)); if ((stat(sysattr->path, &fileinfo)) != 0) { - perror("stat"); + dprintf("stat failed\n"); sysattr->method = 0; } else { if (fileinfo.st_mode & S_IRUSR) @@ -196,8 +196,7 @@ int sysfs_write_attribute(struct sysfs_attribute *sysattr, * "write" permission */ if ((fd = open(sysattr->path, O_WRONLY)) < 0) { - perror("sysfs_write_attribute: open"); - dprintf ("Error reading attribute %s\n", sysattr->path); + dprintf("Error reading attribute %s\n", sysattr->path); return -1; } @@ -262,7 +261,7 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) pgsize = getpagesize(); fbuf = (unsigned char *)calloc(1, pgsize+1); if (fbuf == NULL) { - perror("calloc"); + dprintf("calloc failed\n"); return -1; } if ((fd = open(sysattr->path, O_RDONLY)) < 0) { @@ -281,7 +280,7 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) close(fd); vbuf = (unsigned char *)realloc(fbuf, length+1); if (vbuf == NULL) { - perror("realloc"); + dprintf("realloc failed\n"); free(fbuf); return -1; } @@ -504,7 +503,7 @@ int sysfs_read_directory(struct sysfs_directory *sysdir) } dir = opendir(sysdir->path); if (dir == NULL) { - perror("opendir"); + dprintf("Error opening directory %s\n", sysdir->path); return -1; } while(((dirent = readdir(dir)) != NULL) && retval == 0) { @@ -517,7 +516,7 @@ int sysfs_read_directory(struct sysfs_directory *sysdir) strncat(file_path, "/", sizeof(file_path)); strncat(file_path, dirent->d_name, sizeof(file_path)); if ((lstat(file_path, &astats)) != 0) { - perror("stat"); + dprintf("stat failed\n"); continue; } if (S_ISREG(astats.st_mode)) { diff --git a/lib/sysfs_driver.c b/lib/sysfs_driver.c index a936b4f..51a9107 100644 --- a/lib/sysfs_driver.c +++ b/lib/sysfs_driver.c @@ -177,7 +177,6 @@ struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver) struct sysfs_driver *sysfs_open_driver_by_name(const unsigned char *drv_name, const unsigned char *bus, size_t bsize) { - struct dlist *buslist = NULL, *drivers = NULL, *devices = NULL; struct sysfs_driver *driver = NULL; struct sysfs_device *device = NULL; struct sysfs_link *curlink = NULL; |