mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-23 17:34:00 +03:00
tree-wide: use sd_device_new_from_stat_rdev() whereever appropriate
This commit is contained in:
parent
5735ab0979
commit
930aa88f04
@ -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)
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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");
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user