mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 22:55:23 +00:00
nodedev: Cleanup driver code and prototypes
Alter the node_device_driver source and prototypes to follow more recent code style guidelines w/r/t spacing between functions, format of the function, and the prototype definitions. While the new names for nodeDeviceUpdateCaps, nodeDeviceUpdateDriverName, and nodeDeviceGetTime don't follow exactly w/r/t a "vir" prefix, they do follow other driver nomenclature style. Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
944b8de83e
commit
18c551f378
@ -47,7 +47,9 @@
|
||||
|
||||
virNodeDeviceDriverStatePtr driver;
|
||||
|
||||
static int update_caps(virNodeDeviceObjPtr dev)
|
||||
|
||||
static int
|
||||
nodeDeviceUpdateCaps(virNodeDeviceObjPtr dev)
|
||||
{
|
||||
virNodeDevCapsDefPtr cap = dev->def->caps;
|
||||
|
||||
@ -107,7 +109,8 @@ static int update_caps(virNodeDeviceObjPtr dev)
|
||||
* the driver name for a device each time its entry is used, both for
|
||||
* udev *and* HAL backends.
|
||||
*/
|
||||
static int update_driver_name(virNodeDeviceObjPtr dev)
|
||||
static int
|
||||
nodeDeviceUpdateDriverName(virNodeDeviceObjPtr dev)
|
||||
{
|
||||
char *driver_link = NULL;
|
||||
char *devpath = NULL;
|
||||
@ -144,22 +147,28 @@ static int update_driver_name(virNodeDeviceObjPtr dev)
|
||||
}
|
||||
#else
|
||||
/* XXX: Implement me for non-linux */
|
||||
static int update_driver_name(virNodeDeviceObjPtr dev ATTRIBUTE_UNUSED)
|
||||
static int
|
||||
nodeDeviceUpdateDriverName(virNodeDeviceObjPtr dev ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void nodeDeviceLock(void)
|
||||
void
|
||||
nodeDeviceLock(void)
|
||||
{
|
||||
virMutexLock(&driver->lock);
|
||||
}
|
||||
void nodeDeviceUnlock(void)
|
||||
|
||||
|
||||
void
|
||||
nodeDeviceUnlock(void)
|
||||
{
|
||||
virMutexUnlock(&driver->lock);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
nodeNumOfDevices(virConnectPtr conn,
|
||||
const char *cap,
|
||||
@ -204,6 +213,7 @@ nodeListDevices(virConnectPtr conn,
|
||||
return nnames;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
nodeConnectListAllNodeDevices(virConnectPtr conn,
|
||||
virNodeDevicePtr **devices,
|
||||
@ -224,8 +234,10 @@ nodeConnectListAllNodeDevices(virConnectPtr conn,
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
virNodeDevicePtr
|
||||
nodeDeviceLookupByName(virConnectPtr conn, const char *name)
|
||||
nodeDeviceLookupByName(virConnectPtr conn,
|
||||
const char *name)
|
||||
{
|
||||
virNodeDeviceObjPtr obj;
|
||||
virNodeDevicePtr ret = NULL;
|
||||
@ -340,8 +352,8 @@ nodeDeviceGetXMLDesc(virNodeDevicePtr dev,
|
||||
if (virNodeDeviceGetXMLDescEnsureACL(dev->conn, obj->def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
update_driver_name(obj);
|
||||
if (update_caps(obj) < 0)
|
||||
nodeDeviceUpdateDriverName(obj);
|
||||
if (nodeDeviceUpdateCaps(obj) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = virNodeDeviceDefFormat(obj->def);
|
||||
@ -433,8 +445,11 @@ nodeDeviceNumOfCaps(virNodeDevicePtr dev)
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
nodeDeviceListCaps(virNodeDevicePtr dev, char **const names, int maxnames)
|
||||
nodeDeviceListCaps(virNodeDevicePtr dev,
|
||||
char **const names,
|
||||
int maxnames)
|
||||
{
|
||||
virNodeDeviceObjPtr obj;
|
||||
virNodeDevCapsDefPtr caps;
|
||||
@ -490,8 +505,9 @@ nodeDeviceListCaps(virNodeDevicePtr dev, char **const names, int maxnames)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
get_time(time_t *t)
|
||||
nodeDeviceGetTime(time_t *t)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
@ -522,7 +538,9 @@ get_time(time_t *t)
|
||||
* it's probably safe to assume it's not going to appear.
|
||||
*/
|
||||
static virNodeDevicePtr
|
||||
find_new_device(virConnectPtr conn, const char *wwnn, const char *wwpn)
|
||||
nodeDeviceFindNewDevice(virConnectPtr conn,
|
||||
const char *wwnn,
|
||||
const char *wwpn)
|
||||
{
|
||||
virNodeDevicePtr dev = NULL;
|
||||
time_t start = 0, now = 0;
|
||||
@ -534,7 +552,7 @@ find_new_device(virConnectPtr conn, const char *wwnn, const char *wwpn)
|
||||
* doesn't become invalid. */
|
||||
nodeDeviceUnlock();
|
||||
|
||||
get_time(&start);
|
||||
nodeDeviceGetTime(&start);
|
||||
|
||||
while ((now - start) < LINUX_NEW_DEVICE_WAIT_TIME) {
|
||||
|
||||
@ -546,7 +564,7 @@ find_new_device(virConnectPtr conn, const char *wwnn, const char *wwpn)
|
||||
break;
|
||||
|
||||
sleep(5);
|
||||
if (get_time(&now) == -1)
|
||||
if (nodeDeviceGetTime(&now) == -1)
|
||||
break;
|
||||
}
|
||||
|
||||
@ -555,6 +573,7 @@ find_new_device(virConnectPtr conn, const char *wwnn, const char *wwpn)
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
||||
virNodeDevicePtr
|
||||
nodeDeviceCreateXML(virConnectPtr conn,
|
||||
const char *xmlDesc,
|
||||
@ -587,7 +606,7 @@ nodeDeviceCreateXML(virConnectPtr conn,
|
||||
if (virVHBAManageVport(parent_host, wwpn, wwnn, VPORT_CREATE) < 0)
|
||||
goto cleanup;
|
||||
|
||||
dev = find_new_device(conn, wwnn, wwpn);
|
||||
dev = nodeDeviceFindNewDevice(conn, wwnn, wwpn);
|
||||
/* We don't check the return value, because one way or another,
|
||||
* we're returning what we get... */
|
||||
|
||||
@ -653,6 +672,7 @@ nodeDeviceDestroy(virNodeDevicePtr dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
nodeConnectNodeDeviceEventRegisterAny(virConnectPtr conn,
|
||||
virNodeDevicePtr dev,
|
||||
@ -674,6 +694,7 @@ nodeConnectNodeDeviceEventRegisterAny(virConnectPtr conn,
|
||||
return callbackID;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
nodeConnectNodeDeviceEventDeregisterAny(virConnectPtr conn,
|
||||
int callbackID)
|
||||
@ -694,7 +715,9 @@ nodeConnectNodeDeviceEventDeregisterAny(virConnectPtr conn,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int nodedevRegister(void)
|
||||
|
||||
int
|
||||
nodedevRegister(void)
|
||||
{
|
||||
#ifdef WITH_UDEV
|
||||
return udevNodeRegister();
|
||||
|
@ -31,37 +31,74 @@
|
||||
# define LINUX_NEW_DEVICE_WAIT_TIME 60
|
||||
|
||||
# ifdef WITH_HAL
|
||||
int halNodeRegister(void);
|
||||
# endif
|
||||
# ifdef WITH_UDEV
|
||||
int udevNodeRegister(void);
|
||||
int
|
||||
halNodeRegister(void);
|
||||
# endif
|
||||
|
||||
void nodeDeviceLock(void);
|
||||
void nodeDeviceUnlock(void);
|
||||
# ifdef WITH_UDEV
|
||||
int
|
||||
udevNodeRegister(void);
|
||||
# endif
|
||||
|
||||
void
|
||||
nodeDeviceLock(void);
|
||||
|
||||
void
|
||||
nodeDeviceUnlock(void);
|
||||
|
||||
extern virNodeDeviceDriverStatePtr driver;
|
||||
|
||||
int nodedevRegister(void);
|
||||
int
|
||||
nodedevRegister(void);
|
||||
|
||||
int nodeNumOfDevices(virConnectPtr conn, const char *cap, unsigned int flags);
|
||||
int nodeListDevices(virConnectPtr conn, const char *cap, char **const names,
|
||||
int maxnames, unsigned int flags);
|
||||
int nodeConnectListAllNodeDevices(virConnectPtr conn,
|
||||
int
|
||||
nodeNumOfDevices(virConnectPtr conn,
|
||||
const char *cap,
|
||||
unsigned int flags);
|
||||
|
||||
int nodeListDevices(virConnectPtr conn,
|
||||
const char *cap,
|
||||
char **const names,
|
||||
int maxnames,
|
||||
unsigned int flags);
|
||||
|
||||
int
|
||||
nodeConnectListAllNodeDevices(virConnectPtr conn,
|
||||
virNodeDevicePtr **devices,
|
||||
unsigned int flags);
|
||||
virNodeDevicePtr nodeDeviceLookupByName(virConnectPtr conn, const char *name);
|
||||
virNodeDevicePtr nodeDeviceLookupSCSIHostByWWN(virConnectPtr conn,
|
||||
|
||||
virNodeDevicePtr
|
||||
nodeDeviceLookupByName(virConnectPtr conn,
|
||||
const char *name);
|
||||
|
||||
virNodeDevicePtr
|
||||
nodeDeviceLookupSCSIHostByWWN(virConnectPtr conn,
|
||||
const char *wwnn,
|
||||
const char *wwpn,
|
||||
unsigned int flags);
|
||||
char *nodeDeviceGetXMLDesc(virNodeDevicePtr dev, unsigned int flags);
|
||||
char *nodeDeviceGetParent(virNodeDevicePtr dev);
|
||||
int nodeDeviceNumOfCaps(virNodeDevicePtr dev);
|
||||
int nodeDeviceListCaps(virNodeDevicePtr dev, char **const names, int maxnames);
|
||||
virNodeDevicePtr nodeDeviceCreateXML(virConnectPtr conn,
|
||||
const char *xmlDesc, unsigned int flags);
|
||||
int nodeDeviceDestroy(virNodeDevicePtr dev);
|
||||
|
||||
char *
|
||||
nodeDeviceGetXMLDesc(virNodeDevicePtr dev,
|
||||
unsigned int flags);
|
||||
|
||||
char *
|
||||
nodeDeviceGetParent(virNodeDevicePtr dev);
|
||||
|
||||
int
|
||||
nodeDeviceNumOfCaps(virNodeDevicePtr dev);
|
||||
|
||||
int
|
||||
nodeDeviceListCaps(virNodeDevicePtr dev,
|
||||
char **const names,
|
||||
int maxnames);
|
||||
|
||||
virNodeDevicePtr
|
||||
nodeDeviceCreateXML(virConnectPtr conn,
|
||||
const char *xmlDesc,
|
||||
unsigned int flags);
|
||||
|
||||
int
|
||||
nodeDeviceDestroy(virNodeDevicePtr dev);
|
||||
|
||||
int
|
||||
nodeConnectNodeDeviceEventRegisterAny(virConnectPtr conn,
|
||||
@ -73,4 +110,5 @@ nodeConnectNodeDeviceEventRegisterAny(virConnectPtr conn,
|
||||
int
|
||||
nodeConnectNodeDeviceEventDeregisterAny(virConnectPtr conn,
|
||||
int callbackID);
|
||||
|
||||
#endif /* __VIR_NODE_DEVICE_H__ */
|
||||
|
@ -71,7 +71,8 @@ udevHasDeviceProperty(struct udev_device *dev,
|
||||
}
|
||||
|
||||
|
||||
static const char *udevGetDeviceProperty(struct udev_device *udev_device,
|
||||
static const char *
|
||||
udevGetDeviceProperty(struct udev_device *udev_device,
|
||||
const char *property_key)
|
||||
{
|
||||
const char *ret = NULL;
|
||||
@ -85,7 +86,8 @@ static const char *udevGetDeviceProperty(struct udev_device *udev_device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGetStringProperty(struct udev_device *udev_device,
|
||||
static int
|
||||
udevGetStringProperty(struct udev_device *udev_device,
|
||||
const char *property_key,
|
||||
char **value)
|
||||
{
|
||||
@ -97,7 +99,8 @@ static int udevGetStringProperty(struct udev_device *udev_device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGetIntProperty(struct udev_device *udev_device,
|
||||
static int
|
||||
udevGetIntProperty(struct udev_device *udev_device,
|
||||
const char *property_key,
|
||||
int *value,
|
||||
int base)
|
||||
@ -115,7 +118,8 @@ static int udevGetIntProperty(struct udev_device *udev_device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGetUintProperty(struct udev_device *udev_device,
|
||||
static int
|
||||
udevGetUintProperty(struct udev_device *udev_device,
|
||||
const char *property_key,
|
||||
unsigned int *value,
|
||||
int base)
|
||||
@ -133,7 +137,8 @@ static int udevGetUintProperty(struct udev_device *udev_device,
|
||||
}
|
||||
|
||||
|
||||
static const char *udevGetDeviceSysfsAttr(struct udev_device *udev_device,
|
||||
static const char *
|
||||
udevGetDeviceSysfsAttr(struct udev_device *udev_device,
|
||||
const char *attr_name)
|
||||
{
|
||||
const char *ret = NULL;
|
||||
@ -148,7 +153,8 @@ static const char *udevGetDeviceSysfsAttr(struct udev_device *udev_device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGetStringSysfsAttr(struct udev_device *udev_device,
|
||||
static int
|
||||
udevGetStringSysfsAttr(struct udev_device *udev_device,
|
||||
const char *attr_name,
|
||||
char **value)
|
||||
{
|
||||
@ -164,7 +170,8 @@ static int udevGetStringSysfsAttr(struct udev_device *udev_device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGetIntSysfsAttr(struct udev_device *udev_device,
|
||||
static int
|
||||
udevGetIntSysfsAttr(struct udev_device *udev_device,
|
||||
const char *attr_name,
|
||||
int *value,
|
||||
int base)
|
||||
@ -183,7 +190,8 @@ static int udevGetIntSysfsAttr(struct udev_device *udev_device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGetUintSysfsAttr(struct udev_device *udev_device,
|
||||
static int
|
||||
udevGetUintSysfsAttr(struct udev_device *udev_device,
|
||||
const char *attr_name,
|
||||
unsigned int *value,
|
||||
int base)
|
||||
@ -202,7 +210,8 @@ static int udevGetUintSysfsAttr(struct udev_device *udev_device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGetUint64SysfsAttr(struct udev_device *udev_device,
|
||||
static int
|
||||
udevGetUint64SysfsAttr(struct udev_device *udev_device,
|
||||
const char *attr_name,
|
||||
unsigned long long *value)
|
||||
{
|
||||
@ -220,7 +229,8 @@ static int udevGetUint64SysfsAttr(struct udev_device *udev_device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGenerateDeviceName(struct udev_device *device,
|
||||
static int
|
||||
udevGenerateDeviceName(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def,
|
||||
const char *s)
|
||||
{
|
||||
@ -247,8 +257,10 @@ static int udevGenerateDeviceName(struct udev_device *device,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#if HAVE_UDEV_LOGGING
|
||||
typedef void (*udevLogFunctionPtr)(struct udev *udev,
|
||||
typedef void
|
||||
(*udevLogFunctionPtr)(struct udev *udev,
|
||||
int priority,
|
||||
const char *file,
|
||||
int line,
|
||||
@ -283,7 +295,8 @@ udevLogFunction(struct udev *udev ATTRIBUTE_UNUSED,
|
||||
#endif
|
||||
|
||||
|
||||
static int udevTranslatePCIIds(unsigned int vendor,
|
||||
static int
|
||||
udevTranslatePCIIds(unsigned int vendor,
|
||||
unsigned int product,
|
||||
char **vendor_string,
|
||||
char **product_string)
|
||||
@ -427,7 +440,8 @@ udevPCIGetMdevTypesCap(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessPCI(struct udev_device *device,
|
||||
static int
|
||||
udevProcessPCI(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
virNodeDevCapPCIDevPtr pci_dev = &def->caps->data.pci_dev;
|
||||
@ -527,7 +541,9 @@ static int udevProcessPCI(struct udev_device *device,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int drmGetMinorType(int minor)
|
||||
|
||||
static int
|
||||
drmGetMinorType(int minor)
|
||||
{
|
||||
int type = minor >> 6;
|
||||
|
||||
@ -544,7 +560,9 @@ static int drmGetMinorType(int minor)
|
||||
}
|
||||
}
|
||||
|
||||
static int udevProcessDRMDevice(struct udev_device *device,
|
||||
|
||||
static int
|
||||
udevProcessDRMDevice(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
virNodeDevCapDRMPtr drm = &def->caps->data.drm;
|
||||
@ -564,7 +582,9 @@ static int udevProcessDRMDevice(struct udev_device *device,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int udevProcessUSBDevice(struct udev_device *device,
|
||||
|
||||
static int
|
||||
udevProcessUSBDevice(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
virNodeDevCapUSBDevPtr usb_dev = &def->caps->data.usb_dev;
|
||||
@ -606,7 +626,8 @@ static int udevProcessUSBDevice(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessUSBInterface(struct udev_device *device,
|
||||
static int
|
||||
udevProcessUSBInterface(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
virNodeDevCapUSBIfPtr usb_if = &def->caps->data.usb_if;
|
||||
@ -634,7 +655,8 @@ static int udevProcessUSBInterface(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessNetworkInterface(struct udev_device *device,
|
||||
static int
|
||||
udevProcessNetworkInterface(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
const char *devtype = udev_device_get_devtype(device);
|
||||
@ -671,7 +693,8 @@ static int udevProcessNetworkInterface(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessSCSIHost(struct udev_device *device ATTRIBUTE_UNUSED,
|
||||
static int
|
||||
udevProcessSCSIHost(struct udev_device *device ATTRIBUTE_UNUSED,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
virNodeDevCapSCSIHostPtr scsi_host = &def->caps->data.scsi_host;
|
||||
@ -697,7 +720,8 @@ static int udevProcessSCSIHost(struct udev_device *device ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessSCSITarget(struct udev_device *device,
|
||||
static int
|
||||
udevProcessSCSITarget(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
const char *sysname = NULL;
|
||||
@ -717,8 +741,10 @@ static int udevProcessSCSITarget(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGetSCSIType(virNodeDeviceDefPtr def ATTRIBUTE_UNUSED,
|
||||
unsigned int type, char **typestring)
|
||||
static int
|
||||
udevGetSCSIType(virNodeDeviceDefPtr def ATTRIBUTE_UNUSED,
|
||||
unsigned int type,
|
||||
char **typestring)
|
||||
{
|
||||
int ret = 0;
|
||||
int foundtype = 1;
|
||||
@ -775,7 +801,8 @@ static int udevGetSCSIType(virNodeDeviceDefPtr def ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessSCSIDevice(struct udev_device *device ATTRIBUTE_UNUSED,
|
||||
static int
|
||||
udevProcessSCSIDevice(struct udev_device *device ATTRIBUTE_UNUSED,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
int ret = -1;
|
||||
@ -818,7 +845,8 @@ static int udevProcessSCSIDevice(struct udev_device *device ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessDisk(struct udev_device *device,
|
||||
static int
|
||||
udevProcessDisk(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
virNodeDevCapStoragePtr storage = &def->caps->data.storage;
|
||||
@ -836,7 +864,8 @@ static int udevProcessDisk(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessRemoveableMedia(struct udev_device *device,
|
||||
static int
|
||||
udevProcessRemoveableMedia(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def,
|
||||
int has_media)
|
||||
{
|
||||
@ -877,7 +906,9 @@ static int udevProcessRemoveableMedia(struct udev_device *device,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int udevProcessCDROM(struct udev_device *device,
|
||||
|
||||
static int
|
||||
udevProcessCDROM(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
int has_media = 0;
|
||||
@ -897,7 +928,9 @@ static int udevProcessCDROM(struct udev_device *device,
|
||||
return udevProcessRemoveableMedia(device, def, has_media);
|
||||
}
|
||||
|
||||
static int udevProcessFloppy(struct udev_device *device,
|
||||
|
||||
static int
|
||||
udevProcessFloppy(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
int has_media = 0;
|
||||
@ -915,7 +948,8 @@ static int udevProcessFloppy(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessSD(struct udev_device *device,
|
||||
static int
|
||||
udevProcessSD(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
virNodeDevCapStoragePtr storage = &def->caps->data.storage;
|
||||
@ -934,12 +968,12 @@ static int udevProcessSD(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* This function exists to deal with the case in which a driver does
|
||||
* not provide a device type in the usual place, but udev told us it's
|
||||
* a storage device, and we can make a good guess at what kind of
|
||||
* storage device it is from other information that is provided. */
|
||||
static int udevKludgeStorageType(virNodeDeviceDefPtr def)
|
||||
static int
|
||||
udevKludgeStorageType(virNodeDeviceDefPtr def)
|
||||
{
|
||||
VIR_DEBUG("Could not find definitive storage type for device "
|
||||
"with sysfs path '%s', trying to guess it",
|
||||
@ -960,7 +994,8 @@ static int udevKludgeStorageType(virNodeDeviceDefPtr def)
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessStorage(struct udev_device *device,
|
||||
static int
|
||||
udevProcessStorage(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
virNodeDevCapStoragePtr storage = &def->caps->data.storage;
|
||||
@ -1056,6 +1091,7 @@ static int udevProcessStorage(struct udev_device *device,
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
udevProcessSCSIGeneric(struct udev_device *dev,
|
||||
virNodeDeviceDefPtr def)
|
||||
@ -1070,6 +1106,7 @@ udevProcessSCSIGeneric(struct udev_device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
udevProcessMediatedDevice(struct udev_device *dev,
|
||||
virNodeDeviceDefPtr def)
|
||||
@ -1164,6 +1201,7 @@ udevGetDeviceNodes(struct udev_device *device,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
udevGetDeviceType(struct udev_device *device,
|
||||
virNodeDevCapType *type)
|
||||
@ -1230,7 +1268,8 @@ udevGetDeviceType(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGetDeviceDetails(struct udev_device *device,
|
||||
static int
|
||||
udevGetDeviceDetails(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
switch (def->caps->data.type) {
|
||||
@ -1270,7 +1309,8 @@ static int udevGetDeviceDetails(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int udevRemoveOneDevice(struct udev_device *device)
|
||||
static int
|
||||
udevRemoveOneDevice(struct udev_device *device)
|
||||
{
|
||||
virNodeDeviceObjPtr dev = NULL;
|
||||
virObjectEventPtr event = NULL;
|
||||
@ -1302,7 +1342,8 @@ static int udevRemoveOneDevice(struct udev_device *device)
|
||||
}
|
||||
|
||||
|
||||
static int udevSetParent(struct udev_device *device,
|
||||
static int
|
||||
udevSetParent(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
struct udev_device *parent_device = NULL;
|
||||
@ -1350,7 +1391,8 @@ static int udevSetParent(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int udevAddOneDevice(struct udev_device *device)
|
||||
static int
|
||||
udevAddOneDevice(struct udev_device *device)
|
||||
{
|
||||
virNodeDeviceDefPtr def = NULL;
|
||||
virNodeDeviceObjPtr dev = NULL;
|
||||
@ -1419,7 +1461,8 @@ static int udevAddOneDevice(struct udev_device *device)
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessDeviceListEntry(struct udev *udev,
|
||||
static int
|
||||
udevProcessDeviceListEntry(struct udev *udev,
|
||||
struct udev_list_entry *list_entry)
|
||||
{
|
||||
struct udev_device *device;
|
||||
@ -1452,7 +1495,8 @@ const char *subsystem_blacklist[] = {
|
||||
"acpi", "tty", "vc", "i2c",
|
||||
};
|
||||
|
||||
static int udevEnumerateAddMatches(struct udev_enumerate *udev_enumerate)
|
||||
static int
|
||||
udevEnumerateAddMatches(struct udev_enumerate *udev_enumerate)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@ -1467,7 +1511,8 @@ static int udevEnumerateAddMatches(struct udev_enumerate *udev_enumerate)
|
||||
}
|
||||
|
||||
|
||||
static int udevEnumerateDevices(struct udev *udev)
|
||||
static int
|
||||
udevEnumerateDevices(struct udev *udev)
|
||||
{
|
||||
struct udev_enumerate *udev_enumerate = NULL;
|
||||
struct udev_list_entry *list_entry = NULL;
|
||||
@ -1497,7 +1542,8 @@ static int udevEnumerateDevices(struct udev *udev)
|
||||
}
|
||||
|
||||
|
||||
static void udevPCITranslateDeinit(void)
|
||||
static void
|
||||
udevPCITranslateDeinit(void)
|
||||
{
|
||||
#if defined __s390__ || defined __s390x_
|
||||
/* Nothing was initialized, nothing needs to be cleaned up */
|
||||
@ -1509,7 +1555,8 @@ static void udevPCITranslateDeinit(void)
|
||||
}
|
||||
|
||||
|
||||
static int nodeStateCleanup(void)
|
||||
static int
|
||||
nodeStateCleanup(void)
|
||||
{
|
||||
udevPrivate *priv = NULL;
|
||||
struct udev_monitor *udev_monitor = NULL;
|
||||
@ -1550,7 +1597,8 @@ static int nodeStateCleanup(void)
|
||||
}
|
||||
|
||||
|
||||
static void udevEventHandleCallback(int watch ATTRIBUTE_UNUSED,
|
||||
static void
|
||||
udevEventHandleCallback(int watch ATTRIBUTE_UNUSED,
|
||||
int fd,
|
||||
int events ATTRIBUTE_UNUSED,
|
||||
void *data ATTRIBUTE_UNUSED)
|
||||
@ -1654,7 +1702,8 @@ udevGetDMIData(virNodeDevCapSystemPtr syscap)
|
||||
#endif
|
||||
|
||||
|
||||
static int udevSetupSystemDev(void)
|
||||
static int
|
||||
udevSetupSystemDev(void)
|
||||
{
|
||||
virNodeDeviceDefPtr def = NULL;
|
||||
virNodeDeviceObjPtr dev = NULL;
|
||||
@ -1688,7 +1737,9 @@ static int udevSetupSystemDev(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int udevPCITranslateInit(bool privileged ATTRIBUTE_UNUSED)
|
||||
|
||||
static int
|
||||
udevPCITranslateInit(bool privileged ATTRIBUTE_UNUSED)
|
||||
{
|
||||
#if defined __s390__ || defined __s390x_
|
||||
/* On s390(x) system there is no PCI bus.
|
||||
@ -1710,7 +1761,9 @@ static int udevPCITranslateInit(bool privileged ATTRIBUTE_UNUSED)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nodeStateInitialize(bool privileged,
|
||||
|
||||
static int
|
||||
nodeStateInitialize(bool privileged,
|
||||
virStateInhibitCallback callback ATTRIBUTE_UNUSED,
|
||||
void *opaque ATTRIBUTE_UNUSED)
|
||||
{
|
||||
@ -1807,7 +1860,8 @@ static int nodeStateInitialize(bool privileged,
|
||||
}
|
||||
|
||||
|
||||
static int nodeStateReload(void)
|
||||
static int
|
||||
nodeStateReload(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -1837,7 +1891,9 @@ static virStateDriver udevStateDriver = {
|
||||
.stateReload = nodeStateReload, /* 0.7.3 */
|
||||
};
|
||||
|
||||
int udevNodeRegister(void)
|
||||
|
||||
int
|
||||
udevNodeRegister(void)
|
||||
{
|
||||
VIR_DEBUG("Registering udev node device backend");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user