1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 14:55:37 +03:00

loop-util: use DEVNUM_FORMAT_STR more

This commit is contained in:
Lennart Poettering 2022-09-01 12:14:15 +02:00
parent 91e1ce1a7c
commit ed13feff1e

View File

@ -824,7 +824,7 @@ static int resize_partition(int partition_fd, uint64_t offset, uint64_t size) {
assert(S_ISBLK(st.st_mode));
xsprintf(sysfs, "/sys/dev/block/%u:%u/partition", major(st.st_rdev), minor(st.st_rdev));
xsprintf(sysfs, "/sys/dev/block/" DEVNUM_FORMAT_STR "/partition", DEVNUM_FORMAT_VAL(st.st_rdev));
r = read_one_line_file(sysfs, &buffer);
if (r == -ENOENT) /* not a partition, cannot resize */
return -ENOTTY;
@ -834,7 +834,7 @@ static int resize_partition(int partition_fd, uint64_t offset, uint64_t size) {
if (r < 0)
return r;
xsprintf(sysfs, "/sys/dev/block/%u:%u/start", major(st.st_rdev), minor(st.st_rdev));
xsprintf(sysfs, "/sys/dev/block/" DEVNUM_FORMAT_STR "/start", DEVNUM_FORMAT_VAL(st.st_rdev));
buffer = mfree(buffer);
r = read_one_line_file(sysfs, &buffer);
@ -855,7 +855,7 @@ static int resize_partition(int partition_fd, uint64_t offset, uint64_t size) {
if (current_size == size && current_offset == offset)
return 0;
xsprintf(sysfs, "/sys/dev/block/%u:%u/../dev", major(st.st_rdev), minor(st.st_rdev));
xsprintf(sysfs, "/sys/dev/block/" DEVNUM_FORMAT_STR "/../dev", DEVNUM_FORMAT_VAL(st.st_rdev));
buffer = mfree(buffer);
r = read_one_line_file(sysfs, &buffer);