summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-02-22 17:37:39 +0100
committerLennart Poettering <lennart@poettering.net>2021-02-22 17:38:57 +0100
commit930aa88f0448c90595a57a7b8b0307b14cdb011a (patch)
treed261b4565b06b0802ce49ccc68f7638aae2cd698 /src
parentfuzz-systemctl-parse-argv: add "telinit" to the argv[0] list (diff)
downloadsystemd-930aa88f0448c90595a57a7b8b0307b14cdb011a.tar.xz
systemd-930aa88f0448c90595a57a7b8b0307b14cdb011a.zip
tree-wide: use sd_device_new_from_stat_rdev() whereever appropriate
Diffstat (limited to 'src')
-rw-r--r--src/cryptsetup/cryptsetup.c2
-rw-r--r--src/fsck/fsck.c2
-rw-r--r--src/home/homed-home.c2
-rw-r--r--src/mount/mount-tool.c6
-rw-r--r--src/shared/dissect-image.c2
-rw-r--r--src/shared/udev-util.c2
6 files changed, 8 insertions, 8 deletions
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 2df7633dac..ebfef02aee 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -436,7 +436,7 @@ static char* disk_description(const char *path) {
if (!S_ISBLK(st.st_mode))
return NULL;
- if (sd_device_new_from_devnum(&device, 'b', st.st_rdev) < 0)
+ if (sd_device_new_from_stat_rdev(&device, &st) < 0)
return NULL;
NULSTR_FOREACH(i, name_fields)
diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
index 584d441c94..cd7adfaeb9 100644
--- a/src/fsck/fsck.c
+++ b/src/fsck/fsck.c
@@ -287,7 +287,7 @@ static int run(int argc, char *argv[]) {
"%s is not a block device.",
device);
- r = sd_device_new_from_devnum(&dev, 'b', st.st_rdev);
+ r = sd_device_new_from_stat_rdev(&dev, &st);
if (r < 0)
return log_error_errno(r, "Failed to detect device %s: %m", device);
diff --git a/src/home/homed-home.c b/src/home/homed-home.c
index 2ea0f7c81d..f1db828ed0 100644
--- a/src/home/homed-home.c
+++ b/src/home/homed-home.c
@@ -2711,7 +2711,7 @@ static int home_get_image_path_seat(Home *h, char **ret) {
if (!S_ISBLK(st.st_mode))
return -ENOTBLK;
- r = sd_device_new_from_devnum(&d, 'b', st.st_rdev);
+ r = sd_device_new_from_stat_rdev(&d, &st);
if (r < 0)
return r;
diff --git a/src/mount/mount-tool.c b/src/mount/mount-tool.c
index 153f67f93b..4a8f46761a 100644
--- a/src/mount/mount-tool.c
+++ b/src/mount/mount-tool.c
@@ -929,7 +929,7 @@ static int umount_by_device(sd_bus *bus, const char *what) {
return log_error_errno(SYNTHETIC_ERRNO(ENOTBLK),
"Not a block device: %s", what);
- r = sd_device_new_from_devnum(&d, 'b', st.st_rdev);
+ r = sd_device_new_from_stat_rdev(&d, &st);
if (r < 0)
return log_error_errno(r, "Failed to get device from device number: %m");
@@ -1270,7 +1270,7 @@ static int discover_loop_backing_file(void) {
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Invalid file type: %s", loop_dev);
- r = sd_device_new_from_devnum(&d, 'b', st.st_rdev);
+ r = sd_device_new_from_stat_rdev(&d, &st);
if (r < 0)
return log_error_errno(r, "Failed to get device from device number: %m");
@@ -1314,7 +1314,7 @@ static int discover_device(void) {
"Invalid file type: %s",
arg_mount_what);
- r = sd_device_new_from_devnum(&d, 'b', st.st_rdev);
+ r = sd_device_new_from_stat_rdev(&d, &st);
if (r < 0)
return log_error_errno(r, "Failed to get device from device number: %m");
diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c
index 8de1738264..791d747136 100644
--- a/src/shared/dissect-image.c
+++ b/src/shared/dissect-image.c
@@ -532,7 +532,7 @@ int dissect_image(
if (!S_ISBLK(st.st_mode))
return -ENOTBLK;
- r = sd_device_new_from_devnum(&d, 'b', st.st_rdev);
+ r = sd_device_new_from_stat_rdev(&d, &st);
if (r < 0)
return r;
diff --git a/src/shared/udev-util.c b/src/shared/udev-util.c
index 80b70c18a0..9d732dca2c 100644
--- a/src/shared/udev-util.c
+++ b/src/shared/udev-util.c
@@ -136,7 +136,7 @@ static int device_new_from_dev_path(const char *devlink, sd_device **ret_device)
return log_error_errno(SYNTHETIC_ERRNO(ENOTBLK),
"%s does not point to a block device: %m", devlink);
- r = sd_device_new_from_devnum(ret_device, 'b', st.st_rdev);
+ r = sd_device_new_from_stat_rdev(ret_device, &st);
if (r < 0)
return log_error_errno(r, "Failed to initialize device from %s: %m", devlink);