mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
util: storage: Convert disk locality check to switch statement
To allow the compiler to track future additions of disk types, convert the function to use a switch statement with the correct type.
This commit is contained in:
parent
15784e21cf
commit
dc12cec6f6
@ -1956,7 +1956,22 @@ virStorageSourceGetActualType(virStorageSourcePtr def)
|
|||||||
bool
|
bool
|
||||||
virStorageSourceIsLocalStorage(virStorageSourcePtr src)
|
virStorageSourceIsLocalStorage(virStorageSourcePtr src)
|
||||||
{
|
{
|
||||||
return virStorageSourceGetActualType(src) != VIR_STORAGE_TYPE_NETWORK;
|
virStorageType type = virStorageSourceGetActualType(src);
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case VIR_STORAGE_TYPE_FILE:
|
||||||
|
case VIR_STORAGE_TYPE_BLOCK:
|
||||||
|
case VIR_STORAGE_TYPE_DIR:
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case VIR_STORAGE_TYPE_NETWORK:
|
||||||
|
case VIR_STORAGE_TYPE_VOLUME:
|
||||||
|
case VIR_STORAGE_TYPE_LAST:
|
||||||
|
case VIR_STORAGE_TYPE_NONE:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user