Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
d89f8056
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,发现更多精彩内容 >>
提交
d89f8056
编写于
7月 04, 2013
作者:
M
Michal Privoznik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adapt to VIR_ALLOC and virAsprintf in src/interface/*
上级
1f2bf483
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
15 addition
and
45 deletion
+15
-45
src/interface/interface_backend_netcf.c
src/interface/interface_backend_netcf.c
+6
-21
src/interface/interface_backend_udev.c
src/interface/interface_backend_udev.c
+9
-24
未找到文件。
src/interface/interface_backend_netcf.c
浏览文件 @
d89f8056
...
...
@@ -65,10 +65,8 @@ netcfGetMinimalDefForDevice(struct netcf_if *iface)
virInterfaceDef
*
def
;
/* Allocate our interface definition structure */
if
(
VIR_ALLOC
(
def
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC
(
def
)
<
0
)
return
NULL
;
}
if
(
VIR_STRDUP
(
def
->
name
,
ncf_if_name
(
iface
))
<
0
)
goto
cleanup
;
...
...
@@ -157,10 +155,7 @@ static virDrvOpenStatus netcfInterfaceOpen(virConnectPtr conn,
virCheckFlags
(
VIR_CONNECT_RO
,
VIR_DRV_OPEN_ERROR
);
if
(
VIR_ALLOC
(
driverState
)
<
0
)
{
virReportOOMError
();
goto
alloc_error
;
}
/* initialize non-0 stuff in driverState */
if
(
virMutexInit
(
&
driverState
->
lock
)
<
0
)
...
...
@@ -239,10 +234,8 @@ static int netcfConnectNumOfInterfacesImpl(virConnectPtr conn,
goto
cleanup
;
}
if
(
VIR_ALLOC_N
(
names
,
count
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
names
,
count
)
<
0
)
goto
cleanup
;
}
if
((
count
=
ncf_list_interfaces
(
driver
->
netcf
,
count
,
names
,
status
))
<
0
)
{
const
char
*
errmsg
,
*
details
;
...
...
@@ -332,10 +325,8 @@ static int netcfConnectListInterfacesImpl(virConnectPtr conn,
goto
cleanup
;
}
if
(
VIR_ALLOC_N
(
allnames
,
count
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
allnames
,
count
)
<
0
)
goto
cleanup
;
}
if
((
count
=
ncf_list_interfaces
(
driver
->
netcf
,
count
,
allnames
,
status
))
<
0
)
{
const
char
*
errmsg
,
*
details
;
...
...
@@ -519,10 +510,8 @@ netcfConnectListAllInterfaces(virConnectPtr conn,
goto
cleanup
;
}
if
(
VIR_ALLOC_N
(
names
,
count
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
names
,
count
)
<
0
)
goto
cleanup
;
}
if
((
count
=
ncf_list_interfaces
(
driver
->
netcf
,
count
,
names
,
NETCF_IFACE_ACTIVE
|
...
...
@@ -536,12 +525,8 @@ netcfConnectListAllInterfaces(virConnectPtr conn,
goto
cleanup
;
}
if
(
ifaces
)
{
if
(
VIR_ALLOC_N
(
tmp_iface_objs
,
count
+
1
)
<
0
)
{
virReportOOMError
();
goto
cleanup
;
}
}
if
(
ifaces
&&
VIR_ALLOC_N
(
tmp_iface_objs
,
count
+
1
)
<
0
)
goto
cleanup
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
virInterfaceDefPtr
def
;
...
...
src/interface/interface_backend_udev.c
浏览文件 @
d89f8056
...
...
@@ -73,10 +73,8 @@ udevGetMinimalDefForDevice(struct udev_device *dev)
virInterfaceDef
*
def
;
/* Allocate our interface definition structure */
if
(
VIR_ALLOC
(
def
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC
(
def
)
<
0
)
return
NULL
;
}
if
(
VIR_STRDUP
(
def
->
name
,
udev_device_get_sysname
(
dev
))
<
0
)
goto
cleanup
;
...
...
@@ -141,10 +139,8 @@ udevInterfaceOpen(virConnectPtr conn,
virCheckFlags
(
VIR_CONNECT_RO
,
VIR_DRV_OPEN_ERROR
);
if
(
VIR_ALLOC
(
driverState
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC
(
driverState
)
<
0
)
goto
cleanup
;
}
driverState
->
udev
=
udev_new
();
if
(
!
driverState
->
udev
)
{
...
...
@@ -403,12 +399,9 @@ udevConnectListAllInterfaces(virConnectPtr conn,
}
/* If we're asked for the ifaces then alloc up memory */
if
(
ifaces
)
{
if
(
VIR_ALLOC_N
(
ifaces_list
,
count
+
1
)
<
0
)
{
virReportOOMError
();
ret
=
-
1
;
goto
cleanup
;
}
if
(
ifaces
&&
VIR_ALLOC_N
(
ifaces_list
,
count
+
1
)
<
0
)
{
ret
=
-
1
;
goto
cleanup
;
}
/* Get a list we can walk */
...
...
@@ -815,10 +808,8 @@ udevGetIfaceDefBond(struct udev *udev,
}
/* Allocate our list of slave devices */
if
(
VIR_ALLOC_N
(
ifacedef
->
data
.
bond
.
itf
,
slave_count
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
ifacedef
->
data
.
bond
.
itf
,
slave_count
)
<
0
)
goto
error
;
}
ifacedef
->
data
.
bond
.
nbItf
=
slave_count
;
for
(
i
=
0
;
i
<
slave_count
;
i
++
)
{
...
...
@@ -918,10 +909,8 @@ udevGetIfaceDefBridge(struct udev *udev,
/* Members of the bridge */
if
(
virAsprintf
(
&
member_path
,
"%s/%s"
,
udev_device_get_syspath
(
dev
),
"brif"
)
<
0
)
{
virReportOOMError
();
udev_device_get_syspath
(
dev
),
"brif"
)
<
0
)
goto
error
;
}
/* Get each member of the bridge */
member_count
=
scandir
(
member_path
,
&
member_list
,
...
...
@@ -938,10 +927,8 @@ udevGetIfaceDefBridge(struct udev *udev,
}
/* Allocate our list of member devices */
if
(
VIR_ALLOC_N
(
ifacedef
->
data
.
bridge
.
itf
,
member_count
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
ifacedef
->
data
.
bridge
.
itf
,
member_count
)
<
0
)
goto
error
;
}
ifacedef
->
data
.
bridge
.
nbItf
=
member_count
;
/* Get the interface defintions for each member of the bridge */
...
...
@@ -1016,10 +1003,8 @@ udevGetIfaceDef(struct udev *udev, const char *name)
const
char
*
devtype
;
/* Allocate our interface definition structure */
if
(
VIR_ALLOC
(
ifacedef
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC
(
ifacedef
)
<
0
)
return
NULL
;
}
/* Clear our structure and set safe defaults */
ifacedef
->
startmode
=
VIR_INTERFACE_START_UNSPECIFIED
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录