Future, we want to make an extension of the backend store using --store option.
For backend store expansion, internal function must be concealed,
so add a static declaration.

in order to adapt this modify, change the interface of md_exist().

Signed-off-by: Masaki Saeki <saeki.mas...@po.ntts.co.jp>
---
 sheep/md.c          |    5 +----
 sheep/plain_store.c |    8 ++++++--
 sheep/sheep_priv.h  |    3 +--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/sheep/md.c b/sheep/md.c
index 15687b2..4f0cd49 100644
--- a/sheep/md.c
+++ b/sheep/md.c
@@ -706,11 +706,8 @@ static int scan_wd(uint64_t oid, uint32_t epoch, uint8_t 
ec_index)
        return ret;
 }
 
-bool md_exist(uint64_t oid, uint8_t ec_index)
+bool md_exist(uint64_t oid, uint8_t ec_index, char *path)
 {
-       char path[PATH_MAX];
-
-       get_store_path(oid, ec_index, path);
        if (md_access(path))
                return true;
        /*
diff --git a/sheep/plain_store.c b/sheep/plain_store.c
index fef01ec..9614afa 100644
--- a/sheep/plain_store.c
+++ b/sheep/plain_store.c
@@ -44,7 +44,7 @@ static int prepare_iocb(uint64_t oid, const struct siocb 
*iocb, bool create)
        return flags;
 }
 
-int get_store_path(uint64_t oid, uint8_t ec_index, char *path)
+static int get_store_path(uint64_t oid, uint8_t ec_index, char *path)
 {
        if (is_erasure_oid(oid)) {
                if (unlikely(ec_index >= SD_MAX_COPIES))
@@ -82,7 +82,11 @@ static int get_store_stale_path(uint64_t oid, uint32_t 
epoch, uint8_t ec_index,
  */
 bool default_exist(uint64_t oid, uint8_t ec_index)
 {
-       return md_exist(oid, ec_index);
+       char path[PATH_MAX];
+
+       get_store_path(oid, ec_index, path);
+
+       return md_exist(oid, ec_index, path);
 }
 
 static int err_to_sderr(const char *path, uint64_t oid, int err)
diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
index f102fc7..85af7a0 100644
--- a/sheep/sheep_priv.h
+++ b/sheep/sheep_priv.h
@@ -278,7 +278,6 @@ int for_each_object_in_stale(int (*func)(uint64_t oid, 
const char *path,
                             void *arg);
 int for_each_obj_path(int (*func)(const char *path));
 size_t get_store_objsize(uint64_t oid);
-int get_store_path(uint64_t oid, uint8_t ec_index, char *path);
 
 extern struct list_head store_drivers;
 #define add_store_driver(driver)                               \
@@ -572,7 +571,7 @@ bool md_add_disk(const char *path, bool);
 uint64_t md_init_space(void);
 const char *md_get_object_dir(uint64_t oid);
 int md_handle_eio(const char *);
-bool md_exist(uint64_t oid, uint8_t ec_index);
+bool md_exist(uint64_t oid, uint8_t ec_index, char *path);
 int md_get_stale_path(uint64_t oid, uint32_t epoch, uint8_t ec_index, char *);
 uint32_t md_get_info(struct sd_md_info *info);
 int md_plug_disks(char *disks);
-- 
1.7.1



-- 
sheepdog mailing list
sheepdog@lists.wpkg.org
https://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to