]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
resizepart: use new ul_path_* API
authorKarel Zak <kzak@redhat.com>
Wed, 30 May 2018 08:41:46 +0000 (10:41 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 21 Jun 2018 11:19:28 +0000 (13:19 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/resizepart.c

index 15aa01b8f474fe0af1f98a6cec3bcd216a784198..527517f242f22a6e2a5fc991e96a6ffa14c1e83c 100644 (file)
@@ -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;
 }