mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
nodedev: refactor udevCCWGetState
Refactor method to be only ccw state type depended to allow reuse in a later patch. Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com> Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
20560cb6c4
commit
de4c28cd4a
@ -1205,7 +1205,7 @@ udevGetCCWAddress(const char *sysfs_path,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
udevCCWGetState(struct udev_device *device,
|
udevCCWGetState(struct udev_device *device,
|
||||||
virNodeDevCapData *data)
|
virNodeDevCCWStateType *state)
|
||||||
{
|
{
|
||||||
int online = 0;
|
int online = 0;
|
||||||
|
|
||||||
@ -1215,10 +1215,10 @@ udevCCWGetState(struct udev_device *device,
|
|||||||
switch (online) {
|
switch (online) {
|
||||||
case VIR_NODE_DEV_CCW_STATE_OFFLINE:
|
case VIR_NODE_DEV_CCW_STATE_OFFLINE:
|
||||||
case VIR_NODE_DEV_CCW_STATE_ONLINE:
|
case VIR_NODE_DEV_CCW_STATE_ONLINE:
|
||||||
data->ccw_dev.state = online;
|
*state = online;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
data->ccw_dev.state = VIR_NODE_DEV_CCW_STATE_LAST;
|
*state = VIR_NODE_DEV_CCW_STATE_LAST;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1231,7 +1231,7 @@ udevProcessCCW(struct udev_device *device,
|
|||||||
virNodeDeviceDef *def)
|
virNodeDeviceDef *def)
|
||||||
{
|
{
|
||||||
/* process only online devices to keep the list sane */
|
/* process only online devices to keep the list sane */
|
||||||
if (udevCCWGetState(device, &def->caps->data) < 0)
|
if (udevCCWGetState(device, &def->caps->data.ccw_dev.state) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (udevGetCCWAddress(def->sysfs_path, &def->caps->data) < 0)
|
if (udevGetCCWAddress(def->sysfs_path, &def->caps->data) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user