[sheepdog] [PATCH 7/8] plain: refine init() interface
Liu Yuan
namei.unix at gmail.com
Sun Mar 10 15:19:28 CET 2013
From: Liu Yuan <tailai.ly at taobao.com>
obj_path isn't a valid objects path for raid mode, so we should not pass
obj_path to store.init(), then we'd better completely remove it since we don't
need it for now.
Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
sheep/farm/farm.c | 10 +++++-----
sheep/group.c | 2 +-
sheep/ops.c | 2 +-
sheep/plain_store.c | 2 +-
sheep/sheep_priv.h | 4 ++--
sheep/store.c | 2 +-
6 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/sheep/farm/farm.c b/sheep/farm/farm.c
index 6c5f6b8..7becdd1 100644
--- a/sheep/farm/farm.c
+++ b/sheep/farm/farm.c
@@ -98,21 +98,21 @@ out:
return ret;
}
-static int farm_init(const char *p)
+static int farm_init(void)
{
sd_dprintf("use farm store driver");
- if (create_directory(p) < 0)
+ if (create_directory(obj_path) < 0)
goto err;
- if (!is_xattr_enabled(p)) {
- sd_eprintf("xattrs are not enabled on %s", p);
+ if (!is_xattr_enabled(obj_path)) {
+ sd_eprintf("xattrs are not enabled on %s", obj_path);
goto err;
}
if (snap_init() < 0)
goto err;
- if (default_init(p) < 0)
+ if (default_init() < 0)
goto err;
return SD_RES_SUCCESS;
diff --git a/sheep/group.c b/sheep/group.c
index c2070b4..83f8aa8 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -737,7 +737,7 @@ static void finish_join(const struct join_message *msg,
if (!sys->gateway_only && !sd_store && strlen((char *)msg->store)) {
sd_store = find_store_driver((char *)msg->store);
if (sd_store) {
- if (sd_store->init(obj_path) != SD_RES_SUCCESS)
+ if (sd_store->init() != SD_RES_SUCCESS)
panic("failed to initialize store");
if (set_cluster_store(sd_store->name) != SD_RES_SUCCESS)
panic("failed to store into config file");
diff --git a/sheep/ops.c b/sheep/ops.c
index ff3ebbe..b9634ae 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -255,7 +255,7 @@ static int cluster_make_fs(const struct sd_req *req, struct sd_rsp *rsp,
if (set_cluster_store(store_name) < 0)
return SD_RES_EIO;
- ret = sd_store->init(obj_path);
+ ret = sd_store->init();
if (ret != SD_RES_SUCCESS)
return ret;
diff --git a/sheep/plain_store.c b/sheep/plain_store.c
index d5fe6e2..ad55e09 100644
--- a/sheep/plain_store.c
+++ b/sheep/plain_store.c
@@ -217,7 +217,7 @@ static int init_objlist_and_vdi_bitmap(uint64_t oid, char *wd, void *arg)
return SD_RES_SUCCESS;
}
-int default_init(const char *p)
+int default_init(void)
{
int ret;
diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
index 010118b..24953c3 100644
--- a/sheep/sheep_priv.h
+++ b/sheep/sheep_priv.h
@@ -149,7 +149,7 @@ struct vdi_iocb {
struct store_driver {
struct list_head list;
const char *name;
- int (*init)(const char *path);
+ int (*init)(void);
bool (*exist)(uint64_t oid);
/* create_and_write must be an atomic operation*/
int (*create_and_write)(uint64_t oid, const struct siocb *);
@@ -170,7 +170,7 @@ struct store_driver {
int (*get_snap_file)(struct siocb *);
};
-int default_init(const char *p);
+int default_init(void);
bool default_exist(uint64_t oid);
int default_create_and_write(uint64_t oid, const struct siocb *iocb);
int default_write(uint64_t oid, const struct siocb *iocb);
diff --git a/sheep/store.c b/sheep/store.c
index e7512fb..d4203bd 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -310,7 +310,7 @@ int init_store_driver(void)
return SD_RES_NO_STORE;
}
- return sd_store->init(obj_path);
+ return sd_store->init();
}
int init_disk_space(const char *base_path)
--
1.7.9.5
More information about the sheepdog
mailing list