diff options
author | Emmanuel Dreyfus <manu@netbsd.org> | 2014-05-16 16:58:20 +0200 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2014-05-17 11:53:34 -0700 |
commit | 618d465295df02ae6d53be1327947a210bb8b47d (patch) | |
tree | 5d6a8a489ab3fc339d478cd16c7401736f749df8 | |
parent | aa85de4be3f96a140a69170330293bfdfa3d24e7 (diff) |
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 <perfuse.h> 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 <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/7783
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Harshavardhana <harsha@harshavardhana.net>
-rwxr-xr-x | build-aux/pkg-version | 6 | ||||
-rwxr-xr-x | build-aux/xdrgen | 8 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rwxr-xr-x | extras/post-upgrade-script-for-quota.sh | 4 | ||||
-rwxr-xr-x | extras/pre-upgrade-script-for-quota.sh | 2 | ||||
-rw-r--r-- | rpc/xdr/src/Makefile.am | 72 | ||||
-rw-r--r-- | rpc/xdr/src/xdr-generic.c | 6 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapshot.c | 3 | ||||
-rwxr-xr-x | xlators/mount/fuse/utils/mount.glusterfs.in | 44 | ||||
-rwxr-xr-x | xlators/mount/fuse/utils/mount_glusterfs.in | 16 |
10 files changed, 85 insertions, 79 deletions
diff --git a/build-aux/pkg-version b/build-aux/pkg-version index 15efb154f6a..83d4a5f9136 100755 --- a/build-aux/pkg-version +++ b/build-aux/pkg-version @@ -1,11 +1,11 @@ -#!/bin/bash +#!/bin/sh # To override version/release from git, # create VERSION file containing text with version/release # eg. v3.4.0-1 PKG_VERSION=`cat VERSION 2> /dev/null || git describe --tags --match "v[0-9]*"` -function get_version () +get_version() { # tags and output versions: # - v3.4.0 => 3.4.0 (upstream clean) @@ -21,7 +21,7 @@ function get_version () echo $PKG_VERSION | awk "$AWK_VERSION" | tr -cd '[:alnum:].' } -function get_release () +get_release() { # tags and output releases: # - v3.4.0 => 0 (upstream clean) diff --git a/build-aux/xdrgen b/build-aux/xdrgen index e826111b9cc..c6dd5cc0340 100755 --- a/build-aux/xdrgen +++ b/build-aux/xdrgen @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh append_licence_header () { @@ -67,7 +67,7 @@ gen_headers () rm -f $hfile; rpcgen -h -o $hfile $xfile; # the '#ifdef' part of file should be fixed - sed -i -e 's/-/_/g' $hfile; + sed -e 's/-/_/g' $hfile > ${hfile}.new && mv ${hfile}.new $hfile; # Gen header to temp file and append generated file append_licence_header $hfile $tmp_hfile; # now move the destination file to actual original file @@ -85,11 +85,11 @@ main () exit 1; fi - if [ $1 == "header" ]; then + if [ $1 = "header" ]; then gen_headers $2 fi - if [ $1 == "source" ]; then + if [ $1 = "source" ]; then gen_sources $2 fi } diff --git a/configure.ac b/configure.ac index d16bcb12363..aa55fdba910 100644 --- a/configure.ac +++ b/configure.ac @@ -312,6 +312,7 @@ AC_CHECK_LIB([pthread], [pthread_mutex_init], , AC_MSG_ERROR([Posix threads libr AC_CHECK_FUNC([dlopen], [has_dlopen=yes], AC_CHECK_LIB([dl], [dlopen], , AC_MSG_ERROR([Dynamic linking library required to build glusterfs]))) AC_CHECK_LIB([readline], [rl_do_undo], [RL_UNDO="yes"], [RL_UNDO="no"]) +AC_CHECK_LIB([intl], [gettext]) AC_CHECK_HEADERS([sys/xattr.h]) @@ -859,7 +860,7 @@ AC_CHECK_LIB([readline -ltermcap],[readline],[RLLIBS="-lreadline -ltermcap"]) AC_CHECK_LIB([readline -lncurses],[readline],[RLLIBS="-lreadline -lncurses"]) if test "x$RLLIBS" != "x"; then - if test "x$RL_UNDO" == "xyes"; then + if test "x$RL_UNDO" = "xyes"; then AC_DEFINE(HAVE_READLINE, 1, [readline enabled CLI]) BUILD_READLINE=yes else diff --git a/extras/post-upgrade-script-for-quota.sh b/extras/post-upgrade-script-for-quota.sh index c226687935d..15652429056 100755 --- a/extras/post-upgrade-script-for-quota.sh +++ b/extras/post-upgrade-script-for-quota.sh @@ -15,7 +15,7 @@ BACKUP_DIR=/var/tmp/glusterfs/quota-config-backup function set_limits { local var=$(gluster volume info $1 | grep 'features.quota'| cut -d" " -f2); - if [ -z "$var" ] || [ "$var" == "off" ]; then + if [ -z "$var" ] || [ "$var" = "off" ]; then if [ $2 -eq '0' ]; then echo "Volume $1 does not have quota enabled. " \ "Exiting ..." @@ -54,7 +54,7 @@ if [ -z $1 ]; then exit 1; fi -if [ "$1" == "all" ]; then +if [ "$1" = "all" ]; then for VOL in `gluster volume list`; do set_limits $VOL '1'; diff --git a/extras/pre-upgrade-script-for-quota.sh b/extras/pre-upgrade-script-for-quota.sh index a8001e9e1fe..9ff15f3b307 100755 --- a/extras/pre-upgrade-script-for-quota.sh +++ b/extras/pre-upgrade-script-for-quota.sh @@ -10,7 +10,7 @@ BACKUP_DIR=/var/tmp/glusterfs/quota-config-backup mkdir -p $BACKUP_DIR for i in `gluster volume list`; do var=$(gluster volume info $i | grep 'features.quota'| cut -d" " -f2); - if [ -z "$var" ] || [ "$var" == "off" ]; then + if [ -z "$var" ] || [ "$var" = "off" ]; then continue else gluster volume quota $i list > $BACKUP_DIR/vol_$i; diff --git a/rpc/xdr/src/Makefile.am b/rpc/xdr/src/Makefile.am index 1c70dc9db19..af9e15cfddf 100644 --- a/rpc/xdr/src/Makefile.am +++ b/rpc/xdr/src/Makefile.am @@ -23,91 +23,91 @@ CLEANFILES = $(XDRSOURCES) $(XDRHEADERS) EXTRA_DIST = $(XDRGENFILES) glusterfs3-xdr.c: glusterfs3-xdr.x glusterfs3-xdr.h - @if test -f $<; then \ - $(top_srcdir)/build-aux/xdrgen source $< ; \ + @if test -f ${@:.c=.x}; then \ + $(top_srcdir)/build-aux/xdrgen source ${@:.c=.x} ; \ fi glusterfs3-xdr.h: glusterfs3-xdr.x - @if test -f $< ; then \ - $(top_srcdir)/build-aux/xdrgen header $< ; \ + @if test -f ${@:.h=.x} ; then \ + $(top_srcdir)/build-aux/xdrgen header ${@:.h=.x} ; \ fi cli1-xdr.c: cli1-xdr.x cli1-xdr.h - @if test -f $< ; then \ - $(top_srcdir)/build-aux/xdrgen source $< ; \ + @if test -f ${@:.c=.x} ; then \ + $(top_srcdir)/build-aux/xdrgen source ${@:.c=.x} ; \ fi cli1-xdr.h: cli1-xdr.x - @if test -f $< ; then \ - $(top_srcdir)/build-aux/xdrgen header $< ; \ + @if test -f ${@:.h=.x} ; then \ + $(top_srcdir)/build-aux/xdrgen header ${@:.h=.x} ; \ fi nlm4-xdr.c: nlm4-xdr.x nlm4-xdr.h - @if test -f $< ; then \ - $(top_srcdir)/build-aux/xdrgen source $< ; \ + @if test -f ${@:.c=.x} ; then \ + $(top_srcdir)/build-aux/xdrgen source ${@:.c=.x} ; \ fi nlm4-xdr.h: nlm4-xdr.x - @if test -f $< ; then \ - $(top_srcdir)/build-aux/xdrgen header $< ; \ + @if test -f ${@:.h=.x} ; then \ + $(top_srcdir)/build-aux/xdrgen header ${@:.h=.x} ; \ fi nsm-xdr.c: nsm-xdr.x nsm-xdr.h - @if test -f $< ; then \ - $(top_srcdir)/build-aux/xdrgen source $< ; \ + @if test -f ${@:.c=.x} ; then \ + $(top_srcdir)/build-aux/xdrgen source ${@:.c=.x} ; \ fi nsm-xdr.h: nsm-xdr.x - @if test -f $< ; then \ - $(top_srcdir)/build-aux/xdrgen header $< ; \ + @if test -f ${@:.h=.x} ; then \ + $(top_srcdir)/build-aux/xdrgen header ${@:.h=.x} ; \ fi rpc-common-xdr.c: rpc-common-xdr.x rpc-common-xdr.h - @if test -f $< ; then \ - $(top_srcdir)/build-aux/xdrgen source $< ; \ + @if test -f ${@:.c=.x} ; then \ + $(top_srcdir)/build-aux/xdrgen source ${@:.c=.x} ; \ fi rpc-common-xdr.h: rpc-common-xdr.x - @if test -f $< ; then \ - $(top_srcdir)/build-aux/xdrgen header $< ; \ + @if test -f ${@:.h=.x} ; then \ + $(top_srcdir)/build-aux/xdrgen header ${@:.h=.x} ; \ fi glusterd1-xdr.c: glusterd1-xdr.x glusterd1-xdr.h - @if test -f $< ; then \ - $(top_srcdir)/build-aux/xdrgen source $< ; \ + @if test -f ${@:.c=.x} ; then \ + $(top_srcdir)/build-aux/xdrgen source ${@:.c=.x} ; \ fi glusterd1-xdr.h: glusterd1-xdr.x - @if test -f $< ; then \ - $(top_srcdir)/build-aux/xdrgen header $< ; \ + @if test -f ${@:.h=.x} ; then \ + $(top_srcdir)/build-aux/xdrgen header ${@:.h=.x} ; \ fi acl3-xdr.c: acl3-xdr.x acl3-xdr.h - @if test -f $< ; then \ - $(top_srcdir)/build-aux/xdrgen source $< ; \ + @if test -f ${@:.c=.x} ; then \ + $(top_srcdir)/build-aux/xdrgen source ${@:.c=.x} ; \ fi acl3-xdr.h: acl3-xdr.x - @if test -f $< ; then \ - $(top_srcdir)/build-aux/xdrgen header $< ; \ + @if test -f ${@:.h=.x} ; then \ + $(top_srcdir)/build-aux/xdrgen header ${@:.h=.x} ; \ fi portmap-xdr.c: portmap-xdr.x portmap-xdr.h - @if test -f $< ; then \ - $(top_srcdir)/build-aux/xdrgen source $< ; \ + @if test -f ${@:.c=.x} ; then \ + $(top_srcdir)/build-aux/xdrgen source ${@:.c=.x} ; \ fi portmap-xdr.h: portmap-xdr.x - @if test -f $< ; then \ - $(top_srcdir)/build-aux/xdrgen header $< ; \ + @if test -f ${@:.h=.x} ; then \ + $(top_srcdir)/build-aux/xdrgen header ${@:.h=.x} ; \ fi mount3udp.c: mount3udp.x mount3udp.h - @if test -f $< ; then \ - $(top_srcdir)/build-aux/xdrgen source $< ; \ + @if test -f ${@:.c=.x} ; then \ + $(top_srcdir)/build-aux/xdrgen source ${@:.c=.x} ; \ fi mount3udp.h: mount3udp.x - @if test -f $< ; then \ - $(top_srcdir)/build-aux/xdrgen header $< ; \ + @if test -f ${@:.h=.x} ; then \ + $(top_srcdir)/build-aux/xdrgen header ${@:.h=.x} ; \ fi diff --git a/rpc/xdr/src/xdr-generic.c b/rpc/xdr/src/xdr-generic.c index ee29f3dfa4e..58d1ee77ee2 100644 --- a/rpc/xdr/src/xdr-generic.c +++ b/rpc/xdr/src/xdr-generic.c @@ -24,7 +24,7 @@ xdr_serialize_generic (struct iovec outmsg, void *res, xdrproc_t proc) xdrmem_create (&xdr, outmsg.iov_base, (unsigned int)outmsg.iov_len, XDR_ENCODE); - if (!proc (&xdr, res, 0)) { + if (!proc (&xdr, res)) { ret = -1; goto ret; } @@ -48,7 +48,7 @@ xdr_to_generic (struct iovec inmsg, void *args, xdrproc_t proc) xdrmem_create (&xdr, inmsg.iov_base, (unsigned int)inmsg.iov_len, XDR_DECODE); - if (!proc (&xdr, args, 0)) { + if (!proc (&xdr, args)) { ret = -1; goto ret; } @@ -72,7 +72,7 @@ xdr_to_generic_payload (struct iovec inmsg, void *args, xdrproc_t proc, xdrmem_create (&xdr, inmsg.iov_base, (unsigned int)inmsg.iov_len, XDR_DECODE); - if (!proc (&xdr, args, 0)) { + if (!proc (&xdr, args)) { ret = -1; goto ret; } 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 <perfuse.h> #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. <http://www.redhat.com> # 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 ;; *) |