Commit 07c8c44a authored by Jeremy Bicha's avatar Jeremy Bicha

Import Upstream version 2.1.0+repack

parent 0e710b70
Ananth Mavinakayanahalli <ananth@in.ibm.com>
Daniel Stekloff <dsteklof@us.ibm.com>
Mohan Kumar <mohan@in.ibm.com>
Nitin Vashisth <vnitin@in.ibm.com>
The commands and utilities under the "test" directory are licensed under the
GNU General Public License (GPL) Version 2, June 1991. The full text of the
GPL is located at:
sysfsutils/cmd/GPL
The sysfs library is licensed under the GNU Lesser Public License (LGPL)
Version 2.1, February 1999. The full text of the LGPL is located at:
sysfsutils/lib/LGPL
The authors of sysfsutils would like to thank the following people who
have made contributions:
o Lev Makhlis <mlev@despammed.com>:
- Supplied libsysfs code cleanup including code
simplification, read-only strings, and
C++ compatibility.
o Eric J Bohm <bohm@gate.csgeeks.org>:
- Supplied dlist generic linked list implementation.
- Added dlist_for_each* functionality.
o Guo Min <min.guo@intel.com>:
- Supplied sysfs_write_attribute patch
o Martin Mares <mj@ucw.cz>
- Author of pciutils. Reused the pci name decoding
from Martin's library.
o Martin Pitt <mpitt@debian.org>
- Supplied initial makefiles for lsbus and systool
o Martin Hicks <mort@bork.org>
- Supplied patch to fix class_device functions
o Brian King <brking@us.ibm.com>
- Supplied patch to fix a memory leak in sysfs_dir.c
o Martin Schlemmer <azarah@gentoo.org>
- Supplied patch to prevent checks for installed
headers, while building.
o Lev Makhlis <mlev@despammed.com>
- Supplied patch to make library C++ compatible.
o Dr. Hannes Reinecke <hare@suse.de>
- Supplied patch to fix SEGV in dlist.c
o Arun Bhanu <arun@codemovers.org>
- Supplied patch to fix docs/libsysfs.txt
o Kay Sievers <kay.sievers@vrfy.org>
- Supplied patch to fix sysfs_get_classdir_attr when
the directory vanishes from under us.
- Updates for building with udev and klibc.
- Numerous other updates, cleanups and general guidelines
o Dominik Brodowski <linux@dominikbrodowski.net>
- Fix feature in sysfs_write_attribute(), will now
write new value to attribute if attribute
is a show method and previously had nothing
to be read.
o Martin Schlemmer <azarah@nosferatu.za.org>
- KLIBC updates
o Pavel Roskin <proski@gnu.org>
- Use buildroot for rpmbuilds
/AUTHORS/1.2.2.1/Tue Dec 6 09:03:17 2005//Tsysfsutils-2_1_0
/COPYING/1.2/Wed Apr 6 20:57:01 2005//Tsysfsutils-2_1_0
/CREDITS/1.2.2.3/Tue Dec 6 09:03:17 2005//Tsysfsutils-2_1_0
/ChangeLog/1.2.2.18.4.1/Wed Aug 23 07:37:02 2006//Tsysfsutils-2_1_0
/INSTALL/1.2/Wed Apr 6 20:57:01 2005//Tsysfsutils-2_1_0
/Makefile.am/1.2.2.3/Tue Dec 6 09:03:17 2005//Tsysfsutils-2_1_0
/Makefile.in/1.2.2.7/Tue Dec 6 09:03:17 2005//Tsysfsutils-2_1_0
/NEWS/1.2/Wed Apr 6 20:57:01 2005//Tsysfsutils-2_1_0
/README/1.2.2.3.4.1/Wed Aug 23 07:37:02 2006//Tsysfsutils-2_1_0
/TODO/1.2/Wed Apr 6 20:57:01 2005//Tsysfsutils-2_1_0
/aclocal.m4/1.2.2.3/Fri Nov 25 14:06:04 2005//Tsysfsutils-2_1_0
/compile/1.2/Wed Apr 6 20:57:01 2005//Tsysfsutils-2_1_0
/config.guess/1.2.2.1/Fri Nov 25 14:06:04 2005//Tsysfsutils-2_1_0
/config.h.in/1.2.2.2/Fri Nov 25 14:06:04 2005//Tsysfsutils-2_1_0
/config.sub/1.2.2.1/Fri Nov 25 14:06:04 2005//Tsysfsutils-2_1_0
/configure/1.2.2.4/Fri Nov 25 14:06:04 2005//Tsysfsutils-2_1_0
/configure.ac/1.2.2.3/Mon Aug 7 05:08:00 2006//Tsysfsutils-2_1_0
/depcomp/1.2/Wed Apr 6 20:57:02 2005//Tsysfsutils-2_1_0
/install-sh/1.2/Wed Apr 6 20:57:02 2005//Tsysfsutils-2_1_0
/ltmain.sh/1.2.2.2/Fri Nov 25 14:06:04 2005//Tsysfsutils-2_1_0
/missing/1.2/Wed Apr 6 20:57:02 2005//Tsysfsutils-2_1_0
/mkinstalldirs/1.2/Wed Apr 6 20:57:02 2005//Tsysfsutils-2_1_0
/systool.1/1.2.2.1/Tue Dec 6 09:03:17 2005//Tsysfsutils-2_1_0
D
A D/cmd////
A D/docs////
A D/include////
A D/lib////
A D/m4////
A D/test////
:ext:mohanltc@linux-diag.cvs.sourceforge.net:/cvsroot/linux-diag
Tsysfsutils-2_1_0
This diff is collapsed.
Copyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. (Caching is
disabled by default to prevent problems with accidental use of stale
cache files.)
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You only need
`configure.ac' if you want to change it or regenerate `configure' using
a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. Run `./configure --help'
for details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not support the `VPATH'
variable, you have to compile the package for one architecture at a
time in the source code directory. After you have installed the
package for one architecture, use `make distclean' before reconfiguring
for another architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, `configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the `--target=TYPE' option to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
will cause the specified gcc to be used as the C compiler (unless it is
overridden in the site shell script).
`configure' Invocation
======================
`configure' recognizes the following options to control how it
operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
man_MANS = systool.1
EXTRA_DIST = docs include $(man_MANS) CREDITS lib/LGPL cmd/GPL test/GPL
SUBDIRS = lib cmd test
includedir=@includedir@/sysfs
include_HEADERS = include/libsysfs.h include/dlist.h
dist-hook:
rm -rf `find $(distdir)/docs -name CVS`
rm -rf `find $(distdir)/include -name CVS`
This diff is collapsed.
Version History:
---------------
1.2.0 - Released September 13, 2004
* Added dlist_sort_custom() (Thanks to Eric Bohm)
* Some minor bug fixes.
1.1.0 - Released March 31, 2004
* Added changes for C++ compatibility (Thanks to Lev Makhlis)
* Patched configure.ac not to check for installed headers
* Fixed SEGV in dlist.c (Thanks to Dr. Hannes Reinecke)
* Added security audits in library.
1.0.0 - Released February 24, 2004
* Libsysfs now ships with a comprehensive testsuite.
* List elements are now maintained in sorted order.
* Updated systool for better output and removed lsbus
from the package.
* Populated sysfs_device->drivername field correctly.
If device does not have a driver, field reflects
"unknown".
* Added additional CFLAGS while building the package.
0.4.0 - Released December 18, 2003
* Lots of optimizations. Structure elements that are dlists
or structs themselves are not populated by default.
* Provided APIs for applications to obtain dlists
and structure elements.
* Modified API prototypes to be more meaningful.
* Included manpages for systool and lsbus.
* Added support functions to obtain "parent" of
sysfs_device and sysfs_class_device.
* Modified Makefile.am to make use of Libtool's versioning
facility.
0.3.0 - Released November 6, 2003
* Added support to build shared library
* Added patch to consider "block" as a class
* Corrected "write" attribute functions
* Added more "find/open" functions
* Added pci name decode support
* Added "test" functions to demonstrate API usage
* Lots of other updates resulting from user feedback
0.2.0 - Released August 29, 2003
* Added autoconf configuration support.
* Added Eric J Bohm's dlist patch.
* Changed the library structures and routines to use dlists.
* Added Guo Min's sysfs_write_attribute patch
* Added sysfs_root_device for use with /sys/devices subsystem
* Added lots of "find"/utility functions.
* Modified commands to make use of new API.
* Added functions to get lists of specific subsystems.
0.1.1 - Released August 1, 2003
* Created NEWS file for Version History.
* Added device reference in sysfs_driver.
* Added parent reference in sysfs_device.
* Applied Lev Makhlis' code cleanup patch.
* Removed "-t" option.
* Added binary attribute support.
* Changed sysfs_dlink to generic sysfs_link and
removed sysfs_read_dlinks function.
* Changed sysutils to sysfsutils
0.1.0 - Released June 30, 2003
Sysfs Utilities Package - Includes Libsysfs(v. 2.1.0)
======================================================
Contents
--------
1. Introduction
2. How to Install
2.1 Caveats/Known issues
3. Licenses
4. Reporting Bugs
1. Introduction
---------------
This package's purpose is to provide a set of utilities for interfacing
with sysfs, a virtual filesystem in Linux kernel versions 2.5+ that
provides a tree of system devices. While a filesystem is a very useful
interface, we've decided to provide a stable programming interface
that will hopefully make it easier for applications to query system devices
and their attributes.
This package currently includes:
- libsysfs: a library for accessing system devices.
- systool: an application to view system device information by bus, class,
and topology.
- A number of example usage routines in the "test" directory.
- A comprehensive testsuite, also shipped as part of the "test" directory. This
testsuite can be used to test _all_ the APIs exported by Libsysfs.
Please refer the libsysfs.txt file in the "docs" directory for
details as to how to use the testsuite.
2. How to Install
-----------------
Run the "configure" script to generate Makefiles. Use "make" to build the
library and utilities.
For a successful install, run "make install" as super-user. "make uninstall"
will clean up all installed files.
3. Licenses
-----------
The commands and tests are licensed under the GNU Public License (GPL)
Version2, June 1991. The full text of the GPL is located in this package's
"cmd" directory:
sysfsutils/cmd/GPL
The library is licensed under the GNU Lesser Public License (LGPL)
Version 2.1, February 1999. The full text of the LGPL is located in
this package's "lib" directory:
sysfsutils/lib/LGPL
4. Reporting Bugs
-----------------
Please direct all bugs to either the linux-diag mailing list -
linux-diag-devel@lists.sourceforge.net - or to the authors:
Ananth Mavinakayanahalli <ananth@in.ibm.com>
Daniel Stekloff <dsteklof@us.ibm.com>
Mohan Kumar <mohan@in.ibm.com>
Library:
--------
- Rework debugging error messages and look into better logging on error.
Commands:
---------
- Add topology tree view.
Documentation:
--------------
- Update/improve documentation.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/GPL/1.1.1.1/Mon Aug 25 08:12:28 2003//Tsysfsutils-2_1_0
/Makefile.am/1.2.2.2/Fri Nov 25 14:06:05 2005//Tsysfsutils-2_1_0
/Makefile.in/1.2.2.3/Fri Nov 25 14:06:05 2005//Tsysfsutils-2_1_0
/names.c/1.2.2.1/Wed Apr 6 23:18:11 2005//Tsysfsutils-2_1_0
/names.h/1.2.2.1/Wed Apr 6 23:18:11 2005//Tsysfsutils-2_1_0
/systool.c/1.2.2.3/Fri Nov 25 14:06:05 2005//Tsysfsutils-2_1_0
D
sysfsutils/cmd
:ext:mohanltc@linux-diag.cvs.sourceforge.net:/cvsroot/linux-diag
Tsysfsutils-2_1_0
This diff is collapsed.
bin_PROGRAMS = systool
systool_SOURCES = systool.c names.c names.h
INCLUDES = -I../include
LDADD = ../lib/libsysfs.la
EXTRA_CFLAGS = @EXTRA_CFLAGS@
AM_CFLAGS = -Wall -W -Wstrict-prototypes $(EXTRA_CFLAGS)
This diff is collapsed.
/*
* $Id: names.c,v 1.2.2.1 2005/04/06 23:18:11 stekloff Exp $
*
* The PCI Library -- ID to Name Translation
*
* Copyright (c) 1997--2002 Martin Mares <mj@ucw.cz>
*
* Can be freely distributed and used under the terms of the GNU GPL.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <errno.h>
#include "names.h"
struct nl_entry {
struct nl_entry *next;
unsigned short id1, id2, id3, id4;
int cat;
unsigned char *name;
};
#define NL_VENDOR 0
#define NL_DEVICE 1
#define NL_SUBSYSTEM 2
#define NL_CLASS 3
#define NL_SUBCLASS 4
#define NL_PROGIF 5
#define HASH_SIZE 1024
static inline unsigned int nl_calc_hash(int cat, int id1, int id2, int id3, int id4)
{
unsigned int h;
h = id1 ^ id2 ^ id3 ^ id4 ^ (cat << 5);
h += (h >> 6);
return h & (HASH_SIZE-1);
}
static struct nl_entry *nl_lookup(struct pci_access *a, int num, int cat, int id1, int id2, int id3, int id4)
{
unsigned int h;
struct nl_entry *n;
if (num)
return NULL;
h = nl_calc_hash(cat, id1, id2, id3, id4);
n = a->nl_hash[h];
while (n && (n->id1 != id1 || n->id2 != id2 || n->id3 != id3 || n->id4 != id4 || n->cat != cat))
n = n->next;
return n;
}
static int nl_add(struct pci_access *a, int cat, int id1, int id2, int id3, int id4, unsigned char *text)
{
unsigned int h = nl_calc_hash(cat, id1, id2, id3, id4);
struct nl_entry *n = a->nl_hash[h];
while (n && (n->id1 != id1 || n->id2 != id2 || n->id3 != id3 || n->id4 != id4 || n->cat != cat))
n = n->next;
if (n)
return 1;
n = malloc(sizeof(struct nl_entry));
bzero(n, sizeof(struct nl_entry));
n->id1 = id1;
n->id2 = id2;
n->id3 = id3;
n->id4 = id4;
n->cat = cat;
n->name = text;
n->next = a->nl_hash[h];
a->nl_hash[h] = n;
return 0;
}
static void
err_name_list(struct pci_access *a, unsigned char *msg)
{
fprintf(stderr, "%s: %s: %s\n", a->pci_id_file_name, msg, strerror(errno));
}
static void
parse_name_list(struct pci_access *a)
{
unsigned char *p = a->nl_list;
unsigned char *q, *r;
int lino = 0;
unsigned int id1=0, id2=0, id3=0, id4=0;
int cat = -1;
while (*p)
{
lino++;
q = p;
while (*p && *p != '\n')
p++;
if (*p == '\n')
*p++ = 0;
if (!*q || *q == '#')
continue;
r = p;
while (r > q && r[-1] == ' ')
*--r = 0;
r = q;
while (*q == '\t')
q++;
if (q == r)
{
if (q[0] == 'C' && q[1] == ' ')
{
if (strlen(q+2) < 3 ||
q[4] != ' ' ||
sscanf(q+2, "%x", &id1) != 1)
goto parserr;
cat = NL_CLASS;
}
else
{
if (strlen(q) < 5 ||
q[4] != ' ' ||
sscanf(q, "%x", &id1) != 1)
goto parserr;
cat = NL_VENDOR;
}
id2 = id3 = id4 = 0;
q += 4;
}
else if (q == r+1)
switch (cat)
{
case NL_VENDOR:
case NL_DEVICE:
case NL_SUBSYSTEM:
if (sscanf(q, "%x", &id2) != 1 || q[4] != ' ')
goto parserr;
q += 5;
cat = NL_DEVICE;
id3 = id4 = 0;
break;
case NL_CLASS:
case NL_SUBCLASS:
case NL_PROGIF:
if (sscanf(q, "%x", &id2) != 1 || q[2] != ' ')
goto parserr;
q += 3;
cat = NL_SUBCLASS;
id3 = id4 = 0;
break;
default:
goto parserr;
}
else if (q == r+2)
switch (cat)
{
case NL_DEVICE:
case NL_SUBSYSTEM:
if (sscanf(q, "%x%x", &id3, &id4) != 2 || q[9] != ' ')
goto parserr;
q += 10;
cat = NL_SUBSYSTEM;
break;
case NL_CLASS:
case NL_SUBCLASS:
case NL_PROGIF:
if (sscanf(q, "%x", &id3) != 1 || q[2] != ' ')
goto parserr;
q += 3;
cat = NL_PROGIF;
id4 = 0;
break;
default:
goto parserr;
}
else
goto parserr;
while (*q == ' ')
q++;
if (!*q)
goto parserr;
if (nl_add(a, cat, id1, id2, id3, id4, q))
fprintf(stderr, "%s, line %d: duplicate entry", a->pci_id_file_name, lino);
}
return;