Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
5eb8a7ac
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看板
提交
5eb8a7ac
编写于
12月 04, 2012
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
util: Slightly refactor PCI list functions
In order to be able to steal PCI device by its index in the list.
上级
ea1a9b5f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
42 addition
and
24 deletion
+42
-24
src/libvirt_private.syms
src/libvirt_private.syms
+2
-0
src/util/pci.c
src/util/pci.c
+36
-24
src/util/pci.h
src/util/pci.h
+4
-0
未找到文件。
src/libvirt_private.syms
浏览文件 @
5eb8a7ac
...
...
@@ -1000,10 +1000,12 @@ pciDeviceListAdd;
pciDeviceListCount;
pciDeviceListDel;
pciDeviceListFind;
pciDeviceListFindIndex;
pciDeviceListFree;
pciDeviceListGet;
pciDeviceListNew;
pciDeviceListSteal;
pciDeviceListStealIndex;
pciDeviceNetName;
pciDeviceReAttachInit;
pciDeviceSetManaged;
...
...
src/util/pci.c
浏览文件 @
5eb8a7ac
...
...
@@ -1554,35 +1554,36 @@ pciDeviceListCount(pciDeviceList *list)
}
pciDevice
*
pciDeviceListSteal
(
pciDeviceList
*
list
,
pciDevice
*
dev
)
pciDeviceListSteal
Index
(
pciDeviceList
*
list
,
int
idx
)
{
pciDevice
*
ret
=
NULL
;
int
i
;
for
(
i
=
0
;
i
<
list
->
count
;
i
++
)
{
if
(
list
->
devs
[
i
]
->
domain
!=
dev
->
domain
||
list
->
devs
[
i
]
->
bus
!=
dev
->
bus
||
list
->
devs
[
i
]
->
slot
!=
dev
->
slot
||
list
->
devs
[
i
]
->
function
!=
dev
->
function
)
continue
;
pciDevice
*
ret
;
ret
=
list
->
devs
[
i
];
if
(
idx
<
0
||
idx
>=
list
->
count
)
return
NULL
;
if
(
i
!=
--
list
->
count
)
memmove
(
&
list
->
devs
[
i
],
&
list
->
devs
[
i
+
1
],
sizeof
(
*
list
->
devs
)
*
(
list
->
count
-
i
));
ret
=
list
->
devs
[
idx
];
if
(
VIR_REALLOC_N
(
list
->
devs
,
list
->
count
)
<
0
)
{
;
/* not fatal */
}
if
(
idx
!=
--
list
->
count
)
{
memmove
(
&
list
->
devs
[
idx
],
&
list
->
devs
[
idx
+
1
],
sizeof
(
*
list
->
devs
)
*
(
list
->
count
-
idx
));
}
break
;
if
(
VIR_REALLOC_N
(
list
->
devs
,
list
->
count
)
<
0
)
{
;
/* not fatal */
}
return
ret
;
}
pciDevice
*
pciDeviceListSteal
(
pciDeviceList
*
list
,
pciDevice
*
dev
)
{
return
pciDeviceListStealIndex
(
list
,
pciDeviceListFindIndex
(
list
,
dev
));
}
void
pciDeviceListDel
(
pciDeviceList
*
list
,
pciDevice
*
dev
)
...
...
@@ -1592,8 +1593,8 @@ pciDeviceListDel(pciDeviceList *list,
pciFreeDevice
(
ret
);
}
pciDevice
*
pciDeviceListFind
(
pciDeviceList
*
list
,
pciDevice
*
dev
)
int
pciDeviceListFind
Index
(
pciDeviceList
*
list
,
pciDevice
*
dev
)
{
int
i
;
...
...
@@ -1602,8 +1603,19 @@ pciDeviceListFind(pciDeviceList *list, pciDevice *dev)
list
->
devs
[
i
]
->
bus
==
dev
->
bus
&&
list
->
devs
[
i
]
->
slot
==
dev
->
slot
&&
list
->
devs
[
i
]
->
function
==
dev
->
function
)
return
list
->
devs
[
i
];
return
NULL
;
return
i
;
return
-
1
;
}
pciDevice
*
pciDeviceListFind
(
pciDeviceList
*
list
,
pciDevice
*
dev
)
{
int
i
;
if
((
i
=
pciDeviceListFindIndex
(
list
,
dev
))
>=
0
)
return
list
->
devs
[
i
];
else
return
NULL
;
}
...
...
src/util/pci.h
浏览文件 @
5eb8a7ac
...
...
@@ -75,10 +75,14 @@ pciDevice * pciDeviceListGet (pciDeviceList *list,
int
pciDeviceListCount
(
pciDeviceList
*
list
);
pciDevice
*
pciDeviceListSteal
(
pciDeviceList
*
list
,
pciDevice
*
dev
);
pciDevice
*
pciDeviceListStealIndex
(
pciDeviceList
*
list
,
int
idx
);
void
pciDeviceListDel
(
pciDeviceList
*
list
,
pciDevice
*
dev
);
pciDevice
*
pciDeviceListFind
(
pciDeviceList
*
list
,
pciDevice
*
dev
);
int
pciDeviceListFindIndex
(
pciDeviceList
*
list
,
pciDevice
*
dev
);
/*
* Callback that will be invoked once for each file
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录