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 | |
parent | 4b726c94f0fcc8d16278fb4b20fab6ca8a4c177d (diff) | |
download | sysfsutils-a7f04eab974502d3bd7180f0aff35d97901106ed.tar.gz |
Change ver to 0.3.0
Remove perror usage
Fix warnings
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | cmd/Makefile.am | 4 | ||||
-rw-r--r-- | cmd/Makefile.in | 4 | ||||
-rw-r--r-- | cmd/lsbus.c | 4 | ||||
-rw-r--r-- | cmd/names.c | 16 | ||||
-rw-r--r-- | cmd/systool.c | 12 | ||||
-rwxr-xr-x | configure | 26 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-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 |
14 files changed, 45 insertions, 68 deletions
@@ -1,4 +1,9 @@ +10/14/2003 - Ananth Mavinakayanahalli <ananth@in.ibm.com> + * Changed version number to 0.3.0 + * Cleanups to remove warnings + * Remove perror usage + 10/10/2003 - Ananth Mavinakayanahalli <ananth@in.ibm.com> * Modified the way systool displayed block devices diff --git a/cmd/Makefile.am b/cmd/Makefile.am index 4bcc334..04e83ee 100644 --- a/cmd/Makefile.am +++ b/cmd/Makefile.am @@ -1,6 +1,6 @@ bin_PROGRAMS = systool lsbus -systool_SOURCES = systool.c names.c -lsbus_SOURCES = lsbus.c names.c +systool_SOURCES = systool.c names.c names.h +lsbus_SOURCES = lsbus.c names.c names.h INCLUDES = -I../include LDADD = ../lib/libsysfs.a diff --git a/cmd/Makefile.in b/cmd/Makefile.in index b263562..8dc7897 100644 --- a/cmd/Makefile.in +++ b/cmd/Makefile.in @@ -76,8 +76,8 @@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ bin_PROGRAMS = systool lsbus -systool_SOURCES = systool.c names.c -lsbus_SOURCES = lsbus.c names.c +systool_SOURCES = systool.c names.c names.h +lsbus_SOURCES = lsbus.c names.c names.h INCLUDES = -I../include LDADD = ../lib/libsysfs.a subdir = cmd diff --git a/cmd/lsbus.c b/cmd/lsbus.c index ed4db58..0c2e5ce 100644 --- a/cmd/lsbus.c +++ b/cmd/lsbus.c @@ -199,7 +199,7 @@ void print_device_attributes(struct dlist *attributes) void print_device(struct sysfs_device *device) { struct dlist *attributes = NULL; - unsigned int vendor_id, device_id, subsystem_vendor, subsystem_device; + unsigned int vendor_id, device_id; unsigned char buf[128], *value = NULL; if (device != NULL) { @@ -280,8 +280,6 @@ void print_driver_devices(struct sysfs_driver *driver) */ void print_driver(struct sysfs_driver *driver) { - struct dlist *links = NULL, *attributes = NULL; - if (driver != NULL) { fprintf (stdout, " %s\n", driver->name); print_driver_devices(driver); diff --git a/cmd/names.c b/cmd/names.c index 05a58b6..fafa866 100644 --- a/cmd/names.c +++ b/cmd/names.c @@ -1,5 +1,5 @@ /* - * $Id: names.c,v 1.1.2.3 2003/10/15 12:43:21 mananth Exp $ + * $Id: names.c,v 1.1.2.4 2003/10/15 12:45:44 mananth Exp $ * * The PCI Library -- ID to Name Translation * @@ -246,13 +246,13 @@ pci_lookup_name(struct pci_access *a, unsigned char *buf, int size, int flags, u switch (flags) { case PCI_LOOKUP_VENDOR: - if (n = nl_lookup(a, num, NL_VENDOR, arg1, 0, 0, 0)) + if ((n = nl_lookup(a, num, NL_VENDOR, arg1, 0, 0, 0))) return n->name; else res = snprintf(buf, size, "%04x", arg1); break; case PCI_LOOKUP_DEVICE: - if (n = nl_lookup(a, num, NL_DEVICE, arg1, arg2, 0, 0)) + if ((n = nl_lookup(a, num, NL_DEVICE, arg1, arg2, 0, 0))) return n->name; else res = snprintf(buf, size, "%04x", arg2); @@ -274,13 +274,13 @@ pci_lookup_name(struct pci_access *a, unsigned char *buf, int size, int flags, u res = snprintf(buf, size, "%04x:%04x", arg1, arg2); break; case PCI_LOOKUP_VENDOR | PCI_LOOKUP_SUBSYSTEM: - if (n = nl_lookup(a, num, NL_VENDOR, arg3, 0, 0, 0)) + if ((n = nl_lookup(a, num, NL_VENDOR, arg3, 0, 0, 0))) return n->name; else res = snprintf(buf, size, "%04x", arg2); break; case PCI_LOOKUP_DEVICE | PCI_LOOKUP_SUBSYSTEM: - if (n = nl_lookup(a, num, NL_SUBSYSTEM, arg1, arg2, arg3, arg4)) + if ((n = nl_lookup(a, num, NL_SUBSYSTEM, arg1, arg2, arg3, arg4))) return n->name; else if (arg1 == arg3 && arg2 == arg4 && (n = nl_lookup(a, num, NL_DEVICE, arg1, arg2, 0, 0))) return n->name; @@ -307,15 +307,15 @@ pci_lookup_name(struct pci_access *a, unsigned char *buf, int size, int flags, u res = snprintf(buf, size, "%04x:%04x", arg3, arg4); break; case PCI_LOOKUP_CLASS: - if (n = nl_lookup(a, num, NL_SUBCLASS, arg1 >> 8, arg1 & 0xff, 0, 0)) + if ((n = nl_lookup(a, num, NL_SUBCLASS, arg1 >> 8, arg1 & 0xff, 0, 0))) return n->name; - else if (n = nl_lookup(a, num, NL_CLASS, arg1, 0, 0, 0)) + else if ((n = nl_lookup(a, num, NL_CLASS, arg1, 0, 0, 0))) res = snprintf(buf, size, "%s [%04x]", n->name, arg1); else res = snprintf(buf, size, "Class %04x", arg1); break; case PCI_LOOKUP_PROGIF: - if (n = nl_lookup(a, num, NL_PROGIF, arg1 >> 8, arg1 & 0xff, arg2, 0)) + if ((n = nl_lookup(a, num, NL_PROGIF, arg1 >> 8, arg1 & 0xff, arg2, 0))) return n->name; if (arg1 == 0x0101) { diff --git a/cmd/systool.c b/cmd/systool.c index ad4de42..aa36439 100644 --- a/cmd/systool.c +++ b/cmd/systool.c @@ -243,7 +243,7 @@ void show_attributes(struct dlist *attributes, int level) void show_device(struct sysfs_device *device, int level) { struct dlist *attributes = NULL; - unsigned int vendor_id, device_id, subsystem_vendor, subsystem_device; + unsigned int vendor_id, device_id; unsigned char buf[128], *value = NULL; if (device != NULL) { @@ -504,16 +504,6 @@ int show_sysfs_root(unsigned char *rootname) errno = EINVAL; return 1; } - if (sysfs_get_mnt_path(path, SYSFS_PATH_MAX) != 0) { - perror("sysfs_get_mnt_path"); - fprintf(stderr, "Error getting sysfs mount point\n"); - exit(1); - } - - strcat(path, SYSFS_DEVICES_DIR); - strcat(path, "/"); - strcat(path, rootname); - root = sysfs_open_root_device(rootname); if (root == NULL) { fprintf(stderr, "Error opening root device %s\n", rootname); @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.53 for sysfsutils 0_2_0. +# Generated by GNU Autoconf 2.53 for sysfsutils 0.3.0. # # Report bugs to <linux-diag-devel@lists.sourceforge.net>. # @@ -256,8 +256,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='sysfsutils' PACKAGE_TARNAME='sysfsutils' -PACKAGE_VERSION='0_2_0' -PACKAGE_STRING='sysfsutils 0_2_0' +PACKAGE_VERSION='0.3.0' +PACKAGE_STRING='sysfsutils 0.3.0' PACKAGE_BUGREPORT='linux-diag-devel@lists.sourceforge.net' ac_unique_file="lib/sysfs_bus.c" @@ -762,7 +762,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sysfsutils 0_2_0 to adapt to many kinds of systems. +\`configure' configures sysfsutils 0.3.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -824,7 +824,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sysfsutils 0_2_0:";; + short | recursive ) echo "Configuration of sysfsutils 0.3.0:";; esac cat <<\_ACEOF @@ -883,7 +883,7 @@ esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` @@ -909,7 +909,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -sysfsutils configure 0_2_0 +sysfsutils configure 0.3.0 generated by GNU Autoconf 2.53 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -924,7 +924,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sysfsutils $as_me 0_2_0, which was +It was created by sysfsutils $as_me 0.3.0, which was generated by GNU Autoconf 2.53. Invocation command line was $ $0 $@ @@ -1456,7 +1456,7 @@ fi # Define the identity of the package. PACKAGE=sysfsutils - VERSION=0_2_0 + VERSION=0.3.0 cat >>confdefs.h <<_ACEOF @@ -4313,7 +4313,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by sysfsutils $as_me 0_2_0, which was +This file was extended by sysfsutils $as_me 0.3.0, which was generated by GNU Autoconf 2.53. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4375,7 +4375,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -sysfsutils config.status 0_2_0 +sysfsutils config.status 0.3.0 configured by $0, generated by GNU Autoconf 2.53, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -4710,7 +4710,7 @@ esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` @@ -5063,7 +5063,7 @@ esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` diff --git a/configure.ac b/configure.ac index 83d62df..c561cc3 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ # Process this file with autoconf to produce a configure script. -AC_INIT(sysfsutils, 0_2_0, linux-diag-devel@lists.sourceforge.net) +AC_INIT(sysfsutils, 0.3.0, linux-diag-devel@lists.sourceforge.net) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([lib/sysfs_bus.c]) AM_CONFIG_HEADER([config.h]) 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; |