Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
d0bef643
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d0bef643
编写于
6月 19, 2016
作者:
M
Martin Pietsch
提交者:
Ján Tomko
6月 24, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for VirtualBox 5
上级
541bd183
变更
7
展开全部
显示空白变更内容
内联
并排
Showing
7 changed file
with
25647 addition
and
6 deletion
+25647
-6
src/Makefile.am
src/Makefile.am
+1
-0
src/vbox/vbox_CAPI_v5_0.h
src/vbox/vbox_CAPI_v5_0.h
+25550
-0
src/vbox/vbox_V5_0.c
src/vbox/vbox_V5_0.c
+13
-0
src/vbox/vbox_common.h
src/vbox/vbox_common.h
+2
-0
src/vbox/vbox_storage.c
src/vbox/vbox_storage.c
+2
-0
src/vbox/vbox_tmpl.c
src/vbox/vbox_tmpl.c
+78
-6
src/vbox/vbox_uniformed_api.h
src/vbox/vbox_uniformed_api.h
+1
-0
未找到文件。
src/Makefile.am
浏览文件 @
d0bef643
...
...
@@ -791,6 +791,7 @@ VBOX_DRIVER_SOURCES = \
vbox/vbox_V4_2_20.c vbox/vbox_CAPI_v4_2_20.h
\
vbox/vbox_V4_3.c vbox/vbox_CAPI_v4_3.h
\
vbox/vbox_V4_3_4.c vbox/vbox_CAPI_v4_3_4.h
\
vbox/vbox_V5_0.c vbox/vbox_CAPI_v5_0.h
\
vbox/vbox_common.c vbox/vbox_common.h
\
vbox/vbox_uniformed_api.h
\
vbox/vbox_get_driver.h
\
...
...
src/vbox/vbox_CAPI_v5_0.h
0 → 100644
浏览文件 @
d0bef643
此差异已折叠。
点击以展开。
src/vbox/vbox_V5_0.c
0 → 100644
浏览文件 @
d0bef643
/** @file vbox_V5_0.c
* C file to include support for multiple versions of VirtualBox
* at runtime.
*/
#include <config.h>
/** The API Version */
#define VBOX_API_VERSION 5000000
/** Version specific prefix. */
#define NAME(name) vbox50##name
#include "vbox_tmpl.c"
src/vbox/vbox_common.h
浏览文件 @
d0bef643
...
...
@@ -430,6 +430,8 @@ typedef nsISupports IKeyboard;
vbox43InstallUniformedAPI(&gVBoxAPI); \
} else if (uVersion >= 4003004 && uVersion < 4003051) { \
vbox43_4InstallUniformedAPI(&gVBoxAPI); \
} else if (uVersion >= 4003051 && uVersion < 5000051) { \
vbox50InstallUniformedAPI(&gVBoxAPI); \
} else { \
result = -1; \
} \
...
...
src/vbox/vbox_storage.c
浏览文件 @
d0bef643
...
...
@@ -908,6 +908,8 @@ virStorageDriverPtr vboxGetStorageDriver(uint32_t uVersion)
vbox43InstallUniformedAPI
(
&
gVBoxAPI
);
}
else
if
(
uVersion
>=
4003004
&&
uVersion
<
4003051
)
{
vbox43_4InstallUniformedAPI
(
&
gVBoxAPI
);
}
else
if
(
uVersion
>=
4003051
&&
uVersion
<
5000051
)
{
vbox50InstallUniformedAPI
(
&
gVBoxAPI
);
}
else
{
return
NULL
;
}
...
...
src/vbox/vbox_tmpl.c
浏览文件 @
d0bef643
...
...
@@ -69,6 +69,8 @@
# include "vbox_CAPI_v4_3.h"
#elif VBOX_API_VERSION == 4003004
# include "vbox_CAPI_v4_3_4.h"
#elif VBOX_API_VERSION == 5000000
# include "vbox_CAPI_v5_0.h"
#else
# error "Unsupport VBOX_API_VERSION"
#endif
...
...
@@ -1311,7 +1313,9 @@ _vboxDomainSnapshotRestore(virDomainPtr dom,
ISnapshot
*
snapshot
)
{
vboxGlobalData
*
data
=
dom
->
conn
->
privateData
;
# if VBOX_API_VERSION < 5000000
IConsole
*
console
=
NULL
;
# endif
/*VBOX_API_VERSION < 5000000*/
IProgress
*
progress
=
NULL
;
PRUint32
state
;
nsresult
rc
;
...
...
@@ -1344,8 +1348,10 @@ _vboxDomainSnapshotRestore(virDomainPtr dom,
}
rc
=
VBOX_SESSION_OPEN
(
domiid
.
value
,
machine
);
# if VBOX_API_VERSION < 5000000
if
(
NS_SUCCEEDED
(
rc
))
rc
=
data
->
vboxSession
->
vtbl
->
GetConsole
(
data
->
vboxSession
,
&
console
);
# endif
/*VBOX_API_VERSION < 5000000*/
if
(
NS_FAILED
(
rc
))
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"could not open VirtualBox session with domain %s"
),
...
...
@@ -1353,7 +1359,12 @@ _vboxDomainSnapshotRestore(virDomainPtr dom,
goto
cleanup
;
}
# if VBOX_API_VERSION < 5000000
rc
=
console
->
vtbl
->
RestoreSnapshot
(
console
,
snapshot
,
&
progress
);
# elif VBOX_API_VERSION >= 5000000
/*VBOX_API_VERSION < 5000000*/
rc
=
machine
->
vtbl
->
RestoreSnapshot
(
machine
,
snapshot
,
&
progress
);
# endif
/*VBOX_API_VERSION >= 5000000*/
if
(
NS_FAILED
(
rc
)
||
!
progress
)
{
if
(
rc
==
VBOX_E_INVALID_VM_STATE
)
{
virReportError
(
VIR_ERR_OPERATION_INVALID
,
"%s"
,
...
...
@@ -1378,7 +1389,9 @@ _vboxDomainSnapshotRestore(virDomainPtr dom,
cleanup:
VBOX_RELEASE
(
progress
);
# if VBOX_API_VERSION < 5000000
VBOX_RELEASE
(
console
);
# endif
/*VBOX_API_VERSION < 5000000*/
VBOX_SESSION_CLOSE
();
vboxIIDUnalloc
(
&
domiid
);
return
ret
;
...
...
@@ -2874,7 +2887,11 @@ _virtualboxCreateHardDisk(IVirtualBox *vboxObj, PRUnichar *format,
/* In vbox 2.2 and 3.0, this function will create a IHardDisk object.
* In vbox 3.1 and later, this function will create a IMedium object.
*/
#if VBOX_API_VERSION < 5000000
return
vboxObj
->
vtbl
->
CreateHardDisk
(
vboxObj
,
format
,
location
,
hardDisk
);
#elif VBOX_API_VERSION >= 5000000
/*VBOX_API_VERSION >= 5000000*/
return
vboxObj
->
vtbl
->
CreateMedium
(
vboxObj
,
format
,
location
,
AccessMode_ReadWrite
,
DeviceType_HardDisk
,
hardDisk
);
#endif
/*VBOX_API_VERSION >= 5000000*/
}
static
nsresult
...
...
@@ -3366,7 +3383,23 @@ _sessionGetMachine(ISession *session, IMachine **machine)
static
nsresult
_consoleSaveState
(
IConsole
*
console
,
IProgress
**
progress
)
{
#if VBOX_API_VERSION < 5000000
return
console
->
vtbl
->
SaveState
(
console
,
progress
);
#else
/*VBOX_API_VERSION < 5000000*/
IMachine
*
machine
;
nsresult
rc
;
rc
=
console
->
vtbl
->
GetMachine
(
console
,
&
machine
);
if
(
NS_SUCCEEDED
(
rc
))
rc
=
machine
->
vtbl
->
SaveState
(
machine
,
progress
);
else
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"unable to get machine from console. (error %d)"
),
rc
);
return
rc
;
#endif
/*VBOX_API_VERSION >= 5000000*/
}
static
nsresult
...
...
@@ -3414,7 +3447,25 @@ static nsresult
_consoleTakeSnapshot
(
IConsole
*
console
,
PRUnichar
*
name
,
PRUnichar
*
description
,
IProgress
**
progress
)
{
#if VBOX_API_VERSION < 5000000
return
console
->
vtbl
->
TakeSnapshot
(
console
,
name
,
description
,
progress
);
#else
IMachine
*
machine
;
nsresult
rc
;
PRUnichar
*
id
=
NULL
;
bool
bpause
=
true
;
/*NO live snapshot*/
rc
=
console
->
vtbl
->
GetMachine
(
console
,
&
machine
);
if
(
NS_SUCCEEDED
(
rc
))
rc
=
machine
->
vtbl
->
TakeSnapshot
(
machine
,
name
,
description
,
bpause
,
&
id
,
progress
);
else
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"unable to get machine from console. (error %d)"
),
rc
);
VBOX_RELEASE
(
machine
);
return
rc
;
#endif
/* VBOX_API_VERSION >= 5000000 */
}
static
nsresult
...
...
@@ -3422,9 +3473,24 @@ _consoleDeleteSnapshot(IConsole *console, vboxIIDUnion *iidu, IProgress **progre
{
#if VBOX_API_VERSION < 3001000
return
console
->
vtbl
->
DiscardSnapshot
(
console
,
IID_MEMBER
(
value
),
progress
);
#el
se
/* VBOX_API_VERSION >= 3001000 */
#el
if VBOX_API_VERSION >= 3001000 && VBOX_API_VERSION < 5000000
/* VBOX_API_VERSION >= 3001000 */
return
console
->
vtbl
->
DeleteSnapshot
(
console
,
IID_MEMBER
(
value
),
progress
);
#endif
/* VBOX_API_VERSION >= 3001000 */
#else
/* VBOX_API_VERSION >= 5000000 */
IMachine
*
machine
;
nsresult
rc
;
rc
=
console
->
vtbl
->
GetMachine
(
console
,
&
machine
);
if
(
NS_SUCCEEDED
(
rc
))
rc
=
machine
->
vtbl
->
DeleteSnapshot
(
machine
,
IID_MEMBER
(
value
),
progress
);
else
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"unable to get machine from console. (error %d)"
),
rc
);
VBOX_RELEASE
(
machine
);
return
rc
;
#endif
/* VBOX_API_VERSION >= 5000000 */
}
static
nsresult
...
...
@@ -4342,11 +4408,17 @@ _displayGetScreenResolution(IDisplay *display ATTRIBUTE_UNUSED,
#elif VBOX_API_VERSION < 4003000
return
display
->
vtbl
->
GetScreenResolution
(
display
,
screenId
,
width
,
height
,
bitsPerPixel
);
#el
se
/* VBOX_API_VERSION >= 4003000 */
#el
if VBOX_API_VERSION < 5000000
/* VBOX_API_VERSION >= 4003000 */
return
display
->
vtbl
->
GetScreenResolution
(
display
,
screenId
,
width
,
height
,
bitsPerPixel
,
xOrigin
,
yOrigin
);
#endif
/* VBOX_API_VERSION >= 4003000 */
#else
/*VBOX_API_VERSION >= 5000000 */
PRUint32
gms
;
return
display
->
vtbl
->
GetScreenResolution
(
display
,
screenId
,
width
,
height
,
bitsPerPixel
,
xOrigin
,
yOrigin
,
&
gms
);
#endif
/* VBOX_API_VERSION >= 5000000 */
}
static
nsresult
...
...
@@ -4357,10 +4429,10 @@ _displayTakeScreenShotPNGToArray(IDisplay *display ATTRIBUTE_UNUSED,
PRUint32
*
screenDataSize
ATTRIBUTE_UNUSED
,
PRUint8
**
screenData
ATTRIBUTE_UNUSED
)
{
#if VBOX_API_VERSION < 4000000
#if VBOX_API_VERSION < 4000000
|| VBOX_API_VERSION >= 5000000
vboxUnsupported
();
return
0
;
#else
/* VBOX_API_VERSION >= 4000000 */
#else
/* VBOX_API_VERSION >= 4000000
&& VBOX_API_VERSION < 5000000
*/
return
display
->
vtbl
->
TakeScreenShotPNGToArray
(
display
,
screenId
,
width
,
height
,
screenDataSize
,
screenData
);
...
...
src/vbox/vbox_uniformed_api.h
浏览文件 @
d0bef643
...
...
@@ -628,5 +628,6 @@ void vbox42InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
void
vbox42_20InstallUniformedAPI
(
vboxUniformedAPI
*
pVBoxAPI
);
void
vbox43InstallUniformedAPI
(
vboxUniformedAPI
*
pVBoxAPI
);
void
vbox43_4InstallUniformedAPI
(
vboxUniformedAPI
*
pVBoxAPI
);
void
vbox50InstallUniformedAPI
(
vboxUniformedAPI
*
pVBoxAPI
);
#endif
/* VBOX_UNIFORMED_API_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录