提交 c92ab5d6 编写于 作者: L lifeng68

rename storage container to rootfs

Signed-off-by: Nlifeng68 <lifeng68@huawei.com>
上级 8408ba1c
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
#define IMAGE_STORE_PATH_MODE 0700 #define IMAGE_STORE_PATH_MODE 0700
#define CONTAINER_STORE_PATH_MODE 0700 #define ROOTFS_STORE_PATH_MODE 0700
#define ISULAD_CONFIG "/etc/isulad" #define ISULAD_CONFIG "/etc/isulad"
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} local_storage_srcs) aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} local_storage_srcs)
add_subdirectory(image_store) add_subdirectory(image_store)
add_subdirectory(layer_store) add_subdirectory(layer_store)
add_subdirectory(container_store) add_subdirectory(rootfs_store)
set(STORAGE_SRCS set(STORAGE_SRCS
${local_storage_srcs} ${local_storage_srcs}
${IMAGE_STORE_SRCS} ${IMAGE_STORE_SRCS}
${LAYER_STORE_SRCS} ${LAYER_STORE_SRCS}
${CONTAINER_STORE_SRCS} ${ROOTFS_STORE_SRCS}
PARENT_SCOPE PARENT_SCOPE
) )
...@@ -16,6 +16,6 @@ set(STORAGE_INCS ...@@ -16,6 +16,6 @@ set(STORAGE_INCS
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${IMAGE_STORE_INCS} ${IMAGE_STORE_INCS}
${LAYER_STORE_INCS} ${LAYER_STORE_INCS}
${CONTAINER_STORE_INCS} ${ROOTFS_STORE_INCS}
PARENT_SCOPE PARENT_SCOPE
) )
# get current directory sources files # 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 set(ROOTFS_STORE_SRCS
${local_container_store_srcs} ${local_rootfs_store_srcs}
PARENT_SCOPE PARENT_SCOPE
) )
set(CONTAINER_STORE_INCS set(ROOTFS_STORE_INCS
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
PARENT_SCOPE PARENT_SCOPE
) )
...@@ -12,18 +12,18 @@ ...@@ -12,18 +12,18 @@
* Create: 2020-05-12 * Create: 2020-05-12
* Description: provide container function definition * Description: provide container function definition
******************************************************************************/ ******************************************************************************/
#include "container.h" #include "rootfs.h"
#include "storage_container.h" #include "storage_rootfs.h"
#include "constants.h" #include "constants.h"
#include "util_atomic.h" #include "util_atomic.h"
#include "utils.h" #include "utils.h"
#include "log.h" #include "log.h"
static cntr_t *create_empty_cntr() static cntrootfs_t *create_empty_cntr()
{ {
cntr_t *result = NULL; cntrootfs_t *result = NULL;
result = (cntr_t *)util_smart_calloc_s(sizeof(cntr_t), 1); result = (cntrootfs_t *)util_smart_calloc_s(sizeof(cntrootfs_t), 1);
if (result == NULL) { if (result == NULL) {
ERROR("Out of memory"); ERROR("Out of memory");
goto err_out; goto err_out;
...@@ -33,13 +33,13 @@ static cntr_t *create_empty_cntr() ...@@ -33,13 +33,13 @@ static cntr_t *create_empty_cntr()
return result; return result;
err_out: err_out:
free_container_t(result); free_rootfs_t(result);
return NULL; return NULL;
} }
cntr_t *new_container(storage_container *scntr) cntrootfs_t *new_rootfs(storage_rootfs *scntr)
{ {
cntr_t *c = NULL; cntrootfs_t *c = NULL;
if (scntr == NULL) { if (scntr == NULL) {
ERROR("Empty storage cntr"); ERROR("Empty storage cntr");
...@@ -57,7 +57,7 @@ cntr_t *new_container(storage_container *scntr) ...@@ -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) { if (c == NULL) {
return; return;
...@@ -65,7 +65,7 @@ void container_ref_inc(cntr_t *c) ...@@ -65,7 +65,7 @@ void container_ref_inc(cntr_t *c)
atomic_int_inc(&c->refcnt); atomic_int_inc(&c->refcnt);
} }
void container_ref_dec(cntr_t *c) void rootfs_ref_dec(cntrootfs_t *c)
{ {
bool is_zero = false; bool is_zero = false;
...@@ -78,15 +78,15 @@ void container_ref_dec(cntr_t *c) ...@@ -78,15 +78,15 @@ void container_ref_dec(cntr_t *c)
return; 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) { if (ptr == NULL) {
return; return;
} }
free_storage_container(ptr->scontainer); free_storage_rootfs(ptr->scontainer);
ptr->scontainer = NULL; ptr->scontainer = NULL;
free(ptr); free(ptr);
......
...@@ -12,31 +12,31 @@ ...@@ -12,31 +12,31 @@
* Create: 2020-05-12 * Create: 2020-05-12
* Description: provide containers function definition * Description: provide containers function definition
******************************************************************************/ ******************************************************************************/
#ifndef __OCI_STORAGE_CONTAINER_H #ifndef __OCI_STORAGE_ROOTFS_H
#define __OCI_STORAGE_CONTAINER_H #define __OCI_STORAGE_ROOTFS_H
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <pthread.h> #include <pthread.h>
#include "storage_container.h" #include "storage_rootfs.h"
#include "log.h" #include "log.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
typedef struct _cntr_t_ { typedef struct _cntrootfs_t {
storage_container *scontainer; storage_rootfs *scontainer;
uint64_t refcnt; uint64_t refcnt;
} cntr_t; } cntrootfs_t;
cntr_t *new_container(storage_container *scntr); cntrootfs_t *new_rootfs(storage_rootfs *scntr);
void container_ref_inc(cntr_t *cntr); void rootfs_ref_inc(cntrootfs_t *cntr);
void container_ref_dec(cntr_t *cntr); void rootfs_ref_dec(cntrootfs_t *cntr);
void free_container_t(cntr_t *ptr); void free_rootfs_t(cntrootfs_t *ptr);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif // __OCI_STORAGE_CONTAINER_H #endif // __OCI_STORAGE_ROOTFS_H
...@@ -12,78 +12,78 @@ ...@@ -12,78 +12,78 @@
* Create: 2020-05-12 * Create: 2020-05-12
* Description: provide containers module interface definition * Description: provide containers module interface definition
******************************************************************************/ ******************************************************************************/
#ifndef __OCI_STORAGE_CONTAINER_STORE_H #ifndef __OCI_STORAGE_ROOTFS_STORE_H
#define __OCI_STORAGE_CONTAINER_STORE_H #define __OCI_STORAGE_ROOTFS_STORE_H
#include <stdbool.h> #include <stdbool.h>
#include <string.h> #include <string.h>
#include <pthread.h> #include <pthread.h>
#include "storage.h" #include "storage.h"
#include "container.h" #include "rootfs.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
// Load the containers in the folder(${driver}-containers) // 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) // 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. // 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. // 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, 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_container_options *container_opts); const char *metadata, struct storage_rootfs_options *rootfs_opts);
// Attempt to translate a name to an ID. Most methods do this implicitly. // 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. // 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 // Remove records of all containers
int container_store_wipe(); int rootfs_store_wipe();
// Stores a (potentially large) piece of data associated with this ID. // 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. // 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. // 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. // 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. // 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. // Retrieve information about a container given an ID or name.
cntr_t *container_store_get_container(const char *id); cntrootfs_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. // 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. // 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. // 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. // 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. // 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. // 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 // Free memory of container store, but will not delete the persisted files
void container_store_free(); void rootfs_store_free();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* __OCI_STORAGE_CONTAINER_STORE_H */ #endif /* __OCI_STORAGE_ROOTFS_STORE_H */
...@@ -82,7 +82,7 @@ struct id_mapping_options { ...@@ -82,7 +82,7 @@ struct id_mapping_options {
size_t gid_map_len; size_t gid_map_len;
}; };
struct storage_container_options { struct storage_rootfs_options {
struct id_mapping_options id_mapping_opts; struct id_mapping_options id_mapping_opts;
char **label_opts; char **label_opts;
size_t label_opts_len; size_t label_opts_len;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册