Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
a96d7f3c
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,发现更多精彩内容 >>
提交
a96d7f3c
编写于
5月 03, 2013
作者:
M
Michal Privoznik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adapt to VIR_STRDUP and VIR_STRNDUP in src/lxc/*
上级
f75ed996
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
36 addition
and
57 deletion
+36
-57
src/lxc/lxc_cgroup.c
src/lxc/lxc_cgroup.c
+1
-2
src/lxc/lxc_conf.c
src/lxc/lxc_conf.c
+17
-19
src/lxc/lxc_container.c
src/lxc/lxc_container.c
+4
-14
src/lxc/lxc_controller.c
src/lxc/lxc_controller.c
+8
-12
src/lxc/lxc_driver.c
src/lxc/lxc_driver.c
+2
-7
src/lxc/lxc_process.c
src/lxc/lxc_process.c
+4
-3
未找到文件。
src/lxc/lxc_cgroup.c
浏览文件 @
a96d7f3c
...
...
@@ -538,8 +538,7 @@ virCgroupPtr virLXCCgroupCreate(virDomainDefPtr def, bool startup)
goto
cleanup
;
}
if
(
!
(
res
->
partition
=
strdup
(
"/machine"
)))
{
virReportOOMError
();
if
(
VIR_STRDUP
(
res
->
partition
,
"/machine"
)
<
0
)
{
VIR_FREE
(
res
);
goto
cleanup
;
}
...
...
src/lxc/lxc_conf.c
浏览文件 @
a96d7f3c
...
...
@@ -37,7 +37,7 @@
#include "configmake.h"
#include "lxc_container.h"
#include "virnodesuspend.h"
#include "virstring.h"
#define VIR_FROM_THIS VIR_FROM_LXC
...
...
@@ -119,10 +119,10 @@ virCapsPtr lxcCapsInit(virLXCDriverPtr driver)
if
(
VIR_ALLOC
(
caps
->
host
.
secModels
)
<
0
)
goto
no_memory
;
caps
->
host
.
nsecModels
=
1
;
if
(
!
(
caps
->
host
.
secModels
[
0
].
model
=
strdup
(
model
))
)
goto
no_memory
;
if
(
!
(
caps
->
host
.
secModels
[
0
].
doi
=
strdup
(
doi
))
)
goto
no_memory
;
if
(
VIR_STRDUP
(
caps
->
host
.
secModels
[
0
].
model
,
model
)
<
0
)
goto
error
;
if
(
VIR_STRDUP
(
caps
->
host
.
secModels
[
0
].
doi
,
doi
)
<
0
)
goto
error
;
}
VIR_DEBUG
(
"Initialized caps for security driver
\"
%s
\"
with "
...
...
@@ -161,18 +161,18 @@ int lxcLoadDriverConfig(virLXCDriverPtr driver)
driver
->
securityRequireConfined
=
false
;
/* Set the container configuration directory */
if
(
(
driver
->
configDir
=
strdup
(
LXC_CONFIG_DIR
))
==
NULL
)
goto
no_memory
;
if
(
(
driver
->
stateDir
=
strdup
(
LXC_STATE_DIR
))
==
NULL
)
goto
no_memory
;
if
(
(
driver
->
logDir
=
strdup
(
LXC_LOG_DIR
))
==
NULL
)
goto
no_memory
;
if
(
(
driver
->
autostartDir
=
strdup
(
LXC_AUTOSTART_DIR
))
==
NULL
)
goto
no_memory
;
if
(
VIR_STRDUP
(
driver
->
configDir
,
LXC_CONFIG_DIR
)
<
0
)
goto
error
;
if
(
VIR_STRDUP
(
driver
->
stateDir
,
LXC_STATE_DIR
)
<
0
)
goto
error
;
if
(
VIR_STRDUP
(
driver
->
logDir
,
LXC_LOG_DIR
)
<
0
)
goto
error
;
if
(
VIR_STRDUP
(
driver
->
autostartDir
,
LXC_AUTOSTART_DIR
)
<
0
)
goto
error
;
if
(
(
filename
=
strdup
(
SYSCONFDIR
"/libvirt/lxc.conf"
))
==
NULL
)
goto
no_memory
;
if
(
VIR_STRDUP
(
filename
,
SYSCONFDIR
"/libvirt/lxc.conf"
)
<
0
)
goto
error
;
/* Avoid error from non-existant or unreadable file. */
if
(
access
(
filename
,
R_OK
)
==
-
1
)
...
...
@@ -196,8 +196,7 @@ int lxcLoadDriverConfig(virLXCDriverPtr driver)
p
=
virConfGetValue
(
conf
,
"security_driver"
);
CHECK_TYPE
(
"security_driver"
,
VIR_CONF_STRING
);
if
(
p
&&
p
->
str
)
{
if
(
!
(
driver
->
securityDriverName
=
strdup
(
p
->
str
)))
{
virReportOOMError
();
if
(
VIR_STRDUP
(
driver
->
securityDriverName
,
p
->
str
)
<
0
)
{
virConfFree
(
conf
);
return
-
1
;
}
...
...
@@ -220,7 +219,6 @@ done:
VIR_FREE
(
filename
);
return
0
;
no_memory:
virReportOOMError
();
error:
return
-
1
;
}
src/lxc/lxc_container.c
浏览文件 @
a96d7f3c
...
...
@@ -439,10 +439,8 @@ static int lxcContainerGetSubtree(const char *prefix,
virReportOOMError
();
goto
cleanup
;
}
if
(
!
(
mounts
[
nmounts
]
=
strdup
(
mntent
.
mnt_dir
)))
{
virReportOOMError
();
if
(
VIR_STRDUP
(
mounts
[
nmounts
],
mntent
.
mnt_dir
)
<
0
)
goto
cleanup
;
}
nmounts
++
;
VIR_DEBUG
(
"Grabbed %s"
,
mntent
.
mnt_dir
);
}
...
...
@@ -1041,10 +1039,8 @@ lxcContainerMountDetectFilesystem(const char *src, char **type)
goto
cleanup
;
}
if
(
!
(
*
type
=
strdup
(
data
)))
{
virReportOOMError
();
if
(
VIR_STRDUP
(
*
type
,
data
)
<
0
)
goto
cleanup
;
}
done:
ret
=
0
;
...
...
@@ -1952,17 +1948,11 @@ static int lxcContainerChild(void *data)
virReportOOMError
();
goto
cleanup
;
}
}
else
{
if
(
!
(
ttyPath
=
strdup
(
argv
->
ttyPaths
[
0
])))
{
virReportOOMError
();
}
else
if
(
VIR_STRDUP
(
ttyPath
,
argv
->
ttyPaths
[
0
])
<
0
)
{
goto
cleanup
;
}
}
}
else
{
if
(
!
(
ttyPath
=
strdup
(
"/dev/null"
)))
{
virReportOOMError
();
}
else
if
(
VIR_STRDUP
(
ttyPath
,
"/dev/null"
)
<
0
)
{
goto
cleanup
;
}
}
VIR_DEBUG
(
"Container TTY path: %s"
,
ttyPath
);
...
...
src/lxc/lxc_controller.c
浏览文件 @
a96d7f3c
...
...
@@ -150,14 +150,16 @@ static virLXCControllerPtr virLXCControllerNew(const char *name)
virDomainXMLOptionPtr
xmlopt
=
NULL
;
char
*
configFile
=
NULL
;
if
(
VIR_ALLOC
(
ctrl
)
<
0
)
goto
no_memory
;
if
(
VIR_ALLOC
(
ctrl
)
<
0
)
{
virReportOOMError
();
goto
error
;
}
ctrl
->
timerShutdown
=
-
1
;
ctrl
->
firstClient
=
true
;
if
(
!
(
ctrl
->
name
=
strdup
(
name
))
)
goto
no_memory
;
if
(
VIR_STRDUP
(
ctrl
->
name
,
name
)
<
0
)
goto
error
;
if
((
caps
=
lxcCapsInit
(
NULL
))
==
NULL
)
goto
error
;
...
...
@@ -186,8 +188,6 @@ cleanup:
virObjectUnref
(
xmlopt
);
return
ctrl
;
no_memory:
virReportOOMError
();
error:
virLXCControllerFree
(
ctrl
);
ctrl
=
NULL
;
...
...
@@ -1566,10 +1566,8 @@ int main(int argc, char *argv[])
break
;
case
'n'
:
if
((
name
=
strdup
(
optarg
))
==
NULL
)
{
virReportOOMError
();
if
(
VIR_STRDUP
(
name
,
optarg
)
<
0
)
goto
cleanup
;
}
break
;
case
'v'
:
...
...
@@ -1577,10 +1575,8 @@ int main(int argc, char *argv[])
virReportOOMError
();
goto
cleanup
;
}
if
((
veths
[
nveths
++
]
=
strdup
(
optarg
))
==
NULL
)
{
virReportOOMError
();
if
(
VIR_STRDUP
(
veths
[
nveths
++
],
optarg
)
<
0
)
goto
cleanup
;
}
break
;
case
'c'
:
...
...
src/lxc/lxc_driver.c
浏览文件 @
a96d7f3c
...
...
@@ -626,10 +626,7 @@ static char *lxcDomainGetOSType(virDomainPtr dom)
goto
cleanup
;
}
ret
=
strdup
(
vm
->
def
->
os
.
type
);
if
(
ret
==
NULL
)
virReportOOMError
();
ignore_value
(
VIR_STRDUP
(
ret
,
vm
->
def
->
os
.
type
));
cleanup:
if
(
vm
)
...
...
@@ -1636,9 +1633,7 @@ static char *lxcDomainGetSchedulerType(virDomainPtr dom,
*
nparams
=
3
;
}
ret
=
strdup
(
"posix"
);
if
(
!
ret
)
virReportOOMError
();
ignore_value
(
VIR_STRDUP
(
ret
,
"posix"
));
cleanup:
if
(
vm
)
...
...
src/lxc/lxc_process.c
浏览文件 @
a96d7f3c
...
...
@@ -996,9 +996,9 @@ virLXCProcessEnsureRootFS(virDomainObjPtr vm)
root
->
type
=
VIR_DOMAIN_FS_TYPE_MOUNT
;
if
(
!
(
root
->
src
=
strdup
(
"/"
))
||
!
(
root
->
dst
=
strdup
(
"/"
))
)
goto
no_memory
;
if
(
VIR_STRDUP
(
root
->
src
,
"/"
)
<
0
||
VIR_STRDUP
(
root
->
dst
,
"/"
)
<
0
)
goto
error
;
if
(
VIR_INSERT_ELEMENT
(
vm
->
def
->
fss
,
0
,
...
...
@@ -1010,6 +1010,7 @@ virLXCProcessEnsureRootFS(virDomainObjPtr vm)
no_memory:
virReportOOMError
();
error:
virDomainFSDefFree
(
root
);
return
-
1
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录