summaryrefslogtreecommitdiffstats
path: root/include/sysfs.h
diff options
context:
space:
mode:
authorKarel Zak2011-05-18 16:24:37 +0200
committerKarel Zak2011-05-18 16:24:37 +0200
commit413993fcb1571e2a9208e19b1a54ee132ef5bfa3 (patch)
treeb925aec11925b2daf0dc5f366ea1ba9930d43463 /include/sysfs.h
parentlib: [at.c] add readlink_at(), fix semantic for absolute paths (diff)
downloadkernel-qcow2-util-linux-413993fcb1571e2a9208e19b1a54ee132ef5bfa3.tar.gz
kernel-qcow2-util-linux-413993fcb1571e2a9208e19b1a54ee132ef5bfa3.tar.xz
kernel-qcow2-util-linux-413993fcb1571e2a9208e19b1a54ee132ef5bfa3.zip
lib: [sysfs.c] add sysfs_readlink and name/path functions
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'include/sysfs.h')
-rw-r--r--include/sysfs.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/sysfs.h b/include/sysfs.h
index 5190ac482..a26e0a72e 100644
--- a/include/sysfs.h
+++ b/include/sysfs.h
@@ -27,9 +27,10 @@ struct sysfs_cxt {
extern char *sysfs_devno_attribute_path(dev_t devno, char *buf,
- size_t buflen, const char *attr);
+ size_t bufsiz, const char *attr);
extern int sysfs_devno_has_attribute(dev_t devno, const char *attr);
-extern char *sysfs_devno_path(dev_t devno, char *buf, size_t buflen);
+extern char *sysfs_devno_path(dev_t devno, char *buf, size_t bufsiz);
+extern char *sysfs_devno_to_devpath(dev_t devno, char *buf, size_t bufsiz);
extern dev_t sysfs_devname_to_devno(const char *name, const char *parent);
extern int sysfs_init(struct sysfs_cxt *cxt, dev_t devno,
@@ -39,6 +40,8 @@ extern void sysfs_deinit(struct sysfs_cxt *cxt);
extern DIR *sysfs_opendir(struct sysfs_cxt *cxt, const char *attr);
extern int sysfs_stat(struct sysfs_cxt *cxt, const char *attr, struct stat *st);
+extern ssize_t sysfs_readlink(struct sysfs_cxt *cxt, const char *attr,
+ char *buf, size_t bufsiz);
extern int sysfs_has_attribute(struct sysfs_cxt *cxt, const char *attr);
extern int sysfs_scanf(struct sysfs_cxt *cxt, const char *attr,
@@ -49,10 +52,13 @@ extern int sysfs_read_s64(struct sysfs_cxt *cxt, const char *attr, int64_t *res)
extern int sysfs_read_u64(struct sysfs_cxt *cxt, const char *attr, uint64_t *res);
extern int sysfs_read_int(struct sysfs_cxt *cxt, const char *attr, int *res);
+extern char *sysfs_get_devname(struct sysfs_cxt *cxt, char *buf, size_t bufsiz);
+
extern char *sysfs_strdup(struct sysfs_cxt *cxt, const char *attr);
extern int sysfs_count_dirents(struct sysfs_cxt *cxt, const char *attr);
extern int sysfs_count_partitions(struct sysfs_cxt *cxt, const char *devname);
+extern char *sysfs_get_slave(struct sysfs_cxt *cxt);
extern int sysfs_is_partition_dirent(DIR *dir, struct dirent *d,
const char *parent_name);