diff options
Diffstat (limited to 'xlators/storage/posix/src/posix-handle.h')
-rw-r--r-- | xlators/storage/posix/src/posix-handle.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/xlators/storage/posix/src/posix-handle.h b/xlators/storage/posix/src/posix-handle.h index da48366e..5490d016 100644 --- a/xlators/storage/posix/src/posix-handle.h +++ b/xlators/storage/posix/src/posix-handle.h @@ -46,6 +46,22 @@ } \ } while (0) +#define SET_PGFID_XATTR_IF_ABSENT(path, key, value, flags, op_ret, this, label) \ + do { \ + op_ret = sys_lgetxattr (path, key, &value, sizeof (value)); \ + if (op_ret == -1) { \ + op_errno = errno; \ + if (op_errno == ENOATTR) { \ + SET_PGFID_XATTR (path, key, value, flags, \ + op_ret, this, label); \ + } else { \ + gf_log (this->name, GF_LOG_WARNING,"getting " \ + "xattr failed on %s: key = %s (%s)", \ + path, key, strerror (op_errno)); \ + } \ + } \ + } while (0) + #define REMOVE_PGFID_XATTR(path, key, op_ret, this, label) do { \ op_ret = sys_lremovexattr (path, key); \ if (op_ret == -1) { \ @@ -72,7 +88,6 @@ } else { \ value = ntoh32 (value); \ value++; \ - value = hton32 (value); \ } \ SET_PGFID_XATTR (path, key, value, flags, op_ret, this, label); \ } while (0) @@ -88,7 +103,6 @@ } else { \ value = ntoh32 (value); \ value--; \ - value = hton32 (value); \ if (value > 0) { \ SET_PGFID_XATTR (path, key, value, flags, op_ret, \ this, label); \ |