mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 06:35:24 +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,
|
||||
virNodeDevicePtr **devices,
|
||||
unsigned int flags);
|
||||
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);
|
||||
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,
|
||||
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);
|
||||
|
||||
int
|
||||
nodeConnectNodeDeviceEventRegisterAny(virConnectPtr conn,
|
||||
@ -73,4 +110,5 @@ nodeConnectNodeDeviceEventRegisterAny(virConnectPtr conn,
|
||||
int
|
||||
nodeConnectNodeDeviceEventDeregisterAny(virConnectPtr conn,
|
||||
int callbackID);
|
||||
|
||||
#endif /* __VIR_NODE_DEVICE_H__ */
|
||||
|
@ -71,8 +71,9 @@ udevHasDeviceProperty(struct udev_device *dev,
|
||||
}
|
||||
|
||||
|
||||
static const char *udevGetDeviceProperty(struct udev_device *udev_device,
|
||||
const char *property_key)
|
||||
static const char *
|
||||
udevGetDeviceProperty(struct udev_device *udev_device,
|
||||
const char *property_key)
|
||||
{
|
||||
const char *ret = NULL;
|
||||
|
||||
@ -85,9 +86,10 @@ static const char *udevGetDeviceProperty(struct udev_device *udev_device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGetStringProperty(struct udev_device *udev_device,
|
||||
const char *property_key,
|
||||
char **value)
|
||||
static int
|
||||
udevGetStringProperty(struct udev_device *udev_device,
|
||||
const char *property_key,
|
||||
char **value)
|
||||
{
|
||||
if (VIR_STRDUP(*value,
|
||||
udevGetDeviceProperty(udev_device, property_key)) < 0)
|
||||
@ -97,10 +99,11 @@ static int udevGetStringProperty(struct udev_device *udev_device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGetIntProperty(struct udev_device *udev_device,
|
||||
const char *property_key,
|
||||
int *value,
|
||||
int base)
|
||||
static int
|
||||
udevGetIntProperty(struct udev_device *udev_device,
|
||||
const char *property_key,
|
||||
int *value,
|
||||
int base)
|
||||
{
|
||||
const char *str = NULL;
|
||||
|
||||
@ -115,10 +118,11 @@ static int udevGetIntProperty(struct udev_device *udev_device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGetUintProperty(struct udev_device *udev_device,
|
||||
const char *property_key,
|
||||
unsigned int *value,
|
||||
int base)
|
||||
static int
|
||||
udevGetUintProperty(struct udev_device *udev_device,
|
||||
const char *property_key,
|
||||
unsigned int *value,
|
||||
int base)
|
||||
{
|
||||
const char *str = NULL;
|
||||
|
||||
@ -133,8 +137,9 @@ static int udevGetUintProperty(struct udev_device *udev_device,
|
||||
}
|
||||
|
||||
|
||||
static const char *udevGetDeviceSysfsAttr(struct udev_device *udev_device,
|
||||
const char *attr_name)
|
||||
static const char *
|
||||
udevGetDeviceSysfsAttr(struct udev_device *udev_device,
|
||||
const char *attr_name)
|
||||
{
|
||||
const char *ret = NULL;
|
||||
|
||||
@ -148,9 +153,10 @@ static const char *udevGetDeviceSysfsAttr(struct udev_device *udev_device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGetStringSysfsAttr(struct udev_device *udev_device,
|
||||
const char *attr_name,
|
||||
char **value)
|
||||
static int
|
||||
udevGetStringSysfsAttr(struct udev_device *udev_device,
|
||||
const char *attr_name,
|
||||
char **value)
|
||||
{
|
||||
if (VIR_STRDUP(*value, udevGetDeviceSysfsAttr(udev_device, attr_name)) < 0)
|
||||
return -1;
|
||||
@ -164,10 +170,11 @@ static int udevGetStringSysfsAttr(struct udev_device *udev_device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGetIntSysfsAttr(struct udev_device *udev_device,
|
||||
const char *attr_name,
|
||||
int *value,
|
||||
int base)
|
||||
static int
|
||||
udevGetIntSysfsAttr(struct udev_device *udev_device,
|
||||
const char *attr_name,
|
||||
int *value,
|
||||
int base)
|
||||
{
|
||||
const char *str = NULL;
|
||||
|
||||
@ -183,10 +190,11 @@ static int udevGetIntSysfsAttr(struct udev_device *udev_device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGetUintSysfsAttr(struct udev_device *udev_device,
|
||||
const char *attr_name,
|
||||
unsigned int *value,
|
||||
int base)
|
||||
static int
|
||||
udevGetUintSysfsAttr(struct udev_device *udev_device,
|
||||
const char *attr_name,
|
||||
unsigned int *value,
|
||||
int base)
|
||||
{
|
||||
const char *str = NULL;
|
||||
|
||||
@ -202,9 +210,10 @@ static int udevGetUintSysfsAttr(struct udev_device *udev_device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGetUint64SysfsAttr(struct udev_device *udev_device,
|
||||
const char *attr_name,
|
||||
unsigned long long *value)
|
||||
static int
|
||||
udevGetUint64SysfsAttr(struct udev_device *udev_device,
|
||||
const char *attr_name,
|
||||
unsigned long long *value)
|
||||
{
|
||||
const char *str = NULL;
|
||||
|
||||
@ -220,9 +229,10 @@ static int udevGetUint64SysfsAttr(struct udev_device *udev_device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGenerateDeviceName(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def,
|
||||
const char *s)
|
||||
static int
|
||||
udevGenerateDeviceName(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def,
|
||||
const char *s)
|
||||
{
|
||||
size_t i;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
@ -247,14 +257,16 @@ static int udevGenerateDeviceName(struct udev_device *device,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#if HAVE_UDEV_LOGGING
|
||||
typedef void (*udevLogFunctionPtr)(struct udev *udev,
|
||||
int priority,
|
||||
const char *file,
|
||||
int line,
|
||||
const char *fn,
|
||||
const char *format,
|
||||
va_list args);
|
||||
typedef void
|
||||
(*udevLogFunctionPtr)(struct udev *udev,
|
||||
int priority,
|
||||
const char *file,
|
||||
int line,
|
||||
const char *fn,
|
||||
const char *format,
|
||||
va_list args);
|
||||
|
||||
static void
|
||||
ATTRIBUTE_FMT_PRINTF(6, 0)
|
||||
@ -283,10 +295,11 @@ udevLogFunction(struct udev *udev ATTRIBUTE_UNUSED,
|
||||
#endif
|
||||
|
||||
|
||||
static int udevTranslatePCIIds(unsigned int vendor,
|
||||
unsigned int product,
|
||||
char **vendor_string,
|
||||
char **product_string)
|
||||
static int
|
||||
udevTranslatePCIIds(unsigned int vendor,
|
||||
unsigned int product,
|
||||
char **vendor_string,
|
||||
char **product_string)
|
||||
{
|
||||
struct pci_id_match m;
|
||||
const char *vendor_name = NULL, *device_name = NULL;
|
||||
@ -427,8 +440,9 @@ udevPCIGetMdevTypesCap(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessPCI(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
static int
|
||||
udevProcessPCI(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
virNodeDevCapPCIDevPtr pci_dev = &def->caps->data.pci_dev;
|
||||
virPCIEDeviceInfoPtr pci_express = NULL;
|
||||
@ -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,8 +560,10 @@ static int drmGetMinorType(int minor)
|
||||
}
|
||||
}
|
||||
|
||||
static int udevProcessDRMDevice(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
|
||||
static int
|
||||
udevProcessDRMDevice(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
virNodeDevCapDRMPtr drm = &def->caps->data.drm;
|
||||
int minor;
|
||||
@ -564,8 +582,10 @@ static int udevProcessDRMDevice(struct udev_device *device,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int udevProcessUSBDevice(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
|
||||
static int
|
||||
udevProcessUSBDevice(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
virNodeDevCapUSBDevPtr usb_dev = &def->caps->data.usb_dev;
|
||||
|
||||
@ -606,8 +626,9 @@ static int udevProcessUSBDevice(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessUSBInterface(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
static int
|
||||
udevProcessUSBInterface(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
virNodeDevCapUSBIfPtr usb_if = &def->caps->data.usb_if;
|
||||
|
||||
@ -634,8 +655,9 @@ static int udevProcessUSBInterface(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessNetworkInterface(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
static int
|
||||
udevProcessNetworkInterface(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
const char *devtype = udev_device_get_devtype(device);
|
||||
virNodeDevCapNetPtr net = &def->caps->data.net;
|
||||
@ -671,8 +693,9 @@ static int udevProcessNetworkInterface(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessSCSIHost(struct udev_device *device ATTRIBUTE_UNUSED,
|
||||
virNodeDeviceDefPtr def)
|
||||
static int
|
||||
udevProcessSCSIHost(struct udev_device *device ATTRIBUTE_UNUSED,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
virNodeDevCapSCSIHostPtr scsi_host = &def->caps->data.scsi_host;
|
||||
char *filename = NULL;
|
||||
@ -697,8 +720,9 @@ static int udevProcessSCSIHost(struct udev_device *device ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessSCSITarget(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
static int
|
||||
udevProcessSCSITarget(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
const char *sysname = NULL;
|
||||
virNodeDevCapSCSITargetPtr scsi_target = &def->caps->data.scsi_target;
|
||||
@ -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,8 +801,9 @@ static int udevGetSCSIType(virNodeDeviceDefPtr def ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessSCSIDevice(struct udev_device *device ATTRIBUTE_UNUSED,
|
||||
virNodeDeviceDefPtr def)
|
||||
static int
|
||||
udevProcessSCSIDevice(struct udev_device *device ATTRIBUTE_UNUSED,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
int ret = -1;
|
||||
unsigned int tmp = 0;
|
||||
@ -818,8 +845,9 @@ static int udevProcessSCSIDevice(struct udev_device *device ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessDisk(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
static int
|
||||
udevProcessDisk(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
virNodeDevCapStoragePtr storage = &def->caps->data.storage;
|
||||
|
||||
@ -836,9 +864,10 @@ static int udevProcessDisk(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessRemoveableMedia(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def,
|
||||
int has_media)
|
||||
static int
|
||||
udevProcessRemoveableMedia(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def,
|
||||
int has_media)
|
||||
{
|
||||
virNodeDevCapStoragePtr storage = &def->caps->data.storage;
|
||||
int is_removable = 0;
|
||||
@ -877,8 +906,10 @@ static int udevProcessRemoveableMedia(struct udev_device *device,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int udevProcessCDROM(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
|
||||
static int
|
||||
udevProcessCDROM(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
int has_media = 0;
|
||||
|
||||
@ -897,8 +928,10 @@ static int udevProcessCDROM(struct udev_device *device,
|
||||
return udevProcessRemoveableMedia(device, def, has_media);
|
||||
}
|
||||
|
||||
static int udevProcessFloppy(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
|
||||
static int
|
||||
udevProcessFloppy(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
int has_media = 0;
|
||||
|
||||
@ -915,8 +948,9 @@ static int udevProcessFloppy(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessSD(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
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,8 +994,9 @@ static int udevKludgeStorageType(virNodeDeviceDefPtr def)
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessStorage(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
static int
|
||||
udevProcessStorage(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
virNodeDevCapStoragePtr storage = &def->caps->data.storage;
|
||||
int ret = -1;
|
||||
@ -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,8 +1268,9 @@ udevGetDeviceType(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int udevGetDeviceDetails(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
static int
|
||||
udevGetDeviceDetails(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
switch (def->caps->data.type) {
|
||||
case VIR_NODE_DEV_CAP_PCI_DEV:
|
||||
@ -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,8 +1342,9 @@ static int udevRemoveOneDevice(struct udev_device *device)
|
||||
}
|
||||
|
||||
|
||||
static int udevSetParent(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
static int
|
||||
udevSetParent(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
struct udev_device *parent_device = NULL;
|
||||
const char *parent_sysfs_path = 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,8 +1461,9 @@ static int udevAddOneDevice(struct udev_device *device)
|
||||
}
|
||||
|
||||
|
||||
static int udevProcessDeviceListEntry(struct udev *udev,
|
||||
struct udev_list_entry *list_entry)
|
||||
static int
|
||||
udevProcessDeviceListEntry(struct udev *udev,
|
||||
struct udev_list_entry *list_entry)
|
||||
{
|
||||
struct udev_device *device;
|
||||
const char *name = NULL;
|
||||
@ -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,10 +1597,11 @@ static int nodeStateCleanup(void)
|
||||
}
|
||||
|
||||
|
||||
static void udevEventHandleCallback(int watch ATTRIBUTE_UNUSED,
|
||||
int fd,
|
||||
int events ATTRIBUTE_UNUSED,
|
||||
void *data ATTRIBUTE_UNUSED)
|
||||
static void
|
||||
udevEventHandleCallback(int watch ATTRIBUTE_UNUSED,
|
||||
int fd,
|
||||
int events ATTRIBUTE_UNUSED,
|
||||
void *data ATTRIBUTE_UNUSED)
|
||||
{
|
||||
struct udev_device *device = NULL;
|
||||
struct udev_monitor *udev_monitor = DRV_STATE_UDEV_MONITOR(driver);
|
||||
@ -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,9 +1761,11 @@ static int udevPCITranslateInit(bool privileged ATTRIBUTE_UNUSED)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nodeStateInitialize(bool privileged,
|
||||
virStateInhibitCallback callback ATTRIBUTE_UNUSED,
|
||||
void *opaque ATTRIBUTE_UNUSED)
|
||||
|
||||
static int
|
||||
nodeStateInitialize(bool privileged,
|
||||
virStateInhibitCallback callback ATTRIBUTE_UNUSED,
|
||||
void *opaque ATTRIBUTE_UNUSED)
|
||||
{
|
||||
udevPrivate *priv = NULL;
|
||||
struct udev *udev = NULL;
|
||||
@ -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