summaryrefslogtreecommitdiff
path: root/include/libsysfs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libsysfs.h')
-rw-r--r--include/libsysfs.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/libsysfs.h b/include/libsysfs.h
index 2a96b6d..da0a3ee 100644
--- a/include/libsysfs.h
+++ b/include/libsysfs.h
@@ -33,6 +33,7 @@
#define SYSFS_PROC_MNTS "/proc/mounts"
#define SYSFS_BUS_DIR "/bus"
#define SYSFS_CLASS_DIR "/class"
+#define SYSFS_BLOCK_DIR "/block"
#define SYSFS_DEVICES_DIR "/devices"
#define SYSFS_DEVICES_NAME "devices"
#define SYSFS_DRIVERS_DIR "/drivers"
@@ -40,6 +41,10 @@
#define SYSFS_NAME_ATTRIBUTE "name"
#define SYSFS_UNKNOWN "unknown"
+/* Some "block" subsystem specific #defines */
+#define SYSFS_QUEUE_NAME "queue"
+#define SYSFS_IOSCHED_NAME "iosched"
+
#define SYSFS_PATH_MAX 255
#define SYSFS_NAME_LEN 50
#define SYSFS_BUS_ID_SIZE 20
@@ -127,6 +132,23 @@ struct sysfs_class {
struct sysfs_directory *directory;
};
+struct sysfs_block_device {
+ struct sysfs_device *device; /* the physical device */
+ struct dlist *partitions; /* struct sysfs_block_partition */
+ unsigned char name[SYSFS_NAME_LEN];
+ unsigned char path[SYSFS_PATH_MAX];
+
+ /* for internal use only */
+ struct sysfs_directory *directory;
+};
+
+struct sysfs_block_partition {
+ unsigned char name[SYSFS_NAME_LEN];
+
+ /* for internal use only */
+ struct sysfs_directory *directory;
+};
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -226,6 +248,20 @@ extern int sysfs_find_device_class_name(unsigned char *bus_id,
extern int sysfs_write_classdev_attr(unsigned char *dev,
unsigned char *attrib, unsigned char *value);
+/* generic sysfs block access */
+extern void sysfs_close_block_partition
+ (struct sysfs_block_partition *partition);
+extern void sysfs_close_block_device(struct sysfs_block_device *block);
+extern struct sysfs_block_device *sysfs_open_block_device(unsigned char *name);
+extern struct dlist *sysfs_get_blockdev_attributes
+ (struct sysfs_block_device *block);
+extern struct dlist *sysfs_get_partition_attributes
+ (struct sysfs_block_partition *part);
+extern struct dlist *sysfs_get_queue_attributes
+ (struct sysfs_block_device *block);
+extern struct dlist *sysfs_get_iosched_attributes
+ (struct sysfs_block_device *block);
+
#ifdef __cplusplus
}
#endif