Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
7becc462
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看板
提交
7becc462
编写于
3月 06, 2014
作者:
C
Chunyan Liu
提交者:
Daniel P. Berrange
3月 12, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add parameter checks/annotations to hostdev APIs
Mark many parameters as NONNULL and check for empty list of hostdevs.
上级
e991b09d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
58 addition
and
15 deletion
+58
-15
src/util/virhostdev.c
src/util/virhostdev.c
+27
-0
src/util/virhostdev.h
src/util/virhostdev.h
+31
-15
未找到文件。
src/util/virhostdev.c
浏览文件 @
7becc462
...
...
@@ -465,6 +465,9 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
size_t
i
;
int
ret
=
-
1
;
if
(
!
nhostdevs
)
return
0
;
virObjectLock
(
hostdev_mgr
->
activePCIHostdevs
);
virObjectLock
(
hostdev_mgr
->
inactivePCIHostdevs
);
...
...
@@ -699,6 +702,9 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
virPCIDeviceListPtr
pcidevs
;
size_t
i
;
if
(
!
nhostdevs
)
return
;
virObjectLock
(
hostdev_mgr
->
activePCIHostdevs
);
virObjectLock
(
hostdev_mgr
->
inactivePCIHostdevs
);
...
...
@@ -786,6 +792,9 @@ virHostdevUpdateActivePCIDevices(virHostdevManagerPtr mgr,
size_t
i
;
int
ret
=
-
1
;
if
(
!
nhostdevs
)
return
0
;
virObjectLock
(
mgr
->
activePCIHostdevs
);
virObjectLock
(
mgr
->
inactivePCIHostdevs
);
...
...
@@ -846,6 +855,9 @@ virHostdevUpdateActiveUSBDevices(virHostdevManagerPtr mgr,
size_t
i
;
int
ret
=
-
1
;
if
(
!
nhostdevs
)
return
0
;
virObjectLock
(
mgr
->
activeUSBHostdevs
);
for
(
i
=
0
;
i
<
nhostdevs
;
i
++
)
{
virUSBDevicePtr
usb
=
NULL
;
...
...
@@ -893,6 +905,9 @@ virHostdevUpdateActiveSCSIDevices(virHostdevManagerPtr mgr,
virSCSIDevicePtr
scsi
=
NULL
;
virSCSIDevicePtr
tmp
=
NULL
;
if
(
!
nhostdevs
)
return
0
;
virObjectLock
(
mgr
->
activeSCSIHostdevs
);
for
(
i
=
0
;
i
<
nhostdevs
;
i
++
)
{
hostdev
=
hostdevs
[
i
];
...
...
@@ -1091,6 +1106,9 @@ virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr,
virUSBDevicePtr
tmp
;
bool
coldBoot
=
!!
(
flags
&
VIR_HOSTDEV_COLD_BOOT
);
if
(
!
nhostdevs
)
return
0
;
/* To prevent situation where USB device is assigned to two domains
* we need to keep a list of currently assigned USB devices.
* This is done in several loops which cannot be joined into one big
...
...
@@ -1160,6 +1178,9 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
virSCSIDeviceListPtr
list
;
virSCSIDevicePtr
tmp
;
if
(
!
nhostdevs
)
return
0
;
/* To prevent situation where SCSI device is assigned to two domains
* we need to keep a list of currently assigned SCSI devices.
* This is done in several loops which cannot be joined into one big
...
...
@@ -1268,6 +1289,9 @@ virHostdevReAttachUSBDevices(virHostdevManagerPtr hostdev_mgr,
{
size_t
i
;
if
(
!
nhostdevs
)
return
;
virObjectLock
(
hostdev_mgr
->
activeUSBHostdevs
);
for
(
i
=
0
;
i
<
nhostdevs
;
i
++
)
{
virDomainHostdevDefPtr
hostdev
=
hostdevs
[
i
];
...
...
@@ -1334,6 +1358,9 @@ virHostdevReAttachSCSIDevices(virHostdevManagerPtr hostdev_mgr,
{
size_t
i
;
if
(
!
nhostdevs
)
return
;
virObjectLock
(
hostdev_mgr
->
activeSCSIHostdevs
);
for
(
i
=
0
;
i
<
nhostdevs
;
i
++
)
{
virDomainHostdevDefPtr
hostdev
=
hostdevs
[
i
];
...
...
src/util/virhostdev.h
浏览文件 @
7becc462
...
...
@@ -61,80 +61,96 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
const
unsigned
char
*
uuid
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
,
unsigned
int
flags
);
unsigned
int
flags
)
ATTRIBUTE_NONNULL
(
1
)
ATTRIBUTE_NONNULL
(
2
)
ATTRIBUTE_NONNULL
(
3
)
ATTRIBUTE_NONNULL
(
4
);
int
virHostdevPrepareUSBDevices
(
virHostdevManagerPtr
hostdev_mgr
,
const
char
*
drv_name
,
const
char
*
dom_name
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
,
unsigned
int
flags
);
unsigned
int
flags
)
ATTRIBUTE_NONNULL
(
1
)
ATTRIBUTE_NONNULL
(
2
)
ATTRIBUTE_NONNULL
(
3
);
int
virHostdevPrepareSCSIDevices
(
virHostdevManagerPtr
hostdev_mgr
,
const
char
*
drv_name
,
const
char
*
dom_name
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
);
int
nhostdevs
)
ATTRIBUTE_NONNULL
(
1
)
ATTRIBUTE_NONNULL
(
2
)
ATTRIBUTE_NONNULL
(
3
);
void
virHostdevReAttachPCIDevices
(
virHostdevManagerPtr
hostdev_mgr
,
const
char
*
drv_name
,
const
char
*
dom_name
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
,
const
char
*
oldStateDir
);
const
char
*
oldStateDir
)
ATTRIBUTE_NONNULL
(
1
)
ATTRIBUTE_NONNULL
(
2
)
ATTRIBUTE_NONNULL
(
3
);
void
virHostdevReAttachUSBDevices
(
virHostdevManagerPtr
hostdev_mgr
,
const
char
*
drv_name
,
const
char
*
dom_name
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
);
int
nhostdevs
)
ATTRIBUTE_NONNULL
(
1
)
ATTRIBUTE_NONNULL
(
2
)
ATTRIBUTE_NONNULL
(
3
);
void
virHostdevReAttachSCSIDevices
(
virHostdevManagerPtr
hostdev_mgr
,
const
char
*
drv_name
,
const
char
*
dom_name
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
);
int
nhostdevs
)
ATTRIBUTE_NONNULL
(
1
)
ATTRIBUTE_NONNULL
(
2
)
ATTRIBUTE_NONNULL
(
3
);
int
virHostdevUpdateActivePCIDevices
(
virHostdevManagerPtr
mgr
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
,
const
char
*
drv_name
,
const
char
*
dom_name
);
const
char
*
dom_name
)
ATTRIBUTE_NONNULL
(
1
)
ATTRIBUTE_NONNULL
(
4
)
ATTRIBUTE_NONNULL
(
5
);
int
virHostdevUpdateActiveUSBDevices
(
virHostdevManagerPtr
mgr
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
,
const
char
*
drv_name
,
const
char
*
dom_name
);
const
char
*
dom_name
)
ATTRIBUTE_NONNULL
(
1
)
ATTRIBUTE_NONNULL
(
4
)
ATTRIBUTE_NONNULL
(
5
);
int
virHostdevUpdateActiveSCSIDevices
(
virHostdevManagerPtr
mgr
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
,
const
char
*
drv_name
,
const
char
*
dom_name
);
const
char
*
dom_name
)
ATTRIBUTE_NONNULL
(
1
)
ATTRIBUTE_NONNULL
(
4
)
ATTRIBUTE_NONNULL
(
5
);
int
virHostdevUpdateDomainActiveDevices
(
virHostdevManagerPtr
mgr
,
const
char
*
driver
,
virDomainDefPtr
def
,
unsigned
int
flags
);
unsigned
int
flags
)
ATTRIBUTE_NONNULL
(
1
)
ATTRIBUTE_NONNULL
(
2
)
ATTRIBUTE_NONNULL
(
3
);
int
virHostdevPrepareDomainDevices
(
virHostdevManagerPtr
mgr
,
const
char
*
driver
,
virDomainDefPtr
def
,
unsigned
int
flags
);
unsigned
int
flags
)
ATTRIBUTE_NONNULL
(
1
)
ATTRIBUTE_NONNULL
(
2
)
ATTRIBUTE_NONNULL
(
3
);
void
virHostdevReAttachDomainDevices
(
virHostdevManagerPtr
mgr
,
const
char
*
driver
,
virDomainDefPtr
def
,
unsigned
int
flags
,
const
char
*
oldStateDir
);
const
char
*
oldStateDir
)
ATTRIBUTE_NONNULL
(
1
)
ATTRIBUTE_NONNULL
(
2
)
ATTRIBUTE_NONNULL
(
3
)
ATTRIBUTE_NONNULL
(
5
);
/* functions used by NodeDevDetach/Reattach/Reset */
int
virHostdevPCINodeDeviceDetach
(
virHostdevManagerPtr
mgr
,
virPCIDevicePtr
pci
);
virPCIDevicePtr
pci
)
ATTRIBUTE_NONNULL
(
1
)
ATTRIBUTE_NONNULL
(
2
);
int
virHostdevPCINodeDeviceReAttach
(
virHostdevManagerPtr
mgr
,
virPCIDevicePtr
pci
);
virPCIDevicePtr
pci
)
ATTRIBUTE_NONNULL
(
1
)
ATTRIBUTE_NONNULL
(
2
);
int
virHostdevPCINodeDeviceReset
(
virHostdevManagerPtr
mgr
,
virPCIDevicePtr
pci
);
virPCIDevicePtr
pci
)
ATTRIBUTE_NONNULL
(
1
)
ATTRIBUTE_NONNULL
(
2
);
#endif
/* __VIR_HOSTDEV_H__ */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录