build: MacOSX Porting fixes

git@forge.gluster.org:~schafdog/glusterfs-core/osx-glusterfs

Working functionality on MacOSX

 - GlusterD (management daemon)
 - GlusterCLI (management cli)
 - GlusterFS FUSE (using OSXFUSE)
 - GlusterNFS (without NLM - issues with rpc.statd)

Change-Id: I20193d3f8904388e47344e523b3787dbeab044ac
BUG: 1089172
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Signed-off-by: Dennis Schafroth <dennis@schafroth.com>
Tested-by: Harshavardhana <harsha@harshavardhana.net>
Tested-by: Dennis Schafroth <dennis@schafroth.com>
Reviewed-on: http://review.gluster.org/7503
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
This commit is contained in:
Harshavardhana 2014-04-17 15:54:34 -07:00 committed by Anand Avati
parent 9c13471b10
commit a3cb38e3ed
129 changed files with 2450 additions and 807 deletions

14
.gitignore vendored
View File

@ -8,7 +8,7 @@ install-sh
ltmain.sh
Makefile.in
missing
py-compile
*compile
*.gcda
*.gcno
*.sw?
@ -24,6 +24,9 @@ py-compile
.deps
Makefile
stamp-h1
# Softlinks to test and log
log
*.vol
# Generated files
api/examples/__init__.py
@ -39,11 +42,14 @@ extras/systemd/glusterd.service
extras/ocf/glusterd
extras/ocf/volume
extras/who-wrote-glusterfs/gitdm
extras/geo-rep/gsync-sync-gfid
glusterfs-api.pc
glusterfs.spec
glusterfsd/src/glusterfsd
glusterfsd/src/glusterd
glusterfsd/src/glusterfs
libgfchangelog.pc
libglusterfs/src/spec.lex.c
libglusterfs/src/graph.lex.c
libglusterfs/src/y.tab.c
libglusterfs/src/y.tab.h
libglusterfs/src/gf-error-codes.h
@ -54,3 +60,7 @@ xlators/mount/fuse/utils/mount_glusterfs
xlators/features/glupy/src/setup.py
geo-replication/src/peer_add_secret_pub
geo-replication/src/peer_gsec_create
geo-replication/src/gsyncd
cli/src/gluster
contrib/fuse-util/fusermount-glusterfs
geo-replication/src/gsyncd

View File

@ -31,6 +31,7 @@
#include "protocol-common.h"
#include "glusterfs3.h"
#include "portmap-xdr.h"
#include "xdr-common.h"
#include "xdr-generic.h"
#include "syncop.h"

View File

@ -21,7 +21,7 @@ AM_CPPFLAGS = $(GF_CPPFLAGS) \
-DSYNCDAEMON_COMPILE=$(SYNCDAEMON_COMPILE) -DSBIN_DIR=\"$(sbindir)\"\
$(XML_CPPFLAGS)
AM_CFLAGS = -Wall $(GF_GLUSTERFS_CFLAGS)
AM_CFLAGS = -Wall $(GF_CFLAGS)
CLEANFILES =

View File

@ -620,7 +620,7 @@ cli_cmd_quota_parse (const char **words, int wordcount, dict_t **options)
goto out;
}
ret = gf_string2bytesize (words[5], &value);
ret = gf_string2bytesize_uint64 (words[5], &value);
if (ret != 0) {
if (errno == ERANGE)
cli_err ("Value too large: %s", words[5]);
@ -1750,7 +1750,7 @@ config_parse (const char **words, int wordcount, dict_t *dict,
ret = -1;
goto out;
}
snprintf (append_str, 300, "now:%ld.%06ld",
snprintf (append_str, 300, "now:%" GF_PRI_SECOND ".%06"GF_PRI_SUSECONDS,
tv.tv_sec, tv.tv_usec);
}
@ -3025,7 +3025,7 @@ cli_snap_create_parse (dict_t *dict, const char **words, int wordcount) {
&& (strcmp (words[i], "force") != 0); i++) {
volcount++;
/* volume index starts from 1 */
ret = snprintf (key, sizeof (key), "volname%ld", volcount);
ret = snprintf (key, sizeof (key), "volname%"PRIu64, volcount);
if (ret < 0) {
goto out;
}

View File

@ -2008,14 +2008,14 @@ cli_print_detailed_status (cli_volume_status_t *status)
if (status->total_inodes) {
cli_out ("%-20s : %-20ld", "Inode Count",
cli_out ("%-20s : %-20"GF_PRI_INODE, "Inode Count",
status->total_inodes);
} else {
cli_out ("%-20s : %-20s", "Inode Count", "N/A");
}
if (status->free_inodes) {
cli_out ("%-20s : %-20ld", "Free Inodes",
cli_out ("%-20s : %-20"GF_PRI_INODE, "Free Inodes",
status->free_inodes);
} else {
cli_out ("%-20s : %-20s", "Free Inodes", "N/A");

View File

@ -5211,7 +5211,7 @@ gf_cli_top_volume_cbk (struct rpc_req *req, struct iovec *iov,
gf_time_fmt (timestr, sizeof timestr,
time_sec, gf_timefmt_FT);
snprintf (timestr + strlen (timestr), sizeof timestr - strlen (timestr),
".%"GF_PRI_SUSECONDS, time_usec);
".%ld", time_usec);
if (strlen (filename) < VOL_TOP_PERF_FILENAME_DEF_WIDTH)
cli_out ("%*"PRIu64" %-*s %-*s",
VOL_TOP_PERF_SPEED_WIDTH,
@ -7766,7 +7766,7 @@ cli_snapshot_config_display (dict_t *dict, gf_cli_rsp *rsp)
}
for (i = 0; i < voldisplaycount; i++) {
snprintf (buf, sizeof(buf), "volume%ld-volname", i);
snprintf (buf, sizeof(buf), "volume%"PRIu64"-volname", i);
ret = dict_get_str (dict, buf, &volname);
if (ret) {
gf_log ("cli", GF_LOG_ERROR, "Could not fetch "
@ -7777,7 +7777,7 @@ cli_snapshot_config_display (dict_t *dict, gf_cli_rsp *rsp)
cli_out ("\nVolume : %s", volname);
snprintf (buf, sizeof(buf),
"volume%ld-snap-max-hard-limit", i);
"volume%"PRIu64"-snap-max-hard-limit", i);
ret = dict_get_uint64 (dict, buf, &value);
if (ret) {
gf_log ("cli", GF_LOG_ERROR, "Could not fetch "
@ -7788,7 +7788,7 @@ cli_snapshot_config_display (dict_t *dict, gf_cli_rsp *rsp)
cli_out ("snap-max-hard-limit : %"PRIu64, value);
snprintf (buf, sizeof(buf),
"volume%ld-active-hard-limit", i);
"volume%"PRIu64"-active-hard-limit", i);
ret = dict_get_uint64 (dict, buf, &value);
if (ret) {
gf_log ("cli", GF_LOG_ERROR, "Could not fetch"
@ -7801,7 +7801,7 @@ cli_snapshot_config_display (dict_t *dict, gf_cli_rsp *rsp)
value);
snprintf (buf, sizeof(buf),
"volume%ld-snap-max-soft-limit", i);
"volume%"PRIu64"-snap-max-soft-limit", i);
ret = dict_get_uint64 (dict, buf, &value);
if (ret) {
gf_log ("cli", GF_LOG_ERROR, "Could not fetch "

View File

@ -2299,7 +2299,7 @@ cli_xml_output_vol_profile (dict_t *dict, int op_ret, int op_errno,
goto out;
ret = xmlTextWriterWriteFormatElement
(writer, (xmlChar *)"clearStats", "%s",
(writer, (xmlChar *)"clearStats", "%s",
stats_cleared ? "Cleared stats." :
"Failed to clear stats.");
if (ret)

View File

@ -179,7 +179,7 @@ logging_init (glusterfs_ctx_t *ctx, struct cli_state *state)
/* CLI should not have something to DEBUG after the release,
hence defaulting to INFO loglevel */
gf_log_set_loglevel ((state->log_level == -1) ? GF_LOG_INFO :
gf_log_set_loglevel ((state->log_level == GF_LOG_NONE) ? GF_LOG_INFO :
state->log_level);
return 0;

View File

@ -14,6 +14,9 @@ AC_SUBST([PACKAGE_RELEASE],
[m4_esyscmd([build-aux/pkg-version --release])])
AM_INIT_AUTOMAKE
# Removes warnings when using automake 1.14 around (...but option 'subdir-objects' is disabled )
#but libglusterfs fails to build with contrib (Then are not set up that way?)
#AM_INIT_AUTOMAKE([subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
@ -104,10 +107,10 @@ AC_CONFIG_FILES([Makefile
xlators/protocol/server/Makefile
xlators/protocol/server/src/Makefile
xlators/features/Makefile
xlators/features/changelog/Makefile
xlators/features/changelog/src/Makefile
xlators/features/changelog/lib/Makefile
xlators/features/changelog/lib/src/Makefile
xlators/features/changelog/Makefile
xlators/features/changelog/src/Makefile
xlators/features/changelog/lib/Makefile
xlators/features/changelog/lib/src/Makefile
xlators/features/glupy/Makefile
xlators/features/glupy/examples/Makefile
xlators/features/glupy/src/Makefile
@ -142,8 +145,8 @@ AC_CONFIG_FILES([Makefile
xlators/encryption/rot-13/src/Makefile
xlators/encryption/crypt/Makefile
xlators/encryption/crypt/src/Makefile
xlators/features/qemu-block/Makefile
xlators/features/qemu-block/src/Makefile
xlators/features/qemu-block/Makefile
xlators/features/qemu-block/src/Makefile
xlators/system/Makefile
xlators/system/posix-acl/Makefile
xlators/system/posix-acl/src/Makefile
@ -189,9 +192,9 @@ AC_CONFIG_FILES([Makefile
api/examples/Makefile
api/examples/__init__.py
api/examples/setup.py
geo-replication/Makefile
geo-replication/src/Makefile
geo-replication/syncdaemon/Makefile
geo-replication/Makefile
geo-replication/src/Makefile
geo-replication/syncdaemon/Makefile
glusterfs.spec])
AC_CANONICAL_HOST
@ -286,20 +289,24 @@ 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_FUNC([gettext], [has_gettext=yes], AC_CHECK_LIB([intl], [gettext], , AC_MSG_ERROR([gettext support is required to build glusterfs])))
AC_CHECK_LIB([readline], [rl_do_undo], [RL_UNDO="yes"], [RL_UNDO="no"])
AC_CHECK_HEADERS([sys/xattr.h])
AC_CHECK_HEADERS([sys/ioctl.h], AC_DEFINE(HAVE_IOCTL_IN_SYS_IOCTL_H, 1, [have sys/ioctl.h]))
AC_CHECK_HEADERS([sys/extattr.h])
AC_CHECK_HEADERS([openssl/md5.h])
AC_CHECK_HEADERS([linux/falloc.h])
AC_CHECK_HEADERS([libintl.h])
case $host_os in
darwin*)
if ! test "`/usr/bin/sw_vers | grep ProductVersion: | cut -f 2 | cut -d. -f2`" -ge 5; then
AC_MSG_ERROR([You need at least OS X 10.5 (Leopard) to build Glusterfs])
if ! test "`/usr/bin/sw_vers | grep ProductVersion: | cut -f 2 | cut -d. -f2`" -ge 7; then
AC_MSG_ERROR([You need at least OS X 10.7 (Lion) to build Glusterfs])
fi
;;
esac
@ -326,6 +333,12 @@ if test "x${have_setfsuid}" = "xyes" -a "x${have_setfsgid}" = "xyes"; then
AC_DEFINE(HAVE_SET_FSID, 1, [define if found setfsuid setfsgid])
fi
dnl test umount2 function
AC_CHECK_FUNC([umount2], [have_umount2=yes])
if test "x${have_umount2}" = "xyes"; then
AC_DEFINE(HAVE_UMOUNT2, 1, [define if found umount2])
fi
# FUSE section
AC_ARG_ENABLE([fuse-client],
@ -383,8 +396,7 @@ AC_ARG_ENABLE([crypt-xlator],
AC_HELP_STRING([--enable-crypt-xlator], [Build crypt encryption xlator]))
if test "x$enable_crypt_xlator" = "xyes" -a "x$have_cmac_h" = "xno"; then
echo "Encryption xlator requires OpenSSL with cmac.h"
exit 1
AC_MSG_ERROR([Encryption xlator requires OpenSSL with cmac.h])
fi
BUILD_CRYPT_XLATOR=no
@ -439,7 +451,6 @@ if test "x${enable_qemu_block}" != "xno" -a "x${HAVE_GLIB_2}" = "xyes"; then
Block translator enabled])
fi
AM_CONDITIONAL([ENABLE_QEMU_BLOCK], [test x$BUILD_QEMU_BLOCK = xyes])
# end QEMU_BLOCK section
@ -669,7 +680,7 @@ if test "x${have_llistxattr}" = "xyes"; then
AC_DEFINE(HAVE_LLISTXATTR, 1, [define if llistxattr exists])
fi
AC_CHECK_FUNC([fdatasync], [have_fdatasync=yes])
AC_CHECK_FUNC([fdatasync], [have_fdatasync=no])
if test "x${have_fdatasync}" = "xyes"; then
AC_DEFINE(HAVE_FDATASYNC, 1, [define if fdatasync exists])
fi
@ -707,35 +718,52 @@ AC_SUBST(GF_DISTRIBUTION)
GF_HOST_OS=""
GF_LDFLAGS="-rdynamic"
# check for gcc -Werror=format-security
saved_CFLAGS=$CFLAGS
CFLAGS="-Wformat -Werror=format-security"
dnl check for gcc -Werror=format-security
saved_GF_CFLAGS="-Wformat -Werror=format-security"
AC_MSG_CHECKING([whether $CC accepts -Werror=format-security])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [cc_werror_format_security=yes], [cc_werror_format_security=no])
echo $cc_werror_format_security
if test "x$cc_werror_format_security" = "xno"; then
CFLAGS="$saved_CFLAGS"
GF_CFLAGS="$GF_CFLAGS"
else
CFLAGS="$saved_CFLAGS $CFLAGS"
GF_CFLAGS="$saved_GF_CFLAGS $GF_CFLAGS"
fi
# check for gcc -Werror=implicit-function-declaration
saved_CFLAGS=$CFLAGS
CFLAGS="-Werror=implicit-function-declaration"
dnl check for gcc -Werror=implicit-function-declaration
saved_GF_CFLAGS=$GF_CFLAGS
GF_CFLAGS="-Werror=implicit-function-declaration"
AC_MSG_CHECKING([whether $CC accepts -Werror=implicit-function-declaration])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [cc_werror_implicit=yes], [cc_werror_implicit=no])
echo $cc_werror_implicit
if test "x$cc_werror_implicit" = "xno"; then
CFLAGS="$saved_CFLAGS"
GF_CFLAGS="$saved_GF_CFLAGS"
else
CFLAGS="$saved_CFLAGS $CFLAGS"
GF_CFLAGS="$saved_GF_CFLAGS $GF_CFLAGS"
fi
dnl clang is mostly GCC-compatible, but its version is much lower,
dnl so we have to check for it.
AC_MSG_CHECKING([if compiling with clang])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([], [[
#ifndef __clang__
not clang
#endif
]])],
[CLANG=yes], [CLANG=no])
AC_MSG_RESULT([$CLANG])
if test "x$CLANG" = "xyes"; then
GF_COMPILER_FLAGS="-Wno-gnu -Wno-unknown-pragmas -Wno-deprecated-declarations -Wno-enum-conversion"
fi
case $host_os in
linux*)
GF_HOST_OS="GF_LINUX_HOST_OS"
GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}"
GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
GF_LDADD="${ARGP_STANDALONE_LDADD}"
GF_FUSE_CFLAGS="-DFUSERMOUNT_DIR=\\\"\$(bindir)\\\""
;;
@ -743,7 +771,6 @@ case $host_os in
GF_HOST_OS="GF_SOLARIS_HOST_OS"
GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -m64"
GF_LDFLAGS=""
GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
GF_LDADD="${ARGP_STANDALONE_LDADD}"
GF_GLUSTERFS_LIBS="-lnsl -lresolv -lsocket"
BUILD_FUSE_CLIENT=no
@ -754,7 +781,6 @@ case $host_os in
GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_INCOMPLETE_XOPEN_C063"
GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
GF_LDADD="${ARGP_STANDALONE_LDADD}"
if test "x$ac_cv_header_execinfo_h" = "xyes"; then
GF_GLUSTERFS_LIBS="-lexecinfo"
@ -768,7 +794,6 @@ case $host_os in
GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}"
GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
GF_LDADD="${ARGP_STANDALONE_LDADD}"
if test "x$ac_cv_header_execinfo_h" = "xyes"; then
GF_GLUSTERFS_LIBS="-lexecinfo"
@ -778,24 +803,32 @@ case $host_os in
darwin*)
GF_HOST_OS="GF_DARWIN_HOST_OS"
LIBTOOL=glibtool
GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D__DARWIN_64_BIT_INO_T -bundle -undefined suppress -flat_namespace -D_XOPEN_SOURCE"
GF_CFLAGS="${GF_COMPILER_FLAGS} ${ARGP_STANDALONE_CPPFLAGS} -D__DARWIN_64_BIT_INO_T -D_XOPEN_SOURCE "
GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
GF_GLUSTERFS_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D__DARWIN_64_BIT_INO_T -undefined suppress -flat_namespace"
GF_LDADD="${ARGP_STANDALONE_LDADD}"
GF_LDFLAGS=""
GF_FUSE_CFLAGS="-I\$(CONTRIBDIR)/macfuse"
BUILD_FUSERMOUNT="no"
BUILD_QEMU_BLOCK="no"
FUSERMOUNT_SUBDIR=""
;;
esac
# enable/disable QEMU
AM_CONDITIONAL([ENABLE_QEMU_BLOCK], [test x$BUILD_QEMU_BLOCK = xyes])
# enable debug section
AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug],
[Enable debug build options.]))
# syslog section
AC_ARG_ENABLE([syslog],
AC_HELP_STRING([--disable-syslog],
[Disable syslog for logging]))
AC_HELP_STRING([--disable-syslog],
[Disable syslog for logging]))
USE_SYSLOG="yes"
if test "x$enable_syslog" != "xno"; then
@ -812,8 +845,13 @@ AC_CHECK_LIB([readline -ltermcap],[readline],[RLLIBS="-lreadline -ltermcap"])
AC_CHECK_LIB([readline -lncurses],[readline],[RLLIBS="-lreadline -lncurses"])
if test "x$RLLIBS" != "x"; then
AC_DEFINE(HAVE_READLINE, 1, [readline enabled CLI])
BUILD_READLINE=yes
if test "x$RL_UNDO" == "xyes"; then
AC_DEFINE(HAVE_READLINE, 1, [readline enabled CLI])
BUILD_READLINE=yes
else
BUILD_READLINE="no (present but missing undo)"
fi
fi
BUILD_LIBAIO=no
@ -838,9 +876,20 @@ fi
saved_CFLAGS=$CFLAGS
saved_CPPFLAGS=$CPPFLAGS
saved_LDFLAGS=$LDFLAGS
CFLAGS=`${PYTHON}-config --cflags`
CPPFLAGS=$CFLAGS
LDFLAGS="-L`${PYTHON}-config --prefix`/lib `${PYTHON}-config --ldflags`"
case $host_os in
linux*)
CFLAGS="`${PYTHON}-config --cflags`"
CPPFLAGS=$CFLAGS
LDFLAGS="-L`${PYTHON}-config --prefix`/lib `${PYTHON}-config --ldflags`"
;;
darwin*)
CFLAGS="`${PYTHON}-config --cflags` -Wno-error=unused-command-line-argument-hard-error-in-future"
CPPFLAGS=$CFLAGS
LDFLAGS="-L`${PYTHON}-config --prefix`/lib `${PYTHON}-config --ldflags`"
;;
esac
AC_CHECK_HEADERS([python$PYTHON_VERSION/Python.h],[have_Python_h=yes],[])
AC_ARG_ENABLE([glupy],
AS_HELP_STRING([--enable-glupy],
@ -848,7 +897,7 @@ AC_ARG_ENABLE([glupy],
case x$enable_glupy in
xyes)
if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then
BUILD_GLUPY=yes
BUILD_GLUPY=yes
PYTHONDEV_CFLAGS="$CFLAGS"
PYTHONDEV_CPPFLAGS="$CPPFLAGS"
PYTHONDEV_LDFLAGS="$LDFLAGS"
@ -856,14 +905,14 @@ case x$enable_glupy in
AC_SUBST(PYTHONDEV_CPPFLAGS)
AC_SUBST(PYTHONDEV_LDFLAGS)
else
AC_MSG_ERROR([glupy requires python-devel/python-dev package and python2.x])
AC_MSG_ERROR([glupy requires python-devel/python-dev package and python2.x])
fi
;;
xno)
;;
*)
if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then
BUILD_GLUPY=yes
BUILD_GLUPY=yes
PYTHONDEV_CFLAGS="$CFLAGS"
PYTHONDEV_CPPFLAGS="$CPPFLAGS"
PYTHONDEV_LDFLAGS="$LDFLAGS"
@ -871,7 +920,7 @@ case x$enable_glupy in
AC_SUBST(PYTHONDEV_CPPFLAGS)
AC_SUBST(PYTHONDEV_LDFLAGS)
else
AC_MSG_WARN([
AC_MSG_WARN([
---------------------------------------------------------------------------------
cannot build glupy. python 2.x and python-devel/python-dev package are required.
---------------------------------------------------------------------------------])
@ -903,7 +952,6 @@ AC_SUBST(CFLAGS)
AC_SUBST(GF_HOST_OS)
AC_SUBST([GF_GLUSTERFS_LIBS])
AC_SUBST(GF_GLUSTERFS_CFLAGS)
AC_SUBST(GF_CFLAGS)
AC_SUBST(GF_LDFLAGS)
AC_SUBST(GF_LDADD)
@ -918,7 +966,7 @@ CONTRIBDIR='$(top_srcdir)/contrib'
AC_SUBST(CONTRIBDIR)
GF_CPPDEFINES='-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS)'
GF_CPPINCLUDES='-I$(top_srcdir)/libglusterfs/src -I$(CONTRIBDIR)/uuid $(UNITTEST_CPPFLAGS)'
GF_CPPINCLUDES='-I$(top_srcdir)/libglusterfs/src -I$(CONTRIBDIR)/uuid'
GF_CPPFLAGS="$GF_CPPDEFINES $GF_CPPINCLUDES"
AC_SUBST([GF_CPPFLAGS])

View File

@ -56,12 +56,12 @@ AC_DEFUN([ARGP_CHECK_FUNC],
[Define to 1 if you have the `]ac_func[' function.])
AC_CACHE_CHECK([for $2], ac_var,
[AC_TRY_LINK([$1], [$2],
[AS_VAR_SET(ac_var, yes)],
[AS_VAR_SET(ac_var, no)])])
[AS_VAR_SET(ac_var, yes)],
[AS_VAR_SET(ac_var, no)])])
if test AS_VAR_GET(ac_var) = yes ; then
ifelse([$3],,
[AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]ac_func))],
[$3
[AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]ac_func))],
[$3
])
else
ifelse([$4],, true, [$4])
@ -99,4 +99,7 @@ fi
CPPFLAGS="$CPPFLAGS -I$srcdir"
dnl Added for C99 standards
CFLAGS="$CFLAGS -std=gnu89"
AC_OUTPUT(Makefile)

View File

@ -189,6 +189,15 @@ enum fuse_opcode {
FUSE_INTERRUPT = 36,
FUSE_BMAP = 37,
FUSE_DESTROY = 38,
/*
FUSE_IOCTL = 39,
FUSE_POLL = 40,
FUSE_NOTIFY_REPLY = 41,
FUSE_BATCH_FORGET = 42,
FUSE_FALLOCATE = 43,
FUSE_READDIRPLUS = 44,
*/
#if (__FreeBSD__ >= 10)
FUSE_SETVOLNAME = 61,
FUSE_GETXTIMES = 62,

View File

@ -21,7 +21,7 @@
#include <errno.h>
#include <dirent.h>
#include <signal.h>
#ifndef __NetBSD__
#if !defined(__NetBSD__) && !defined(GF_DARWIN_HOST_OS)
#include <mntent.h>
#endif /* __NetBSD__ */
#include <sys/stat.h>
@ -36,7 +36,15 @@
#define MS_RDONLY MNT_RDONLY
#endif
#ifdef linux
#ifdef GF_DARWIN_HOST_OS
#include <sys/param.h>
#include <sys/mount.h>
#define umount2(dir, flags) unmount(dir, ((flags) != 0) ? MNT_FORCE : 0)
#define MS_RDONLY MNT_RDONLY
#endif
#ifdef GF_LINUX_HOST_OS
#define _PATH_MOUNT "/bin/mount"
#else /* NetBSD, MacOS X */
#define _PATH_MOUNT "/sbin/mount"

View File

@ -3,7 +3,7 @@ bin_PROGRAMS = fusermount-glusterfs
fusermount_glusterfs_SOURCES = fusermount.c mount_util.c $(CONTRIBDIR)/fuse-lib/mount-common.c
noinst_HEADERS = $(CONTRIBDIR)/fuse-include/mount_util.h
AM_CPPFLAGS = $(GF_CPPFLAGS) -DFUSE_UTIL -I$(CONTRIBDIR)/fuse-include
AM_CPPFLAGS = $(GF_CPPFLAGS) -DFUSE_UTIL -I$(CONTRIBDIR)/fuse-include -I$(CONTRIBDIR)/fuse-lib
AM_CFLAGS = -Wall $(GF_CFLAGS)

View File

@ -10,6 +10,11 @@
#include <config.h>
#include "mount_util.h"
#ifndef HAVE_UMOUNT2
#include "mount-gluster-compat.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -20,11 +25,18 @@
#include <fcntl.h>
#include <pwd.h>
#include <limits.h>
#if !defined(__NetBSD__) && !defined(GF_DARWIN_HOST_OS)
#include <mntent.h>
#endif /* __NetBSD__ */
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/mount.h>
#ifdef HAVE_SET_FSID
#include <sys/fsuid.h>
#endif
#ifdef GF_DARWIN_HOST_OS
#include <sys/param.h>
#endif
#include <sys/mount.h>
#include <sys/socket.h>
#include <sys/utsname.h>
#include <sched.h>
@ -63,22 +75,32 @@ static const char *get_user_name(void)
}
}
#ifdef HAVE_SET_FSID
static uid_t oldfsuid;
static gid_t oldfsgid;
#endif
static void drop_privs(void)
{
if (getuid() != 0) {
#ifdef HAVE_SET_FSID
oldfsuid = setfsuid(getuid());
oldfsgid = setfsgid(getgid());
#else
fprintf(stderr, "%s: Implement alternative setfsuid/gid \n", progname);
#endif
}
}
static void restore_privs(void)
{
if (getuid() != 0) {
#ifdef HAVE_SET_FSID
setfsuid(oldfsuid);
setfsgid(oldfsgid);
#else
fprintf(stderr, "%s: Implement alternative setfsuid/gid \n", progname);
#endif
}
}

View File

@ -1,3 +1,8 @@
/*
* 'rebel' branch modifications:
* Copyright (C) 2010 Tuxera. All Rights Reserved.
*/
/*
* Copyright (C) 2006-2008 Google. All Rights Reserved.
* Amit Singh <singh@>
@ -6,69 +11,81 @@
#ifndef _FUSE_PARAM_H_
#define _FUSE_PARAM_H_
/* Compile-time tunables (M_MACFUSE*) */
#include <AvailabilityMacros.h>
#define M_MACFUSE_ENABLE_FIFOFS 0
#define M_MACFUSE_ENABLE_INTERRUPT 1
#define M_MACFUSE_ENABLE_SPECFS 0
#define M_MACFUSE_ENABLE_TSLOCKING 0
#define M_MACFUSE_ENABLE_UNSUPPORTED 1
#define M_MACFUSE_ENABLE_XATTR 1
/* Compile-time tunables (M_OSXFUSE*) */
#if M_MACFUSE_ENABLE_UNSUPPORTED
#define M_MACFUSE_ENABLE_DSELECT 0
#define M_MACFUSE_ENABLE_EXCHANGE 1
#define M_MACFUSE_ENABLE_KQUEUE 1
#define M_MACFUSE_ENABLE_KUNC 0
#if __LP64__
#define M_MACFUSE_ENABLE_INTERIM_FSNODE_LOCK 1
#endif /* __LP64__ */
#endif /* M_MACFUSE_ENABLE_UNSUPPORTED */
#define M_OSXFUSE_ENABLE_FIFOFS 0
#define M_OSXFUSE_ENABLE_INTERRUPT 1
#define M_OSXFUSE_ENABLE_SPECFS 0
#define M_OSXFUSE_ENABLE_TSLOCKING 1
#define M_OSXFUSE_ENABLE_UNSUPPORTED 1
#define M_OSXFUSE_ENABLE_XATTR 1
#define M_OSXFUSE_ENABLE_DSELECT 1
#if M_MACFUSE_ENABLE_INTERIM_FSNODE_LOCK
#define FUSE_VNOP_EXPORT __private_extern__
#if M_OSXFUSE_ENABLE_UNSUPPORTED
# define M_OSXFUSE_ENABLE_EXCHANGE 1
# define M_OSXFUSE_ENABLE_KUNC 0
# define M_OSXFUSE_ENABLE_INTERIM_FSNODE_LOCK 1
#endif /* M_OSXFUSE_ENABLE_UNSUPPORTED */
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
# if M_OSXFUSE_ENABLE_UNSUPPORTED
/*
* In Mac OS X 10.5 the file system implementation is responsible for
* posting kqueue events. Starting with Mac OS X 10.6 VFS took over that
* job.
*/
# define M_OSXFUSE_ENABLE_KQUEUE 1
# endif
#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */
#if M_OSXFUSE_ENABLE_INTERIM_FSNODE_LOCK
# define M_OSXFUSE_ENABLE_HUGE_LOCK 0
# define M_OSXFUSE_ENABLE_LOCK_LOGGING 0
# define FUSE_VNOP_EXPORT __private_extern__
#else
#define FUSE_VNOP_EXPORT static
#endif /* M_MACFUSE_ENABLE_INTERIM_FSNODE_LOCK */
# define FUSE_VNOP_EXPORT static
#endif /* M_OSXFUSE_ENABLE_INTERIM_FSNODE_LOCK */
/* User Control */
#define MACFUSE_POSTUNMOUNT_SIGNAL SIGKILL
#define OSXFUSE_POSTUNMOUNT_SIGNAL SIGKILL
#define MACOSX_ADMIN_GROUP_NAME "admin"
#define SYSCTL_MACFUSE_TUNABLES_ADMIN "macfuse.tunables.admin_group"
#define SYSCTL_MACFUSE_VERSION_NUMBER "macfuse.version.number"
#define SYSCTL_OSXFUSE_TUNABLES_ADMIN "osxfuse.tunables.admin_group"
#define SYSCTL_OSXFUSE_VERSION_NUMBER "osxfuse.version.number"
/* Paths */
#define MACFUSE_BUNDLE_PATH "/Library/Filesystems/fusefs.fs"
#define MACFUSE_KEXT MACFUSE_BUNDLE_PATH "/Support/fusefs.kext"
#define MACFUSE_LOAD_PROG MACFUSE_BUNDLE_PATH "/Support/load_fusefs"
#define MACFUSE_MOUNT_PROG MACFUSE_BUNDLE_PATH "/Support/mount_fusefs"
#define OSXFUSE_BUNDLE_PATH "/Library/Filesystems/osxfusefs.fs"
#define OSXFUSE_KEXT OSXFUSE_BUNDLE_PATH "/Support/osxfusefs.kext"
#define OSXFUSE_LOAD_PROG OSXFUSE_BUNDLE_PATH "/Support/load_osxfusefs"
#define OSXFUSE_MOUNT_PROG OSXFUSE_BUNDLE_PATH "/Support/mount_osxfusefs"
#define SYSTEM_KEXTLOAD "/sbin/kextload"
#define SYSTEM_KEXTUNLOAD "/sbin/kextunload"
/* Compatible API version */
#define MACFUSE_MIN_USER_VERSION_MAJOR 7
#define MACFUSE_MIN_USER_VERSION_MINOR 5
#define OSXFUSE_MIN_USER_VERSION_MAJOR 7
#define OSXFUSE_MIN_USER_VERSION_MINOR 5
/* Device Interface */
/*
* This is the prefix ("fuse" by default) of the name of a FUSE device node
* in devfs. The suffix is the device number. "/dev/fuse0" is the first FUSE
* This is the prefix ("osxfuse" by default) of the name of a FUSE device node
* in devfs. The suffix is the device number. "/dev/osxfuse0" is the first FUSE
* device by default. If you change the prefix from the default to something
* else, the user-space FUSE library will need to know about it too.
*/
#define MACFUSE_DEVICE_BASENAME "fuse"
#define OSXFUSE_DEVICE_BASENAME "osxfuse"
/*
* This is the number of /dev/fuse<n> nodes we will create. <n> goes from
* 0 to (FUSE_NDEVICES - 1).
* This is the number of /dev/osxfuse<n> nodes we will create. <n> goes from
* 0 to (OSXFUSE_NDEVICES - 1).
*/
#define MACFUSE_NDEVICES 24
#define OSXFUSE_NDEVICES 24
/*
* This is the default block size of the virtual storage devices that are
@ -131,13 +148,13 @@
/* User-Kernel IPC Buffer */
#define FUSE_MIN_USERKERNEL_BUFSIZE (128 * 1024)
#define FUSE_MAX_USERKERNEL_BUFSIZE (4096 * 1024)
#define FUSE_MAX_USERKERNEL_BUFSIZE (16 * 1024 * 1024)
#define FUSE_REASONABLE_XATTRSIZE FUSE_MIN_USERKERNEL_BUFSIZE
#endif /* KERNEL */
#define FUSE_DEFAULT_USERKERNEL_BUFSIZE (4096 * 1024)
#define FUSE_DEFAULT_USERKERNEL_BUFSIZE (16 * 1024 * 1024)
#define FUSE_LINK_MAX LINK_MAX
#define FUSE_UIO_BACKUP_MAX 8

View File

@ -105,7 +105,7 @@ loadkmod(void)
pid = fork();
if (pid == 0) {
execl(MACFUSE_LOAD_PROG, MACFUSE_LOAD_PROG, NULL);
execl(OSXFUSE_LOAD_PROG, OSXFUSE_LOAD_PROG, NULL);
/* exec failed */
exit(ENOENT);
@ -133,13 +133,17 @@ Return:
}
int
gf_fuse_mount (const char *mountpoint, char *fsname,
unsigned long mountflags, char *mnt_param,
pid_t *mnt_pid, int status_fd) /* Not used on OS X */
/* int
gf_fuse_mount (const char *mountpoint, char *fsname, char *mnt_param,
pid_t *mtab_pid /* not used on OS X */)
pid_t *mtab_pid) */
{
int fd, pid;
int result;
char *fdnam, *dev;
const char *mountprog = MACFUSE_MOUNT_PROG;
const char *mountprog = OSXFUSE_MOUNT_PROG;
sig_t chldf;
/* mount_fusefs should not try to spawn the daemon */
@ -170,7 +174,8 @@ gf_fuse_mount (const char *mountpoint, char *fsname, char *mnt_param,
size_t version_len = MAXHOSTNAMELEN;
size_t version_len_desired = 0;
result = sysctlbyname(SYSCTL_MACFUSE_VERSION_NUMBER, version,
result = sysctlbyname(SYSCTL_OSXFUSE_VERSION_NUMBER
, version,
&version_len, NULL, (size_t)0);
if (result == 0) {
/* sysctlbyname() includes the trailing '\0' in version_len */
@ -197,10 +202,12 @@ gf_fuse_mount (const char *mountpoint, char *fsname, char *mnt_param,
gf_log("glusterfs-fuse", GF_LOG_INFO,
"MacFUSE kext version %s", version);
}
// TODO Bypass version check
result = 0;
if (result != 0)
GFFUSE_LOGERR("MacFUSE version %s is not supported", version);
GFFUSE_LOGERR("MacFUSE version %s is not supported", version);
} else
GFFUSE_LOGERR("cannot load MacFUSE kext");
GFFUSE_LOGERR("cannot load MacFUSE kext");
if (result != 0)
return -1;
@ -228,9 +235,9 @@ gf_fuse_mount (const char *mountpoint, char *fsname, char *mnt_param,
int r, devidx = -1;
char devpath[MAXPATHLEN];
for (r = 0; r < MACFUSE_NDEVICES; r++) {
for (r = 0; r < OSXFUSE_NDEVICES; r++) {
snprintf(devpath, MAXPATHLEN - 1,
_PATH_DEV MACFUSE_DEVICE_BASENAME "%d", r);
_PATH_DEV OSXFUSE_DEVICE_BASENAME "%d", r);
fd = open(devpath, O_RDWR);
if (fd >= 0) {
dev = devpath;
@ -336,8 +343,8 @@ gf_fuse_unmount(const char *mountpoint, int fd)
devname_r(sbuf.st_rdev, S_IFCHR, dev, 128);
if (strncmp(dev, MACFUSE_DEVICE_BASENAME,
sizeof(MACFUSE_DEVICE_BASENAME) - 1)) {
if (strncmp(dev, OSXFUSE_DEVICE_BASENAME,
sizeof(OSXFUSE_DEVICE_BASENAME) - 1)) {
return;
}

163
contrib/mount/mntent.c Normal file
View File

@ -0,0 +1,163 @@
/*
* Copyright (c) 1980, 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.
* Copyright (c) 2001
* David Rufino <daverufino@btinternet.com>
* Copyright (c) 2014
* Red Hat, Inc. <http://www.redhat.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifdef GF_DARWIN_HOST_OS
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <sys/ucred.h>
#include <sys/mount.h>
#include "mntent_compat.h"
static int pos = -1;
static int mntsize = -1;
static struct mntent _mntent;
char *
hasmntopt (const struct mntent *mnt, const char *option)
{
int found;
char *opt, *optbuf;
optbuf = strdup(mnt->mnt_opts);
found = 0;
for (opt = optbuf; (opt = strtok(opt, " ")) != NULL; opt = NULL) {
if (!strcasecmp(opt, option)) {
opt = opt - optbuf + mnt->mnt_opts;
free (optbuf);
return (opt);
}
}
free (optbuf);
return (NULL);
}
static char *
concatopt (char *s0, const char *s1)
{
size_t i;
char *cp;
if (s1 == NULL || *s1 == '\0')
return s0;
if (s0 && *s0) {
i = strlen(s0) + strlen(s1) + 1 + 1;
if ((cp = (char *)malloc(i)) == NULL)
return (NULL);
(void)snprintf(cp, i, "%s %s", s0, s1);
} else
cp = strdup(s1);
if (s0)
free(s0);
return (cp);
}
static char *
flags2opts (int flags)
{
char *res;
res = NULL;
res = concatopt(res, (flags & MNT_RDONLY) ? "ro" : "rw");
if (flags & MNT_SYNCHRONOUS) res = concatopt(res, "sync");
if (flags & MNT_NOEXEC) res = concatopt(res, "noexec");
if (flags & MNT_NOSUID) res = concatopt(res, "nosuid");
if (flags & MNT_NODEV) res = concatopt(res, "nodev");
if (flags & MNT_UNION) res = concatopt(res, "union");
if (flags & MNT_ASYNC) res = concatopt(res, "async");
#if !defined(GF_DARWIN_HOST_OS)
if (flags & MNT_NOATIME) res = concatopt(res, "noatime");
if (flags & MNT_NOCLUSTERR) res = concatopt(res, "noclusterr");
if (flags & MNT_NOCLUSTERW) res = concatopt(res, "noclusterw");
if (flags & MNT_NOSYMFOLLOW) res = concatopt(res, "nosymfollow");
if (flags & MNT_SUIDDIR) res = concatopt(res, "suiddir");
#endif
return res;
}
static struct mntent *
statfs_to_mntent (struct statfs *mntbuf)
{
static char opts_buf[40], *tmp;
_mntent.mnt_fsname = mntbuf->f_mntfromname;
_mntent.mnt_dir = mntbuf->f_mntonname;
_mntent.mnt_type = mntbuf->f_fstypename;
tmp = flags2opts (mntbuf->f_flags);
if (tmp) {
opts_buf[sizeof(opts_buf)-1] = '\0';
strncpy (opts_buf, tmp, sizeof(opts_buf)-1);
free (tmp);
} else {
*opts_buf = '\0';
}
_mntent.mnt_opts = opts_buf;
_mntent.mnt_freq = _mntent.mnt_passno = 0;
return (&_mntent);
}
struct mntent *
getmntent (FILE *fp)
{
struct statfs *mntbuf;
if (pos == -1 || mntsize == -1)
mntsize = getmntinfo (&mntbuf, MNT_NOWAIT);
++pos;
if (pos == mntsize) {
pos = mntsize = -1;
return (NULL);
}
return (statfs_to_mntent (&mntbuf[pos]));
}
/* Dummy functions */
FILE *
setmntent(const char *filename, const char *type)
{
return (FILE *)0x1;
}
int
endmntent (FILE *fp)
{
return 1;
}
#endif /* GF_DARWIN_HOST_OS */

View File

@ -0,0 +1,35 @@
/*
Copyright (c) 2014 Red Hat, Inc. <http://www.redhat.com>
This file is part of GlusterFS.
This file is licensed to you under your choice of the GNU Lesser
General Public License, version 3 or any later version (LGPLv3 or
later), or the GNU General Public License, version 2 (GPLv2), in all
cases as published by the Free Software Foundation.
*/
#ifndef _MNTENT_H
#define _MNTENT_H
#ifdef GF_DARWIN_HOST_OS
#include <stdio.h>
struct mntent {
char *mnt_fsname;
char *mnt_dir;
char *mnt_type;
char *mnt_opts;
int mnt_freq;
int mnt_passno;
};
struct mntent *getmntent (FILE *fp);
FILE *setmntent (const char *filename, const char *type);
int endmntent(FILE *fp);
char * hasmntopt (const struct mntent *mnt, const char *option);
/* Dummy - /etc/mtab has no meaning on OSX platform */
#define _PATH_MOUNTED "/etc/mtab"
#endif /* GF_DARWIN_HOST_OS */
#endif /* _MNTENT_H */

View File

@ -12,7 +12,14 @@
# include <sys/types.h>
# include <machine/bswap.h>
#elif defined(CONFIG_BYTESWAP_H)
#ifdef GF_DARWIN_HOST_OS
# include <libkern/OSByteOrder.h>
#define bswap_16(x) OSSwapInt16(x)
#define bswap_32(x) OSSwapInt32(x)
#define bswap_64(x) OSSwapInt64(x)
#else
# include <byteswap.h>
#endif
static inline uint16_t bswap16(uint16_t x)
{

View File

@ -156,7 +156,7 @@ int qemu_fls(int i)
*/
int qemu_fdatasync(int fd)
{
#ifdef CONFIG_FDATASYNC
#ifdef HAVE_FDATASYNC
return fdatasync(fd);
#else
return fsync(fd);

204
contrib/sunrpc/xdr_sizeof.c Normal file
View File

@ -0,0 +1,204 @@
/*
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
* Reserved. This file contains Original Code and/or Modifications of
* Original Code as defined in and that are subject to the Apple Public
* Source License Version 1.1 (the "License"). You may not use this file
* except in compliance with the License. Please obtain a copy of the
* License at http://www.apple.com/publicsource and read it before using
* this file.
*
* The Original Code and all software distributed under the License are
* distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
* License for the specific language governing rights and limitations
* under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
/*
* xdr_sizeof.c
*
* Copyright 1990 Sun Microsystems, Inc.
*
* General purpose routine to see how much space something will use
* when serialized using XDR.
*/
#ifdef GF_DARWIN_HOST_OS
#include <rpc/types.h>
#include <rpc/xdr.h>
#include <sys/types.h>
#include <sys/cdefs.h>
#include <stdlib.h>
/* ARGSUSED */
#ifdef GF_DARWIN_HOST_OS
static bool_t
x_putlong (XDR *xdrs, const int *longp)
{
xdrs->x_handy += BYTES_PER_XDR_UNIT;
return TRUE;
}
#else
static bool_t
x_putlong (XDR *xdrs, const long *longp)
{
xdrs->x_handy += BYTES_PER_XDR_UNIT;
return TRUE;
}
#endif
/* ARGSUSED */
static bool_t
x_putbytes (XDR *xdrs, const char *bp, u_int len)
{
xdrs->x_handy += len;
return TRUE;
}
#ifdef GF_DARWIN_HOST_OS
static u_int
x_getpostn (XDR *xdrs)
{
return xdrs->x_handy;
}
#else
static u_int
x_getpostn (const XDR *xdrs)
{
return xdrs->x_handy;
}
#endif
/* ARGSUSED */
static bool_t
x_setpostn (XDR *xdrs, u_int len)
{
/* This is not allowed */
return FALSE;
}
static int32_t *
x_inline (XDR *xdrs, u_int len)
{
if (len == 0)
return NULL;
if (xdrs->x_op != XDR_ENCODE)
return NULL;
if (len < (u_int) (long int) xdrs->x_base)
{
/* x_private was already allocated */
xdrs->x_handy += len;
return (int32_t *) xdrs->x_private;
}
else
{
/* Free the earlier space and allocate new area */
free (xdrs->x_private);
if ((xdrs->x_private = (caddr_t) malloc (len)) == NULL)
{
xdrs->x_base = 0;
return NULL;
}
xdrs->x_base = (void *) (long) len;
xdrs->x_handy += len;
return (int32_t *) xdrs->x_private;
}
}
static int
harmless (void)
{
/* Always return FALSE/NULL, as the case may be */
return 0;
}
static void
x_destroy (XDR *xdrs)
{
xdrs->x_handy = 0;
xdrs->x_base = 0;
if (xdrs->x_private)
{
free (xdrs->x_private);
xdrs->x_private = NULL;
}
return;
}
unsigned long
xdr_sizeof (xdrproc_t func, void *data)
{
XDR x;
struct xdr_ops ops;
bool_t stat;
#ifdef GF_DARWIN_HOST_OS
typedef bool_t (*dummyfunc1) (XDR *, int *);
#else
typedef bool_t (*dummyfunc1) (XDR *, long *);
#endif
typedef bool_t (*dummyfunc2) (XDR *, caddr_t, u_int);
ops.x_putlong = x_putlong;
ops.x_putbytes = x_putbytes;
ops.x_inline = x_inline;
ops.x_getpostn = x_getpostn;
ops.x_setpostn = x_setpostn;
ops.x_destroy = x_destroy;
/* the other harmless ones */
ops.x_getlong = (dummyfunc1) harmless;
ops.x_getbytes = (dummyfunc2) harmless;
x.x_op = XDR_ENCODE;
x.x_ops = &ops;
x.x_handy = 0;
x.x_private = (caddr_t) NULL;
x.x_base = (caddr_t) 0;
stat = func (&x, data, 0);
if (x.x_private)
free (x.x_private);
return (stat == TRUE ? (unsigned) x.x_handy : 0);
}
#endif /* GF_DARWIN_HOST_OS */

View File

@ -44,6 +44,18 @@
#include <windows.h>
#define UUID MYUUID
#endif
#ifdef __APPLE__
#define PRI_TIME "ld"
#define PRI_TIME_USEC "d"
#define SCAN_TIME "lu"
#else
#define PRI_TIME "lu"
#define PRI_TIME_USEC "lu"
#define SCAN_TIME "ld"
#endif
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@ -354,8 +366,7 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low,
unsigned int cl;
unsigned long tv1, tv2;
int a;
if (fscanf(state_f, "clock: %04x tv: %lu %lu adj: %d\n",
if (fscanf(state_f, "clock: %04x tv: %" SCAN_TIME " %" SCAN_TIME " adj: %d\n",
&cl, &tv1, &tv2, &a) == 4) {
clock_seq = cl & 0x3FFF;
last.tv_sec = tv1;
@ -404,7 +415,7 @@ try_again:
if (state_fd > 0) {
rewind(state_f);
len = fprintf(state_f,
"clock: %04x tv: %016lu %08lu adj: %08d\n",
"clock: %04x tv: %016" PRI_TIME "%08" PRI_TIME_USEC "adj: %08d\n",
clock_seq, last.tv_sec, last.tv_usec, adjustment);
fflush(state_f);
if (ftruncate(state_fd, len) < 0) {

View File

@ -52,6 +52,7 @@
#include <time.h>
#include "uuidP.h"
#include "logging.h"
time_t uuid_time(const uuid_t uu, struct timeval *ret_tv)
{
@ -163,8 +164,7 @@ main(int argc, char **argv)
printf("Warning: not a time-based UUID, so UUID time "
"decoding will likely not work!\n");
}
printf("UUID time is: (%ld, %ld): %s\n", tv.tv_sec, tv.tv_usec,
ctime(&time_reg));
printf("UUID time is: (%" GF_PRI_SECOND ", %" GF_PRI_USEC "): %s\n", tv.tv_sec, tv.tv_usec, ctime(&time_reg));
return 0;
}

View File

@ -4,6 +4,7 @@ scripts_DATA = gsync-upgrade.sh generate-gfid-file.sh get-gfid.sh \
scripts_PROGRAMS = gsync-sync-gfid
gsync_sync_gfid_CFLAGS = $(GF_CFLAGS) -Wall -I$(top_srcdir)/libglusterfs/src
gsync_sync_gfid_LDFLAGS = $(GF_LDFLAGS)
gsync_sync_gfid_LDADD = $(GF_LIBS) $(top_builddir)/libglusterfs/src/libglusterfs.la
gsync_sync_gfid_SOURCES = gsync-sync-gfid.c

View File

@ -32,8 +32,13 @@ def genCHeader(logBook,
defineLines.append("#define %-20s %d" % (nameDef, code))
defineLines.append("#define %-20s %s" % (msgNameDef,
json.dumps(msg)))
caseLines.append("#ifdef HAVE_LIBINTL_H")
caseLines.append(" case %s: return _(%s);" % \
(nameDef, msgNameDef))
caseLines.append("#else")
caseLines.append(" case %s: return %s;" % \
(nameDef, msgNameDef))
caseLines.append("#endif")
d = {'DEFINES': "\n".join(defineLines),
'CASES': "\n".join(caseLines)}

View File

@ -9,10 +9,11 @@
#ifndef _GF_ERROR_CODES_H
#define _GF_ERROR_CODES_H
#ifdef HAVE_LIBINTL_H
#include <libintl.h>
#define _(STRING) gettext(STRING)
#endif
/** START: ERROR CODE DEFINITIONS **/
$DEFINES

View File

@ -13,7 +13,7 @@ AM_CPPFLAGS = $(GF_CPPFLAGS) \
-DCONFDIR=\"$(sysconfdir)/glusterfs\" \
-I$(top_srcdir)/rpc/rpc-lib/src -I$(top_srcdir)/rpc/xdr/src
AM_CFLAGS = -Wall $(GF_GLUSTERFS_CFLAGS)
AM_CFLAGS = -Wall $(GF_CFLAGS)
CLEANFILES =

View File

@ -1516,7 +1516,7 @@ parse_cmdline (int argc, char *argv[], glusterfs_ctx_t *ctx)
#ifdef GF_DARWIN_HOST_OS
if (cmd_args->mount_point)
cmd_args->mac_compat = GF_OPTION_DEFERRED;
cmd_args->mac_compat = GF_OPTION_DEFERRED;
#endif
ret = 0;

View File

@ -26,8 +26,8 @@ libglusterfs_la_SOURCES = dict.c xlator.c logging.c \
graph-print.c trie.c run.c options.c fd-lk.c circ-buff.c \
event-history.c gidcache.c ctx.c client_t.c event-poll.c event-epoll.c \
$(CONTRIBDIR)/libgen/basename_r.c $(CONTRIBDIR)/libgen/dirname_r.c \
$(CONTRIBDIR)/stdlib/gf_mkostemp.c strfd.c
$(CONTRIBDIR)/stdlib/gf_mkostemp.c strfd.c \
$(CONTRIBDIR)/mount/mntent.c
nodist_libglusterfs_la_SOURCES = y.tab.c graph.lex.c gf-error-codes.h
@ -43,7 +43,8 @@ noinst_HEADERS = common-utils.h defaults.h dict.h glusterfs.h hashfn.h timespec.
$(CONTRIB_BUILDDIR)/uuid/uuid_types.h syncop.h graph-utils.h trie.h \
run.h options.h lkowner.h fd-lk.h circ-buff.h event-history.h \
gidcache.h client_t.h glusterfs-acl.h glfs-message-id.h \
template-component-messages.h strfd.h
template-component-messages.h strfd.h \
$(CONTRIBDIR)/mount/mntent_compat.h lvm-defaults.h
EXTRA_DIST = graph.l graph.y

View File

@ -52,7 +52,7 @@ gf_client_clienttable_expand (clienttable_t *clienttable, uint32_t nr)
uint32_t oldmax_clients = -1;
int ret = -1;
if (clienttable == NULL || nr < 0) {
if (clienttable == NULL || nr > UINT32_MAX) {
gf_log_callingfn ("client_t", GF_LOG_ERROR, "invalid argument");
ret = EINVAL;
goto out;

View File

@ -1170,7 +1170,7 @@ gf_string2uint8 (const char *str, uint8_t *n)
if (rv != 0)
return rv;
if (l >= 0 && l <= UINT8_MAX) {
if (l <= UINT8_MAX) {
*n = (uint8_t) l;
return 0;
}
@ -1189,7 +1189,7 @@ gf_string2uint16 (const char *str, uint16_t *n)
if (rv != 0)
return rv;
if (l >= 0 && l <= UINT16_MAX) {
if (l <= UINT16_MAX) {
*n = (uint16_t) l;
return 0;
}
@ -1208,7 +1208,7 @@ gf_string2uint32 (const char *str, uint32_t *n)
if (rv != 0)
return rv;
if (l >= 0 && l <= UINT32_MAX) {
if (l <= UINT32_MAX) {
*n = (uint32_t) l;
return 0;
}
@ -1227,7 +1227,7 @@ gf_string2uint64 (const char *str, uint64_t *n)
if (rv != 0)
return rv;
if (l >= 0 && l <= UINT64_MAX) {
if (l <= UINT64_MAX) {
*n = (uint64_t) l;
return 0;
}
@ -1258,7 +1258,7 @@ gf_string2uint8_base10 (const char *str, uint8_t *n)
if (rv != 0)
return rv;
if (l >= 0 && l <= UINT8_MAX) {
if (l <= UINT8_MAX) {
*n = (uint8_t) l;
return 0;
}
@ -1277,7 +1277,7 @@ gf_string2uint16_base10 (const char *str, uint16_t *n)
if (rv != 0)
return rv;
if (l >= 0 && l <= UINT16_MAX) {
if (l <= UINT16_MAX) {
*n = (uint16_t) l;
return 0;
}
@ -1296,7 +1296,7 @@ gf_string2uint32_base10 (const char *str, uint32_t *n)
if (rv != 0)
return rv;
if (l >= 0 && l <= UINT32_MAX) {
if (l <= UINT32_MAX) {
*n = (uint32_t) l;
return 0;
}
@ -1315,7 +1315,7 @@ gf_string2uint64_base10 (const char *str, uint64_t *n)
if (rv != 0)
return rv;
if (l >= 0 && l <= UINT64_MAX) {
if (l <= UINT64_MAX) {
*n = (uint64_t) l;
return 0;
}
@ -1361,7 +1361,7 @@ err:
}
int
gf_string2bytesize (const char *str, uint64_t *n)
gf_string2bytesize_range (const char *str, uint64_t *n, uint64_t max)
{
double value = 0.0;
char *tail = NULL;
@ -1410,7 +1410,7 @@ gf_string2bytesize (const char *str, uint64_t *n)
return -1;
}
if ((UINT64_MAX - value) < 0) {
if ((max - value) < 0) {
errno = ERANGE;
return -1;
}
@ -1420,6 +1420,28 @@ gf_string2bytesize (const char *str, uint64_t *n)
return 0;
}
int
gf_string2bytesize_size (const char *str, size_t *n)
{
uint64_t u64;
size_t max = (size_t) - 1;
int val = gf_string2bytesize_range (str, &u64, max);
*n = (size_t) u64;
return val;
}
int
gf_string2bytesize (const char *str, uint64_t *n)
{
return gf_string2bytesize_range(str, n, UINT64_MAX);
}
int
gf_string2bytesize_uint64 (const char *str, uint64_t *n)
{
return gf_string2bytesize_range(str, n, UINT64_MAX);
}
int
gf_string2percent_or_bytesize (const char *str,
uint64_t *n,

View File

@ -488,12 +488,12 @@ static inline void
gf_time_fmt (char *dst, size_t sz_dst, time_t utime, unsigned int fmt)
{
extern void _gf_timestuff (gf_timefmts *, const char ***, const char ***);
static gf_timefmts timefmt_last = (gf_timefmts) -1;
static gf_timefmts timefmt_last = (gf_timefmts) - 1;
static const char **fmts;
static const char **zeros;
struct tm tm;
if (timefmt_last == -1)
if (timefmt_last == (gf_timefmts) - 1)
_gf_timestuff (&timefmt_last, &fmts, &zeros);
if (timefmt_last < fmt) fmt = gf_timefmt_default;
if (utime && gmtime_r (&utime, &tm) != NULL) {
@ -552,8 +552,9 @@ int gf_string2uint8_base10 (const char *str, uint8_t *n);
int gf_string2uint16_base10 (const char *str, uint16_t *n);
int gf_string2uint32_base10 (const char *str, uint32_t *n);
int gf_string2uint64_base10 (const char *str, uint64_t *n);
int gf_string2bytesize (const char *str, uint64_t *n);
int gf_string2bytesize_size (const char *str, size_t *n);
int gf_string2bytesize_uint64 (const char *str, uint64_t *n);
int gf_string2percent_or_bytesize (const char *str, uint64_t *n,
gf_boolean_t *is_percent);
@ -626,7 +627,7 @@ gf_skip_header_section (int fd, int header_len);
struct iatt;
struct _dict;
inline gf_boolean_t
gf_boolean_t
dht_is_linkfile (struct iatt *buf, struct _dict *dict);
int

View File

@ -31,11 +31,21 @@
#include <sys/un.h>
#include <linux/limits.h>
#include <sys/xattr.h>
#include <linux/xattr.h>
#include <endian.h>
#ifdef HAVE_LINUX_FALLOC_H
#include <linux/falloc.h>
#endif
#ifdef HAVE_ENDIAN_H
#include <endian.h>
#endif
#endif /* GF_LINUX_HOST_OS */
#ifdef HAVE_XATTR_H
#include <sys/xattr.h>
#endif
/*
* Define the fallocate flags in case we do not have the header. This also
* accounts for older systems that do not define FALLOC_FL_PUNCH_HOLE.
@ -61,7 +71,29 @@
#define lsetxattr(path,key,value,size,flags) setxattr(path,key,value,size,flags)
#endif /* HAVE_LLISTXATTR */
#endif /* GF_LINUX_HOST_OS */
#ifdef GF_DARWIN_HOST_OS
#include <machine/endian.h>
#include <libkern/OSByteOrder.h>
#define htobe16(x) OSSwapHostToBigInt16(x)
#define htole16(x) OSSwapHostToLittleInt16(x)
#define be16toh(x) OSSwapBigToHostInt16(x)
#define le16toh(x) OSSwapLittleToHostInt16(x)
#define htobe32(x) OSSwapHostToBigInt32(x)
#define htole32(x) OSSwapHostToLittleInt32(x)
#define be32toh(x) OSSwapBigToHostInt32(x)
#define le32toh(x) OSSwapLittleToHostInt32(x)
#define htobe64(x) OSSwapHostToBigInt64(x)
#define htole64(x) OSSwapHostToLittleInt64(x)
#define be64toh(x) OSSwapBigToHostInt64(x)
#define le64toh(x) OSSwapLittleToHostInt64(x)
#endif
#ifdef GF_BSD_HOST_OS
/* In case of FreeBSD and NetBSD */
@ -125,12 +157,29 @@ enum {
#endif /* GF_BSD_HOST_OS */
#ifdef GF_DARWIN_HOST_OS
#include <machine/endian.h>
#include <libkern/OSByteOrder.h>
#define htobe16(x) OSSwapHostToBigInt16(x)
#define htole16(x) OSSwapHostToLittleInt16(x)
#define be16toh(x) OSSwapBigToHostInt16(x)
#define le16toh(x) OSSwapLittleToHostInt16(x)
#define htobe32(x) OSSwapHostToBigInt32(x)
#define htole32(x) OSSwapHostToLittleInt32(x)
#define be32toh(x) OSSwapBigToHostInt32(x)
#define le32toh(x) OSSwapLittleToHostInt32(x)
#define htobe64(x) OSSwapHostToBigInt64(x)
#define htole64(x) OSSwapHostToLittleInt64(x)
#define be64toh(x) OSSwapBigToHostInt64(x)
#define le64toh(x) OSSwapLittleToHostInt64(x)
#define UNIX_PATH_MAX 104
#define AT_SYMLINK_NOFOLLOW 0x100
#include <sys/types.h>
#include <sys/un.h>
#include <machine/endian.h>
#include <sys/xattr.h>
#include <limits.h>

View File

@ -1041,7 +1041,7 @@ data_to_uint8 (data_t *data)
errno = 0;
value = strtol (str, NULL, 0);
if ((UCHAR_MAX - value) < 0) {
if ((UCHAR_MAX - (uint8_t)value) < 0) {
errno = ERANGE;
gf_log_callingfn ("dict", GF_LOG_WARNING,
"data conversion overflow detected (%s)",
@ -2157,7 +2157,7 @@ dict_set_bin (dict_t *this, char *key, void *ptr, size_t size)
data_t * data = NULL;
int ret = 0;
if (!ptr || (size < 0)) {
if (!ptr || (size > ULONG_MAX)) {
ret = -EINVAL;
goto err;
}
@ -2185,7 +2185,7 @@ dict_set_static_bin (dict_t *this, char *key, void *ptr, size_t size)
data_t * data = NULL;
int ret = 0;
if (!ptr || (size < 0)) {
if (!ptr || (size > ULONG_MAX)) {
ret = -EINVAL;
goto err;
}

View File

@ -59,7 +59,7 @@ gf_fd_fdtable_expand (fdtable_t *fdtable, uint32_t nr)
uint32_t oldmax_fds = -1;
int ret = -1;
if (fdtable == NULL || nr < 0) {
if (fdtable == NULL || nr > UINT32_MAX) {
gf_log_callingfn ("fd", GF_LOG_ERROR, "invalid argument");
ret = EINVAL;
goto out;

View File

@ -162,7 +162,7 @@
/* TODO: Keeping it to 200, so that we can fit in 2KB buffer for auth data
* in RPC server code, if there is ever need for having more aux-gids, then
* we have to add aux-gid in payload of actors */
#define GF_MAX_AUX_GROUPS 65536
#define GF_MAX_AUX_GROUPS 65535
#define GF_UUID_BUF_SIZE 50

View File

@ -21,9 +21,16 @@
#include <locale.h>
#include <string.h>
#include <stdlib.h>
#include <libintl.h>
#include <syslog.h>
#ifdef HAVE_LIBINTL_H
#include <libintl.h>
#endif
#ifdef HAVE_BACKTRACE
#include <execinfo.h>
#endif
#include <sys/stat.h>
#include "gf-error-codes.h"
@ -40,14 +47,6 @@
#include "defaults.h"
#include "glusterfs.h"
#ifdef GF_LINUX_HOST_OS
#include <syslog.h>
#endif
#ifdef HAVE_BACKTRACE
#include <execinfo.h>
#endif
static char *gf_level_strings[] = {"", /* NONE */
"M", /* EMERGENCY */
"A", /* ALERT */
@ -374,9 +373,10 @@ gf_openlog (const char *ident, int option, int facility)
/* TODO: Should check for errors here and return appropriately */
setlocale(LC_ALL, "");
#ifdef HAVE_LIBINTL_H
bindtextdomain("gluster", "/usr/share/locale");
textdomain("gluster");
#endif
/* close the previous syslog if open as we are changing settings */
closelog ();
openlog(ident, _option, _facility);

View File

@ -24,17 +24,27 @@
#ifdef GF_DARWIN_HOST_OS
#define GF_PRI_FSBLK "u"
#define GF_PRI_DEV PRId32
#define GF_PRI_NLINK PRIu16
#define GF_PRI_INODE PRIu64
#define GF_PRI_NLINK PRIu32
#define GF_PRI_SECOND "ld"
#define GF_PRI_SUSECONDS "06d"
#define GF_PRI_USEC "d"
#else
#define GF_PRI_FSBLK PRIu64
#define GF_PRI_DEV PRIu64
#define GF_PRI_INODE PRIu64
#define GF_PRI_NLINK PRIu32
#define GF_PRI_SECOND "lu"
#define GF_PRI_SUSECONDS "06ld"
#endif
#define GF_PRI_BLKSIZE PRId32
#define GF_PRI_SIZET "zu"
#ifdef GF_DARWIN_HOST_OS
#define GF_PRI_TIME "ld"
#else
#define GF_PRI_TIME PRIu64
#endif
#if 0
/* Syslog definitions :-) */

View File

@ -0,0 +1,25 @@
/*
Copyright (c) 2014 Red Hat, Inc. <http://www.redhat.com>
This file is part of GlusterFS.
This file is licensed to you under your choice of the GNU Lesser
General Public License, version 3 or any later version (LGPLv3 or
later), or the GNU General Public License, version 2 (GPLv2), in all
cases as published by the Free Software Foundation.
*/
#ifndef _LVM_DEFAULTS_H
#define _LVM_DEFAULTS_H
#ifndef _CONFIG_H
#define _CONFIG_H
#include "config.h"
#endif
#define LVM_RESIZE "/sbin/lvresize"
#define LVM_CREATE "/sbin/lvcreate"
#define LVM_CONVERT "/sbin/lvconvert"
#define LVM_REMOVE "/sbin/lvremove"
#define LVS "/sbin/lvs"
#endif /* _LVM_DEFAULTS_H */

View File

@ -79,7 +79,7 @@ xlator_option_validate_int (xlator_t *xl, const char *key, const char *value,
goto out;
}
if ((opt->validate == GF_OPT_VALIDATE_MIN)) {
if (opt->validate == GF_OPT_VALIDATE_MIN) {
if (inputll < opt->min) {
snprintf (errstr, 256,
"'%lld' in 'option %s %s' is smaller than "
@ -88,8 +88,8 @@ xlator_option_validate_int (xlator_t *xl, const char *key, const char *value,
gf_log (xl->name, GF_LOG_ERROR, "%s", errstr);
goto out;
}
} else if ((opt->validate == GF_OPT_VALIDATE_MAX)) {
if ((inputll > opt->max)) {
} else if (opt->validate == GF_OPT_VALIDATE_MAX) {
if (inputll > opt->max) {
snprintf (errstr, 256,
"'%lld' in 'option %s %s' is greater than "
"maximum value '%.0f'", inputll, key,
@ -118,12 +118,12 @@ static int
xlator_option_validate_sizet (xlator_t *xl, const char *key, const char *value,
volume_option_t *opt, char **op_errstr)
{
uint64_t size = 0;
size_t size = 0;
int ret = 0;
char errstr[256];
/* Check the range */
if (gf_string2bytesize (value, &size) != 0) {
if (gf_string2bytesize_size (value, &size) != 0) {
snprintf (errstr, 256,
"invalid number format \"%s\" in option \"%s\"",
value, key);
@ -142,13 +142,13 @@ xlator_option_validate_sizet (xlator_t *xl, const char *key, const char *value,
if ((size < opt->min) || (size > opt->max)) {
if ((strncmp (key, "cache-size", 10) == 0) &&
(size > opt->max)) {
snprintf (errstr, 256, "Cache size %"PRId64" is out of "
snprintf (errstr, 256, "Cache size %" GF_PRI_SIZET " is out of "
"range [%.0f - %.0f]",
size, opt->min, opt->max);
gf_log (xl->name, GF_LOG_WARNING, "%s", errstr);
} else {
snprintf (errstr, 256,
"'%"PRId64"' in 'option %s %s' "
"'%" GF_PRI_SIZET "' in 'option %s %s' "
"is out of range [%.0f - %.0f]",
size, key, value, opt->min, opt->max);
gf_log (xl->name, GF_LOG_ERROR, "%s", errstr);
@ -478,7 +478,7 @@ xlator_option_validate_double (xlator_t *xl, const char *key, const char *value,
goto out;
}
if ((opt->validate == GF_OPT_VALIDATE_MIN)) {
if (opt->validate == GF_OPT_VALIDATE_MIN) {
if (input < opt->min) {
snprintf (errstr, 256,
"'%f' in 'option %s %s' is smaller than "
@ -487,8 +487,8 @@ xlator_option_validate_double (xlator_t *xl, const char *key, const char *value,
gf_log (xl->name, GF_LOG_ERROR, "%s", errstr);
goto out;
}
} else if ((opt->validate == GF_OPT_VALIDATE_MAX)) {
if ((input > opt->max)) {
} else if (opt->validate == GF_OPT_VALIDATE_MAX) {
if (input > opt->max) {
snprintf (errstr, 256,
"'%f' in 'option %s %s' is greater than "
"maximum value '%f'", input, key,
@ -617,12 +617,12 @@ out:
static int
gf_validate_size (const char *sizestr, volume_option_t *opt)
{
uint64_t value = 0;
size_t value = 0;
int ret = 0;
GF_ASSERT (opt);
if (gf_string2bytesize (sizestr, &value) != 0 ||
if (gf_string2bytesize_size (sizestr, &value) != 0 ||
value < opt->min ||
value % 512) {
ret = -1;
@ -787,7 +787,7 @@ xlator_option_validate (xlator_t *xl, char *key, char *value,
[GF_OPTION_TYPE_MAX] = NULL,
};
if (opt->type < 0 || opt->type >= GF_OPTION_TYPE_MAX) {
if (opt->type > GF_OPTION_TYPE_MAX) {
gf_log (xl->name, GF_LOG_ERROR,
"unknown option type '%d'", opt->type);
goto out;
@ -1120,18 +1120,18 @@ pc_or_size (char *in, double *out)
{
double pc = 0;
int ret = 0;
uint64_t size = 0;
size_t size = 0;
if (gf_string2percent (in, &pc) == 0) {
if (pc > 100.0) {
ret = gf_string2bytesize (in, &size);
ret = gf_string2bytesize_size (in, &size);
if (!ret)
*out = size;
} else {
*out = pc;
}
} else {
ret = gf_string2bytesize (in, &size);
ret = gf_string2bytesize_size (in, &size);
if (!ret)
*out = size;
}
@ -1143,7 +1143,8 @@ DEFINE_INIT_OPT(uint64_t, uint64, gf_string2uint64);
DEFINE_INIT_OPT(int64_t, int64, gf_string2int64);
DEFINE_INIT_OPT(uint32_t, uint32, gf_string2uint32);
DEFINE_INIT_OPT(int32_t, int32, gf_string2int32);
DEFINE_INIT_OPT(uint64_t, size, gf_string2bytesize);
DEFINE_INIT_OPT(size_t, size, gf_string2bytesize_size);
DEFINE_INIT_OPT(uint64_t, size_uint64, gf_string2bytesize_uint64);
DEFINE_INIT_OPT(double, percent, gf_string2percent);
DEFINE_INIT_OPT(double, percent_or_size, pc_or_size);
DEFINE_INIT_OPT(gf_boolean_t, bool, gf_string2boolean);
@ -1158,7 +1159,8 @@ DEFINE_RECONF_OPT(uint64_t, uint64, gf_string2uint64);
DEFINE_RECONF_OPT(int64_t, int64, gf_string2int64);
DEFINE_RECONF_OPT(uint32_t, uint32, gf_string2uint32);
DEFINE_RECONF_OPT(int32_t, int32, gf_string2int32);
DEFINE_RECONF_OPT(uint64_t, size, gf_string2bytesize);
DEFINE_RECONF_OPT(size_t, size, gf_string2bytesize_size);
DEFINE_RECONF_OPT(uint64_t, size_uint64, gf_string2bytesize_uint64);
DEFINE_RECONF_OPT(double, percent, gf_string2percent);
DEFINE_RECONF_OPT(double, percent_or_size, pc_or_size);
DEFINE_RECONF_OPT(gf_boolean_t, bool, gf_string2boolean);

View File

@ -108,7 +108,8 @@ DECLARE_INIT_OPT(uint64_t, uint64);
DECLARE_INIT_OPT(int64_t, int64);
DECLARE_INIT_OPT(uint32_t, uint32);
DECLARE_INIT_OPT(int32_t, int32);
DECLARE_INIT_OPT(uint64_t, size);
DECLARE_INIT_OPT(size_t, size);
DECLARE_INIT_OPT(uint64_t, size_uint64);
DECLARE_INIT_OPT(double, percent);
DECLARE_INIT_OPT(double, percent_or_size);
DECLARE_INIT_OPT(gf_boolean_t, bool);
@ -163,8 +164,12 @@ xlator_option_init_##type (xlator_t *this, dict_t *options, char *key, \
THIS = this; \
ret = conv (value, val_p); \
THIS = old_THIS; \
if (ret) \
if (ret) { \
gf_log (this->name, GF_LOG_INFO, \
"option %s convertion failed value %s", \
key, value); \
return ret; \
} \
ret = xlator_option_validate (this, key, value, opt, NULL); \
return ret; \
}
@ -189,7 +194,8 @@ DECLARE_RECONF_OPT(uint64_t, uint64);
DECLARE_RECONF_OPT(int64_t, int64);
DECLARE_RECONF_OPT(uint32_t, uint32);
DECLARE_RECONF_OPT(int32_t, int32);
DECLARE_RECONF_OPT(uint64_t, size);
DECLARE_RECONF_OPT(size_t, size);
DECLARE_RECONF_OPT(uint64_t, size_uint64);
DECLARE_RECONF_OPT(double, percent);
DECLARE_RECONF_OPT(double, percent_or_size);
DECLARE_RECONF_OPT(gf_boolean_t, bool);

View File

@ -19,6 +19,7 @@
#include <sys/types.h>
#include <utime.h>
#include <sys/time.h>
#include <fcntl.h>
int
sys_lstat (const char *path, struct stat *buf)
@ -41,12 +42,58 @@ sys_fstat (int fd, struct stat *buf)
}
int
sys_fstatat(int dirfd, const char *pathname, struct stat *buf, int flags)
{
#ifdef GF_DARWIN_HOST_OS
if (fchdir(dirfd) < 0)
return -1;
if(flags & AT_SYMLINK_NOFOLLOW)
return lstat(pathname, buf);
else
return stat(pathname, buf);
#else
return fstatat (dirfd, pathname, buf, flags);
#endif
}
int
sys_openat(int dirfd, const char *pathname, int flags, ...)
{
mode_t mode = 0;
if (flags & O_CREAT) {
va_list ap;
va_start(ap, flags);
mode = va_arg(ap, int);
va_end(ap);
}
#ifdef GF_DARWIN_HOST_OS
if (fchdir(dirfd) < 0)
return -1;
return open (pathname, flags, mode);
#else
return openat (dirfd, pathname, flags, mode);
#endif
}
DIR *
sys_opendir (const char *name)
{
return opendir (name);
}
int sys_mkdirat(int dirfd, const char *pathname, mode_t mode)
{
#ifdef GF_DARWIN_HOST_OS
if(fchdir(dirfd) < 0)
return -1;
return mkdir(pathname, mode);
#else
return mkdirat (dirfd, pathname, mode);
#endif
}
struct dirent *
sys_readdir (DIR *dir)
@ -262,13 +309,43 @@ sys_fsync (int fd)
int
sys_fdatasync (int fd)
{
#ifdef HAVE_FDATASYNC
return fdatasync (fd);
#ifdef GF_DARWIN_HOST_OS
return fcntl (fd, F_FULLFSYNC);
#else
return 0;
return fdatasync (fd);
#endif
}
void
gf_add_prefix(const char *ns, const char *key, char **newkey)
{
/* if we dont have any namespace, append USER NS */
if (strncmp(key, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) &&
strncmp(key, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) &&
strncmp(key, XATTR_SECURITY_PREFIX, XATTR_TRUSTED_PREFIX_LEN) &&
strncmp(key, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) {
int ns_length = strlen(ns);
*newkey = GF_MALLOC(ns_length + strlen(key) + 10,
gf_common_mt_char);
strcpy(*newkey, ns);
strcat(*newkey, key);
} else {
*newkey = gf_strdup(key);
}
}
void
gf_remove_prefix(const char *ns, const char *key, char **newkey)
{
int ns_length = strlen(ns);
if (strncmp(key, ns, ns_length) == 0) {
*newkey = GF_MALLOC(-ns_length + strlen(key) + 10,
gf_common_mt_char);
strcpy(*newkey, key + ns_length);
} else {
*newkey = gf_strdup(key);
}
}
int
sys_lsetxattr (const char *path, const char *name, const void *value,
@ -289,8 +366,11 @@ sys_lsetxattr (const char *path, const char *name, const void *value,
#endif
#ifdef GF_DARWIN_HOST_OS
/* OS X clients will carry other flags, which will be used on a
OS X host, but masked out on others. GF assume NOFOLLOW on Linux,
enforcing */
return setxattr (path, name, value, size, 0,
flags|XATTR_NOFOLLOW);
(flags & ~XATTR_NOSECURITY) | XATTR_NOFOLLOW);
#endif
}
@ -313,12 +393,10 @@ sys_llistxattr (const char *path, char *list, size_t size)
#endif
#ifdef GF_DARWIN_HOST_OS
return listxattr (path, list, size, XATTR_NOFOLLOW);
return listxattr (path, list, size, XATTR_NOFOLLOW);
#endif
}
ssize_t
sys_lgetxattr (const char *path, const char *name, void *value, size_t size)
{
@ -337,7 +415,7 @@ sys_lgetxattr (const char *path, const char *name, void *value, size_t size)
#endif
#ifdef GF_DARWIN_HOST_OS
return getxattr (path, name, value, size, 0, XATTR_NOFOLLOW);
return getxattr (path, name, value, size, 0, XATTR_NOFOLLOW);
#endif
}
@ -412,7 +490,7 @@ sys_fsetxattr (int filedes, const char *name, const void *value,
#endif
#ifdef GF_DARWIN_HOST_OS
return fsetxattr (filedes, name, value, size, 0, flags);
return fsetxattr (filedes, name, value, size, 0, flags & ~XATTR_NOSECURITY);
#endif
}
@ -435,7 +513,7 @@ sys_flistxattr (int filedes, char *list, size_t size)
#endif
#ifdef GF_DARWIN_HOST_OS
return flistxattr (filedes, list, size, XATTR_NOFOLLOW);
return flistxattr (filedes, list, size, XATTR_NOFOLLOW);
#endif
}
@ -491,4 +569,3 @@ sys_fallocate(int fd, int mode, off_t offset, off_t len)
errno = ENOSYS;
return -1;
}

View File

@ -11,6 +11,41 @@
#ifndef __SYSCALL_H__
#define __SYSCALL_H__
/* GF follows the Linux XATTR definition, which differs in Darwin. */
#define GF_XATTR_CREATE 0x1 /* set value, fail if attr already exists */
#define GF_XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
/* Linux kernel version 2.6.x don't have these defined
define if not defined */
#ifndef XATTR_SECURITY_PREFIX
#define XATTR_SECURITY_PREFIX "security."
#define XATTR_SECURITY_PREFIX_LEN (sizeof (XATTR_SECURITY_PREFIX) - 1)
#endif
#ifndef XATTR_SYSTEM_PREFIX
#define XATTR_SYSTEM_PREFIX "system."
#define XATTR_SYSTEM_PREFIX_LEN (sizeof (XATTR_SYSTEM_PREFIX) - 1)
#endif
#ifndef XATTR_TRUSTED_PREFIX
#define XATTR_TRUSTED_PREFIX "trusted."
#define XATTR_TRUSTED_PREFIX_LEN (sizeof (XATTR_TRUSTED_PREFIX) - 1)
#endif
#ifndef XATTR_USER_PREFIX
#define XATTR_USER_PREFIX "user."
#define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1)
#endif
#if defined(GF_DARWIN_HOST_OS)
#include <sys/xattr.h>
#define XATTR_DARWIN_NOSECURITY XATTR_NOSECURITY
#define XATTR_DARWIN_NODEFAULT XATTR_NODEFAULT
#define XATTR_DARWIN_SHOWCOMPRESSION XATTR_SHOWCOMPRESSION
#endif
int
sys_lstat (const char *path, struct stat *buf);
@ -20,8 +55,13 @@ sys_stat (const char *path, struct stat *buf);
int
sys_fstat (int fd, struct stat *buf);
DIR *
sys_opendir (const char *name);
int
sys_fstatat (int dirfd, const char *pathname, struct stat *buf,
int flags);
int
sys_openat (int dirfd, const char *pathname, int flags, ...);
DIR *sys_opendir (const char *name);
struct dirent *
sys_readdir (DIR *dir);
@ -38,6 +78,9 @@ sys_mknod (const char *pathname, mode_t mode, dev_t dev);
int
sys_mkdir (const char *pathname, mode_t mode);
int
sys_mkdirat (int dirfd, const char *pathname, mode_t mode);
int
sys_unlink (const char *pathname);
@ -107,6 +150,12 @@ sys_fsync (int fd);
int
sys_fdatasync (int fd);
void
gf_add_prefix(const char *ns, const char *key, char **newkey);
void
gf_remove_prefix(const char *ns, const char *key, char **newkey);
int
sys_lsetxattr (const char *path, const char *name, const void *value,
size_t size, int flags);

View File

@ -10,54 +10,51 @@
#include <stdio.h>
#include <inttypes.h>
#if defined GF_LINUX_HOST_OS || defined GF_SOLARIS_HOST_OS || defined GF_BSD_HOST_OS
#include <time.h>
#include <sys/time.h>
#endif
#if defined GF_DARWIN_HOST_OS
#include <mach/mach_time.h>
static mach_timebase_info_data_t gf_timebase;
#endif
#include "logging.h"
#include "time.h"
void tv2ts (struct timeval tv, struct timespec *ts)
{
ts->tv_sec = tv.tv_sec;
ts->tv_nsec = tv.tv_usec * 1000;
}
#include "timespec.h"
void timespec_now (struct timespec *ts)
{
#if defined GF_LINUX_HOST_OS || defined GF_SOLARIS_HOST_OS || defined GF_BSD_HOST_OS
if (0 == clock_gettime(CLOCK_MONOTONIC, ts))
return;
else {
struct timeval tv;
if (0 == gettimeofday(&tv, NULL))
tv2ts(tv, ts);
TIMEVAL_TO_TIMESPEC(&tv, ts);
}
#elif defined GF_DARWIN_HOST_OS
mach_timebase_info_data_t tb = { 0 };
static double timebase = 0.0;
uint64_t time = 0;
mach_timebase_info (&tb);
uint64_t time = mach_absolute_time();
static double scaling = 0.0;
timebase *= info.numer;
timebase /= info.denom;
if (mach_timebase_info(&gf_timebase) != KERN_SUCCESS) {
gf_timebase.numer = 1;
gf_timebase.denom = 1;
}
if (gf_timebase.denom == 0) {
gf_timebase.numer = 1;
gf_timebase.denom = 1;
}
time = mach_absolute_time();
time *= timebase;
scaling = (double) gf_timebase.numer / (double) gf_timebase.denom;
time *= scaling;
ts->tv_sec = (time * NANO);
ts->tv_nsec = (time - (ts.tv_sec * GIGA));
ts->tv_nsec = (time - (ts->tv_sec * GIGA));
#endif /* Platform verification */
gf_log_callingfn ("timer", GF_LOG_DEBUG, "%"PRIu64".%09"PRIu64,
/*
gf_log_callingfn ("timer", GF_LOG_TRACE, "%"GF_PRI_TIME".%09"GF_PRI_TIME,
ts->tv_sec, ts->tv_nsec);
*/
}
void timespec_adjust_delta (struct timespec *ts, struct timespec delta)

View File

@ -12,12 +12,12 @@
#define __INCLUDE_TIMESPEC_H__
#include <stdint.h>
#include <sys/time.h>
#define TS(ts) ((ts.tv_sec * 1000000000LL) + ts.tv_nsec)
#define NANO (+1.0E-9)
#define GIGA UINT64_C(1000000000)
void tv2ts (struct timeval tv, struct timespec *ts);
void timespec_now (struct timespec *ts);
void timespec_adjust_delta (struct timespec *ts, struct timespec delta);

View File

@ -2,10 +2,10 @@ lib_LTLIBRARIES = libgfrpc.la
libgfrpc_la_SOURCES = auth-unix.c rpcsvc-auth.c rpcsvc.c auth-null.c \
rpc-transport.c xdr-rpc.c xdr-rpcclnt.c rpc-clnt.c auth-glusterfs.c \
rpc-drc.c
rpc-drc.c $(CONTRIBDIR)/sunrpc/xdr_sizeof.c
libgfrpc_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
libgfrpc_la_LDFLAGS = -version-info $(LIBGFRPC_LT_VERSION)
libgfrpc_la_LDFLAGS = -version-info $(LIBGFRPC_LT_VERSION) $(GF_LDFLAGS)
noinst_HEADERS = rpcsvc.h rpc-transport.h xdr-common.h xdr-rpc.h xdr-rpcclnt.h \
rpc-clnt.h rpcsvc-common.h protocol-common.h rpc-drc.h

View File

@ -717,8 +717,9 @@ rpc_clnt_handle_cbk (struct rpc_clnt *clnt, rpc_transport_pollin_t *msg)
}
gf_log (clnt->conn.name, GF_LOG_TRACE,
"received rpc message (XID: 0x%lx, "
"Ver: %ld, Program: %ld, ProgVers: %ld, Proc: %ld) "
"receivd rpc message (XID: 0x%" GF_PRI_RPC_XID ", "
"Ver: %" GF_PRI_RPC_VERSION ", Program: %" GF_PRI_RPC_PROG_ID ", "
"ProgVers: %" GF_PRI_RPC_PROG_VERS ", Proc: %" GF_PRI_RPC_PROC ") "
"from rpc-transport (%s)", rpc_call_xid (&rpcmsg),
rpc_call_rpcvers (&rpcmsg), rpc_call_program (&rpcmsg),
rpc_call_progver (&rpcmsg), rpc_call_progproc (&rpcmsg),
@ -1141,7 +1142,7 @@ xdr_serialize_glusterfs_auth (char *dest, struct auth_glusterfs_parms_v2 *au)
{
ssize_t ret = -1;
XDR xdr;
uint64_t ngroups = 0;
u_long ngroups = 0;
int max_groups = 0;
if ((!dest) || (!au))

View File

@ -460,7 +460,7 @@ rpcsvc_vacate_drc_entries (rpcsvc_drc_globals_t *drc)
client = reply->client;
(void *)rb_delete (client->rbtree, reply);
rb_delete (client->rbtree, reply);
rpcsvc_drc_op_destroy (drc, reply);
rpcsvc_drc_client_unref (drc, client);

View File

@ -423,9 +423,10 @@ rpcsvc_request_create (rpcsvc_t *svc, rpc_transport_t *trans,
ret = -1;
rpcsvc_request_init (svc, trans, &rpcmsg, progmsg, msg, req);
gf_log (GF_RPCSVC, GF_LOG_TRACE, "received rpc-message (XID: 0x%lx, "
"Ver: %ld, Program: %ld, ProgVers: %ld, Proc: %ld) from"
" rpc-transport (%s)", rpc_call_xid (&rpcmsg),
gf_log (GF_RPCSVC, GF_LOG_TRACE, "received rpc-message "
"(XID: 0x%" GF_PRI_RPC_XID ", Ver: %" GF_PRI_RPC_VERSION ", Program: %" GF_PRI_RPC_PROG_ID ", "
"ProgVers: %" GF_PRI_RPC_PROG_VERS ", Proc: %" GF_PRI_RPC_PROC ") "
"from rpc-transport (%s)", rpc_call_xid (&rpcmsg),
rpc_call_rpcvers (&rpcmsg), rpc_call_program (&rpcmsg),
rpc_call_progver (&rpcmsg), rpc_call_progproc (&rpcmsg),
trans->name);
@ -434,8 +435,9 @@ rpcsvc_request_create (rpcsvc_t *svc, rpc_transport_t *trans,
/* LOG- TODO: print rpc version, also print the peerinfo
from transport */
gf_log (GF_RPCSVC, GF_LOG_ERROR, "RPC version not supported "
"(XID: 0x%lx, Ver: %ld, Prog: %ld, ProgVers: %ld, "
"Proc: %ld) from trans (%s)", rpc_call_xid (&rpcmsg),
"(XID: 0x%" GF_PRI_RPC_XID ", Ver: %" GF_PRI_RPC_VERSION ", Program: %" GF_PRI_RPC_PROG_ID ", "
"ProgVers: %" GF_PRI_RPC_PROG_VERS ", Proc: %" GF_PRI_RPC_PROC ") "
"from trans (%s)", rpc_call_xid (&rpcmsg),
rpc_call_rpcvers (&rpcmsg), rpc_call_program (&rpcmsg),
rpc_call_progver (&rpcmsg), rpc_call_progproc (&rpcmsg),
trans->name);
@ -451,8 +453,9 @@ rpcsvc_request_create (rpcsvc_t *svc, rpc_transport_t *trans,
*/
rpcsvc_request_seterr (req, AUTH_ERROR);
gf_log (GF_RPCSVC, GF_LOG_ERROR, "auth failed on request. "
"(XID: 0x%lx, Ver: %ld, Prog: %ld, ProgVers: %ld, "
"Proc: %ld) from trans (%s)", rpc_call_xid (&rpcmsg),
"(XID: 0x%" GF_PRI_RPC_XID ", Ver: %" GF_PRI_RPC_VERSION ", Program: %" GF_PRI_RPC_PROG_ID ", "
"ProgVers: %" GF_PRI_RPC_PROG_VERS ", Proc: %" GF_PRI_RPC_PROC ") "
"from trans (%s)", rpc_call_xid (&rpcmsg),
rpc_call_rpcvers (&rpcmsg), rpc_call_program (&rpcmsg),
rpc_call_progver (&rpcmsg), rpc_call_progproc (&rpcmsg),
trans->name);
@ -797,15 +800,9 @@ err:
return txrecord;
}
static inline int
rpcsvc_get_callid (rpcsvc_t *rpc)
{
return GF_UNIVERSAL_ANSWER;
}
int
rpcsvc_fill_callback (int prognum, int progver, int procnum, int payload,
uint64_t xid, struct rpc_msg *request)
uint32_t xid, struct rpc_msg *request)
{
int ret = -1;
@ -870,9 +867,9 @@ out:
return txrecord;
}
struct iobuf *
static struct iobuf *
rpcsvc_callback_build_record (rpcsvc_t *rpc, int prognum, int progver,
int procnum, size_t payload, uint64_t xid,
int procnum, size_t payload, u_long xid,
struct iovec *recbuf)
{
struct rpc_msg request = {0, };
@ -892,7 +889,7 @@ rpcsvc_callback_build_record (rpcsvc_t *rpc, int prognum, int progver,
&request);
if (ret == -1) {
gf_log ("rpcsvc", GF_LOG_WARNING, "cannot build a rpc-request "
"xid (%"PRIu64")", xid);
"xid (%" GF_PRI_RPC_XID ")", xid);
goto out;
}
@ -939,7 +936,6 @@ rpcsvc_callback_submit (rpcsvc_t *rpc, rpc_transport_t *trans,
rpc_transport_req_t req;
int ret = -1;
int proglen = 0;
uint64_t callid = 0;
if (!rpc) {
goto out;
@ -947,15 +943,14 @@ rpcsvc_callback_submit (rpcsvc_t *rpc, rpc_transport_t *trans,
memset (&req, 0, sizeof (req));
callid = rpcsvc_get_callid (rpc);
if (proghdr) {
proglen += iov_length (proghdr, proghdrcount);
}
request_iob = rpcsvc_callback_build_record (rpc, prog->prognum,
prog->progver, procnum,
proglen, callid,
proglen,
GF_UNIVERSAL_ANSWER,
&rpchdr);
if (!request_iob) {
gf_log ("rpcsvc", GF_LOG_WARNING,
@ -1256,7 +1251,7 @@ rpcsvc_program_register_portmap (rpcsvc_program_t *newprog, uint32_t port)
if (!(pmap_set (newprog->prognum, newprog->progver, IPPROTO_TCP,
port))) {
gf_log (GF_RPCSVC, GF_LOG_ERROR, "Could not register with"
" portmap");
" portmap %d %d %u", newprog->prognum, newprog->progver, port);
goto out;
}

View File

@ -18,8 +18,8 @@
#include <rpc/types.h>
#include <sys/types.h>
#include <rpc/auth.h>
#include <rpc/xdr.h>
#include <rpc/auth.h>
#include <sys/uio.h>
#ifdef __NetBSD__
@ -68,7 +68,9 @@ enum gf_dump_procnum {
#define xdr_u_quad_t xdr_u_int64_t
#define xdr_quad_t xdr_int64_t
#define xdr_uint32_t xdr_u_int32_t
#define uint64_t u_int64_t
#define xdr_uint64_t xdr_u_int64_t
unsigned long xdr_sizeof (xdrproc_t func, void *data);
#endif
#if defined(__NetBSD__)

View File

@ -78,4 +78,21 @@ xdr_to_auth_unix_cred (char *msgbuf, int msglen, struct authunix_parms *au,
#define rpc_call_verf_flavour(call) (rpc_opaque_auth_flavour ((&(call)->ru.RM_cmb.cb_verf)))
#define rpc_call_verf_len(call) (rpc_opaque_auth_len ((&(call)->ru.RM_cmb.cb_verf)))
#ifdef GF_DARWIN_HOST_OS
#define GF_PRI_RPC_XID PRIu32
#define GF_PRI_RPC_VERSION PRIu32
#define GF_PRI_RPC_PROG_ID PRIu32
#define GF_PRI_RPC_PROG_VERS PRIu32
#define GF_PRI_RPC_PROC PRIu32
#define GF_PRI_RPC_PROC_VERSION PRIu32
#else
#define GF_PRI_RPC_XID PRIu64
#define GF_PRI_RPC_VERSION PRIu64
#define GF_PRI_RPC_PROG_ID PRIu64
#define GF_PRI_RPC_PROG_VERS PRIu64
#define GF_PRI_RPC_PROC PRIu64
#define GF_PRI_RPC_PROC_VERSION PRIu64
#endif
#endif

View File

@ -3,7 +3,7 @@
transport_LTLIBRARIES = rdma.la
transportdir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/rpc-transport
rdma_la_LDFLAGS = -module -avoid-version
rdma_la_LDFLAGS = -module -avoid-version -nostartfiles
rdma_la_SOURCES = rdma.c name.c
rdma_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
@ -11,7 +11,7 @@ rdma_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
noinst_HEADERS = rdma.h name.h
-I$(top_srcdir)/libglusterfs/src -I$(top_srcdir)/rpc/rpc-lib/src/ \
-I$(top_srcdir)/xlators/protocol/lib/src/ -shared -nostartfiles $(GF_CFLAGS)
-I$(top_srcdir)/xlators/protocol/lib/src/ -shared $(GF_CFLAGS)
AM_CPPFLAGS = $(GF_CPPFLAGS) \
-I$(top_srcdir)/libglusterfs/src -I$(top_srcdir)/rpc/rpc-lib/src/ \

View File

@ -2027,7 +2027,7 @@ out:
}
inline int32_t
static inline int32_t
__gf_rdma_register_local_mr_for_rdma (gf_rdma_peer_t *peer,
struct iovec *vector, int count,
gf_rdma_post_context_t *ctx)
@ -3074,7 +3074,7 @@ out:
}
inline int32_t
static inline int32_t
gf_rdma_decode_error_msg (gf_rdma_peer_t *peer, gf_rdma_post_t *post,
size_t bytes_in_post)
{
@ -3616,7 +3616,7 @@ out:
}
inline int32_t
static inline int32_t
gf_rdma_recv_request (gf_rdma_peer_t *peer, gf_rdma_post_t *post,
gf_rdma_read_chunk_t *readch)
{

View File

@ -3346,7 +3346,7 @@ reconfigure (rpc_transport_t *this, dict_t *options)
optstr = NULL;
if (dict_get_str (this->options, "tcp-window-size",
&optstr) == 0) {
if (gf_string2bytesize (optstr, &windowsize) != 0) {
if (gf_string2uint64 (optstr, &windowsize) != 0) {
gf_log (this->name, GF_LOG_ERROR,
"invalid number format: %s", optstr);
goto out;
@ -3467,7 +3467,7 @@ socket_init (rpc_transport_t *this)
optstr = NULL;
if (dict_get_str (this->options, "tcp-window-size",
&optstr) == 0) {
if (gf_string2bytesize (optstr, &windowsize) != 0) {
if (gf_string2uint64 (optstr, &windowsize) != 0) {
gf_log (this->name, GF_LOG_ERROR,
"invalid number format: %s", optstr);
return -1;

View File

@ -17,13 +17,7 @@
#define _NLM_H_RPCGEN
#include <rpc/rpc.h>
#if defined(__NetBSD__)
#define xdr_u_quad_t xdr_u_int64_t
#define xdr_quad_t xdr_int64_t
#define xdr_uint32_t xdr_u_int32_t
#define xdr_uint64_t xdr_u_int64_t
#endif
#include "xdr-common.h"
#ifdef __cplusplus
extern "C" {
@ -33,6 +27,14 @@ extern "C" {
#define LM_MAXSTRLEN 1024
#define MAXNAMELEN 1025
#if defined(GF_DARWIN_HOST_OS)
#define xdr_u_quad_t xdr_u_int64_t
#define xdr_quad_t xdr_int64_t
#define xdr_uint32_t xdr_u_int32_t
#define xdr_uint64_t xdr_u_int64_t
#define uint64_t u_int64_t
#endif
#if defined(__NetBSD__)
#define xdr_u_quad_t xdr_u_int64_t
#define xdr_quad_t xdr_int64_t

View File

@ -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)) {
if (!proc (&xdr, res, 0)) {
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)) {
if (!proc (&xdr, args, 0)) {
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)) {
if (!proc (&xdr, args, 0)) {
ret = -1;
goto ret;
}

View File

@ -95,6 +95,7 @@ enum nfsstat3 {
NFS3ERR_SERVERFAULT = 10006,
NFS3ERR_BADTYPE = 10007,
NFS3ERR_JUKEBOX = 10008,
NFS3ERR_END_OF_LIST = -1,
};
typedef enum nfsstat3 nfsstat3;

View File

@ -24,11 +24,10 @@ TEST $CLI volume set $V0 build-pgfid on;
TEST mkdir $M0/a;
TEST touch $M0/a/b;
getfattr -e text -n glusterfs.ancestry.path "$M0/a/b" | grep "^glusterfs.ancestry.path" | cut -d"=" -f2 | tr -d \";
EXPECT "/a/b" get_ancestry_path "/a/b";
TEST $CLI volume set $V0 build-pgfid off;
TEST ! getfattr -e text -n "glusterfs.ancestry.path" $M0/a/b;
EXPECT "" get_ancestry_path "/a/b";
TEST $CLI volume stop $V0;
TEST $CLI volume delete $V0;

View File

@ -5,6 +5,7 @@
. $(dirname $0)/../cluster.rc
. $(dirname $0)/../snapshot.rc
V1="patchy2"
function create_volumes() {
@ -48,6 +49,7 @@ function restore_snapshots() {
}
cleanup;
TEST verify_lvm_version;
#Create cluster with 3 nodes
TEST launch_cluster 3;
TEST setup_lvm 3
@ -92,4 +94,3 @@ TEST ! volume_exists $V0
TEST ! volume_exists $V1
cleanup;

View File

@ -4,6 +4,7 @@
. $(dirname $0)/../snapshot.rc
cleanup;
TEST verify_lvm_version;
TEST glusterd;
TEST pidof glusterd;

View File

@ -6,7 +6,7 @@
. $(dirname $0)/../snapshot.rc
cleanup;
TEST verify_lvm_version
TEST launch_cluster 2
TEST setup_lvm 2

View File

@ -46,6 +46,13 @@ function init_lvm() {
return 0
}
function verify_lvm_version() {
if `/sbin/lvcreate --help | grep -q thin`; then
return 0;
fi
return 1;
}
function setup_lvm() {
init_lvm $@ || return 1
_setup_lvm
@ -287,4 +294,3 @@ function volume_exists() {
return 0
fi
}

View File

@ -37,7 +37,6 @@
#include "afr.h"
#include "afr-transaction.h"
//#include "afr-self-heal-common.h"
static void
@ -1750,5 +1749,3 @@ out:
}
/* }}} */

View File

@ -585,12 +585,10 @@ afr_selfheal_data_opendir (xlator_t *this, inode_t *inode)
}
loc_wipe (&loc);
return fd;
return fd;
}
int
afr_selfheal_entry (call_frame_t *frame, xlator_t *this, inode_t *inode)
{

View File

@ -18,7 +18,6 @@
#include "afr-self-heal.h"
#include "byte-order.h"
#define AFR_HEAL_ATTR (GF_SET_ATTR_UID|GF_SET_ATTR_GID|GF_SET_ATTR_MODE)
int

View File

@ -185,7 +185,7 @@ reconfigure (xlator_t *this, dict_t *options)
uint32, out);
GF_OPTION_RECONF (AFR_SH_READDIR_SIZE_KEY, priv->sh_readdir_size,
options, size, out);
options, size_uint64, out);
/* Reset this so we re-discover in case the topology changed. */
GF_OPTION_RECONF ("ensure-durability", priv->ensure_durability, options,
bool, out);
@ -331,7 +331,7 @@ init (xlator_t *this)
GF_OPTION_INIT ("eager-lock", priv->eager_lock, bool, out);
GF_OPTION_INIT ("quorum-type", qtype, str, out);
GF_OPTION_INIT ("quorum-count", priv->quorum_count, uint32, out);
GF_OPTION_INIT (AFR_SH_READDIR_SIZE_KEY, priv->sh_readdir_size, size,
GF_OPTION_INIT (AFR_SH_READDIR_SIZE_KEY, priv->sh_readdir_size, size_uint64,
out);
fix_quorum_options(this,priv,qtype);
@ -436,7 +436,7 @@ fini (xlator_t *this)
priv = this->private;
this->private = NULL;
afr_priv_destroy (priv);
if (this->itable);//I dont see any destroy func
//if (this->itable);//I dont see any destroy func
return 0;
}

View File

@ -1,4 +1,3 @@
xlator_LTLIBRARIES = dht.la nufa.la switch.la
xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/cluster

View File

@ -47,7 +47,7 @@ struct dht_layout {
int gen;
int type;
int ref; /* use with dht_conf_t->layout_lock */
int search_unhashed;
gf_boolean_t search_unhashed;
struct {
int err; /* 0 = normal
-1 = dir exists and no xattr
@ -263,7 +263,7 @@ struct dht_conf {
int gen;
dht_du_t *du_stats;
double min_free_disk;
double min_free_inodes;
double min_free_inodes;
char disk_unit;
int32_t refresh_interval;
gf_boolean_t unhashed_sticky_bit;

View File

@ -366,7 +366,6 @@ dht_reconfigure (xlator_t *this, dict_t *options)
" lookup-unhashed should be boolean,"
" not (%s), defaulting to (%d)",
temp_str, conf->search_unhashed);
//return -1;
ret = -1;
goto out;
}
@ -449,11 +448,11 @@ gf_defrag_pattern_list_fill (xlator_t *this, gf_defrag_info_t *defrag, char *dat
if (!pattern)
goto out;
if (!num) {
if (gf_string2bytesize(pattern, &pattern_list->size)
if (gf_string2bytesize_uint64(pattern, &pattern_list->size)
== 0) {
pattern = "*";
}
} else if (gf_string2bytesize (num, &pattern_list->size) != 0) {
} else if (gf_string2bytesize_uint64 (num, &pattern_list->size) != 0) {
gf_log (this->name, GF_LOG_ERROR,
"invalid number format \"%s\"", num);
goto out;

View File

@ -1,4 +1,3 @@
xlator_LTLIBRARIES = stripe.la
xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/cluster

View File

@ -13,6 +13,7 @@
#include "stripe.h"
#include "byte-order.h"
#include "mem-types.h"
#include "logging.h"
void
stripe_local_wipe (stripe_local_t *local)
@ -260,8 +261,8 @@ stripe_fill_pathinfo_xattr (xlator_t *this, stripe_local_t *local,
goto out;
}
(void) snprintf (stripe_size_str, 20, "%ld",
(local->fctx) ? local->fctx->stripe_size : 0);
(void) snprintf (stripe_size_str, 20, "%"PRId64,
(long long) (local->fctx) ? local->fctx->stripe_size : 0);
/* extra bytes for decorations (brackets and <>'s) */
padding = strlen (this->name) + strlen (STRIPE_PATHINFO_HEADER)
@ -504,7 +505,7 @@ set_default_block_size (stripe_private_t *priv, char *num)
GF_VALIDATE_OR_GOTO (THIS->name, num, out);
if (gf_string2bytesize (num, &priv->block_size) != 0) {
if (gf_string2bytesize_uint64 (num, &priv->block_size) != 0) {
gf_log (THIS->name, GF_LOG_ERROR,
"invalid number format \"%s\"", num);
goto out;
@ -554,7 +555,7 @@ set_stripe_block_size (xlator_t *this, stripe_private_t *priv, char *data)
if (ret)
goto out;
}
if (gf_string2bytesize (num, &stripe_opt->block_size) != 0) {
if (gf_string2bytesize_uint64 (num, &stripe_opt->block_size) != 0) {
gf_log (this->name, GF_LOG_ERROR,
"invalid number format \"%s\"", num);
goto out;
@ -674,4 +675,3 @@ uncoalesced_size(off_t size, uint64_t stripe_size, int stripe_count,
return size;
}

View File

@ -4459,7 +4459,7 @@ stripe_is_bd (dict_t *this, char *key, data_t *value, void *data)
return 0;
}
inline gf_boolean_t
static inline gf_boolean_t
stripe_setxattr_is_bd (dict_t *dict)
{
gf_boolean_t is_bd = _gf_false;
@ -4628,7 +4628,7 @@ out:
return ret;
}
inline gf_boolean_t
static inline gf_boolean_t
stripe_fsetxattr_is_special (dict_t *dict)
{
gf_boolean_t is_spl = _gf_false;
@ -5080,7 +5080,7 @@ reconfigure (xlator_t *this, dict_t *options)
goto unlock;
}
if (gf_string2bytesize (opt->default_value, &priv->block_size)){
if (gf_string2bytesize_uint64 (opt->default_value, &priv->block_size)){
gf_log (this->name, GF_LOG_ERROR,
"Unable to set default block-size ");
ret = -1;
@ -5187,7 +5187,7 @@ init (xlator_t *this)
ret = -1;
goto unlock;
}
if (gf_string2bytesize (opt->default_value, &priv->block_size)){
if (gf_string2bytesize_uint64 (opt->default_value, &priv->block_size)){
gf_log (this->name, GF_LOG_ERROR,
"Unable to set default block-size ");
ret = -1;
@ -5601,7 +5601,7 @@ err:
return 0;
}
inline gf_boolean_t
static inline gf_boolean_t
stripe_is_special_xattr (const char *name)
{
gf_boolean_t is_spl = _gf_false;

View File

@ -509,7 +509,7 @@ out:
return 0;
}
inline int
static inline int
ios_stats_cleanup (xlator_t *this, inode_t *inode)
{

View File

@ -18,6 +18,44 @@
* Very helpful translator for debugging.
*/
static inline void
trace_stat_to_str(struct iatt *buf, char *str)
{
char atime_buf[256] = {0,};
char mtime_buf[256] = {0,};
char ctime_buf[256] = {0,};
uint64_t ia_time = 0;
if (!buf)
return;
ia_time = buf->ia_atime;
strftime (atime_buf, 256, "[%b %d %H:%M:%S]",
localtime ((time_t *)&ia_time));
ia_time = buf->ia_mtime;
strftime (mtime_buf, 256, "[%b %d %H:%M:%S]",
localtime ((time_t *)&ia_time));
ia_time = buf->ia_ctime;
strftime (ctime_buf, 256, "[%b %d %H:%M:%S]",
localtime ((time_t *)&ia_time));
snprintf (str, sizeof (str),
"gfid=%s ino=%"PRIu64", mode=%o, "
"nlink=%"GF_PRI_NLINK", uid=%u, "
"gid=%u, size=%"PRIu64", "
"blocks=%"PRIu64", atime=%s, "
"mtime=%s, ctime=%s",
uuid_utoa (buf->ia_gfid),
buf->ia_ino,
st_mode_from_ia (buf->ia_prot, buf->ia_type),
buf->ia_nlink, buf->ia_uid,
buf->ia_gid, buf->ia_size,
buf->ia_blocks, atime_buf,
mtime_buf, ctime_buf);
}
int
dump_history_trace (circular_buffer_t *cb, void *data)
{

View File

@ -59,40 +59,3 @@ typedef struct {
"%s", _string); \
} \
} while (0);
#define trace_stat_to_str(buf, statstr) \
do { \
char atime_buf[256] = {0,}; \
char mtime_buf[256] = {0,}; \
char ctime_buf[256] = {0,}; \
uint64_t ia_time = 0; \
\
if (!buf) \
break; \
\
ia_time = buf->ia_atime; \
strftime (atime_buf, 256, "[%b %d %H:%M:%S]", \
localtime ((time_t *)&ia_time)); \
\
ia_time = buf->ia_mtime; \
strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", \
localtime ((time_t *)&ia_time)); \
\
ia_time = buf->ia_ctime; \
strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", \
localtime ((time_t *)&ia_time)); \
\
snprintf (statstr, sizeof (statstr), \
"gfid=%s ino=%"PRIu64", mode=%o, " \
"nlink=%"GF_PRI_NLINK", uid=%u, " \
"gid=%u, size=%"PRIu64", " \
"blocks=%"PRIu64", atime=%s, " \
"mtime=%s, ctime=%s", \
uuid_utoa (buf->ia_gfid), buf->ia_ino, \
st_mode_from_ia (buf->ia_prot, \
buf->ia_type), \
buf->ia_nlink, buf->ia_uid, \
buf->ia_gid, buf->ia_size, \
buf->ia_blocks, atime_buf, \
mtime_buf, ctime_buf); \
} while (0);

View File

@ -4169,9 +4169,9 @@ int32_t master_set_block_size (xlator_t *this, crypt_private_t *priv,
if (options != NULL)
GF_OPTION_RECONF("block-size", block_size, options,
size, error);
size_uint64, error);
else
GF_OPTION_INIT("block-size", block_size, size, error);
GF_OPTION_INIT("block-size", block_size, size_uint64, error);
switch (block_size) {
case 512:
@ -4224,9 +4224,9 @@ static int master_set_data_key_size (xlator_t *this, crypt_private_t *priv,
if (options != NULL)
GF_OPTION_RECONF("data-key-size", key_size, options,
size, error);
uint64, error);
else
GF_OPTION_INIT("data-key-size", key_size, size, error);
GF_OPTION_INIT("data-key-size", key_size, uint64, error);
ret = data_cipher_algs[master->m_alg][master->m_mode].check_key(key_size);
if (ret) {

View File

@ -22,6 +22,7 @@
#include <openssl/cmac.h>
#include <openssl/modes.h>
#include "crypt-mem-types.h"
#include "compat.h"
#define CRYPT_XLATOR_ID (0)
@ -38,13 +39,17 @@
#define MASTER_VOL_KEY_SIZE (32)
#define NMTD_VOL_KEY_SIZE (16)
#ifdef __NetBSD__
#if defined(__NetBSD__)
typedef off_t loff_t;
#endif
#if defined(GF_DARWIN_HOST_OS)
typedef uint64_t loff_t;
#endif
struct crypt_key {
uint32_t len;
const char *label;
const char *label;
};
/*
@ -124,7 +129,7 @@ struct master_cipher_info {
* master key
*/
unsigned char m_key[MASTER_VOL_KEY_SIZE];
/*
/*
* volume key for oid authentication
*/
unsigned char m_nmtd_key[NMTD_VOL_KEY_SIZE];
@ -870,8 +875,8 @@ static inline linkop_unwind_handler_t linkop_unwind_dispatch(glusterfs_fop_t fop
return rename_unwind;
default:
gf_log("crypt", GF_LOG_ERROR, "Bad link operation %d", fop);
return NULL;
}
return NULL;
}
}
static inline mtd_op_t linkop_mtdop_dispatch(glusterfs_fop_t fop)

View File

@ -12,7 +12,7 @@ changelog_la_SOURCES = changelog.c changelog-rt.c changelog-helpers.c \
changelog_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src -fPIC -D_FILE_OFFSET_BITS=64 \
-D_GNU_SOURCE -D$(GF_HOST_OS) -shared -nostartfiles -DDATADIR=\"$(localstatedir)\"
-D_GNU_SOURCE -D$(GF_HOST_OS) -shared -DDATADIR=\"$(localstatedir)\"
AM_CFLAGS = -Wall $(GF_CFLAGS)

View File

@ -268,9 +268,11 @@ typedef struct {
void
changelog_thread_cleanup (xlator_t *this, pthread_t thr_id);
inline void *
void *
changelog_get_usable_buffer (changelog_local_t *local);
inline void
void
changelog_set_usable_record_and_length (changelog_local_t *local,
size_t len, int xr);
void
@ -290,16 +292,16 @@ int
changelog_inject_single_event (xlator_t *this,
changelog_priv_t *priv,
changelog_log_data_t *cld);
inline size_t
size_t
changelog_entry_length ();
inline int
int
changelog_write (int fd, char *buffer, size_t len);
int
changelog_write_change (changelog_priv_t *priv, char *buffer, size_t len);
inline int
int
changelog_handle_change (xlator_t *this,
changelog_priv_t *priv, changelog_log_data_t *cld);
inline void
void
changelog_update (xlator_t *this, changelog_priv_t *priv,
changelog_local_t *local, changelog_log_type type);
void *

View File

@ -10,7 +10,7 @@ cdc_la_SOURCES = cdc.c cdc-helper.c
cdc_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS) \
-shared -nostartfiles $(LIBZ_CFLAGS)
-shared $(LIBZ_CFLAGS)
AM_CFLAGS = -Wall $(GF_CFLAGS)

View File

@ -497,13 +497,13 @@ fop_fxattrop_index_action (xlator_t *this, inode_t *inode, dict_t *xattr)
_xattrop_index_action (this, inode, xattr);
}
inline gf_boolean_t
static inline gf_boolean_t
index_xattrop_track (loc_t *loc, gf_xattrop_flags_t flags, dict_t *dict)
{
return (flags == GF_XATTROP_ADD_ARRAY);
}
inline gf_boolean_t
static inline gf_boolean_t
index_fxattrop_track (fd_t *fd, gf_xattrop_flags_t flags, dict_t *dict)
{
return (flags == GF_XATTROP_ADD_ARRAY);

View File

@ -35,7 +35,7 @@ __pl_inodelk_ref (pl_inode_lock_t *lock)
lock->ref++;
}
void
inline void
__pl_inodelk_unref (pl_inode_lock_t *lock)
{
lock->ref--;

View File

@ -294,7 +294,7 @@ pl_locks_by_fd (pl_inode_t *pl_inode, fd_t *fd)
{
list_for_each_entry (l, &pl_inode->ext_list, list) {
if ((l->fd_num == fd_to_fdnum(fd))) {
if (l->fd_num == fd_to_fdnum(fd)) {
found = 1;
break;
}
@ -319,7 +319,7 @@ delete_locks_of_fd (xlator_t *this, pl_inode_t *pl_inode, fd_t *fd)
{
list_for_each_entry_safe (l, tmp, &pl_inode->ext_list, list) {
if ((l->fd_num == fd_to_fdnum(fd))) {
if (l->fd_num == fd_to_fdnum(fd)) {
if (l->blocked) {
list_move_tail (&l->list, &blocked_list);
continue;
@ -644,7 +644,8 @@ pl_fgetxattr_handle_lockinfo (xlator_t *this, fd_t *fd,
pl_inode_t *pl_inode = NULL;
char *key = NULL, *buf = NULL;
int32_t op_ret = 0;
unsigned long fdnum = 0, len = 0;
unsigned long fdnum = 0;
int32_t len = 0;
dict_t *tmp = NULL;
pl_inode = pl_inode_get (this, fd->inode);
@ -1340,7 +1341,7 @@ __fd_has_locks (pl_inode_t *pl_inode, fd_t *fd)
posix_lock_t *l = NULL;
list_for_each_entry (l, &pl_inode->ext_list, list) {
if ((l->fd_num == fd_to_fdnum(fd))) {
if (l->fd_num == fd_to_fdnum(fd)) {
found = 1;
break;
}
@ -1369,7 +1370,7 @@ __dup_locks_to_fdctx (pl_inode_t *pl_inode, fd_t *fd,
int ret = 0;
list_for_each_entry (l, &pl_inode->ext_list, list) {
if ((l->fd_num == fd_to_fdnum(fd))) {
if (l->fd_num == fd_to_fdnum(fd)) {
duplock = lock_dup (l);
if (!duplock) {
ret = -1;

View File

@ -6,9 +6,10 @@ mac_compat_la_LDFLAGS = -module -avoid-version
mac_compat_la_SOURCES = mac-compat.c
mac_compat_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
noinst_HEADERS = mac-compat.h
AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src
AM_CFLAGS = -Wall $(GF_CFLAGS)
CLEANFILES =
CLEANFILES =

View File

@ -15,35 +15,28 @@
#include "xlator.h"
#include "defaults.h"
#include "compat-errno.h"
#include "syscall.h"
#include "mem-pool.h"
#include "mac-compat.h"
enum apple_xattr {
GF_FINDER_INFO_XATTR,
GF_RESOURCE_FORK_XATTR,
GF_XATTR_ALL,
GF_XATTR_NONE
};
static char *apple_xattr_name[] = {
[GF_FINDER_INFO_XATTR] = "com.apple.FinderInfo",
[GF_RESOURCE_FORK_XATTR] = "com.apple.ResourceFork"
};
static const char *apple_xattr_value[] = {
[GF_FINDER_INFO_XATTR] =
/* 1 2 3 4 5 6 7 8 */
"\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0",
[GF_RESOURCE_FORK_XATTR] = ""
};
static int32_t apple_xattr_len[] = {
[GF_FINDER_INFO_XATTR] = 32,
[GF_RESOURCE_FORK_XATTR] = 1
};
static int
dict_key_remove_namespace(dict_t *dict, char *key, data_t *value, void *data)
{
/*
char buffer[3*value->len+1];
int index = 0;
for (index = 0; index < value->len; index++)
sprintf(buffer+3*index, " %02x", value->data[index]);
*/
xlator_t *this = (xlator_t *) data;
if (strncmp(key, "user.", 5) == 0) {
dict_set (dict, key + 5, value);
gf_log (this->name, GF_LOG_DEBUG,
"remove_namespace_dict: %s -> %s ", key, key + 5);
dict_del (dict, key);
}
return 0;
}
int32_t
maccomp_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
@ -53,54 +46,91 @@ maccomp_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
intptr_t ax = (intptr_t)this->private;
int i = 0;
gf_log (this->name, GF_LOG_DEBUG,
"getxattr_cbk: dict %p private: %p xdata %p ", dict,
this->private, xdata);
if (dict) {
dict_foreach(dict, dict_key_remove_namespace, this);
}
else {
// TODO: we expect dict to exist here, don't know why this
// this is needed
dict = dict_new();
}
gf_log (this->name, GF_LOG_DEBUG,
"getxattr_cbk: dict %p ax: %ld op_ret %d op_err %d ", dict, ax,
op_ret, op_errno);
if ((ax == GF_XATTR_ALL && op_ret >= 0) || ax != GF_XATTR_NONE) {
op_ret = op_errno = 0;
for (i = 0; i < GF_XATTR_ALL; i++) {
if (dict_get (dict, apple_xattr_name[i]))
continue;
/* set dummy data */
gf_log (this->name, GF_LOG_DEBUG,
"getxattr_cbk: setting dummy data %p, %s", dict,
apple_xattr_name[i]);
if (dict_set (dict, apple_xattr_name[i],
bin_to_data ((void *)apple_xattr_value[i],
apple_xattr_len[i])) == -1) {
op_ret = -1;
op_errno = ENOMEM;
op_errno = ENOATTR;
break;
}
}
}
STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict, xdata);
return 0;
}
static
int prepend_xattr_user_namespace(dict_t *dict, char *key, data_t *value, void *obj)
{
xlator_t *this = (xlator_t *) obj;
dict_t *newdict = (dict_t *) this->private;
char *newkey = NULL;
gf_add_prefix(XATTR_USER_PREFIX, key, &newkey);
key = newkey;
dict_set(newdict, (char *)key, value);
if (newkey)
GF_FREE(newkey);
return 0;
}
intptr_t
check_name(const char *name, char **newkey)
{
intptr_t ax = GF_XATTR_NONE;
if (name) {
int i = 0;
for (i = 0; i < GF_XATTR_ALL; i++) {
if (strcmp (apple_xattr_name[i], name) == 0) {
ax = i;
break;
}
}
gf_add_prefix("user.", name, newkey);
} else
ax = GF_XATTR_ALL;
return ax;
}
int32_t
maccomp_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
const char *name, dict_t *xdata)
{
intptr_t ax = GF_XATTR_NONE;
int i = 0;
if (name) {
for (i = 0; i < GF_XATTR_ALL; i++) {
if (strcmp (apple_xattr_name[i], name) == 0) {
ax = i;
break;
}
}
} else
ax = GF_XATTR_ALL;
this->private = (void *)ax;
char *newkey = NULL;
this->private = (void *) check_name(name, &newkey);
gf_log (this->name, GF_LOG_DEBUG,
"getxattr: name %s private: %p xdata %p ", name,
this->private, xdata);
STACK_WIND (frame, maccomp_getxattr_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->getxattr,
loc, name, xdata);
loc, newkey, xdata);
return 0;
}
@ -109,30 +139,17 @@ int32_t
maccomp_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
const char *name, dict_t *xdata)
{
intptr_t ax = GF_XATTR_NONE;
int i = 0;
if (name) {
for (i = 0; i < GF_XATTR_ALL; i++) {
if (strcmp (apple_xattr_name[i], name) == 0) {
ax = i;
break;
}
}
} else
ax = GF_XATTR_ALL;
this->private = (void *)ax;
char *newkey = NULL;
this->private = (void *) check_name(name, &newkey);
STACK_WIND (frame, maccomp_getxattr_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fgetxattr,
fd, name, xdata);
fd, newkey, xdata);
GF_FREE(newkey);
return 0;
}
int32_t
maccomp_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
@ -141,12 +158,56 @@ maccomp_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret == -1 && ax != GF_XATTR_NONE)
op_ret = op_errno = 0;
gf_log (this->name, GF_LOG_DEBUG,
"setxattr_cbk op_ret %d op_errno %d private: %p xdata %p ",
op_ret, op_errno, this->private, xdata);
STACK_UNWIND_STRICT (setxattr, frame, op_ret, op_errno, xdata);
return 0;
}
int32_t
maccomp_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *iatt1,
struct iatt *iattr2, dict_t *xdata)
{
gf_log (this->name, GF_LOG_DEBUG,
"setattr_cbk op_ret %d op_errno %d private: %p xdata %p ",
op_ret, op_errno, this->private, xdata);
STACK_UNWIND_STRICT (setattr, frame, op_ret, op_errno,
iatt1, iattr2, xdata);
return 0;
}
int map_flags(int flags)
{
/* DARWIN has different defines on XATTR_ flags.
There do not seem to be a POSIX standard
Parse any other flags over.
NOFOLLOW is always true on Linux and Darwin
*/
int linux_flags = flags & ~(GF_XATTR_CREATE | GF_XATTR_REPLACE | XATTR_REPLACE);
if (XATTR_CREATE & flags)
linux_flags |= GF_XATTR_CREATE;
if (XATTR_REPLACE & flags)
linux_flags |= GF_XATTR_REPLACE;
return linux_flags;
}
int32_t
maccomp_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
const char *name, dict_t *xdata)
{
char *newkey = NULL;
this->private = (void *) check_name(name, &newkey);
STACK_WIND (frame, default_fremovexattr_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fremovexattr,
fd, newkey, xdata);
GF_FREE(newkey);
return 0;
}
int32_t
maccomp_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
@ -162,16 +223,56 @@ maccomp_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
break;
}
}
dict_t *newdict = dict_new();
this->private = (void *) newdict;
dict_foreach(dict, prepend_xattr_user_namespace, this);
this->private = (void *)ax;
int linux_flags = map_flags(flags);
gf_log (this->name, GF_LOG_DEBUG,
"setxattr flags: %d -> %d dict %p private: %p xdata %p ",
flags, linux_flags, dict, this->private, xdata);
STACK_WIND (frame, maccomp_setxattr_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->setxattr,
loc, dict, flags, xdata);
loc, newdict, linux_flags, xdata);
dict_unref(newdict);
return 0;
}
int32_t
maccomp_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, struct iatt *iattr,
int32_t flags, dict_t *xdata)
{
gf_log (this->name, GF_LOG_DEBUG,
"setattr iattr %p private: %p xdata %p ",
iattr, this->private, xdata);
STACK_WIND (frame, maccomp_setattr_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->setattr,
loc, iattr, flags, xdata);
return 0;
}
int32_t
maccomp_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
const char *name, dict_t *xdata)
{
char *newkey = NULL;
this->private = (void *) check_name(name, &newkey);
STACK_WIND (frame, default_removexattr_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->removexattr,
loc, newkey, xdata);
gf_log (this->name, GF_LOG_TRACE,
"removeattr name %p private: %p xdata %p ",
name, this->private, xdata);
GF_FREE(newkey);
return 0;
}
int32_t
maccomp_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict,
@ -188,12 +289,20 @@ maccomp_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict,
}
}
this->private = (void *)ax;
dict_t *newdict = dict_new();
this->private = (void *) newdict;
dict_foreach(dict, prepend_xattr_user_namespace, this);
this->private = (void *)ax;
int linux_flags = map_flags(flags);
gf_log (this->name, GF_LOG_DEBUG,
"fsetxattr flags: %d -> %d dict %p private: %p xdata %p ",
flags, linux_flags, dict, this->private, xdata);
STACK_WIND (frame, maccomp_setxattr_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fsetxattr,
fd, dict, flags, xdata);
fd, newdict, linux_flags, xdata);
dict_unref(newdict);
return 0;
}
@ -224,10 +333,13 @@ fini (xlator_t *this)
struct xlator_fops fops = {
.getxattr = maccomp_getxattr,
.fgetxattr = maccomp_fgetxattr,
.setxattr = maccomp_setxattr,
.fsetxattr = maccomp_fsetxattr,
.getxattr = maccomp_getxattr,
.fgetxattr = maccomp_fgetxattr,
.setxattr = maccomp_setxattr,
.setattr = maccomp_setattr,
.fsetxattr = maccomp_fsetxattr,
.removexattr = maccomp_removexattr,
.fremovexattr = maccomp_fremovexattr,
};
struct xlator_cbks cbks;

View File

@ -0,0 +1,41 @@
/*
Copyright (c) 2014 Red Hat, Inc. <http://www.redhat.com>
This file is part of GlusterFS.
This file is licensed to you under your choice of the GNU Lesser
General Public License, version 3 or any later version (LGPLv3 or
later), or the GNU General Public License, version 2 (GPLv2), in all
cases as published by the Free Software Foundation.
*/
#ifndef __MAC_COMPAT_H__
#define __MAC_COMPAT_H__
enum apple_xattr {
GF_FINDER_INFO_XATTR,
GF_RESOURCE_FORK_XATTR,
GF_XATTR_ALL,
GF_XATTR_NONE
};
static char *apple_xattr_name[] = {
[GF_FINDER_INFO_XATTR] = "com.apple.FinderInfo",
[GF_RESOURCE_FORK_XATTR] = "com.apple.ResourceFork"
};
static const char *apple_xattr_value[] = {
[GF_FINDER_INFO_XATTR] =
/* 1 2 3 4 5 6 7 8 */
"\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0",
[GF_RESOURCE_FORK_XATTR] = ""
};
static int32_t apple_xattr_len[] = {
[GF_FINDER_INFO_XATTR] = 32,
[GF_RESOURCE_FORK_XATTR] = 1
};
#endif /* __MAC_COMPAT_H__ */

View File

@ -9,7 +9,7 @@
*/
#ifndef _MARKER_QUOTA_HELPER_H
#define _MARKER_QUOTA_HELPER
#define _MARKER_QUOTA_HELPER_H
#ifndef _CONFIG_H
#define _CONFIG_H

View File

@ -365,7 +365,10 @@ mq_update_size_xattr (call_frame_t *frame, void *cookie, xlator_t *this,
local->loc.path, ntoh64 (*delta));
new_dict = dict_new ();
if (!new_dict);
if (!new_dict) {
errno = ENOMEM;
goto err;
}
ret = dict_set_bin (new_dict, QUOTA_SIZE_KEY, delta, 8);
if (ret)
@ -385,7 +388,6 @@ mq_update_size_xattr (call_frame_t *frame, void *cookie, xlator_t *this,
err:
if (op_ret == -1 || ret == -1) {
local->err = -1;
mq_release_lock_on_dirty_inode (frame, NULL, this, 0, 0, NULL);
}

View File

@ -255,18 +255,18 @@ out:
return 0;
}
int32_t
gf_boolean_t
call_from_special_client (call_frame_t *frame, xlator_t *this, const char *name)
{
struct volume_mark *vol_mark = NULL;
marker_conf_t *priv = NULL;
gf_boolean_t ret = _gf_true;
gf_boolean_t is_true = _gf_true;
priv = (marker_conf_t *)this->private;
if (frame->root->pid != GF_CLIENT_PID_GSYNCD || name == NULL ||
strcmp (name, MARKER_XATTR_PREFIX "." VOLUME_MARK) != 0) {
ret = _gf_false;
is_true = _gf_false;
goto out;
}
@ -274,7 +274,7 @@ call_from_special_client (call_frame_t *frame, xlator_t *this, const char *name)
marker_getxattr_stampfile_cbk (frame, this, name, vol_mark, NULL);
out:
return ret;
return is_true;
}
int32_t
@ -348,10 +348,10 @@ int32_t
marker_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
const char *name, dict_t *xdata)
{
gf_boolean_t ret = _gf_false;
marker_conf_t *priv = NULL;
unsigned long cookie = 0;
marker_local_t *local = NULL;
gf_boolean_t is_true = _gf_false;
marker_conf_t *priv = NULL;
unsigned long cookie = 0;
marker_local_t *local = NULL;
priv = this->private;
@ -362,16 +362,15 @@ marker_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
MARKER_INIT_LOCAL (frame, local);
ret = loc_copy (&local->loc, loc);
if (ret < 0)
goto out;
if ((loc_copy (&local->loc, loc)) < 0)
goto out;
gf_log (this->name, GF_LOG_DEBUG, "USER:PID = %d", frame->root->pid);
if (priv && priv->feature_enabled & GF_XTIME)
ret = call_from_special_client (frame, this, name);
is_true = call_from_special_client (frame, this, name);
if (ret == _gf_false) {
if (is_true == _gf_false) {
if (name == NULL) {
/* Signifies that marker translator
* has to filter the quota's xattr's,
@ -380,10 +379,11 @@ marker_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
*/
cookie = 1;
}
STACK_WIND_COOKIE (frame, marker_getxattr_cbk, (void *)cookie,
STACK_WIND_COOKIE (frame, marker_getxattr_cbk,
(void *)cookie,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->getxattr, loc,
name, xdata);
FIRST_CHILD(this)->fops->getxattr,
loc, name, xdata);
}
return 0;

View File

@ -244,7 +244,7 @@ out:
return;
}
inline void
static inline void
quota_link_count_decrement (quota_local_t *local)
{
call_stub_t *stub = NULL;
@ -270,7 +270,7 @@ out:
return;
}
inline void
static inline void
quota_handle_validate_error (quota_local_t *local, int32_t op_ret,
int32_t op_errno)
{
@ -377,7 +377,7 @@ quota_timeout (struct timeval *tv, int32_t timeout)
return timed_out;
}
inline void
static inline void
quota_add_parent (quota_dentry_t *dentry, struct list_head *list)
{
quota_dentry_t *entry = NULL;
@ -928,7 +928,7 @@ err:
return 0;
}
inline int
static inline int
quota_get_limits (xlator_t *this, dict_t *dict, int64_t *hard_lim,
int64_t *soft_lim)
{

View File

@ -227,7 +227,7 @@ quotad_aggregator_getlimit (rpcsvc_request_t *req)
if (ret)
goto err;
ret = dict_set_int32 (state->xdata, GET_ANCESTRY_PATH_KEY,42);
ret = dict_set_int32 (state->xdata, GET_ANCESTRY_PATH_KEY, 42);
if (ret)
goto err;

View File

@ -29,7 +29,7 @@ noinst_HEADERS = glusterd.h glusterd-utils.h glusterd-op-sm.h \
AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src \
-I$(rpclibdir) -I$(CONTRIBDIR)/rbtree \
-I$(top_srcdir)/rpc/xdr/src -I$(top_srcdir)/rpc/rpc-lib/src \
-I$(CONTRIBDIR)/uuid \
-I$(CONTRIBDIR)/uuid -I$(CONTRIBDIR)/mount \
-DSBIN_DIR=\"$(sbindir)\" -DDATADIR=\"$(localstatedir)\" \
-DGSYNCD_PREFIX=\"$(libexecdir)/glusterfs\"\
-DSYNCDAEMON_COMPILE=$(SYNCDAEMON_COMPILE) $(XML_CPPFLAGS)

View File

@ -181,7 +181,7 @@ glusterd_hooks_set_volume_args (dict_t *dict, runner_t *runner)
goto out;
runner_add_arg (runner, "-o");
for (i = 1; (ret == 0); i++) {
for (i = 1; ret == 0; i++) {
snprintf (query, sizeof (query), "key%d", i);
ret = dict_get_str (dict, query, &key);
if (ret)

View File

@ -1020,7 +1020,7 @@ glusterd_op_stage_reset_volume (dict_t *dict, char **op_errstr)
{
int ret = 0;
char *volname = NULL;
gf_boolean_t exists = _gf_false;
int exists = 0;
char msg[2048] = {0};
char *key = NULL;
char *key_fixed = NULL;
@ -1068,6 +1068,7 @@ glusterd_op_stage_reset_volume (dict_t *dict, char **op_errstr)
ret = -1;
goto out;
}
if (!exists) {
ret = snprintf (msg, sizeof (msg),
"Option %s does not exist", key);
@ -1819,7 +1820,7 @@ glusterd_op_set_volume (dict_t *dict)
if (dict_count == 0) {
ret = glusterd_volset_help (NULL, &op_errstr);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "%s",
gf_log (this->name, GF_LOG_ERROR, "%s",
(op_errstr)? op_errstr:
"Volume set help internal error");
}
@ -3262,7 +3263,7 @@ glusterd_is_get_op (xlator_t *this, glusterd_op_t op, dict_t *dict)
if (op == GD_OP_STATUS_VOLUME)
return _gf_true;
if ((op == GD_OP_SET_VOLUME)) {
if (op == GD_OP_SET_VOLUME) {
//check for set volume help
ret = dict_get_str (dict, "volname", &volname);
if (volname &&

View File

@ -474,7 +474,7 @@ glusterd_set_quota_limit (char *volname, char *path, char *hard_limit,
new_limit.sl = hton64 (new_limit.sl);
ret = gf_string2bytesize (hard_limit, (uint64_t*)&new_limit.hl);
ret = gf_string2bytesize_uint64 (hard_limit, (uint64_t*)&new_limit.hl);
if (ret)
goto out;
@ -1400,13 +1400,13 @@ glusterd_op_stage_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
"Faild to get hard-limit from dict");
goto out;
}
ret = gf_string2bytesize (hard_limit_str, &hard_limit);
ret = gf_string2bytesize_uint64 (hard_limit_str, &hard_limit);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Failed to convert hard-limit string to value");
goto out;
}
if (hard_limit > INT64_MAX) {
if (hard_limit > UINT64_MAX) {
ret = -1;
ret = gf_asprintf (op_errstr, "Hard-limit %s is greater"
" than %"PRId64"bytes. Please set a "

View File

@ -18,6 +18,14 @@
#include <sys/resource.h>
#include <sys/statvfs.h>
#include <sys/mount.h>
#include <signal.h>
#if !defined(__NetBSD__) && !defined(GF_DARWIN_HOST_OS)
#include <mntent.h>
#else
#include "mntent_compat.h"
#endif
#include "globals.h"
#include "compat.h"
@ -40,9 +48,7 @@
#include "cli1-xdr.h"
#include "xdr-generic.h"
#ifdef GF_LINUX_HOST_OS
#include <mntent.h>
#endif
#include "lvm-defaults.h"
char snap_mount_folder[PATH_MAX];
@ -267,7 +273,7 @@ out:
int
snap_max_hard_limits_validate (dict_t *dict, char *volname,
uint64_t value, char **op_errstr)
uint64_t value, char **op_errstr)
{
char err_str[PATH_MAX] = "";
glusterd_conf_t *conf = NULL;
@ -449,7 +455,7 @@ glusterd_snap_create_pre_val_use_rsp_dict (dict_t *dst, dict_t *src)
for (i = 0; i < volume_count; i++) {
memset (snapbrckcnt, '\0', sizeof(snapbrckcnt));
ret = snprintf (snapbrckcnt, sizeof(snapbrckcnt) - 1,
"vol%ld_brickcount", i+1);
"vol%"PRId64"_brickcount", i+1);
ret = dict_get_int64 (src, snapbrckcnt, &brick_count);
if (ret) {
gf_log (this->name, GF_LOG_TRACE,
@ -460,7 +466,7 @@ glusterd_snap_create_pre_val_use_rsp_dict (dict_t *dst, dict_t *src)
for (j = 0; j < brick_count; j++) {
/* Fetching data from source dict */
snprintf (key, sizeof(key) - 1,
"vol%ld.brickdir%ld", i+1, j);
"vol%"PRId64".brickdir%"PRId64, i+1, j);
ret = dict_get_ptr (src, key,
(void **)&snap_brick_dir);
@ -471,7 +477,7 @@ glusterd_snap_create_pre_val_use_rsp_dict (dict_t *dst, dict_t *src)
}
snprintf (key, sizeof(key) - 1,
"vol%ld.brick_snapdevice%ld", i+1, j);
"vol%"PRId64".brick_snapdevice%"PRId64, i+1, j);
ret = dict_get_ptr (src, key,
(void **)&snap_device);
@ -482,7 +488,7 @@ glusterd_snap_create_pre_val_use_rsp_dict (dict_t *dst, dict_t *src)
}
snprintf (snapbrckord, sizeof(snapbrckord) - 1,
"vol%ld.brick%ld.order", i+1, j);
"vol%"PRId64".brick%"PRId64".order", i+1, j);
ret = dict_get_int64 (src, snapbrckord, &brick_order);
if (ret) {
@ -493,7 +499,7 @@ glusterd_snap_create_pre_val_use_rsp_dict (dict_t *dst, dict_t *src)
/* Adding the data in the dst dict */
snprintf (key, sizeof(key) - 1,
"vol%ld.brickdir%ld", i+1, brick_order);
"vol%"PRId64".brickdir%"PRId64, i+1, brick_order);
tmpstr = gf_strdup (snap_brick_dir);
if (!tmpstr) {
@ -511,7 +517,7 @@ glusterd_snap_create_pre_val_use_rsp_dict (dict_t *dst, dict_t *src)
}
snprintf (key, sizeof(key) - 1,
"vol%ld.brick_snapdevice%ld",
"vol%"PRId64".brick_snapdevice%"PRId64,
i+1, brick_order);
tmpstr = gf_strdup (snap_device);
@ -618,8 +624,8 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
goto out;
}
if (volcount <= 0) {
snprintf (err_str, sizeof (err_str), "Invalid volume count %ld "
"supplied", volcount);
snprintf (err_str, sizeof (err_str), "Invalid volume count %"PRId64
" supplied", volcount);
ret = -1;
goto out;
}
@ -638,7 +644,7 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
}
for (i = 1; i <= volcount; i++) {
snprintf (key, sizeof (key), "volname%ld", i);
snprintf (key, sizeof (key), "volname%"PRId64, i);
ret = dict_get_str (dict, key, &volname);
if (ret) {
snprintf (err_str, sizeof (err_str),
@ -690,7 +696,7 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
goto out;
}
snprintf (key, sizeof(key) - 1, "vol%ld_volid", i);
snprintf (key, sizeof(key) - 1, "vol%"PRId64"_volid", i);
ret = dict_get_bin (dict, key, (void **)&snap_volid);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
@ -745,7 +751,7 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
}
snprintf (key, sizeof(key),
"vol%ld.brick_snapdevice%ld", i,
"vol%"PRId64".brick_snapdevice%"PRId64, i,
brick_count);
ret = dict_set_dynstr (rsp_dict, key, device);
if (ret) {
@ -783,7 +789,7 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
ret = -1;
goto out;
}
snprintf (key, sizeof(key), "vol%ld.brickdir%ld", i,
snprintf (key, sizeof(key), "vol%"PRId64".brickdir%"PRId64, i,
brick_count);
ret = dict_set_dynstr (rsp_dict, key, tmpstr);
if (ret) {
@ -793,7 +799,7 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
}
tmpstr = NULL;
snprintf (key, sizeof(key) - 1, "vol%ld.brick%ld.order",
snprintf (key, sizeof(key) - 1, "vol%"PRId64".brick%"PRId64".order",
i, brick_count);
ret = dict_set_int64 (rsp_dict, key, brick_order);
if (ret) {
@ -805,7 +811,7 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
brick_count++;
brick_order++;
}
snprintf (key, sizeof(key) - 1, "vol%ld_brickcount", i);
snprintf (key, sizeof(key) - 1, "vol%"PRId64"_brickcount", i);
ret = dict_set_int64 (rsp_dict, key, brick_count);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to set %s",
@ -1002,7 +1008,7 @@ glusterd_do_lvm_snapshot_remove (glusterd_volinfo_t *snap_vol,
snprintf (msg, sizeof(msg), "remove snapshot of the brick %s:%s, "
"device: %s", brickinfo->hostname, brickinfo->path,
snap_device);
runner_add_args (&runner, "/sbin/lvremove", "-f", snap_device, NULL);
runner_add_args (&runner, LVM_REMOVE, "-f", snap_device, NULL);
runner_log (&runner, "", GF_LOG_DEBUG, msg);
ret = runner_run (&runner);
@ -2047,8 +2053,8 @@ glusterd_handle_snapshot_create (rpcsvc_request_t *req, glusterd_op_t op,
goto out;
}
if (volcount <= 0) {
gf_log (this->name, GF_LOG_ERROR, "Invalid volume count %ld "
"supplied", volcount);
gf_log (this->name, GF_LOG_ERROR, "Invalid volume count %"PRId64
" supplied", volcount);
ret = -1;
goto out;
}
@ -2476,7 +2482,7 @@ glusterd_create_snap_object (dict_t *dict, dict_t *rsp_dict)
}
if (time_stamp <= 0) {
ret = -1;
gf_log (this->name, GF_LOG_ERROR, "Invalid time-stamp: %ld",
gf_log (this->name, GF_LOG_ERROR, "Invalid time-stamp: %"PRId64,
time_stamp);
goto out;
}
@ -2715,7 +2721,7 @@ glusterd_take_lvm_snapshot (glusterd_volinfo_t *snap_vol,
/* Figuring out if setactivationskip flag is supported or not */
runinit (&runner);
snprintf (msg, sizeof (msg), "running lvcreate help");
runner_add_args (&runner, "/sbin/lvcreate", "--help", NULL);
runner_add_args (&runner, LVM_CREATE, "--help", NULL);
runner_log (&runner, "", GF_LOG_DEBUG, msg);
runner_redir (&runner, STDOUT_FILENO, RUN_PIPE);
ret = runner_start (&runner);
@ -2744,11 +2750,11 @@ glusterd_take_lvm_snapshot (glusterd_volinfo_t *snap_vol,
snprintf (msg, sizeof (msg), "taking snapshot of the brick %s:%s",
brickinfo->hostname, brickinfo->path);
if (match == _gf_true)
runner_add_args (&runner, "/sbin/lvcreate", "-s", device,
runner_add_args (&runner, LVM_CREATE, "-s", device,
"--setactivationskip", "n", "--name",
snap_vol->volname, NULL);
else
runner_add_args (&runner, "/sbin/lvcreate", "-s", device,
runner_add_args (&runner, LVM_CREATE, "-s", device,
"--name", snap_vol->volname, NULL);
runner_log (&runner, "", GF_LOG_DEBUG, msg);
ret = runner_start (&runner);
@ -2862,7 +2868,11 @@ 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)
umount (snap_brick_mount_path);
#else
unmount (snap_brick_mount_path, 0);
#endif
}
gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
@ -2893,7 +2903,7 @@ glusterd_add_bricks_to_snap_volume (dict_t *dict, dict_t *rsp_dict,
GF_ASSERT (snap_brickinfo);
GF_ASSERT (snap_brick_dir);
snprintf (key, sizeof(key) - 1, "vol%ld.brickdir%d", volcount,
snprintf (key, sizeof(key) - 1, "vol%"PRId64".brickdir%d", volcount,
brick_count);
ret = dict_get_ptr (dict, key, (void **)snap_brick_dir);
if (ret) {
@ -2951,7 +2961,7 @@ glusterd_add_bricks_to_snap_volume (dict_t *dict, dict_t *rsp_dict,
}
}
snprintf (key, sizeof(key), "vol%ld.brick_snapdevice%d",
snprintf (key, sizeof(key), "vol%"PRId64".brick_snapdevice%d",
volcount, brick_count);
ret = dict_get_ptr (dict, key, (void **)&snap_device);
if (ret) {
@ -3129,7 +3139,7 @@ glusterd_do_snap_vol (glusterd_volinfo_t *origin_vol, glusterd_snap_t *snap,
GF_ASSERT (rsp_dict);
/* fetch username, password and vol_id from dict*/
snprintf (key, sizeof(key), "volume%ld_username", volcount);
snprintf (key, sizeof(key), "volume%"PRId64"_username", volcount);
ret = dict_get_str (dict, key, &username);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to get %s for "
@ -3137,7 +3147,7 @@ glusterd_do_snap_vol (glusterd_volinfo_t *origin_vol, glusterd_snap_t *snap,
goto out;
}
snprintf (key, sizeof(key), "volume%ld_password", volcount);
snprintf (key, sizeof(key), "volume%"PRId64"_password", volcount);
ret = dict_get_str (dict, key, &password);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to get %s for "
@ -3145,7 +3155,7 @@ glusterd_do_snap_vol (glusterd_volinfo_t *origin_vol, glusterd_snap_t *snap,
goto out;
}
snprintf (key, sizeof(key) - 1, "vol%ld_volid", volcount);
snprintf (key, sizeof(key) - 1, "vol%"PRId64"_volid", volcount);
ret = dict_get_bin (dict, key, (void **)&snap_volid);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
@ -3367,7 +3377,7 @@ glusterd_handle_snapshot_remove (rpcsvc_request_t *req, glusterd_op_t op,
goto out;
}
snprintf (key, sizeof (key), "volname%ld", volcount);
snprintf (key, sizeof (key), "volname%"PRId64, volcount);
ret = dict_set_dynstr (dict, key, volname);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to set "
@ -3771,7 +3781,7 @@ glusterd_snapshot_create_commit (dict_t *dict, char **op_errstr,
}
for (i = 1; i <= volcount; i++) {
snprintf (key, sizeof (key), "volname%ld", i);
snprintf (key, sizeof (key), "volname%"PRId64, i);
ret = dict_get_str (dict, key, &volname);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
@ -3922,7 +3932,7 @@ snap_max_limits_display_commit (dict_t *rsp_dict, char *volname,
soft_limit_value = (active_hard_limit *
conf->snap_max_soft_limit) / 100;
snprintf (buf, sizeof(buf), "volume%ld-volname", count);
snprintf (buf, sizeof(buf), "volume%"PRIu64"-volname", count);
ret = dict_set_str (rsp_dict, buf, volinfo->volname);
if (ret) {
snprintf (err_str, PATH_MAX,
@ -3931,7 +3941,7 @@ snap_max_limits_display_commit (dict_t *rsp_dict, char *volname,
}
snprintf (buf, sizeof(buf),
"volume%ld-snap-max-hard-limit", count);
"volume%"PRIu64"-snap-max-hard-limit", count);
ret = dict_set_uint64 (rsp_dict, buf, snap_max_limit);
if (ret) {
snprintf (err_str, PATH_MAX,
@ -3940,7 +3950,7 @@ snap_max_limits_display_commit (dict_t *rsp_dict, char *volname,
}
snprintf (buf, sizeof(buf),
"volume%ld-active-hard-limit", count);
"volume%"PRIu64"-active-hard-limit", count);
ret = dict_set_uint64 (rsp_dict, buf,
active_hard_limit);
if (ret) {
@ -3950,7 +3960,7 @@ snap_max_limits_display_commit (dict_t *rsp_dict, char *volname,
}
snprintf (buf, sizeof(buf),
"volume%ld-snap-max-soft-limit", count);
"volume%"PRIu64"-snap-max-soft-limit", count);
ret = dict_set_uint64 (rsp_dict, buf, soft_limit_value);
if (ret) {
snprintf (err_str, PATH_MAX,
@ -3984,7 +3994,7 @@ snap_max_limits_display_commit (dict_t *rsp_dict, char *volname,
soft_limit_value = (active_hard_limit *
conf->snap_max_soft_limit) / 100;
snprintf (buf, sizeof(buf), "volume%ld-volname", count);
snprintf (buf, sizeof(buf), "volume%"PRIu64"-volname", count);
ret = dict_set_str (rsp_dict, buf, volinfo->volname);
if (ret) {
snprintf (err_str, PATH_MAX,
@ -3993,7 +4003,7 @@ snap_max_limits_display_commit (dict_t *rsp_dict, char *volname,
}
snprintf (buf, sizeof(buf),
"volume%ld-snap-max-hard-limit", count);
"volume%"PRIu64"-snap-max-hard-limit", count);
ret = dict_set_uint64 (rsp_dict, buf, snap_max_limit);
if (ret) {
snprintf (err_str, PATH_MAX,
@ -4002,7 +4012,7 @@ snap_max_limits_display_commit (dict_t *rsp_dict, char *volname,
}
snprintf (buf, sizeof(buf),
"volume%ld-active-hard-limit", count);
"volume%"PRIu64"-active-hard-limit", count);
ret = dict_set_uint64 (rsp_dict, buf, active_hard_limit);
if (ret) {
snprintf (err_str, PATH_MAX,
@ -4011,7 +4021,7 @@ snap_max_limits_display_commit (dict_t *rsp_dict, char *volname,
}
snprintf (buf, sizeof(buf),
"volume%ld-snap-max-soft-limit", count);
"volume%"PRIu64"-snap-max-soft-limit", count);
ret = dict_set_uint64 (rsp_dict, buf, soft_limit_value);
if (ret) {
snprintf (err_str, PATH_MAX,
@ -4196,7 +4206,7 @@ glusterd_get_brick_lvm_details (dict_t *rsp_dict,
* for the above given command with separator ":",
* The output will be "vgname:lvsize"
*/
runner_add_args (&runner, "lvs", device, "--noheading", "-o",
runner_add_args (&runner, LVS, device, "--noheading", "-o",
"vg_name,data_percent,lv_size",
"--separator", ":", NULL);
runner_redir (&runner, STDOUT_FILENO, RUN_PIPE);

View File

@ -2615,7 +2615,7 @@ out:
return volinfo;
}
inline void
static inline void
glusterd_store_set_options_path (glusterd_conf_t *conf, char *path, size_t len)
{
snprintf (path, len, "%s/options", conf->workdir);
@ -3722,7 +3722,7 @@ glusterd_store_retrieve_quota_version (glusterd_volinfo_t *volinfo)
}
version = strtoul (version_str, &tmp, 10);
if (version < 0) {
if ((errno == ERANGE) || (errno == EINVAL)) {
gf_log (this->name, GF_LOG_DEBUG, "Invalid version number");
goto out;
}

View File

@ -13,6 +13,12 @@
#endif
#include <inttypes.h>
#if !defined(__NetBSD__) && !defined(GF_DARWIN_HOST_OS)
#include <mntent.h>
#else
#include "mntent_compat.h"
#endif
#include "globals.h"
#include "glusterfs.h"
#include "compat.h"
@ -44,7 +50,6 @@
#include <inttypes.h>
#include <signal.h>
#include <sys/types.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <rpc/pmap_clnt.h>
@ -56,11 +61,6 @@
#include <lvm2app.h>
#endif
#ifdef GF_LINUX_HOST_OS
#include <mntent.h>
#endif
#ifdef GF_SOLARIS_HOST_OS
#include <sys/sockio.h>
#endif
@ -4520,14 +4520,16 @@ glusterd_nodesvc_start (char *server, gf_boolean_t wait)
"--trace-children=yes", "--track-origins=yes",
NULL);
runner_argprintf (&runner, "--log-file=%s", valgrind_logfile);
}
}
runner_add_args (&runner, SBIN_DIR"/glusterfs",
"-s", "localhost",
"--volfile-id", volfileid,
"-p", pidfile,
"-l", logfile,
"-S", sockfpath, NULL);
"-S", sockfpath,
"-L", "DEBUG",
NULL);
if (!strcmp (server, "glustershd")) {
snprintf (glusterd_uuid_option, sizeof (glusterd_uuid_option),
@ -5454,7 +5456,6 @@ out:
return -1;
}
#ifdef GF_LINUX_HOST_OS
int
glusterd_get_brick_root (char *path, char **mount_point)
{
@ -5750,7 +5751,6 @@ out:
return device;
}
#endif
int
glusterd_add_brick_detail_to_dict (glusterd_volinfo_t *volinfo,
@ -5824,13 +5824,12 @@ glusterd_add_brick_detail_to_dict (glusterd_volinfo_t *volinfo,
if (ret)
goto out;
}
#ifdef GF_LINUX_HOST_OS
ret = glusterd_add_brick_mount_details (brickinfo, dict, count);
if (ret)
goto out;
ret = glusterd_add_inode_size_to_dict (dict, count);
#endif
out:
if (ret)
gf_log (this->name, GF_LOG_DEBUG, "Error adding brick"
@ -8828,7 +8827,7 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
}
for (i = 0; i < voldisplaycount; i++) {
snprintf (buf, sizeof(buf), "volume%ld-volname", i);
snprintf (buf, sizeof(buf), "volume%"PRIu64"-volname", i);
ret = dict_get_str (src, buf, &volname);
if (ret) {
gf_log ("", GF_LOG_ERROR,
@ -8843,7 +8842,7 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
}
snprintf (buf, sizeof(buf),
"volume%ld-snap-max-hard-limit", i);
"volume%"PRIu64"-snap-max-hard-limit", i);
ret = dict_get_uint64 (src, buf, &value);
if (ret) {
gf_log ("", GF_LOG_ERROR,
@ -8858,7 +8857,7 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
}
snprintf (buf, sizeof(buf),
"volume%ld-active-hard-limit", i);
"volume%"PRIu64"-active-hard-limit", i);
ret = dict_get_uint64 (src, buf, &value);
if (ret) {
gf_log ("", GF_LOG_ERROR,
@ -8873,7 +8872,7 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
}
snprintf (buf, sizeof(buf),
"volume%ld-snap-max-soft-limit", i);
"volume%"PRIu64"-snap-max-soft-limit", i);
ret = dict_get_uint64 (src, buf, &value);
if (ret) {
gf_log ("", GF_LOG_ERROR,

View File

@ -8,7 +8,7 @@
cases as published by the Free Software Foundation.
*/
#ifndef _GLUSTERD_UTILS_H
#define _GLUSTERD_UTILS_H_
#define _GLUSTERD_UTILS_H
#ifndef _CONFIG_H
#define _CONFIG_H
@ -684,14 +684,16 @@ glusterd_rpc_clnt_unref (glusterd_conf_t *conf, rpc_clnt_t *rpc);
int32_t
glusterd_compare_volume_name(struct list_head *, struct list_head *);
#ifdef GF_LINUX_HOST_OS
char*
glusterd_get_brick_mount_details (glusterd_brickinfo_t *brickinfo);
struct mntent *
glusterd_get_mnt_entry_info (char *mnt_pt, FILE *mtab);
int
glusterd_get_brick_root (char *path, char **mount_point);
#endif //LINUX_HOST
int
glusterd_compare_snap_time(struct list_head *, struct list_head *);

View File

@ -741,7 +741,7 @@ int
glusterd_volinfo_get_boolean (glusterd_volinfo_t *volinfo, char *key)
{
char *val = NULL;
gf_boolean_t boo = _gf_false;
gf_boolean_t enabled = _gf_false;
int ret = 0;
ret = glusterd_volinfo_get (volinfo, key, &val);
@ -749,14 +749,14 @@ glusterd_volinfo_get_boolean (glusterd_volinfo_t *volinfo, char *key)
return -1;
if (val)
ret = gf_string2boolean (val, &boo);
ret = gf_string2boolean (val, &enabled);
if (ret) {
gf_log ("", GF_LOG_ERROR, "value for %s option is not valid", key);
return -1;
}
return boo;
return enabled;
}
gf_boolean_t
@ -1258,8 +1258,8 @@ static int
server_check_marker_off (volgen_graph_t *graph, struct volopt_map_entry *vme,
glusterd_volinfo_t *volinfo)
{
gf_boolean_t bool = _gf_false;
int ret = 0;
gf_boolean_t enabled = _gf_false;
int ret = 0;
GF_ASSERT (volinfo);
GF_ASSERT (vme);
@ -1267,8 +1267,8 @@ server_check_marker_off (volgen_graph_t *graph, struct volopt_map_entry *vme,
if (strcmp (vme->option, "!xtime") != 0)
return 0;
ret = gf_string2boolean (vme->value, &bool);
if (ret || bool)
ret = gf_string2boolean (vme->value, &enabled);
if (ret || enabled)
goto out;
ret = glusterd_volinfo_get_boolean (volinfo, VKEY_MARKER_XTIME);
@ -1279,10 +1279,10 @@ server_check_marker_off (volgen_graph_t *graph, struct volopt_map_entry *vme,
}
if (ret) {
bool = _gf_false;
ret = glusterd_check_gsync_running (volinfo, &bool);
enabled = _gf_false;
ret = glusterd_check_gsync_running (volinfo, &enabled);
if (bool) {
if (enabled) {
gf_log ("", GF_LOG_WARNING, GEOREP" sessions active"
"for the volume %s, cannot disable marker "
,volinfo->volname);

Some files were not shown because too many files have changed in this diff Show More