1 /* 2 * driver-nodedev.h: entry points for nodedev drivers 3 * 4 * Copyright (C) 2006-2014 Red Hat, Inc. 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library. If not, see 18 * <http://www.gnu.org/licenses/>. 19 */ 20 21 #pragma once 22 23 #ifndef __VIR_DRIVER_H_INCLUDES___ 24 # error "Don't include this file directly, only use driver.h" 25 #endif 26 27 typedef int 28 (*virDrvNodeNumOfDevices)(virConnectPtr conn, 29 const char *cap, 30 unsigned int flags); 31 32 typedef int 33 (*virDrvNodeListDevices)(virConnectPtr conn, 34 const char *cap, 35 char **const names, 36 int maxnames, 37 unsigned int flags); 38 39 typedef int 40 (*virDrvConnectListAllNodeDevices)(virConnectPtr conn, 41 virNodeDevicePtr **devices, 42 unsigned int flags); 43 44 typedef virNodeDevicePtr 45 (*virDrvNodeDeviceLookupByName)(virConnectPtr conn, 46 const char *name); 47 48 typedef virNodeDevicePtr 49 (*virDrvNodeDeviceLookupSCSIHostByWWN)(virConnectPtr conn, 50 const char *wwnn, 51 const char *wwpn, 52 unsigned int flags); 53 54 typedef char * 55 (*virDrvNodeDeviceGetXMLDesc)(virNodeDevicePtr dev, 56 unsigned int flags); 57 58 typedef char * 59 (*virDrvNodeDeviceGetParent)(virNodeDevicePtr dev); 60 61 typedef int 62 (*virDrvNodeDeviceNumOfCaps)(virNodeDevicePtr dev); 63 64 typedef int 65 (*virDrvNodeDeviceListCaps)(virNodeDevicePtr dev, 66 char **const names, 67 int maxnames); 68 69 typedef virNodeDevicePtr 70 (*virDrvNodeDeviceCreateXML)(virConnectPtr conn, 71 const char *xmlDesc, 72 unsigned int flags); 73 74 typedef int 75 (*virDrvNodeDeviceDestroy)(virNodeDevicePtr dev); 76 77 typedef virNodeDevicePtr 78 (*virDrvNodeDeviceDefineXML)(virConnectPtr conn, 79 const char *xmlDesc, 80 unsigned int flags); 81 82 typedef int 83 (*virDrvNodeDeviceUndefine)(virNodeDevicePtr dev, 84 unsigned int flags); 85 86 typedef int 87 (*virDrvNodeDeviceCreate)(virNodeDevicePtr dev, 88 unsigned int flags); 89 90 typedef int 91 (*virDrvNodeDeviceSetAutostart)(virNodeDevicePtr dev, 92 int autostart); 93 94 typedef int 95 (*virDrvNodeDeviceGetAutostart)(virNodeDevicePtr dev, 96 int *autostart); 97 98 typedef int 99 (*virDrvNodeDeviceIsPersistent)(virNodeDevicePtr dev); 100 101 typedef int 102 (*virDrvNodeDeviceIsActive)(virNodeDevicePtr dev); 103 104 typedef int 105 (*virDrvConnectNodeDeviceEventRegisterAny)(virConnectPtr conn, 106 virNodeDevicePtr dev, 107 int eventID, 108 virConnectNodeDeviceEventGenericCallback cb, 109 void *opaque, 110 virFreeCallback freecb); 111 112 typedef int 113 (*virDrvConnectNodeDeviceEventDeregisterAny)(virConnectPtr conn, 114 int callbackID); 115 116 117 118 typedef struct _virNodeDeviceDriver virNodeDeviceDriver; 119 120 /** 121 * _virNodeDeviceDriver: 122 * 123 * Structure associated with monitoring the devices 124 * on a virtualized node. 125 * 126 */ 127 struct _virNodeDeviceDriver { 128 const char *name; /* the name of the driver */ 129 virDrvNodeNumOfDevices nodeNumOfDevices; 130 virDrvNodeListDevices nodeListDevices; 131 virDrvConnectListAllNodeDevices connectListAllNodeDevices; 132 virDrvConnectNodeDeviceEventRegisterAny connectNodeDeviceEventRegisterAny; 133 virDrvConnectNodeDeviceEventDeregisterAny connectNodeDeviceEventDeregisterAny; 134 virDrvNodeDeviceLookupByName nodeDeviceLookupByName; 135 virDrvNodeDeviceLookupSCSIHostByWWN nodeDeviceLookupSCSIHostByWWN; 136 virDrvNodeDeviceGetXMLDesc nodeDeviceGetXMLDesc; 137 virDrvNodeDeviceGetParent nodeDeviceGetParent; 138 virDrvNodeDeviceNumOfCaps nodeDeviceNumOfCaps; 139 virDrvNodeDeviceListCaps nodeDeviceListCaps; 140 virDrvNodeDeviceCreateXML nodeDeviceCreateXML; 141 virDrvNodeDeviceDestroy nodeDeviceDestroy; 142 virDrvNodeDeviceDefineXML nodeDeviceDefineXML; 143 virDrvNodeDeviceUndefine nodeDeviceUndefine; 144 virDrvNodeDeviceCreate nodeDeviceCreate; 145 virDrvNodeDeviceSetAutostart nodeDeviceSetAutostart; 146 virDrvNodeDeviceGetAutostart nodeDeviceGetAutostart; 147 virDrvNodeDeviceIsPersistent nodeDeviceIsPersistent; 148 virDrvNodeDeviceIsActive nodeDeviceIsActive; 149 }; 150