summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src
diff options
context:
space:
mode:
authorHarshavardhana <harsha@harshavardhana.net>2014-01-21 22:03:41 -0800
committerVijay Bellur <vbellur@redhat.com>2014-01-22 21:04:31 -0800
commit7bea98fa5845ced670d7bb2d9b1336c03855a798 (patch)
tree7055b91378c46bae6c3336835dbed00bf960a002 /xlators/storage/posix/src
parente48c5f8a84a1ec27492bcede0a028755a440be45 (diff)
storage/posix: HANDLE_PFX is redundant use GF_HIDDEN_PATH instead
GF_HIDDEN_PATH usage would help in better readability of the code and avoids bugs produced from redundant macro constants. Change-Id: I2fd7e92e87783ba462ae438ced2cf4f720a25f5c BUG: 990028 Signed-off-by: Harshavardhana <harsha@harshavardhana.net> Reviewed-on: http://review.gluster.org/6756 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src')
-rw-r--r--xlators/storage/posix/src/posix-handle.c22
-rw-r--r--xlators/storage/posix/src/posix-handle.h1
-rw-r--r--xlators/storage/posix/src/posix.h2
3 files changed, 12 insertions, 13 deletions
diff --git a/xlators/storage/posix/src/posix-handle.c b/xlators/storage/posix/src/posix-handle.c
index 613709fc8f1..adb8acc075d 100644
--- a/xlators/storage/posix/src/posix-handle.c
+++ b/xlators/storage/posix/src/posix-handle.c
@@ -145,7 +145,7 @@ posix_make_ancestryfromgfid (xlator_t *this, char *path, int pathsize,
dir_handle = alloca (handle_size);
linkname = alloca (PATH_MAX);
snprintf (dir_handle, handle_size, "%s/%s/%02x/%02x/%s",
- priv_base_path, HANDLE_PFX, gfid[0], gfid[1],
+ priv_base_path, GF_HIDDEN_PATH, gfid[0], gfid[1],
uuid_utoa (gfid));
len = readlink (dir_handle, linkname, PATH_MAX);
@@ -343,13 +343,13 @@ posix_handle_path (xlator_t *this, uuid_t gfid, const char *basename,
buf = alloca (maxlen);
}
- base_len = (priv->base_path_length + SLEN(HANDLE_PFX) + 45);
+ base_len = (priv->base_path_length + SLEN(GF_HIDDEN_PATH) + 45);
base_str = alloca (base_len + 1);
base_len = snprintf (base_str, base_len + 1, "%s/%s/%02x/%02x/%s",
- priv->base_path, HANDLE_PFX, gfid[0], gfid[1],
+ priv->base_path, GF_HIDDEN_PATH, gfid[0], gfid[1],
uuid_str);
- pfx_len = priv->base_path_length + 1 + SLEN(HANDLE_PFX) + 1;
+ pfx_len = priv->base_path_length + 1 + SLEN(GF_HIDDEN_PATH) + 1;
if (basename) {
len = snprintf (buf, maxlen, "%s/%s", base_str, basename);
@@ -391,7 +391,7 @@ posix_handle_gfid_path (xlator_t *this, uuid_t gfid, const char *basename,
len = priv->base_path_length /* option directory "/export" */
+ SLEN("/")
- + SLEN(HANDLE_PFX)
+ + SLEN(GF_HIDDEN_PATH)
+ SLEN("/")
+ SLEN("00/")
+ SLEN("00/")
@@ -422,10 +422,10 @@ posix_handle_gfid_path (xlator_t *this, uuid_t gfid, const char *basename,
if (basename) {
len = snprintf (buf, buflen, "%s/%s/%02x/%02x/%s/%s", priv->base_path,
- HANDLE_PFX, gfid[0], gfid[1], uuid_str, basename);
+ GF_HIDDEN_PATH, gfid[0], gfid[1], uuid_str, basename);
} else {
len = snprintf (buf, buflen, "%s/%s/%02x/%02x/%s", priv->base_path,
- HANDLE_PFX, gfid[0], gfid[1], uuid_str);
+ GF_HIDDEN_PATH, gfid[0], gfid[1], uuid_str);
}
out:
return len;
@@ -454,10 +454,10 @@ posix_handle_init (xlator_t *this)
return -1;
}
- handle_pfx = alloca (priv->base_path_length + 1 + strlen (HANDLE_PFX)
+ handle_pfx = alloca (priv->base_path_length + 1 + strlen (GF_HIDDEN_PATH)
+ 1);
- sprintf (handle_pfx, "%s/%s", priv->base_path, HANDLE_PFX);
+ sprintf (handle_pfx, "%s/%s", priv->base_path, GF_HIDDEN_PATH);
ret = stat (handle_pfx, &stbuf);
switch (ret) {
@@ -621,7 +621,7 @@ posix_handle_trash_init (xlator_t *this)
priv = this->private;
priv->trash_path = GF_CALLOC (1, priv->base_path_length + strlen ("/")
- + strlen (HANDLE_PFX) + strlen ("/")
+ + strlen (GF_HIDDEN_PATH) + strlen ("/")
+ strlen (TRASH_DIR) + 1,
gf_posix_mt_trash_path);
@@ -629,7 +629,7 @@ posix_handle_trash_init (xlator_t *this)
goto out;
strncpy (priv->trash_path, priv->base_path, priv->base_path_length);
- strcat (priv->trash_path, "/" HANDLE_PFX "/" TRASH_DIR);
+ strcat (priv->trash_path, "/" GF_HIDDEN_PATH "/" TRASH_DIR);
ret = posix_handle_new_trash_init (this, priv->trash_path);
if (ret)
goto out;
diff --git a/xlators/storage/posix/src/posix-handle.h b/xlators/storage/posix/src/posix-handle.h
index 8874ca2655f..31cbf83fd02 100644
--- a/xlators/storage/posix/src/posix-handle.h
+++ b/xlators/storage/posix/src/posix-handle.h
@@ -19,7 +19,6 @@
#include "xlator.h"
#include "gf-dirent.h"
-#define HANDLE_PFX ".glusterfs"
#define TRASH_DIR "landfill"
#define UUID0_STR "00000000-0000-0000-0000-000000000000"
diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h
index d579bf673db..91e0664ed2d 100644
--- a/xlators/storage/posix/src/posix.h
+++ b/xlators/storage/posix/src/posix.h
@@ -54,7 +54,7 @@
#define MAX_NO_VECT 1024
#define POSIX_GFID_HANDLE_SIZE(base_path_len) (base_path_len + SLEN("/") \
- + SLEN(HANDLE_PFX) + SLEN("/") \
+ + SLEN(GF_HIDDEN_PATH) + SLEN("/") \
+ SLEN("00/") \
+ SLEN("00/") + SLEN(UUID0_STR) + 1) /* '\0' */;