summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/glusterfs.h3
-rw-r--r--libglusterfs/src/syncop.c36
-rw-r--r--libglusterfs/src/syncop.h4
-rw-r--r--libglusterfs/src/xlator.c42
-rw-r--r--libglusterfs/src/xlator.h1
5 files changed, 85 insertions, 1 deletions
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 8d7659b5015..a810f3a81f0 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -128,11 +128,12 @@
#define GLUSTERFS_POSIXLK_COUNT "glusterfs.posixlk-count"
#define GLUSTERFS_PARENT_ENTRYLK "glusterfs.parent-entrylk"
#define GLUSTERFS_INODELK_DOM_COUNT "glusterfs.inodelk-dom-count"
-#define QUOTA_SIZE_KEY "trusted.glusterfs.quota.size"
#define GFID_TO_PATH_KEY "glusterfs.gfid2path"
#define GF_XATTR_STIME_PATTERN "trusted.glusterfs.*.stime"
#define GF_XATTR_TRIGGER_SYNC "glusterfs.geo-rep.trigger-sync"
+#define QUOTA_SIZE_KEY "trusted.glusterfs.quota.size"
+
/* Index xlator related */
#define GF_XATTROP_INDEX_GFID "glusterfs.xattrop_index_gfid"
#define GF_XATTROP_INDEX_COUNT "glusterfs.xattrop_index_count"
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index e3321cf6ddb..e241e2c1ee0 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -2537,3 +2537,39 @@ syncop_inodelk (xlator_t *subvol, const char *volume, loc_t *loc, int32_t cmd,
return args.op_ret;
}
+
+int32_t
+syncop_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *dict,
+ dict_t *xdata)
+{
+ struct syncargs *args = NULL;
+
+ args = cookie;
+
+ args->op_ret = op_ret;
+ args->op_errno = op_errno;
+
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ __wake (args);
+
+ return 0;
+
+}
+
+int
+syncop_xattrop (xlator_t *subvol, loc_t *loc, gf_xattrop_flags_t flags,
+ dict_t *dict, dict_t *xdata)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_xattrop_cbk, subvol->fops->xattrop,
+ loc, flags, dict, xdata);
+
+ if (args.op_ret < 0)
+ return -args.op_errno;
+
+ return args.op_ret;
+}
diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h
index 7f8ec7345b0..a9244a51552 100644
--- a/libglusterfs/src/syncop.h
+++ b/libglusterfs/src/syncop.h
@@ -439,4 +439,8 @@ syncop_inodelk (xlator_t *subvol, const char *volume, loc_t *loc, int32_t cmd,
int
syncop_ipc (xlator_t *subvol, int op, dict_t *xdata_in, dict_t **xdata_out);
+int
+syncop_xattrop (xlator_t *subvol, loc_t *loc, gf_xattrop_flags_t flags,
+ dict_t *dict, dict_t *xdata);
+
#endif /* _SYNCOP_H */
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 49af7d2e0e6..cc4726e0ea5 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -860,9 +860,51 @@ loc_is_root (loc_t *loc)
} else if (loc && loc->inode && __is_root_gfid (loc->inode->gfid)) {
return _gf_true;
}
+
return _gf_false;
}
+int32_t
+loc_build_child (loc_t *child, loc_t *parent, char *name)
+{
+ int32_t ret = -1;
+
+ GF_VALIDATE_OR_GOTO ("xlator", child, out);
+ GF_VALIDATE_OR_GOTO ("xlator", parent, out);
+ GF_VALIDATE_OR_GOTO ("xlator", name, out);
+
+ loc_gfid (parent, child->pargfid);
+
+ if (strcmp (parent->path, "/") == 0)
+ ret = gf_asprintf ((char **)&child->path, "/%s", name);
+ else
+ ret = gf_asprintf ((char **)&child->path, "%s/%s", parent->path,
+ name);
+
+ if (ret < 0 || !child->path) {
+ ret = -1;
+ goto out;
+ }
+
+ child->name = strrchr (child->path, '/') + 1;
+
+ child->parent = inode_ref (parent->inode);
+ child->inode = inode_new (parent->inode->table);
+
+ if (!child->inode) {
+ ret = -1;
+ goto out;
+ }
+
+ ret = 0;
+
+out:
+ if ((ret < 0) && child)
+ loc_wipe (child);
+
+ return ret;
+}
+
int
xlator_destroy (xlator_t *xl)
{
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index e953ec04372..733f6cf47ab 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -960,6 +960,7 @@ int loc_path (loc_t *loc, const char *bname);
void loc_gfid (loc_t *loc, uuid_t gfid);
char* loc_gfid_utoa (loc_t *loc);
gf_boolean_t loc_is_root (loc_t *loc);
+int32_t loc_build_child (loc_t *child, loc_t *parent, char *name);
int xlator_mem_acct_init (xlator_t *xl, int num_types);
int is_gf_log_command (xlator_t *trans, const char *name, char *value);
int glusterd_check_log_level (const char *value);