udev: use SYNTHETIC_ERRNO() macro in log_device_*_errno()

This commit is contained in:
Yu Watanabe
2019-01-13 17:50:47 +09:00
parent 7ae3561a5a
commit a119328608
6 changed files with 8 additions and 8 deletions

View File

@@ -240,7 +240,7 @@ static int builtin_blkid(sd_device *dev, int argc, char *argv[], bool test) {
if (r < 0)
return log_device_error_errno(dev, r, "Failed to parse '%s' as an integer: %m", optarg);
if (offset < 0)
return log_device_error_errno(dev, -ERANGE, "Invalid offset %"PRIi64": %m", offset);
return log_device_error_errno(dev, SYNTHETIC_ERRNO(ERANGE), "Invalid offset %"PRIi64": %m", offset);
break;
case 'R':
noraid = true;

View File

@@ -18,7 +18,7 @@ static int builtin_btrfs(sd_device *dev, int argc, char *argv[], bool test) {
int r;
if (argc != 3 || !streq(argv[1], "ready"))
return log_device_error_errno(dev, EINVAL, "Invalid arguments");
return log_device_error_errno(dev, SYNTHETIC_ERRNO(EINVAL), "Invalid arguments");
fd = open("/dev/btrfs-control", O_RDWR|O_CLOEXEC);
if (fd < 0)

View File

@@ -165,7 +165,7 @@ static int builtin_hwdb(sd_device *dev, int argc, char *argv[], bool test) {
if (r < 0)
return log_device_debug_errno(dev, r, "Failed to lookup hwdb: %m");
if (r == 0)
return log_device_debug_errno(dev, ENOENT, "No entry found from hwdb: %m");
return log_device_debug_errno(dev, SYNTHETIC_ERRNO(ENOENT), "No entry found from hwdb.");
return r;
}
@@ -180,7 +180,7 @@ static int builtin_hwdb(sd_device *dev, int argc, char *argv[], bool test) {
if (r < 0)
return log_device_debug_errno(dev, r, "Failed to lookup hwdb: %m");
if (r == 0)
return log_device_debug_errno(dev, ENOENT, "No entry found from hwdb: %m");
return log_device_debug_errno(dev, SYNTHETIC_ERRNO(ENOENT), "No entry found from hwdb.");
return r;
}

View File

@@ -74,7 +74,7 @@ static int map_keycode(sd_device *dev, int fd, int scancode, const char *keycode
/* check if it's a numeric code already */
keycode_num = strtoul(keycode, &endptr, 0);
if (endptr[0] !='\0')
return log_device_error_errno(dev, EINVAL, "Failed to parse key identifier '%s'", keycode);
return log_device_error_errno(dev, SYNTHETIC_ERRNO(EINVAL), "Failed to parse key identifier '%s'", keycode);
}
map.scan = scancode;
@@ -152,7 +152,7 @@ static int set_trackpoint_sensitivity(sd_device *dev, const char *value) {
if (r < 0)
return log_device_error_errno(dev, r, "Failed to parse POINTINGSTICK_SENSITIVITY '%s': %m", value);
else if (val_i < 0 || val_i > 255)
return log_device_error_errno(dev, ERANGE, "POINTINGSTICK_SENSITIVITY %d outside range [0..255]", val_i);
return log_device_error_errno(dev, SYNTHETIC_ERRNO(ERANGE), "POINTINGSTICK_SENSITIVITY %d outside range [0..255]", val_i);
xsprintf(val_s, "%d", val_i);

View File

@@ -16,7 +16,7 @@ static int builtin_net_setup_link(sd_device *dev, int argc, char **argv, bool te
int r;
if (argc > 1)
return log_device_error_errno(dev, EINVAL, "This program takes no arguments.");
return log_device_error_errno(dev, SYNTHETIC_ERRNO(EINVAL), "This program takes no arguments.");
r = link_get_driver(ctx, dev, &driver);
if (r >= 0)

View File

@@ -300,7 +300,7 @@ static int node_permissions_apply(sd_device *dev, bool apply,
return log_device_debug_errno(dev, errno, "cannot stat() node '%s' (%m)", devnode);
if (((stats.st_mode & S_IFMT) != (mode & S_IFMT)) || (stats.st_rdev != devnum))
return log_device_debug_errno(dev, EEXIST, "Found node '%s' with non-matching devnum %s, skip handling",
return log_device_debug_errno(dev, SYNTHETIC_ERRNO(EEXIST), "Found node '%s' with non-matching devnum %s, skip handling",
devnode, id_filename);
if (apply) {