Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
e7a1da8a
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,发现更多精彩内容 >>
提交
e7a1da8a
编写于
11月 13, 2014
作者:
M
Martin Kletzander
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove unnecessary curly brackets in src/storage/
Signed-off-by:
N
Martin Kletzander
<
mkletzan@redhat.com
>
上级
5cca4cd1
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
35 addition
and
70 deletion
+35
-70
src/storage/parthelper.c
src/storage/parthelper.c
+1
-2
src/storage/storage_backend.c
src/storage/storage_backend.c
+3
-6
src/storage/storage_backend_disk.c
src/storage/storage_backend_disk.c
+5
-10
src/storage/storage_backend_fs.c
src/storage/storage_backend_fs.c
+2
-4
src/storage/storage_backend_mpath.c
src/storage/storage_backend_mpath.c
+9
-18
src/storage/storage_backend_rbd.c
src/storage/storage_backend_rbd.c
+10
-20
src/storage/storage_backend_scsi.c
src/storage/storage_backend_scsi.c
+2
-4
src/storage/storage_driver.c
src/storage/storage_driver.c
+3
-6
未找到文件。
src/storage/parthelper.c
浏览文件 @
e7a1da8a
...
...
@@ -91,9 +91,8 @@ int main(int argc, char **argv)
if
(
VIR_STRDUP_QUIET
(
canonical_path
,
path
)
<
0
)
return
2
;
}
else
{
if
(
virFileResolveLink
(
path
,
&
canonical_path
)
!=
0
)
{
if
(
virFileResolveLink
(
path
,
&
canonical_path
)
!=
0
)
return
2
;
}
partsep
=
*
canonical_path
&&
c_isdigit
(
canonical_path
[
strlen
(
canonical_path
)
-
1
])
?
"p"
:
""
;
...
...
src/storage/storage_backend.c
浏览文件 @
e7a1da8a
...
...
@@ -182,9 +182,8 @@ virStorageBackendCopyToFD(virStorageVolDefPtr vol,
}
#ifdef __linux__
if
(
ioctl
(
fd
,
BLKBSZGET
,
&
wbytes
)
<
0
)
{
if
(
ioctl
(
fd
,
BLKBSZGET
,
&
wbytes
)
<
0
)
wbytes
=
0
;
}
#endif
if
((
wbytes
==
0
)
&&
fstat
(
fd
,
&
st
)
==
0
)
wbytes
=
st
.
st_blksize
;
...
...
@@ -395,9 +394,8 @@ createRawFile(int fd, virStorageVolDefPtr vol,
(
vol
->
target
.
allocation
<
inputvol
->
target
.
capacity
);
ret
=
virStorageBackendCopyToFD
(
vol
,
inputvol
,
fd
,
&
remain
,
want_sparse
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
goto
cleanup
;
}
}
if
(
remain
&&
need_alloc
)
{
...
...
@@ -631,9 +629,8 @@ virStorageBackendCreateExecCommand(virStoragePoolObjPtr pool,
virCommandSetGID
(
cmd
,
-
1
);
if
(
!
filecreated
)
{
if
(
virCommandRun
(
cmd
,
NULL
)
<
0
)
{
if
(
virCommandRun
(
cmd
,
NULL
)
<
0
)
return
-
1
;
}
if
(
stat
(
vol
->
target
.
path
,
&
st
)
<
0
)
{
virReportSystemError
(
errno
,
_
(
"failed to create %s"
),
vol
->
target
.
path
);
...
...
src/storage/storage_backend_disk.c
浏览文件 @
e7a1da8a
...
...
@@ -171,9 +171,8 @@ virStorageBackendDiskMakeFreeExtent(virStoragePoolObjPtr pool,
return
-
1
;
/* Don't bother to re-alloc freeExtents - it'll be free'd shortly */
/* first block reported as free, even if it is not */
if
(
dev
->
freeExtents
[
dev
->
nfreeExtent
].
start
==
0
)
{
if
(
dev
->
freeExtents
[
dev
->
nfreeExtent
].
start
==
0
)
dev
->
freeExtents
[
dev
->
nfreeExtent
].
start
=
SECTOR_SIZE
;
}
pool
->
def
->
available
+=
(
dev
->
freeExtents
[
dev
->
nfreeExtent
].
end
-
...
...
@@ -349,9 +348,8 @@ virStorageBackendDiskRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
return
-
1
;
}
if
(
virStorageBackendDiskReadGeometry
(
pool
)
!=
0
)
{
if
(
virStorageBackendDiskReadGeometry
(
pool
)
!=
0
)
return
-
1
;
}
return
virStorageBackendDiskReadPartitions
(
pool
,
NULL
);
}
...
...
@@ -467,9 +465,8 @@ virStorageBackendDiskPartTypeToCreate(virStoragePoolObjPtr pool)
partType
==
VIR_STORAGE_VOL_DISK_TYPE_EXTENDED
)
count
++
;
}
if
(
count
>=
4
)
{
if
(
count
>=
4
)
return
VIR_STORAGE_VOL_DISK_TYPE_LOGICAL
;
}
}
/* for all other cases, all partitions are primary */
...
...
@@ -587,9 +584,8 @@ virStorageBackendDiskPartBoundaries(virStoragePoolObjPtr pool,
}
/* if we are creating a logical partition, we need one extra
block between partitions (or actually move start one block) */
if
(
partType
==
VIR_STORAGE_VOL_DISK_TYPE_LOGICAL
)
{
if
(
partType
==
VIR_STORAGE_VOL_DISK_TYPE_LOGICAL
)
size
-=
SECTOR_SIZE
;
}
}
if
(
size
>
neededSize
&&
(
smallestSize
==
0
||
...
...
@@ -659,9 +655,8 @@ virStorageBackendDiskCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
goto
cleanup
;
}
if
(
virStorageBackendDiskPartFormat
(
pool
,
vol
,
&
partFormat
)
!=
0
)
{
if
(
virStorageBackendDiskPartFormat
(
pool
,
vol
,
&
partFormat
)
!=
0
)
goto
cleanup
;
}
virCommandAddArg
(
cmd
,
partFormat
);
if
(
virStorageBackendDiskPartBoundaries
(
pool
,
&
startOffset
,
...
...
src/storage/storage_backend_fs.c
浏览文件 @
e7a1da8a
...
...
@@ -639,9 +639,8 @@ virStorageBackendFileSystemProbe(const char *device,
error:
VIR_FREE
(
libblkid_format
);
if
(
probe
!=
NULL
)
{
if
(
probe
!=
NULL
)
blkid_free_probe
(
probe
);
}
return
ret
;
}
...
...
@@ -737,9 +736,8 @@ virStorageBackendMakeFileSystem(virStoragePoolObjPtr pool,
ok_to_mkfs
=
true
;
}
if
(
ok_to_mkfs
)
{
if
(
ok_to_mkfs
)
ret
=
virStorageBackendExecuteMKFS
(
device
,
format
);
}
error:
return
ret
;
...
...
src/storage/storage_backend_mpath.c
浏览文件 @
e7a1da8a
...
...
@@ -119,14 +119,12 @@ virStorageBackendIsMultipath(const char *dev_name)
goto
out
;
}
if
(
STREQ
(
target_type
,
"multipath"
))
{
if
(
STREQ
(
target_type
,
"multipath"
))
ret
=
1
;
}
out:
if
(
dmt
!=
NULL
)
{
if
(
dmt
!=
NULL
)
dm_task_destroy
(
dmt
);
}
return
ret
;
}
...
...
@@ -138,21 +136,17 @@ virStorageBackendGetMinorNumber(const char *dev_name, uint32_t *minor)
struct
dm_task
*
dmt
;
struct
dm_info
info
;
if
(
!
(
dmt
=
dm_task_create
(
DM_DEVICE_INFO
)))
{
if
(
!
(
dmt
=
dm_task_create
(
DM_DEVICE_INFO
)))
goto
out
;
}
if
(
!
dm_task_set_name
(
dmt
,
dev_name
))
{
if
(
!
dm_task_set_name
(
dmt
,
dev_name
))
goto
out
;
}
if
(
!
dm_task_run
(
dmt
))
{
if
(
!
dm_task_run
(
dmt
))
goto
out
;
}
if
(
!
dm_task_get_info
(
dmt
,
&
info
))
{
if
(
!
dm_task_get_info
(
dmt
,
&
info
))
goto
out
;
}
*
minor
=
info
.
minor
;
ret
=
0
;
...
...
@@ -177,9 +171,8 @@ virStorageBackendCreateVols(virStoragePoolObjPtr pool,
do
{
is_mpath
=
virStorageBackendIsMultipath
(
names
->
name
);
if
(
is_mpath
<
0
)
{
if
(
is_mpath
<
0
)
goto
out
;
}
if
(
is_mpath
==
1
)
{
...
...
@@ -193,9 +186,8 @@ virStorageBackendCreateVols(virStoragePoolObjPtr pool,
goto
out
;
}
if
(
virStorageBackendMpathNewVol
(
pool
,
minor
,
map_device
)
<
0
)
{
if
(
virStorageBackendMpathNewVol
(
pool
,
minor
,
map_device
)
<
0
)
goto
out
;
}
VIR_FREE
(
map_device
);
}
...
...
@@ -247,9 +239,8 @@ virStorageBackendGetMaps(virStoragePoolObjPtr pool)
virStorageBackendCreateVols
(
pool
,
names
);
out:
if
(
dmt
!=
NULL
)
{
if
(
dmt
!=
NULL
)
dm_task_destroy
(
dmt
);
}
return
retval
;
}
...
...
src/storage/storage_backend_rbd.c
浏览文件 @
e7a1da8a
...
...
@@ -330,13 +330,11 @@ static int virStorageBackendRBDRefreshPool(virConnectPtr conn,
ptr
.
cluster
=
NULL
;
ptr
.
ioctx
=
NULL
;
if
(
virStorageBackendRBDOpenRADOSConn
(
&
ptr
,
conn
,
&
pool
->
def
->
source
)
<
0
)
{
if
(
virStorageBackendRBDOpenRADOSConn
(
&
ptr
,
conn
,
&
pool
->
def
->
source
)
<
0
)
goto
cleanup
;
}
if
(
virStorageBackendRBDOpenIoCTX
(
&
ptr
,
pool
)
<
0
)
{
if
(
virStorageBackendRBDOpenIoCTX
(
&
ptr
,
pool
)
<
0
)
goto
cleanup
;
}
struct
rados_cluster_stat_t
clusterstat
;
r
=
rados_cluster_stat
(
ptr
.
cluster
,
&
clusterstat
);
...
...
@@ -428,17 +426,14 @@ static int virStorageBackendRBDDeleteVol(virConnectPtr conn,
VIR_DEBUG
(
"Removing RBD image %s/%s"
,
pool
->
def
->
source
.
name
,
vol
->
name
);
if
(
flags
&
VIR_STORAGE_VOL_DELETE_ZEROED
)
{
if
(
flags
&
VIR_STORAGE_VOL_DELETE_ZEROED
)
VIR_WARN
(
"%s"
,
_
(
"This storage backend does not supported zeroed removal of volumes"
));
}
if
(
virStorageBackendRBDOpenRADOSConn
(
&
ptr
,
conn
,
&
pool
->
def
->
source
)
<
0
)
{
if
(
virStorageBackendRBDOpenRADOSConn
(
&
ptr
,
conn
,
&
pool
->
def
->
source
)
<
0
)
goto
cleanup
;
}
if
(
virStorageBackendRBDOpenIoCTX
(
&
ptr
,
pool
)
<
0
)
{
if
(
virStorageBackendRBDOpenIoCTX
(
&
ptr
,
pool
)
<
0
)
goto
cleanup
;
}
r
=
rbd_remove
(
ptr
.
ioctx
,
vol
->
name
);
if
(
r
<
0
)
{
...
...
@@ -555,17 +550,14 @@ static int virStorageBackendRBDRefreshVol(virConnectPtr conn,
ptr
.
ioctx
=
NULL
;
int
ret
=
-
1
;
if
(
virStorageBackendRBDOpenRADOSConn
(
&
ptr
,
conn
,
&
pool
->
def
->
source
)
<
0
)
{
if
(
virStorageBackendRBDOpenRADOSConn
(
&
ptr
,
conn
,
&
pool
->
def
->
source
)
<
0
)
goto
cleanup
;
}
if
(
virStorageBackendRBDOpenIoCTX
(
&
ptr
,
pool
)
<
0
)
{
if
(
virStorageBackendRBDOpenIoCTX
(
&
ptr
,
pool
)
<
0
)
goto
cleanup
;
}
if
(
volStorageBackendRBDRefreshVolInfo
(
vol
,
pool
,
&
ptr
)
<
0
)
{
if
(
volStorageBackendRBDRefreshVolInfo
(
vol
,
pool
,
&
ptr
)
<
0
)
goto
cleanup
;
}
ret
=
0
;
...
...
@@ -589,13 +581,11 @@ static int virStorageBackendRBDResizeVol(virConnectPtr conn ATTRIBUTE_UNUSED,
virCheckFlags
(
0
,
-
1
);
if
(
virStorageBackendRBDOpenRADOSConn
(
&
ptr
,
conn
,
&
pool
->
def
->
source
)
<
0
)
{
if
(
virStorageBackendRBDOpenRADOSConn
(
&
ptr
,
conn
,
&
pool
->
def
->
source
)
<
0
)
goto
cleanup
;
}
if
(
virStorageBackendRBDOpenIoCTX
(
&
ptr
,
pool
)
<
0
)
{
if
(
virStorageBackendRBDOpenIoCTX
(
&
ptr
,
pool
)
<
0
)
goto
cleanup
;
}
r
=
rbd_open
(
ptr
.
ioctx
,
vol
->
name
,
&
image
,
NULL
);
if
(
r
<
0
)
{
...
...
src/storage/storage_backend_scsi.c
浏览文件 @
e7a1da8a
...
...
@@ -256,9 +256,8 @@ getNewStyleBlockDevice(const char *lun_path,
while
((
direrr
=
virDirRead
(
block_dir
,
&
block_dirent
,
block_path
))
>
0
)
{
if
(
STREQLEN
(
block_dirent
->
d_name
,
"."
,
1
))
{
if
(
STREQLEN
(
block_dirent
->
d_name
,
"."
,
1
))
continue
;
}
if
(
VIR_STRDUP
(
*
block_device
,
block_dirent
->
d_name
)
<
0
)
{
closedir
(
block_dir
);
...
...
@@ -397,9 +396,8 @@ processLU(virStoragePoolObjPtr pool,
VIR_DEBUG
(
"%u:%u:%u:%u is a Direct-Access LUN"
,
host
,
bus
,
target
,
lun
);
if
(
getBlockDevice
(
host
,
bus
,
target
,
lun
,
&
block_device
)
<
0
)
{
if
(
getBlockDevice
(
host
,
bus
,
target
,
lun
,
&
block_device
)
<
0
)
goto
out
;
}
if
(
virStorageBackendSCSINewLun
(
pool
,
host
,
bus
,
target
,
lun
,
...
...
src/storage/storage_driver.c
浏览文件 @
e7a1da8a
...
...
@@ -484,9 +484,8 @@ storageConnectListDefinedStoragePools(virConnectPtr conn,
cleanup:
storageDriverUnlock
();
for
(
i
=
0
;
i
<
got
;
i
++
)
{
for
(
i
=
0
;
i
<
got
;
i
++
)
VIR_FREE
(
names
[
i
]);
}
memset
(
names
,
0
,
nnames
*
sizeof
(
*
names
));
return
-
1
;
}
...
...
@@ -1650,9 +1649,8 @@ storageVolCreateXML(virStoragePoolPtr obj,
/* Wipe any key the user may have suggested, as volume creation
* will generate the canonical key. */
VIR_FREE
(
voldef
->
key
);
if
(
backend
->
createVol
(
obj
->
conn
,
pool
,
voldef
)
<
0
)
{
if
(
backend
->
createVol
(
obj
->
conn
,
pool
,
voldef
)
<
0
)
goto
cleanup
;
}
pool
->
volumes
.
objs
[
pool
->
volumes
.
count
++
]
=
voldef
;
volobj
=
virGetStorageVol
(
obj
->
conn
,
pool
->
def
->
name
,
voldef
->
name
,
...
...
@@ -1830,9 +1828,8 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
* Wipe any key the user may have suggested, as volume creation
* will generate the canonical key. */
VIR_FREE
(
newvol
->
key
);
if
(
backend
->
createVol
(
obj
->
conn
,
pool
,
newvol
)
<
0
)
{
if
(
backend
->
createVol
(
obj
->
conn
,
pool
,
newvol
)
<
0
)
goto
cleanup
;
}
pool
->
volumes
.
objs
[
pool
->
volumes
.
count
++
]
=
newvol
;
volobj
=
virGetStorageVol
(
obj
->
conn
,
pool
->
def
->
name
,
newvol
->
name
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录