mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Remove udevStrToLong_ui
Remove the debug message, open code the error in the two udevGetUint callers and use a more specific error in SCSI and PCI processing.
This commit is contained in:
parent
1a97fb16ae
commit
07202bf4cf
@ -58,23 +58,6 @@ struct _udevPrivate {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int udevStrToLong_ui(char const *s,
|
|
||||||
char **end_ptr,
|
|
||||||
int base,
|
|
||||||
unsigned int *result)
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
ret = virStrToLong_ui(s, end_ptr, base, result);
|
|
||||||
if (ret != 0) {
|
|
||||||
VIR_ERROR(_("Failed to convert '%s' to unsigned int"), s);
|
|
||||||
} else {
|
|
||||||
VIR_DEBUG("Converted '%s' to unsigned int %u", s, *result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int udevStrToLong_i(char const *s,
|
static int udevStrToLong_i(char const *s,
|
||||||
char **end_ptr,
|
char **end_ptr,
|
||||||
int base,
|
int base,
|
||||||
@ -165,9 +148,11 @@ static int udevGetUintProperty(struct udev_device *udev_device,
|
|||||||
ret = udevGetDeviceProperty(udev_device, property_key, &udev_value);
|
ret = udevGetDeviceProperty(udev_device, property_key, &udev_value);
|
||||||
|
|
||||||
if (ret == PROPERTY_FOUND) {
|
if (ret == PROPERTY_FOUND) {
|
||||||
if (udevStrToLong_ui(udev_value, NULL, base, value) != 0)
|
if (virStrToLong_ui(udev_value, NULL, base, value) < 0) {
|
||||||
|
VIR_ERROR(_("Failed to convert '%s' to unsigned int"), udev_value);
|
||||||
ret = PROPERTY_ERROR;
|
ret = PROPERTY_ERROR;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VIR_FREE(udev_value);
|
VIR_FREE(udev_value);
|
||||||
return ret;
|
return ret;
|
||||||
@ -264,9 +249,11 @@ static int udevGetUintSysfsAttr(struct udev_device *udev_device,
|
|||||||
ret = udevGetDeviceSysfsAttr(udev_device, attr_name, &udev_value);
|
ret = udevGetDeviceSysfsAttr(udev_device, attr_name, &udev_value);
|
||||||
|
|
||||||
if (ret == PROPERTY_FOUND) {
|
if (ret == PROPERTY_FOUND) {
|
||||||
if (udevStrToLong_ui(udev_value, NULL, base, value) != 0)
|
if (virStrToLong_ui(udev_value, NULL, base, value) < 0) {
|
||||||
|
VIR_ERROR(_("Failed to convert '%s' to unsigned int"), udev_value);
|
||||||
ret = PROPERTY_ERROR;
|
ret = PROPERTY_ERROR;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VIR_FREE(udev_value);
|
VIR_FREE(udev_value);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user