This is a preparation patch. Signed-off-by: Liu Yuan <namei.unix at gmail.com> --- sheep/farm/trunk.c | 2 +- sheep/journal.c | 2 +- sheep/md.c | 13 +++++++------ sheep/plain_store.c | 4 ++-- sheep/sheep_priv.h | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/sheep/farm/trunk.c b/sheep/farm/trunk.c index eaa4193..c26f960 100644 --- a/sheep/farm/trunk.c +++ b/sheep/farm/trunk.c @@ -34,7 +34,7 @@ static int fill_entry_new_sha1(struct trunk_entry *entry) struct sha1_file_hdr hdr = { .priv = 0 }; memcpy(hdr.tag, TAG_DATA, TAG_LEN); - strbuf_addstr(&buf, get_object_path(entry->oid)); + strbuf_addstr(&buf, md_get_object_path(entry->oid)); strbuf_addf(&buf, "/%016" PRIx64, entry->oid); fd = open(buf.buf, O_RDONLY); if (fd < 0) { diff --git a/sheep/journal.c b/sheep/journal.c index e2fce5c..7c260d2 100644 --- a/sheep/journal.c +++ b/sheep/journal.c @@ -142,7 +142,7 @@ static void journal_get_path(struct journal_descriptor *jd, char *path) case JF_STORE: case JF_REMOVE_OBJ: snprintf(path, PATH_MAX, "%s/%016"PRIx64, - get_object_path(jd->oid), jd->oid); + md_get_object_path(jd->oid), jd->oid); if (jd->flag == JF_STORE) sd_iprintf("%s, size %"PRIu64", off %"PRIu64", %d", path, jd->size, jd->offset, jd->create); diff --git a/sheep/md.c b/sheep/md.c index 66abe79..291ffca 100644 --- a/sheep/md.c +++ b/sheep/md.c @@ -337,7 +337,7 @@ reinit: return total; } -char *get_object_path(uint64_t oid) +char *md_get_object_path(uint64_t oid) { struct vdisk *vd; char *p; @@ -351,7 +351,7 @@ char *get_object_path(uint64_t oid) return p; } -static char *get_object_path_nolock(uint64_t oid) +static char *md_get_object_path_nolock(uint64_t oid) { struct vdisk *vd; @@ -476,12 +476,12 @@ static int get_old_new_path(uint64_t oid, uint32_t epoch, char *path, if (!epoch) { snprintf(old, PATH_MAX, "%s/%016" PRIx64, path, oid); snprintf(new, PATH_MAX, "%s/%016" PRIx64, - get_object_path_nolock(oid), oid); + md_get_object_path_nolock(oid), oid); } else { snprintf(old, PATH_MAX, "%s/.stale/%016"PRIx64".%"PRIu32, path, oid, epoch); snprintf(new, PATH_MAX, "%s/.stale/%016"PRIx64".%"PRIu32, - get_object_path_nolock(oid), oid, epoch); + md_get_object_path_nolock(oid), oid, epoch); } if (!md_access(old)) @@ -566,7 +566,8 @@ bool md_exist(uint64_t oid) { char path[PATH_MAX]; - snprintf(path, PATH_MAX, "%s/%016" PRIx64, get_object_path(oid), oid); + snprintf(path, PATH_MAX, "%s/%016" PRIx64, md_get_object_path(oid), + oid); if (md_access(path)) return true; /* @@ -583,7 +584,7 @@ bool md_exist(uint64_t oid) int md_get_stale_path(uint64_t oid, uint32_t epoch, char *path) { snprintf(path, PATH_MAX, "%s/.stale/%016"PRIx64".%"PRIu32, - get_object_path(oid), oid, epoch); + md_get_object_path(oid), oid, epoch); if (md_access(path)) return SD_RES_SUCCESS; diff --git a/sheep/plain_store.c b/sheep/plain_store.c index 7f6b52d..2b40803 100644 --- a/sheep/plain_store.c +++ b/sheep/plain_store.c @@ -40,13 +40,13 @@ static int get_open_flags(uint64_t oid, bool create) static int get_obj_path(uint64_t oid, char *path) { return snprintf(path, PATH_MAX, "%s/%016" PRIx64, - get_object_path(oid), oid); + md_get_object_path(oid), oid); } static int get_tmp_obj_path(uint64_t oid, char *path) { return snprintf(path, PATH_MAX, "%s/%016"PRIx64".tmp", - get_object_path(oid), oid); + md_get_object_path(oid), oid); } static int get_stale_obj_path(uint64_t oid, uint32_t epoch, char *path) diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h index b66f348..d086aef 100644 --- a/sheep/sheep_priv.h +++ b/sheep/sheep_priv.h @@ -404,7 +404,7 @@ int journal_remove_object(uint64_t oid); /* md.c */ bool md_add_disk(char *path); uint64_t md_init_space(void); -char *get_object_path(uint64_t oid); +char *md_get_object_path(uint64_t oid); int md_handle_eio(char *); bool md_exist(uint64_t oid); int md_get_stale_path(uint64_t oid, uint32_t epoch, char *path); -- 1.7.9.5 |