summaryrefslogtreecommitdiffstats
path: root/xlators/features/index/src
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2014-01-03 11:59:43 +0530
committerAnand Avati <avati@redhat.com>2014-01-14 00:31:20 -0800
commit54bf0ba4698a2d46db3485cc12ae04dd90349570 (patch)
tree17b3c8ef5c43e52db14f9bd00c92ecd82dceb385 /xlators/features/index/src
parent3af42583dd804371952d61e9d7ff4c640e67ba0d (diff)
consolidate code for #ifdef HAVE_LINKAT usage
sys_link() now does ifdef HAVE_LINKAT linkat (...) else link (...) endif Use sys_link() in all places where we previously had the conditional behavior. Change-Id: I8bce5ac1175efd2ba7ab4bb5b372f6d1e0365d28 BUG: 764655 Signed-off-by: Vijay Bellur <vbellur@redhat.com> Reviewed-on: http://review.gluster.org/6633 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/features/index/src')
-rw-r--r--xlators/features/index/src/index.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c
index 4ba72c02234..db592719b57 100644
--- a/xlators/features/index/src/index.c
+++ b/xlators/features/index/src/index.c
@@ -16,6 +16,7 @@
#include "options.h"
#include "glusterfs3-xdr.h"
#include "syncop.h"
+#include "syscall.h"
#define XATTROP_SUBDIR "xattrop"
#define BASE_INDICES_HOLDER_SUBDIR "base_indices_holder"
@@ -407,13 +408,8 @@ sync_base_indices (void *index_priv)
snprintf (base_index_path, PATH_MAX, "%s/%s",
base_indices_holder, entry->d_name);
-#ifdef HAVE_LINKAT
- /* see HAVE_LINKAT in xlators/storage/posix/src/posix.c */
- ret = linkat (AT_FDCWD, xattrop_index_path,
- AT_FDCWD, base_index_path, 0);
-#else
- ret = link (xattrop_index_path, base_index_path);
-#endif
+ ret = sys_link (xattrop_index_path, base_index_path);
+
if (ret && errno != EEXIST)
goto out;
@@ -549,12 +545,8 @@ index_add (xlator_t *this, uuid_t gfid, const char *subdir)
index_get_index (priv, index);
make_index_path (priv->index_basepath, subdir,
index, index_path, sizeof (index_path));
-#ifdef HAVE_LINKAT
- /* see HAVE_LINKAT in xlators/storage/posix/src/posix.c */
- ret = linkat (AT_FDCWD, index_path, AT_FDCWD, gfid_path, 0);
-#else
- ret = link (index_path, gfid_path);
-#endif
+
+ ret = sys_link (index_path, gfid_path);
if (!ret || (errno == EEXIST)) {
ret = 0;
index_created = 1;
@@ -587,12 +579,7 @@ index_add (xlator_t *this, uuid_t gfid, const char *subdir)
if (fd >= 0)
close (fd);
-#ifdef HAVE_LINKAT
- /* see HAVE_LINKAT in xlators/storage/posix/src/posix.c */
- ret = linkat (AT_FDCWD, index_path, AT_FDCWD, gfid_path, 0);
-#else
- ret = link (index_path, gfid_path);
-#endif
+ ret = sys_link (index_path, gfid_path);
if (ret && (errno != EEXIST)) {
gf_log (this->name, GF_LOG_ERROR, "%s: Not able to "
"add to index (%s)", uuid_utoa (gfid),
@@ -606,12 +593,7 @@ index_add (xlator_t *this, uuid_t gfid, const char *subdir)
make_index_path (priv->index_basepath,
GF_BASE_INDICES_HOLDER_GFID,
index, base_path, sizeof (base_path));
-#ifdef HAVE_LINKAT
- /* see HAVE_LINKAT in xlators/storage/posix/src/posix.c */
- ret = linkat (AT_FDCWD, index_path, AT_FDCWD, base_path, 0);
-#else
- ret = link (index_path, base_path);
-#endif
+ ret = sys_link (index_path, base_path);
if (ret)
goto out;
}