2014-02-18 10:08:10 +00:00
|
|
|
/*
|
|
|
|
* bhyve_utils.h: bhyve utils
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014 Roman Bogorodskiy
|
|
|
|
*
|
|
|
|
* 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:15 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "driver.h"
|
|
|
|
#include "domain_event.h"
|
|
|
|
#include "configmake.h"
|
|
|
|
#include "virdomainobjlist.h"
|
|
|
|
#include "virthread.h"
|
2020-02-24 19:16:24 +00:00
|
|
|
#include "hypervisor/virclosecallbacks.h"
|
2019-06-07 20:20:15 +00:00
|
|
|
#include "virportallocator.h"
|
|
|
|
|
|
|
|
#define BHYVE_AUTOSTART_DIR SYSCONFDIR "/libvirt/bhyve/autostart"
|
|
|
|
#define BHYVE_CONFIG_DIR SYSCONFDIR "/libvirt/bhyve"
|
2019-08-20 15:05:12 +00:00
|
|
|
#define BHYVE_STATE_DIR RUNSTATEDIR "/libvirt/bhyve"
|
2019-06-07 20:20:15 +00:00
|
|
|
#define BHYVE_LOG_DIR LOCALSTATEDIR "/log/libvirt/bhyve"
|
2014-02-18 10:08:10 +00:00
|
|
|
|
2017-03-11 16:19:03 +00:00
|
|
|
typedef struct _virBhyveDriverConfig virBhyveDriverConfig;
|
|
|
|
typedef struct _virBhyveDriverConfig *virBhyveDriverConfigPtr;
|
|
|
|
|
|
|
|
struct _virBhyveDriverConfig {
|
|
|
|
virObject parent;
|
|
|
|
|
|
|
|
char *firmwareDir;
|
|
|
|
};
|
|
|
|
|
2014-02-18 10:08:10 +00:00
|
|
|
struct _bhyveConn {
|
|
|
|
virMutex lock;
|
2017-03-11 16:19:03 +00:00
|
|
|
|
|
|
|
virBhyveDriverConfigPtr config;
|
|
|
|
|
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;
|
|
|
|
|
2014-02-18 10:08:10 +00:00
|
|
|
virDomainObjListPtr domains;
|
|
|
|
virCapsPtr caps;
|
|
|
|
virDomainXMLOptionPtr xmlopt;
|
|
|
|
char *pidfile;
|
2014-04-23 09:24:05 +00:00
|
|
|
virSysinfoDefPtr hostsysinfo;
|
2014-03-18 09:31:48 +00:00
|
|
|
|
2014-04-23 11:55:05 +00:00
|
|
|
virObjectEventStatePtr domainEventState;
|
|
|
|
|
2014-03-18 09:31:48 +00:00
|
|
|
virCloseCallbacksPtr closeCallbacks;
|
2014-11-08 16:48:35 +00:00
|
|
|
|
2018-02-06 09:09:06 +00:00
|
|
|
virPortAllocatorRangePtr remotePorts;
|
2017-05-08 10:36:43 +00:00
|
|
|
|
2015-07-19 08:20:35 +00:00
|
|
|
unsigned bhyvecaps;
|
2014-11-08 16:48:35 +00:00
|
|
|
unsigned grubcaps;
|
2014-02-18 10:08:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _bhyveConn bhyveConn;
|
|
|
|
typedef struct _bhyveConn *bhyveConnPtr;
|
|
|
|
|
2014-03-23 09:16:09 +00:00
|
|
|
struct bhyveAutostartData {
|
|
|
|
bhyveConnPtr driver;
|
|
|
|
virConnectPtr conn;
|
|
|
|
};
|
|
|
|
|
2014-02-18 10:08:10 +00:00
|
|
|
void bhyveDriverLock(bhyveConnPtr driver);
|
|
|
|
void bhyveDriverUnlock(bhyveConnPtr driver);
|