diff options
author | Karel Zak | 2018-05-16 13:20:39 +0200 |
---|---|---|
committer | Karel Zak | 2018-06-21 13:07:46 +0200 |
commit | 708a58b665a2157c4d6f9057246a1531ae3ae33a (patch) | |
tree | dc0f36e29bdf9df025f5d97dc851845ec175cdd2 /libblkid/src/devname.c | |
parent | lib/sysfs: add sysfs_blkdev_get_parent() (diff) | |
download | kernel-qcow2-util-linux-708a58b665a2157c4d6f9057246a1531ae3ae33a.tar.gz kernel-qcow2-util-linux-708a58b665a2157c4d6f9057246a1531ae3ae33a.tar.xz kernel-qcow2-util-linux-708a58b665a2157c4d6f9057246a1531ae3ae33a.zip |
libblkid: use new ul_path_* API
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libblkid/src/devname.c')
-rw-r--r-- | libblkid/src/devname.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libblkid/src/devname.c b/libblkid/src/devname.c index 59029ec06..986bcf241 100644 --- a/libblkid/src/devname.c +++ b/libblkid/src/devname.c @@ -565,6 +565,7 @@ static int probe_all(blkid_cache cache, int only_if_new) */ static int probe_all_removable(blkid_cache cache) { + struct path_cxt *pc; DIR *dir; struct dirent *d; @@ -575,8 +576,9 @@ static int probe_all_removable(blkid_cache cache) if (!dir) return -BLKID_ERR_PROC; + pc = ul_new_path(NULL); + while((d = readdir(dir))) { - struct sysfs_cxt sysfs = UL_SYSFSCXT_EMPTY; int removable = 0; dev_t devno; @@ -589,20 +591,19 @@ static int probe_all_removable(blkid_cache cache) ((d->d_name[1] == '.') && (d->d_name[2] == 0)))) continue; - devno = sysfs_devname_to_devno(d->d_name, NULL); + devno = sysfs_devname_to_devno(d->d_name); if (!devno) continue; - if (sysfs_init(&sysfs, devno, NULL) == 0) { - if (sysfs_read_int(&sysfs, "removable", &removable) != 0) + if (sysfs_blkdev_init_path(pc, devno, NULL) == 0 + && ul_path_read_s32(pc, &removable, "removable") != 0) removable = 0; - sysfs_deinit(&sysfs); - } if (removable) probe_one(cache, d->d_name, devno, 0, 0, 1); } + ul_unref_path(pc); closedir(dir); return 0; } |