partx: use new ul_path_* API
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
7f8a406679
commit
61bc5fd156
|
@ -177,14 +177,15 @@ static int get_partno_from_device(char *partition, dev_t devno)
|
||||||
assert(partition);
|
assert(partition);
|
||||||
|
|
||||||
if (devno) {
|
if (devno) {
|
||||||
struct sysfs_cxt cxt;
|
struct path_cxt *pc;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (sysfs_init(&cxt, devno, NULL))
|
pc = ul_new_sysfs_path(devno, NULL, NULL);
|
||||||
|
if (!pc)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
rc = sysfs_read_int(&cxt, "partition", &partno);
|
rc = ul_path_read_s32(pc, &partno, "partition");
|
||||||
sysfs_deinit(&cxt);
|
ul_unref_path(pc);
|
||||||
|
|
||||||
if (rc == 0)
|
if (rc == 0)
|
||||||
return partno;
|
return partno;
|
||||||
|
|
Loading…
Reference in New Issue