Commit Graph

31 Commits

Author SHA1 Message Date
Shalini Chellathurai Saroja
2b9690b62d util: virhostdev: add virHostdevIsMdevDevice()
Add the function virHostdevIsMdevDevice() which detects whether a
hostdev is a mediated device or not. Also, replace all existing
conditionals.

Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-05-14 12:12:06 -04:00
John Ferlan
2902771fa0 util: Remove NONNULL from virHostdevReAttachMediatedDevices
Causes build failure when enabling static analysis
2017-03-27 12:41:24 -04:00
Erik Skultety
a4a39d90ab hostdev: Maintain a driver list of active mediated devices
Keep track of the assigned mediated devices the same way we do it for
the rest of hostdevs. Methods like 'Prepare', 'Update', and 'ReAttach'
are introduced by this patch.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2017-03-27 15:39:35 +02:00
John Ferlan
cd0ed1456d util: Remove NONNULL(1) for virHostdevReAttachDomainDevices
Since the function handles a NULL 'mgr' condition, no need for the NONNULL
2017-03-22 13:50:00 -04:00
John Ferlan
40f2a476d1 util: Remove NONNULL(1) for virHostdevPrepareDomainDevices
Since the code checks 'mgr == NULL' anyway, no need for the prototype
to have the NONNULL arg check.  Also add an error message to indicate what
the failure is so that there isn't a failed for some reason error.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2017-03-22 13:50:00 -04:00
John Ferlan
47dcce2f08 util: Remove NONNULL(2,3) for virHostdevReAttachSCSIVHostDevices
The comparison code used STREQ_NULLABLE anyway for both 'drv_name' and
'dom_name', so no need. Add a NULLSTR on the 'dom_name' too.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2017-03-22 13:50:00 -04:00
John Ferlan
ceaf327475 util: Remove NONNULL(2,3) for virHostdevReAttachUSBDevices
The comparison code used STREQ_NULLABLE anyway for both 'drv_name' and
'dom_name', so no need. Add a NULLSTR on the 'dom_name' too.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2017-03-22 13:49:59 -04:00
John Ferlan
17a448da1d util: Remove NONNULL(2,3) for virHostdevReAttachPCIDevices
The called function uses a STRNEQ_NULLABLE anyway for both 'drv_name' and
'dom_name', so no need.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2017-03-22 13:49:59 -04:00
Peter Krempa
b4c7310633 Disallow inclusion of files from src/conf into src/utils
The utils code should stay separated from other code (except for very
well justified cases). Unfortunately commit 272769becc
made it trivial to break the separation (and not get slapped by the
syntax-check rule) by adding -I src/conf to the CFLAGS for utils.

Remove this shortcut and except the two offenders from the syntax check
so that the codebase can be kept separated.
2017-02-20 15:12:07 +01:00
Eric Farman
629544be0f util: Management routines for scsi_host devices
For a new hostdev type='scsi_host' we have a number of
required functions for managing, adding, and removing the
host device to/from guests.  Provide the basic infrastructure
for these tasks.

The name "SCSIVHost" (and its variants) is chosen to avoid
conflicts with existing code named "SCSIHost" to refer to
a hostdev type='scsi' protcol='none'.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
2016-11-24 12:15:26 -05:00
Marc Hartmayer
20bf8ea693 util: Add virHostdevIsSCSIDevice()
Add the function virHostdevIsSCSIDevice() which detects whether a
hostdev is a SCSI device or not.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
2016-11-22 14:37:36 +01:00
Cédric Bosdonnat
ea46e00f12 Add virHostdevFindUSBDevice to private symbols
Finding an USB device from the vendor/device values will be needed
by libxl driver to convert from vendor/device to bus/dev addresses.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-09-02 17:38:09 +02:00
Andrea Bolognani
2ab52f4af7 hostdev: Rename virHostdevUpdateDomainActiveDevices()
The new name, virHostdevUpdateActiveDomainDevices(), follows the
same naming conventions used by the rest of the module.

No functional changes.
2015-10-26 13:50:35 +01:00
Chunyan Liu
1b780c9eae virhostdev.h: remove ATTRIBUTE_NONNULL from oldStateDir
In libxl driver oldStateDir is NULL when calling
virHostdevReAttachDomainHostdevs. This is allowed.
Remove ATTRIBUTE_NONNULL setting from oldStateDir.

Introduced by commit 6225cb3.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2014-03-19 10:05:31 +01:00
Jim Fehlig
b322717f6e hostdev: add virObject field to virHostdevManager struct
Commit 6b306d66 converted virHostdevManager to a virObject, but
missed adding a virObject field to the virHostdevManager struct.
Result is memory corruption when taking a reference on an instance
of the object, where atomic inc is done on the stateDir field.
Later use of stateDir crashes libvirtd.
2014-03-13 08:41:43 -06:00
Chunyan Liu
7becc46225 Add parameter checks/annotations to hostdev APIs
Mark many parameters as NONNULL and check for empty list of
hostdevs.
2014-03-12 16:53:33 +00:00
Chunyan Liu
e991b09ddd add 3 wrapper functions for prepare/reattach/update domain hostdevs 2014-03-12 16:53:20 +00:00
Chunyan Liu
4dd9f103fa improve virHostdevUpdate* parameters to make it more widely used
Changes parameter from vm def to specific hostdevs info and name info, so that
it could be used more widely, e.g, could be used without full vm def info.
2014-03-12 16:41:32 +00:00
Daniel P. Berrange
a65e6d3626 Capitalize USB, PCI and SCSI in hostdev variables
Change any variable names with Usb, Pci or Scsi to use
USB, PCI and SCSI since they are abbreviations.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-03-12 16:38:18 +00:00
Daniel P. Berrange
e9a60dcc7c Remove redundant duplicated 'Hostdev' string method names
Some virHostdevXXXX methods included the string Hostdev again
as a suffix. Change the latter to Device instead.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-03-12 16:35:30 +00:00
Chunyan Liu
7be4bddea1 Capitalize USB, PCI and SCSI in hostdev methods
Change any method names with Usb, Pci or Scsi to use
USB, PCI and SCSI since they are abbreviations.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-03-12 16:20:01 +00:00
Daniel P. Berrange
b4bbaeef41 Fixed const-ness of parameters in netdev/hostdev code
Various methods in virnetdev.c and virhostdev.c were missing
const-ness for several char * parameters.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-03-12 16:03:06 +00:00
Chunyan Liu
1c6ee84c9d improve parameter name to let it more meaningful 2014-03-12 16:03:06 +00:00
Chunyan Liu
1fabf06ca5 move virHostdevNodeDevice* to virhostdev.c 2014-03-12 16:03:06 +00:00
Chunyan Liu
a4797138ad move virHostdevReAttachHostScsiDevices to virhostdev.c 2014-03-12 16:03:06 +00:00
Chunyan Liu
2d961cf3ba move virHostdevReAttachUsbHostdevs to virhostdev.c 2014-03-12 16:03:05 +00:00
Chunyan Liu
5035f75fed move virHostdevPrepareHostSCSIDevices to virhostdev.c 2014-03-12 16:03:05 +00:00
Chunyan Liu
1c310c609c move virHostdevPrepareHostUSBDevices to virhostdev.c 2014-03-12 16:03:05 +00:00
Chunyan Liu
00729f4559 move virHostdevUpdate* functions to virhostdev.c 2014-03-12 16:03:05 +00:00
Chunyan Liu
899b261127 move virHostdevPrepare(ReAttach)PCIDevices to virhostdev.c 2014-03-12 16:03:05 +00:00
Chunyan Liu
6b4c0a635e add virhostdev files to maintain global state of host devices
Signed-off-by: Chunyan Liu <cyliu@suse.com>
2014-03-04 12:28:45 +00:00