Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
d53bbfd1
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看板
提交
d53bbfd1
编写于
3月 07, 2014
作者:
M
Michal Privoznik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
src/storage: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
Signed-off-by:
N
Michal Privoznik
<
mprivozn@redhat.com
>
上级
ba52e4c7
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
15 addition
and
34 deletion
+15
-34
src/storage/storage_backend_disk.c
src/storage/storage_backend_disk.c
+4
-9
src/storage/storage_backend_fs.c
src/storage/storage_backend_fs.c
+1
-4
src/storage/storage_backend_iscsi.c
src/storage/storage_backend_iscsi.c
+1
-4
src/storage/storage_backend_logical.c
src/storage/storage_backend_logical.c
+3
-5
src/storage/storage_backend_mpath.c
src/storage/storage_backend_mpath.c
+1
-3
src/storage/storage_backend_rbd.c
src/storage/storage_backend_rbd.c
+4
-6
src/storage/storage_backend_scsi.c
src/storage/storage_backend_scsi.c
+1
-3
未找到文件。
src/storage/storage_backend_disk.c
浏览文件 @
d53bbfd1
...
...
@@ -52,21 +52,16 @@ virStorageBackendDiskMakeDataVol(virStoragePoolObjPtr pool,
if
(
vol
==
NULL
)
{
if
(
VIR_ALLOC
(
vol
)
<
0
)
return
-
1
;
if
(
VIR_REALLOC_N
(
pool
->
volumes
.
objs
,
pool
->
volumes
.
count
+
1
)
<
0
)
{
virStorageVolDefFree
(
vol
);
return
-
1
;
}
pool
->
volumes
.
objs
[
pool
->
volumes
.
count
++
]
=
vol
;
/* Prepended path will be same for all partitions, so we can
* strip the path to form a reasonable pool-unique name
*/
tmp
=
strrchr
(
groups
[
0
],
'/'
);
if
(
VIR_STRDUP
(
vol
->
name
,
tmp
?
tmp
+
1
:
groups
[
0
])
<
0
)
if
(
VIR_STRDUP
(
vol
->
name
,
tmp
?
tmp
+
1
:
groups
[
0
])
<
0
||
VIR_APPEND_ELEMENT
(
pool
->
volumes
.
objs
,
pool
->
volumes
.
count
,
vol
)
<
0
)
{
virStorageVolDefFree
(
vol
);
return
-
1
;
}
}
if
(
vol
->
target
.
path
==
NULL
)
{
if
(
VIR_STRDUP
(
devpath
,
groups
[
0
])
<
0
)
...
...
src/storage/storage_backend_fs.c
浏览文件 @
d53bbfd1
...
...
@@ -905,11 +905,8 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn ATTRIBUTE_UNUSED,
}
if
(
VIR_REALLOC_N
(
pool
->
volumes
.
objs
,
pool
->
volumes
.
count
+
1
)
<
0
)
if
(
VIR_APPEND_ELEMENT
(
pool
->
volumes
.
objs
,
pool
->
volumes
.
count
,
vol
)
<
0
)
goto
cleanup
;
pool
->
volumes
.
objs
[
pool
->
volumes
.
count
++
]
=
vol
;
vol
=
NULL
;
}
closedir
(
dir
);
...
...
src/storage/storage_backend_iscsi.c
浏览文件 @
d53bbfd1
...
...
@@ -447,14 +447,11 @@ virStorageBackendISCSIGetTargets(virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
if
(
VIR_STRDUP
(
target
,
groups
[
1
])
<
0
)
return
-
1
;
if
(
VIR_
REALLOC_N
(
list
->
targets
,
list
->
ntargets
+
1
)
<
0
)
{
if
(
VIR_
APPEND_ELEMENT
(
list
->
targets
,
list
->
ntargets
,
target
)
<
0
)
{
VIR_FREE
(
target
);
return
-
1
;
}
list
->
targets
[
list
->
ntargets
]
=
target
;
list
->
ntargets
++
;
return
0
;
}
...
...
src/storage/storage_backend_logical.c
浏览文件 @
d53bbfd1
...
...
@@ -115,9 +115,6 @@ virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool,
if
(
VIR_STRDUP
(
vol
->
name
,
groups
[
0
])
<
0
)
goto
cleanup
;
if
(
VIR_REALLOC_N
(
pool
->
volumes
.
objs
,
pool
->
volumes
.
count
+
1
))
goto
cleanup
;
}
if
(
vol
->
target
.
path
==
NULL
)
{
...
...
@@ -251,8 +248,9 @@ virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool,
vol
->
source
.
nextent
++
;
}
if
(
is_new_vol
)
pool
->
volumes
.
objs
[
pool
->
volumes
.
count
++
]
=
vol
;
if
(
is_new_vol
&&
VIR_APPEND_ELEMENT
(
pool
->
volumes
.
objs
,
pool
->
volumes
.
count
,
vol
)
<
0
)
goto
cleanup
;
ret
=
0
;
...
...
src/storage/storage_backend_mpath.c
浏览文件 @
d53bbfd1
...
...
@@ -99,10 +99,8 @@ virStorageBackendMpathNewVol(virStoragePoolObjPtr pool,
if
(
VIR_STRDUP
(
vol
->
key
,
vol
->
target
.
path
)
<
0
)
goto
cleanup
;
if
(
VIR_REALLOC_N
(
pool
->
volumes
.
objs
,
pool
->
volumes
.
count
+
1
)
<
0
)
if
(
VIR_APPEND_ELEMENT_COPY
(
pool
->
volumes
.
objs
,
pool
->
volumes
.
count
,
vol
)
<
0
)
goto
cleanup
;
pool
->
volumes
.
objs
[
pool
->
volumes
.
count
++
]
=
vol
;
pool
->
def
->
capacity
+=
vol
->
capacity
;
pool
->
def
->
allocation
+=
vol
->
allocation
;
ret
=
0
;
...
...
src/storage/storage_backend_rbd.c
浏览文件 @
d53bbfd1
...
...
@@ -382,11 +382,6 @@ static int virStorageBackendRBDRefreshPool(virConnectPtr conn,
for
(
name
=
names
;
name
<
names
+
max_size
;)
{
virStorageVolDefPtr
vol
;
if
(
VIR_REALLOC_N
(
pool
->
volumes
.
objs
,
pool
->
volumes
.
count
+
1
)
<
0
)
{
virStoragePoolObjClearVols
(
pool
);
goto
cleanup
;
}
if
(
STREQ
(
name
,
""
))
break
;
...
...
@@ -405,7 +400,10 @@ static int virStorageBackendRBDRefreshPool(virConnectPtr conn,
goto
cleanup
;
}
pool
->
volumes
.
objs
[
pool
->
volumes
.
count
++
]
=
vol
;
if
(
VIR_APPEND_ELEMENT
(
pool
->
volumes
.
objs
,
pool
->
volumes
.
count
,
vol
)
<
0
)
{
virStoragePoolObjClearVols
(
pool
);
goto
cleanup
;
}
}
VIR_DEBUG
(
"Found %zu images in RBD pool %s"
,
...
...
src/storage/storage_backend_scsi.c
浏览文件 @
d53bbfd1
...
...
@@ -249,12 +249,10 @@ virStorageBackendSCSINewLun(virStoragePoolObjPtr pool,
pool
->
def
->
capacity
+=
vol
->
capacity
;
pool
->
def
->
allocation
+=
vol
->
allocation
;
if
(
VIR_REALLOC_N
(
pool
->
volumes
.
objs
,
pool
->
volumes
.
count
+
1
)
<
0
)
{
if
(
VIR_APPEND_ELEMENT
(
pool
->
volumes
.
objs
,
pool
->
volumes
.
count
,
vol
)
<
0
)
{
retval
=
-
1
;
goto
free_vol
;
}
pool
->
volumes
.
objs
[
pool
->
volumes
.
count
++
]
=
vol
;
goto
out
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录