From 618d465295df02ae6d53be1327947a210bb8b47d Mon Sep 17 00:00:00 2001 From: Emmanuel Dreyfus Date: Fri, 16 May 2014 16:58:20 +0200 Subject: NetBSD build fixes - Shell scripts: == is specific to bash and ksh. Use = instead. - Shell scripts: use sh instead of bash if bash functionnality is not used - Shell scripts: ${var/search/replace} is specific to bash - sed: The -i option is specific to GNU sed. - Makefiles: $< outside of generic rules only work in GNU make. - xdrproc_t() is not universally defined as variadic. Do not specify third argument if it is not used - NetBSD FUSE specific: only include in FUSE client code, it harms in other locations - configure: Search for gettext() in libintl as NetBSD stores it there - Like MacOS X, NetBSD has unmount(2) and not umount(2) (un vs u) Some other build issues previously included in this change were removed: - __THROW macro, addressed in http://review.gluster.com/#/c/7757/ - getmntent() compat shared with MacOS X, in http://review.gluster.com/#/c/7722/ This patchset adds warning fixes for mount_glusterfs BUG: 764655 Change-Id: I2f1faf8ff96362d3e2baf237b943df619011f1f4 Signed-off-by: Emmanuel Dreyfus Reviewed-on: http://review.gluster.org/7783 Tested-by: Gluster Build System Reviewed-by: Harshavardhana --- xlators/mgmt/glusterd/src/glusterd-snapshot.c | 3 +- xlators/mount/fuse/utils/mount.glusterfs.in | 44 +++++++++++++++------------ xlators/mount/fuse/utils/mount_glusterfs.in | 16 +++++----- 3 files changed, 34 insertions(+), 29 deletions(-) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c index e4aa838acaf..3a16d08a96b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c @@ -27,7 +27,6 @@ #endif #ifdef __NetBSD__ -#include #define umount2(dir, flags) unmount(dir, ((flags) != 0) ? MNT_FORCE : 0) #endif @@ -3687,7 +3686,7 @@ out: if (ret) { gf_log (this->name, GF_LOG_WARNING, "unmounting the snap brick" " mount %s", snap_brick_mount_path); -#if !defined(GF_DARWIN_HOST_OS) +#if !defined(GF_DARWIN_HOST_OS) && !defined(__NetBSD__) umount (snap_brick_mount_path); #else unmount (snap_brick_mount_path, 0); diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in index 71ea66c3ca8..154b8fa97e8 100755 --- a/xlators/mount/fuse/utils/mount.glusterfs.in +++ b/xlators/mount/fuse/utils/mount.glusterfs.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # Copyright (c) 2013 Red Hat, Inc. # This file is part of GlusterFS. @@ -37,7 +37,6 @@ _init () warn "WARNING: getfattr not found, certain checks will be skipped.." fi - alias lsL='ls -L' mounttab=/proc/mounts uname_s=`uname -s` case ${uname_s} in @@ -330,7 +329,7 @@ check_recursive_mount () # remove trailing / from mount point mnt_dir=${1%/}; - if [ -n ${getfattr} ]; then + if [ -n "${getfattr}" ]; then ${getfattr} -n trusted.gfid $mnt_dir 2>/dev/null | grep -iq "trusted.gfid="; if [ $? -eq 0 ]; then warn "ERROR: $mnt_dir is in use as a brick of a gluster volume"; @@ -341,7 +340,7 @@ check_recursive_mount () # check if the mount point is a brick's parent directory GLUSTERD_WORKDIR="/var/lib/glusterd"; - lsL "$GLUSTERD_WORKDIR"/vols/*/bricks/* > /dev/null 2>&1; + ls -L "$GLUSTERD_WORKDIR"/vols/*/bricks/* > /dev/null 2>&1; if [ $? -ne 0 ]; then return; fi @@ -358,7 +357,7 @@ check_recursive_mount () continue; fi - if [ -n ${getfattr} ]; then + if [ -n "${getfattr}" ]; then ${getfattr} -n trusted.gfid "$brick" 2>/dev/null | grep -iq "trusted.gfid="; if [ $? -eq 0 ]; then # brick is local @@ -452,17 +451,17 @@ with_options() use_readdirp=$value ;; "no-root-squash") - if [ $value == "yes" ] || - [ $value == "on" ] || - [ $value == "enable" ] || - [ $value == "true" ] ; then + if [ $value = "yes" ] || + [ $value = "on" ] || + [ $value = "enable" ] || + [ $value = "true" ] ; then no_root_squash=1; fi ;; "root-squash") - if [ $value == "no" ] || - [ $value == "off" ] || - [ $value == "disable" ] || - [ $value == "false" ] ; then + if [ $value = "no" ] || + [ $value = "off" ] || + [ $value = "disable" ] || + [ $value = "false" ] ; then no_root_squash=1; fi ;; *) @@ -521,7 +520,7 @@ without_options() parse_options() { local optarg=${1} - for pair in $(echo ${optarg//,/ }); do + for pair in $(echo ${optarg}|sed 's/,/ /g'); do key=$(echo "$pair" | cut -f1 -d'='); value=$(echo "$pair" | cut -f2- -d'='); if [ "$key" = "$value" ]; then @@ -549,16 +548,18 @@ update_updatedb() main () { + if [ "x${uname_s}" = "xLinux" ] ; then + volfile_loc=$1 + mount_point=$2 - volfile_loc=$1 - mount_point=$2 - - ## `mount` specifies options as a last argument - shift 2; + ## `mount` specifies options as a last argument + shift 2; + fi while getopts "Vo:h" opt; do case "${opt}" in o) parse_options ${OPTARG}; + shift 2; ;; V) ${cmd_line} -V; @@ -575,6 +576,11 @@ main () esac done + if [ "x${uname_s}" = "xNetBSD" ] ; then + volfile_loc=$1 + mount_point=$2 + fi + [ -r "$volfile_loc" ] || { server_ip=$(echo "$volfile_loc" | sed -n 's/\([a-zA-Z0-9:.\-]*\):.*/\1/p'); volume_str=$(echo "$volfile_loc" | sed -n 's/.*:\([^ ]*\).*/\1/p'); diff --git a/xlators/mount/fuse/utils/mount_glusterfs.in b/xlators/mount/fuse/utils/mount_glusterfs.in index 539b0f558c2..e0a06ea6925 100755 --- a/xlators/mount/fuse/utils/mount_glusterfs.in +++ b/xlators/mount/fuse/utils/mount_glusterfs.in @@ -380,17 +380,17 @@ with_options() use_readdirp=$value ;; "no-root-squash") - if [ $value == "yes" ] || - [ $value == "on" ] || - [ $value == "enable" ] || - [ $value == "true" ] ; then + if [ $value = "yes" ] || + [ $value = "on" ] || + [ $value = "enable" ] || + [ $value = "true" ] ; then no_root_squash=1; fi ;; "root-squash") - if [ $value == "no" ] || - [ $value == "off" ] || - [ $value == "disable" ] || - [ $value == "false" ] ; then + if [ $value = "no" ] || + [ $value = "off" ] || + [ $value = "disable" ] || + [ $value = "false" ] ; then no_root_squash=1; fi ;; *) -- cgit