tree-wise: several cleanups for logging
- drop unnecessary SYNTHETIC_ERRNO() when the logger does not propagate error code, - drop unnecessary '%m' in error message when the error code is specified with SYNTHETIC_ERRNO(), - add missing full stop at the end of log message, - use RET_GATHER(), - add missing ", ignoring.", - upeercase the first letter, etc., etc...
This commit is contained in:
@@ -86,14 +86,14 @@ static int disk_scsi_inquiry_command(
|
||||
if (io_hdr.status != 0 ||
|
||||
io_hdr.host_status != 0 ||
|
||||
io_hdr.driver_status != 0)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "ioctl v3 failed");
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "ioctl v3 failed.");
|
||||
|
||||
} else {
|
||||
/* even if the ioctl succeeds, we need to check the return value */
|
||||
if (io_v4.device_status != 0 ||
|
||||
io_v4.transport_status != 0 ||
|
||||
io_v4.driver_status != 0)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "ioctl v4 failed");
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "ioctl v4 failed.");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -160,7 +160,7 @@ static int disk_identify_command(
|
||||
} else {
|
||||
if (!((sense[0] & 0x7f) == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c) &&
|
||||
!((sense[0] & 0x7f) == 0x70 && sense[12] == 0x00 && sense[13] == 0x1d))
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "ioctl v4 failed: %m");
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "ioctl v4 failed.");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -232,7 +232,7 @@ static int disk_identify_packet_device_command(
|
||||
return log_debug_errno(errno, "ioctl v3 failed: %m");
|
||||
} else {
|
||||
if ((sense[0] & 0x7f) != 0x72 || desc[0] != 0x9 || desc[1] != 0x0c)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "ioctl v4 failed: %m");
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "ioctl v4 failed.");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -368,7 +368,7 @@ static int builtin_blkid(UdevEvent *event, int argc, char *argv[]) {
|
||||
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, SYNTHETIC_ERRNO(EINVAL), "Invalid offset %"PRIi64": %m", offset);
|
||||
return log_device_error_errno(dev, SYNTHETIC_ERRNO(EINVAL), "Invalid offset %"PRIi64".", offset);
|
||||
break;
|
||||
case 'R':
|
||||
noraid = true;
|
||||
|
||||
@@ -814,7 +814,7 @@ static int names_devicetree(sd_device *dev, const char *prefix, EventMode mode)
|
||||
ofnode_path = path_startswith(ofnode_syspath, devicetree_syspath);
|
||||
if (!ofnode_path)
|
||||
return log_device_debug_errno(ofnode_dev, SYNTHETIC_ERRNO(EINVAL),
|
||||
"The device '%s' is not a child device of '%s': %m",
|
||||
"The device '%s' is not a child device of '%s'.",
|
||||
ofnode_syspath, devicetree_syspath);
|
||||
|
||||
/* Get back our leading / to match the contents of the aliases */
|
||||
@@ -855,7 +855,7 @@ static int names_devicetree(sd_device *dev, const char *prefix, EventMode mode)
|
||||
/* ...but make sure we don't have an alias conflict */
|
||||
if (i == 0 && device_get_sysattr_value_filtered(aliases_dev, conflict, NULL) >= 0)
|
||||
return log_device_debug_errno(dev, SYNTHETIC_ERRNO(EEXIST),
|
||||
"Ethernet alias conflict: ethernet and ethernet0 both exist");
|
||||
"Ethernet alias conflict: ethernet and ethernet0 both exist.");
|
||||
|
||||
char str[ALTIFNAMSIZ];
|
||||
if (snprintf_ok(str, sizeof str, "%sd%u", prefix, i))
|
||||
@@ -1232,7 +1232,7 @@ static int names_xen(sd_device *dev, const char *prefix, EventMode mode) {
|
||||
|
||||
p = startswith(vif, "vif-");
|
||||
if (!p)
|
||||
return log_device_debug_errno(dev, SYNTHETIC_ERRNO(EINVAL), "Invalid vif name: %s: %m", vif);
|
||||
return log_device_debug_errno(dev, SYNTHETIC_ERRNO(EINVAL), "Invalid vif name: %s.", vif);
|
||||
|
||||
r = safe_atou_full(p, SAFE_ATO_REFUSE_PLUS_MINUS | SAFE_ATO_REFUSE_LEADING_ZERO |
|
||||
SAFE_ATO_REFUSE_LEADING_WHITESPACE | 10, &id);
|
||||
|
||||
@@ -126,7 +126,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
|
||||
if (arg_print) {
|
||||
if (optind != argc)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "No arguments expected");
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "No arguments expected.");
|
||||
} else {
|
||||
if (optind + 1 > argc)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Too few arguments, command to execute.");
|
||||
@@ -193,7 +193,7 @@ static int lock_device(
|
||||
|
||||
/* Extra safety: check that the device still refers to what we think it refers to */
|
||||
if (!S_ISBLK(st.st_mode) || st.st_rdev != devno)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(ENXIO), "Path '%s' no longer refers to specified block device %u:%u: %m", path, major(devno), minor(devno));
|
||||
return log_error_errno(SYNTHETIC_ERRNO(ENXIO), "Path '%s' no longer refers to specified block device %u:%u.", path, major(devno), minor(devno));
|
||||
|
||||
r = lock_generic(fd, LOCK_BSD, LOCK_EX|LOCK_NB);
|
||||
if (r < 0) {
|
||||
|
||||
Reference in New Issue
Block a user