open-isns: Fix warnings reported by gcc-4.5.2
[open-iscsi.git] / usr / sysfs.h
blobf5e13b3ea5a2cf08fd8df075869936997bb20827
1 /*
2 * This is from udev-121 udev.h
4 * Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
5 * Copyright (C) 2003-2006 Kay Sievers <kay.sievers@vrfy.org>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation version 2 of the License.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef _SYSFS_
23 #define _SYSFS_
25 #include <stdint.h>
26 #include "list.h"
27 #include "string.h"
29 #define PATH_SIZE 512
30 #define NAME_SIZE 256
32 struct sysfs_device {
33 struct list_head node; /* for device cache */
34 struct sysfs_device *parent; /* already cached parent*/
35 char devpath[PATH_SIZE];
36 char subsystem[NAME_SIZE]; /* $class, $bus, drivers, module */
37 char kernel[NAME_SIZE]; /* device instance name */
38 char kernel_number[NAME_SIZE];
39 char driver[NAME_SIZE]; /* device driver name */
42 extern char sysfs_path[PATH_SIZE];
43 extern int sysfs_init(void);
44 extern void sysfs_cleanup(void);
45 extern void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath,
46 const char *subsystem, const char *driver);
47 extern struct sysfs_device *sysfs_device_get(const char *devpath);
48 extern struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev);
49 extern struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem);
50 extern char *sysfs_attr_get_value(const char *devpath, const char *attr_name);
51 extern int sysfs_resolve_link(char *path, size_t size);
52 extern int sysfs_lookup_devpath_by_subsys_id(char *devpath, size_t len, const char *subsystem, const char *id);
54 extern char *sysfs_get_value(const char *id, char *subsys, char *param);
55 extern int sysfs_get_uint(char *id, char *subsys, char *param,
56 unsigned int *value);
57 extern int sysfs_get_int(const char *id, char *subsys, char *param, int *value);
58 extern int sysfs_get_str(char *id, char *subsys, char *param, char *value,
59 int value_size);
60 extern int sysfs_get_uint64(char *id, char *subsys, char *param,
61 uint64_t *value);
62 extern int sysfs_set_param(char *id, char *subsys, char *attr_name,
63 char *write_buf, ssize_t buf_size);
65 #endif