summaryrefslogtreecommitdiffstats
path: root/include/sysfs.h
diff options
context:
space:
mode:
authorKarel Zak2018-05-09 15:54:12 +0200
committerKarel Zak2018-06-21 11:58:10 +0200
commit1ed21c80ed3683c17708caad3d545da4d8e09b02 (patch)
tree6a37d3f03c6c9e5031aa04d4554cebb6ef318e32 /include/sysfs.h
parentlsblk: add partition table UUID and type fields. (diff)
downloadkernel-qcow2-util-linux-1ed21c80ed3683c17708caad3d545da4d8e09b02.tar.gz
kernel-qcow2-util-linux-1ed21c80ed3683c17708caad3d545da4d8e09b02.tar.xz
kernel-qcow2-util-linux-1ed21c80ed3683c17708caad3d545da4d8e09b02.zip
lib/path: new implementation
The goal is to avoid duplicate code in path.c and sysfs.c and make it possible to define prefix for paths for all sysfs and procfs based utils. Now we have /proc snapshots (for tests) for lscpu only. It would be nice to have the same (for sysfs) for lsblk and another tools. * very simple API to read numbers, strings and symlinks * based on openat() pc = ul_new_path("/sys/block/sda"); ul_path_read_u64(pc, &size, "size"); ul_path_read_u64(pc, &lsz, "queue/logical_block_size"); * printf-like API to generate paths, for example: ul_path_readf_u64(pc, &num, "sda%d/size", partno) * allow to define prefix to redirect hardcoded paths to another location, for example: pc = ul_new_path("/sys/block/sda"); ul_path_set_prefix(pc, "/my/regression/dump"); ul_path_read_u64(pc, &num, "size"); to read /my/regression/dump/sys/block/sda/size * allow to extend the API by "dialects", for example for sysfs: pc = ul_new_path(NULL); sysfs_blkdev_init_path(pc, devno, NULL); and use ul_path_* functions to read from @pc initialized by sysfs_blkdev_init_path() * add test_path binary Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'include/sysfs.h')
0 files changed, 0 insertions, 0 deletions