From 1b74cf992986287a510fe3b28a8ee7554e8b0992 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sat, 21 Jun 2014 02:00:23 -0700 Subject: porting: Port for FreeBSD rebased from Mike Ma's efforts - Provides a working Gluster Management Daemon, CLI - Provides a working GlusterFS server, GlusterNFS server - Provides a working GlusterFS client - execinfo port from FreeBSD is moved into ./contrib/libexecinfo for ease of portability on NetBSD. (FreeBSD 10 and OSX provide execinfo natively) - More portability cleanups for Darwin, FreeBSD and NetBSD - Provides a new rc script for FreeBSD Change-Id: I8dff336f97479ca5a7f9b8c6b730051c0f8ac46f BUG: 1111774 Original-Author: Mike Ma Signed-off-by: Harshavardhana Reviewed-on: http://review.gluster.org/8141 Tested-by: Gluster Build System Reviewed-by: Kaleb KEITHLEY --- xlators/storage/posix/src/posix-handle.c | 2 ++ xlators/storage/posix/src/posix-helpers.c | 12 +++++++++++- xlators/storage/posix/src/posix.c | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'xlators/storage/posix') diff --git a/xlators/storage/posix/src/posix-handle.c b/xlators/storage/posix/src/posix-handle.c index 78aba988e31..b6cfbd081ea 100644 --- a/xlators/storage/posix/src/posix-handle.c +++ b/xlators/storage/posix/src/posix-handle.c @@ -26,6 +26,8 @@ #include "xlator.h" #include "syscall.h" +#include "compat-errno.h" + inode_t * posix_resolve (xlator_t *this, inode_table_t *itable, inode_t *parent, char *bname, struct iatt *iabuf) diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 143267637b5..c2f87c893d3 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -686,7 +686,7 @@ posix_gfid_set (xlator_t *this, const char *path, loc_t *loc, dict_t *xattr_req) } ret = sys_lsetxattr (path, GFID_XATTR_KEY, uuid_req, 16, XATTR_CREATE); - if (ret != 0) { + if (ret == -1) { gf_log (this->name, GF_LOG_WARNING, "setting GFID on %s failed (%s)", path, strerror (errno)); @@ -1268,6 +1268,11 @@ posix_acl_xattr_set (xlator_t *this, const char *path, dict_t *xattr_req) if (data) { ret = sys_lsetxattr (path, POSIX_ACL_ACCESS_XATTR, data->data, data->len, 0); +#ifdef __FreeBSD__ + if (ret != -1) { + ret = 0; + } +#endif /* __FreeBSD__ */ if (ret != 0) goto out; } @@ -1276,6 +1281,11 @@ posix_acl_xattr_set (xlator_t *this, const char *path, dict_t *xattr_req) if (data) { ret = sys_lsetxattr (path, POSIX_ACL_DEFAULT_XATTR, data->data, data->len, 0); +#ifdef __FreeBSD__ + if (ret != -1) { + ret = 0; + } +#endif /* __FreeBSD__ */ if (ret != 0) goto out; } diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 35e34c4bec6..ef98939c46d 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -5344,7 +5344,7 @@ init (xlator_t *this) /* Check for Extended attribute support, if not present, log it */ op_ret = sys_lsetxattr (dir_data->data, "trusted.glusterfs.test", "working", 8, 0); - if (op_ret == 0) { + if (op_ret != -1) { sys_lremovexattr (dir_data->data, "trusted.glusterfs.test"); } else { tmp_data = dict_get (this->options, @@ -5451,7 +5451,7 @@ init (xlator_t *this) /* First time volume, set the GFID */ size = sys_lsetxattr (dir_data->data, "trusted.gfid", rootgfid, 16, XATTR_CREATE); - if (size) { + if (size == -1) { gf_log (this->name, GF_LOG_ERROR, "%s: failed to set gfid (%s)", dir_data->data, strerror (errno)); -- cgit