Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
defd05a0
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,发现更多精彩内容 >>
提交
defd05a0
编写于
8月 26, 2020
作者:
W
WangFengTu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix code review comment
Signed-off-by:
N
WangFengTu
<
wangfengtu@huawei.com
>
上级
749b0880
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
20 deletion
+16
-20
src/daemon/modules/image/oci/registry/registry.c
src/daemon/modules/image/oci/registry/registry.c
+12
-16
src/daemon/modules/image/oci/registry/registry_apiv2.c
src/daemon/modules/image/oci/registry/registry_apiv2.c
+4
-4
未找到文件。
src/daemon/modules/image/oci/registry/registry.c
浏览文件 @
defd05a0
...
...
@@ -101,13 +101,13 @@ static int parse_manifest_schema1(pull_descriptor *desc)
}
if
(
manifest
->
fs_layers_len
>
MAX_LAYER_NUM
||
manifest
->
fs_layers_len
==
0
)
{
ERROR
(
"Invalid layer number %
ld
, maxium is %d and it can't be 0"
,
manifest
->
fs_layers_len
,
MAX_LAYER_NUM
);
ERROR
(
"Invalid layer number %
zu
, maxium is %d and it can't be 0"
,
manifest
->
fs_layers_len
,
MAX_LAYER_NUM
);
ret
=
-
1
;
goto
out
;
}
if
(
manifest
->
fs_layers_len
!=
manifest
->
history_len
)
{
ERROR
(
"Invalid layer number %
ld do not match history number %ld
"
,
manifest
->
fs_layers_len
,
ERROR
(
"Invalid layer number %
zu do not match history number %zu
"
,
manifest
->
fs_layers_len
,
manifest
->
history_len
);
ret
=
-
1
;
goto
out
;
...
...
@@ -173,7 +173,7 @@ static int parse_manifest_schema2(pull_descriptor *desc)
desc
->
config
.
size
=
manifest
->
config
->
size
;
if
(
manifest
->
layers_len
>
MAX_LAYER_NUM
)
{
ERROR
(
"Invalid layer number %
ld
, maxium is %d"
,
manifest
->
layers_len
,
MAX_LAYER_NUM
);
ERROR
(
"Invalid layer number %
zu
, maxium is %d"
,
manifest
->
layers_len
,
MAX_LAYER_NUM
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -188,7 +188,7 @@ static int parse_manifest_schema2(pull_descriptor *desc)
for
(
i
=
0
;
i
<
manifest
->
layers_len
;
i
++
)
{
if
(
strcmp
(
manifest
->
layers
[
i
]
->
media_type
,
DOCKER_IMAGE_LAYER_TAR_GZIP
)
&&
strcmp
(
manifest
->
layers
[
i
]
->
media_type
,
DOCKER_IMAGE_LAYER_FOREIGN_TAR_GZIP
))
{
ERROR
(
"Unsupported layer's media type %s, layer index %
ld
"
,
manifest
->
layers
[
i
]
->
media_type
,
i
);
ERROR
(
"Unsupported layer's media type %s, layer index %
zu
"
,
manifest
->
layers
[
i
]
->
media_type
,
i
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -226,7 +226,7 @@ static int parse_manifest_ociv1(pull_descriptor *desc)
desc
->
config
.
size
=
manifest
->
config
->
size
;
if
(
manifest
->
layers_len
>
MAX_LAYER_NUM
)
{
ERROR
(
"Invalid layer number %
ld
, maxium is %d"
,
manifest
->
layers_len
,
MAX_LAYER_NUM
);
ERROR
(
"Invalid layer number %
zu
, maxium is %d"
,
manifest
->
layers_len
,
MAX_LAYER_NUM
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -243,7 +243,7 @@ static int parse_manifest_ociv1(pull_descriptor *desc)
strcmp
(
manifest
->
layers
[
i
]
->
media_type
,
OCI_IMAGE_LAYER_TAR
)
&&
strcmp
(
manifest
->
layers
[
i
]
->
media_type
,
OCI_IMAGE_LAYER_ND_TAR
)
&&
strcmp
(
manifest
->
layers
[
i
]
->
media_type
,
OCI_IMAGE_LAYER_ND_TAR_GZIP
))
{
ERROR
(
"Unsupported layer's media type %s, layer index %
ld
"
,
manifest
->
layers
[
i
]
->
media_type
,
i
);
ERROR
(
"Unsupported layer's media type %s, layer index %
zu
"
,
manifest
->
layers
[
i
]
->
media_type
,
i
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -1151,7 +1151,7 @@ static void *fetch_layer_in_thread(void *arg)
prctl
(
PR_SET_NAME
,
"fetch_layer"
);
if
(
fetch_layer
(
info
->
desc
,
info
->
index
)
!=
0
)
{
ERROR
(
"fetch layer %
ld
failed"
,
info
->
index
);
ERROR
(
"fetch layer %
zu
failed"
,
info
->
index
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -1163,7 +1163,7 @@ static void *fetch_layer_in_thread(void *arg)
if
(
is_manifest_schemav1
(
info
->
desc
->
manifest
.
media_type
))
{
diffid
=
oci_calc_diffid
(
info
->
file
);
if
(
diffid
==
NULL
)
{
ERROR
(
"calc diffid for layer %
ld
failed"
,
info
->
index
);
ERROR
(
"calc diffid for layer %
zu
failed"
,
info
->
index
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -1225,7 +1225,7 @@ static int add_fetch_task(thread_fetch_info *info)
if
(
cache
==
NULL
)
{
ret
=
pthread_create
(
&
tid
,
NULL
,
fetch_layer_in_thread
,
info
);
if
(
ret
!=
0
)
{
ERROR
(
"failed to start thread fetch layer %
d"
,
(
int
)
info
->
index
);
ERROR
(
"failed to start thread fetch layer %
zu"
,
info
->
index
);
goto
out
;
}
info
->
desc
->
pulling_number
++
;
...
...
@@ -1427,9 +1427,9 @@ static int fetch_all(pull_descriptor *desc)
// to get layers by compressed digest to reuse layer.
parent_chain_id
=
NULL
;
sret
=
snprintf
(
file
,
sizeof
(
file
),
"%s/%
d"
,
desc
->
blobpath
,
(
int
)
i
);
sret
=
snprintf
(
file
,
sizeof
(
file
),
"%s/%
zu"
,
desc
->
blobpath
,
i
);
if
(
sret
<
0
||
(
size_t
)
sret
>=
sizeof
(
file
))
{
ERROR
(
"Failed to sprintf file for layer %
d"
,
(
int
)
i
);
ERROR
(
"Failed to sprintf file for layer %
zu"
,
i
);
ret
=
-
1
;
break
;
}
...
...
@@ -1514,7 +1514,7 @@ static int create_config_from_v1config(pull_descriptor *desc)
if
(
manifest
->
fs_layers_len
!=
desc
->
layers_len
||
manifest
->
fs_layers_len
!=
manifest
->
history_len
||
manifest
->
history_len
==
0
)
{
ERROR
(
"Invalid length manifest, fs layers length %
ld, histroy length %ld, layers length %ld
"
,
ERROR
(
"Invalid length manifest, fs layers length %
zu, histroy length %zu, layers length %zu
"
,
manifest
->
fs_layers_len
,
manifest
->
history_len
,
desc
->
layers_len
);
ret
=
-
1
;
goto
out
;
...
...
@@ -1736,10 +1736,6 @@ static int prepare_pull_desc(pull_descriptor *desc, registry_pull_options *optio
desc
->
username
=
util_strdup_s
(
options
->
auth
.
username
);
desc
->
password
=
util_strdup_s
(
options
->
auth
.
password
);
}
else
{
free
(
desc
->
username
);
desc
->
username
=
NULL
;
free
(
desc
->
password
);
desc
->
password
=
NULL
;
ret
=
auths_load
(
desc
->
host
,
&
desc
->
username
,
&
desc
->
password
);
if
(
ret
!=
0
)
{
ERROR
(
"Failed to load auths for host %s"
,
desc
->
host
);
...
...
src/daemon/modules/image/oci/registry/registry_apiv2.c
浏览文件 @
defd05a0
...
...
@@ -1117,20 +1117,20 @@ int fetch_layer(pull_descriptor *desc, size_t index)
}
if
(
index
>=
desc
->
layers_len
)
{
ERROR
(
"Invalid layer index %
ld, total layer number %ld
"
,
index
,
desc
->
layers_len
);
ERROR
(
"Invalid layer index %
zu, total layer number %zu
"
,
index
,
desc
->
layers_len
);
return
-
1
;
}
sret
=
snprintf
(
file
,
sizeof
(
file
),
"%s/%
d"
,
desc
->
blobpath
,
(
int
)
index
);
sret
=
snprintf
(
file
,
sizeof
(
file
),
"%s/%
zu"
,
desc
->
blobpath
,
index
);
if
(
sret
<
0
||
(
size_t
)
sret
>=
sizeof
(
file
))
{
ERROR
(
"Failed to sprintf file for layer %
l
u"
,
index
);
ERROR
(
"Failed to sprintf file for layer %
z
u"
,
index
);
return
-
1
;
}
layer
=
&
desc
->
layers
[
index
];
sret
=
snprintf
(
path
,
sizeof
(
path
),
"/v2/%s/blobs/%s"
,
desc
->
name
,
layer
->
digest
);
if
(
sret
<
0
||
(
size_t
)
sret
>=
sizeof
(
path
))
{
ERROR
(
"Failed to sprintf path for layer %
ld
, name %s, digest %s"
,
index
,
desc
->
name
,
layer
->
digest
);
ERROR
(
"Failed to sprintf path for layer %
zu
, name %s, digest %s"
,
index
,
desc
->
name
,
layer
->
digest
);
ret
=
-
1
;
goto
out
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录