SUBDIRS = mount nfs portmap rquota lib include . $(MAYBE_EXAMPLES)
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libnfs.pc
+
+EXTRA_DIST = README COPYING libnfs.pc.in
+
# PARTICULAR PURPOSE.
@SET_MAKE@
+
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
- $(top_srcdir)/configure COPYING compile config.guess \
- config.sub depcomp install-sh ltmain.sh missing
+ $(srcdir)/libnfs.pc.in $(top_srcdir)/configure COPYING compile \
+ config.guess config.sub depcomp install-sh ltmain.sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = libnfs.pc
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(pkgconfigdir)"
+DATA = $(pkgconfig_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LIBNFS_PC_REQ_PRIVATE = @LIBNFS_PC_REQ_PRIVATE@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
RPCGENFLAGS = @RPCGENFLAGS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+TIRPC_CFLAGS = @TIRPC_CFLAGS@
+TIRPC_LIBS = @TIRPC_LIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = mount nfs portmap rquota lib include . $(MAYBE_EXAMPLES)
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libnfs.pc
+EXTRA_DIST = README COPYING libnfs.pc.in
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
distclean-hdr:
-rm -f config.h stamp-h1
+libnfs.pc: $(top_builddir)/config.status $(srcdir)/libnfs.pc.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
-rm -f *.lo
distclean-libtool:
-rm -f libtool config.lt
+install-pkgconfigDATA: $(pkgconfig_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
+ @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
+ done
+
+uninstall-pkgconfigDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
exit 1; } >&2
check-am: all-am
check: check-recursive
-all-am: Makefile config.h
+all-am: Makefile $(DATA) config.h
installdirs: installdirs-recursive
installdirs-am:
+ for dir in "$(DESTDIR)$(pkgconfigdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
info-am:
-install-data-am:
+install-data-am: install-pkgconfigDATA
install-dvi: install-dvi-recursive
ps-am:
-uninstall-am:
+uninstall-am: uninstall-pkgconfigDATA
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
ctags-recursive install-am install-strip tags-recursive
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- installdirs-am maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
- ps ps-am tags tags-recursive uninstall uninstall-am
+ install-pdf install-pdf-am install-pkgconfigDATA install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-pkgconfigDATA
# Tell versions [3.59,3.63) of GNU make to not export all variables.
These servers require you use the "insecure" export option in /etc/exports
in order to allow libnfs clients to be able to connect.
+Some versions of Linux support special capabilities that can be assigned to
+programs to allow non-root users to bind to system ports.
+This is set up by running
+ sudo setcap 'cap_net_bind_service=+ep' /path/to/executable
+When libnfs is linked against an executable with this special capability
+assigned to it, libnfs may be able to use system ports even when executing
+under the privilege of a non-root user account.
+
+This is highly non-portable so IF this works on your linux system, count
+yourself lucky.
+
+
+
PLATFORM support
=================
As of now this is tested with linux, MacOSX and Apple iOS.
MacOSX: - tested with SDK 10.4 (under Snow Leopard) - should also work with later SDKs and 64Bit
iOS: - tested with iOS SDK 4.2 - running on iOS 4.3.x
FreeBSD:- tested with 8.2
+OpenSolaris
+Windows:- tested on Windows 7 64 and Windows XP 32 using Visual Studio 10 (see README.win32.txt for build instructions)
Cygwin
--- /dev/null
+LibNFS requires a oncrpc library and rpcgen compiler that can handle
+64 bit types. Link below for one such package, but any 64bit capable oncrpc
+package should work with some effort.
+
+
+1. checkout git://github.com/Memphiz/oncrpc-win32.git project (branch hyper!)
+2. build oncrpc-win32 project (see README.libnfs in the projects dir)
+3. checkout libnfs ("parallel" to oncrpc-win32)
+4. load vs2010 project from win32/libnfs/libnfs.sln
+5. build libnfs and nfsclient-sync
# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
#
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-# 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
-# Inc.
+# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# Written by Gordon Matzigkeit, 1996
#
# This file is free software; the Free Software Foundation gives
m4_define([_LT_COPYING], [dnl
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-# 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
-# Inc.
+# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# Written by Gordon Matzigkeit, 1996
#
# This file is part of GNU Libtool.
AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
+dnl
_LT_DECL([], [host_alias], [0], [The host system])dnl
_LT_DECL([], [host], [0])dnl
_LT_DECL([], [host_os], [0])dnl
m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
configured by $[0], generated by m4_PACKAGE_STRING.
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2011 Free Software Foundation, Inc.
This config.lt script is free software; the Free Software Foundation
gives unlimited permision to copy, distribute and modify it."
m4_case([$1],
[C], [_LT_LANG(C)],
[C++], [_LT_LANG(CXX)],
+ [Go], [_LT_LANG(GO)],
[Java], [_LT_LANG(GCJ)],
[Fortran 77], [_LT_LANG(F77)],
[Fortran], [_LT_LANG(FC)],
])# _LT_LANG
+m4_ifndef([AC_PROG_GO], [
+# NOTE: This macro has been submitted for inclusion into #
+# GNU Autoconf as AC_PROG_GO. When it is available in #
+# a released version of Autoconf we should remove this #
+# macro and use it instead. #
+m4_defun([AC_PROG_GO],
+[AC_LANG_PUSH(Go)dnl
+AC_ARG_VAR([GOC], [Go compiler command])dnl
+AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+AC_CHECK_TOOL(GOC, gccgo)
+if test -z "$GOC"; then
+ if test -n "$ac_tool_prefix"; then
+ AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
+ fi
+fi
+if test -z "$GOC"; then
+ AC_CHECK_PROG(GOC, gccgo, gccgo, false)
+fi
+])#m4_defun
+])#m4_ifndef
+
+
# _LT_LANG_DEFAULT_CONFIG
# -----------------------
m4_defun([_LT_LANG_DEFAULT_CONFIG],
m4_ifdef([LT_PROG_GCJ],
[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+AC_PROVIDE_IFELSE([AC_PROG_GO],
+ [LT_LANG(GO)],
+ [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
+
AC_PROVIDE_IFELSE([LT_PROG_RC],
[LT_LANG(RC)],
[m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-dynamiclib -Wl,-single_module conftest.c 2>conftest.err
_lt_result=$?
- if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+ # If there is a non-empty error log, and "single_module"
+ # appears in it, assume the flag caused a linker warning
+ if test -s conftest.err && $GREP single_module conftest.err; then
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ # Otherwise, if the output was created with a 0 exit code from
+ # the compiler, it worked.
+ elif test -f libconftest.dylib && test $_lt_result -eq 0; then
lt_cv_apple_cc_single_mod=yes
else
cat conftest.err >&AS_MESSAGE_LOG_FD
rm -rf libconftest.dylib*
rm -f conftest.*
fi])
+
AC_CACHE_CHECK([for -exported_symbols_list linker flag],
[lt_cv_ld_exported_symbols_list],
[lt_cv_ld_exported_symbols_list=no
[lt_cv_ld_exported_symbols_list=no])
LDFLAGS="$save_LDFLAGS"
])
+
AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
[lt_cv_ld_force_load=no
cat > conftest.c << _LT_EOF
echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
_lt_result=$?
- if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+ if test -s conftest.err && $GREP force_load conftest.err; then
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
lt_cv_ld_force_load=yes
else
cat conftest.err >&AS_MESSAGE_LOG_FD
])
-# _LT_DARWIN_LINKER_FEATURES
-# --------------------------
+# _LT_DARWIN_LINKER_FEATURES([TAG])
+# ---------------------------------
# Checks for linker and compiler features on darwin
m4_defun([_LT_DARWIN_LINKER_FEATURES],
[
_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
if test "$lt_cv_ld_force_load" = "yes"; then
_LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+ m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
+ [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes])
else
_LT_TAGVAR(whole_archive_flag_spec, $1)=''
fi
CFLAGS="$SAVE_CFLAGS"
fi
;;
-sparc*-*solaris*)
+*-*solaris*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.o` in
*64-bit*)
case $lt_cv_prog_gnu_ld in
- yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ yes*)
+ case $host in
+ i?86-*-solaris*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ sparc*-*-solaris*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ # GNU ld 2.21 introduced _sol2 emulations. Use them if available.
+ if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+ LD="${LD-ld}_sol2"
+ fi
+ ;;
*)
if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
LD="${LD-ld} -64"
if test -n "$RANLIB"; then
case $host_os in
openbsd*)
- old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
;;
*)
- old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
;;
esac
- old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
fi
case $host_os in
lt_cv_sys_max_cmd_len=196608
;;
+ os2*)
+ # The test takes a long time on OS/2.
+ lt_cv_sys_max_cmd_len=8192
+ ;;
+
osf*)
# Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
# due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
# If test is not a shell built-in, we'll probably end up computing a
# maximum length that is only half of the actual maximum length, but
# we can't tell.
- while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+ while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
= "X$teststring$teststring"; } >/dev/null 2>&1 &&
test $i != 17 # 1/2 MB should be enough
do
case $host_os in
aix3*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
shlibpath_var=LIBPATH
;;
aix[[4-9]]*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
hardcode_into_libs=yes
;;
bsdi[[45]]*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
;;
dgux*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
shlibpath_var=LD_LIBRARY_PATH
;;
-freebsd1*)
- dynamic_linker=no
- ;;
-
freebsd* | dragonfly*)
# DragonFly does not have aout. When/if they implement a new
# versioning mechanism, adjust this.
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[[123]]*) objformat=aout ;;
+ freebsd[[23]].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[[01]]* | freebsdelf3.[[01]]*)
;;
gnu*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
;;
haiku*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
dynamic_linker="$host_os runtime_loader"
;;
interix[[3-9]]*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
nonstopux*) version_type=nonstopux ;;
*)
if test "$lt_cv_prog_gnu_ld" = yes; then
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
else
version_type=irix
fi ;;
dynamic_linker=no
;;
-# This must be Linux ELF.
+# This must be glibc/ELF.
linux* | k*bsd*-gnu | kopensolaris*-gnu)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
;;
newsos6)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
;;
solaris*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
;;
sysv4 | sysv4.3*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
sysv4*MP*)
if test -d /usr/nec ;then
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
soname_spec='$libname${shared_ext}.$major'
shlibpath_var=LD_LIBRARY_PATH
tpf*)
# TPF is a cross-target only. Preferred cross-host = GNU/Linux.
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
;;
uts4*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
lt_cv_deplibs_check_method=pass_all
;;
-# This must be Linux ELF.
+# This must be glibc/ELF.
linux* | k*bsd*-gnu | kopensolaris*-gnu)
lt_cv_deplibs_check_method=pass_all
;;
# which start with @ or ?.
lt_cv_sys_global_symbol_pipe="$AWK ['"\
" {last_section=section; section=\$ 3};"\
+" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
" \$ 0!~/External *\|/{next};"\
" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
case $cc_basename in
nvcc*) # Cuda Compiler Driver 2.2
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC'
+ if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
+ fi
;;
esac
else
;;
*)
case `$CC -V 2>&1 | sed 5q` in
- *Sun\ F* | *Sun*Fortran*)
+ *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
# Sun Fortran 8.3 passes all unrecognized flags to the linker
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)=''
;;
+ *Sun\ F* | *Sun*Fortran*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
*Sun\ C*)
# Sun C 5.9
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
;;
+ *Intel*\ [[CF]]*Compiler*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ *Portland\ Group*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
esac
;;
esac
;;
cygwin* | mingw* | cegcc*)
case $cc_basename in
- cl*) ;;
+ cl*)
+ _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+ ;;
*)
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
_LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
- _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
_LT_TAGVAR(hardcode_libdir_separator, $1)=
_LT_TAGVAR(hardcode_minus_L, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
xlf* | bgf* | bgxlf* | mpixlf*)
# IBM XL Fortran 10.1 on PPC cannot create shared libs itself
_LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
- _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
if test "x$supports_anon_versioning" = xyes; then
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
# The linker will not automatically build a static lib if we build a DLL.
# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
# Don't use ranlib
_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
- freebsd1*)
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
-
# FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
# support. Future versions do this automatically, but an explicit c++rt0.o
# does not break anything, and helps significantly (at the cost of a little
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_minus_L, $1)=yes
fi
if test "$with_gnu_ld" = no; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
- _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
[Flag to hardcode $libdir into a binary during linking.
This must work even if $libdir does not exist])
-_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],
- [[If ld is used when linking, flag to hardcode $libdir into a binary
- during linking. This must work even if $libdir does not exist]])
_LT_TAGDECL([], [hardcode_libdir_separator], [1],
[Whether we need a single "-rpath" flag with a separated argument])
_LT_TAGDECL([], [hardcode_direct], [0],
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
_LT_TAGVAR(hardcode_libdir_separator, $1)=
_LT_TAGVAR(hardcode_minus_L, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
esac
;;
- freebsd[[12]]*)
+ freebsd2.*)
# C++ shared libraries reported to be fairly broken before
# switch to ELF
_LT_TAGVAR(ld_shlibs, $1)=no
}
};
_LT_EOF
+], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
+package foo
+func foo() {
+}
+_LT_EOF
])
_lt_libdeps_save_CFLAGS=$CFLAGS
case "$CC $CFLAGS " in #(
*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
esac
dnl Parse the compiler output and extract the necessary
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
_LT_TAGVAR(hardcode_libdir_separator, $1)=
_LT_TAGVAR(hardcode_minus_L, $1)=no
_LT_TAGVAR(hardcode_automatic, $1)=no
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
_LT_TAGVAR(hardcode_libdir_separator, $1)=
_LT_TAGVAR(hardcode_minus_L, $1)=no
_LT_TAGVAR(hardcode_automatic, $1)=no
])# _LT_LANG_GCJ_CONFIG
+# _LT_LANG_GO_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Go compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GO_CONFIG],
+[AC_REQUIRE([LT_PROG_GO])dnl
+AC_LANG_SAVE
+
+# Source file extension for Go test sources.
+ac_ext=go
+
+# Object file extension for compiled Go test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="package main; func main() { }"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='package main; func main() { }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GOC-"gccgo"}
+CFLAGS=$GOFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# Go did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GO_CONFIG
+
+
# _LT_LANG_RC_CONFIG([TAG])
# -------------------------
# Ensure that the configuration variables for the Windows resource compiler
dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+# LT_PROG_GO
+# ----------
+AC_DEFUN([LT_PROG_GO],
+[AC_CHECK_TOOL(GOC, gccgo,)
+])
+
+
# LT_PROG_RC
# ----------
AC_DEFUN([LT_PROG_RC],
# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
m4_define([_LT_WITH_PIC],
[AC_ARG_WITH([pic],
- [AS_HELP_STRING([--with-pic],
+ [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
- [pic_mode="$withval"],
+ [lt_p=${PACKAGE-default}
+ case $withval in
+ yes|no) pic_mode=$withval ;;
+ *)
+ pic_mode=default
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for lt_pkg in $withval; do
+ IFS="$lt_save_ifs"
+ if test "X$lt_pkg" = "X$lt_p"; then
+ pic_mode=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
[pic_mode=default])
test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
# @configure_input@
-# serial 3293 ltversion.m4
+# serial 3337 ltversion.m4
# This file is part of GNU Libtool
-m4_define([LT_PACKAGE_VERSION], [2.4])
-m4_define([LT_PACKAGE_REVISION], [1.3293])
+m4_define([LT_PACKAGE_VERSION], [2.4.2])
+m4_define([LT_PACKAGE_REVISION], [1.3337])
AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.4'
-macro_revision='1.3293'
+[macro_version='2.4.2'
+macro_revision='1.3337'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
+#
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=m4_default([$1], [0.9.0])
+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ PKG_CONFIG=""
+ fi
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists. Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# have to call PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+ m4_default([$2], [:])
+m4_ifvaln([$3], [else
+ $3])dnl
+fi])
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+ pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+ PKG_CHECK_EXISTS([$3],
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes ],
+ [pkg_failed=yes])
+ else
+ pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+ AC_MSG_RESULT([no])
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+ m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])[]dnl
+ ])
+elif test $pkg_failed = untried; then
+ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
+ ])
+else
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ AC_MSG_RESULT([yes])
+ $3
+fi[]dnl
+])# PKG_CHECK_MODULES
+
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
/* Define to 1 if you have the <sys/filio.h> header file. */
#undef HAVE_SYS_FILIO_H
+/* Define to 1 if you have the <sys/sockio.h> header file. */
+#undef HAVE_SYS_SOCKIO_H
+
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for libnfs 0.0.0.
+# Generated by GNU Autoconf 2.68 for libnfs 1.2.0.
+#
+# Report bugs to <ronniesahlberg@gmail.com>.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
$as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
else
- $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
-$0: including any error possibly output before this
-$0: message. Then install a modern shell, or manually run
-$0: the script under such a shell if you do have one."
+ $as_echo "$0: Please tell bug-autoconf@gnu.org and
+$0: ronniesahlberg@gmail.com about your system, including
+$0: any error possibly output before this message. Then
+$0: install a modern shell, or manually run the script
+$0: under such a shell if you do have one."
fi
exit 1
fi
# Identity of this package.
PACKAGE_NAME='libnfs'
PACKAGE_TARNAME='libnfs'
-PACKAGE_VERSION='0.0.0'
-PACKAGE_STRING='libnfs 0.0.0'
-PACKAGE_BUGREPORT=''
+PACKAGE_VERSION='1.2.0'
+PACKAGE_STRING='libnfs 1.2.0'
+PACKAGE_BUGREPORT='ronniesahlberg@gmail.com'
PACKAGE_URL=''
# Factoring default headers for most tests.
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
+LIBNFS_PC_REQ_PRIVATE
+TIRPC_LIBS
+TIRPC_CFLAGS
RPCGENFLAGS
MAYBE_EXAMPLES
HAVE_RPCGEN
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
CPP
OTOOL64
OTOOL
LDFLAGS
LIBS
CPPFLAGS
-CPP'
+CPP
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
+TIRPC_CFLAGS
+TIRPC_LIBS'
# Initialize some variables set by options.
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libnfs 0.0.0 to adapt to many kinds of systems.
+\`configure' configures libnfs 1.2.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libnfs 0.0.0:";;
+ short | recursive ) echo "Configuration of libnfs 1.2.0:";;
esac
cat <<\_ACEOF
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --with-pic try to use only PIC/non-PIC objects [default=use
+ --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-sysroot=DIR Search for dependent libraries within DIR
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
+ PKG_CONFIG path to pkg-config utility
+ PKG_CONFIG_PATH
+ directories to add to pkg-config's search path
+ PKG_CONFIG_LIBDIR
+ path overriding pkg-config's built-in search path
+ TIRPC_CFLAGS
+ C compiler flags for TIRPC, overriding pkg-config
+ TIRPC_LIBS linker flags for TIRPC, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
-Report bugs to the package provider.
+Report bugs to <ronniesahlberg@gmail.com>.
_ACEOF
ac_status=$?
fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libnfs configure 0.0.0
+libnfs configure 1.2.0
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## --------------------------------------- ##
+## Report this to ronniesahlberg@gmail.com ##
+## --------------------------------------- ##"
+ ) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libnfs $as_me 0.0.0, which was
+It was created by libnfs $as_me 1.2.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
# Define the identity of the package.
PACKAGE='libnfs'
- VERSION='0.0.0'
+ VERSION='1.2.0'
cat >>confdefs.h <<_ACEOF
-macro_version='2.4'
-macro_revision='1.3293'
+macro_version='2.4.2'
+macro_revision='1.3337'
lt_cv_sys_max_cmd_len=196608
;;
+ os2*)
+ # The test takes a long time on OS/2.
+ lt_cv_sys_max_cmd_len=8192
+ ;;
+
osf*)
# Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
# due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
# If test is not a shell built-in, we'll probably end up computing a
# maximum length that is only half of the actual maximum length, but
# we can't tell.
- while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+ while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
= "X$teststring$teststring"; } >/dev/null 2>&1 &&
test $i != 17 # 1/2 MB should be enough
do
lt_cv_deplibs_check_method=pass_all
;;
-# This must be Linux ELF.
+# This must be glibc/ELF.
linux* | k*bsd*-gnu | kopensolaris*-gnu)
lt_cv_deplibs_check_method=pass_all
;;
if test -n "$RANLIB"; then
case $host_os in
openbsd*)
- old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
;;
*)
- old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
;;
esac
- old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
fi
case $host_os in
# which start with @ or ?.
lt_cv_sys_global_symbol_pipe="$AWK '"\
" {last_section=section; section=\$ 3};"\
+" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
" \$ 0!~/External *\|/{next};"\
" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
CFLAGS="$SAVE_CFLAGS"
fi
;;
-sparc*-*solaris*)
+*-*solaris*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
case `/usr/bin/file conftest.o` in
*64-bit*)
case $lt_cv_prog_gnu_ld in
- yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ yes*)
+ case $host in
+ i?86-*-solaris*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ sparc*-*-solaris*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ # GNU ld 2.21 introduced _sol2 emulations. Use them if available.
+ if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+ LD="${LD-ld}_sol2"
+ fi
+ ;;
*)
if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
LD="${LD-ld} -64"
$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-dynamiclib -Wl,-single_module conftest.c 2>conftest.err
_lt_result=$?
- if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+ # If there is a non-empty error log, and "single_module"
+ # appears in it, assume the flag caused a linker warning
+ if test -s conftest.err && $GREP single_module conftest.err; then
+ cat conftest.err >&5
+ # Otherwise, if the output was created with a 0 exit code from
+ # the compiler, it worked.
+ elif test -f libconftest.dylib && test $_lt_result -eq 0; then
lt_cv_apple_cc_single_mod=yes
else
cat conftest.err >&5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
if ${lt_cv_ld_exported_symbols_list+:} false; then :
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
$as_echo_n "checking for -force_load linker flag... " >&6; }
if ${lt_cv_ld_force_load+:} false; then :
echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
_lt_result=$?
- if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+ if test -s conftest.err && $GREP force_load conftest.err; then
+ cat conftest.err >&5
+ elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
lt_cv_ld_force_load=yes
else
cat conftest.err >&5
# Check whether --with-pic was given.
if test "${with_pic+set}" = set; then :
- withval=$with_pic; pic_mode="$withval"
+ withval=$with_pic; lt_p=${PACKAGE-default}
+ case $withval in
+ yes|no) pic_mode=$withval ;;
+ *)
+ pic_mode=default
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for lt_pkg in $withval; do
+ IFS="$lt_save_ifs"
+ if test "X$lt_pkg" = "X$lt_p"; then
+ pic_mode=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
else
pic_mode=default
fi
+
+
+
+
case $cc_basename in
nvcc*) # Cuda Compiler Driver 2.2
lt_prog_compiler_wl='-Xlinker '
- lt_prog_compiler_pic='-Xcompiler -fPIC'
+ if test -n "$lt_prog_compiler_pic"; then
+ lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
+ fi
;;
esac
else
;;
*)
case `$CC -V 2>&1 | sed 5q` in
- *Sun\ F* | *Sun*Fortran*)
+ *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
# Sun Fortran 8.3 passes all unrecognized flags to the linker
lt_prog_compiler_pic='-KPIC'
lt_prog_compiler_static='-Bstatic'
lt_prog_compiler_wl=''
;;
+ *Sun\ F* | *Sun*Fortran*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Qoption ld '
+ ;;
*Sun\ C*)
# Sun C 5.9
lt_prog_compiler_pic='-KPIC'
lt_prog_compiler_static='-Bstatic'
lt_prog_compiler_wl='-Wl,'
;;
+ *Intel*\ [CF]*Compiler*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ *Portland\ Group*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
esac
;;
esac
hardcode_direct=no
hardcode_direct_absolute=no
hardcode_libdir_flag_spec=
- hardcode_libdir_flag_spec_ld=
hardcode_libdir_separator=
hardcode_minus_L=no
hardcode_shlibpath_var=unsupported
xlf* | bgf* | bgxlf* | mpixlf*)
# IBM XL Fortran 10.1 on PPC cannot create shared libs itself
whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
- hardcode_libdir_flag_spec=
- hardcode_libdir_flag_spec_ld='-rpath $libdir'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
if test "x$supports_anon_versioning" = xyes; then
archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
# The linker will not automatically build a static lib if we build a DLL.
# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
enable_shared_with_static_runtimes=yes
+ exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
# Don't use ranlib
old_postinstall_cmds='chmod 644 $oldlib'
hardcode_shlibpath_var=unsupported
if test "$lt_cv_ld_force_load" = "yes"; then
whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
else
whole_archive_flag_spec=''
fi
hardcode_shlibpath_var=no
;;
- freebsd1*)
- ld_shlibs=no
- ;;
-
# FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
# support. Future versions do this automatically, but an explicit c++rt0.o
# does not break anything, and helps significantly (at the cost of a little
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
fi
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- hardcode_libdir_flag_spec_ld='+b $libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
hardcode_direct_absolute=yes
-
-
-
-
-
case $host_os in
aix3*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
shlibpath_var=LIBPATH
;;
aix[4-9]*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
hardcode_into_libs=yes
;;
bsdi[45]*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
;;
dgux*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
shlibpath_var=LD_LIBRARY_PATH
;;
-freebsd1*)
- dynamic_linker=no
- ;;
-
freebsd* | dragonfly*)
# DragonFly does not have aout. When/if they implement a new
# versioning mechanism, adjust this.
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
;;
gnu*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
;;
haiku*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
dynamic_linker="$host_os runtime_loader"
;;
interix[3-9]*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
nonstopux*) version_type=nonstopux ;;
*)
if test "$lt_cv_prog_gnu_ld" = yes; then
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
else
version_type=irix
fi ;;
dynamic_linker=no
;;
-# This must be Linux ELF.
+# This must be glibc/ELF.
linux* | k*bsd*-gnu | kopensolaris*-gnu)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
;;
newsos6)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
;;
solaris*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
;;
sysv4 | sysv4.3*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
sysv4*MP*)
if test -d /usr/nec ;then
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
soname_spec='$libname${shared_ext}.$major'
shlibpath_var=LD_LIBRARY_PATH
tpf*)
# TPF is a cross-target only. Preferred cross-host = GNU/Linux.
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
;;
uts4*)
- version_type=linux
+ version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
+
+
ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+ ac_pt_PKG_CONFIG=$PKG_CONFIG
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_PKG_CONFIG" = x; then
+ PKG_CONFIG=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ PKG_CONFIG=$ac_pt_PKG_CONFIG
+ fi
+else
+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=0.9.0
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ PKG_CONFIG=""
+ fi
+fi
+
# Work around stupid autoconf default cflags. pt 2
if test "$SAVE_CFLAGS" = "x"; then
CFLAGS=""
fi
+# We always want 64 bit file offsets
+CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64"
+
# Extract the first word of "rpcgen", so it can be a program name with args.
set dummy rpcgen; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
fi
+done
+
+ for ac_header in sys/sockio.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "sys/sockio.h" "ac_cv_header_sys_sockio_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_sockio_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_SOCKIO_H 1
+_ACEOF
+
+fi
+
done
if test x$ENABLE_EXAMPLES = xyes; then
fi
-echo "Use TI-RPC: $enable_tirpc"
+LIBNFS_PC_REQ_PRIVATE=
+
if test "$enable_tirpc" = "yes"; then
- CFLAGS="${CFLAGS} -I /usr/include/tirpc"
- LDFLAGS="${LDFLAGS} -ltirpc"
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIRPC" >&5
+$as_echo_n "checking for TIRPC... " >&6; }
+
+if test -n "$TIRPC_CFLAGS"; then
+ pkg_cv_TIRPC_CFLAGS="$TIRPC_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtirpc\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libtirpc") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_TIRPC_CFLAGS=`$PKG_CONFIG --cflags "libtirpc" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$TIRPC_LIBS"; then
+ pkg_cv_TIRPC_LIBS="$TIRPC_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtirpc\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libtirpc") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_TIRPC_LIBS=`$PKG_CONFIG --libs "libtirpc" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
fi
+ if test $_pkg_short_errors_supported = yes; then
+ TIRPC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libtirpc" 2>&1`
+ else
+ TIRPC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtirpc" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$TIRPC_PKG_ERRORS" >&5
+
+ as_fn_error $? "unable to locate libtirpc files" "$LINENO" 5
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ as_fn_error $? "unable to locate libtirpc files" "$LINENO" 5
+else
+ TIRPC_CFLAGS=$pkg_cv_TIRPC_CFLAGS
+ TIRPC_LIBS=$pkg_cv_TIRPC_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+ CFLAGS="${CFLAGS} ${TIRPC_CFLAGS}"
+ LIBS="${LIBS} ${TIRPC_LIBS}"
+ LIBNFS_PC_REQ_PRIVATE="${LIBNFS_PC_REQ_PRIVATE} libtirpc"
+fi
+
+
#output
ac_config_files="$ac_config_files Makefile include/Makefile lib/Makefile mount/Makefile nfs/Makefile portmap/Makefile rquota/Makefile examples/Makefile"
+ac_config_files="$ac_config_files libnfs.pc"
+
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libnfs $as_me 0.0.0, which was
+This file was extended by libnfs $as_me 1.2.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Configuration commands:
$config_commands
-Report bugs to the package provider."
+Report bugs to <ronniesahlberg@gmail.com>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-libnfs config.status 0.0.0
+libnfs config.status 1.2.0
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`'
hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
# Quote evaled strings.
for var in SHELL \
ECHO \
+PATH_SEPARATOR \
SED \
GREP \
EGREP \
allow_undefined_flag \
no_undefined_flag \
hardcode_libdir_flag_spec \
-hardcode_libdir_flag_spec_ld \
hardcode_libdir_separator \
exclude_expsyms \
include_expsyms \
"portmap/Makefile") CONFIG_FILES="$CONFIG_FILES portmap/Makefile" ;;
"rquota/Makefile") CONFIG_FILES="$CONFIG_FILES rquota/Makefile" ;;
"examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
+ "libnfs.pc") CONFIG_FILES="$CONFIG_FILES libnfs.pc" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
#
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-# 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
-# Inc.
+# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# Written by Gordon Matzigkeit, 1996
#
# This file is part of GNU Libtool.
# An echo program that protects backslashes.
ECHO=$lt_ECHO
+# The PATH separator for the build system.
+PATH_SEPARATOR=$lt_PATH_SEPARATOR
+
# The host system.
host_alias=$host_alias
host=$host
# This must work even if \$libdir does not exist
hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
-# If ld is used when linking, flag to hardcode \$libdir into a binary
-# during linking. This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
-
# Whether we need a single "-rpath" flag with a separated argument.
hardcode_libdir_separator=$lt_hardcode_libdir_separator
AC_PREREQ(2.50)
-AC_INIT([libnfs], [0.0.0])
+AC_INIT([libnfs], [1.2.0], [ronniesahlberg@gmail.com])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign])
AC_CANONICAL_HOST
AC_PROG_LIBTOOL
AM_PROG_CC_C_O
+PKG_PROG_PKG_CONFIG
# Work around stupid autoconf default cflags. pt 2
if test "$SAVE_CFLAGS" = "x"; then
CFLAGS=""
fi
+# We always want 64 bit file offsets
+CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64"
+
AC_CHECK_PROG([HAVE_RPCGEN], [rpcgen], [yes], [no])
if test x$HAVE_RPCGEN != xyes; then
AC_MSG_ERROR([Can not find required program])
;;
*solaris*)
AC_CHECK_HEADERS([sys/filio.h])
+ AC_CHECK_HEADERS([sys/sockio.h])
if test x$ENABLE_EXAMPLES = xyes; then
AC_CHECK_LIB([socket], [main], , [AC_MSG_ERROR([Can not find required library])])
AC_CHECK_LIB([nsl], [main], , [AC_MSG_ERROR([Can not find required library])])
#include <sys/socket.h>
])
-echo "Use TI-RPC: $enable_tirpc"
+LIBNFS_PC_REQ_PRIVATE=
+
if test "$enable_tirpc" = "yes"; then
- CFLAGS="${CFLAGS} -I /usr/include/tirpc"
- LDFLAGS="${LDFLAGS} -ltirpc"
+ PKG_CHECK_MODULES(TIRPC, libtirpc, [],
+ AC_MSG_ERROR([unable to locate libtirpc files]))
+ CFLAGS="${CFLAGS} ${TIRPC_CFLAGS}"
+ LIBS="${LIBS} ${TIRPC_LIBS}"
+ LIBNFS_PC_REQ_PRIVATE="${LIBNFS_PC_REQ_PRIVATE} libtirpc"
fi
+AC_SUBST(LIBNFS_PC_REQ_PRIVATE)
+
#output
AC_CONFIG_FILES([Makefile]
[include/Makefile]
[examples/Makefile]
)
-AC_OUTPUT
+AC_OUTPUT([libnfs.pc])
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LIBNFS_PC_REQ_PRIVATE = @LIBNFS_PC_REQ_PRIVATE@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
RPCGENFLAGS = @RPCGENFLAGS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+TIRPC_CFLAGS = @TIRPC_CFLAGS@
+TIRPC_LIBS = @TIRPC_LIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
/* Example program using the highlevel async interface.
*/
-
+#ifdef WIN32
+#include "win32_compat.h"
+#else
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <poll.h>
+#endif
+
#define SERVER "10.1.1.27"
#define EXPORT "/VIRTUAL"
#define NFSFILE "/BOOKS/Classics/Dracula.djvu"
#include <stdlib.h>
#include <stdint.h>
#include <sys/types.h>
-#include <sys/stat.h>
#include <unistd.h>
-#include <fcntl.h>
-#include <poll.h>
#include "libnfs.h"
#include "libnfs-raw.h"
#include "libnfs-raw-mount.h"
* This allow accurate control of the exact commands that are being used.
*/
+#ifdef WIN32
+#include "win32_compat.h"
+#else
+#include <poll.h>
+#endif
#define SERVER "10.1.1.27"
#define EXPORT "/shared"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <poll.h>
#include "libnfs.h"
#include "libnfs-raw.h"
#include "libnfs-raw-mount.h"
/* Example program using the highlevel sync interface
*/
-
+#ifdef WIN32
+#include "win32_compat.h"
+#else
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/statvfs.h>
+#endif
+
#define SERVER "10.1.1.27"
#define EXPORT "/VIRTUAL"
#define NFSFILE "/BOOKS/Classics/Dracula.djvu.truncated"
#define NFSDIR "/BOOKS/Classics/"
#define _GNU_SOURCE
+
+#if defined(WIN32)
+#pragma comment(lib, "ws2_32.lib")
+WSADATA wsaData;
+#else
+#include <sys/statvfs.h>
+#include <unistd.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/statvfs.h>
-#include <unistd.h>
#include <fcntl.h>
#include "libnfs.h"
#include <rpc/rpc.h> /* for authunix_create() */
};
+void PrintServerList()
+{
+ struct nfs_server_list *srvrs;
+ struct nfs_server_list *srv;
+
+ srvrs = nfs_find_local_servers();
+
+ for (srv=srvrs; srv; srv = srv->next)
+ {
+ printf("Found nfs server: %s\n", srv->addr);
+
+ }
+ free_nfs_srvr_list(srvrs);
+}
+
char buf[3*1024*1024+337];
int main(int argc _U_, char *argv[] _U_)
{
struct nfs_context *nfs;
int i, ret;
+ uint64_t offset;
struct client client;
struct stat st;
struct nfsfh *nfsfh;
struct nfsdir *nfsdir;
struct nfsdirent *nfsdirent;
+ struct statvfs svfs;
+ exports export, tmp;
+
+#if defined(WIN32)
+ if (WSAStartup(MAKEWORD(2,2), &wsaData) != 0) {
+ printf("Failed to start Winsock2\n");
+ exit(10);
+ }
+#endif
+
client.server = SERVER;
client.export = EXPORT;
client.is_finished = 0;
- off_t offset;
- struct statvfs svfs;
- exports export, tmp;
+
+ PrintServerList();
export = mount_getexports(SERVER);
if (export != NULL) {
exit(10);
}
while((nfsdirent = nfs_readdir(nfs, nfsdir)) != NULL) {
- char *filename = NULL;
+ char filename[1024];
printf("Inode:%d Name:%s ", (int)nfsdirent->inode, nfsdirent->name);
- asprintf(&filename, "%s/%s", NFSDIR, nfsdirent->name);
+ sprintf(filename, "%s/%s", NFSDIR, nfsdirent->name);
ret = nfs_open(nfs, filename, O_RDONLY, &nfsfh);
- free(filename);
if (ret != 0) {
printf("Failed to open(%s) %s\n", filename, nfs_get_error(nfs));
exit(10);
ret = nfs_read(nfs, nfsfh, sizeof(buf), buf);
if (ret < 0) {
printf("Error reading file\n");
- exit(10);
}
printf("Read %d bytes\n", ret);
ret = nfs_close(nfs, nfsfh);
nfscdir = $(includedir)/nfsc
dist_nfsc_HEADERS = \
libnfs.h \
- libnfs-private.h \
libnfs-raw.h \
- slist.h \
${abs_top_srcdir}/mount/libnfs-raw-mount.h \
${abs_top_srcdir}/portmap/libnfs-raw-portmap.h \
${abs_top_srcdir}/nfs/libnfs-raw-nfs.h \
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LIBNFS_PC_REQ_PRIVATE = @LIBNFS_PC_REQ_PRIVATE@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
RPCGENFLAGS = @RPCGENFLAGS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+TIRPC_CFLAGS = @TIRPC_CFLAGS@
+TIRPC_LIBS = @TIRPC_LIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
nfscdir = $(includedir)/nfsc
dist_nfsc_HEADERS = \
libnfs.h \
- libnfs-private.h \
libnfs-raw.h \
- slist.h \
${abs_top_srcdir}/mount/libnfs-raw-mount.h \
${abs_top_srcdir}/portmap/libnfs-raw-portmap.h \
${abs_top_srcdir}/nfs/libnfs-raw-nfs.h \
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#include <rpc/xdr.h>
#include <rpc/auth.h>
+struct rpc_fragment {
+ struct rpc_fragment *next;
+ uint64_t size;
+ char *data;
+};
+
struct rpc_context {
int fd;
int is_connected;
int is_udp;
struct sockaddr *udp_dest;
int is_broadcast;
+
+ /* track the address we connect to so we can auto-reconnect on session failure */
+ struct sockaddr_storage s;
+ int auto_reconnect;
+
+ /* fragment reassembly */
+ struct rpc_fragment *fragments;
};
struct rpc_pdu {
void nfs_set_error(struct nfs_context *nfs, char *error_string, ...);
struct rpc_context *nfs_get_rpc_context(struct nfs_context *nfs);
+const char *nfs_get_server(struct nfs_context *nfs);
+const char *nfs_get_export(struct nfs_context *nfs);
/* we dont want to expose UDP to normal applications/users this is private to libnfs to use exclusively for broadcast RPC */
int rpc_bind_udp(struct rpc_context *rpc, char *addr, int port);
struct rpc_context *rpc_init_udp_context(void);
struct sockaddr *rpc_get_recv_sockaddr(struct rpc_context *rpc);
+void rpc_set_autoreconnect(struct rpc_context *rpc);
+void rpc_unset_autoreconnect(struct rpc_context *rpc);
+
+int rpc_add_fragment(struct rpc_context *rpc, char *data, uint64_t size);
+void rpc_free_all_fragments(struct rpc_context *rpc);
+
* protocol as well as the XDR encoded/decoded structures.
*/
#include <stdint.h>
+#include <rpc/rpc.h>
+#include <rpc/auth.h>
struct rpc_data {
int size;
struct rpc_context *rpc_init_context(void);
void rpc_destroy_context(struct rpc_context *rpc);
-struct AUTH;
-void rpc_set_auth(struct rpc_context *rpc, struct AUTH *auth);
+void rpc_set_auth(struct rpc_context *rpc, AUTH *auth);
int rpc_get_fd(struct rpc_context *rpc);
int rpc_which_events(struct rpc_context *rpc);
int rpc_service(struct rpc_context *rpc, int revents);
char *rpc_get_error(struct rpc_context *rpc);
+int rpc_queue_length(struct rpc_context *rpc);
#define RPC_STATUS_SUCCESS 0
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, off_t offset, size_t count, void *private_data);
+int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t offset, uint64_t count, void *private_data);
/*
* Call NFS/WRITE
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_write_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *buf, off_t offset, size_t count, int stable_how, void *private_data);
+int rpc_nfs_write_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *buf, uint64_t offset, uint64_t count, int stable_how, void *private_data);
/*
* Call NFS/COMMIT
int rpc_nfs_create_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *name, int mode, void *private_data);
+/*
+ * Call NFS/MKNOD
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
+ * data is MKNOD3res *
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+int rpc_nfs_mknod_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *file, int mode, int major, int minor, void *private_data);
/*
/*
- * Call NFS/REMOVE
+ * Call NFS/READDIR
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
*/
int rpc_nfs_readdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t cookie, char *cookieverf, int count, void *private_data);
+/*
+ * Call NFS/READDIRPLUS
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
+ * data is READDIRPLUS3res *
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+int rpc_nfs_readdirplus_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t cookie, char *cookieverf, int count, void *private_data);
+
/*
* Call NFS/FSSTAT
* Function returns
* This is the highlevel interface to access NFS resources using a posix-like interface
*/
#include <stdint.h>
+#include <rpc/rpc.h>
+#include <rpc/auth.h>
struct nfs_context;
struct rpc_context;
+#if defined(WIN32)
+#define EXTERN __declspec( dllexport )
+#else
+#define EXTERN
+#endif
+
+#if defined(WIN32)
+struct statvfs {
+ uint32_t f_bsize;
+ uint32_t f_frsize;
+ uint64_t f_blocks;
+ uint64_t f_bfree;
+ uint64_t f_bavail;
+ uint32_t f_files;
+ uint32_t f_ffree;
+ uint32_t f_favail;
+ uint32_t f_fsid;
+ uint32_t f_flag;
+ uint32_t f_namemax;
+};
+struct utimbuf {
+ time_t actime;
+ time_t modtime;
+};
+#define R_OK 4
+#define W_OK 2
+#define X_OK 1
+#endif
+
/*
* Used for interfacing the async version of the api into an external eventsystem
*/
-int nfs_get_fd(struct nfs_context *nfs);
-int nfs_which_events(struct nfs_context *nfs);
-int nfs_service(struct nfs_context *nfs, int revents);
+EXTERN int nfs_get_fd(struct nfs_context *nfs);
+EXTERN int nfs_which_events(struct nfs_context *nfs);
+EXTERN int nfs_service(struct nfs_context *nfs, int revents);
+EXTERN int nfs_queue_length(struct nfs_context *nfs);
/*
* Used if you need different credentials than the default for the current user.
*/
-struct AUTH;
-void nfs_set_auth(struct nfs_context *nfs, struct AUTH *auth);
+EXTERN void nfs_set_auth(struct nfs_context *nfs, AUTH *auth);
/*
* When an operation failed, this function can extract a detailed error string.
*/
-char *nfs_get_error(struct nfs_context *nfs);
+EXTERN char *nfs_get_error(struct nfs_context *nfs);
/*
* NULL : Failed to create a context.
* *nfs : A pointer to an nfs context.
*/
-struct nfs_context *nfs_init_context(void);
+EXTERN struct nfs_context *nfs_init_context(void);
/*
* Destroy an nfs context.
*/
-void nfs_destroy_context(struct nfs_context *nfs);
+EXTERN void nfs_destroy_context(struct nfs_context *nfs);
struct nfsfh;
/*
* Get the maximum supported READ3 size by the server
*/
-size_t nfs_get_readmax(struct nfs_context *nfs);
+EXTERN uint64_t nfs_get_readmax(struct nfs_context *nfs);
/*
* Get the maximum supported WRITE3 size by the server
*/
-size_t nfs_get_writemax(struct nfs_context *nfs);
+EXTERN uint64_t nfs_get_writemax(struct nfs_context *nfs);
/*
* -errno : An error occured.
* data is the error string.
*/
-int nfs_mount_async(struct nfs_context *nfs, const char *server, const char *exportname, nfs_cb cb, void *private_data);
+EXTERN int nfs_mount_async(struct nfs_context *nfs, const char *server, const char *exportname, nfs_cb cb, void *private_data);
/*
* Sync nfs mount.
* Function returns
* 0 : The operation was successfull.
* -errno : The command failed.
*/
-int nfs_mount(struct nfs_context *nfs, const char *server, const char *exportname);
+EXTERN int nfs_mount(struct nfs_context *nfs, const char *server, const char *exportname);
* data is the error string.
*/
struct stat;
-int nfs_stat_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
+EXTERN int nfs_stat_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
/*
* Sync stat(<filename>)
* Function returns
* 0 : The operation was successfull.
* -errno : The command failed.
*/
-int nfs_stat(struct nfs_context *nfs, const char *path, struct stat *st);
+EXTERN int nfs_stat(struct nfs_context *nfs, const char *path, struct stat *st);
/*
* -errno : An error occured.
* data is the error string.
*/
-int nfs_fstat_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, void *private_data);
+EXTERN int nfs_fstat_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, void *private_data);
/*
* Sync fstat(nfsfh *)
* Function returns
* 0 : The operation was successfull.
* -errno : The command failed.
*/
-int nfs_fstat(struct nfs_context *nfs, struct nfsfh *nfsfh, struct stat *st);
+EXTERN int nfs_fstat(struct nfs_context *nfs, struct nfsfh *nfsfh, struct stat *st);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_open_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
+EXTERN int nfs_open_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
/*
* Sync stat(<filename>)
* Function returns
* 0 : The operation was successfull. *nfsfh is filled in.
* -errno : The command failed.
*/
-int nfs_open(struct nfs_context *nfs, const char *path, int mode, struct nfsfh **nfsfh);
+EXTERN int nfs_open(struct nfs_context *nfs, const char *path, int mode, struct nfsfh **nfsfh);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_close_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, void *private_data);
+EXTERN int nfs_close_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, void *private_data);
/*
* Sync close(nfsfh)
* Function returns
* 0 : The operation was successfull.
* -errno : The command failed.
*/
-int nfs_close(struct nfs_context *nfs, struct nfsfh *nfsfh);
+EXTERN int nfs_close(struct nfs_context *nfs, struct nfsfh *nfsfh);
/*
* -errno : An error occured.
* data is the error string.
*/
-int nfs_pread_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, nfs_cb cb, void *private_data);
+EXTERN int nfs_pread_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, nfs_cb cb, void *private_data);
/*
* Sync pread()
* Function returns
* >=0 : numer of bytes read.
* -errno : An error occured.
*/
-int nfs_pread(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buf);
+EXTERN int nfs_pread(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buf);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_read_async(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, nfs_cb cb, void *private_data);
+EXTERN int nfs_read_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, nfs_cb cb, void *private_data);
/*
* Sync read()
* Function returns
* >=0 : numer of bytes read.
* -errno : An error occured.
*/
-int nfs_read(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf);
+EXTERN int nfs_read(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, char *buf);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_pwrite_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buf, nfs_cb cb, void *private_data);
+EXTERN int nfs_pwrite_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buf, nfs_cb cb, void *private_data);
/*
* Sync pwrite()
* Function returns
* >=0 : numer of bytes written.
* -errno : An error occured.
*/
-int nfs_pwrite(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buf);
+EXTERN int nfs_pwrite(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buf);
/*
* -errno : An error occured.
* data is the error string.
*/
-int nfs_write_async(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf, nfs_cb cb, void *private_data);
+EXTERN int nfs_write_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, char *buf, nfs_cb cb, void *private_data);
/*
* Sync write()
* Function returns
* >=0 : numer of bytes written.
* -errno : An error occured.
*/
-int nfs_write(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf);
+EXTERN int nfs_write(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, char *buf);
/*
*
* When the callback is invoked, status indicates the result:
* >=0 : Success.
- * data is off_t * for the current position.
+ * data is uint64_t * for the current position.
* -errno : An error occured.
* data is the error string.
*/
-int nfs_lseek_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, int whence, nfs_cb cb, void *private_data);
+EXTERN int nfs_lseek_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, int whence, nfs_cb cb, void *private_data);
/*
* Sync lseek()
* Function returns
* >=0 : numer of bytes read.
* -errno : An error occured.
*/
-int nfs_lseek(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, int whence, off_t *current_offset);
+EXTERN int nfs_lseek(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, int whence, uint64_t *current_offset);
/*
* -errno : An error occured.
* data is the error string.
*/
-int nfs_fsync_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, void *private_data);
+EXTERN int nfs_fsync_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, void *private_data);
/*
* Sync fsync()
* Function returns
* 0 : Success
* -errno : An error occured.
*/
-int nfs_fsync(struct nfs_context *nfs, struct nfsfh *nfsfh);
+EXTERN int nfs_fsync(struct nfs_context *nfs, struct nfsfh *nfsfh);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_truncate_async(struct nfs_context *nfs, const char *path, off_t length, nfs_cb cb, void *private_data);
+EXTERN int nfs_truncate_async(struct nfs_context *nfs, const char *path, uint64_t length, nfs_cb cb, void *private_data);
/*
* Sync truncate()
* Function returns
* 0 : Success
* -errno : An error occured.
*/
-int nfs_truncate(struct nfs_context *nfs, const char *path, off_t length);
+EXTERN int nfs_truncate(struct nfs_context *nfs, const char *path, uint64_t length);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_ftruncate_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t length, nfs_cb cb, void *private_data);
+EXTERN int nfs_ftruncate_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t length, nfs_cb cb, void *private_data);
/*
* Sync ftruncate()
* Function returns
* 0 : Success
* -errno : An error occured.
*/
-int nfs_ftruncate(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t length);
+EXTERN int nfs_ftruncate(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t length);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_mkdir_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
+EXTERN int nfs_mkdir_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
/*
* Sync mkdir()
* Function returns
* 0 : Success
* -errno : An error occured.
*/
-int nfs_mkdir(struct nfs_context *nfs, const char *path);
+EXTERN int nfs_mkdir(struct nfs_context *nfs, const char *path);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_rmdir_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
+EXTERN int nfs_rmdir_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
/*
* Sync rmdir()
* Function returns
* 0 : Success
* -errno : An error occured.
*/
-int nfs_rmdir(struct nfs_context *nfs, const char *path);
+EXTERN int nfs_rmdir(struct nfs_context *nfs, const char *path);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_creat_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
+EXTERN int nfs_creat_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
/*
* Sync creat()
* Function returns
* 0 : Success
* -errno : An error occured.
*/
-int nfs_creat(struct nfs_context *nfs, const char *path, int mode, struct nfsfh **nfsfh);
+EXTERN int nfs_creat(struct nfs_context *nfs, const char *path, int mode, struct nfsfh **nfsfh);
+/*
+ * MKNOD()
+ */
+/*
+ * Async mknod()
+ *
+ * Function returns
+ * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
+ * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * 0 : Success.
+ * -errno : An error occured.
+ * data is the error string.
+ */
+EXTERN int nfs_mknod_async(struct nfs_context *nfs, const char *path, int mode, int dev, nfs_cb cb, void *private_data);
+/*
+ * Sync mknod()
+ * Function returns
+ * 0 : Success
+ * -errno : An error occured.
+ */
+EXTERN int nfs_mknod(struct nfs_context *nfs, const char *path, int mode, int dev);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_unlink_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
+EXTERN int nfs_unlink_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
/*
* Sync unlink()
* Function returns
* 0 : Success
* -errno : An error occured.
*/
-int nfs_unlink(struct nfs_context *nfs, const char *path);
+EXTERN int nfs_unlink(struct nfs_context *nfs, const char *path);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_opendir_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
+EXTERN int nfs_opendir_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
/*
* Sync opendir()
* Function returns
* 0 : Success
* -errno : An error occured.
*/
-int nfs_opendir(struct nfs_context *nfs, const char *path, struct nfsdir **nfsdir);
+EXTERN int nfs_opendir(struct nfs_context *nfs, const char *path, struct nfsdir **nfsdir);
struct nfsdirent *next;
char *name;
uint64_t inode;
+
+ /* some extra fields we get for free through the READDIRPLUS3 call. You need libnfs-raw-nfs.h for these */
+ uint32_t type; /* NF3REG, NF3DIR, NF3BLK, ... */
+ uint32_t mode;
+ uint64_t size;
+ struct timeval atime;
+ struct timeval mtime;
+ struct timeval ctime;
};
/*
* nfs_readdir() never blocks, so no special sync/async versions are available
*/
-struct nfsdirent *nfs_readdir(struct nfs_context *nfs, struct nfsdir *nfsdir);
+EXTERN struct nfsdirent *nfs_readdir(struct nfs_context *nfs, struct nfsdir *nfsdir);
/*
* nfs_closedir() never blocks, so no special sync/async versions are available
*/
-void nfs_closedir(struct nfs_context *nfs, struct nfsdir *nfsdir);
+EXTERN void nfs_closedir(struct nfs_context *nfs, struct nfsdir *nfsdir);
* data is the error string.
*/
struct statvfs;
-int nfs_statvfs_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
+EXTERN int nfs_statvfs_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
/*
* Sync statvfs(<dirname>)
* Function returns
* 0 : The operation was successfull.
* -errno : The command failed.
*/
-int nfs_statvfs(struct nfs_context *nfs, const char *path, struct statvfs *svfs);
+EXTERN int nfs_statvfs(struct nfs_context *nfs, const char *path, struct statvfs *svfs);
/*
* data is the error string.
*/
struct statvfs;
-int nfs_readlink_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
+EXTERN int nfs_readlink_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
/*
* Sync readlink(<name>)
* Function returns
* 0 : The operation was successfull.
* -errno : The command failed.
*/
-int nfs_readlink(struct nfs_context *nfs, const char *path, char *buf, int bufsize);
+EXTERN int nfs_readlink(struct nfs_context *nfs, const char *path, char *buf, int bufsize);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_chmod_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
+EXTERN int nfs_chmod_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
/*
* Sync chmod(<name>)
* Function returns
* 0 : The operation was successfull.
* -errno : The command failed.
*/
-int nfs_chmod(struct nfs_context *nfs, const char *path, int mode);
+EXTERN int nfs_chmod(struct nfs_context *nfs, const char *path, int mode);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_fchmod_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int mode, nfs_cb cb, void *private_data);
+EXTERN int nfs_fchmod_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int mode, nfs_cb cb, void *private_data);
/*
* Sync fchmod(<handle>)
* Function returns
* 0 : The operation was successfull.
* -errno : The command failed.
*/
-int nfs_fchmod(struct nfs_context *nfs, struct nfsfh *nfsfh, int mode);
+EXTERN int nfs_fchmod(struct nfs_context *nfs, struct nfsfh *nfsfh, int mode);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_chown_async(struct nfs_context *nfs, const char *path, int uid, int gid, nfs_cb cb, void *private_data);
+EXTERN int nfs_chown_async(struct nfs_context *nfs, const char *path, int uid, int gid, nfs_cb cb, void *private_data);
/*
* Sync chown(<name>)
* Function returns
* 0 : The operation was successfull.
* -errno : The command failed.
*/
-int nfs_chown(struct nfs_context *nfs, const char *path, int uid, int gid);
+EXTERN int nfs_chown(struct nfs_context *nfs, const char *path, int uid, int gid);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_fchown_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int gid, nfs_cb cb, void *private_data);
+EXTERN int nfs_fchown_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int gid, nfs_cb cb, void *private_data);
/*
* Sync fchown(<handle>)
* Function returns
* 0 : The operation was successfull.
* -errno : The command failed.
*/
-int nfs_fchown(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int gid);
+EXTERN int nfs_fchown(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int gid);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_utimes_async(struct nfs_context *nfs, const char *path, struct timeval *times, nfs_cb cb, void *private_data);
+EXTERN int nfs_utimes_async(struct nfs_context *nfs, const char *path, struct timeval *times, nfs_cb cb, void *private_data);
/*
* Sync utimes(<path>)
* Function returns
* 0 : The operation was successfull.
* -errno : The command failed.
*/
-int nfs_utimes(struct nfs_context *nfs, const char *path, struct timeval *times);
+EXTERN int nfs_utimes(struct nfs_context *nfs, const char *path, struct timeval *times);
/*
* data is the error string.
*/
struct utimbuf;
-int nfs_utime_async(struct nfs_context *nfs, const char *path, struct utimbuf *times, nfs_cb cb, void *private_data);
+EXTERN int nfs_utime_async(struct nfs_context *nfs, const char *path, struct utimbuf *times, nfs_cb cb, void *private_data);
/*
* Sync utime(<path>)
* Function returns
* 0 : The operation was successfull.
* -errno : The command failed.
*/
-int nfs_utime(struct nfs_context *nfs, const char *path, struct utimbuf *times);
+EXTERN int nfs_utime(struct nfs_context *nfs, const char *path, struct utimbuf *times);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_access_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
+EXTERN int nfs_access_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
/*
* Sync access(<path>)
* Function returns
* 0 : The operation was successfull.
* -errno : The command failed.
*/
-int nfs_access(struct nfs_context *nfs, const char *path, int mode);
+EXTERN int nfs_access(struct nfs_context *nfs, const char *path, int mode);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_symlink_async(struct nfs_context *nfs, const char *oldpath, const char *newpath, nfs_cb cb, void *private_data);
+EXTERN int nfs_symlink_async(struct nfs_context *nfs, const char *oldpath, const char *newpath, nfs_cb cb, void *private_data);
/*
* Sync symlink(<path>)
* Function returns
* 0 : The operation was successfull.
* -errno : The command failed.
*/
-int nfs_symlink(struct nfs_context *nfs, const char *oldpath, const char *newpath);
+EXTERN int nfs_symlink(struct nfs_context *nfs, const char *oldpath, const char *newpath);
/*
* -errno : An error occured.
* data is the error string.
*/
-int nfs_rename_async(struct nfs_context *nfs, const char *oldpath, const char *newpath, nfs_cb cb, void *private_data);
+EXTERN int nfs_rename_async(struct nfs_context *nfs, const char *oldpath, const char *newpath, nfs_cb cb, void *private_data);
/*
* Sync rename(<oldpath>, <newpath>)
* Function returns
* 0 : The operation was successfull.
* -errno : The command failed.
*/
-int nfs_rename(struct nfs_context *nfs, const char *oldpath, const char *newpath);
+EXTERN int nfs_rename(struct nfs_context *nfs, const char *oldpath, const char *newpath);
* -errno : An error occured.
* data is the error string.
*/
-int nfs_link_async(struct nfs_context *nfs, const char *oldpath, const char *newpath, nfs_cb cb, void *private_data);
+EXTERN int nfs_link_async(struct nfs_context *nfs, const char *oldpath, const char *newpath, nfs_cb cb, void *private_data);
/*
* Sync link(<oldpath>, <newpath>)
* Function returns
* 0 : The operation was successfull.
* -errno : The command failed.
*/
-int nfs_link(struct nfs_context *nfs, const char *oldpath, const char *newpath);
+EXTERN int nfs_link(struct nfs_context *nfs, const char *oldpath, const char *newpath);
/*
* -errno : An error occured.
* data is the error string.
*/
-int mount_getexports_async(struct rpc_context *rpc, const char *server, rpc_cb cb, void *private_data);
+EXTERN int mount_getexports_async(struct rpc_context *rpc, const char *server, rpc_cb cb, void *private_data);
/*
* Sync getexports(<server>)
* Function returns
*
* returned data must be freed by calling mount_free_export_list(exportnode);
*/
-struct exportnode *mount_getexports(const char *server);
+EXTERN struct exportnode *mount_getexports(const char *server);
-void mount_free_export_list(struct exportnode *exports);
+EXTERN void mount_free_export_list(struct exportnode *exports);
//qqq replace later with lseek(cur, 0)
-off_t nfs_get_current_offset(struct nfsfh *nfsfh);
+uint64_t nfs_get_current_offset(struct nfsfh *nfsfh);
pdu.c \
socket.c
-libnfs_la_LDFLAGS = -version-info 0:0:0
+libnfs_la_LDFLAGS = -version-info 1:2:0
libnfs_la_LIBADD = \
../mount/libmount.la \
../nfs/libnfs.la \
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LIBNFS_PC_REQ_PRIVATE = @LIBNFS_PC_REQ_PRIVATE@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
RPCGENFLAGS = @RPCGENFLAGS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+TIRPC_CFLAGS = @TIRPC_CFLAGS@
+TIRPC_LIBS = @TIRPC_LIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
pdu.c \
socket.c
-libnfs_la_LDFLAGS = -version-info 0:0:0
+libnfs_la_LDFLAGS = -version-info 1:2:0
libnfs_la_LIBADD = \
../mount/libmount.la \
../nfs/libnfs.la \
/*
Copyright (C) 2010 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef WIN32
+#include "win32_compat.h"
+#else
+#include <unistd.h>
+#include <strings.h>
+#endif/*WIN32*/
#define _GNU_SOURCE
+
#include <stdio.h>
#include <stdarg.h>
-#include <unistd.h>
#include <string.h>
-#include <strings.h>
#include <stdlib.h>
#include <rpc/rpc.h>
#include <rpc/xdr.h>
if (rpc == NULL) {
return NULL;
}
- bzero(rpc, sizeof(struct rpc_context));
+ memset(rpc, 0, sizeof(struct rpc_context));
rpc->encodebuflen = 65536;
rpc->encodebuf = malloc(rpc->encodebuflen);
return NULL;
}
- rpc->auth = authunix_create_default();
+#if defined(WIN32)
+ rpc->auth = authunix_create("LibNFS", 65535, 65535, 0, NULL);
+#else
+ rpc->auth = authunix_create_default();
+#endif
if (rpc->auth == NULL) {
free(rpc->encodebuf);
free(rpc);
return rpc;
}
-void rpc_set_auth(struct rpc_context *rpc, struct AUTH *auth)
+void rpc_set_auth(struct rpc_context *rpc, AUTH *auth)
{
if (rpc->auth != NULL) {
auth_destroy(rpc->auth);
void rpc_set_error(struct rpc_context *rpc, char *error_string, ...)
{
va_list ap;
- char *str;
if (rpc->error_string != NULL) {
free(rpc->error_string);
}
va_start(ap, error_string);
- vasprintf(&str, error_string, ap);
- rpc->error_string = str;
+ rpc->error_string = malloc(1024);
+ vsnprintf(rpc->error_string, 1024, error_string, ap);
va_end(ap);
}
}
}
+static void rpc_free_fragment(struct rpc_fragment *fragment)
+{
+ if (fragment->data != NULL) {
+ free(fragment->data);
+ }
+ free(fragment);
+}
+
+void rpc_free_all_fragments(struct rpc_context *rpc)
+{
+ while (rpc->fragments != NULL) {
+ struct rpc_fragment *fragment = rpc->fragments;
+
+ SLIST_REMOVE(&rpc->fragments, fragment);
+ rpc_free_fragment(fragment);
+ }
+}
+
+int rpc_add_fragment(struct rpc_context *rpc, char *data, uint64_t size)
+{
+ struct rpc_fragment *fragment;
+
+ fragment = malloc(sizeof(struct rpc_fragment));
+ if (fragment == NULL) {
+ return -1;
+ }
+
+ fragment->size = size;
+ fragment->data = malloc(fragment->size);
+ if(fragment->data == NULL) {
+ free(fragment);
+ return -1;
+ }
+
+ memcpy(fragment->data, data, fragment->size);
+ SLIST_ADD_END(&rpc->fragments, fragment);
+ return 0;
+}
void rpc_destroy_context(struct rpc_context *rpc)
{
rpc_free_pdu(rpc, pdu);
}
+ rpc_free_all_fragments(rpc);
+
auth_destroy(rpc->auth);
rpc->auth =NULL;
if (rpc->fd != -1) {
- close(rpc->fd);
+#if defined(WIN32)
+ closesocket(rpc->fd);
+#else
+ close(rpc->fd);
+#endif
}
if (rpc->encodebuf != NULL) {
/*
* High level api to nfs filesystems
*/
+#ifdef WIN32
+#include "win32_compat.h"
+#define DllExport
+#else
+#include <strings.h>
+#include <unistd.h>
+#include <sys/statvfs.h>
+#include <poll.h>
+#include <sys/ioctl.h>
+#include <netdb.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#endif
+#ifdef HAVE_CONFIG_H
#include "config.h"
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <strings.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/statvfs.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
-#include <poll.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <netdb.h>
+
+#ifdef HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif
+
#include "libnfs.h"
#include "libnfs-raw.h"
#include "libnfs-raw-mount.h"
struct sync_cb_data {
int is_finished;
int status;
- off_t offset;
+ uint64_t offset;
void *return_data;
int return_int;
};
{
struct pollfd pfd;
- for (;;) {
- if (cb_data->is_finished) {
- break;
- }
+ while (!cb_data->is_finished) {
+
pfd.fd = rpc_get_fd(rpc);
pfd.events = rpc_which_events(rpc);
-
if (poll(&pfd, 1, -1) < 0) {
rpc_set_error(rpc, "Poll failed");
cb_data->status = -EIO;
cb_data->status = -EIO;
break;
}
+ if (rpc_get_fd(rpc) == -1) {
+ rpc_set_error(rpc, "Socket closed\n");
+ break;
+ }
+ }
+}
+
+static void wait_for_nfs_reply(struct nfs_context *nfs, struct sync_cb_data *cb_data)
+{
+ struct pollfd pfd;
+
+ while (!cb_data->is_finished) {
+
+ pfd.fd = nfs_get_fd(nfs);
+ pfd.events = nfs_which_events(nfs);
+ if (poll(&pfd, 1, -1) < 0) {
+ nfs_set_error(nfs, "Poll failed");
+ cb_data->status = -EIO;
+ break;
+ }
+ if (nfs_service(nfs, pfd.revents) < 0) {
+ nfs_set_error(nfs, "nfs_service failed");
+ cb_data->status = -EIO;
+ break;
+ }
}
}
int nfs_mount(struct nfs_context *nfs, const char *server, const char *export)
{
struct sync_cb_data cb_data;
+ struct rpc_context *rpc = nfs_get_rpc_context(nfs);
cb_data.is_finished = 0;
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
+
+ /* Dont want any more callbacks even if the socket is closed */
+ rpc->connect_cb = NULL;
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
memcpy(buffer, (char *)data, status);
}
-int nfs_pread(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buffer)
+int nfs_pread(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buffer)
{
struct sync_cb_data cb_data;
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
/*
* read()
*/
-int nfs_read(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buffer)
+int nfs_read(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, char *buffer)
{
return nfs_pread(nfs, nfsfh, nfs_get_current_offset(nfsfh), count, buffer);
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
}
}
-int nfs_pwrite(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buf)
+int nfs_pwrite(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buf)
{
struct sync_cb_data cb_data;
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
/*
* write()
*/
-int nfs_write(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf)
+int nfs_write(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, char *buf)
{
return nfs_pwrite(nfs, nfsfh, nfs_get_current_offset(nfsfh), count, buf);
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
}
}
-int nfs_ftruncate(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t length)
+int nfs_ftruncate(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t length)
{
struct sync_cb_data cb_data;
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
}
}
-int nfs_truncate(struct nfs_context *nfs, const char *path, off_t length)
+int nfs_truncate(struct nfs_context *nfs, const char *path, uint64_t length)
{
struct sync_cb_data cb_data;
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
+/*
+ * mknod()
+ */
+static void mknod_cb(int status, struct nfs_context *nfs, void *data, void *private_data)
+{
+ struct sync_cb_data *cb_data = private_data;
+
+ cb_data->is_finished = 1;
+ cb_data->status = status;
+
+ if (status < 0) {
+ nfs_set_error(nfs, "mknod call failed with \"%s\"", (char *)data);
+ return;
+ }
+}
+
+int nfs_mknod(struct nfs_context *nfs, const char *path, int mode, int dev)
+{
+ struct sync_cb_data cb_data;
+
+ cb_data.is_finished = 0;
+ if (nfs_mknod_async(nfs, path, mode, dev, mknod_cb, &cb_data) != 0) {
+ nfs_set_error(nfs, "nfs_creat_async failed");
+ return -1;
+ }
+
+ wait_for_nfs_reply(nfs, &cb_data);
+
+ return cb_data.status;
+}
/*
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
}
if (cb_data->return_data != NULL) {
- memcpy(cb_data->return_data, data, sizeof(off_t));
+ memcpy(cb_data->return_data, data, sizeof(uint64_t));
}
}
-int nfs_lseek(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, int whence, off_t *current_offset)
+int nfs_lseek(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, int whence, uint64_t *current_offset)
{
struct sync_cb_data cb_data;
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
+ wait_for_nfs_reply(nfs, &cb_data);
return cb_data.status;
}
-
void free_nfs_srvr_list(struct nfs_server_list *srv)
{
while (srv != NULL) {
/* check for dupes */
for (srvr = srv_data->srvrs; srvr; srvr = srvr->next) {
if (!strcmp(hostdd, srvr->addr)) {
- return 0;
+ return;
}
}
srv_data->srvrs = srvr;
}
+#ifdef WIN32
+
+static int send_nfsd_probes(struct rpc_context *rpc, INTERFACE_INFO *InterfaceList, int numIfs, struct nfs_list_data *data)
+{
+ int i=0;
+
+ for(i = 0; i < numIfs; i++)
+ {
+ SOCKADDR *pAddress;
+ char bcdd[16];
+ unsigned long nFlags = 0;
+
+ pAddress = (SOCKADDR *) & (InterfaceList[i].iiBroadcastAddress);
+
+ if(pAddress->sa_family != AF_INET)
+ continue;
+
+ nFlags = InterfaceList[i].iiFlags;
+
+ if (!(nFlags & IFF_UP))
+ {
+ continue;
+ }
+
+ if (nFlags & IFF_LOOPBACK)
+ {
+ continue;
+ }
+
+ if (!(nFlags & IFF_BROADCAST))
+ {
+ continue;
+ }
+
+ if (getnameinfo(pAddress, sizeof(struct sockaddr_in), &bcdd[0], sizeof(bcdd), NULL, 0, NI_NUMERICHOST) < 0)
+ {
+ continue;
+ }
+
+ if (rpc_set_udp_destination(rpc, bcdd, 111, 1) < 0)
+ {
+ return -1;
+ }
+
+ if (rpc_pmap_callit_async(rpc, MOUNT_PROGRAM, 2, 0, NULL, 0, callit_cb, data) < 0)
+ {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+struct nfs_server_list *nfs_find_local_servers(void)
+{
+ struct rpc_context *rpc;
+ struct nfs_list_data data = {0, NULL};
+ struct timeval tv_start, tv_current;
+ int loop;
+ struct pollfd pfd;
+ INTERFACE_INFO InterfaceList[20];
+ unsigned long nBytesReturned;
+ int nNumInterfaces = 0;
+
+ rpc = rpc_init_udp_context();
+ if (rpc == NULL)
+ {
+ return NULL;
+ }
+
+ if (rpc_bind_udp(rpc, "0.0.0.0", 0) < 0)
+ {
+ rpc_destroy_context(rpc);
+ return NULL;
+ }
+
+ if (WSAIoctl(rpc_get_fd(rpc), SIO_GET_INTERFACE_LIST, 0, 0, &InterfaceList, sizeof(InterfaceList), &nBytesReturned, 0, 0) == SOCKET_ERROR)
+ {
+ return NULL;
+ }
+
+ nNumInterfaces = nBytesReturned / sizeof(INTERFACE_INFO);
+
+ for (loop=0; loop<3; loop++)
+ {
+ if (send_nfsd_probes(rpc, InterfaceList, nNumInterfaces, &data) != 0)
+ {
+ rpc_destroy_context(rpc);
+ return NULL;
+ }
+
+ win32_gettimeofday(&tv_start, NULL);
+ for(;;)
+ {
+ int mpt;
+
+ pfd.fd = rpc_get_fd(rpc);
+ pfd.events = rpc_which_events(rpc);
+
+ win32_gettimeofday(&tv_current, NULL);
+ mpt = 1000
+ - (tv_current.tv_sec *1000 + tv_current.tv_usec / 1000)
+ + (tv_start.tv_sec *1000 + tv_start.tv_usec / 1000);
+
+ if (poll(&pfd, 1, mpt) < 0)
+ {
+ free_nfs_srvr_list(data.srvrs);
+ rpc_destroy_context(rpc);
+ return NULL;
+ }
+ if (pfd.revents == 0)
+ {
+ break;
+ }
+
+ if (rpc_service(rpc, pfd.revents) < 0)
+ {
+ break;
+ }
+ }
+ }
+
+ rpc_destroy_context(rpc);
+
+ if (data.status != 0)
+ {
+ free_nfs_srvr_list(data.srvrs);
+ return NULL;
+ }
+ return data.srvrs;
+}
+#else
+
static int send_nfsd_probes(struct rpc_context *rpc, struct ifconf *ifc, struct nfs_list_data *data)
{
char *ptr;
free_nfs_srvr_list(data.srvrs);
return NULL;
}
-
return data.srvrs;
}
+#endif//WIN32
--- /dev/null
+LIBRARY libnfs
+EXPORTS
+mount_free_export_list
+mount_getexports
+mount_getexports_async
+nfs_find_local_servers
+free_nfs_srvr_list
+nfs_access
+nfs_access_async
+nfs_chmod
+nfs_chmod_async
+nfs_chown
+nfs_chown_async
+nfs_close
+nfs_close_async
+nfs_closedir
+nfs_creat
+nfs_creat_async
+nfs_destroy_context
+nfs_fchmod
+nfs_fchmod_async
+nfs_fchown
+nfs_fchown_async
+nfs_fstat
+nfs_fstat_async
+nfs_fsync
+nfs_fsync_async
+nfs_ftruncate
+nfs_ftruncate_async
+nfs_get_error
+nfs_get_fd
+nfs_get_readmax
+nfs_get_writemax
+nfs_init_context
+nfs_link
+nfs_link_async
+nfs_lseek
+nfs_lseek_async
+nfs_mkdir
+nfs_mkdir_async
+nfs_mknod
+nfs_mknod_async
+nfs_mount
+nfs_mount_async
+nfs_open
+nfs_open_async
+nfs_opendir
+nfs_opendir_async
+nfs_pread
+nfs_pread_async
+nfs_pwrite
+nfs_pwrite_async
+nfs_read
+nfs_read_async
+nfs_readdir
+nfs_readlink
+nfs_readlink_async
+nfs_rename
+nfs_rename_async
+nfs_rmdir
+nfs_rmdir_async
+nfs_service
+nfs_set_auth
+nfs_stat
+nfs_stat_async
+nfs_statvfs
+nfs_statvfs_async
+nfs_symlink
+nfs_symlink_async
+nfs_truncate
+nfs_truncate_async
+nfs_unlink
+nfs_unlink_async
+nfs_utime
+nfs_utime_async
+nfs_utimes
+nfs_utimes_async
+nfs_which_events
+nfs_write
+nfs_write_async
/*
* High level api to nfs filesystems
*/
+#ifdef WIN32
+#include "win32_compat.h"
+#define DllExport
+#else
+#include <strings.h>
+#include <sys/statvfs.h>
+#include <utime.h>
+#include <unistd.h>
+#endif/*WIN32*/
#define _GNU_SOURCE
+
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
-#include <strings.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/statvfs.h>
-#include <utime.h>
-#include <unistd.h>
#include <fcntl.h>
#include "libnfs.h"
#include "libnfs-raw.h"
struct nfsfh {
struct nfs_fh3 fh;
int is_sync;
- off_t offset;
+ uint64_t offset;
};
struct nfs_context {
char *server;
char *export;
struct nfs_fh3 rootfh;
- size_t readmax;
- size_t writemax;
+ uint64_t readmax;
+ uint64_t writemax;
};
void nfs_free_nfsdir(struct nfsdir *nfsdir)
int error;
int cancel;
int num_calls;
- off_t start_offset, max_offset;
+ uint64_t start_offset, max_offset;
char *buffer;
};
struct nfs_mcb_data {
struct nfs_cb_data *data;
- off_t offset;
- size_t count;
+ uint64_t offset;
+ uint64_t count;
};
static int nfs_lookup_path_async_internal(struct nfs_context *nfs, struct nfs_cb_data *data, struct nfs_fh3 *fh);
-void nfs_set_auth(struct nfs_context *nfs, struct AUTH *auth)
+void nfs_set_auth(struct nfs_context *nfs, AUTH *auth)
{
- return rpc_set_auth(nfs->rpc, auth);
+ rpc_set_auth(nfs->rpc, auth);
}
int nfs_get_fd(struct nfs_context *nfs)
return rpc_get_fd(nfs->rpc);
}
+int nfs_queue_length(struct nfs_context *nfs)
+{
+ return rpc_queue_length(nfs->rpc);
+}
+
int nfs_which_events(struct nfs_context *nfs)
{
return rpc_which_events(nfs->rpc);
return NULL;
}
+ nfs->server = NULL;
+ nfs->export = NULL;
+
+ nfs->rootfh.data.data_len = 0;
+ nfs->rootfh.data.data_val = NULL;
+
return nfs;
}
struct nfs_cb_data *data = private_data;
struct nfs_context *nfs = data->nfs;
+ /* Dont want any more callbacks even if the socket is closed */
+ rpc->connect_cb = NULL;
+
if (status == RPC_STATUS_ERROR) {
data->cb(-EFAULT, nfs, command_data, data->private_data);
free_nfs_cb_data(data);
free_nfs_cb_data(data);
return;
}
+ /* NFS TCP connections we want to autoreconnect after sessions are torn down (due to inactivity or error) */
+ rpc_set_autoreconnect(rpc);
}
struct nfs_cb_data *data = private_data;
struct nfs_context *nfs = data->nfs;
+ /* Dont want any more callbacks even if the socket is closed */
+ rpc->connect_cb = NULL;
+
if (status == RPC_STATUS_ERROR) {
data->cb(-EFAULT, nfs, command_data, data->private_data);
free_nfs_cb_data(data);
struct nfs_cb_data *data = private_data;
struct nfs_context *nfs = data->nfs;
+ /* Dont want any more callbacks even if the socket is closed */
+ rpc->connect_cb = NULL;
+
if (status == RPC_STATUS_ERROR) {
data->cb(-EFAULT, nfs, command_data, data->private_data);
free_nfs_cb_data(data);
int nfs_mount_async(struct nfs_context *nfs, const char *server, const char *export, nfs_cb cb, void *private_data)
{
struct nfs_cb_data *data;
+ char *new_server, *new_export;
data = malloc(sizeof(struct nfs_cb_data));
if (data == NULL) {
rpc_set_error(nfs->rpc, "out of memory. failed to allocate memory for nfs mount data");
return -1;
}
- bzero(data, sizeof(struct nfs_cb_data));
- nfs->server = strdup(server);
- nfs->export = strdup(export);
+ memset(data, 0, sizeof(struct nfs_cb_data));
+ new_server = strdup(server);
+ new_export = strdup(export);
+ if (nfs->server != NULL) {
+ free(nfs->server);
+ }
+ nfs->server = new_server;
+ if (nfs->export != NULL) {
+ free(nfs->export);
+ }
+ nfs->export = new_export;
data->nfs = nfs;
data->cb = cb;
data->private_data = private_data;
}
path = data->path;
- str = index(path, '/');
+ str = strchr(path, '/');
if (str != NULL) {
*str = 0;
data->path = str+1;
rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_cb_data structure");
return -1;
}
- bzero(data, sizeof(struct nfs_cb_data));
+ memset(data, 0, sizeof(struct nfs_cb_data));
data->nfs = nfs;
data->cb = cb;
data->continue_cb = continue_cb;
if (res->GETATTR3res_u.resok.obj_attributes.type == NF3DIR) {
st.st_mode |= S_IFDIR ;
}
+ if (res->GETATTR3res_u.resok.obj_attributes.type == NF3REG) {
+ st.st_mode |= S_IFREG ;
+ }
st.st_nlink = res->GETATTR3res_u.resok.obj_attributes.nlink;
st.st_uid = res->GETATTR3res_u.resok.obj_attributes.uid;
st.st_gid = res->GETATTR3res_u.resok.obj_attributes.gid;
st.st_rdev = 0;
st.st_size = res->GETATTR3res_u.resok.obj_attributes.size;
+#ifndef WIN32
st.st_blksize = 4096;
st.st_blocks = res->GETATTR3res_u.resok.obj_attributes.size / 4096;
+#endif//WIN32
st.st_atime = res->GETATTR3res_u.resok.obj_attributes.atime.seconds;
st.st_mtime = res->GETATTR3res_u.resok.obj_attributes.mtime.seconds;
st.st_ctime = res->GETATTR3res_u.resok.obj_attributes.ctime.seconds;
free_nfs_cb_data(data);
return;
}
- bzero(nfsfh, sizeof(struct nfsfh));
+ memset(nfsfh, 0, sizeof(struct nfsfh));
if (data->continue_int & O_SYNC) {
nfsfh->is_sync = 1;
free(mdata);
}
-int nfs_pread_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, nfs_cb cb, void *private_data)
+int nfs_pread_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, nfs_cb cb, void *private_data)
{
struct nfs_cb_data *data;
rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_cb_data structure");
return -1;
}
- bzero(data, sizeof(struct nfs_cb_data));
+ memset(data, 0, sizeof(struct nfs_cb_data));
data->nfs = nfs;
data->cb = cb;
data->private_data = private_data;
}
while (count > 0) {
- size_t readcount = count;
+ uint64_t readcount = count;
struct nfs_mcb_data *mdata;
if (readcount > nfs_get_readmax(nfs)) {
rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_mcb_data structure");
return -1;
}
- bzero(mdata, sizeof(struct nfs_mcb_data));
+ memset(mdata, 0, sizeof(struct nfs_mcb_data));
mdata->data = data;
mdata->offset = offset;
mdata->count = readcount;
/*
* Async read()
*/
-int nfs_read_async(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, nfs_cb cb, void *private_data)
+int nfs_read_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, nfs_cb cb, void *private_data)
{
return nfs_pread_async(nfs, nfsfh, nfsfh->offset, count, cb, private_data);
}
free_nfs_cb_data(data);
}
-int nfs_pwrite_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buf, nfs_cb cb, void *private_data)
+static void nfs_pwrite_mcb(struct rpc_context *rpc _U_, int status, void *command_data, void *private_data)
+{
+ struct nfs_mcb_data *mdata = private_data;
+ struct nfs_cb_data *data = mdata->data;
+ struct nfs_context *nfs = data->nfs;
+ WRITE3res *res;
+
+ data->num_calls--;
+
+ if (status == RPC_STATUS_ERROR) {
+ /* flag the failure but do not invoke callback until we have received all responses */
+ data->error = 1;
+ }
+ if (status == RPC_STATUS_CANCEL) {
+ /* flag the cancellation but do not invoke callback until we have received all responses */
+ data->cancel = 1;
+ }
+
+ if (status == RPC_STATUS_SUCCESS) {
+ res = command_data;
+ if (res->status != NFS3_OK) {
+ rpc_set_error(nfs->rpc, "NFS: Write failed with %s(%d)", nfsstat3_to_str(res->status), nfsstat3_to_errno(res->status));
+ data->error = 1;
+ } else {
+ if (res->WRITE3res_u.resok.count > 0) {
+ if ((unsigned)data->max_offset < mdata->offset + res->WRITE3res_u.resok.count) {
+ data->max_offset = mdata->offset + res->WRITE3res_u.resok.count;
+ }
+ }
+ }
+ }
+
+ if (data->num_calls > 0) {
+ /* still waiting for more replies */
+ free(mdata);
+ return;
+ }
+
+ if (data->error != 0) {
+ data->cb(-EFAULT, nfs, command_data, data->private_data);
+ free_nfs_cb_data(data);
+ free(mdata);
+ return;
+ }
+ if (data->cancel != 0) {
+ data->cb(-EINTR, nfs, "Command was cancelled", data->private_data);
+ free_nfs_cb_data(data);
+ free(mdata);
+ return;
+ }
+
+ data->nfsfh->offset = data->max_offset;
+ data->cb(data->max_offset - data->start_offset, nfs, NULL, data->private_data);
+
+ free_nfs_cb_data(data);
+ free(mdata);
+}
+
+
+int nfs_pwrite_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buf, nfs_cb cb, void *private_data)
{
struct nfs_cb_data *data;
rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_cb_data structure");
return -1;
}
- bzero(data, sizeof(struct nfs_cb_data));
+ memset(data, 0, sizeof(struct nfs_cb_data));
data->nfs = nfs;
data->cb = cb;
data->private_data = private_data;
data->nfsfh = nfsfh;
nfsfh->offset = offset;
- if (rpc_nfs_write_async(nfs->rpc, nfs_pwrite_cb, &nfsfh->fh, buf, offset, count, nfsfh->is_sync?FILE_SYNC:UNSTABLE, data) != 0) {
- rpc_set_error(nfs->rpc, "RPC error: Failed to send WRITE call for %s", data->path);
- data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
- free_nfs_cb_data(data);
- return -1;
+
+ if (count <= nfs_get_writemax(nfs)) {
+ if (rpc_nfs_write_async(nfs->rpc, nfs_pwrite_cb, &nfsfh->fh, buf, offset, count, nfsfh->is_sync?FILE_SYNC:UNSTABLE, data) != 0) {
+ rpc_set_error(nfs->rpc, "RPC error: Failed to send WRITE call for %s", data->path);
+ data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
+ free_nfs_cb_data(data);
+ return -1;
+ }
+ return 0;
}
+
+ /* trying to write more than maximum server write size, we has to chop it up into smaller
+ * chunks.
+ * we send all writes in parallell so that performance is still good.
+ */
+ data->max_offset = offset;
+ data->start_offset = offset;
+
+ while (count > 0) {
+ uint64_t writecount = count;
+ struct nfs_mcb_data *mdata;
+
+ if (writecount > nfs_get_writemax(nfs)) {
+ writecount = nfs_get_writemax(nfs);
+ }
+
+ mdata = malloc(sizeof(struct nfs_mcb_data));
+ if (mdata == NULL) {
+ rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_mcb_data structure");
+ return -1;
+ }
+ memset(mdata, 0, sizeof(struct nfs_mcb_data));
+ mdata->data = data;
+ mdata->offset = offset;
+ mdata->count = writecount;
+
+ if (rpc_nfs_write_async(nfs->rpc, nfs_pwrite_mcb, &nfsfh->fh, &buf[offset - data->start_offset], offset, writecount, nfsfh->is_sync?FILE_SYNC:UNSTABLE, mdata) != 0) {
+ rpc_set_error(nfs->rpc, "RPC error: Failed to send WRITE call for %s", data->path);
+ data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
+ free(mdata);
+ return -1;
+ }
+
+ count -= writecount;
+ offset += writecount;
+ data->num_calls++;
+ }
+
return 0;
}
/*
* Async write()
*/
-int nfs_write_async(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf, nfs_cb cb, void *private_data)
+int nfs_write_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, char *buf, nfs_cb cb, void *private_data)
{
return nfs_pwrite_async(nfs, nfsfh, nfsfh->offset, count, buf, cb, private_data);
}
rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_cb_data structure");
return -1;
}
- bzero(data, sizeof(struct nfs_cb_data));
+ memset(data, 0, sizeof(struct nfs_cb_data));
data->nfs = nfs;
data->cb = cb;
data->private_data = private_data;
rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_cb_data structure");
return -1;
}
- bzero(data, sizeof(struct nfs_cb_data));
+ memset(data, 0, sizeof(struct nfs_cb_data));
data->nfs = nfs;
data->cb = cb;
data->private_data = private_data;
free_nfs_cb_data(data);
}
-int nfs_ftruncate_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t length, nfs_cb cb, void *private_data)
+int nfs_ftruncate_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t length, nfs_cb cb, void *private_data)
{
struct nfs_cb_data *data;
SETATTR3args args;
rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_cb_data structure");
return -1;
}
- bzero(data, sizeof(struct nfs_cb_data));
+ memset(data, 0, sizeof(struct nfs_cb_data));
data->nfs = nfs;
data->cb = cb;
data->private_data = private_data;
- bzero(&args, sizeof(SETATTR3args));
+ memset(&args, 0, sizeof(SETATTR3args));
args.object.data.data_len = nfsfh->fh.data.data_len;
args.object.data.data_val = nfsfh->fh.data.data_val;
args.new_attributes.size.set_it = 1;
*/
static int nfs_truncate_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data)
{
- off_t offset = data->continue_int;
+ uint64_t offset = data->continue_int;
struct nfsfh nfsfh;
nfsfh.fh.data.data_val = data->fh.data.data_val;
return 0;
}
-int nfs_truncate_async(struct nfs_context *nfs, const char *path, off_t length, nfs_cb cb, void *private_data)
+int nfs_truncate_async(struct nfs_context *nfs, const char *path, uint64_t length, nfs_cb cb, void *private_data)
{
- off_t offset;
+ uint64_t offset;
offset = length;
return -1;
}
- ptr = rindex(new_path, '/');
+ ptr = strrchr(new_path, '/');
if (ptr == NULL) {
rpc_set_error(nfs->rpc, "Invalid path %s", path);
return -1;
return -1;
}
- ptr = rindex(new_path, '/');
+ ptr = strrchr(new_path, '/');
if (ptr == NULL) {
rpc_set_error(nfs->rpc, "Invalid path %s", path);
return -1;
free_nfs_cb_data(data);
return;
}
- bzero(nfsfh, sizeof(struct nfsfh));
+ memset(nfsfh, 0, sizeof(struct nfsfh));
/* steal the filehandle */
nfsfh->fh.data.data_len = data->fh.data.data_len;
return -1;
}
- ptr = rindex(new_path, '/');
+ ptr = strrchr(new_path, '/');
if (ptr == NULL) {
rpc_set_error(nfs->rpc, "Invalid path %s", path);
return -1;
return -1;
}
- ptr = rindex(new_path, '/');
+ ptr = strrchr(new_path, '/');
if (ptr == NULL) {
rpc_set_error(nfs->rpc, "Invalid path %s", path);
return -1;
}
+/*
+ * Async mknod()
+ */
+struct mknod_cb_data {
+ char *path;
+ int mode;
+ int major;
+ int minor;
+};
+
+static void free_mknod_cb_data(void *ptr)
+{
+ struct mknod_cb_data *data = ptr;
+
+ free(data->path);
+ free(data);
+}
+
+static void nfs_mknod_cb(struct rpc_context *rpc _U_, int status, void *command_data, void *private_data)
+{
+ MKNOD3res *res;
+ struct nfs_cb_data *data = private_data;
+ struct nfs_context *nfs = data->nfs;
+ char *str = data->continue_data;
+
+ str = &str[strlen(str) + 1];
+
+ if (status == RPC_STATUS_ERROR) {
+ data->cb(-EFAULT, nfs, command_data, data->private_data);
+ free_nfs_cb_data(data);
+ return;
+ }
+ if (status == RPC_STATUS_CANCEL) {
+ data->cb(-EINTR, nfs, "Command was cancelled", data->private_data);
+ free_nfs_cb_data(data);
+ return;
+ }
+
+ res = command_data;
+ if (res->status != NFS3_OK) {
+ rpc_set_error(nfs->rpc, "NFS: MKNOD of %s/%s failed with %s(%d)", data->saved_path, str, nfsstat3_to_str(res->status), nfsstat3_to_errno(res->status));
+ data->cb(nfsstat3_to_errno(res->status), nfs, rpc_get_error(nfs->rpc), data->private_data);
+ free_nfs_cb_data(data);
+ return;
+ }
+
+ data->cb(0, nfs, NULL, data->private_data);
+ free_nfs_cb_data(data);
+}
+
+static int nfs_mknod_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data)
+{
+ struct mknod_cb_data *cb_data = data->continue_data;
+ char *str = cb_data->path;
+
+ str = &str[strlen(str) + 1];
+
+ if (rpc_nfs_mknod_async(nfs->rpc, nfs_mknod_cb, &data->fh, str, cb_data->mode, cb_data->major, cb_data->minor, data) != 0) {
+ data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
+ free_nfs_cb_data(data);
+ return -1;
+ }
+ return 0;
+}
+
+int nfs_mknod_async(struct nfs_context *nfs, const char *path, int mode, int dev, nfs_cb cb, void *private_data)
+{
+ char *ptr;
+ struct mknod_cb_data *cb_data;
+
+ cb_data = malloc(sizeof(struct mknod_cb_data));
+ if (cb_data == NULL) {
+ rpc_set_error(nfs->rpc, "Out of memory, failed to allocate mode buffer for cb data");
+ return -1;
+ }
+
+ cb_data->path = strdup(path);
+ if (cb_data->path == NULL) {
+ rpc_set_error(nfs->rpc, "Out of memory, failed to allocate mode buffer for path");
+ free(cb_data);
+ return -1;
+ }
+ ptr = strrchr(cb_data->path, '/');
+ if (ptr == NULL) {
+ rpc_set_error(nfs->rpc, "Invalid path %s", path);
+ return -1;
+ }
+ *ptr = 0;
+ cb_data->mode = mode;
+ cb_data->major = major(dev);
+ cb_data->minor = minor(dev);
+
+ /* data->path now points to the parent directory, and beyond the nul terminateor is the new directory to create */
+ if (nfs_lookuppath_async(nfs, cb_data->path, cb, private_data, nfs_mknod_continue_internal, cb_data, free_mknod_cb_data, 0) != 0) {
+ rpc_set_error(nfs->rpc, "Out of memory: failed to start parsing the path components");
+ free_mknod_cb_data(cb_data);
+ return -1;
+ }
+
+ return 0;
+}
/*
* Async opendir()
*/
-static void nfs_opendir_cb(struct rpc_context *rpc _U_, int status, void *command_data, void *private_data)
+
+/* ReadDirPlus Emulation Callback data */
+struct rdpe_cb_data {
+ int getattrcount;
+ int status;
+ struct nfs_cb_data *data;
+};
+
+/* ReadDirPlus Emulation LOOKUP Callback data */
+struct rdpe_lookup_cb_data {
+ struct rdpe_cb_data *rdpe_cb_data;
+ struct nfsdirent *nfsdirent;
+};
+
+/* Workaround for servers lacking READDIRPLUS, use READDIR instead and a GETATTR-loop */
+static void nfs_opendir3_cb(struct rpc_context *rpc _U_, int status, void *command_data, void *private_data)
+{
+ LOOKUP3res *res = command_data;
+ struct rdpe_lookup_cb_data *rdpe_lookup_cb_data = private_data;
+ struct rdpe_cb_data *rdpe_cb_data = rdpe_lookup_cb_data->rdpe_cb_data;
+ struct nfs_cb_data *data = rdpe_cb_data->data;
+ struct nfsdir *nfsdir = data->continue_data;
+ struct nfs_context *nfs = data->nfs;
+ struct nfsdirent *nfsdirent = rdpe_lookup_cb_data->nfsdirent;
+
+ free(rdpe_lookup_cb_data);
+
+ rdpe_cb_data->getattrcount--;
+
+ if (status == RPC_STATUS_ERROR) {
+ rdpe_cb_data->status = RPC_STATUS_ERROR;
+ }
+ if (status == RPC_STATUS_CANCEL) {
+ rdpe_cb_data->status = RPC_STATUS_CANCEL;
+ }
+ if (status == RPC_STATUS_SUCCESS && res->status != NFS3_OK) {
+ rdpe_cb_data->status = RPC_STATUS_ERROR;
+ }
+ if (status == RPC_STATUS_SUCCESS && res->status == NFS3_OK) {
+ if (res->LOOKUP3res_u.resok.obj_attributes.attributes_follow) {
+ fattr3 *attributes = &res->LOOKUP3res_u.resok.obj_attributes.post_op_attr_u.attributes;
+
+ nfsdirent->type = attributes->type;
+ nfsdirent->mode = attributes->mode;
+ nfsdirent->size = attributes->size;
+
+ nfsdirent->atime.tv_sec = attributes->atime.seconds;
+ nfsdirent->atime.tv_usec = attributes->atime.nseconds/1000;
+ nfsdirent->mtime.tv_sec = attributes->mtime.seconds;
+ nfsdirent->mtime.tv_usec = attributes->mtime.nseconds/1000;
+ nfsdirent->ctime.tv_sec = attributes->ctime.seconds;
+ nfsdirent->ctime.tv_usec = attributes->ctime.nseconds/1000;
+ }
+ }
+
+ if (rdpe_cb_data->getattrcount == 0) {
+ if (rdpe_cb_data->status != RPC_STATUS_SUCCESS) {
+ data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
+ nfs_free_nfsdir(nfsdir);
+ } else {
+ data->cb(0, nfs, nfsdir, data->private_data);
+ }
+ free(rdpe_cb_data);
+
+ data->continue_data = NULL;
+ free_nfs_cb_data(data);
+ }
+}
+
+static void nfs_opendir2_cb(struct rpc_context *rpc _U_, int status, void *command_data, void *private_data)
{
- READDIR3res *res;
+ READDIR3res *res = command_data;
struct nfs_cb_data *data = private_data;
struct nfs_context *nfs = data->nfs;
- struct nfsdir *nfsdir = data->continue_data;;
+ struct nfsdir *nfsdir = data->continue_data;
+ struct nfsdirent *nfsdirent;
struct entry3 *entry;
uint64_t cookie;
+ struct rdpe_cb_data *rdpe_cb_data;
if (status == RPC_STATUS_ERROR) {
data->cb(-EFAULT, nfs, command_data, data->private_data);
free_nfs_cb_data(data);
return;
}
+
if (status == RPC_STATUS_CANCEL) {
data->cb(-EINTR, nfs, "Command was cancelled", data->private_data);
nfs_free_nfsdir(nfsdir);
return;
}
- res = command_data;
if (res->status != NFS3_OK) {
rpc_set_error(nfs->rpc, "NFS: READDIR of %s failed with %s(%d)", data->saved_path, nfsstat3_to_str(res->status), nfsstat3_to_errno(res->status));
data->cb(nfsstat3_to_errno(res->status), nfs, rpc_get_error(nfs->rpc), data->private_data);
entry =res->READDIR3res_u.resok.reply.entries;
while (entry != NULL) {
- struct nfsdirent *nfsdirent;
-
nfsdirent = malloc(sizeof(struct nfsdirent));
if (nfsdirent == NULL) {
data->cb(-ENOMEM, nfs, "Failed to allocate dirent", data->private_data);
free_nfs_cb_data(data);
return;
}
- bzero(nfsdirent, sizeof(struct nfsdirent));
+ memset(nfsdirent, 0, sizeof(struct nfsdirent));
nfsdirent->name = strdup(entry->name);
if (nfsdirent->name == NULL) {
data->cb(-ENOMEM, nfs, "Failed to allocate dirent->name", data->private_data);
return;
}
nfsdirent->inode = entry->fileid;
+
nfsdirent->next = nfsdir->entries;
nfsdir->entries = nfsdirent;
}
if (res->READDIR3res_u.resok.reply.eof == 0) {
- if (rpc_nfs_readdir_async(nfs->rpc, nfs_opendir_cb, &data->fh, cookie, res->READDIR3res_u.resok.cookieverf, 20000, data) != 0) {
+ if (rpc_nfs_readdir_async(nfs->rpc, nfs_opendir2_cb, &data->fh, cookie, res->READDIR3res_u.resok.cookieverf, 8192, data) != 0) {
rpc_set_error(nfs->rpc, "RPC error: Failed to send READDIR call for %s", data->path);
data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
nfs_free_nfsdir(nfsdir);
return;
}
+ /* steal the dirhandle */
+ nfsdir->current = nfsdir->entries;
+
+ rdpe_cb_data = malloc(sizeof(struct rdpe_cb_data));
+ rdpe_cb_data->getattrcount = 0;
+ rdpe_cb_data->status = RPC_STATUS_SUCCESS;
+ rdpe_cb_data->data = data;
+ for (nfsdirent = nfsdir->entries; nfsdirent; nfsdirent = nfsdirent->next) {
+ struct rdpe_lookup_cb_data *rdpe_lookup_cb_data;
+
+ rdpe_lookup_cb_data = malloc(sizeof(struct rdpe_lookup_cb_data));
+ rdpe_lookup_cb_data->rdpe_cb_data = rdpe_cb_data;
+ rdpe_lookup_cb_data->nfsdirent = nfsdirent;
+
+ if (rpc_nfs_lookup_async(nfs->rpc, nfs_opendir3_cb, &data->fh, nfsdirent->name, rdpe_lookup_cb_data) != 0) {
+ rpc_set_error(nfs->rpc, "RPC error: Failed to send READDIR LOOKUP call");
+
+ /* if we have already commands in flight, we cant just stop, we have to wait for the
+ * commands in flight to complete
+ */
+ if (rdpe_cb_data->getattrcount > 0) {
+ rdpe_cb_data->status = RPC_STATUS_ERROR;
+ free(rdpe_lookup_cb_data);
+ return;
+ }
+
+ data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
+ nfs_free_nfsdir(nfsdir);
+ data->continue_data = NULL;
+ free_nfs_cb_data(data);
+ free(rdpe_lookup_cb_data);
+ free(rdpe_cb_data);
+ return;
+ }
+ rdpe_cb_data->getattrcount++;
+ }
+}
+
+
+static void nfs_opendir_cb(struct rpc_context *rpc _U_, int status, void *command_data, void *private_data)
+{
+ READDIRPLUS3res *res = command_data;
+ struct nfs_cb_data *data = private_data;
+ struct nfs_context *nfs = data->nfs;
+ struct nfsdir *nfsdir = data->continue_data;
+ struct entryplus3 *entry;
+ uint64_t cookie;
+
+
+ if (status == RPC_STATUS_ERROR || (status == RPC_STATUS_SUCCESS && res->status == NFS3ERR_NOTSUPP) ){
+ cookieverf3 cv;
+
+ if (rpc_nfs_readdir_async(nfs->rpc, nfs_opendir2_cb, &data->fh, 0, (char *)&cv, 8192, data) != 0) {
+ rpc_set_error(nfs->rpc, "RPC error: Failed to send READDIR call for %s", data->path);
+ data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
+ nfs_free_nfsdir(nfsdir);
+ data->continue_data = NULL;
+ free_nfs_cb_data(data);
+ return;
+ }
+ return;
+ }
+
+ if (status == RPC_STATUS_CANCEL) {
+ data->cb(-EINTR, nfs, "Command was cancelled", data->private_data);
+ nfs_free_nfsdir(nfsdir);
+ data->continue_data = NULL;
+ free_nfs_cb_data(data);
+ return;
+ }
+
+ if (res->status != NFS3_OK) {
+ rpc_set_error(nfs->rpc, "NFS: READDIRPLUS of %s failed with %s(%d)", data->saved_path, nfsstat3_to_str(res->status), nfsstat3_to_errno(res->status));
+ data->cb(nfsstat3_to_errno(res->status), nfs, rpc_get_error(nfs->rpc), data->private_data);
+ nfs_free_nfsdir(nfsdir);
+ data->continue_data = NULL;
+ free_nfs_cb_data(data);
+ return;
+ }
+
+ entry =res->READDIRPLUS3res_u.resok.reply.entries;
+ while (entry != NULL) {
+ struct nfsdirent *nfsdirent;
+
+ nfsdirent = malloc(sizeof(struct nfsdirent));
+ if (nfsdirent == NULL) {
+ data->cb(-ENOMEM, nfs, "Failed to allocate dirent", data->private_data);
+ nfs_free_nfsdir(nfsdir);
+ data->continue_data = NULL;
+ free_nfs_cb_data(data);
+ return;
+ }
+ memset(nfsdirent, 0, sizeof(struct nfsdirent));
+ nfsdirent->name = strdup(entry->name);
+ if (nfsdirent->name == NULL) {
+ data->cb(-ENOMEM, nfs, "Failed to allocate dirent->name", data->private_data);
+ nfs_free_nfsdir(nfsdir);
+ data->continue_data = NULL;
+ free_nfs_cb_data(data);
+ return;
+ }
+ nfsdirent->inode = entry->fileid;
+ if (entry->name_attributes.attributes_follow) {
+ nfsdirent->type = entry->name_attributes.post_op_attr_u.attributes.type;
+ nfsdirent->mode = entry->name_attributes.post_op_attr_u.attributes.mode;
+ nfsdirent->size = entry->name_attributes.post_op_attr_u.attributes.size;
+
+ nfsdirent->atime.tv_sec = entry->name_attributes.post_op_attr_u.attributes.atime.seconds;
+ nfsdirent->atime.tv_usec = entry->name_attributes.post_op_attr_u.attributes.atime.nseconds/1000;
+ nfsdirent->mtime.tv_sec = entry->name_attributes.post_op_attr_u.attributes.mtime.seconds;
+ nfsdirent->mtime.tv_usec = entry->name_attributes.post_op_attr_u.attributes.mtime.nseconds/1000;
+ nfsdirent->ctime.tv_sec = entry->name_attributes.post_op_attr_u.attributes.ctime.seconds;
+ nfsdirent->ctime.tv_usec = entry->name_attributes.post_op_attr_u.attributes.ctime.nseconds/1000;
+ }
+
+ nfsdirent->next = nfsdir->entries;
+ nfsdir->entries = nfsdirent;
+
+ cookie = entry->cookie;
+ entry = entry->nextentry;
+ }
+
+ if (res->READDIRPLUS3res_u.resok.reply.eof == 0) {
+ if (rpc_nfs_readdirplus_async(nfs->rpc, nfs_opendir_cb, &data->fh, cookie, res->READDIRPLUS3res_u.resok.cookieverf, 8192, data) != 0) {
+ rpc_set_error(nfs->rpc, "RPC error: Failed to send READDIRPLUS call for %s", data->path);
+ data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
+ nfs_free_nfsdir(nfsdir);
+ data->continue_data = NULL;
+ free_nfs_cb_data(data);
+ return;
+ }
+ return;
+ }
+
/* steal the dirhandle */
data->continue_data = NULL;
nfsdir->current = nfsdir->entries;
{
cookieverf3 cv;
- bzero(cv, sizeof(cookieverf3));
- if (rpc_nfs_readdir_async(nfs->rpc, nfs_opendir_cb, &data->fh, 0, (char *)&cv, 20000, data) != 0) {
- rpc_set_error(nfs->rpc, "RPC error: Failed to send READDIR call for %s", data->path);
+ memset(cv, 0, sizeof(cookieverf3));
+ if (rpc_nfs_readdirplus_async(nfs->rpc, nfs_opendir_cb, &data->fh, 0, (char *)&cv, 8192, data) != 0) {
+ rpc_set_error(nfs->rpc, "RPC error: Failed to send READDIRPLUS call for %s", data->path);
data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
free_nfs_cb_data(data);
return -1;
rpc_set_error(nfs->rpc, "failed to allocate buffer for nfsdir");
return -1;
}
- bzero(nfsdir, sizeof(struct nfsdir));
+ memset(nfsdir, 0, sizeof(struct nfsdir));
if (nfs_lookuppath_async(nfs, path, cb, private_data, nfs_opendir_continue_internal, nfsdir, free, 0) != 0) {
rpc_set_error(nfs->rpc, "Out of memory: failed to start parsing the path components");
struct lseek_cb_data {
struct nfs_context *nfs;
struct nfsfh *nfsfh;
- off_t offset;
+ uint64_t offset;
nfs_cb cb;
void *private_data;
};
free(data);
}
-int nfs_lseek_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, int whence, nfs_cb cb, void *private_data)
+int nfs_lseek_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, int whence, nfs_cb cb, void *private_data)
{
struct lseek_cb_data *data;
{
SETATTR3args args;
- bzero(&args, sizeof(SETATTR3args));
+ memset(&args, 0, sizeof(SETATTR3args));
args.object.data.data_len = data->fh.data.data_len;
args.object.data.data_val = data->fh.data.data_val;
args.new_attributes.mode.set_it = 1;
rpc_set_error(nfs->rpc, "out of memory. failed to allocate memory for nfs mount data");
return -1;
}
- bzero(data, sizeof(struct nfs_cb_data));
+ memset(data, 0, sizeof(struct nfs_cb_data));
data->nfs = nfs;
data->cb = cb;
data->private_data = private_data;
SETATTR3args args;
struct nfs_chown_data *chown_data = data->continue_data;
- bzero(&args, sizeof(SETATTR3args));
+ memset(&args, 0, sizeof(SETATTR3args));
args.object.data.data_len = data->fh.data.data_len;
args.object.data.data_val = data->fh.data.data_val;
if (chown_data->uid != (uid_t)-1) {
rpc_set_error(nfs->rpc, "out of memory. failed to allocate memory for fchown data");
return -1;
}
- bzero(data, sizeof(struct nfs_cb_data));
+ memset(data, 0, sizeof(struct nfs_cb_data));
data->nfs = nfs;
data->cb = cb;
data->private_data = private_data;
SETATTR3args args;
struct timeval *utimes_data = data->continue_data;
- bzero(&args, sizeof(SETATTR3args));
+ memset(&args, 0, sizeof(SETATTR3args));
args.object.data.data_len = data->fh.data.data_len;
args.object.data.data_val = data->fh.data.data_val;
if (utimes_data != NULL) {
rpc_set_error(nfs->rpc, "Out of memory, failed to allocate buffer for symlink data");
return -1;
}
- bzero(symlink_data, sizeof(struct nfs_symlink_data));
+ memset(symlink_data, 0, sizeof(struct nfs_symlink_data));
symlink_data->oldpath = strdup(oldpath);
if (symlink_data->oldpath == NULL) {
return -1;
}
- ptr = rindex(symlink_data->newpathparent, '/');
+ ptr = strrchr(symlink_data->newpathparent, '/');
if (ptr == NULL) {
rpc_set_error(nfs->rpc, "Invalid path %s", oldpath);
free_nfs_symlink_data(symlink_data);
rpc_set_error(nfs->rpc, "Out of memory, failed to allocate buffer for rename data");
return -1;
}
- bzero(rename_data, sizeof(struct nfs_rename_data));
+ memset(rename_data, 0, sizeof(struct nfs_rename_data));
rename_data->oldpath = strdup(oldpath);
if (rename_data->oldpath == NULL) {
free_nfs_rename_data(rename_data);
return -1;
}
- ptr = rindex(rename_data->oldpath, '/');
+ ptr = strrchr(rename_data->oldpath, '/');
if (ptr == NULL) {
rpc_set_error(nfs->rpc, "Invalid path %s", oldpath);
free_nfs_rename_data(rename_data);
free_nfs_rename_data(rename_data);
return -1;
}
- ptr = rindex(rename_data->newpath, '/');
+ ptr = strrchr(rename_data->newpath, '/');
if (ptr == NULL) {
rpc_set_error(nfs->rpc, "Invalid path %s", newpath);
free_nfs_rename_data(rename_data);
rpc_set_error(nfs->rpc, "Out of memory, failed to allocate buffer for link data");
return -1;
}
- bzero(link_data, sizeof(struct nfs_link_data));
+ memset(link_data, 0, sizeof(struct nfs_link_data));
link_data->oldpath = strdup(oldpath);
if (link_data->oldpath == NULL) {
free_nfs_link_data(link_data);
return -1;
}
- ptr = rindex(link_data->newpath, '/');
+ ptr = strrchr(link_data->newpath, '/');
if (ptr == NULL) {
rpc_set_error(nfs->rpc, "Invalid path %s", newpath);
free_nfs_link_data(link_data);
//qqq replace later with lseek()
-off_t nfs_get_current_offset(struct nfsfh *nfsfh)
+uint64_t nfs_get_current_offset(struct nfsfh *nfsfh)
{
return nfsfh->offset;
}
/*
* Get the maximum supported READ3 size by the server
*/
-size_t nfs_get_readmax(struct nfs_context *nfs)
+uint64_t nfs_get_readmax(struct nfs_context *nfs)
{
return nfs->readmax;
}
/*
* Get the maximum supported WRITE3 size by the server
*/
-size_t nfs_get_writemax(struct nfs_context *nfs)
+uint64_t nfs_get_writemax(struct nfs_context *nfs)
{
- return nfs->writemax;
+ /* Some XDR libraries can not marshall PDUs bigger than this */
+ if (nfs->writemax < 32768) {
+ return nfs->writemax;
+ }
+ return 32768;
}
void nfs_set_error(struct nfs_context *nfs, char *error_string, ...)
char *str = NULL;
va_start(ap, error_string);
- vasprintf(&str, error_string, ap);
+ str = malloc(1024);
+ vsnprintf(str, 1024, error_string, ap);
if (nfs->rpc->error_string != NULL) {
free(nfs->rpc->error_string);
}
nfs->rpc->error_string = str;
- va_end(ap);
+ va_end(ap);
}
{
struct mount_cb_data *data = private_data;
+ /* Dont want any more callbacks even if the socket is closed */
+ rpc->connect_cb = NULL;
+
if (status == RPC_STATUS_ERROR) {
data->cb(rpc, -EFAULT, command_data, data->private_data);
free_mount_cb_data(data);
{
struct mount_cb_data *data = private_data;
+ /* Dont want any more callbacks even if the socket is closed */
+ rpc->connect_cb = NULL;
+
if (status == RPC_STATUS_ERROR) {
data->cb(rpc, -EFAULT, command_data, data->private_data);
free_mount_cb_data(data);
if (data == NULL) {
return -1;
}
- bzero(data, sizeof(struct mount_cb_data));
+ memset(data, 0, sizeof(struct mount_cb_data));
data->cb = cb;
data->private_data = private_data;
data->server = strdup(server);
return nfs->rpc;
}
+const char *nfs_get_server(struct nfs_context *nfs) {
+ return nfs->server;
+}
+
+const char *nfs_get_export(struct nfs_context *nfs) {
+ return nfs->export;
+}
+
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef WIN32
+#include "win32_compat.h"
+#ifndef MSG_DONTWAIT
+#define MSG_DONTWAIT 0
+#endif
+#else
+#include <strings.h>
+#endif/*WIN32*/
#include <stdio.h>
-#include <strings.h>
#include <stdlib.h>
#include <errno.h>
#include <rpc/rpc.h>
rpc_set_error(rpc, "Out of memory: Failed to allocate pdu structure");
return NULL;
}
- bzero(pdu, sizeof(struct rpc_pdu));
+ memset(pdu, 0, sizeof(struct rpc_pdu));
pdu->xid = rpc->xid++;
pdu->cb = cb;
pdu->private_data = private_data;
xdr_setpos(&pdu->xdr, 4); /* skip past the record marker */
}
- bzero(&msg, sizeof(struct rpc_msg));
+ memset(&msg, 0, sizeof(struct rpc_msg));
msg.rm_xid = pdu->xid;
msg.rm_direction = CALL;
msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
size = ntohl(*(uint32_t *)buf);
- if ((size & 0x80000000) == 0) {
- /* cant handle oncrpc fragments */
- return -1;
- }
-
return (size & 0x7fffffff) + 4;
}
{
struct rpc_msg msg;
- bzero(&msg, sizeof(struct rpc_msg));
+ memset(&msg, 0, sizeof(struct rpc_msg));
msg.acpted_rply.ar_verf = _null_auth;
if (pdu->xdr_decode_bufsize > 0) {
if (pdu->xdr_decode_buf != NULL) {
pdu->cb(rpc, RPC_STATUS_ERROR, "Failed to allocate buffer for decoding of XDR reply", pdu->private_data);
return 0;
}
- bzero(pdu->xdr_decode_buf, pdu->xdr_decode_bufsize);
+ memset(pdu->xdr_decode_buf, 0, pdu->xdr_decode_bufsize);
}
msg.acpted_rply.ar_results.where = pdu->xdr_decode_buf;
msg.acpted_rply.ar_results.proc = pdu->xdr_decode_fn;
{
struct rpc_pdu *pdu;
XDR xdr;
- int pos, recordmarker;
+ int pos, recordmarker = 0;
unsigned int xid;
+ char *reasbuf = NULL;
- bzero(&xdr, sizeof(XDR));
+ memset(&xdr, 0, sizeof(XDR));
xdrmem_create(&xdr, buf, size, XDR_DECODE);
if (rpc->is_udp == 0) {
xdr_destroy(&xdr);
return -1;
}
+ if (!(recordmarker&0x80000000)) {
+ xdr_destroy(&xdr);
+ if (rpc_add_fragment(rpc, buf+4, size-4) != 0) {
+ rpc_set_error(rpc, "Failed to queue fragment for reassembly.");
+ return -1;
+ }
+ return 0;
+ }
}
+
+ /* reassembly */
+ if (recordmarker != 0 && rpc->fragments != NULL) {
+ struct rpc_fragment *fragment;
+ uint64_t total = size - 4;
+ char *ptr;
+
+ xdr_destroy(&xdr);
+ for (fragment = rpc->fragments; fragment; fragment = fragment->next) {
+ total += fragment->size;
+ }
+
+ reasbuf = malloc(total);
+ if (reasbuf == NULL) {
+ rpc_set_error(rpc, "Failed to reassemble PDU");
+ rpc_free_all_fragments(rpc);
+ return -1;
+ }
+ ptr = reasbuf;
+ for (fragment = rpc->fragments; fragment; fragment = fragment->next) {
+ memcpy(ptr, fragment->data, fragment->size);
+ ptr += fragment->size;
+ }
+ memcpy(ptr, buf + 4, size - 4);
+ xdrmem_create(&xdr, reasbuf, total, XDR_DECODE);
+ rpc_free_all_fragments(rpc);
+ }
+
pos = xdr_getpos(&xdr);
if (xdr_int(&xdr, (int *)&xid) == 0) {
rpc_set_error(rpc, "xdr_int reading xid failed");
xdr_destroy(&xdr);
+ if (reasbuf != NULL) {
+ free(reasbuf);
+ }
return -1;
}
xdr_setpos(&xdr, pos);
if (rpc->is_udp == 0 || rpc->is_broadcast == 0) {
rpc_free_pdu(rpc, pdu);
}
+ if (reasbuf != NULL) {
+ free(reasbuf);
+ }
return 0;
}
rpc_set_error(rpc, "No matching pdu found for xid:%d", xid);
xdr_destroy(&xdr);
+ if (reasbuf != NULL) {
+ free(reasbuf);
+ }
return -1;
}
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef WIN32
+#include "win32_compat.h"
+#else
+#include <unistd.h>
+#include <poll.h>
+#include <arpa/inet.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#endif/*WIN32*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
#include <fcntl.h>
-#include <poll.h>
#include <string.h>
#include <errno.h>
#include <rpc/rpc.h>
#include <rpc/xdr.h>
-#include <arpa/inet.h>
#ifdef HAVE_SYS_FILIO_H
#include <sys/filio.h>
#endif
-#include <sys/ioctl.h>
+#ifdef HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif
#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
#include "libnfs.h"
#include "libnfs-raw.h"
#include "libnfs-private.h"
#include "slist.h"
+#ifdef WIN32
+//has to be included after stdlib!!
+#include "win32_errnowrapper.h"
+#endif
+
+
+static int rpc_reconnect_requeue(struct rpc_context *rpc);
+static int rpc_connect_sockaddr_async(struct rpc_context *rpc, struct sockaddr_storage *s);
+
static void set_nonblocking(int fd)
{
- unsigned v;
+ int v = 0;
+#if defined(WIN32)
+ long nonblocking=1;
+ v = ioctlsocket(fd, FIONBIO,&nonblocking);
+#else
v = fcntl(fd, F_GETFL, 0);
fcntl(fd, F_SETFL, v | O_NONBLOCK);
+#endif //FIXME
}
int rpc_get_fd(struct rpc_context *rpc)
static int rpc_write_to_socket(struct rpc_context *rpc)
{
- ssize_t count;
+ int64_t count;
if (rpc == NULL) {
return -1;
}
while (rpc->outqueue != NULL) {
- ssize_t total;
+ int64_t total;
total = rpc->outqueue->outdata.size;
+#if defined(WIN32)
+ count = send(rpc->fd, rpc->outqueue->outdata.data + rpc->outqueue->written, total - rpc->outqueue->written, 0);
+#else
count = write(rpc->fd, rpc->outqueue->outdata.data + rpc->outqueue->written, total - rpc->outqueue->written);
+#endif
if (count == -1) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
return 0;
int available;
int size;
int pdu_size;
- ssize_t count;
+ int64_t count;
+#if defined(WIN32)
+ if (ioctlsocket(rpc->fd, FIONREAD, &available) != 0) {
+#else
if (ioctl(rpc->fd, FIONREAD, &available) != 0) {
+#endif
rpc_set_error(rpc, "Ioctl FIONREAD returned error : %d. Closing socket.", errno);
return -1;
}
+
if (available == 0) {
rpc_set_error(rpc, "Socket has been closed");
return -1;
if (rpc->inpos < 4) {
size = 4 - rpc->inpos;
+#if defined(WIN32)
+ count = recv(rpc->fd, rpc->inbuf + rpc->inpos, size, 0);
+#else
count = read(rpc->fd, rpc->inbuf + rpc->inpos, size);
+#endif
if (count == -1) {
if (errno == EINTR) {
return 0;
size = rpc->insize - rpc->inpos;
}
+#if defined(WIN32)
+ count = recv(rpc->fd, rpc->inbuf + rpc->inpos, size, 0);
+#else
count = read(rpc->fd, rpc->inbuf + rpc->inpos, size);
+#endif
if (count == -1) {
if (errno == EINTR) {
return 0;
int rpc_service(struct rpc_context *rpc, int revents)
{
if (revents & POLLERR) {
+#ifdef WIN32
+ char err = 0;
+#else
int err = 0;
+#endif
socklen_t err_size = sizeof(err);
if (getsockopt(rpc->fd, SOL_SOCKET, SO_ERROR,
- &err, &err_size) != 0 || err != 0) {
+ (char *)&err, &err_size) != 0 || err != 0) {
if (err == 0) {
err = errno;
}
rpc_set_error(rpc, "rpc_service: POLLERR, "
"Unknown socket error.");
}
- rpc->connect_cb(rpc, RPC_STATUS_ERROR, rpc->error_string, rpc->connect_data);
+ if (rpc->connect_cb != NULL) {
+ rpc->connect_cb(rpc, RPC_STATUS_ERROR, rpc->error_string, rpc->connect_data);
+ }
return -1;
}
if (revents & POLLHUP) {
rpc_set_error(rpc, "Socket failed with POLLHUP");
- rpc->connect_cb(rpc, RPC_STATUS_ERROR, rpc->error_string, rpc->connect_data);
+ if (rpc->connect_cb != NULL) {
+ rpc->connect_cb(rpc, RPC_STATUS_ERROR, rpc->error_string, rpc->connect_data);
+ }
return -1;
}
socklen_t err_size = sizeof(err);
if (getsockopt(rpc->fd, SOL_SOCKET, SO_ERROR,
- &err, &err_size) != 0 || err != 0) {
+ (char *)&err, &err_size) != 0 || err != 0) {
if (err == 0) {
err = errno;
}
rpc_set_error(rpc, "rpc_service: socket error "
"%s(%d) while connecting.",
strerror(err), err);
- rpc->connect_cb(rpc, RPC_STATUS_ERROR,
+ if (rpc->connect_cb != NULL) {
+ rpc->connect_cb(rpc, RPC_STATUS_ERROR,
NULL, rpc->connect_data);
+ }
return -1;
}
rpc->is_connected = 1;
- rpc->connect_cb(rpc, RPC_STATUS_SUCCESS, NULL, rpc->connect_data);
+ if (rpc->connect_cb != NULL) {
+ rpc->connect_cb(rpc, RPC_STATUS_SUCCESS, NULL, rpc->connect_data);
+ }
return 0;
}
+ if (revents & POLLIN) {
+ if (rpc_read_from_socket(rpc) != 0) {
+ rpc_reconnect_requeue(rpc);
+ return 0;
+ }
+ }
+
if (revents & POLLOUT && rpc->outqueue != NULL) {
if (rpc_write_to_socket(rpc) != 0) {
rpc_set_error(rpc, "write to socket failed");
}
}
- if (revents & POLLIN) {
- if (rpc_read_from_socket(rpc) != 0) {
- rpc_disconnect(rpc, rpc_get_error(rpc));
- return -1;
+ return 0;
+}
+
+void rpc_set_autoreconnect(struct rpc_context *rpc)
+{
+ rpc->auto_reconnect = 1;
+}
+
+void rpc_unset_autoreconnect(struct rpc_context *rpc)
+{
+ rpc->auto_reconnect = 0;
+}
+
+static int rpc_connect_sockaddr_async(struct rpc_context *rpc, struct sockaddr_storage *s)
+{
+ int socksize;
+
+ switch (s->ss_family) {
+ case AF_INET:
+ socksize = sizeof(struct sockaddr_in);
+ rpc->fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ break;
+ default:
+ rpc_set_error(rpc, "Can not handle AF_FAMILY:%d", s->ss_family);
+ return -1;
+ }
+
+ if (rpc->fd == -1) {
+ rpc_set_error(rpc, "Failed to open socket");
+ return -1;
+ }
+
+
+#if !defined(WIN32)
+ /* Some systems allow you to set capabilities on an executable
+ * to allow the file to be executed with privilege to bind to
+ * privileged system ports, even if the user is not root.
+ *
+ * Opportunistically try to bind the socket to a low numbered
+ * system port in the hope that the user is either root or the
+ * executable has the CAP_NET_BIND_SERVICE.
+ *
+ * As soon as we fail the bind() with EACCES we know we will never
+ * be able to bind to a system port so we terminate the loop.
+ *
+ * On linux, use
+ * sudo setcap 'cap_net_bind_service=+ep' /path/executable
+ * to make the executable able to bind to a system port.
+ */
+ if (1) {
+ int port;
+ int one = 1;
+
+ setsockopt(rpc->fd, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one));
+
+ for (port = 200; port < 500; port++) {
+ struct sockaddr_in sin;
+
+ memset(&sin, 0, sizeof(sin));
+ sin.sin_port = htons(port);
+ sin.sin_family = AF_INET;
+ sin.sin_addr.s_addr = 0;
+
+ if (bind(rpc->fd, (struct sockaddr *)&sin, sizeof(struct sockaddr_in)) != 0 && errno != EACCES) {
+ /* we didnt get EACCES, so try again */
+ continue;
+ }
+ break;
}
}
+#endif
- return 0;
-}
+ set_nonblocking(rpc->fd);
+#if defined(WIN32)
+ if (connect(rpc->fd, (struct sockaddr *)s, socksize) == 0 && errno != EINPROGRESS )
+#else
+ if (connect(rpc->fd, (struct sockaddr *)s, socksize) != 0 && errno != EINPROGRESS)
+#endif
+ {
+ rpc_set_error(rpc, "connect() to server failed");
+ return -1;
+ }
+
+ return 0;
+}
int rpc_connect_async(struct rpc_context *rpc, const char *server, int port, rpc_cb cb, void *private_data)
{
- struct sockaddr_storage s;
- struct sockaddr_in *sin = (struct sockaddr_in *)&s;
- int socksize;
+ struct sockaddr_in *sin = (struct sockaddr_in *)&rpc->s;
if (rpc->fd != -1) {
rpc_set_error(rpc, "Trying to connect while already connected");
return -1;
}
+ rpc->auto_reconnect = 0;
+
sin->sin_family = AF_INET;
sin->sin_port = htons(port);
if (inet_pton(AF_INET, server, &sin->sin_addr) != 1) {
return -1;
}
- switch (s.ss_family) {
+
+ switch (rpc->s.ss_family) {
case AF_INET:
- socksize = sizeof(struct sockaddr_in);
#ifdef HAVE_SOCKADDR_LEN
- sin->sin_len = socksize;
+ sin->sin_len = sizeof(struct sockaddr_in);
#endif
- rpc->fd = socket(AF_INET, SOCK_STREAM, 0);
break;
}
- if (rpc->fd == -1) {
- rpc_set_error(rpc, "Failed to open socket");
- return -1;
- }
-
rpc->connect_cb = cb;
rpc->connect_data = private_data;
- set_nonblocking(rpc->fd);
-
- if (connect(rpc->fd, (struct sockaddr *)&s, socksize) != 0 && errno != EINPROGRESS) {
- rpc_set_error(rpc, "connect() to server failed");
+ if (rpc_connect_sockaddr_async(rpc, &rpc->s) != 0) {
return -1;
- }
+ }
return 0;
}
int rpc_disconnect(struct rpc_context *rpc, char *error)
{
+ rpc_unset_autoreconnect(rpc);
+
if (rpc->fd != -1) {
+#if defined(WIN32)
+ closesocket(rpc->fd);
+#else
close(rpc->fd);
+#endif
}
rpc->fd = -1;
return 0;
}
+static void reconnect_cb(struct rpc_context *rpc, int status, void *data _U_, void *private_data)
+{
+ if (status != RPC_STATUS_SUCCESS) {
+ rpc_error_all_pdus(rpc, "RPC ERROR: Failed to reconnect async");
+ return;
+ }
+
+ rpc->is_connected = 1;
+ rpc->connect_cb = NULL;
+}
+
+/* disconnect but do not error all PDUs, just move pdus in-flight back to the outqueue and reconnect */
+static int rpc_reconnect_requeue(struct rpc_context *rpc)
+{
+ struct rpc_pdu *pdu;
+
+ if (rpc->fd != -1) {
+#if defined(WIN32)
+ closesocket(rpc->fd);
+#else
+ close(rpc->fd);
+#endif
+ }
+ rpc->fd = -1;
+
+ rpc->is_connected = 0;
+
+ /* socket is closed so we will not get any replies to any commands
+ * in flight. Move them all over from the waitpdu queue back to the out queue
+ */
+ for (pdu=rpc->waitpdu; pdu; pdu=pdu->next) {
+ SLIST_REMOVE(&rpc->waitpdu, pdu);
+ SLIST_ADD(&rpc->outqueue, pdu);
+ /* we have to re-send the whole pdu again */
+ pdu->written = 0;
+ }
+
+ if (rpc->auto_reconnect != 0) {
+ rpc->connect_cb = reconnect_cb;
+
+ if (rpc_connect_sockaddr_async(rpc, &rpc->s) != 0) {
+ rpc_error_all_pdus(rpc, "RPC ERROR: Failed to reconnect async");
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
int rpc_bind_udp(struct rpc_context *rpc, char *addr, int port)
{
return -1;
}
- snprintf(service, 6, "%d", port);
+ sprintf(service, "%d", port);
if (getaddrinfo(addr, service, NULL, &ai) != 0) {
rpc_set_error(rpc, "Invalid address:%s. "
"Can not resolv into IPv4/v6 structure.");
return -1;
}
- snprintf(service, 6, "%d", port);
+ sprintf(service, "%d", port);
if (getaddrinfo(addr, service, NULL, &ai) != 0) {
rpc_set_error(rpc, "Invalid address:%s. "
"Can not resolv into IPv4/v6 structure.");
freeaddrinfo(ai);
rpc->is_broadcast = is_broadcast;
- setsockopt(rpc->fd, SOL_SOCKET, SO_BROADCAST, &is_broadcast, sizeof(is_broadcast));
+ setsockopt(rpc->fd, SOL_SOCKET, SO_BROADCAST, (char *)&is_broadcast, sizeof(is_broadcast));
return 0;
}
{
return (struct sockaddr *)&rpc->udp_src;
}
+
+int rpc_queue_length(struct rpc_context *rpc)
+{
+ int i=0;
+ struct rpc_pdu *pdu;
+
+ for(pdu = rpc->outqueue; pdu; pdu = pdu->next) {
+ i++;
+ }
+ for(pdu = rpc->waitpdu; pdu; pdu = pdu->next) {
+ i++;
+ }
+ return i;
+}
--- /dev/null
+# libnfs pkg-config file
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libnfs
+Description: libnfs is a client library for accessing NFS shares over a network.
+Version: @VERSION@
+Requires:
+Conflicts:
+Libs: -L${libdir} -lnfs
+Cflags: -I${includedir}
+Requires.private: @LIBNFS_PC_REQ_PRIVATE@
-# libtool (GNU libtool) 2.4
+# libtool (GNU libtool) 2.4.2
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
-# 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# --quiet, --silent don't print informational messages
# --no-quiet, --no-silent
# print informational messages (default)
+# --no-warn don't display warning messages
# --tag=TAG use configuration variables from tag TAG
# -v, --verbose print more informational messages than default
# --no-verbose don't print the extra informational messages
# compiler: $LTCC
# compiler flags: $LTCFLAGS
# linker: $LD (gnu? $with_gnu_ld)
-# $progname: (GNU libtool) 2.4 Debian-2.4-2
+# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1
# automake: $automake_version
# autoconf: $autoconf_version
#
PROGRAM=libtool
PACKAGE=libtool
-VERSION="2.4 Debian-2.4-2"
+VERSION="2.4.2 Debian-2.4.2-1"
TIMESTAMP=""
-package_revision=1.3293
+package_revision=1.3337
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
: ${CP="cp -f"}
test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
-: ${EGREP="/bin/grep -E"}
-: ${FGREP="/bin/grep -F"}
-: ${GREP="/bin/grep"}
-: ${LN_S="ln -s"}
: ${MAKE="make"}
: ${MKDIR="mkdir"}
: ${MV="mv -f"}
: ${RM="rm -f"}
-: ${SED="/bin/sed"}
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
: ${Xsed="$SED -e 1s/^X//"}
;;
*)
save_IFS="$IFS"
- IFS=:
+ IFS=${PATH_SEPARATOR-:}
for progdir in $PATH; do
IFS="$save_IFS"
test -x "$progdir/$progname" && break
s*\$LTCFLAGS*'"$LTCFLAGS"'*
s*\$LD*'"$LD"'*
s/\$with_gnu_ld/'"$with_gnu_ld"'/
- s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
- s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
+ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
+ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
p
d
}
opt_help=false
opt_help_all=false
opt_silent=:
+opt_warning=:
opt_verbose=:
opt_silent=false
opt_verbose=false
;;
--no-silent|--no-quiet)
opt_silent=false
+func_append preserve_args " $opt"
+ ;;
+ --no-warning|--no-warn)
+ opt_warning=false
func_append preserve_args " $opt"
;;
--no-verbose)
*.[cCFSifmso] | \
*.ada | *.adb | *.ads | *.asm | \
*.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
- *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
+ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
func_xform "$libobj"
libobj=$func_xform_result
;;
# Set up the ranlib parameters.
oldlib="$destdir/$name"
+ func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+ tool_oldlib=$func_to_tool_file_result
func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
if test -n "$stripme" && test -n "$old_striplib"; then
- func_show_eval "$old_striplib $oldlib" 'exit $?'
+ func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
fi
# Do each command in the postinstall commands.
# linked before any other PIC object. But we must not use
# pic_flag when linking with -static. The problem exists in
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
- *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
*-*-hpux*)
pic_flag_for_symtable=" $pic_flag" ;;
# launches target application with the remaining arguments.
func_exec_program ()
{
- for lt_wr_arg
- do
- case \$lt_wr_arg in
- --lt-*) ;;
- *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
- esac
- shift
- done
+ case \" \$* \" in
+ *\\ --lt-*)
+ for lt_wr_arg
+ do
+ case \$lt_wr_arg in
+ --lt-*) ;;
+ *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
+ esac
+ shift
+ done ;;
+ esac
func_exec_program_core \${1+\"\$@\"}
}
{
EOF
func_emit_wrapper yes |
- $SED -e 's/\([\\"]\)/\\\1/g' \
- -e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
-
+ $SED -n -e '
+s/^\(.\{79\}\)\(..*\)/\1\
+\2/
+h
+s/\([\\"]\)/\\\1/g
+s/$/\\n/
+s/\([^\n]*\).*/ fputs ("\1", f);/p
+g
+D'
cat <<"EOF"
}
EOF
continue
;;
- -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
func_append compiler_flags " $arg"
func_append compile_command " $arg"
func_append finalize_command " $arg"
lib=
found=no
case $deplib in
- -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
test "$hardcode_direct_absolute" = no; then
add="$dir/$linklib"
elif test "$hardcode_minus_L" = yes; then
- add_dir="-L$dir"
+ add_dir="-L$absdir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
case $libdir in
# which has an extra 1 added just for fun
#
case $version_type in
+ # correct linux to gnu/linux during the next big refactor
darwin|linux|osf|windows|none)
func_arith $number_major + $number_minor
current=$func_arith_result
versuffix="$major.$revision"
;;
- linux)
+ linux) # correct to gnu/linux during the next big refactor
func_arith $current - $age
major=.$func_arith_result
versuffix="$major.$age.$revision"
# Test again, we may have decided not to build it any more
if test "$build_libtool_libs" = yes; then
+ # Remove ${wl} instances when linking with ld.
+ # FIXME: should test the right _cmds variable.
+ case $archive_cmds in
+ *\$LD\ *) wl= ;;
+ esac
if test "$hardcode_into_libs" = yes; then
# Hardcode the library paths
hardcode_libdirs=
elif test -n "$runpath_var"; then
case "$perm_rpath " in
*" $libdir "*) ;;
- *) func_apped perm_rpath " $libdir" ;;
+ *) func_append perm_rpath " $libdir" ;;
esac
fi
done
if test -n "$hardcode_libdir_separator" &&
test -n "$hardcode_libdirs"; then
libdir="$hardcode_libdirs"
- if test -n "$hardcode_libdir_flag_spec_ld"; then
- eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
- else
- eval dep_rpath=\"$hardcode_libdir_flag_spec\"
- fi
+ eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
fi
if test -n "$runpath_var" && test -n "$perm_rpath"; then
# We should set the runpath_var.
esac
done
fi
+ func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+ tool_oldlib=$func_to_tool_file_result
eval cmds=\"$old_archive_cmds\"
func_len " $cmds"
*.la)
func_basename "$deplib"
name="$func_basename_result"
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ func_resolve_sysroot "$deplib"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
test -z "$libdir" && \
func_fatal_error "\`$deplib' is not a valid libtool archive"
func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LIBNFS_PC_REQ_PRIVATE = @LIBNFS_PC_REQ_PRIVATE@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
RPCGENFLAGS = @RPCGENFLAGS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+TIRPC_CFLAGS = @TIRPC_CFLAGS@
+TIRPC_LIBS = @TIRPC_LIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef WIN32
+#include "win32_compat.h"
+#endif/*WIN32*/
+
#include <stdio.h>
#include <errno.h>
#include <rpc/rpc.h>
#include "libnfs-private.h"
#include "libnfs-raw-mount.h"
-
int rpc_mount_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LIBNFS_PC_REQ_PRIVATE = @LIBNFS_PC_REQ_PRIVATE@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
RPCGENFLAGS = @RPCGENFLAGS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+TIRPC_CFLAGS = @TIRPC_CFLAGS@
+TIRPC_LIBS = @TIRPC_LIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef WIN32
+#include "win32_compat.h"
+#else
+#include <sys/stat.h>
+#endif/*WIN32*/
+
#include <stdio.h>
#include <errno.h>
-#include <sys/stat.h>
#include <string.h>
#include <rpc/rpc.h>
#include <rpc/xdr.h>
#include "libnfs-private.h"
#include "libnfs-raw-nfs.h"
-
-
char *nfsstat3_to_str(int error)
{
switch (error) {
-int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, off_t offset, size_t count, void *private_data)
+int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t offset, uint64_t count, void *private_data)
{
struct rpc_pdu *pdu;
READ3args args;
}
-int rpc_nfs_write_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *buf, off_t offset, size_t count, int stable_how, void *private_data)
+int rpc_nfs_write_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *buf, uint64_t offset, uint64_t count, int stable_how, void *private_data)
{
struct rpc_pdu *pdu;
WRITE3args args;
return -1;
}
- bzero(&args, sizeof(MKDIR3args));
+ memset(&args, 0, sizeof(MKDIR3args));
args.where.dir.data.data_len = fh->data.data_len;
args.where.dir.data.data_val = fh->data.data_val;
args.where.name = dir;
return -1;
}
- bzero(&args, sizeof(RMDIR3args));
+ memset(&args, 0, sizeof(RMDIR3args));
args.object.dir.data.data_len = fh->data.data_len;
args.object.dir.data.data_val = fh->data.data_val;
args.object.name = dir;
return -1;
}
- bzero(&args, sizeof(CREATE3args));
+ memset(&args, 0, sizeof(CREATE3args));
args.where.dir.data.data_len = fh->data.data_len;
args.where.dir.data.data_val = fh->data.data_val;
args.where.name = file;
+int rpc_nfs_mknod_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *file, int mode, int major, int minor, void *private_data)
+{
+ struct rpc_pdu *pdu;
+ MKNOD3args args;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_MKNOD, cb, private_data, (xdrproc_t)xdr_MKNOD3res, sizeof(MKNOD3res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/mknod call");
+ return -1;
+ }
+
+ memset(&args, 0, sizeof(MKNOD3args));
+ args.where.dir.data.data_len = fh->data.data_len;
+ args.where.dir.data.data_val = fh->data.data_val;
+ args.where.name = file;
+ switch (mode & S_IFMT) {
+ case S_IFCHR:
+ args.what.type = NF3CHR;
+ args.what.mknoddata3_u.chr_device.dev_attributes.mode.set_it = 1;
+ args.what.mknoddata3_u.chr_device.dev_attributes.mode.set_mode3_u.mode = mode & (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH);
+ args.what.mknoddata3_u.chr_device.spec.specdata1 = major;
+ args.what.mknoddata3_u.chr_device.spec.specdata2 = minor;
+ break;
+ case S_IFBLK:
+ args.what.type = NF3BLK;
+ args.what.mknoddata3_u.blk_device.dev_attributes.mode.set_it = 1;
+ args.what.mknoddata3_u.blk_device.dev_attributes.mode.set_mode3_u.mode = mode & (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH);
+ args.what.mknoddata3_u.blk_device.spec.specdata1 = major;
+ args.what.mknoddata3_u.blk_device.spec.specdata2 = minor;
+ case S_IFSOCK:
+ args.what.type = NF3SOCK;
+ args.what.mknoddata3_u.sock_attributes.mode.set_it = 1;
+ args.what.mknoddata3_u.sock_attributes.mode.set_mode3_u.mode = mode & (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH);
+ break;
+ case S_IFIFO:
+ args.what.type = NF3FIFO;
+ args.what.mknoddata3_u.pipe_attributes.mode.set_it = 1;
+ args.what.mknoddata3_u.pipe_attributes.mode.set_mode3_u.mode = mode & (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH);
+ break;
+ default:
+ rpc_set_error(rpc, "Invalid file type for nfs/mknod call");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ if (xdr_MKNOD3args(&pdu->xdr, &args) == 0) {
+ rpc_set_error(rpc, "XDR error: Failed to encode MKNOD3args");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/mknod call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
int rpc_nfs_remove_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *file, void *private_data)
{
return -1;
}
- bzero(&args, sizeof(REMOVE3args));
+ memset(&args, 0, sizeof(REMOVE3args));
args.object.dir.data.data_len = fh->data.data_len;
args.object.dir.data.data_val = fh->data.data_val;
args.object.name = file;
return 0;
}
-
int rpc_nfs_readdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t cookie, char *cookieverf, int count, void *private_data)
{
struct rpc_pdu *pdu;
return -1;
}
- bzero(&args, sizeof(READDIR3args));
+ memset(&args, 0, sizeof(READDIR3args));
args.dir.data.data_len = fh->data.data_len;
args.dir.data.data_val = fh->data.data_val;
args.cookie = cookie;
return 0;
}
+int rpc_nfs_readdirplus_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t cookie, char *cookieverf, int count, void *private_data)
+{
+ struct rpc_pdu *pdu;
+ READDIRPLUS3args args;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_READDIRPLUS, cb, private_data, (xdrproc_t)xdr_READDIRPLUS3res, sizeof(READDIRPLUS3res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/readdirplus call");
+ return -1;
+ }
+
+ memset(&args, 0, sizeof(READDIRPLUS3args));
+ args.dir.data.data_len = fh->data.data_len;
+ args.dir.data.data_val = fh->data.data_val;
+ args.cookie = cookie;
+ memcpy(&args.cookieverf, cookieverf, sizeof(cookieverf3));
+ args.dircount = count;
+ args.maxcount = count;
+
+ if (xdr_READDIRPLUS3args(&pdu->xdr, &args) == 0) {
+ rpc_set_error(rpc, "XDR error: Failed to encode READDIRPLUS3args");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/readdirplus call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
int rpc_nfs_fsstat_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data)
{
struct rpc_pdu *pdu;
return -1;
}
- bzero(&args, sizeof(SYMLINK3args));
+ memset(&args, 0, sizeof(SYMLINK3args));
args.where.dir.data.data_len = fh->data.data_len;
args.where.dir.data.data_val = fh->data.data_val;
args.where.name = newname;
return -1;
}
- bzero(&args, sizeof(RENAME3args));
+ memset(&args, 0, sizeof(RENAME3args));
args.from.dir.data.data_len = olddir->data.data_len;
args.from.dir.data.data_val = olddir->data.data_val;
args.from.name = oldname;
return -1;
}
- bzero(&args, sizeof(LINK3args));
+ memset(&args, 0, sizeof(LINK3args));
args.file.data.data_len = file->data.data_len;
args.file.data.data_val = file->data.data_val;
args.link.dir.data.data_len = newdir->data.data_len;
union createhow3 switch (createmode3 mode) {
case UNCHECKED:
- case GUARDED:
sattr3 obj_attributes;
+ case GUARDED:
+ sattr3 g_obj_attributes;
case EXCLUSIVE:
createverf3 verf;
};
union mknoddata3 switch (ftype3 type) {
case NF3CHR:
+ devicedata3 chr_device;
case NF3BLK:
- devicedata3 device;
+ devicedata3 blk_device;
case NF3SOCK:
+ sattr3 sock_attributes;
case NF3FIFO:
sattr3 pipe_attributes;
default:
SYMLINK3res
NFS3_SYMLINK(SYMLINK3args) = 10;
-/* MKNOD3res NFSPROC3_MKNOD(MKNOD3args) = 11;*/
+ MKNOD3res
+ NFS3_MKNOD(MKNOD3args) = 11;
REMOVE3res
NFS3_REMOVE(REMOVE3args) = 12;
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef WIN32
+#include "win32_compat.h"
+#else
+#include <sys/stat.h>
+#endif/*WIN32*/
#include <stdio.h>
#include <errno.h>
-#include <sys/stat.h>
#include <string.h>
#include <rpc/rpc.h>
#include <rpc/xdr.h>
--- /dev/null
+Name: libnfs
+Summary: NFS client library
+Vendor: Ronnie Sahlberg
+Packager: ronniesahlberg@gmail.com
+Version: @VERSION@
+Release: 1
+Epoch: 0
+License: GNU LGPL version 2.1
+Group: System Environment/Libraries
+URL: http://www.github.com/sahlberg/libnfs
+
+Source: libnfs-%{version}.tar.gz
+
+Provides: lib = %{version}
+
+Prefix: /usr
+BuildRoot: %{_tmppath}/%{name}-%{version}-root
+
+%description
+LibNFS is a NFS client library
+
+#######################################################################
+
+
+
+%prep
+%setup -q
+# setup the init script and sysconfig file
+%setup -T -D -n libnfs-%{version} -q
+
+%build
+
+## check for ccache
+if ccache -h >/dev/null 2>&1 ; then
+ CC="ccache gcc"
+else
+ CC="gcc"
+fi
+
+export CC
+
+## always run autogen.sh
+aclocal
+autoheader
+autoconf
+libtoolize -c -f -i
+automake --add-missing
+
+
+CFLAGS="$RPM_OPT_FLAGS $EXTRA -O0 -g -D_GNU_SOURCE" ./configure \
+ --prefix=%{_prefix}
+
+%install
+# Clean up in case there is trash left from a previous build
+rm -rf $RPM_BUILD_ROOT
+
+# Create the target build directory hierarchy
+
+make DESTDIR=$RPM_BUILD_ROOT install
+
+# Remove "*.old" files
+find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \;
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+#######################################################################
+## Files section ##
+#######################################################################
+
+%files
+%defattr(-,root,root)
+
+%{_libdir}/libnfs.so*
+
+%package devel
+Summary: Development libraries for LibNFS
+Group: Development
+
+%description devel
+development libraries for LibNFS
+
+%files devel
+%defattr(-,root,root)
+%{_includedir}/nfsc/libnfs.h
+%{_includedir}/nfsc/libnfs-raw.h
+%{_includedir}/nfsc/libnfs-raw-mount.h
+%{_includedir}/nfsc/libnfs-raw-nfs.h
+%{_includedir}/nfsc/libnfs-raw-portmap.h
+%{_includedir}/nfsc/libnfs-raw-rquota.h
+%{_libdir}/libnfs.a
+%{_libdir}/libnfs.la
+%{_libdir}/pkgconfig/libnfs.pc
+
+%changelog
+* Tue Dec 6 2011 : Version 1.2
+ - Add support for MKNOD
+ - Add support for HaneWin NFS server
+ - Change all [s]size_t offset_t to be 64bit clean scalars
+* Sun Nov 27 2011 : Version 1.1
+ - Fix definition and use of AUTH
+ - Only call the "connect" callback if non-NULL
+ - make sure the callback for connect is only invoked once for the sync api
+ - make file offset bits 64 bits always
+* Sun Jul 31 2011 : Version 1.0
+ - Initial version
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+#
+# makerpms.sh - build RPM packages from the git sources
+#
+# Copyright (C) John H Terpstra 1998-2002
+# Copyright (C) Gerald (Jerry) Carter 2003
+# Copyright (C) Jim McDonough 2007
+# Copyright (C) Andrew Tridgell 2007
+# Copyright (C) Michael Adam 2008-2009
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, see <http://www.gnu.org/licenses/>.
+#
+
+#
+# The following allows environment variables to override the target directories
+# the alternative is to have a file in your home directory calles .rpmmacros
+# containing the following:
+# %_topdir /home/mylogin/redhat
+#
+# Note: Under this directory rpm expects to find the same directories that are under the
+# /usr/src/redhat directory
+#
+
+EXTRA_OPTIONS="$1"
+
+DIRNAME=$(dirname $0)
+TOPDIR=${DIRNAME}/../..
+
+SPECDIR=`rpm --eval %_specdir`
+SRCDIR=`rpm --eval %_sourcedir`
+
+SPECFILE="libnfs.spec"
+SPECFILE_IN="libnfs.spec.in"
+RPMBUILD="rpmbuild"
+
+# We use tags and determine the version, as follows:
+# libnfs-0.9.1 (First release of 0.9).
+# libnfs-0.9.23 (23rd minor release of the 112 version)
+#
+# If we're not directly on a tag, this is a devel release; we append
+# .0.<patchnum>.<checksum>.devel to the release.
+TAG=`git describe`
+case "$TAG" in
+ libnfs-*)
+ TAG=${TAG##libnfs-}
+ case "$TAG" in
+ *-*-g*) # 0.9-168-ge6cf0e8
+ # Not exactly on tag: devel version.
+ VERSION=`echo "$TAG" | sed 's/\([^-]\+\)-\([0-9]\+\)-\(g[0-9a-f]\+\)/\1.0.\2.\3.devel/'`
+ ;;
+ *)
+ # An actual release version
+ VERSION=$TAG
+ ;;
+ esac
+ ;;
+ *)
+ echo Invalid tag "$TAG" >&2
+ exit 1
+ ;;
+esac
+
+sed -e s/@VERSION@/$VERSION/g \
+ < ${DIRNAME}/${SPECFILE_IN} \
+ > ${DIRNAME}/${SPECFILE}
+
+VERSION=$(grep ^Version ${DIRNAME}/${SPECFILE} | sed -e 's/^Version:\ \+//')
+
+if echo | gzip -c --rsyncable - > /dev/null 2>&1 ; then
+ GZIP="gzip -9 --rsyncable"
+else
+ GZIP="gzip -9"
+fi
+
+pushd ${TOPDIR}
+echo -n "Creating libnfs-${VERSION}.tar.gz ... "
+git archive --prefix=libnfs-${VERSION}/ HEAD | ${GZIP} > ${SRCDIR}/libnfs-${VERSION}.tar.gz
+RC=$?
+popd
+echo "Done."
+if [ $RC -ne 0 ]; then
+ echo "Build failed!"
+ exit 1
+fi
+
+# At this point the SPECDIR and SRCDIR vaiables must have a value!
+
+##
+## copy additional source files
+##
+cp -p ${DIRNAME}/${SPECFILE} ${SPECDIR}
+
+##
+## Build
+##
+echo "$(basename $0): Getting Ready to build release package"
+${RPMBUILD} -ba --clean --rmsource ${EXTRA_OPTIONS} ${SPECDIR}/${SPECFILE} || exit 1
+
+echo "$(basename $0): Done."
+
+exit 0
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LIBNFS_PC_REQ_PRIVATE = @LIBNFS_PC_REQ_PRIVATE@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
RPCGENFLAGS = @RPCGENFLAGS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+TIRPC_CFLAGS = @TIRPC_CFLAGS@
+TIRPC_LIBS = @TIRPC_LIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef WIN32
+#include "win32_compat.h"
+#endif/*WIN32*/
#include <stdio.h>
#include <rpc/rpc.h>
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
+LIBNFS_PC_REQ_PRIVATE = @LIBNFS_PC_REQ_PRIVATE@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
RPCGENFLAGS = @RPCGENFLAGS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+TIRPC_CFLAGS = @TIRPC_CFLAGS@
+TIRPC_LIBS = @TIRPC_LIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef WIN32
+#include "win32_compat.h"
+#endif/*WIN32*/
#include <stdio.h>
#include <errno.h>
--- /dev/null
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C++ Express 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libnfs", "libnfs.vcxproj", "{7CAB9B67-6AA9-497F-A900-20D9D05049F5}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nfsclient-sync", "..\nfsclient-sync\nfsclient-sync.vcxproj", "{B907AC9A-50C5-4E43-97C3-27DC7241F6C5}"
+ ProjectSection(ProjectDependencies) = postProject
+ {7CAB9B67-6AA9-497F-A900-20D9D05049F5} = {7CAB9B67-6AA9-497F-A900-20D9D05049F5}
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {7CAB9B67-6AA9-497F-A900-20D9D05049F5}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7CAB9B67-6AA9-497F-A900-20D9D05049F5}.Debug|Win32.Build.0 = Debug|Win32
+ {7CAB9B67-6AA9-497F-A900-20D9D05049F5}.Release|Win32.ActiveCfg = Release|Win32
+ {7CAB9B67-6AA9-497F-A900-20D9D05049F5}.Release|Win32.Build.0 = Release|Win32
+ {B907AC9A-50C5-4E43-97C3-27DC7241F6C5}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B907AC9A-50C5-4E43-97C3-27DC7241F6C5}.Debug|Win32.Build.0 = Debug|Win32
+ {B907AC9A-50C5-4E43-97C3-27DC7241F6C5}.Release|Win32.ActiveCfg = Release|Win32
+ {B907AC9A-50C5-4E43-97C3-27DC7241F6C5}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{7CAB9B67-6AA9-497F-A900-20D9D05049F5}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>libnfs</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <LibraryPath>..\..\..\oncrpc-win32\win32\bin;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib</LibraryPath>
+ <ExecutablePath>..\..\..\oncrpc-win32\win32\bin;$(VCInstallDir)bin;$(WindowsSdkDir)bin\NETFX 4.0 Tools;$(WindowsSdkDir)bin;$(VSInstallDir)Common7\Tools\bin;$(VSInstallDir)Common7\tools;$(VSInstallDir)Common7\ide;$(ProgramFiles)\HTML Help Workshop;$(FrameworkSDKDir)\bin;$(MSBuildToolsPath32);$(VSInstallDir);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH);</ExecutablePath>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <LibraryPath>..\..\..\oncrpc-win32\win32\bin;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib</LibraryPath>
+ <ExecutablePath>..\..\..\oncrpc-win32\win32\bin;$(VCInstallDir)bin;$(WindowsSdkDir)bin\NETFX 4.0 Tools;$(WindowsSdkDir)bin;$(VSInstallDir)Common7\Tools\bin;$(VSInstallDir)Common7\tools;$(VSInstallDir)Common7\ide;$(ProgramFiles)\HTML Help Workshop;$(FrameworkSDKDir)\bin;$(MSBuildToolsPath32);$(VSInstallDir);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH);</ExecutablePath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_WIN32_WINNT=0x0501;_U_=;_USE_32BIT_TIME_T;__STDC_CONSTANT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\..\oncrpc-win32\win32\include;..\..\include;..\..\.;..\..\win32;..\..\mount;..\..\nfs;..\..\lib</AdditionalIncludeDirectories>
+ <CompileAs>Default</CompileAs>
+ <DisableSpecificWarnings>4996</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ModuleDefinitionFile>..\..\lib\libnfs-win32.def</ModuleDefinitionFile>
+ <AdditionalDependencies>oncrpc.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <IgnoreSpecificDefaultLibraries>MSVCRT</IgnoreSpecificDefaultLibraries>
+ </Link>
+ <PreBuildEvent>
+ <Command>copy $(ProjectDir)..\..\nfs\nfs.x $(ProjectDir)..\..\nfs\libnfs-raw-nfs.x
+rpcgen.exe -h $(ProjectDir)..\..\nfs\libnfs-raw-nfs.x > $(ProjectDir)..\..\nfs\libnfs-raw-nfs.h
+rpcgen.exe -c $(ProjectDir)..\..\nfs\libnfs-raw-nfs.x > $(ProjectDir)..\..\nfs\libnfs-raw-nfs.c
+
+copy $(ProjectDir)..\..\rquota\rquota.x $(ProjectDir)..\..\rquota\libnfs-raw-rquota.x
+rpcgen.exe -h $(ProjectDir)..\..\rquota\libnfs-raw-rquota.x > $(ProjectDir)..\..\rquota\libnfs-raw-rquota.h
+rpcgen.exe -c $(ProjectDir)..\..\rquota\libnfs-raw-rquota.x > $(ProjectDir)..\..\rquota\libnfs-raw-rquota.c
+
+copy $(ProjectDir)..\..\portmap\portmap.x $(ProjectDir)..\..\portmap\libnfs-raw-portmap.x
+rpcgen.exe -h $(ProjectDir)..\..\portmap\libnfs-raw-portmap.x > $(ProjectDir)..\..\portmap\libnfs-raw-portmap.h
+rpcgen.exe -c $(ProjectDir)..\..\portmap\libnfs-raw-portmap.x > $(ProjectDir)..\..\portmap\libnfs-raw-portmap.c
+
+copy $(ProjectDir)..\..\mount\mount.x $(ProjectDir)..\..\mount\libnfs-raw-mount.x
+rpcgen.exe -h $(ProjectDir)..\..\mount\libnfs-raw-mount.x > $(ProjectDir)..\..\mount\libnfs-raw-mount.h
+rpcgen.exe -c $(ProjectDir)..\..\mount\libnfs-raw-mount.x > $(ProjectDir)..\..\mount\libnfs-raw-mount.c</Command>
+ </PreBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_WIN32_WINNT=0x0501;_U_=;_USE_32BIT_TIME_T;__STDC_CONSTANT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\..\oncrpc-win32\win32\include;..\..\include;..\..\.;..\..\win32;..\..\mount;..\..\nfs;..\..\lib</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4996</DisableSpecificWarnings>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>oncrpc.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <ModuleDefinitionFile>..\..\lib\libnfs-win32.def</ModuleDefinitionFile>
+ </Link>
+ <PreBuildEvent>
+ <Command>copy $(ProjectDir)..\..\nfs\nfs.x $(ProjectDir)..\..\nfs\libnfs-raw-nfs.x
+rpcgen.exe -h $(ProjectDir)..\..\nfs\libnfs-raw-nfs.x > $(ProjectDir)..\..\nfs\libnfs-raw-nfs.h
+rpcgen.exe -c $(ProjectDir)..\..\nfs\libnfs-raw-nfs.x > $(ProjectDir)..\..\nfs\libnfs-raw-nfs.c
+
+copy $(ProjectDir)..\..\rquota\rquota.x $(ProjectDir)..\..\rquota\libnfs-raw-rquota.x
+rpcgen.exe -h $(ProjectDir)..\..\rquota\libnfs-raw-rquota.x > $(ProjectDir)..\..\rquota\libnfs-raw-rquota.h
+rpcgen.exe -c $(ProjectDir)..\..\rquota\libnfs-raw-rquota.x > $(ProjectDir)..\..\rquota\libnfs-raw-rquota.c
+
+copy $(ProjectDir)..\..\portmap\portmap.x $(ProjectDir)..\..\portmap\libnfs-raw-portmap.x
+rpcgen.exe -h $(ProjectDir)..\..\portmap\libnfs-raw-portmap.x > $(ProjectDir)..\..\portmap\libnfs-raw-portmap.h
+rpcgen.exe -c $(ProjectDir)..\..\portmap\libnfs-raw-portmap.x > $(ProjectDir)..\..\portmap\libnfs-raw-portmap.c
+
+copy $(ProjectDir)..\..\mount\mount.x $(ProjectDir)..\..\mount\libnfs-raw-mount.x
+rpcgen.exe -h $(ProjectDir)..\..\mount\libnfs-raw-mount.x > $(ProjectDir)..\..\mount\libnfs-raw-mount.h
+rpcgen.exe -c $(ProjectDir)..\..\mount\libnfs-raw-mount.x > $(ProjectDir)..\..\mount\libnfs-raw-mount.c</Command>
+ </PreBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\lib\init.c" />
+ <ClCompile Include="..\..\lib\libnfs-sync.c" />
+ <ClCompile Include="..\..\lib\libnfs.c" />
+ <ClCompile Include="..\..\lib\pdu.c" />
+ <ClCompile Include="..\..\lib\socket.c" />
+ <ClCompile Include="..\..\mount\libnfs-raw-mount.c" />
+ <ClCompile Include="..\..\mount\mount.c" />
+ <ClCompile Include="..\..\nfs\libnfs-raw-nfs.c" />
+ <ClCompile Include="..\..\nfs\nfs.c" />
+ <ClCompile Include="..\..\nfs\nfsacl.c" />
+ <ClCompile Include="..\..\portmap\libnfs-raw-portmap.c" />
+ <ClCompile Include="..\..\portmap\portmap.c" />
+ <ClCompile Include="..\..\rquota\libnfs-raw-rquota.c" />
+ <ClCompile Include="..\..\rquota\rquota.c" />
+ <ClCompile Include="..\win32_compat.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\mount\libnfs-raw-mount.h" />
+ <ClInclude Include="..\..\nfs\libnfs-raw-nfs.h" />
+ <ClInclude Include="..\..\portmap\libnfs-raw-portmap.h" />
+ <ClInclude Include="..\..\rquota\libnfs-raw-rquota.h" />
+ <ClInclude Include="..\win32_compat.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\lib\libnfs-win32.def" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\nfs\libnfs-raw-nfs.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\nfs\nfs.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\nfs\nfsacl.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\rquota\libnfs-raw-rquota.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\rquota\rquota.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\portmap\libnfs-raw-portmap.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\portmap\portmap.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\mount\libnfs-raw-mount.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\mount\mount.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\lib\init.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\lib\libnfs.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\lib\libnfs-sync.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\lib\pdu.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\lib\socket.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\win32_compat.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\nfs\libnfs-raw-nfs.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\rquota\libnfs-raw-rquota.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\portmap\libnfs-raw-portmap.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\mount\libnfs-raw-mount.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\win32_compat.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\lib\libnfs-win32.def" />
+ </ItemGroup>
+</Project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{B907AC9A-50C5-4E43-97C3-27DC7241F6C5}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>nfsclientsync</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <LibraryPath>..\libnfs\Debug;..\..\..\oncrpc-win32\win32\bin;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib</LibraryPath>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <LibraryPath>..\libnfs\Release;..\..\..\oncrpc-win32\win32\bin;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib</LibraryPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_U_=;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\..\oncrpc-win32\win32\include;..\..\include;..\..\.;..\..\win32;..\..\mount;..\..\nfs</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies>libnfs.lib;oncrpc.lib;WS2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ <ProjectReference>
+ <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_U_=;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\..\oncrpc-win32\win32\include;..\..\include;..\..\.;..\..\win32;..\..\mount;..\..\nfs</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>libnfs.lib;oncrpc.lib;WS2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\examples\nfsclient-sync.c" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\examples\nfsclient-sync.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file
--- /dev/null
+/*
+Copyright (c) 2006 by Dan Kennedy.
+Copyright (c) 2006 by Juliusz Chroboczek.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#ifndef WIN32
+
+static int dummy ATTRIBUTE((unused));
+
+#else
+#include "win32_compat.h"
+#include <errno.h>
+#include <stdio.h>
+#include < time.h >
+
+#undef poll
+#undef socket
+#undef connect
+#undef accept
+#undef shutdown
+#undef getpeername
+#undef sleep
+#undef inet_aton
+#undef gettimeofday
+#undef stat
+#define assert(a)
+
+/* Windows needs this header file for the implementation of inet_aton() */
+#include <ctype.h>
+
+int win32_inet_pton(int af, const char * src, void * dst)
+{
+ struct sockaddr_in sa;
+ int len = sizeof(SOCKADDR);
+ int ret = -1;
+ int strLen = strlen(src) + 1;
+#ifdef UNICODE
+ wchar_t *srcNonConst = (wchar_t *)malloc(strLen*sizeof(wchar_t));
+ memset(srcNonConst, 0, strLen);
+ MultiByteToWideChar(CP_ACP, 0, src, -1, srcNonConst, strLen);
+#else
+ char *srcNonConst = (char *)malloc(strLen);
+ memset(srcNonConst, 0, strLen);
+ strncpy(srcNonConst, src, strLen);
+#endif
+
+ if( WSAStringToAddress(srcNonConst,af,NULL,(LPSOCKADDR)&sa,&len) == 0 )
+ {
+ ret = 1;
+ }
+ else
+ {
+ if( WSAGetLastError() == WSAEINVAL )
+ {
+ ret = -1;
+ }
+ }
+ free(srcNonConst);
+ memcpy(dst, &sa.sin_addr, sizeof(struct in_addr));
+ return ret;
+}
+
+int win32_poll(struct pollfd *fds, unsigned int nfds, int timo)
+{
+ struct timeval timeout, *toptr;
+ fd_set ifds, ofds, efds, *ip, *op;
+ unsigned int i;
+ int rc;
+
+ // Set up the file-descriptor sets in ifds, ofds and efds.
+ FD_ZERO(&ifds);
+ FD_ZERO(&ofds);
+ FD_ZERO(&efds);
+ for (i = 0, op = ip = 0; i < nfds; ++i)
+ {
+ fds[i].revents = 0;
+ if(fds[i].events & (POLLIN|POLLPRI))
+ {
+ ip = &ifds;
+ FD_SET(fds[i].fd, ip);
+ }
+ if(fds[i].events & POLLOUT)
+ {
+ op = &ofds;
+ FD_SET(fds[i].fd, op);
+ }
+ FD_SET(fds[i].fd, &efds);
+ }
+
+ // Set up the timeval structure for the timeout parameter
+ if(timo < 0)
+ {
+ toptr = 0;
+ }
+ else
+ {
+ toptr = &timeout;
+ timeout.tv_sec = timo / 1000;
+ timeout.tv_usec = (timo - timeout.tv_sec * 1000) * 1000;
+ }
+
+#ifdef DEBUG_POLL
+ printf("Entering select() sec=%ld usec=%ld ip=%lx op=%lx\n",
+ (long)timeout.tv_sec, (long)timeout.tv_usec, (long)ip, (long)op);
+#endif
+ rc = select(0, ip, op, &efds, toptr);
+#ifdef DEBUG_POLL
+ printf("Exiting select rc=%d\n", rc);
+#endif
+
+ if(rc <= 0)
+ return rc;
+
+ if(rc > 0)
+ {
+ for (i = 0; i < nfds; ++i)
+ {
+ int fd = fds[i].fd;
+ if(fds[i].events & (POLLIN|POLLPRI) && FD_ISSET(fd, &ifds))
+ fds[i].revents |= POLLIN;
+ if(fds[i].events & POLLOUT && FD_ISSET(fd, &ofds))
+ fds[i].revents |= POLLOUT;
+ if(FD_ISSET(fd, &efds)) // Some error was detected ... should be some way to know.
+ fds[i].revents |= POLLHUP;
+#ifdef DEBUG_POLL
+ printf("%d %d %d revent = %x\n",
+ FD_ISSET(fd, &ifds), FD_ISSET(fd, &ofds), FD_ISSET(fd, &efds),
+ fds[i].revents
+ );
+#endif
+ }
+ }
+ return rc;
+}
+
+#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
+ #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
+#else
+ #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
+#endif
+
+struct timezone
+{
+ int tz_minuteswest; /* minutes W of Greenwich */
+ int tz_dsttime; /* type of dst correction */
+};
+
+int win32_gettimeofday(struct timeval *tv, struct timezone *tz)
+{
+ FILETIME ft;
+ unsigned __int64 tmpres = 0;
+ static int tzflag;
+
+ if (NULL != tv)
+ {
+ GetSystemTimeAsFileTime(&ft);
+
+ tmpres |= ft.dwHighDateTime;
+ tmpres <<= 32;
+ tmpres |= ft.dwLowDateTime;
+
+ /*converting file time to unix epoch*/
+ tmpres -= DELTA_EPOCH_IN_MICROSECS;
+ tmpres /= 10; /*convert into microseconds*/
+ tv->tv_sec = (long)(tmpres / 1000000UL);
+ tv->tv_usec = (long)(tmpres % 1000000UL);
+ }
+
+ if (NULL != tz)
+ {
+ if (!tzflag)
+ {
+ _tzset();
+ tzflag++;
+ }
+ tz->tz_minuteswest = _timezone / 60;
+ tz->tz_dsttime = _daylight;
+ }
+
+ return 0;
+}
+
+#endif
--- /dev/null
+/*
+Copyright (c) 2006 by Dan Kennedy.
+Copyright (c) 2006 by Juliusz Chroboczek.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+/*Adaptions by memphiz@xbmc.org*/
+
+#ifdef WIN32
+#ifndef win32_COMPAT_H_
+#define win32_COMPAT_H_
+#define NO_IPv6 1
+
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#include <Ws2ipdef.h>
+#include <basetsd.h>
+#include <io.h>
+#include <sys/stat.h>
+
+typedef int uid_t;
+typedef int gid_t;
+typedef int socklen_t;
+
+#define S_IRUSR 0000400
+#define S_IWUSR 0000200
+#define S_IXUSR 0000100
+#define S_IRWXG 0000070 /* RWX mask for group */
+#define S_IRGRP 0000040
+#define S_IWGRP 0000020
+#define S_IXGRP 0000010
+#define S_IRWXO 0000007 /* RWX mask for other */
+#define S_IROTH 0000004
+#define S_IWOTH 0000002
+#define S_IXOTH 0000001
+
+#define F_GETFL 3
+#define F_SETFL 4
+
+#define O_NONBLOCK 0x40000000
+#define O_SYNC 0
+
+#define MSG_DONTWAIT 0
+#define ssize_t SSIZE_T
+
+#define POLLIN 0x0001 /* There is data to read */
+#define POLLPRI 0x0002 /* There is urgent data to read */
+#define POLLOUT 0x0004 /* Writing now will not block */
+#define POLLERR 0x0008 /* Error condition */
+#define POLLHUP 0x0010 /* Hung up */
+#define POLLNVAL 0x0020 /* Invalid request: fd not open */
+
+struct pollfd {
+ SOCKET fd; /* file descriptor */
+ short events; /* requested events */
+ short revents; /* returned events */
+};
+
+/* Wrapper macros to call misc. functions win32 is missing */
+#define poll(x, y, z) win32_poll(x, y, z)
+#define inet_pton(x,y,z) win32_inet_pton(x,y,z)
+int win32_inet_pton(int af, const char * src, void * dst);
+int win32_poll(struct pollfd *fds, unsigned int nfsd, int timeout);
+int win32_gettimeofday(struct timeval *tv, struct timezone *tz);
+
+#endif//win32_COMPAT_H_
+#endif//WIN32
--- /dev/null
+#ifndef WIN32_ERRNOWRAPPER_H_
+#define WIN32_ERRNOWRAPPER_H_
+
+#undef errno
+#define errno WSAGetLastError()
+#undef EAGAIN
+#undef EWOULDBLOCK
+#undef EINTR
+#undef EINPROGRESS
+
+#define EWOULDBLOCK WSAEWOULDBLOCK
+#define EAGAIN WSAEWOULDBLOCK //same on windows
+#define EINTR WSAEINTR
+#define EINPROGRESS WSAEINPROGRESS
+#endif //WIN32_ERRNOWRAPPER_H_
--- /dev/null
+rem build script for win32
+rem set the
+rem
+
+rem EDIT THESE
+set ONCRPC_BASE_DIR=C:\MinGW\msys\1.0\home\Administrator\src\oncrpc-win32\
+set LIBNFS_BASE_DIR=..
+rem END EDIT
+
+set RPCINCLUDE="%ONCRPC_BASE_DIR%\win32\include"
+set RPCDLL="%ONCRPC_BASE_DIR%\win32\bin\oncrpc.dll"
+set RPCLIB="%ONCRPC_BASE_DIR%\win32\bin\oncrpc.lib"
+set RPCGEN="%ONCRPC_BASE_DIR%\win32\bin\rpcgen.exe"
+
+
+cd %LIBNFS_BASE_DIR%
+
+rem generate NFS from .x
+rem
+copy nfs\nfs.x nfs\libnfs-raw-nfs.x
+%RPCGEN% -h nfs\libnfs-raw-nfs.x > nfs\libnfs-raw-nfs.h
+%RPCGEN% -c nfs\libnfs-raw-nfs.x > nfs\libnfs-raw-nfs.c
+cl /I. /Iinclude /Iwin32 /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0501 -MDd nfs\libnfs-raw-nfs.c -Fonfs\libnfs-raw-nfs.obj
+cl /I. /Iinclude /Iwin32 /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0501 -MDd nfs\nfs.c -Fonfs\nfs.obj
+cl /I. /Iinclude /Iwin32 /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0501 -MDd nfs\nfsacl.c -Fonfs\nfsacl.obj
+
+
+
+rem
+rem generate RQUOTA from .x
+rem
+copy rquota\rquota.x rquota\libnfs-raw-rquota.x
+%RPCGEN% -h rquota\libnfs-raw-rquota.x > rquota\libnfs-raw-rquota.h
+%RPCGEN% -c rquota\libnfs-raw-rquota.x > rquota\libnfs-raw-rquota.c
+cl /I. /Iinclude /Iwin32 /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0501 -MDd rquota\libnfs-raw-rquota.c -Forquota\libnfs-raw-rquota.obj
+cl /I. /Iinclude /Iwin32 /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0501 -MDd rquota\rquota.c -Forquota\rquota.obj
+
+
+
+rem
+rem generate PORTMAP from .x
+rem
+copy portmap\portmap.x portmap\libnfs-raw-portmap.x
+%RPCGEN% -h portmap\libnfs-raw-portmap.x > portmap\libnfs-raw-portmap.h
+%RPCGEN% -c portmap\libnfs-raw-portmap.x > portmap\libnfs-raw-portmap.c
+cl /I. /Iinclude /Iwin32 /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0501 -MDd portmap\libnfs-raw-portmap.c -Foportmap\libnfs-raw-portmap.obj
+cl /I. /Iinclude /Iwin32 /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0501 -MDd portmap\portmap.c -Foportmap\portmap.obj
+
+
+rem
+rem generate MOUNT from .x
+rem
+copy mount\mount.x mount\libnfs-raw-mount.x
+%RPCGEN% -h mount\libnfs-raw-mount.x > mount\libnfs-raw-mount.h
+%RPCGEN% -c mount\libnfs-raw-mount.x > mount\libnfs-raw-mount.c
+cl /I. /Iinclude /Iwin32 /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0501 -MDd mount\libnfs-raw-mount.c -Fomount\libnfs-raw-mount.obj
+cl /I. /Iinclude /Iwin32 /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0501 -MDd mount\mount.c -Fomount\mount.obj
+
+
+
+rem
+rem generate core part of library
+rem
+cl /I. /Iinclude /Iwin32 /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0501 -MDd lib\init.c -Folib\init.obj
+cl /I. /Iinclude /Iwin32 /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0501 -MDd -D_U_="" lib\pdu.c -Folib\pdu.obj
+cl /I. /Iinclude /Iwin32 /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0501 -MDd -D_U_="" lib\socket.c -Folib\socket.obj
+cl /I. /Iinclude /Iwin32 /I%RPCINCLUDE% /Imount /Infs -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0501 -MDd -D_U_="" lib\libnfs.c -Folib\libnfs.obj
+cl /I. /Iinclude /Iwin32 /I%RPCINCLUDE% /Imount /Infs -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0501 -MDd -D_U_="" lib\libnfs-sync.c -Folib\libnfs-sync.obj
+
+rem
+rem generate win32 compat layer
+rem
+cl /I. -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0501 -MDd -D_U_="" win32\win32_compat.c -Fowin32\win32_compat.obj
+
+
+
+rem
+rem create a linklibrary/dll
+rem
+lib /out:lib\libnfs.lib /def:lib\libnfs-win32.def nfs\nfs.obj nfs\nfsacl.obj nfs\libnfs-raw-nfs.obj rquota\rquota.obj rquota\libnfs-raw-rquota.obj mount\mount.obj mount\libnfs-raw-mount.obj portmap\portmap.obj portmap\libnfs-raw-portmap.obj lib\init.obj lib\pdu.obj lib\socket.obj lib\libnfs.obj lib\libnfs-sync.obj win32\win32_compat.obj
+
+link /DLL /out:lib\libnfs.dll /DEBUG /DEBUGTYPE:cv lib\libnfs.exp nfs\nfs.obj nfs\nfsacl.obj nfs\libnfs-raw-nfs.obj rquota\rquota.obj rquota\libnfs-raw-rquota.obj mount\mount.obj mount\libnfs-raw-mount.obj portmap\portmap.obj portmap\libnfs-raw-portmap.obj lib\init.obj lib\pdu.obj lib\socket.obj lib\libnfs.obj lib\libnfs-sync.obj win32\win32_compat.obj %RPCLIB% ws2_32.lib
+
+
+
+rem
+rem build a test application
+rem
+cl /I. /Iinclude /Iwin32 /I%RPCINCLUDE% /Imount /Infs -Zi -Od -DWIN32 -D_WIN32_WINNT=0x0501 -MDd -D_U_="" examples\nfsclient-sync.c lib\libnfs.lib %RPCLIB% WS2_32.lib kernel32.lib mswsock.lib advapi32.lib wsock32.lib advapi32.lib
+
+
+
+
+
+
+
+
--- /dev/null
+rem build script for win32\r
+rem set the \r
+rem\r
+\r
+rem EDIT THESE\r
+set RPCINCLUDE="C:\...where my rpc includes live...\include"\r
+set RPCDLL="C:\...where my rpc DLL can be found...\rpc.dll"\r
+set RPCLIB="C:\...where my rpc link library can be found...\rpc.lib"\r
+set RPCGEN="C:\...where my rpcgen executable lives...\rpcgen.exe"\r
+\r
+\r
+\r
+rem generate NFS from .x\r
+rem\r
+copy nfs\nfs.x nfs\libnfs-raw-nfs.x\r
+%RPCGEN% -h nfs\libnfs-raw-nfs.x > nfs\libnfs-raw-nfs.h\r
+%RPCGEN% -c nfs\libnfs-raw-nfs.x > nfs\libnfs-raw-nfs.c\r
+cl /I. /Iinclude /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0600 -MDd nfs\libnfs-raw-nfs.c -Fonfs\libnfs-raw-nfs.obj\r
+cl /I. /Iinclude /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0600 -MDd nfs\nfs.c -Fonfs\nfs.obj\r
+cl /I. /Iinclude /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0600 -MDd nfs\nfsacl.c -Fonfs\nfsacl.obj\r
+\r
+\r
+\r
+rem\r
+rem generate RQUOTA from .x\r
+rem\r
+copy rquota\rquota.x rquota\libnfs-raw-rquota.x\r
+%RPCGEN% -h rquota\libnfs-raw-rquota.x > rquota\libnfs-raw-rquota.h\r
+%RPCGEN% -c rquota\libnfs-raw-rquota.x > rquota\libnfs-raw-rquota.c\r
+cl /I. /Iinclude /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0600 -MDd rquota\libnfs-raw-rquota.c -Forquota\libnfs-raw-rquota.obj\r
+cl /I. /Iinclude /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0600 -MDd rquota\rquota.c -Forquota\rquota.obj\r
+\r
+\r
+\r
+rem\r
+rem generate PORTMAP from .x\r
+rem\r
+copy portmap\portmap.x portmap\libnfs-raw-portmap.x\r
+%RPCGEN% -h portmap\libnfs-raw-portmap.x > portmap\libnfs-raw-portmap.h\r
+%RPCGEN% -c portmap\libnfs-raw-portmap.x > portmap\libnfs-raw-portmap.c\r
+cl /I. /Iinclude /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0600 -MDd portmap\libnfs-raw-portmap.c -Foportmap\libnfs-raw-portmap.obj\r
+cl /I. /Iinclude /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0600 -MDd portmap\portmap.c -Foportmap\portmap.obj\r
+\r
+\r
+rem\r
+rem generate MOUNT from .x\r
+rem\r
+copy mount\mount.x mount\libnfs-raw-mount.x\r
+%RPCGEN% -h mount\libnfs-raw-mount.x > mount\libnfs-raw-mount.h\r
+%RPCGEN% -c mount\libnfs-raw-mount.x > mount\libnfs-raw-mount.c\r
+cl /I. /Iinclude /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0600 -MDd mount\libnfs-raw-mount.c -Fomount\libnfs-raw-mount.obj\r
+cl /I. /Iinclude /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0600 -MDd mount\mount.c -Fomount\mount.obj\r
+\r
+\r
+\r
+rem\r
+rem generate core part of library\r
+rem\r
+cl /I. /Iinclude /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0600 -MDd lib\init.c -Folib\init.obj\r
+cl /I. /Iinclude /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0600 -MDd -D_U_="" lib\pdu.c -Folib\pdu.obj\r
+cl /I. /Iinclude /I%RPCINCLUDE% -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0600 -MDd -D_U_="" lib\socket.c -Folib\socket.obj\r
+cl /I. /Iinclude /I%RPCINCLUDE% /Imount /Infs -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0600 -MDd -D_U_="" lib\libnfs.c -Folib\libnfs.obj\r
+cl /I. /Iinclude /I%RPCINCLUDE% /Imount /Infs -Zi -Od -c -DWIN32 -D_WIN32_WINNT=0x0600 -MDd -D_U_="" lib\libnfs-sync.c -Folib\libnfs-sync.obj\r
+\r
+\r
+\r
+rem\r
+rem create a linklibrary/dll\r
+rem\r
+lib /out:lib\libnfs.lib /def:lib\libnfs-win32.def nfs\nfs.obj nfs\nfsacl.obj nfs\libnfs-raw-nfs.obj rquota\rquota.obj rquota\libnfs-raw-rquota.obj mount\mount.obj mount\libnfs-raw-mount.obj portmap\portmap.obj portmap\libnfs-raw-portmap.obj lib\init.obj lib\pdu.obj lib\socket.obj lib\libnfs.obj lib\libnfs-sync.obj\r
+\r
+link /DLL /out:lib\libnfs.dll /DEBUG /DEBUGTYPE:cv lib\libnfs.exp nfs\nfs.obj nfs\nfsacl.obj nfs\libnfs-raw-nfs.obj rquota\rquota.obj rquota\libnfs-raw-rquota.obj mount\mount.obj mount\libnfs-raw-mount.obj portmap\portmap.obj portmap\libnfs-raw-portmap.obj lib\init.obj lib\pdu.obj lib\socket.obj lib\libnfs.obj lib\libnfs-sync.obj %RPCLIB% ws2_32.lib\r
+\r
+\r
+\r
+rem\r
+rem build a test application\r
+rem\r
+cl /I. /Iinclude /I%RPCINCLUDE% /Imount /Infs -Zi -Od -DWIN32 -D_WIN32_WINNT=0x0600 -MDd -D_U_="" examples\nfsclient-sync.c lib\libnfs.lib %RPCLIB% WS2_32.lib kernel32.lib mswsock.lib advapi32.lib wsock32.lib advapi32.lib\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r