Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
82513be8
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看板
提交
82513be8
编写于
8月 11, 2014
作者:
T
Taowei
提交者:
Michal Privoznik
8月 15, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vbox: Rewrite vboxConnectGetMaxVcpus
上级
427931ae
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
51 addition
and
24 deletion
+51
-24
src/vbox/vbox_common.c
src/vbox/vbox_common.c
+24
-0
src/vbox/vbox_common.h
src/vbox/vbox_common.h
+1
-0
src/vbox/vbox_tmpl.c
src/vbox/vbox_tmpl.c
+18
-24
src/vbox/vbox_uniformed_api.h
src/vbox/vbox_uniformed_api.h
+8
-0
未找到文件。
src/vbox/vbox_common.c
浏览文件 @
82513be8
...
...
@@ -439,3 +439,27 @@ int vboxConnectIsAlive(virConnectPtr conn ATTRIBUTE_UNUSED)
{
return
1
;
}
int
vboxConnectGetMaxVcpus
(
virConnectPtr
conn
,
const
char
*
type
ATTRIBUTE_UNUSED
)
{
VBOX_OBJECT_CHECK
(
conn
,
int
,
-
1
);
PRUint32
maxCPUCount
=
0
;
/* VirtualBox Supports only hvm and thus the type passed to it
* has no meaning, setting it to ATTRIBUTE_UNUSED
*/
ISystemProperties
*
systemProperties
=
NULL
;
gVBoxAPI
.
UIVirtualBox
.
GetSystemProperties
(
data
->
vboxObj
,
&
systemProperties
);
if
(
!
systemProperties
)
goto
cleanup
;
gVBoxAPI
.
UISystemProperties
.
GetMaxGuestCPUCount
(
systemProperties
,
&
maxCPUCount
);
if
(
maxCPUCount
>
0
)
ret
=
maxCPUCount
;
cleanup:
VBOX_RELEASE
(
systemProperties
);
return
ret
;
}
src/vbox/vbox_common.h
浏览文件 @
82513be8
...
...
@@ -167,5 +167,6 @@ typedef nsISupports ISession;
typedef
nsISupports
IConsole
;
typedef
nsISupports
IProgress
;
typedef
nsISupports
IMachine
;
typedef
nsISupports
ISystemProperties
;
#endif
/* VBOX_COMMON_H */
src/vbox/vbox_tmpl.c
浏览文件 @
82513be8
...
...
@@ -914,30 +914,6 @@ vboxSocketParseAddrUtf16(vboxGlobalData *data, const PRUnichar *utf16,
return
result
;
}
static
int
vboxConnectGetMaxVcpus
(
virConnectPtr
conn
,
const
char
*
type
ATTRIBUTE_UNUSED
)
{
VBOX_OBJECT_CHECK
(
conn
,
int
,
-
1
);
PRUint32
maxCPUCount
=
0
;
/* VirtualBox Supports only hvm and thus the type passed to it
* has no meaning, setting it to ATTRIBUTE_UNUSED
*/
ISystemProperties
*
systemProperties
=
NULL
;
data
->
vboxObj
->
vtbl
->
GetSystemProperties
(
data
->
vboxObj
,
&
systemProperties
);
if
(
systemProperties
)
{
systemProperties
->
vtbl
->
GetMaxGuestCPUCount
(
systemProperties
,
&
maxCPUCount
);
VBOX_RELEASE
(
systemProperties
);
}
if
(
maxCPUCount
>
0
)
ret
=
maxCPUCount
;
return
ret
;
}
static
char
*
vboxConnectGetCapabilities
(
virConnectPtr
conn
)
{
VBOX_OBJECT_CHECK
(
conn
,
char
*
,
NULL
);
...
...
@@ -11346,6 +11322,12 @@ _virtualboxGetMachine(IVirtualBox *vboxObj, vboxIIDUnion *iidu, IMachine **machi
#endif
/* VBOX_API_VERSION >= 4000000 */
static
nsresult
_virtualboxGetSystemProperties
(
IVirtualBox
*
vboxObj
,
ISystemProperties
**
systemProperties
)
{
return
vboxObj
->
vtbl
->
GetSystemProperties
(
vboxObj
,
systemProperties
);
}
#if VBOX_API_VERSION < 4000000
static
nsresult
...
...
@@ -11404,6 +11386,12 @@ _progressGetResultCode(IProgress *progress, resultCodeUnion *resultCode)
#endif
/* VBOX_API_VERSION != 2002000 */
}
static
nsresult
_systemPropertiesGetMaxGuestCPUCount
(
ISystemProperties
*
systemProperties
,
PRUint32
*
maxCPUCount
)
{
return
systemProperties
->
vtbl
->
GetMaxGuestCPUCount
(
systemProperties
,
maxCPUCount
);
}
static
vboxUniformedPFN
_UPFN
=
{
.
Initialize
=
_pfnInitialize
,
.
Uninitialize
=
_pfnUninitialize
,
...
...
@@ -11431,6 +11419,7 @@ static vboxUniformednsISupports _nsUISupports = {
static
vboxUniformedIVirtualBox
_UIVirtualBox
=
{
.
GetVersion
=
_virtualboxGetVersion
,
.
GetMachine
=
_virtualboxGetMachine
,
.
GetSystemProperties
=
_virtualboxGetSystemProperties
,
};
static
vboxUniformedISession
_UISession
=
{
...
...
@@ -11448,6 +11437,10 @@ static vboxUniformedIProgress _UIProgress = {
.
GetResultCode
=
_progressGetResultCode
,
};
static
vboxUniformedISystemProperties
_UISystemProperties
=
{
.
GetMaxGuestCPUCount
=
_systemPropertiesGetMaxGuestCPUCount
,
};
void
NAME
(
InstallUniformedAPI
)(
vboxUniformedAPI
*
pVBoxAPI
)
{
pVBoxAPI
->
APIVersion
=
VBOX_API_VERSION
;
...
...
@@ -11461,6 +11454,7 @@ void NAME(InstallUniformedAPI)(vboxUniformedAPI *pVBoxAPI)
pVBoxAPI
->
UISession
=
_UISession
;
pVBoxAPI
->
UIConsole
=
_UIConsole
;
pVBoxAPI
->
UIProgress
=
_UIProgress
;
pVBoxAPI
->
UISystemProperties
=
_UISystemProperties
;
#if VBOX_API_VERSION <= 2002000 || VBOX_API_VERSION >= 4000000
pVBoxAPI
->
domainEventCallbacks
=
0
;
...
...
src/vbox/vbox_uniformed_api.h
浏览文件 @
82513be8
...
...
@@ -171,6 +171,7 @@ typedef struct {
typedef
struct
{
nsresult
(
*
GetVersion
)(
IVirtualBox
*
vboxObj
,
PRUnichar
**
versionUtf16
);
nsresult
(
*
GetMachine
)(
IVirtualBox
*
vboxObj
,
vboxIIDUnion
*
iidu
,
IMachine
**
machine
);
nsresult
(
*
GetSystemProperties
)(
IVirtualBox
*
vboxObj
,
ISystemProperties
**
systemProperties
);
}
vboxUniformedIVirtualBox
;
/* Functions for ISession */
...
...
@@ -191,6 +192,11 @@ typedef struct {
nsresult
(
*
GetResultCode
)(
IProgress
*
progress
,
resultCodeUnion
*
resultCode
);
}
vboxUniformedIProgress
;
/* Functions for ISystemProperties */
typedef
struct
{
nsresult
(
*
GetMaxGuestCPUCount
)(
ISystemProperties
*
systemProperties
,
PRUint32
*
maxCPUCount
);
}
vboxUniformedISystemProperties
;
typedef
struct
{
/* vbox API version */
uint32_t
APIVersion
;
...
...
@@ -205,6 +211,7 @@ typedef struct {
vboxUniformedISession
UISession
;
vboxUniformedIConsole
UIConsole
;
vboxUniformedIProgress
UIProgress
;
vboxUniformedISystemProperties
UISystemProperties
;
/* vbox API features */
bool
domainEventCallbacks
;
bool
hasStaticGlobalData
;
...
...
@@ -225,6 +232,7 @@ char *vboxConnectGetHostname(virConnectPtr conn);
int
vboxConnectIsSecure
(
virConnectPtr
conn
);
int
vboxConnectIsEncrypted
(
virConnectPtr
conn
);
int
vboxConnectIsAlive
(
virConnectPtr
conn
);
int
vboxConnectGetMaxVcpus
(
virConnectPtr
conn
,
const
char
*
type
);
/* Version specified functions for installing uniformed API */
void
vbox22InstallUniformedAPI
(
vboxUniformedAPI
*
pVBoxAPI
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录