提交 e2859b9d 编写于 作者: J Ján Tomko

udevProcessStorage: trim all whitespace from model and vendor

Use virTrimSpaces instead of a custom implementation.
上级 cc1d0e2a
......@@ -839,20 +839,6 @@ static int udevKludgeStorageType(virNodeDeviceDefPtr def)
}
static void udevStripSpaces(char *s)
{
if (s == NULL)
return;
while (virFileStripSuffix(s, " ")) {
/* do nothing */
;
}
return;
}
static int udevProcessStorage(struct udev_device *device,
virNodeDeviceDefPtr def)
{
......@@ -876,10 +862,13 @@ static int udevProcessStorage(struct udev_device *device,
if (udevGetStringSysfsAttr(device, "device/vendor", &data->storage.vendor) < 0)
goto out;
udevStripSpaces(def->caps->data.storage.vendor);
if (def->caps->data.storage.vendor)
virTrimSpaces(def->caps->data.storage.vendor, NULL);
if (udevGetStringSysfsAttr(device, "device/model", &data->storage.model) < 0)
goto out;
udevStripSpaces(def->caps->data.storage.model);
if (def->caps->data.storage.model)
virTrimSpaces(def->caps->data.storage.model, NULL);
/* There is no equivalent of the hotpluggable property in libudev,
* but storage is going toward a world in which hotpluggable is
* expected, so I don't see a problem with not having a property
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册