summaryrefslogtreecommitdiffstats
path: root/xlators/storage
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2017-12-27 16:14:30 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2018-01-05 09:35:07 +0000
commit92430596d697381d5f49ff69eb24d9ff3e291da8 (patch)
tree2a393ce9a5032f207ca38464a2db9bfc9f3c7045 /xlators/storage
parent01caa839ebda29c2fe209c4767626f2f49ea3e71 (diff)
dict: add more types for values
Added 2 more types which are present in gluster codebase, mainly IATT and UUID. Updates #203 Change-Id: Ib6d6d6aefb88c3494fbf93dcbe08d9979484968f Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'xlators/storage')
-rw-r--r--xlators/storage/posix/src/posix-entry-ops.c12
-rw-r--r--xlators/storage/posix/src/posix-helpers.c8
-rw-r--r--xlators/storage/posix/src/posix.h4
3 files changed, 12 insertions, 12 deletions
diff --git a/xlators/storage/posix/src/posix-entry-ops.c b/xlators/storage/posix/src/posix-entry-ops.c
index 050fea4c255..5fb3a4b09c8 100644
--- a/xlators/storage/posix/src/posix-entry-ops.c
+++ b/xlators/storage/posix/src/posix-entry-ops.c
@@ -314,7 +314,7 @@ posix_mknod (call_frame_t *frame, xlator_t *this,
gid_t gid = 0;
struct iatt preparent = {0,};
struct iatt postparent = {0,};
- void * uuid_req = NULL;
+ uuid_t uuid_req = {0,};
int32_t nlink_samepgfid = 0;
char *pgfid_xattr_key = NULL;
gf_boolean_t entry_created = _gf_false, gfid_set = _gf_false;
@@ -366,7 +366,7 @@ posix_mknod (call_frame_t *frame, xlator_t *this,
linkfile may be for a hardlinked file */
if (dict_get (xdata, GLUSTERFS_INTERNAL_FOP_KEY)) {
dict_del (xdata, GLUSTERFS_INTERNAL_FOP_KEY);
- op_ret = dict_get_ptr (xdata, "gfid-req", &uuid_req);
+ op_ret = dict_get_gfuuid (xdata, "gfid-req", &uuid_req);
if (op_ret) {
gf_msg_debug (this->name, 0, "failed to get the gfid from "
"dict for %s", loc->path);
@@ -523,7 +523,7 @@ posix_mkdir (call_frame_t *frame, xlator_t *this,
struct iatt preparent = {0,};
struct iatt postparent = {0,};
gf_boolean_t entry_created = _gf_false, gfid_set = _gf_false;
- void *uuid_req = NULL;
+ uuid_t uuid_req = {0,};
ssize_t size = 0;
dict_t *xdata_rsp = NULL;
void *disk_xattr = NULL;
@@ -580,7 +580,7 @@ posix_mkdir (call_frame_t *frame, xlator_t *this,
mode = posix_override_umask (mode, mode_bit);
if (xdata) {
- op_ret = dict_get_ptr (xdata, "gfid-req", &uuid_req);
+ op_ret = dict_get_gfuuid (xdata, "gfid-req", &uuid_req);
if (!op_ret && !gf_uuid_compare (stbuf.ia_gfid, uuid_req)) {
op_ret = -1;
op_errno = EEXIST;
@@ -588,7 +588,7 @@ posix_mkdir (call_frame_t *frame, xlator_t *this,
}
}
- if (uuid_req && !gf_uuid_is_null (uuid_req)) {
+ if (!gf_uuid_is_null (uuid_req)) {
op_ret = posix_istat (this, uuid_req, NULL, &stbuf);
if ((op_ret == 0) && IA_ISDIR (stbuf.ia_type)) {
size = posix_handle_path (this, uuid_req, NULL, NULL,
@@ -624,7 +624,7 @@ posix_mkdir (call_frame_t *frame, xlator_t *this,
* new dir.*/
posix_handle_unset (this, stbuf.ia_gfid, NULL);
}
- } else if (!uuid_req && frame->root->pid != GF_SERVER_PID_TRASH) {
+ } else if (frame->root->pid != GF_SERVER_PID_TRASH) {
op_ret = -1;
op_errno = EPERM;
gf_msg_callingfn (this->name, GF_LOG_WARNING, op_errno,
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index e299dcb837c..fa9a120ebcd 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -856,7 +856,7 @@ posix_gfid_unset (xlator_t *this, dict_t *xdata)
if (xdata == NULL)
goto out;
- ret = dict_get_ptr (xdata, "gfid-req", (void **)&uuid);
+ ret = dict_get_gfuuid (xdata, "gfid-req", &uuid);
if (ret) {
goto out;
}
@@ -869,7 +869,7 @@ out:
int
posix_gfid_set (xlator_t *this, const char *path, loc_t *loc, dict_t *xattr_req)
{
- void *uuid_req = NULL;
+ uuid_t uuid_req;
uuid_t uuid_curr;
int ret = 0;
ssize_t size = 0;
@@ -888,7 +888,7 @@ posix_gfid_set (xlator_t *this, const char *path, loc_t *loc, dict_t *xattr_req)
goto verify_handle;
}
- ret = dict_get_ptr (xattr_req, "gfid-req", &uuid_req);
+ ret = dict_get_gfuuid (xattr_req, "gfid-req", &uuid_req);
if (ret) {
gf_msg_debug (this->name, 0,
"failed to get the gfid from dict for %s",
@@ -2705,7 +2705,7 @@ posix_set_iatt_in_dict (dict_t *dict, struct iatt *in_stbuf)
memcpy (stbuf, in_stbuf, len);
- ret = dict_set_bin (dict, DHT_IATT_IN_XDATA_KEY, stbuf, len);
+ ret = dict_set_iatt (dict, DHT_IATT_IN_XDATA_KEY, stbuf, false);
if (ret)
GF_FREE (stbuf);
diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h
index c4c28d59977..330ed20b480 100644
--- a/xlators/storage/posix/src/posix.h
+++ b/xlators/storage/posix/src/posix.h
@@ -81,14 +81,14 @@
#define GFID_NULL_CHECK_AND_GOTO(frame, this, loc, xattr_req, op_ret, \
op_errno, out) \
do { \
- void *_uuid_req = NULL; \
+ uuid_t _uuid_req; \
int _ret = 0; \
/* TODO: Remove pid check once trash implements client side \
* logic to assign gfid for entry creations inside .trashcan \
*/ \
if (frame->root->pid == GF_SERVER_PID_TRASH) \
break; \
- _ret = dict_get_ptr (xattr_req, "gfid-req", &_uuid_req); \
+ _ret = dict_get_gfuuid (xattr_req, "gfid-req", &_uuid_req); \
if (_ret) { \
gf_msg (this->name, GF_LOG_ERROR, EINVAL, \
P_MSG_NULL_GFID, "failed to get the gfid from" \