mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 06:50:22 +03:00
vbox: Introduce IVirtualBoxErrorInfo interface
The IVirtualBoxErrorInfo interface allows us to query error messages from VirtualBox. Since VirtualBox has stacked errors we need the GetNext() method too. The odd one, that sticks out is GetIID() as it is not part of the interface as defined by VirtualBox header files. BUT, we need to get the interface UUID (which MAY change across each release) so that it can be passed to VBOX_QUERY_INTERFACE() introduced earlier. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
d4b6aa6305
commit
2a690fc172
@ -361,6 +361,7 @@ typedef nsISupports IHost;
|
||||
typedef nsISupports IHostNetworkInterface;
|
||||
typedef nsISupports IDHCPServer;
|
||||
typedef nsISupports IKeyboard;
|
||||
typedef nsISupports IVirtualBoxErrorInfo;
|
||||
|
||||
/* Macros for all vbox drivers. */
|
||||
|
||||
|
@ -2150,6 +2150,32 @@ _keyboardPutScancodes(IKeyboard *keyboard, PRUint32 scancodesSize,
|
||||
codesStored);
|
||||
}
|
||||
|
||||
static const nsID *
|
||||
_virtualBoxErrorInfoGetIID(void)
|
||||
{
|
||||
static const nsID ret = IVIRTUALBOXERRORINFO_IID;
|
||||
|
||||
return &ret;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
_virtualBoxErrorInfoGetComponent(IVirtualBoxErrorInfo *errInfo, PRUnichar **component)
|
||||
{
|
||||
return errInfo->vtbl->GetComponent(errInfo, component);
|
||||
}
|
||||
|
||||
static nsresult
|
||||
_virtualBoxErrorInfoGetNext(IVirtualBoxErrorInfo *errInfo, IVirtualBoxErrorInfo **next)
|
||||
{
|
||||
return errInfo->vtbl->GetNext(errInfo, next);
|
||||
}
|
||||
|
||||
static nsresult
|
||||
_virtualBoxErrorInfoGetText(IVirtualBoxErrorInfo *errInfo, PRUnichar **text)
|
||||
{
|
||||
return errInfo->vtbl->GetText(errInfo, text);
|
||||
}
|
||||
|
||||
static bool _machineStateOnline(PRUint32 state)
|
||||
{
|
||||
return ((state >= MachineState_FirstOnline) &&
|
||||
@ -2505,6 +2531,13 @@ static vboxUniformedIKeyboard _UIKeyboard = {
|
||||
.PutScancodes = _keyboardPutScancodes,
|
||||
};
|
||||
|
||||
static vboxUniformedIVirtualBoxErrorInfo _UIVirtualBoxErrorInfo = {
|
||||
.GetIID = _virtualBoxErrorInfoGetIID,
|
||||
.GetComponent = _virtualBoxErrorInfoGetComponent,
|
||||
.GetNext = _virtualBoxErrorInfoGetNext,
|
||||
.GetText = _virtualBoxErrorInfoGetText,
|
||||
};
|
||||
|
||||
static uniformedMachineStateChecker _machineStateChecker = {
|
||||
.Online = _machineStateOnline,
|
||||
.Inactive = _machineStateInactive,
|
||||
@ -2550,6 +2583,7 @@ void NAME(InstallUniformedAPI)(vboxUniformedAPI *pVBoxAPI)
|
||||
pVBoxAPI->UIHNInterface = _UIHNInterface;
|
||||
pVBoxAPI->UIDHCPServer = _UIDHCPServer;
|
||||
pVBoxAPI->UIKeyboard = _UIKeyboard;
|
||||
pVBoxAPI->UIVirtualBoxErrorInfo = _UIVirtualBoxErrorInfo;
|
||||
pVBoxAPI->machineStateChecker = _machineStateChecker;
|
||||
|
||||
pVBoxAPI->chipsetType = 1;
|
||||
|
@ -494,6 +494,13 @@ typedef struct {
|
||||
PRInt32 *scanCodes, PRUint32 *codesStored);
|
||||
} vboxUniformedIKeyboard;
|
||||
|
||||
typedef struct {
|
||||
const nsID * (*GetIID)(void);
|
||||
nsresult (*GetComponent)(IVirtualBoxErrorInfo *errInfo, PRUnichar **component);
|
||||
nsresult (*GetNext)(IVirtualBoxErrorInfo *errInfo, IVirtualBoxErrorInfo **next);
|
||||
nsresult (*GetText)(IVirtualBoxErrorInfo *errInfo, PRUnichar **text);
|
||||
} vboxUniformedIVirtualBoxErrorInfo;
|
||||
|
||||
typedef struct {
|
||||
bool (*Online)(PRUint32 state);
|
||||
bool (*Inactive)(PRUint32 state);
|
||||
@ -541,6 +548,7 @@ typedef struct {
|
||||
vboxUniformedIHNInterface UIHNInterface;
|
||||
vboxUniformedIDHCPServer UIDHCPServer;
|
||||
vboxUniformedIKeyboard UIKeyboard;
|
||||
vboxUniformedIVirtualBoxErrorInfo UIVirtualBoxErrorInfo;
|
||||
uniformedMachineStateChecker machineStateChecker;
|
||||
/* vbox API features */
|
||||
bool chipsetType;
|
||||
|
Loading…
x
Reference in New Issue
Block a user