diff options
author | Amar Tumballi <amarts@redhat.com> | 2013-09-10 17:40:04 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-11-13 11:43:48 -0800 |
commit | 5d7560e11e371919c97f78381c0d0c90885ce80f (patch) | |
tree | d446022be21e3b027b335e2981855c1a4983d43f /libglusterfs/src/inode.h | |
parent | cc742479562f085034b1ea969d4a5869d28a7136 (diff) |
libglusterfs/inode: introduce new APIs for ctx handling
* inode_ctx_reset{0,1,2}() for reseting value1, value2, and both respectively
* inode_ctx_get0() - to get the first value only
* inode_ctx_set0() - to set the first value only
* inode_ctx_get1() - to get the second value only
* inode_ctx_set1() - to set the second value only
Change-Id: I4dfbdac81d6a3f4e5784e060c76edabb1692ce03
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: http://review.gluster.org/5890
Reviewed-by: Anand Avati <avati@redhat.com>
Tested-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs/src/inode.h')
-rw-r--r-- | libglusterfs/src/inode.h | 62 |
1 files changed, 53 insertions, 9 deletions
diff --git a/libglusterfs/src/inode.h b/libglusterfs/src/inode.h index cf766a31bc6..a8897626545 100644 --- a/libglusterfs/src/inode.h +++ b/libglusterfs/src/inode.h @@ -73,10 +73,12 @@ struct _inode_ctx { uint64_t key; xlator_t *xl_key; }; + /* if value1 is 0, then field is not set.. */ union { uint64_t value1; void *ptr1; }; + /* if value2 is 0, then field is not set.. */ union { uint64_t value2; void *ptr2; @@ -159,6 +161,11 @@ __inode_path (inode_t *inode, const char *name, char **bufp); inode_t * inode_from_path (inode_table_t *table, const char *path); +inode_t * +inode_resolve (inode_table_t *table, char *path); + +/* deal with inode ctx's both values */ + int inode_ctx_set2 (inode_t *inode, xlator_t *xlator, uint64_t *value1, uint64_t *value2); @@ -177,29 +184,66 @@ int inode_ctx_del2 (inode_t *inode, xlator_t *xlator, uint64_t *value1, uint64_t *value2); -inode_t * -inode_resolve (inode_table_t *table, char *path); +int +inode_ctx_reset2 (inode_t *inode, xlator_t *xlator, uint64_t *value1, + uint64_t *value2); + +/* deal with inode ctx's 1st value */ + +int +inode_ctx_set0 (inode_t *inode, xlator_t *xlator, uint64_t *value1); + +int +__inode_ctx_set0 (inode_t *inode, xlator_t *xlator, uint64_t *value1); + +int +inode_ctx_get0 (inode_t *inode, xlator_t *xlator, uint64_t *value1); +int +__inode_ctx_get0 (inode_t *inode, xlator_t *xlator, uint64_t *value1); + +int +inode_ctx_reset0 (inode_t *inode, xlator_t *xlator, uint64_t *value1); + +/* deal with inode ctx's 2st value */ + +int +inode_ctx_set1 (inode_t *inode, xlator_t *xlator, uint64_t *value2); + +int +__inode_ctx_set1 (inode_t *inode, xlator_t *xlator, uint64_t *value2); + +int +inode_ctx_get1 (inode_t *inode, xlator_t *xlator, uint64_t *value2); +int +__inode_ctx_get1 (inode_t *inode, xlator_t *xlator, uint64_t *value2); + +int +inode_ctx_reset1 (inode_t *inode, xlator_t *xlator, uint64_t *value2); -#define __inode_ctx_set(i,x,v_p) __inode_ctx_set2(i,x,v_p,0) -#define inode_ctx_set(i,x,v_p) inode_ctx_set2(i,x,v_p,0) static inline int __inode_ctx_put(inode_t *inode, xlator_t *this, uint64_t v) { - return __inode_ctx_set2 (inode, this, &v, 0); + return __inode_ctx_set0 (inode, this, &v); } static inline int inode_ctx_put(inode_t *inode, xlator_t *this, uint64_t v) { - return inode_ctx_set2(inode, this, &v, 0); + return inode_ctx_set0 (inode, this, &v); } -#define __inode_ctx_get(i,x,v) __inode_ctx_get2(i,x,v,0) -#define inode_ctx_get(i,x,v) inode_ctx_get2(i,x,v,0) +#define __inode_ctx_set(i,x,v_p) __inode_ctx_set0(i,x,v_p) -#define inode_ctx_del(i,x,v) inode_ctx_del2(i,x,v,0) +#define inode_ctx_set(i,x,v_p) inode_ctx_set0(i,x,v_p) +#define inode_ctx_reset(i,x,v) inode_ctx_reset0(i,x,v) + +#define __inode_ctx_get(i,x,v) __inode_ctx_get0(i,x,v) + +#define inode_ctx_get(i,x,v) inode_ctx_get0(i,x,v) + +#define inode_ctx_del(i,x,v) inode_ctx_del2(i,x,v,0) gf_boolean_t __is_root_gfid (uuid_t gfid); |