提交 c92ab5d6 编写于 作者: L lifeng68

rename storage container to rootfs

Signed-off-by: Nlifeng68 <lifeng68@huawei.com>
上级 8408ba1c
......@@ -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"
......
......@@ -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
)
# 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
)
......@@ -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 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) {
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)
cntrootfs_t *new_rootfs(storage_rootfs *scntr)
{
cntr_t *c = NULL;
cntrootfs_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);
......
......@@ -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 _cntrootfs_t {
storage_rootfs *scontainer;
uint64_t refcnt;
} cntr_t;
} cntrootfs_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);
cntrootfs_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
......@@ -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);
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.
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 */
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册