summaryrefslogtreecommitdiffstats
path: root/disk-utils
diff options
context:
space:
mode:
authorKarel Zak2018-05-30 10:41:46 +0200
committerKarel Zak2018-06-21 13:19:28 +0200
commit7f8a406679bde6020541ee059cf1b8e271e9bd23 (patch)
tree734d3699b74ae08a39f1d070077256b650003a81 /disk-utils
parentblkzone: use new ul_path_* API (diff)
downloadkernel-qcow2-util-linux-7f8a406679bde6020541ee059cf1b8e271e9bd23.tar.gz
kernel-qcow2-util-linux-7f8a406679bde6020541ee059cf1b8e271e9bd23.tar.xz
kernel-qcow2-util-linux-7f8a406679bde6020541ee059cf1b8e271e9bd23.zip
resizepart: use new ul_path_* API
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils')
-rw-r--r--disk-utils/resizepart.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/disk-utils/resizepart.c b/disk-utils/resizepart.c
index 15aa01b8f..527517f24 100644
--- a/disk-utils/resizepart.c
+++ b/disk-utils/resizepart.c
@@ -32,8 +32,7 @@ static void __attribute__((__noreturn__)) usage(void)
static int get_partition_start(int fd, int partno, uint64_t *start)
{
struct stat st;
- struct sysfs_cxt disk = UL_SYSFSCXT_EMPTY,
- part = UL_SYSFSCXT_EMPTY;
+ struct path_cxt *disk = NULL, *part = NULL;
dev_t devno = 0;
int rc = -1;
@@ -43,23 +42,26 @@ static int get_partition_start(int fd, int partno, uint64_t *start)
if (fstat(fd, &st) || !S_ISBLK(st.st_mode))
goto done;
devno = st.st_rdev;
- if (sysfs_init(&disk, devno, NULL))
+ disk = ul_new_sysfs_path(devno, NULL, NULL);
+ if (!disk)
goto done;
/*
* partition
*/
- devno = sysfs_partno_to_devno(&disk, partno);
+ devno = sysfs_blkdev_partno_to_devno(disk, partno);
if (!devno)
goto done;
- if (sysfs_init(&part, devno, &disk))
+
+ part = ul_new_sysfs_path(devno, disk, NULL);
+ if (!part)
goto done;
- if (sysfs_read_u64(&part, "start", start))
+ if (ul_path_read_u64(part, start, "start"))
goto done;
rc = 0;
done:
- sysfs_deinit(&part);
- sysfs_deinit(&disk);
+ ul_unref_path(part);
+ ul_unref_path(disk);
return rc;
}