summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix-gfid-path.c
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2019-12-10 10:56:55 +0200
committerAmar Tumballi <amarts@gmail.com>2020-01-03 11:35:05 +0000
commit1e56e7acc3ced4f49d4494556bf6c86cd017b4ea (patch)
tree909b4e53b5a3bfb8b387092d0293a565044b6235 /xlators/storage/posix/src/posix-gfid-path.c
parent5cfd4553d163b96c9c409db68264d1b6af2fe49e (diff)
posix: improve posix_{set_gfid2path_xattr|remove_gfid2path_xattr} funcs
1. Move them to posix-entry-ops.c and make them static. 2. Remove useless 'val' parameter allocation and snprintf() in posix_set_gfid2path_xattr(), as it was identical to pgfid_bname. Change-Id: I41f3946c6c42aee9d7cf1150e21b442438fbcce2 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src/posix-gfid-path.c')
-rw-r--r--xlators/storage/posix/src/posix-gfid-path.c77
1 files changed, 0 insertions, 77 deletions
diff --git a/xlators/storage/posix/src/posix-gfid-path.c b/xlators/storage/posix/src/posix-gfid-path.c
index b5e141e..1b38e9b 100644
--- a/xlators/storage/posix/src/posix-gfid-path.c
+++ b/xlators/storage/posix/src/posix-gfid-path.c
@@ -18,83 +18,6 @@
#include "posix-gfid-path.h"
#include "posix.h"
-int32_t
-posix_set_gfid2path_xattr(xlator_t *this, const char *path, uuid_t pgfid,
- const char *bname)
-{
- char xxh64[GF_XXH64_DIGEST_LENGTH * 2 + 1] = {
- 0,
- };
- char pgfid_bname[1024] = {
- 0,
- };
- char *key = NULL;
- char *val = NULL;
- const size_t key_size = GFID2PATH_XATTR_KEY_PREFIX_LENGTH +
- GF_XXH64_DIGEST_LENGTH * 2 + 1;
- const size_t val_size = UUID_CANONICAL_FORM_LEN + NAME_MAX + 2;
- int ret = 0;
- int len;
-
- GF_VALIDATE_OR_GOTO("posix", this, err);
-
- len = snprintf(pgfid_bname, sizeof(pgfid_bname), "%s/%s", uuid_utoa(pgfid),
- bname);
- gf_xxh64_wrapper((unsigned char *)pgfid_bname, len,
- GF_XXHSUM64_DEFAULT_SEED, xxh64);
- key = alloca(key_size);
- snprintf(key, key_size, GFID2PATH_XATTR_KEY_PREFIX "%s", xxh64);
-
- val = alloca(val_size);
- len = snprintf(val, val_size, "%s/%s", uuid_utoa(pgfid), bname);
-
- ret = sys_lsetxattr(path, key, val, len, XATTR_CREATE);
- if (ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, errno, P_MSG_PGFID_OP,
- "setting gfid2path xattr failed on %s: key = %s ", path, key);
- goto err;
- }
- return 0;
-err:
- return -1;
-}
-
-int32_t
-posix_remove_gfid2path_xattr(xlator_t *this, const char *path, uuid_t pgfid,
- const char *bname)
-{
- char xxh64[GF_XXH64_DIGEST_LENGTH * 2 + 1] = {
- 0,
- };
- char pgfid_bname[1024] = {
- 0,
- };
- int ret = 0;
- char *key = NULL;
- const size_t key_size = GFID2PATH_XATTR_KEY_PREFIX_LENGTH +
- GF_XXH64_DIGEST_LENGTH * 2 + 1;
- int len;
-
- GF_VALIDATE_OR_GOTO("posix", this, err);
-
- len = snprintf(pgfid_bname, sizeof(pgfid_bname), "%s/%s", uuid_utoa(pgfid),
- bname);
- gf_xxh64_wrapper((unsigned char *)pgfid_bname, len,
- GF_XXHSUM64_DEFAULT_SEED, xxh64);
- key = alloca(key_size);
- snprintf(key, key_size, GFID2PATH_XATTR_KEY_PREFIX "%s", xxh64);
-
- ret = sys_lremovexattr(path, key);
- if (ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, errno, P_MSG_PGFID_OP,
- "removing gfid2path xattr failed on %s: key = %s", path, key);
- goto err;
- }
- return 0;
-err:
- return -1;
-}
-
gf_boolean_t
posix_is_gfid2path_xattr(const char *name)
{