Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
c92ab5d6
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,发现更多精彩内容 >>
提交
c92ab5d6
编写于
5月 14, 2020
作者:
L
lifeng68
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename storage container to rootfs
Signed-off-by:
N
lifeng68
<
lifeng68@huawei.com
>
上级
8408ba1c
变更
9
展开全部
显示空白变更内容
内联
并排
Showing
9 changed file
with
217 addition
and
206 deletion
+217
-206
src/constants.h
src/constants.h
+1
-1
src/image/oci/storage/CMakeLists.txt
src/image/oci/storage/CMakeLists.txt
+3
-3
src/image/oci/storage/rootfs_store/CMakeLists.txt
src/image/oci/storage/rootfs_store/CMakeLists.txt
+11
-0
src/image/oci/storage/rootfs_store/rootfs.c
src/image/oci/storage/rootfs_store/rootfs.c
+13
-13
src/image/oci/storage/rootfs_store/rootfs.h
src/image/oci/storage/rootfs_store/rootfs.h
+11
-11
src/image/oci/storage/rootfs_store/rootfs_store.c
src/image/oci/storage/rootfs_store/rootfs_store.c
+154
-154
src/image/oci/storage/rootfs_store/rootfs_store.h
src/image/oci/storage/rootfs_store/rootfs_store.h
+23
-23
src/image/oci/storage/storage.h
src/image/oci/storage/storage.h
+1
-1
src/json/schema/schema/storage/rootfs.json
src/json/schema/schema/storage/rootfs.json
+0
-0
未找到文件。
src/constants.h
浏览文件 @
c92ab5d6
...
...
@@ -54,7 +54,7 @@
#define IMAGE_STORE_PATH_MODE 0700
#define
CONTAINER
_STORE_PATH_MODE 0700
#define
ROOTFS
_STORE_PATH_MODE 0700
#define ISULAD_CONFIG "/etc/isulad"
...
...
src/image/oci/storage/CMakeLists.txt
浏览文件 @
c92ab5d6
...
...
@@ -2,13 +2,13 @@
aux_source_directory
(
${
CMAKE_CURRENT_SOURCE_DIR
}
local_storage_srcs
)
add_subdirectory
(
image_store
)
add_subdirectory
(
layer_store
)
add_subdirectory
(
container
_store
)
add_subdirectory
(
rootfs
_store
)
set
(
STORAGE_SRCS
${
local_storage_srcs
}
${
IMAGE_STORE_SRCS
}
${
LAYER_STORE_SRCS
}
${
CONTAINER
_STORE_SRCS
}
${
ROOTFS
_STORE_SRCS
}
PARENT_SCOPE
)
...
...
@@ -16,6 +16,6 @@ set(STORAGE_INCS
${
CMAKE_CURRENT_SOURCE_DIR
}
${
IMAGE_STORE_INCS
}
${
LAYER_STORE_INCS
}
${
CONTAINER
_STORE_INCS
}
${
ROOTFS
_STORE_INCS
}
PARENT_SCOPE
)
src/image/oci/storage/
container
_store/CMakeLists.txt
→
src/image/oci/storage/
rootfs
_store/CMakeLists.txt
浏览文件 @
c92ab5d6
# get current directory sources files
aux_source_directory
(
${
CMAKE_CURRENT_SOURCE_DIR
}
local_
container
_store_srcs
)
aux_source_directory
(
${
CMAKE_CURRENT_SOURCE_DIR
}
local_
rootfs
_store_srcs
)
set
(
CONTAINER
_STORE_SRCS
${
local_
container
_store_srcs
}
set
(
ROOTFS
_STORE_SRCS
${
local_
rootfs
_store_srcs
}
PARENT_SCOPE
)
set
(
CONTAINER
_STORE_INCS
set
(
ROOTFS
_STORE_INCS
${
CMAKE_CURRENT_SOURCE_DIR
}
PARENT_SCOPE
)
src/image/oci/storage/
container_store/container
.c
→
src/image/oci/storage/
rootfs_store/rootfs
.c
浏览文件 @
c92ab5d6
...
...
@@ -12,18 +12,18 @@
* Create: 2020-05-12
* Description: provide container function definition
******************************************************************************/
#include "
container
.h"
#include "storage_
container
.h"
#include "
rootfs
.h"
#include "storage_
rootfs
.h"
#include "constants.h"
#include "util_atomic.h"
#include "utils.h"
#include "log.h"
static
cntr_t
*
create_empty_cntr
()
static
cntr
ootfs
_t
*
create_empty_cntr
()
{
cntr_t
*
result
=
NULL
;
cntr
ootfs
_t
*
result
=
NULL
;
result
=
(
cntr
_t
*
)
util_smart_calloc_s
(
sizeof
(
cntr
_t
),
1
);
result
=
(
cntr
ootfs_t
*
)
util_smart_calloc_s
(
sizeof
(
cntrootfs
_t
),
1
);
if
(
result
==
NULL
)
{
ERROR
(
"Out of memory"
);
goto
err_out
;
...
...
@@ -33,13 +33,13 @@ static cntr_t *create_empty_cntr()
return
result
;
err_out:
free_
container
_t
(
result
);
free_
rootfs
_t
(
result
);
return
NULL
;
}
cntr
_t
*
new_container
(
storage_container
*
scntr
)
cntr
ootfs_t
*
new_rootfs
(
storage_rootfs
*
scntr
)
{
cntr_t
*
c
=
NULL
;
cntr
ootfs
_t
*
c
=
NULL
;
if
(
scntr
==
NULL
)
{
ERROR
(
"Empty storage cntr"
);
...
...
@@ -57,7 +57,7 @@ cntr_t *new_container(storage_container *scntr)
}
void
container_ref_inc
(
cntr
_t
*
c
)
void
rootfs_ref_inc
(
cntrootfs
_t
*
c
)
{
if
(
c
==
NULL
)
{
return
;
...
...
@@ -65,7 +65,7 @@ void container_ref_inc(cntr_t *c)
atomic_int_inc
(
&
c
->
refcnt
);
}
void
container_ref_dec
(
cntr
_t
*
c
)
void
rootfs_ref_dec
(
cntrootfs
_t
*
c
)
{
bool
is_zero
=
false
;
...
...
@@ -78,15 +78,15 @@ void container_ref_dec(cntr_t *c)
return
;
}
free_
container
_t
(
c
);
free_
rootfs
_t
(
c
);
}
void
free_
container_t
(
cntr
_t
*
ptr
)
void
free_
rootfs_t
(
cntrootfs
_t
*
ptr
)
{
if
(
ptr
==
NULL
)
{
return
;
}
free_storage_
container
(
ptr
->
scontainer
);
free_storage_
rootfs
(
ptr
->
scontainer
);
ptr
->
scontainer
=
NULL
;
free
(
ptr
);
...
...
src/image/oci/storage/
container_store/container
.h
→
src/image/oci/storage/
rootfs_store/rootfs
.h
浏览文件 @
c92ab5d6
...
...
@@ -12,31 +12,31 @@
* Create: 2020-05-12
* Description: provide containers function definition
******************************************************************************/
#ifndef __OCI_STORAGE_
CONTAINER
_H
#define __OCI_STORAGE_
CONTAINER
_H
#ifndef __OCI_STORAGE_
ROOTFS
_H
#define __OCI_STORAGE_
ROOTFS
_H
#include <stdbool.h>
#include <stdint.h>
#include <pthread.h>
#include "storage_
container
.h"
#include "storage_
rootfs
.h"
#include "log.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
_cntr
_t_
{
storage_
container
*
scontainer
;
typedef
struct
_cntr
ootfs_t
{
storage_
rootfs
*
scontainer
;
uint64_t
refcnt
;
}
cntr_t
;
}
cntr
ootfs
_t
;
cntr
_t
*
new_container
(
storage_container
*
scntr
);
void
container_ref_inc
(
cntr
_t
*
cntr
);
void
container_ref_dec
(
cntr
_t
*
cntr
);
void
free_
container_t
(
cntr
_t
*
ptr
);
cntr
ootfs_t
*
new_rootfs
(
storage_rootfs
*
scntr
);
void
rootfs_ref_inc
(
cntrootfs
_t
*
cntr
);
void
rootfs_ref_dec
(
cntrootfs
_t
*
cntr
);
void
free_
rootfs_t
(
cntrootfs
_t
*
ptr
);
#ifdef __cplusplus
}
#endif
#endif // __OCI_STORAGE_
CONTAINER
_H
#endif // __OCI_STORAGE_
ROOTFS
_H
src/image/oci/storage/
container_store/container
_store.c
→
src/image/oci/storage/
rootfs_store/rootfs
_store.c
浏览文件 @
c92ab5d6
此差异已折叠。
点击以展开。
src/image/oci/storage/
container_store/container
_store.h
→
src/image/oci/storage/
rootfs_store/rootfs
_store.h
浏览文件 @
c92ab5d6
...
...
@@ -12,78 +12,78 @@
* Create: 2020-05-12
* Description: provide containers module interface definition
******************************************************************************/
#ifndef __OCI_STORAGE_
CONTAINER
_STORE_H
#define __OCI_STORAGE_
CONTAINER
_STORE_H
#ifndef __OCI_STORAGE_
ROOTFS
_STORE_H
#define __OCI_STORAGE_
ROOTFS
_STORE_H
#include <stdbool.h>
#include <string.h>
#include <pthread.h>
#include "storage.h"
#include "
container
.h"
#include "
rootfs
.h"
#ifdef __cplusplus
extern
"C"
{
#endif
// Load the containers in the folder(${driver}-containers)
int
container
_store_init
(
struct
storage_module_init_options
*
opts
);
int
rootfs
_store_init
(
struct
storage_module_init_options
*
opts
);
// Creates a container that has a specified ID (or generates a random one if an empty value is supplied)
// and optional names, based on the specified image, using the specified layer as its read-write layer.
// return a new id, or NULL if failed.
char
*
container
_store_create
(
const
char
*
id
,
const
char
**
names
,
size_t
names_len
,
const
char
*
image
,
const
char
*
layer
,
const
char
*
metadata
,
struct
storage_container_options
*
container
_opts
);
char
*
rootfs
_store_create
(
const
char
*
id
,
const
char
**
names
,
size_t
names_len
,
const
char
*
image
,
const
char
*
layer
,
const
char
*
metadata
,
struct
storage_rootfs_options
*
rootfs
_opts
);
// Attempt to translate a name to an ID. Most methods do this implicitly.
char
*
container
_store_lookup
(
const
char
*
id
);
char
*
rootfs
_store_lookup
(
const
char
*
id
);
// Remove the record of the container.
int
container
_store_delete
(
const
char
*
id
);
int
rootfs
_store_delete
(
const
char
*
id
);
// Remove records of all containers
int
container
_store_wipe
();
int
rootfs
_store_wipe
();
// Stores a (potentially large) piece of data associated with this ID.
int
container
_store_set_big_data
(
const
char
*
id
,
const
char
*
key
,
const
char
*
data
);
int
rootfs
_store_set_big_data
(
const
char
*
id
,
const
char
*
key
,
const
char
*
data
);
// Replace the list of names associated with a container with the supplied values.
int
container
_store_set_names
(
const
char
*
id
,
const
char
**
names
,
size_t
names_len
);
int
rootfs
_store_set_names
(
const
char
*
id
,
const
char
**
names
,
size_t
names_len
);
// Updates the metadata associated with the item with the specified ID.
int
container
_store_set_metadata
(
const
char
*
id
,
const
char
*
metadata
);
int
rootfs
_store_set_metadata
(
const
char
*
id
,
const
char
*
metadata
);
// Saves the contents of the store to disk.
int
container_store_save
(
cntr
_t
*
c
);
int
rootfs_store_save
(
cntrootfs
_t
*
c
);
// Check if there is a container with the given ID or name.
bool
container
_store_exists
(
const
char
*
id
);
bool
rootfs
_store_exists
(
const
char
*
id
);
// Retrieve information about a container given an ID or name.
cntr
_t
*
container_store_get_container
(
const
char
*
id
);
cntr
ootfs_t
*
rootfs_store_get_rootfs
(
const
char
*
id
);
// Retrieves a (potentially large) piece of data associated with this ID, if it has previously been set.
char
*
container
_store_big_data
(
const
char
*
id
,
const
char
*
key
);
char
*
rootfs
_store_big_data
(
const
char
*
id
,
const
char
*
key
);
// Retrieves the size of a (potentially large) piece of data associated with this ID, if it has previously been set.
int64_t
container
_store_big_data_size
(
const
char
*
id
,
const
char
*
key
);
int64_t
rootfs
_store_big_data_size
(
const
char
*
id
,
const
char
*
key
);
// Retrieves the digest of a (potentially large) piece of data associated with this ID, if it has previously been set.
char
*
container
_store_big_data_digest
(
const
char
*
id
,
const
char
*
key
);
char
*
rootfs
_store_big_data_digest
(
const
char
*
id
,
const
char
*
key
);
// Returns a list of the names of previously-stored pieces of data.
int
container
_store_big_data_names
(
const
char
*
id
,
char
***
names
,
size_t
*
names_len
);
int
rootfs
_store_big_data_names
(
const
char
*
id
,
char
***
names
,
size_t
*
names_len
);
// Reads metadata associated with an item with the specified ID.
char
*
container
_store_metadata
(
const
char
*
id
);
char
*
rootfs
_store_metadata
(
const
char
*
id
);
// Return a slice enumerating the known containers.
int
container_store_get_all_containers
(
cntr
_t
*
containers
,
size_t
*
len
);
int
rootfs_store_get_all_rootfs
(
cntrootfs
_t
*
containers
,
size_t
*
len
);
// Free memory of container store, but will not delete the persisted files
void
container
_store_free
();
void
rootfs
_store_free
();
#ifdef __cplusplus
}
#endif
#endif
/* __OCI_STORAGE_
CONTAINER
_STORE_H */
#endif
/* __OCI_STORAGE_
ROOTFS
_STORE_H */
src/image/oci/storage/storage.h
浏览文件 @
c92ab5d6
...
...
@@ -82,7 +82,7 @@ struct id_mapping_options {
size_t
gid_map_len
;
};
struct
storage_
container
_options
{
struct
storage_
rootfs
_options
{
struct
id_mapping_options
id_mapping_opts
;
char
**
label_opts
;
size_t
label_opts_len
;
...
...
src/json/schema/schema/storage/
container
.json
→
src/json/schema/schema/storage/
rootfs
.json
浏览文件 @
c92ab5d6
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录