2017-02-28 18:24:26 +00:00
|
|
|
/*
|
|
|
|
* virnodedeviceobj.h: node device object handling for node devices
|
|
|
|
* (derived from node_device_conf.h)
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2019-06-07 20:20:19 +00:00
|
|
|
#pragma once
|
2017-02-28 18:24:26 +00:00
|
|
|
|
2019-06-07 20:20:19 +00:00
|
|
|
#include "internal.h"
|
|
|
|
#include "virthread.h"
|
2017-02-28 18:24:26 +00:00
|
|
|
|
2019-06-07 20:20:19 +00:00
|
|
|
#include "node_device_conf.h"
|
|
|
|
#include "object_event.h"
|
2017-02-28 18:24:26 +00:00
|
|
|
|
|
|
|
|
2017-05-12 17:56:14 +00:00
|
|
|
typedef struct _virNodeDeviceObj virNodeDeviceObj;
|
|
|
|
typedef virNodeDeviceObj *virNodeDeviceObjPtr;
|
|
|
|
|
|
|
|
typedef struct _virNodeDeviceObjList virNodeDeviceObjList;
|
|
|
|
typedef virNodeDeviceObjList *virNodeDeviceObjListPtr;
|
|
|
|
|
2017-02-28 18:24:26 +00:00
|
|
|
typedef struct _virNodeDeviceDriverState virNodeDeviceDriverState;
|
|
|
|
typedef virNodeDeviceDriverState *virNodeDeviceDriverStatePtr;
|
|
|
|
struct _virNodeDeviceDriverState {
|
|
|
|
virMutex lock;
|
|
|
|
|
2019-05-23 10:34:08 +00:00
|
|
|
/* pid file FD, ensures two copies of the driver can't use the same root */
|
|
|
|
int lockFD;
|
|
|
|
|
|
|
|
char *stateDir;
|
|
|
|
|
2017-10-17 15:05:47 +00:00
|
|
|
virNodeDeviceObjListPtr devs; /* currently-known devices */
|
|
|
|
void *privateData; /* driver-specific private data */
|
2017-10-16 09:53:33 +00:00
|
|
|
bool privileged; /* whether we run in privileged mode */
|
2017-02-28 18:24:26 +00:00
|
|
|
|
|
|
|
/* Immutable pointer, self-locking APIs */
|
|
|
|
virObjectEventStatePtr nodeDeviceEventState;
|
|
|
|
};
|
|
|
|
|
2017-05-15 15:00:59 +00:00
|
|
|
void
|
|
|
|
virNodeDeviceObjEndAPI(virNodeDeviceObjPtr *obj);
|
2017-02-28 18:24:26 +00:00
|
|
|
|
2017-06-03 11:36:01 +00:00
|
|
|
virNodeDeviceDefPtr
|
|
|
|
virNodeDeviceObjGetDef(virNodeDeviceObjPtr obj);
|
|
|
|
|
2017-03-02 13:50:27 +00:00
|
|
|
virNodeDeviceObjPtr
|
2017-05-12 18:47:17 +00:00
|
|
|
virNodeDeviceObjListFindByName(virNodeDeviceObjListPtr devs,
|
|
|
|
const char *name);
|
2017-02-28 18:24:26 +00:00
|
|
|
|
|
|
|
virNodeDeviceObjPtr
|
2017-05-12 18:47:17 +00:00
|
|
|
virNodeDeviceObjListFindBySysfsPath(virNodeDeviceObjListPtr devs,
|
|
|
|
const char *sysfs_path)
|
2017-02-28 18:24:26 +00:00
|
|
|
ATTRIBUTE_NONNULL(2);
|
|
|
|
|
2017-05-12 19:31:10 +00:00
|
|
|
virNodeDeviceObjPtr
|
|
|
|
virNodeDeviceObjListFindSCSIHostByWWNs(virNodeDeviceObjListPtr devs,
|
|
|
|
const char *wwnn,
|
|
|
|
const char *wwpn);
|
|
|
|
|
2017-03-02 13:50:27 +00:00
|
|
|
virNodeDeviceObjPtr
|
2017-05-12 18:47:17 +00:00
|
|
|
virNodeDeviceObjListAssignDef(virNodeDeviceObjListPtr devs,
|
|
|
|
virNodeDeviceDefPtr def);
|
2017-03-02 13:50:27 +00:00
|
|
|
|
|
|
|
void
|
2017-05-12 18:47:17 +00:00
|
|
|
virNodeDeviceObjListRemove(virNodeDeviceObjListPtr devs,
|
|
|
|
virNodeDeviceObjPtr dev);
|
2017-02-28 18:24:26 +00:00
|
|
|
|
2017-03-02 13:50:27 +00:00
|
|
|
int
|
2017-05-12 18:47:17 +00:00
|
|
|
virNodeDeviceObjListGetParentHost(virNodeDeviceObjListPtr devs,
|
2017-07-20 13:17:22 +00:00
|
|
|
virNodeDeviceDefPtr def);
|
2017-02-28 18:24:26 +00:00
|
|
|
|
2017-05-12 17:51:25 +00:00
|
|
|
virNodeDeviceObjListPtr
|
|
|
|
virNodeDeviceObjListNew(void);
|
|
|
|
|
2017-03-02 13:50:27 +00:00
|
|
|
void
|
|
|
|
virNodeDeviceObjListFree(virNodeDeviceObjListPtr devs);
|
2017-02-28 18:24:26 +00:00
|
|
|
|
2017-03-02 13:50:27 +00:00
|
|
|
typedef bool
|
|
|
|
(*virNodeDeviceObjListFilter)(virConnectPtr conn,
|
|
|
|
virNodeDeviceDefPtr def);
|
2017-02-28 18:24:26 +00:00
|
|
|
|
2017-03-19 11:49:38 +00:00
|
|
|
int
|
2017-05-12 18:47:17 +00:00
|
|
|
virNodeDeviceObjListNumOfDevices(virNodeDeviceObjListPtr devs,
|
|
|
|
virConnectPtr conn,
|
|
|
|
const char *cap,
|
2017-08-16 13:23:27 +00:00
|
|
|
virNodeDeviceObjListFilter filter);
|
2017-03-19 11:49:38 +00:00
|
|
|
|
2017-03-19 19:51:03 +00:00
|
|
|
int
|
2017-05-12 18:47:17 +00:00
|
|
|
virNodeDeviceObjListGetNames(virNodeDeviceObjListPtr devs,
|
|
|
|
virConnectPtr conn,
|
2017-08-16 13:23:27 +00:00
|
|
|
virNodeDeviceObjListFilter filter,
|
2017-05-12 18:47:17 +00:00
|
|
|
const char *cap,
|
|
|
|
char **const names,
|
|
|
|
int maxnames);
|
2017-03-19 19:51:03 +00:00
|
|
|
|
2017-03-02 13:50:27 +00:00
|
|
|
int
|
|
|
|
virNodeDeviceObjListExport(virConnectPtr conn,
|
2017-03-20 11:28:30 +00:00
|
|
|
virNodeDeviceObjListPtr devobjs,
|
2017-03-02 13:50:27 +00:00
|
|
|
virNodeDevicePtr **devices,
|
2017-08-16 13:23:27 +00:00
|
|
|
virNodeDeviceObjListFilter filter,
|
2017-03-02 13:50:27 +00:00
|
|
|
unsigned int flags);
|
2017-02-28 18:24:26 +00:00
|
|
|
|
2018-02-23 23:09:20 +00:00
|
|
|
void
|
|
|
|
virNodeDeviceObjSetSkipUpdateCaps(virNodeDeviceObjPtr obj,
|
|
|
|
bool skipUpdateCaps);
|