Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
2e5ffb29
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,发现更多精彩内容 >>
提交
2e5ffb29
编写于
6月 19, 2014
作者:
P
Peter Krempa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
security: manager: Unify function header format
上级
5fd0b40f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
157 addition
and
91 deletion
+157
-91
src/security/security_manager.c
src/security/security_manager.c
+157
-91
未找到文件。
src/security/security_manager.c
浏览文件 @
2e5ffb29
...
...
@@ -19,10 +19,8 @@
*
* Author: Daniel P. Berrange <berrange@redhat.com>
*/
#include <config.h>
#include "security_driver.h"
#include "security_stack.h"
#include "security_dac.h"
...
...
@@ -60,7 +58,8 @@ void virSecurityManagerDispose(void *obj)
}
static
int
virSecurityManagerOnceInit
(
void
)
static
int
virSecurityManagerOnceInit
(
void
)
{
if
(
!
(
virSecurityManagerClass
=
virClassNew
(
virClassForObjectLockable
(),
"virSecurityManagerClass"
,
...
...
@@ -73,11 +72,13 @@ static int virSecurityManagerOnceInit(void)
VIR_ONCE_GLOBAL_INIT
(
virSecurityManager
);
static
virSecurityManagerPtr
virSecurityManagerNewDriver
(
virSecurityDriverPtr
drv
,
const
char
*
virtDriver
,
bool
allowDiskFormatProbing
,
bool
defaultConfined
,
bool
requireConfined
)
static
virSecurityManagerPtr
virSecurityManagerNewDriver
(
virSecurityDriverPtr
drv
,
const
char
*
virtDriver
,
bool
allowDiskFormatProbing
,
bool
defaultConfined
,
bool
requireConfined
)
{
virSecurityManagerPtr
mgr
;
char
*
privateData
;
...
...
@@ -114,7 +115,9 @@ static virSecurityManagerPtr virSecurityManagerNewDriver(virSecurityDriverPtr dr
return
mgr
;
}
virSecurityManagerPtr
virSecurityManagerNewStack
(
virSecurityManagerPtr
primary
)
virSecurityManagerPtr
virSecurityManagerNewStack
(
virSecurityManagerPtr
primary
)
{
virSecurityManagerPtr
mgr
=
virSecurityManagerNewDriver
(
&
virSecurityDriverStack
,
...
...
@@ -131,21 +134,25 @@ virSecurityManagerPtr virSecurityManagerNewStack(virSecurityManagerPtr primary)
return
mgr
;
}
int
virSecurityManagerStackAddNested
(
virSecurityManagerPtr
stack
,
virSecurityManagerPtr
nested
)
int
virSecurityManagerStackAddNested
(
virSecurityManagerPtr
stack
,
virSecurityManagerPtr
nested
)
{
if
(
!
STREQ
(
"stack"
,
stack
->
drv
->
name
))
return
-
1
;
return
virSecurityStackAddNested
(
stack
,
nested
);
}
virSecurityManagerPtr
virSecurityManagerNewDAC
(
const
char
*
virtDriver
,
uid_t
user
,
gid_t
group
,
bool
allowDiskFormatProbing
,
bool
defaultConfined
,
bool
requireConfined
,
bool
dynamicOwnership
)
virSecurityManagerPtr
virSecurityManagerNewDAC
(
const
char
*
virtDriver
,
uid_t
user
,
gid_t
group
,
bool
allowDiskFormatProbing
,
bool
defaultConfined
,
bool
requireConfined
,
bool
dynamicOwnership
)
{
virSecurityManagerPtr
mgr
=
virSecurityManagerNewDriver
(
&
virSecurityDriverDAC
,
...
...
@@ -161,16 +168,19 @@ virSecurityManagerPtr virSecurityManagerNewDAC(const char *virtDriver,
virSecurityManagerDispose
(
mgr
);
return
NULL
;
}
virSecurityDACSetDynamicOwnership
(
mgr
,
dynamicOwnership
);
return
mgr
;
}
virSecurityManagerPtr
virSecurityManagerNew
(
const
char
*
name
,
const
char
*
virtDriver
,
bool
allowDiskFormatProbing
,
bool
defaultConfined
,
bool
requireConfined
)
virSecurityManagerPtr
virSecurityManagerNew
(
const
char
*
name
,
const
char
*
virtDriver
,
bool
allowDiskFormatProbing
,
bool
defaultConfined
,
bool
requireConfined
)
{
virSecurityDriverPtr
drv
=
virSecurityDriverLookup
(
name
,
virtDriver
);
if
(
!
drv
)
...
...
@@ -211,7 +221,8 @@ virSecurityManagerPtr virSecurityManagerNew(const char *name,
* followed by a call to virSecurityManagerPostFork() in both
* parent and child.
*/
int
virSecurityManagerPreFork
(
virSecurityManagerPtr
mgr
)
int
virSecurityManagerPreFork
(
virSecurityManagerPtr
mgr
)
{
int
ret
=
0
;
...
...
@@ -230,12 +241,14 @@ int virSecurityManagerPreFork(virSecurityManagerPtr mgr)
* Must be called after fork()'ing in both parent and child
* to ensure mutex state is sane for the child to use
*/
void
virSecurityManagerPostFork
(
virSecurityManagerPtr
mgr
)
void
virSecurityManagerPostFork
(
virSecurityManagerPtr
mgr
)
{
virObjectUnlock
(
mgr
);
}
void
*
virSecurityManagerGetPrivateData
(
virSecurityManagerPtr
mgr
)
void
*
virSecurityManagerGetPrivateData
(
virSecurityManagerPtr
mgr
)
{
return
mgr
->
privateData
;
}
...
...
@@ -247,6 +260,7 @@ virSecurityManagerGetDriver(virSecurityManagerPtr mgr)
return
mgr
->
virtDriver
;
}
const
char
*
virSecurityManagerGetDOI
(
virSecurityManagerPtr
mgr
)
{
...
...
@@ -262,6 +276,7 @@ virSecurityManagerGetDOI(virSecurityManagerPtr mgr)
return
NULL
;
}
const
char
*
virSecurityManagerGetModel
(
virSecurityManagerPtr
mgr
)
{
...
...
@@ -277,9 +292,11 @@ virSecurityManagerGetModel(virSecurityManagerPtr mgr)
return
NULL
;
}
/* return NULL if a base label is not present */
const
char
*
virSecurityManagerGetBaseLabel
(
virSecurityManagerPtr
mgr
,
int
virtType
)
virSecurityManagerGetBaseLabel
(
virSecurityManagerPtr
mgr
,
int
virtType
)
{
if
(
mgr
->
drv
->
getBaseLabel
)
{
const
char
*
ret
;
...
...
@@ -292,24 +309,32 @@ virSecurityManagerGetBaseLabel(virSecurityManagerPtr mgr, int virtType)
return
NULL
;
}
bool
virSecurityManagerGetAllowDiskFormatProbing
(
virSecurityManagerPtr
mgr
)
bool
virSecurityManagerGetAllowDiskFormatProbing
(
virSecurityManagerPtr
mgr
)
{
return
mgr
->
allowDiskFormatProbing
;
}
bool
virSecurityManagerGetDefaultConfined
(
virSecurityManagerPtr
mgr
)
bool
virSecurityManagerGetDefaultConfined
(
virSecurityManagerPtr
mgr
)
{
return
mgr
->
defaultConfined
;
}
bool
virSecurityManagerGetRequireConfined
(
virSecurityManagerPtr
mgr
)
bool
virSecurityManagerGetRequireConfined
(
virSecurityManagerPtr
mgr
)
{
return
mgr
->
requireConfined
;
}
int
virSecurityManagerRestoreDiskLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
virDomainDiskDefPtr
disk
)
int
virSecurityManagerRestoreDiskLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
virDomainDiskDefPtr
disk
)
{
if
(
mgr
->
drv
->
domainRestoreSecurityDiskLabel
)
{
int
ret
;
...
...
@@ -323,8 +348,10 @@ int virSecurityManagerRestoreDiskLabel(virSecurityManagerPtr mgr,
return
-
1
;
}
int
virSecurityManagerSetDaemonSocketLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
)
int
virSecurityManagerSetDaemonSocketLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
)
{
if
(
mgr
->
drv
->
domainSetSecurityDaemonSocketLabel
)
{
int
ret
;
...
...
@@ -338,8 +365,10 @@ int virSecurityManagerSetDaemonSocketLabel(virSecurityManagerPtr mgr,
return
-
1
;
}
int
virSecurityManagerSetSocketLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
)
int
virSecurityManagerSetSocketLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
)
{
if
(
mgr
->
drv
->
domainSetSecuritySocketLabel
)
{
int
ret
;
...
...
@@ -353,8 +382,10 @@ int virSecurityManagerSetSocketLabel(virSecurityManagerPtr mgr,
return
-
1
;
}
int
virSecurityManagerClearSocketLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
)
int
virSecurityManagerClearSocketLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
)
{
if
(
mgr
->
drv
->
domainClearSecuritySocketLabel
)
{
int
ret
;
...
...
@@ -368,9 +399,11 @@ int virSecurityManagerClearSocketLabel(virSecurityManagerPtr mgr,
return
-
1
;
}
int
virSecurityManagerSetDiskLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
virDomainDiskDefPtr
disk
)
int
virSecurityManagerSetDiskLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
virDomainDiskDefPtr
disk
)
{
if
(
mgr
->
drv
->
domainSetSecurityDiskLabel
)
{
int
ret
;
...
...
@@ -384,10 +417,12 @@ int virSecurityManagerSetDiskLabel(virSecurityManagerPtr mgr,
return
-
1
;
}
int
virSecurityManagerRestoreHostdevLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
virDomainHostdevDefPtr
dev
,
const
char
*
vroot
)
int
virSecurityManagerRestoreHostdevLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
virDomainHostdevDefPtr
dev
,
const
char
*
vroot
)
{
if
(
mgr
->
drv
->
domainRestoreSecurityHostdevLabel
)
{
int
ret
;
...
...
@@ -401,10 +436,12 @@ int virSecurityManagerRestoreHostdevLabel(virSecurityManagerPtr mgr,
return
-
1
;
}
int
virSecurityManagerSetHostdevLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
virDomainHostdevDefPtr
dev
,
const
char
*
vroot
)
int
virSecurityManagerSetHostdevLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
virDomainHostdevDefPtr
dev
,
const
char
*
vroot
)
{
if
(
mgr
->
drv
->
domainSetSecurityHostdevLabel
)
{
int
ret
;
...
...
@@ -418,9 +455,11 @@ int virSecurityManagerSetHostdevLabel(virSecurityManagerPtr mgr,
return
-
1
;
}
int
virSecurityManagerSetSavedStateLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
const
char
*
savefile
)
int
virSecurityManagerSetSavedStateLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
const
char
*
savefile
)
{
if
(
mgr
->
drv
->
domainSetSavedStateLabel
)
{
int
ret
;
...
...
@@ -434,9 +473,10 @@ int virSecurityManagerSetSavedStateLabel(virSecurityManagerPtr mgr,
return
-
1
;
}
int
virSecurityManagerRestoreSavedStateLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
const
char
*
savefile
)
int
virSecurityManagerRestoreSavedStateLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
const
char
*
savefile
)
{
if
(
mgr
->
drv
->
domainRestoreSavedStateLabel
)
{
int
ret
;
...
...
@@ -450,8 +490,10 @@ int virSecurityManagerRestoreSavedStateLabel(virSecurityManagerPtr mgr,
return
-
1
;
}
int
virSecurityManagerGenLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
)
int
virSecurityManagerGenLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
)
{
int
ret
=
-
1
;
size_t
i
,
j
;
...
...
@@ -545,9 +587,11 @@ int virSecurityManagerGenLabel(virSecurityManagerPtr mgr,
return
ret
;
}
int
virSecurityManagerReserveLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
pid_t
pid
)
int
virSecurityManagerReserveLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
pid_t
pid
)
{
if
(
mgr
->
drv
->
domainReserveSecurityLabel
)
{
int
ret
;
...
...
@@ -561,8 +605,10 @@ int virSecurityManagerReserveLabel(virSecurityManagerPtr mgr,
return
-
1
;
}
int
virSecurityManagerReleaseLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
)
int
virSecurityManagerReleaseLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
)
{
if
(
mgr
->
drv
->
domainReleaseSecurityLabel
)
{
int
ret
;
...
...
@@ -576,9 +622,11 @@ int virSecurityManagerReleaseLabel(virSecurityManagerPtr mgr,
return
-
1
;
}
int
virSecurityManagerSetAllLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
const
char
*
stdin_path
)
int
virSecurityManagerSetAllLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
const
char
*
stdin_path
)
{
if
(
mgr
->
drv
->
domainSetSecurityAllLabel
)
{
int
ret
;
...
...
@@ -592,9 +640,11 @@ int virSecurityManagerSetAllLabel(virSecurityManagerPtr mgr,
return
-
1
;
}
int
virSecurityManagerRestoreAllLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
bool
migrated
)
int
virSecurityManagerRestoreAllLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
bool
migrated
)
{
if
(
mgr
->
drv
->
domainRestoreSecurityAllLabel
)
{
int
ret
;
...
...
@@ -608,10 +658,11 @@ int virSecurityManagerRestoreAllLabel(virSecurityManagerPtr mgr,
return
-
1
;
}
int
virSecurityManagerGetProcessLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
pid_t
pid
,
virSecurityLabelPtr
sec
)
int
virSecurityManagerGetProcessLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
pid_t
pid
,
virSecurityLabelPtr
sec
)
{
if
(
mgr
->
drv
->
domainGetSecurityProcessLabel
)
{
int
ret
;
...
...
@@ -625,8 +676,10 @@ int virSecurityManagerGetProcessLabel(virSecurityManagerPtr mgr,
return
-
1
;
}
int
virSecurityManagerSetProcessLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
)
int
virSecurityManagerSetProcessLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
)
{
if
(
mgr
->
drv
->
domainSetSecurityProcessLabel
)
{
int
ret
;
...
...
@@ -640,9 +693,11 @@ int virSecurityManagerSetProcessLabel(virSecurityManagerPtr mgr,
return
-
1
;
}
int
virSecurityManagerSetChildProcessLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
virCommandPtr
cmd
)
int
virSecurityManagerSetChildProcessLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
virCommandPtr
cmd
)
{
if
(
mgr
->
drv
->
domainSetSecurityChildProcessLabel
)
return
mgr
->
drv
->
domainSetSecurityChildProcessLabel
(
mgr
,
vm
,
cmd
);
...
...
@@ -651,8 +706,10 @@ int virSecurityManagerSetChildProcessLabel(virSecurityManagerPtr mgr,
return
-
1
;
}
int
virSecurityManagerVerify
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
def
)
int
virSecurityManagerVerify
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
def
)
{
virSecurityLabelDefPtr
secdef
;
...
...
@@ -679,9 +736,11 @@ int virSecurityManagerVerify(virSecurityManagerPtr mgr,
return
-
1
;
}
int
virSecurityManagerSetImageFDLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
int
fd
)
int
virSecurityManagerSetImageFDLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
int
fd
)
{
if
(
mgr
->
drv
->
domainSetSecurityImageFDLabel
)
{
int
ret
;
...
...
@@ -695,9 +754,11 @@ int virSecurityManagerSetImageFDLabel(virSecurityManagerPtr mgr,
return
-
1
;
}
int
virSecurityManagerSetTapFDLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
int
fd
)
int
virSecurityManagerSetTapFDLabel
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
int
fd
)
{
if
(
mgr
->
drv
->
domainSetSecurityTapFDLabel
)
{
int
ret
;
...
...
@@ -711,8 +772,10 @@ int virSecurityManagerSetTapFDLabel(virSecurityManagerPtr mgr,
return
-
1
;
}
char
*
virSecurityManagerGetMountOptions
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
)
char
*
virSecurityManagerGetMountOptions
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
)
{
if
(
mgr
->
drv
->
domainGetSecurityMountOptions
)
{
char
*
ret
;
...
...
@@ -726,6 +789,7 @@ char *virSecurityManagerGetMountOptions(virSecurityManagerPtr mgr,
return
NULL
;
}
virSecurityManagerPtr
*
virSecurityManagerGetNested
(
virSecurityManagerPtr
mgr
)
{
...
...
@@ -743,9 +807,11 @@ virSecurityManagerGetNested(virSecurityManagerPtr mgr)
return
list
;
}
int
virSecurityManagerSetHugepages
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
const
char
*
path
)
int
virSecurityManagerSetHugepages
(
virSecurityManagerPtr
mgr
,
virDomainDefPtr
vm
,
const
char
*
path
)
{
if
(
mgr
->
drv
->
domainSetSecurityHugepages
)
{
int
ret
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录