summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/glusterfs.h
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2015-09-22 12:17:50 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-09-28 04:12:16 -0700
commitecfa2edd7816abbf8fbbe43c308ddf895849e8e6 (patch)
treec540eaa1779b1586fbbab48336de606f454c0704 /libglusterfs/src/glusterfs.h
parent7f33579e8a42eb19e92559a6c3acaeb92b6bb184 (diff)
posix: xattrop 'GF_XATTROP_ADD_ARRAY_WITH_DEFAULT' implementation
Implementation of xattrop type: GF_XATTROP_ADD_ARRAY_WITH_DEFAULT GF_XATTROP_ADD_ARRAY64_WITH_DEFAULT These operations are similar to 'GF_XATTROP_ADD_ARRAY', except that it adds a default value if xattr is missing or its value is zero on disk. One use-case of this operation is in inode-quota. When a new directory is created, its default dir_count should be set to 1. So when a xattrop performed setting inode-xattrs, it should account initial dir_count 1 if the xattrs are not present Here is the usage of this operation value required in xdata for each key struct array { int32_t newvalue_1; int32_t newvalue_2; ... int32_t newvalue_n; int32_t default_1; int32_t default_2; ... int32_t default_n; }; or struct array { int32_t value_1; int32_t value_2; ... int32_t value_n; } data[2]; fill data[0] with new value to add fill data[1] with default value xattrop GF_XATTROP_ADD_ARRAY_WITH_DEFAULT for i from 1 to n { if (xattr (dest_i) is zero or not set in the disk) dest_i = newvalue_i + default_i else dest_i = dest_i + newvalue_i } value in xdata after xattrop is successful struct array { int32_t dest_1; int32_t dest_2; ... int32_t dest_n; }; Change-Id: Ic6a08473e99fd98299a839d4d8416081a7534efd BUG: 1243946 Signed-off-by: vmallika <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/11702 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'libglusterfs/src/glusterfs.h')
-rw-r--r--libglusterfs/src/glusterfs.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 18ffbb1f2b1..fae7d490af8 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -373,7 +373,9 @@ typedef enum {
GF_XATTROP_ADD_ARRAY64,
GF_XATTROP_OR_ARRAY,
GF_XATTROP_AND_ARRAY,
- GF_XATTROP_GET_AND_SET
+ GF_XATTROP_GET_AND_SET,
+ GF_XATTROP_ADD_ARRAY_WITH_DEFAULT,
+ GF_XATTROP_ADD_ARRAY64_WITH_DEFAULT
} gf_xattrop_flags_t;
#define GF_SET_IF_NOT_PRESENT 0x1 /* default behaviour */