summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2018-01-05 13:51:18 +0530
committerAmar Tumballi <amarts@redhat.com>2018-01-17 00:00:11 +0000
commit9404b0de3fd8ab5adc3a531d4cb37b56e1e3908f (patch)
treeb01d08009acb12182f411a4d0edb5b70b15a5cd4 /xlators/features
parent7ba7a4b27d124f4ee16fe4776a4670cd5b0160c4 (diff)
core: fix some of the dict_{get,set} with proper APIs
updates #220 Change-Id: I6e25dbb69b2c7021e00073e8f025d212db7de0be Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/changelog/src/changelog.c16
-rw-r--r--xlators/features/changetimerecorder/src/changetimerecorder.c8
-rw-r--r--xlators/features/gfid-access/src/gfid-access.c6
-rw-r--r--xlators/features/shard/src/shard.c14
-rw-r--r--xlators/features/trash/src/trash.c6
5 files changed, 18 insertions, 32 deletions
diff --git a/xlators/features/changelog/src/changelog.c b/xlators/features/changelog/src/changelog.c
index caea8a59477..10a149232c2 100644
--- a/xlators/features/changelog/src/changelog.c
+++ b/xlators/features/changelog/src/changelog.c
@@ -627,7 +627,6 @@ changelog_mkdir (call_frame_t *frame, xlator_t *this,
{
int ret = -1;
uuid_t gfid = {0,};
- void *uuid_req = NULL;
size_t xtra_len = 0;
changelog_priv_t *priv = NULL;
changelog_opt_t *co = NULL;
@@ -638,13 +637,12 @@ changelog_mkdir (call_frame_t *frame, xlator_t *this,
priv = this->private;
CHANGELOG_NOT_ACTIVE_THEN_GOTO (frame, priv, wind);
- ret = dict_get_ptr (xdata, "gfid-req", &uuid_req);
+ ret = dict_get_gfuuid (xdata, "gfid-req", &gfid);
if (ret) {
gf_msg_debug (this->name, 0,
"failed to get gfid from dict");
goto wind;
}
- gf_uuid_copy (gfid, uuid_req);
CHANGELOG_INIT_NOCHECK (this, frame->local, NULL, gfid, 5);
@@ -767,7 +765,6 @@ changelog_symlink (call_frame_t *frame, xlator_t *this,
int ret = -1;
size_t xtra_len = 0;
uuid_t gfid = {0,};
- void *uuid_req = NULL;
changelog_priv_t *priv = NULL;
changelog_opt_t *co = NULL;
call_stub_t *stub = NULL;
@@ -777,13 +774,12 @@ changelog_symlink (call_frame_t *frame, xlator_t *this,
priv = this->private;
CHANGELOG_NOT_ACTIVE_THEN_GOTO (frame, priv, wind);
- ret = dict_get_ptr (xdata, "gfid-req", &uuid_req);
+ ret = dict_get_gfuuid (xdata, "gfid-req", &gfid);
if (ret) {
gf_msg_debug (this->name, 0,
"failed to get gfid from dict");
goto wind;
}
- gf_uuid_copy (gfid, uuid_req);
CHANGELOG_INIT_NOCHECK (this, frame->local, NULL, gfid, 2);
@@ -896,7 +892,6 @@ changelog_mknod (call_frame_t *frame,
{
int ret = -1;
uuid_t gfid = {0,};
- void *uuid_req = NULL;
size_t xtra_len = 0;
changelog_priv_t *priv = NULL;
changelog_opt_t *co = NULL;
@@ -924,13 +919,12 @@ changelog_mknod (call_frame_t *frame,
goto wind;
}
- ret = dict_get_ptr (xdata, "gfid-req", &uuid_req);
+ ret = dict_get_gfuuid (xdata, "gfid-req", &gfid);
if (ret) {
gf_msg_debug (this->name, 0,
"failed to get gfid from dict");
goto wind;
}
- gf_uuid_copy (gfid, uuid_req);
CHANGELOG_INIT_NOCHECK (this, frame->local, NULL, gfid, 5);
@@ -1071,7 +1065,6 @@ changelog_create (call_frame_t *frame, xlator_t *this,
{
int ret = -1;
uuid_t gfid = {0,};
- void *uuid_req = NULL;
changelog_opt_t *co = NULL;
changelog_priv_t *priv = NULL;
size_t xtra_len = 0;
@@ -1082,13 +1075,12 @@ changelog_create (call_frame_t *frame, xlator_t *this,
priv = this->private;
CHANGELOG_NOT_ACTIVE_THEN_GOTO (frame, priv, wind);
- ret = dict_get_ptr (xdata, "gfid-req", &uuid_req);
+ ret = dict_get_gfuuid (xdata, "gfid-req", &gfid);
if (ret) {
gf_msg_debug (this->name, 0,
"failed to get gfid from dict");
goto wind;
}
- gf_uuid_copy (gfid, uuid_req);
/* init with two extra records */
CHANGELOG_INIT_NOCHECK (this, frame->local, NULL, gfid, 5);
diff --git a/xlators/features/changetimerecorder/src/changetimerecorder.c b/xlators/features/changetimerecorder/src/changetimerecorder.c
index 74b610386d7..a9af008f807 100644
--- a/xlators/features/changetimerecorder/src/changetimerecorder.c
+++ b/xlators/features/changetimerecorder/src/changetimerecorder.c
@@ -1378,7 +1378,6 @@ ctr_mknod (call_frame_t *frame, xlator_t *this,
gf_ctr_inode_context_t *_inode_cx = &ctr_inode_cx;
gf_ctr_link_context_t ctr_link_cx;
gf_ctr_link_context_t *_link_cx = &ctr_link_cx;
- void *uuid_req = NULL;
uuid_t gfid = {0,};
uuid_t *ptr_gfid = &gfid;
@@ -1389,12 +1388,11 @@ ctr_mknod (call_frame_t *frame, xlator_t *this,
GF_ASSERT(frame->root);
/*get gfid from xdata dict*/
- ret = dict_get_ptr (xdata, "gfid-req", &uuid_req);
+ ret = dict_get_gfuuid (xdata, "gfid-req", &gfid);
if (ret) {
gf_msg_debug (this->name, 0, "failed to get gfid from dict");
goto out;
}
- gf_uuid_copy (gfid, uuid_req);
/*fill ctr link context*/
FILL_CTR_LINK_CX (_link_cx, loc->pargfid, loc->name, out);
@@ -1467,7 +1465,6 @@ ctr_create (call_frame_t *frame, xlator_t *this,
gf_ctr_inode_context_t *_inode_cx = &ctr_inode_cx;
gf_ctr_link_context_t ctr_link_cx;
gf_ctr_link_context_t *_link_cx = &ctr_link_cx;
- void *uuid_req = NULL;
uuid_t gfid = {0,};
uuid_t *ptr_gfid = &gfid;
struct iatt dummy_stat = {0};
@@ -1478,14 +1475,13 @@ ctr_create (call_frame_t *frame, xlator_t *this,
GF_ASSERT(frame->root);
/*Get GFID from Xdata dict*/
- ret = dict_get_ptr (xdata, "gfid-req", &uuid_req);
+ ret = dict_get_gfuuid (xdata, "gfid-req", &gfid);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
CTR_MSG_GET_GFID_FROM_DICT_FAILED,
"failed to get gfid from dict");
goto out;
}
- gf_uuid_copy (gfid, uuid_req);
/*fill ctr link context*/
FILL_CTR_LINK_CX(_link_cx, loc->pargfid, loc->name, out);
diff --git a/xlators/features/gfid-access/src/gfid-access.c b/xlators/features/gfid-access/src/gfid-access.c
index 7d75b09bae0..49d781c59ba 100644
--- a/xlators/features/gfid-access/src/gfid-access.c
+++ b/xlators/features/gfid-access/src/gfid-access.c
@@ -291,7 +291,7 @@ ga_fill_tmp_loc (loc_t *loc, xlator_t *this, uuid_t gfid,
int ret = -1;
uint64_t value = 0;
inode_t *parent = NULL;
- uuid_t *gfid_ptr = NULL;
+ unsigned char *gfid_ptr = NULL;
parent = loc->inode;
ret = inode_ctx_get (loc->inode, this, &value);
@@ -323,8 +323,8 @@ ga_fill_tmp_loc (loc_t *loc, xlator_t *this, uuid_t gfid,
ret = -1;
goto out;
}
- gf_uuid_copy (*gfid_ptr, gfid);
- ret = dict_set_dynptr (xdata, "gfid-req", gfid_ptr, sizeof (uuid_t));
+ gf_uuid_copy (gfid_ptr, gfid);
+ ret = dict_set_gfuuid (xdata, "gfid-req", gfid_ptr, false);
if (ret < 0)
goto out;
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c
index decc09fe188..35ad2bcf8b0 100644
--- a/xlators/features/shard/src/shard.c
+++ b/xlators/features/shard/src/shard.c
@@ -947,8 +947,8 @@ shard_lookup_dot_shard (call_frame_t *frame, xlator_t *this,
goto err;
}
- ret = dict_set_static_bin (xattr_req, "gfid-req", priv->dot_shard_gfid,
- 16);
+ ret = dict_set_gfuuid (xattr_req, "gfid-req", priv->dot_shard_gfid,
+ true);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0, SHARD_MSG_DICT_SET_FAILED,
"Failed to set gfid of /.shard into dict");
@@ -1751,7 +1751,7 @@ shard_create_gfid_dict (dict_t *dict)
{
int ret = 0;
dict_t *new = NULL;
- uuid_t *gfid = NULL;
+ unsigned char *gfid = NULL;
new = dict_copy_with_ref (dict, NULL);
if (!new)
@@ -1763,9 +1763,9 @@ shard_create_gfid_dict (dict_t *dict)
goto out;
}
- gf_uuid_generate (*gfid);
+ gf_uuid_generate (gfid);
- ret = dict_set_dynptr (new, "gfid-req", gfid, sizeof (uuid_t));
+ ret = dict_set_gfuuid (new, "gfid-req", gfid, false);
out:
if (ret) {
@@ -4168,8 +4168,8 @@ shard_mkdir_dot_shard (call_frame_t *frame, xlator_t *this,
if (ret)
goto err;
- ret = dict_set_static_bin (xattr_req, "gfid-req", priv->dot_shard_gfid,
- 16);
+ ret = dict_set_gfuuid (xattr_req, "gfid-req", priv->dot_shard_gfid,
+ true);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0, SHARD_MSG_DICT_SET_FAILED,
"Failed to set gfid-req for /.shard");
diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c
index 3baa828143a..cfdcc6ff5fc 100644
--- a/xlators/features/trash/src/trash.c
+++ b/xlators/features/trash/src/trash.c
@@ -553,8 +553,7 @@ trash_internalop_dir_lookup_cbk (call_frame_t *frame, void *cookie,
ret = ENOMEM;
goto out;
}
- ret = dict_set_dynptr (dict, "gfid-req", gfid_ptr,
- sizeof (uuid_t));
+ ret = dict_set_gfuuid (dict, "gfid-req", *gfid_ptr, false);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"setting key gfid-req failed");
@@ -692,8 +691,7 @@ trash_dir_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
/* Fixed gfid is set for trash directory with
* this function
*/
- ret = dict_set_dynptr (dict, "gfid-req", gfid_ptr,
- sizeof (uuid_t));
+ ret = dict_set_gfuuid (dict, "gfid-req", *gfid_ptr, false);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"setting key gfid-req failed");