Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
6f761c56
I
iSulad
项目概览
openeuler
/
iSulad
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
iSulad
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6f761c56
编写于
5月 13, 2020
作者:
L
lifeng68
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
clean code: remove unused codes with storage status and metadata
Signed-off-by:
N
lifeng68
<
lifeng68@huawei.com
>
上级
af23474c
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
0 addition
and
248 deletion
+0
-248
src/image/image.c
src/image/image.c
+0
-92
src/image/image.h
src/image/image.h
+0
-23
src/image/oci/oci_image.c
src/image/oci/oci_image.c
+0
-60
src/image/oci/oci_image.h
src/image/oci/oci_image.h
+0
-4
src/image/oci/storage/layer_store/layer_store.c
src/image/oci/storage/layer_store/layer_store.c
+0
-42
src/image/oci/storage/layer_store/layer_store.h
src/image/oci/storage/layer_store/layer_store.h
+0
-8
test/mocks/image_mock.cc
test/mocks/image_mock.cc
+0
-17
test/mocks/image_mock.h
test/mocks/image_mock.h
+0
-2
未找到文件。
src/image/image.c
浏览文件 @
6f761c56
...
@@ -60,8 +60,6 @@ static const struct bim_ops g_embedded_ops = {
...
@@ -60,8 +60,6 @@ static const struct bim_ops g_embedded_ops = {
.
resolve_image_name
=
embedded_resolve_image_name
,
.
resolve_image_name
=
embedded_resolve_image_name
,
.
container_fs_usage
=
embedded_filesystem_usage
,
.
container_fs_usage
=
embedded_filesystem_usage
,
.
get_filesystem_info
=
NULL
,
.
get_filesystem_info
=
NULL
,
.
get_storage_status
=
NULL
,
.
get_storage_metadata
=
NULL
,
.
image_status
=
NULL
,
.
image_status
=
NULL
,
.
load_image
=
embedded_load_image
,
.
load_image
=
embedded_load_image
,
.
pull_image
=
NULL
,
.
pull_image
=
NULL
,
...
@@ -95,8 +93,6 @@ static const struct bim_ops g_oci_ops = {
...
@@ -95,8 +93,6 @@ static const struct bim_ops g_oci_ops = {
.
resolve_image_name
=
oci_resolve_image_name
,
.
resolve_image_name
=
oci_resolve_image_name
,
.
container_fs_usage
=
oci_container_filesystem_usage
,
.
container_fs_usage
=
oci_container_filesystem_usage
,
.
get_filesystem_info
=
oci_get_filesystem_info
,
.
get_filesystem_info
=
oci_get_filesystem_info
,
.
get_storage_status
=
oci_get_storage_status
,
.
get_storage_metadata
=
oci_get_storage_metadata
,
.
image_status
=
oci_status_image
,
.
image_status
=
oci_status_image
,
.
load_image
=
oci_load_image
,
.
load_image
=
oci_load_image
,
.
pull_image
=
oci_pull_rf
,
.
pull_image
=
oci_pull_rf
,
...
@@ -130,8 +126,6 @@ static const struct bim_ops g_ext_ops = {
...
@@ -130,8 +126,6 @@ static const struct bim_ops g_ext_ops = {
.
container_fs_usage
=
ext_filesystem_usage
,
.
container_fs_usage
=
ext_filesystem_usage
,
.
image_status
=
NULL
,
.
image_status
=
NULL
,
.
get_filesystem_info
=
NULL
,
.
get_filesystem_info
=
NULL
,
.
get_storage_status
=
NULL
,
.
get_storage_metadata
=
NULL
,
.
load_image
=
ext_load_image
,
.
load_image
=
ext_load_image
,
.
pull_image
=
NULL
,
.
pull_image
=
NULL
,
.
login
=
ext_login
,
.
login
=
ext_login
,
...
@@ -293,66 +287,6 @@ out:
...
@@ -293,66 +287,6 @@ out:
return
ret
;
return
ret
;
}
}
int
im_get_storage_status
(
const
char
*
image_type
,
im_storage_status_response
**
response
)
{
int
ret
=
-
1
;
const
struct
bim_type
*
q
=
NULL
;
if
(
image_type
==
NULL
)
{
ERROR
(
"Image type is required"
);
goto
out
;
}
q
=
get_bim_by_type
(
image_type
);
if
(
q
==
NULL
)
{
goto
out
;
}
if
(
q
->
ops
->
get_storage_status
==
NULL
)
{
ERROR
(
"Get storage status umimplements"
);
goto
out
;
}
ret
=
q
->
ops
->
get_storage_status
(
response
);
if
(
ret
!=
0
)
{
ERROR
(
"Get storage status failed"
);
free_im_storage_status_response
(
*
response
);
*
response
=
NULL
;
goto
out
;
}
out:
return
ret
;
}
int
im_get_storage_metadata
(
const
char
*
image_type
,
char
*
id
,
im_storage_metadata_response
**
response
)
{
int
ret
=
-
1
;
const
struct
bim_type
*
q
=
NULL
;
if
(
image_type
==
NULL
||
response
==
NULL
)
{
ERROR
(
"Image type or response is NULL"
);
goto
out
;
}
q
=
get_bim_by_type
(
image_type
);
if
(
q
==
NULL
)
{
goto
out
;
}
if
(
q
->
ops
->
get_storage_metadata
==
NULL
)
{
ERROR
(
"Get storage metadata umimplements"
);
goto
out
;
}
ret
=
q
->
ops
->
get_storage_metadata
(
id
,
response
);
if
(
ret
!=
0
)
{
ERROR
(
"Get storage metadata failed"
);
free_im_storage_metadata_response
(
*
response
);
*
response
=
NULL
;
goto
out
;
}
out:
return
ret
;
}
int
im_get_filesystem_info
(
const
char
*
image_type
,
im_fs_info_response
**
response
)
int
im_get_filesystem_info
(
const
char
*
image_type
,
im_fs_info_response
**
response
)
{
{
int
ret
=
-
1
;
int
ret
=
-
1
;
...
@@ -1948,29 +1882,3 @@ void free_im_fs_info_response(im_fs_info_response *ptr)
...
@@ -1948,29 +1882,3 @@ void free_im_fs_info_response(im_fs_info_response *ptr)
free
(
ptr
);
free
(
ptr
);
}
}
void
free_im_storage_status_response
(
im_storage_status_response
*
ptr
)
{
if
(
ptr
==
NULL
)
{
return
;
}
free
(
ptr
->
backing_fs
);
ptr
->
backing_fs
=
NULL
;
free
(
ptr
->
status
);
ptr
->
status
=
NULL
;
free
(
ptr
);
}
void
free_im_storage_metadata_response
(
im_storage_metadata_response
*
ptr
)
{
if
(
ptr
==
NULL
)
{
return
;
}
free_json_map_string_string
(
ptr
->
metadata
);
ptr
->
metadata
=
NULL
;
free
(
ptr
->
name
);
ptr
->
name
=
NULL
;
free
(
ptr
->
errmsg
);
ptr
->
errmsg
=
NULL
;
free
(
ptr
);
}
src/image/image.h
浏览文件 @
6f761c56
...
@@ -54,17 +54,6 @@ typedef struct {
...
@@ -54,17 +54,6 @@ typedef struct {
}
image_filter
;
}
image_filter
;
#endif
#endif
typedef
struct
{
char
*
backing_fs
;
char
*
status
;
}
im_storage_status_response
;
typedef
struct
{
json_map_string_string
*
metadata
;
char
*
name
;
char
*
errmsg
;
}
im_storage_metadata_response
;
typedef
struct
{
typedef
struct
{
imagetool_fs_info
*
fs_info
;
imagetool_fs_info
*
fs_info
;
char
*
errmsg
;
char
*
errmsg
;
...
@@ -256,10 +245,6 @@ struct bim_ops {
...
@@ -256,10 +245,6 @@ struct bim_ops {
int
(
*
get_filesystem_info
)(
im_fs_info_response
**
response
);
int
(
*
get_filesystem_info
)(
im_fs_info_response
**
response
);
int
(
*
get_storage_status
)(
im_storage_status_response
**
response
);
int
(
*
get_storage_metadata
)(
char
*
id
,
im_storage_metadata_response
**
response
);
/* import */
/* import */
int
(
*
import
)(
const
im_import_request
*
request
,
char
**
id
);
int
(
*
import
)(
const
im_import_request
*
request
,
char
**
id
);
...
@@ -393,14 +378,6 @@ int im_get_filesystem_info(const char *image_type, im_fs_info_response **respons
...
@@ -393,14 +378,6 @@ int im_get_filesystem_info(const char *image_type, im_fs_info_response **respons
void
free_im_fs_info_response
(
im_fs_info_response
*
ptr
);
void
free_im_fs_info_response
(
im_fs_info_response
*
ptr
);
int
im_get_storage_status
(
const
char
*
image_type
,
im_storage_status_response
**
response
);
void
free_im_storage_status_response
(
im_storage_status_response
*
ptr
);
int
im_get_storage_metadata
(
const
char
*
image_type
,
char
*
id
,
im_storage_metadata_response
**
response
);
void
free_im_storage_metadata_response
(
im_storage_metadata_response
*
ptr
);
size_t
im_get_image_count
(
const
im_image_count_request
*
request
);
size_t
im_get_image_count
(
const
im_image_count_request
*
request
);
void
free_im_image_count_request
(
im_image_count_request
*
ptr
);
void
free_im_image_count_request
(
im_image_count_request
*
ptr
);
...
...
src/image/oci/oci_image.c
浏览文件 @
6f761c56
...
@@ -355,66 +355,6 @@ err_out:
...
@@ -355,66 +355,6 @@ err_out:
return
-
1
;
return
-
1
;
}
}
int
oci_get_storage_status
(
im_storage_status_response
**
response
)
{
int
ret
=
-
1
;
if
(
response
==
NULL
)
{
ERROR
(
"Invalid input arguments"
);
return
ret
;
}
*
response
=
(
im_storage_status_response
*
)
util_common_calloc_s
(
sizeof
(
im_storage_status_response
));
if
(
*
response
==
NULL
)
{
ERROR
(
"Out of memory"
);
return
ret
;
}
// TODO call storage image status interface
//ret = isula_do_storage_status(*response);
if
(
ret
!=
0
)
{
ERROR
(
"Get get storage status failed"
);
ret
=
-
1
;
goto
err_out
;
}
return
0
;
err_out:
free_im_storage_status_response
(
*
response
);
*
response
=
NULL
;
return
ret
;
}
int
oci_get_storage_metadata
(
char
*
id
,
im_storage_metadata_response
**
response
)
{
int
ret
=
-
1
;
if
(
response
==
NULL
||
id
==
NULL
)
{
ERROR
(
"Invalid input arguments"
);
return
ret
;
}
*
response
=
(
im_storage_metadata_response
*
)
util_common_calloc_s
(
sizeof
(
im_storage_metadata_response
));
if
(
*
response
==
NULL
)
{
ERROR
(
"Out of memory"
);
return
ret
;
}
// TODO call storage metadata status interface
//ret = isula_do_storage_metadata(id, *response);
if
(
ret
!=
0
)
{
ERROR
(
"Get get storage metadata failed"
);
ret
=
-
1
;
goto
err_out
;
}
return
0
;
err_out:
free_im_storage_metadata_response
(
*
response
);
*
response
=
NULL
;
return
ret
;
}
int
oci_load_image
(
const
im_load_request
*
request
)
int
oci_load_image
(
const
im_load_request
*
request
)
{
{
int
ret
=
0
;
int
ret
=
0
;
...
...
src/image/oci/oci_image.h
浏览文件 @
6f761c56
...
@@ -38,10 +38,6 @@ int oci_umount_rf(const im_umount_request *request);
...
@@ -38,10 +38,6 @@ int oci_umount_rf(const im_umount_request *request);
int
oci_delete_rf
(
const
im_delete_request
*
request
);
int
oci_delete_rf
(
const
im_delete_request
*
request
);
int
oci_export_rf
(
const
im_export_request
*
request
);
int
oci_export_rf
(
const
im_export_request
*
request
);
int
oci_container_filesystem_usage
(
const
im_container_fs_usage_request
*
request
,
imagetool_fs_info
**
fs_usage
);
int
oci_container_filesystem_usage
(
const
im_container_fs_usage_request
*
request
,
imagetool_fs_info
**
fs_usage
);
int
oci_get_storage_status
(
im_storage_status_response
**
response
);
int
oci_get_storage_metadata
(
char
*
id
,
im_storage_metadata_response
**
response
);
int
oci_login
(
const
im_login_request
*
request
);
int
oci_login
(
const
im_login_request
*
request
);
int
oci_logout
(
const
im_logout_request
*
request
);
int
oci_logout
(
const
im_logout_request
*
request
);
...
...
src/image/oci/storage/layer_store/layer_store.c
浏览文件 @
6f761c56
...
@@ -1572,33 +1572,6 @@ unlock:
...
@@ -1572,33 +1572,6 @@ unlock:
return
ret
;
return
ret
;
}
}
struct
layer_store_status
*
layer_store_status
()
{
struct
graphdriver_status
*
d_status
=
NULL
;
struct
layer_store_status
*
result
=
NULL
;
d_status
=
graphdriver_get_status
();
if
(
d_status
==
NULL
)
{
return
NULL
;
}
result
=
util_common_calloc_s
(
sizeof
(
struct
layer_store_status
));
if
(
result
==
NULL
)
{
ERROR
(
"Out of memory"
);
goto
out
;
}
result
->
backing_fs
=
d_status
->
backing_fs
;
d_status
->
backing_fs
=
NULL
;
result
->
status
=
d_status
->
status
;
d_status
->
status
=
NULL
;
result
->
driver_name
=
d_status
->
driver_name
;
d_status
->
driver_name
=
NULL
;
out:
free_graphdriver_status
(
d_status
);
return
result
;
}
int
layer_store_try_repair_lowers
(
const
char
*
id
)
int
layer_store_try_repair_lowers
(
const
char
*
id
)
{
{
layer_t
*
l
=
NULL
;
layer_t
*
l
=
NULL
;
...
@@ -1643,18 +1616,3 @@ void free_layer_store_mount_opts(struct layer_store_mount_opts *ptr)
...
@@ -1643,18 +1616,3 @@ void free_layer_store_mount_opts(struct layer_store_mount_opts *ptr)
ptr
->
mount_opts
=
NULL
;
ptr
->
mount_opts
=
NULL
;
free
(
ptr
);
free
(
ptr
);
}
}
void
free_layer_store_status
(
struct
layer_store_status
*
ptr
)
{
if
(
ptr
==
NULL
)
{
return
;
}
free
(
ptr
->
backing_fs
);
ptr
->
backing_fs
=
NULL
;
free
(
ptr
->
driver_name
);
ptr
->
driver_name
=
NULL
;
free
(
ptr
->
status
);
ptr
->
status
=
NULL
;
free
(
ptr
);
}
src/image/oci/storage/layer_store/layer_store.h
浏览文件 @
6f761c56
...
@@ -41,12 +41,6 @@ struct layer_opts {
...
@@ -41,12 +41,6 @@ struct layer_opts {
struct
layer_store_mount_opts
*
opts
;
struct
layer_store_mount_opts
*
opts
;
};
};
struct
layer_store_status
{
char
*
driver_name
;
char
*
backing_fs
;
char
*
status
;
};
int
layer_store_init
(
const
struct
storage_module_init_options
*
conf
);
int
layer_store_init
(
const
struct
storage_module_init_options
*
conf
);
bool
layer_store_check
(
const
char
*
id
);
bool
layer_store_check
(
const
char
*
id
);
...
@@ -63,12 +57,10 @@ char *layer_store_mount(const char *id, const struct layer_store_mount_opts *opt
...
@@ -63,12 +57,10 @@ char *layer_store_mount(const char *id, const struct layer_store_mount_opts *opt
int
layer_store_umount
(
const
char
*
id
,
bool
force
);
int
layer_store_umount
(
const
char
*
id
,
bool
force
);
int
layer_store_mounted
(
const
char
*
id
);
int
layer_store_mounted
(
const
char
*
id
);
int
layer_store_set_names
(
const
char
*
id
,
const
char
*
const
*
names
,
size_t
names_len
);
int
layer_store_set_names
(
const
char
*
id
,
const
char
*
const
*
names
,
size_t
names_len
);
struct
layer_store_status
*
layer_store_status
();
int
layer_store_try_repair_lowers
(
const
char
*
id
);
int
layer_store_try_repair_lowers
(
const
char
*
id
);
void
free_layer_store_mount_opts
(
struct
layer_store_mount_opts
*
ptr
);
void
free_layer_store_mount_opts
(
struct
layer_store_mount_opts
*
ptr
);
void
free_layer_opts
(
struct
layer_opts
*
opts
);
void
free_layer_opts
(
struct
layer_opts
*
opts
);
void
free_layer_store_status
(
struct
layer_store_status
*
ptr
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
test/mocks/image_mock.cc
浏览文件 @
6f761c56
...
@@ -24,23 +24,6 @@ void MockImage_SetMock(MockImage* mock)
...
@@ -24,23 +24,6 @@ void MockImage_SetMock(MockImage* mock)
g_image_mock
=
mock
;
g_image_mock
=
mock
;
}
}
int
im_get_storage_status
(
const
char
*
image_type
,
im_storage_status_response
**
response
)
{
if
(
g_image_mock
!=
nullptr
)
{
return
g_image_mock
->
ImGetStorageStatus
(
image_type
,
response
);
}
return
-
1
;
}
void
free_im_storage_status_response
(
im_storage_status_response
*
ptr
)
{
if
(
g_image_mock
!=
nullptr
)
{
g_image_mock
->
FreeImStorageStatusResponse
(
ptr
);
return
;
}
return
;
}
int
im_container_export
(
const
im_export_request
*
request
)
int
im_container_export
(
const
im_export_request
*
request
)
{
{
if
(
g_image_mock
!=
nullptr
)
{
if
(
g_image_mock
!=
nullptr
)
{
...
...
test/mocks/image_mock.h
浏览文件 @
6f761c56
...
@@ -22,8 +22,6 @@
...
@@ -22,8 +22,6 @@
class
MockImage
{
class
MockImage
{
public:
public:
virtual
~
MockImage
()
=
default
;
virtual
~
MockImage
()
=
default
;
MOCK_METHOD2
(
ImGetStorageStatus
,
int
(
const
char
*
,
im_storage_status_response
**
));
MOCK_METHOD1
(
FreeImStorageStatusResponse
,
void
(
im_storage_status_response
*
));
MOCK_METHOD1
(
ImContainerExport
,
int
(
const
im_export_request
*
request
));
MOCK_METHOD1
(
ImContainerExport
,
int
(
const
im_export_request
*
request
));
MOCK_METHOD1
(
FreeImExportRequest
,
void
(
im_export_request
*
ptr
));
MOCK_METHOD1
(
FreeImExportRequest
,
void
(
im_export_request
*
ptr
));
MOCK_METHOD3
(
ImGetStorageMetadata
,
int
(
const
char
*
image_type
,
char
*
id
,
im_storage_metadata_response
**
response
));
MOCK_METHOD3
(
ImGetStorageMetadata
,
int
(
const
char
*
image_type
,
char
*
id
,
im_storage_metadata_response
**
response
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录