summaryrefslogtreecommitdiff
path: root/include/libsysfs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libsysfs.h')
-rw-r--r--include/libsysfs.h30
1 files changed, 19 insertions, 11 deletions
diff --git a/include/libsysfs.h b/include/libsysfs.h
index 70cd5e8..ee2b23d 100644
--- a/include/libsysfs.h
+++ b/include/libsysfs.h
@@ -75,17 +75,15 @@ struct sysfs_directory {
};
struct sysfs_driver {
- struct dlist *devices;
unsigned char name[SYSFS_NAME_LEN];
unsigned char path[SYSFS_PATH_MAX];
/* for internal use only */
+ struct dlist *devices;
struct sysfs_directory *directory;
};
struct sysfs_device {
- struct sysfs_device *parent;
- struct dlist *children;
unsigned char name[SYSFS_NAME_LEN];
unsigned char bus_id[SYSFS_NAME_LEN];
unsigned char bus[SYSFS_NAME_LEN];
@@ -93,45 +91,47 @@ struct sysfs_device {
unsigned char path[SYSFS_PATH_MAX];
/* for internal use only */
+ struct sysfs_device *parent;
+ struct dlist *children;
struct sysfs_directory *directory;
};
struct sysfs_root_device {
- struct dlist *devices;
unsigned char name[SYSFS_NAME_LEN];
unsigned char path[SYSFS_PATH_MAX];
/* for internal use only */
+ struct dlist *devices;
struct sysfs_directory *directory;
};
struct sysfs_bus {
- struct dlist *drivers;
- struct dlist *devices;
unsigned char name[SYSFS_NAME_LEN];
unsigned char path[SYSFS_PATH_MAX];
/* internal use only */
+ struct dlist *drivers;
+ struct dlist *devices;
struct sysfs_directory *directory;
};
struct sysfs_class_device {
- struct sysfs_device *sysdevice; /* NULL if virtual */
- struct sysfs_driver *driver; /* NULL if not implemented */
unsigned char name[SYSFS_NAME_LEN];
unsigned char classname[SYSFS_NAME_LEN];
unsigned char path[SYSFS_PATH_MAX];
/* for internal use only */
+ struct sysfs_device *sysdevice; /* NULL if virtual */
+ struct sysfs_driver *driver; /* NULL if not implemented */
struct sysfs_directory *directory;
};
struct sysfs_class {
- struct dlist *devices;
unsigned char name[SYSFS_NAME_LEN];
unsigned char path[SYSFS_PATH_MAX];
/* for internal use only */
+ struct dlist *devices;
struct sysfs_directory *directory;
};
@@ -145,6 +145,7 @@ extern "C" {
extern int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len);
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_get_link(const unsigned char *path, unsigned char *target,
size_t len);
extern struct dlist *sysfs_open_subsystem_list(unsigned char *name);
@@ -178,13 +179,12 @@ extern struct sysfs_attribute *sysfs_get_directory_attribute
(struct sysfs_directory *dir, unsigned char *attrname);
/* sysfs driver access */
-extern void sysfs_close_bus_driver(struct sysfs_driver *driver);
-extern struct sysfs_driver *sysfs_open_bus_driver(const unsigned char *path);
extern void sysfs_close_driver(struct sysfs_driver *driver);
extern struct sysfs_driver *sysfs_open_driver(const unsigned char *path);
extern struct sysfs_attribute *sysfs_get_driver_attr
(struct sysfs_driver *drv, const unsigned 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_get_driver_links(struct sysfs_driver *driver);
extern struct sysfs_device *sysfs_get_driver_device
(struct sysfs_driver *driver, const unsigned char *name);
@@ -195,6 +195,7 @@ extern struct sysfs_attribute *sysfs_open_driver_attr(const unsigned char *bus,
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 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 *path);
extern struct sysfs_attribute *sysfs_get_device_attr
@@ -212,6 +213,8 @@ extern struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus,
unsigned char *id);
extern struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus,
unsigned 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 sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus,
unsigned char *attrname);
@@ -224,8 +227,13 @@ extern int sysfs_find_driver_bus(const unsigned char *driver,
extern void sysfs_close_class_device(struct sysfs_class_device *dev);
extern struct sysfs_class_device *sysfs_open_class_device
(const unsigned char *path);
+extern struct sysfs_device *sysfs_get_classdev_device
+ (struct sysfs_class_device *clsdev);
+extern struct sysfs_driver *sysfs_get_classdev_driver
+ (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 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);
extern struct sysfs_class_device *sysfs_open_class_device_by_name