Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
ce17ddac
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,发现更多精彩内容 >>
提交
ce17ddac
编写于
3月 07, 2014
作者:
M
Michal Privoznik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
src/xen: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
Signed-off-by:
N
Michal Privoznik
<
mprivozn@redhat.com
>
上级
fb9bec10
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
11 addition
and
62 deletion
+11
-62
src/xen/xen_driver.c
src/xen/xen_driver.c
+2
-17
src/xen/xen_driver.h
src/xen/xen_driver.h
+1
-1
src/xen/xen_inotify.c
src/xen/xen_inotify.c
+2
-11
src/xen/xm_internal.c
src/xen/xm_internal.c
+3
-15
src/xen/xs_internal.c
src/xen/xs_internal.c
+2
-17
src/xen/xs_internal.h
src/xen/xs_internal.h
+1
-1
未找到文件。
src/xen/xen_driver.c
浏览文件 @
ce17ddac
...
...
@@ -2879,13 +2879,9 @@ xenUnifiedAddDomainInfo(xenUnifiedDomainInfoListPtr list,
info
->
id
=
id
;
/* Make space on list */
n
=
list
->
count
;
if
(
VIR_REALLOC_N
(
list
->
doms
,
n
+
1
)
<
0
)
{
if
(
VIR_APPEND_ELEMENT
(
list
->
doms
,
list
->
count
,
info
)
<
0
)
goto
error
;
}
list
->
doms
[
n
]
=
info
;
list
->
count
++
;
return
0
;
error:
if
(
info
)
...
...
@@ -2915,18 +2911,7 @@ xenUnifiedRemoveDomainInfo(xenUnifiedDomainInfoListPtr list,
VIR_FREE
(
list
->
doms
[
i
]
->
name
);
VIR_FREE
(
list
->
doms
[
i
]);
if
(
i
<
(
list
->
count
-
1
))
memmove
(
list
->
doms
+
i
,
list
->
doms
+
i
+
1
,
sizeof
(
*
(
list
->
doms
))
*
(
list
->
count
-
(
i
+
1
)));
if
(
VIR_REALLOC_N
(
list
->
doms
,
list
->
count
-
1
)
<
0
)
{
;
/* Failure to reduce memory allocation isn't fatal */
}
list
->
count
--
;
VIR_DELETE_ELEMENT
(
list
->
doms
,
i
,
list
->
count
);
return
0
;
}
}
...
...
src/xen/xen_driver.h
浏览文件 @
ce17ddac
...
...
@@ -104,7 +104,7 @@ typedef struct _xenUnifiedDomainInfo xenUnifiedDomainInfo;
typedef
xenUnifiedDomainInfo
*
xenUnifiedDomainInfoPtr
;
struct
_xenUnifiedDomainInfoList
{
unsigned
in
t
count
;
size_
t
count
;
xenUnifiedDomainInfoPtr
*
doms
;
};
typedef
struct
_xenUnifiedDomainInfoList
xenUnifiedDomainInfoList
;
...
...
src/xen/xen_inotify.c
浏览文件 @
ce17ddac
...
...
@@ -173,17 +173,8 @@ xenInotifyXendDomainsDirRemoveEntry(virConnectPtr conn, const char *fname)
VIR_FREE
(
priv
->
configInfoList
->
doms
[
i
]
->
name
);
VIR_FREE
(
priv
->
configInfoList
->
doms
[
i
]);
if
(
i
<
(
priv
->
configInfoList
->
count
-
1
))
memmove
(
priv
->
configInfoList
->
doms
+
i
,
priv
->
configInfoList
->
doms
+
i
+
1
,
sizeof
(
*
(
priv
->
configInfoList
->
doms
))
*
(
priv
->
configInfoList
->
count
-
(
i
+
1
)));
if
(
VIR_REALLOC_N
(
priv
->
configInfoList
->
doms
,
priv
->
configInfoList
->
count
-
1
)
<
0
)
{
;
/* Failure to reduce memory allocation isn't fatal */
}
priv
->
configInfoList
->
count
--
;
VIR_DELETE_ELEMENT
(
priv
->
configInfoList
->
doms
,
i
,
priv
->
configInfoList
->
count
);
return
0
;
}
}
...
...
src/xen/xm_internal.c
浏览文件 @
ce17ddac
...
...
@@ -1262,10 +1262,8 @@ xenXMDomainAttachDeviceFlags(virConnectPtr conn,
case
VIR_DOMAIN_DEVICE_NET
:
{
if
(
VIR_
REALLOC_N
(
def
->
nets
,
def
->
nnets
+
1
)
<
0
)
if
(
VIR_
APPEND_ELEMENT
(
def
->
nets
,
def
->
nnets
,
dev
->
data
.
net
)
<
0
)
goto
cleanup
;
def
->
nets
[
def
->
nnets
++
]
=
dev
->
data
.
net
;
dev
->
data
.
net
=
NULL
;
break
;
}
...
...
@@ -1348,12 +1346,7 @@ xenXMDomainDetachDeviceFlags(virConnectPtr conn,
dev
->
data
.
disk
->
dst
&&
STREQ
(
def
->
disks
[
i
]
->
dst
,
dev
->
data
.
disk
->
dst
))
{
virDomainDiskDefFree
(
def
->
disks
[
i
]);
if
(
i
<
(
def
->
ndisks
-
1
))
memmove
(
def
->
disks
+
i
,
def
->
disks
+
i
+
1
,
sizeof
(
*
def
->
disks
)
*
(
def
->
ndisks
-
(
i
+
1
)));
def
->
ndisks
--
;
VIR_DELETE_ELEMENT
(
def
->
disks
,
i
,
def
->
ndisks
);
break
;
}
}
...
...
@@ -1365,12 +1358,7 @@ xenXMDomainDetachDeviceFlags(virConnectPtr conn,
for
(
i
=
0
;
i
<
def
->
nnets
;
i
++
)
{
if
(
!
virMacAddrCmp
(
&
def
->
nets
[
i
]
->
mac
,
&
dev
->
data
.
net
->
mac
))
{
virDomainNetDefFree
(
def
->
nets
[
i
]);
if
(
i
<
(
def
->
nnets
-
1
))
memmove
(
def
->
nets
+
i
,
def
->
nets
+
i
+
1
,
sizeof
(
*
def
->
nets
)
*
(
def
->
nnets
-
(
i
+
1
)));
def
->
nnets
--
;
VIR_DELETE_ELEMENT
(
def
->
nets
,
i
,
def
->
nnets
);
break
;
}
}
...
...
src/xen/xs_internal.c
浏览文件 @
ce17ddac
...
...
@@ -666,14 +666,9 @@ xenStoreAddWatch(virConnectPtr conn,
VIR_STRDUP
(
watch
->
token
,
token
)
<
0
)
goto
error
;
/* Make space on list */
n
=
list
->
count
;
if
(
VIR_REALLOC_N
(
list
->
watches
,
n
+
1
)
<
0
)
if
(
VIR_APPEND_ELEMENT_COPY
(
list
->
watches
,
list
->
count
,
watch
)
<
0
)
goto
error
;
list
->
watches
[
n
]
=
watch
;
list
->
count
++
;
return
xs_watch
(
priv
->
xshandle
,
watch
->
path
,
watch
->
token
);
error:
...
...
@@ -719,17 +714,7 @@ xenStoreRemoveWatch(virConnectPtr conn, const char *path, const char *token)
VIR_FREE
(
list
->
watches
[
i
]
->
token
);
VIR_FREE
(
list
->
watches
[
i
]);
if
(
i
<
(
list
->
count
-
1
))
memmove
(
list
->
watches
+
i
,
list
->
watches
+
i
+
1
,
sizeof
(
*
(
list
->
watches
))
*
(
list
->
count
-
(
i
+
1
)));
if
(
VIR_REALLOC_N
(
list
->
watches
,
list
->
count
-
1
)
<
0
)
{
;
/* Failure to reduce memory allocation isn't fatal */
}
list
->
count
--
;
VIR_DELETE_ELEMENT
(
list
->
watches
,
i
,
list
->
count
);
return
0
;
}
}
...
...
src/xen/xs_internal.h
浏览文件 @
ce17ddac
...
...
@@ -71,7 +71,7 @@ typedef struct _xenStoreWatch xenStoreWatch;
typedef
xenStoreWatch
*
xenStoreWatchPtr
;
struct
_xenStoreWatchList
{
unsigned
in
t
count
;
size_
t
count
;
xenStoreWatchPtr
*
watches
;
};
typedef
struct
_xenStoreWatchList
xenStoreWatchList
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录