diff options
author | Amar Tumballi <amarts@redhat.com> | 2018-01-05 13:51:18 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-01-17 00:00:11 +0000 |
commit | 9404b0de3fd8ab5adc3a531d4cb37b56e1e3908f (patch) | |
tree | b01d08009acb12182f411a4d0edb5b70b15a5cd4 /xlators | |
parent | 7ba7a4b27d124f4ee16fe4776a4670cd5b0160c4 (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')
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 5 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-common.c | 2 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-entry.c | 4 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 4 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-linkfile.c | 2 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 4 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-selfheal.c | 2 | ||||
-rw-r--r-- | xlators/cluster/stripe/src/stripe.c | 2 | ||||
-rw-r--r-- | xlators/features/changelog/src/changelog.c | 16 | ||||
-rw-r--r-- | xlators/features/changetimerecorder/src/changetimerecorder.c | 8 | ||||
-rw-r--r-- | xlators/features/gfid-access/src/gfid-access.c | 6 | ||||
-rw-r--r-- | xlators/features/shard/src/shard.c | 14 | ||||
-rw-r--r-- | xlators/features/trash/src/trash.c | 6 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs-fops.c | 4 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-handshake.c | 2 |
15 files changed, 33 insertions, 48 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 42a82f006b4..96419c6df5a 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -3163,7 +3163,6 @@ afr_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req) afr_local_t *local = NULL; int32_t op_errno = 0; int event = 0; - void *gfid_req = NULL; int ret = 0; if (loc_is_nameless (loc)) { @@ -3203,9 +3202,9 @@ afr_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req) op_errno = ENOMEM; goto out; } - ret = dict_get_ptr (local->xattr_req, "gfid-req", &gfid_req); + ret = dict_get_gfuuid (local->xattr_req, "gfid-req", + &local->cont.lookup.gfid_req); if (ret == 0) { - gf_uuid_copy (local->cont.lookup.gfid_req, gfid_req); dict_del (local->xattr_req, "gfid-req"); } } diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index 88a3d9618e3..311da68e8ee 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -60,7 +60,7 @@ afr_lookup_and_heal_gfid (xlator_t *this, inode_t *parent, const char *name, goto out; } - ret = dict_set_static_bin (xdata, "gfid-req", gfid, 16); + ret = dict_set_gfuuid (xdata, "gfid-req", gfid, true); if (ret) { ret = -ENOMEM; goto out; diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c index 647dd71911b..b601040504e 100644 --- a/xlators/cluster/afr/src/afr-self-heal-entry.c +++ b/xlators/cluster/afr/src/afr-self-heal-entry.c @@ -107,8 +107,8 @@ afr_selfheal_recreate_entry (call_frame_t *frame, int dst, int source, if (ret) goto out; - ret = dict_set_static_bin (xdata, "gfid-req", - replies[source].poststat.ia_gfid, 16); + ret = dict_set_gfuuid (xdata, "gfid-req", + replies[source].poststat.ia_gfid, true); if (ret) goto out; diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 4a16714177a..d54d54c5fc4 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -2895,8 +2895,8 @@ dht_lookup_directory (call_frame_t *frame, xlator_t *this, loc_t *loc) } if (!gf_uuid_is_null (local->gfid)) { - ret = dict_set_static_bin (local->xattr_req, "gfid-req", - local->gfid, 16); + ret = dict_set_gfuuid (local->xattr_req, "gfid-req", + local->gfid, true); if (ret) gf_msg (this->name, GF_LOG_WARNING, 0, DHT_MSG_DICT_SET_FAILED, diff --git a/xlators/cluster/dht/src/dht-linkfile.c b/xlators/cluster/dht/src/dht-linkfile.c index 101d93915b9..a6d994b4157 100644 --- a/xlators/cluster/dht/src/dht-linkfile.c +++ b/xlators/cluster/dht/src/dht-linkfile.c @@ -135,7 +135,7 @@ dht_linkfile_create (call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk, if (!gf_uuid_is_null (local->gfid)) { gf_uuid_unparse(local->gfid, gfid); - ret = dict_set_static_bin (dict, "gfid-req", local->gfid, 16); + ret = dict_set_gfuuid (dict, "gfid-req", local->gfid, true); if (ret) gf_msg ("dht-linkfile", GF_LOG_INFO, 0, DHT_MSG_DICT_SET_FAILED, diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index f48ba19cc3d..70d5a5f316f 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -692,7 +692,7 @@ __dht_rebalance_create_dst_file (xlator_t *this, xlator_t *to, xlator_t *from, "path:%s", loc->path); goto out; } - ret = dict_set_static_bin (dict, "gfid-req", stbuf->ia_gfid, 16); + ret = dict_set_gfuuid (dict, "gfid-req", stbuf->ia_gfid, true); if (ret) { *fop_errno = ENOMEM; ret = -1; @@ -1336,7 +1336,7 @@ migrate_special_files (xlator_t *this, xlator_t *from, xlator_t *to, loc_t *loc, } /* Set the gfid of the source file in dict */ - ret = dict_set_static_bin (dict, "gfid-req", buf->ia_gfid, 16); + ret = dict_set_gfuuid (dict, "gfid-req", buf->ia_gfid, true); if (ret) { *fop_errno = ENOMEM; ret = -1; diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index d137e1303e5..b3ca4c2c281 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -1392,7 +1392,7 @@ dht_selfheal_dir_mkdir_lookup_done (call_frame_t *frame, xlator_t *this) if (!dict) return -1; - ret = dict_set_static_bin (dict, "gfid-req", local->gfid, 16); + ret = dict_set_gfuuid (dict, "gfid-req", local->gfid, true); if (ret) gf_msg (this->name, GF_LOG_WARNING, 0, DHT_MSG_DICT_SET_FAILED, diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index 5a8bf1a9275..fae80c3e200 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -124,7 +124,7 @@ stripe_entry_self_heal (call_frame_t *frame, xlator_t *this, if (!xdata) goto out; - ret = dict_set_static_bin (xdata, "gfid-req", local->stbuf.ia_gfid, 16); + ret = dict_set_gfuuid (xdata, "gfid-req", local->stbuf.ia_gfid, true); if (ret) gf_log (this->name, GF_LOG_WARNING, "%s: failed to set gfid-req", local->loc.path); 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"); diff --git a/xlators/nfs/server/src/nfs-fops.c b/xlators/nfs/server/src/nfs-fops.c index f3741a40998..601f29fcef9 100644 --- a/xlators/nfs/server/src/nfs-fops.c +++ b/xlators/nfs/server/src/nfs-fops.c @@ -328,7 +328,7 @@ dict_t * nfs_gfid_dict (inode_t *inode) { uuid_t newgfid = {0, }; - char *dyngfid = NULL; + unsigned char *dyngfid = NULL; dict_t *dictgfid = NULL; int ret = -1; uuid_t rootgfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; @@ -353,7 +353,7 @@ nfs_gfid_dict (inode_t *inode) return (NULL); } - ret = dict_set_bin (dictgfid, "gfid-req", dyngfid, sizeof (uuid_t)); + ret = dict_set_gfuuid (dictgfid, "gfid-req", dyngfid, false); if (ret < 0) { GF_FREE (dyngfid); dict_unref (dictgfid); diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c index 9f4b2509ea8..acc1cb6ca75 100644 --- a/xlators/protocol/server/src/server-handshake.c +++ b/xlators/protocol/server/src/server-handshake.c @@ -328,7 +328,7 @@ do_path_lookup (xlator_t *xl, dict_t *dict, inode_t *parinode, char *basename) loc.inode = inode_new (xl->itable); gf_uuid_generate (gfid); - ret = dict_set_static_bin (dict, "gfid-req", gfid, 16); + ret = dict_set_gfuuid (dict, "gfid-req", gfid, true); if (ret) { gf_log (xl->name, GF_LOG_ERROR, "failed to set 'gfid-req' for subdir"); |