2014-03-01 06:28:59 +00:00
|
|
|
/* virhostdev.h: hostdev management
|
|
|
|
*
|
2014-03-05 12:14:38 +00:00
|
|
|
* Copyright (C) 2006-2007, 2009-2013 Red Hat, Inc.
|
|
|
|
* Copyright (C) 2006 Daniel P. Berrange
|
2014-03-01 06:28:59 +00:00
|
|
|
* Copyright (C) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
2014-03-05 12:14:38 +00:00
|
|
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
2014-03-01 06:28:59 +00:00
|
|
|
* Author: Chunyan Liu <cyliu@suse.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __VIR_HOSTDEV_H__
|
|
|
|
# define __VIR_HOSTDEV_H__
|
|
|
|
|
|
|
|
# include "internal.h"
|
|
|
|
|
|
|
|
# include "virpci.h"
|
|
|
|
# include "virusb.h"
|
|
|
|
# include "virscsi.h"
|
2014-03-05 12:14:38 +00:00
|
|
|
# include "domain_conf.h"
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
VIR_HOSTDEV_STRICT_ACS_CHECK = (1 << 0), /* strict acs check */
|
|
|
|
VIR_HOSTDEV_COLD_BOOT = (1 << 1), /* cold boot */
|
|
|
|
} virHostdevFlag;
|
|
|
|
|
2014-03-01 06:28:59 +00:00
|
|
|
|
|
|
|
typedef struct _virHostdevManager virHostdevManager;
|
|
|
|
typedef virHostdevManager *virHostdevManagerPtr;
|
|
|
|
struct _virHostdevManager {
|
|
|
|
char *stateDir;
|
|
|
|
|
|
|
|
virPCIDeviceListPtr activePciHostdevs;
|
|
|
|
virPCIDeviceListPtr inactivePciHostdevs;
|
|
|
|
virUSBDeviceListPtr activeUsbHostdevs;
|
|
|
|
virSCSIDeviceListPtr activeScsiHostdevs;
|
|
|
|
};
|
|
|
|
|
|
|
|
virHostdevManagerPtr virHostdevManagerGetDefault(void);
|
2014-03-05 12:14:38 +00:00
|
|
|
int
|
|
|
|
virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
|
|
|
|
const char *drv_name,
|
2014-03-06 07:24:06 +00:00
|
|
|
const char *dom_name,
|
2014-03-05 12:14:38 +00:00
|
|
|
const unsigned char *uuid,
|
|
|
|
virDomainHostdevDefPtr *hostdevs,
|
2014-03-06 05:53:56 +00:00
|
|
|
int nhostdevs,
|
|
|
|
unsigned int flags);
|
|
|
|
int
|
|
|
|
virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr,
|
|
|
|
const char *drv_name,
|
2014-03-06 07:24:06 +00:00
|
|
|
const char *dom_name,
|
2014-03-06 05:53:56 +00:00
|
|
|
virDomainHostdevDefPtr *hostdevs,
|
2014-03-05 12:14:38 +00:00
|
|
|
int nhostdevs,
|
|
|
|
unsigned int flags);
|
2014-03-06 06:19:11 +00:00
|
|
|
int
|
|
|
|
virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
|
|
|
|
const char *drv_name,
|
2014-03-06 07:24:06 +00:00
|
|
|
const char *dom_name,
|
2014-03-06 06:19:11 +00:00
|
|
|
virDomainHostdevDefPtr *hostdevs,
|
|
|
|
int nhostdevs);
|
2014-03-05 12:14:38 +00:00
|
|
|
void
|
|
|
|
virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
|
|
|
|
const char *drv_name,
|
2014-03-06 07:24:06 +00:00
|
|
|
const char *dom_name,
|
2014-03-05 12:14:38 +00:00
|
|
|
virDomainHostdevDefPtr *hostdevs,
|
|
|
|
int nhostdevs,
|
2014-03-12 16:01:39 +00:00
|
|
|
const char *oldStateDir);
|
2014-03-06 06:37:30 +00:00
|
|
|
void
|
|
|
|
virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
|
|
|
|
const char *drv_name,
|
2014-03-06 07:24:06 +00:00
|
|
|
const char *dom_name,
|
2014-03-06 06:37:30 +00:00
|
|
|
virDomainHostdevDefPtr *hostdevs,
|
|
|
|
int nhostdevs);
|
2014-03-06 06:49:23 +00:00
|
|
|
void
|
|
|
|
virHostdevReAttachScsiHostdevs(virHostdevManagerPtr hostdev_mgr,
|
|
|
|
const char *drv_name,
|
2014-03-06 07:24:06 +00:00
|
|
|
const char *dom_name,
|
2014-03-06 06:49:23 +00:00
|
|
|
virDomainHostdevDefPtr *hostdevs,
|
|
|
|
int nhostdevs);
|
2014-03-06 05:13:00 +00:00
|
|
|
int
|
|
|
|
virHostdevUpdateActivePciHostdevs(virHostdevManagerPtr mgr,
|
|
|
|
const char *drv_name,
|
|
|
|
virDomainDefPtr def);
|
|
|
|
int
|
|
|
|
virHostdevUpdateActiveUsbHostdevs(virHostdevManagerPtr mgr,
|
|
|
|
const char *drv_name,
|
|
|
|
virDomainDefPtr def);
|
|
|
|
int
|
|
|
|
virHostdevUpdateActiveScsiHostdevs(virHostdevManagerPtr mgr,
|
|
|
|
const char *drv_name,
|
|
|
|
virDomainDefPtr def);
|
2014-03-01 06:28:59 +00:00
|
|
|
|
2014-03-06 07:20:14 +00:00
|
|
|
/* functions used by NodeDevDetach/Reattach/Reset */
|
|
|
|
int virHostdevPciNodeDeviceDetach(virHostdevManagerPtr mgr,
|
|
|
|
virPCIDevicePtr pci);
|
|
|
|
int virHostdevPciNodeDeviceReAttach(virHostdevManagerPtr mgr,
|
|
|
|
virPCIDevicePtr pci);
|
|
|
|
int virHostdevPciNodeDeviceReset(virHostdevManagerPtr mgr,
|
|
|
|
virPCIDevicePtr pci);
|
|
|
|
|
2014-03-01 06:28:59 +00:00
|
|
|
#endif /* __VIR_HOSTDEV_H__ */
|