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/mgmt/glusterd/src/glusterd-quota.c | 2 +- xlators/mgmt/glusterd/src/glusterd-snapshot.c | 11 ++++++++--- xlators/mgmt/glusterd/src/glusterd-store.c | 2 +- xlators/mgmt/glusterd/src/glusterd-utils.c | 9 ++++----- xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 2 +- 5 files changed, 15 insertions(+), 11 deletions(-) (limited to 'xlators/mgmt') diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c index 3e29a9601bc..e4a48439812 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quota.c +++ b/xlators/mgmt/glusterd/src/glusterd-quota.c @@ -482,7 +482,7 @@ glusterd_set_quota_limit (char *volname, char *path, char *hard_limit, ret = sys_lsetxattr (abspath, "trusted.glusterfs.quota.limit-set", (char *)(void *)&new_limit, sizeof (new_limit), 0); - if (ret) { + if (ret == -1) { gf_asprintf (op_errstr, "setxattr of " "'trusted.glusterfs.quota.limit-set' failed on %s." " Reason : %s", abspath, strerror (errno)); diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c index 3095414b88e..c1ddc0849cc 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c @@ -20,7 +20,7 @@ #include #include -#if !defined(__NetBSD__) && !defined(GF_DARWIN_HOST_OS) +#if defined(GF_LINUX_HOST_OS) #include #else #include "mntent_compat.h" @@ -30,7 +30,7 @@ #define umount2(dir, flags) unmount(dir, ((flags) != 0) ? MNT_FORCE : 0) #endif -#ifdef GF_DARWIN_HOST_OS +#if defined(GF_DARWIN_HOST_OS) || defined(__FreeBSD__) #include #include #define umount2(dir, flags) unmount(dir, ((flags) != 0) ? MNT_FORCE : 0) @@ -3743,7 +3743,7 @@ glusterd_snap_brick_create (glusterd_volinfo_t *snap_volinfo, GF_XATTR_VOL_ID_KEY, snap_volinfo->volume_id, 16, XATTR_REPLACE); - if (ret) { + if (ret == -1) { gf_log (this->name, GF_LOG_ERROR, "Failed to set " "extended attribute %s on %s. Reason: " "%s, snap: %s", GF_XATTR_VOL_ID_KEY, @@ -4043,8 +4043,13 @@ glusterd_update_fs_uuid (glusterd_brickinfo_t *brickinfo) * file-system which is sharing the UUID with any other * file-system on the system. */ +#ifdef GF_LINUX_HOST_OS ret = mount (brickinfo->device_path, mount_path, brickinfo->fstype, 0, "nouuid"); +#else + ret = -1; +#endif + if (ret) { gf_log (this->name, GF_LOG_ERROR, "Failed to mount " "%s at %s", brickinfo->device_path, diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index 0177ed169fc..e03ec7af9f5 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -45,7 +45,7 @@ #include #include -#if !defined(__NetBSD__) && !defined(GF_DARWIN_HOST_OS) +#if defined(GF_LINUX_HOST_OS) #include #else #include "mntent_compat.h" diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index fb677200a7e..6b973a3638d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -13,7 +13,7 @@ #endif #include -#if !defined(__NetBSD__) && !defined(GF_DARWIN_HOST_OS) +#if defined(GF_LINUX_HOST_OS) #include #else #include "mntent_compat.h" @@ -722,7 +722,7 @@ glusterd_snap_volinfo_restore (dict_t *dict, dict_t *rsp_dict, new_volinfo->volume_id, sizeof (new_volinfo->volume_id), XATTR_REPLACE); - if (ret) { + if (ret == -1) { gf_log (this->name, GF_LOG_ERROR, "Failed to " "set extended attribute %s on %s. " "Reason: %s, snap: %s", @@ -7438,7 +7438,6 @@ glusterd_add_brick_to_dict (glusterd_volinfo_t *volinfo, xlator_t *this = NULL; glusterd_conf_t *priv = NULL; - GF_ASSERT (volinfo); GF_ASSERT (brickinfo); GF_ASSERT (dict); @@ -8109,7 +8108,7 @@ glusterd_check_and_set_brick_xattr (char *host, char *path, uuid_t uuid, /* Check for xattr support in backend fs */ ret = sys_lsetxattr (path, "trusted.glusterfs.test", "working", 8, 0); - if (ret) { + if (ret == -1) { snprintf (msg, sizeof (msg), "Glusterfs is not" " supported on brick: %s:%s.\nSetting" " extended attributes failed, reason:" @@ -8135,7 +8134,7 @@ glusterd_check_and_set_brick_xattr (char *host, char *path, uuid_t uuid, ret = sys_lsetxattr (path, GF_XATTR_VOL_ID_KEY, uuid, 16, flags); - if (ret) { + if (ret == -1) { snprintf (msg, sizeof (msg), "Failed to set extended " "attributes %s, reason: %s", GF_XATTR_VOL_ID_KEY, strerror (errno)); diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index aa9805092fa..53beebe0555 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -1055,7 +1055,7 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr, GF_XATTR_VOL_ID_KEY, volinfo->volume_id, 16, XATTR_CREATE); - if (ret) { + if (ret == -1) { snprintf (msg, sizeof (msg), "Failed to set " "extended attribute %s on %s. Reason: " "%s", GF_XATTR_VOL_ID_KEY, -- cgit