Commit Graph

92 Commits (master)

Author SHA1 Message Date
Ronnie Sahlberg 2772c70be6 New version 5.0.1
Fixes non-pthread build

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2022-02-01 03:31:37 +10:00
Ronnie Sahlberg c33e0c3825 configure.ac: fix typo for ENABLE_PTHREAD
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2022-01-29 13:30:51 +10:00
Ronnie Sahlberg a48f019e05 New version 5.0.0
Multithread support for Linux and Windows
Fix NFS4 behavior of chmod/chown/utimes
Add marshalling / unmarshalling of various NFSv4.1 structures (but not 4.1 support)
PS3 support
PS2 EE support
Support escaped characters in the URL
Fix MINGW build

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2022-01-28 10:50:38 +10:00
Ronnie Sahlberg f55637619e initial pthread support
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-10-14 16:31:26 +10:00
Ronnie Sahlberg 030814506e new version 4.0.0
Fix the versioning in makerpms.sh
Fix some compile issues in the test programs.
NFSv3: skip commit on close if the file has not been written to.
Add nfs_umount() to NFSv3
Add nfs_statvfs64()
Fix invalid shift of pid_t when generating rpc->xid
Compile fixes for Mac OSX
Fix for dup2() on Windows
NFSv4 fix for directory handling
Improvements to configure/bulding

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2019-02-13 07:38:04 +10:00
Lars Wendler 5a5a5c1e70
configure.ac: fix --enable-utils
Running "configure --enable-utils" _disables_ compilation/installation of
utils (and vice versa) while omitting the --(en|dis)able-utils option auto-
enables utils.
This patch fixes the logic when the option is given on command line but
keeps utils build enabled when the option was omitted.
2018-07-06 11:54:54 +02:00
Ronnie Sahlberg 695ac3b77b New version: 3.0.0
NFSv4 support.
lockf() support (NFSv4 only).
fcntl() support for locking (NFSv4 only).
Add CMake support.
URL arguments to select NFS version.
URL argument to set nfsport. This allows NFSv4 to work for
 servers without portmapper support.
URL argument to set he mount port.
NFSv4: use getpwnam to map NFSv4 (Ganesha) when passing uid/gid
 as a user/group name insead of as a uid/gid.
Added nfs-fh: a simle utility to print the filehandle for a nfs file.
Win32 build fixes.
Add a new open2() function that takes a mode argument.
Add a testsuite for libnfs.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-06-24 08:53:52 +10:00
Daniel Abrecht 24ca14101f The check for getpwnam wrongly succeeded on some systems.
It didn't fail if pwd.h is missing because #includes must be seperated with a newline, a comma won't work.
The compile works anyway because the "struct passwd *pwd" implicitly declares an anonymus struct type "passwd"
and using an undeclared function is an implicit function declaration. Here's the output of configure in that case:

  configure:13381: checking whether getpwnam() is available
  configure:13396: i686-w64-mingw32-gcc -c -I/home/daniel/fsetmp/dokany/src/dokan_fuse/include/  -I/home/daniel/fsetmp/dokany/src/dokan_fuse/include/  conftest.c >&5
  conftest.c:23:23: warning: extra tokens at end of #include directive
   #include <sys/types.h>, #include <pwd.h>
                         ^
  conftest.c: In function 'main':
  conftest.c:28:30: warning: implicit declaration of function 'getpwnam' [-Wimplicit-function-declaration]
           struct passwd *pwd = getpwnam("nobody");
                                ^~~~~~~~
  conftest.c:28:30: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
  configure:13396: $? = 0
  configure:13403: result: yes
2018-04-07 16:40:44 +00:00
Ronnie Sahlberg c5eca214fc add conditional support for getpwnam()
Some nfsv4 servers return a user/group name in the attributes instead
of a uid/gid number. At least for the "nobody" user.

For those, try to use getpwnam() where available to map the string back
to a uid/gid or return uid/gid==65534 (common value for nobody)
if not available or failing.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-02-16 08:24:26 +10:00
Ronnie Sahlberg bbf38735d8 TESTS: Initial test directory.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-06-16 13:14:31 -07:00
Ronnie Sahlberg d3af23322a New version : 2.0.0
The main changes since 1.11.0:

BUGS
====
Fix NULL pointer crash in nfs_link().

Clamp read/write size for servers (Ganesha) that offer very large io sizes
instead of failing to connect to the export.

Tell the server to commit all data to stable storage when we close files.

Double free fix: don't call rpc_free_pdu() after rpc_queue_pdu() failure.

Fix for memory leak in rpc_allocate_*().

Fixes to build nfs-ls and nfs-cp on win32.

Abort the mount process correctly if MOUNT/MNT returns error or is cancelled.

Fix memory leak in error path in nfs_create_2_cb().

Fix leak of rpc->inbuf if we destroy the context while we still have PDUs
in flight.

FEATURES
========
Add O_NOFOLLOW support for nfs_open()

Add a new mkdir2 command that also takes a mode argument.

Add a new readlink2 command that avoids having to preallocate the buffer.

Add support for RPC timeouts for both the sync and async interfaces.

Build fixes for Mingw and Cygwin

Update README to document two new Windows builds

Use SOCK_CLOEXEC for the sockets

Make rpc_set{g|u}id() public

Performance optimization: socket: Batch pdu read in rpc_read_from_socket

Low level support for NFSv4 and some examples

Support for building RPC servers

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-06-16 12:48:10 -07:00
Ronnie Sahlberg 2db0878396 Use clock_gettime(CLOCK_MONOTONIC_COARSE) if/when available
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-10 18:11:00 -07:00
Ronnie Sahlberg 5b28ab5d53 Include sys/sysmacros.h on platforms that have it
This addresses issue 202

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-09 14:30:14 -07:00
Bill Zissimopoulos e35a44e2bf Cygwin should not use winsock2.
The configure.ac script was erroneously including -lws2_32,
i.e. the winsock2 library. Cygwin is a full POSIX environment
and does not need the winsock2 functionality as it supplies its
own POSIX compatible sockets.

Including -lws2_32 caused getnameinfo to fail with error 10093
(WSANOTINITIALISED). This usually means that the Winsock
WSAStartup function has not been called. Calling WSAStartup is
not necessary for Cygwin programs and in fact should be avoided.
2017-03-25 11:43:54 -07:00
Daniel Abrecht 50bf03bc66 Some changes to resolve conflicts with dokan_fuse 2017-02-26 18:14:37 +00:00
Max Kellermann 3ef8675c6f configure.ac: avoid AC_TRY_RUN
Those tests are compile-time and link-time checks, and running the
resulting programs is not needed or even helpful.  This fixes the
Windows cross-build, which previously failed because SO_BINDTODEVICE
was assumed to be available.
2017-02-10 23:43:15 +01:00
Max Kellermann f51769792a configure.ac: remove GLIB_CFLAGS and GLIB_LIBS
What is this?  Maybe fallout from a copy'n'paste orgy?
2017-02-10 23:42:37 +01:00
Max Kellermann a027637cf6 configure.ac: use AC_SYS_LARGEFILE
Let autoconf in all its wisdom decide what needs to be done for large
file support.  Hard-coding it to _FILE_OFFSET_BITS=64 is fragile.
2017-02-09 12:52:22 +01:00
Ronnie Sahlberg 0a4f9cd8a8 EXAMPLE: nfs4-cat-talloc
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-12-17 17:42:35 -08:00
Ronnie Sahlberg 853474d387 Add NFSv4 protocol definitions
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-12-17 10:44:12 -08:00
Ronnie Sahlberg 2edbd14779 New version 1.11.0
- Reduce the number of memory allocations in the ZDR layer.
 - Check both seconds and nanoseconds field when validating dir cache.
 - Invalidate the dir cache immediately if we do something that would cause
   it to become stale, such as adding/removing objects from the cache.
 - Add options to enable/disable dir caching.
 - Discard readahead cache on [p]write and truncate.
 - Android fixes
 - Windows fixes
 - Support timeouts for sync functions
 - Add an internal pagecache
 - Add nfs_rewinddir(), nfs_seekdir() and nfs_telldir()
 - Fix crash in nfs_truncate()
 - Fix segfault that can trigger if we rpc_disconnect() during the mount.
 - Add support to bind to a specific interface (linux only)

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-10-09 11:23:11 -07:00
Chris 5f75307a36 Added the ability to bind to a specific interface with the
`nfs_set_interface` and `rpc_set_interface` APIs, or via the
NFS URL `if=<interface>` parameter. This feature requires
`root` permissions.

NOTE: This has only been compiled and tested on Ubuntu 14.04. It's
unlikely that it'll work on other platforms without modification,
particularly around the inclusion of <net/if.h> and IFNAMSIZ define
in `libnfs-private.h`.
2016-09-19 18:31:49 -07:00
Peter Lieven 77d592c8e9 configure.ac: really build with -Werror by default
Signed-off-by: Peter Lieven <pl@kamp.de>
2016-05-13 10:38:45 +02:00
Ronnie Sahlberg 04363a9274 New version 1.10.0
The biggest changes in this release are:
 - Fix a leak where we leaked one rdpe_cb_data structure on each open_dir()
 - Make building the utils optional
 - Android: the correct define is __ANDROID__ not ANDROID
 - Win32: Use _U_ instead of ATTRIBURE((unused))
 - Win32: Fix nfs_stat declaration for Win32
 - Various fixes for mingw builds
 - Make rpc->connect_cb a one shot callback and improve documentation
 - Remove the FUSE module. It now lives in its own repo
 - Fix POLLERR/POLLHUP handling to properly handle session failures and to
   try to auto-reconnect

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-01-31 16:06:44 -08:00
Ronnie Sahlberg 66876e2879 Merge pull request #131 from jbkempf/win32_mingw
Support Win32 compilation with Mingw
2016-01-16 08:51:31 -08:00
Felix Paul Kühne 0dc008ab93 Add a configure option to disable the utils compilation
For some targets like iOS, utils are not useable, so it should be possible to disable their compilation
2016-01-14 17:02:53 +01:00
Diego Elio Pettenò 7744df2c76 build: enable subdir-objects option to make sure that source files are built where expected. 2016-01-08 23:43:06 +01:00
Jean-Baptiste Kempf 3c37d03f4b Win32: do not compile nfs-cp in utils
It depends on stat features that are not available
2016-01-08 23:23:00 +01:00
Jean-Baptiste Kempf cd53647f53 Win32: link utils with winsock2 2016-01-08 23:23:00 +01:00
Ronnie Sahlberg 8f06fc9d92 New version 1.9.8
- Disable multithreading in fuse_nfs
- Add -Wall and -Werror compiler flags (and fix issues found by it)
- Add nfs-cat utility
- Switch to using nfs_[f]stat64 instead of the deprecated nfs_[f]stat call
  in all examples
- If the server does not return any atttributes for entries in READDIRPLUS
  then try to fetch them using lookup instead.
- Reconnection fixes
- Enforce the max pdu size and add sanity checks when reading PDUs from
  the socket.
- Stop using ioctl(FIONREAD) to find out how many bytes to read, and treat
  0 as an indication of a problem. Some applications call their POLLIN handlers
  spuriosly even when there is no data to read, which breaks this check in
  libnfs.
- Add basic support to do logging.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-08-02 10:18:25 -07:00
Ronnie Sahlberg 617cfba5b5 configure is hard. now it looks like --enable-werror works
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-03-11 21:22:43 -07:00
Ronnie Sahlberg d01e75de8a configure: only add -Werror id --enable-werror is used
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-03-11 20:32:04 -07:00
Ronnie Sahlberg 84607f4821 Add -Wall -Werror and friends
Update the configure to add some sanity -W arguments.
A good start is probably :
  -Wall -Werror -Wshadow -Wno-write-strings -Wstrict-prototypes
  -Wpointer-arith -Wcast-align -Wno-strict-aliasing

Fixup the paces in the code that triggers.
(one of which is readahead code which is perhaps broken?)

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-03-10 21:06:38 -07:00
Ronnie Sahlberg e775160243 new version 1.9.7
- Auto-traverse mounts. With this option (default to on) libnfs will
   autodiscover and handle any nested submounts.
 - Remove nfs_get_current_offset. Applications should use seek instead of this function.
 - Add umask() support.
 - Change set_tcp_sockopt() to be static.
 - Android fix for nfs-ls
 - Make S_IFLNK available on windows.
 - Fix a use after free.
 - Fix a bug where truncate() treated offset as 32bit.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-02-09 19:16:56 -08:00
Ronnie Sahlberg 080d231129 New version 1.9.6
- Add O_TRUNC support for nfs_create
 - Handle OOM during create
 - Return more stats fields as part of readdir since we get these for "free"
   when we use READDIRPLUS
 - Follow symlinks during path resolution
 - Add lchown, lstat and lutimes
 - Replace all [u_]quad types with [u]int types in our RPC layer
 - Solaris build fixes

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-11-25 06:47:55 -08:00
Ronnie Sahlberg 5fe97d1088 solaris: we need -lsocket and -lnsl for all builds not just examples
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-08-16 16:17:06 -07:00
Ross Lagerwall fc08ac459c libnfs: Set as much stat information as possible
Set as much stat information as possible for stat, stat64, fstat and
readdir.

Fill in dev to the given fsid.
Fill in rdev to the given major and minor numbers.
Set the file type bits in the mode from the type returned by the server.
Set the number of blocks used based on the number of bytes used in
blocks of size 512 (which is what stat(2) uses), rounded up.
Fill in the nanosecond timestamps.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-20 22:06:34 +01:00
Ronnie Sahlberg b9e5039f49 New version 1.9.5
This version removes old ONC-RPC symbols and automatically includes the
RPC/ZDR layer include from the raw low level headers.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-07-19 15:47:35 -07:00
Ronnie Sahlberg 3c769bb1bd New version 1.9.4
New version of libnfs:

- IPv6 support
- Support for Portmapper version 3 and an example portmap client.
- Directory caching top make repeated opendir() calls faster
- Readahead support
- Build manpages for the utilities (==nfs-ls)
- Support for O_APPEND
- Rename the list macros to avoid collission on *BSD

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-06-29 14:57:45 -07:00
Ronnie Sahlberg c7ddf2e5cb NFS-LS: Build nfs-ls as utils and make it install under bin 2014-03-21 18:31:05 -07:00
Ronnie Sahlberg ca3bb55c65 DOC: Add manpage for nfs-ls 2014-03-21 18:15:40 -07:00
Ronnie Sahlberg 7058971155 New version: 1.9.3
Wed Mar 19 2014: Version 1.9.3
 - Add O_TRUNC support to nfs_open()
 - Add a simple but incomplete LD_PRELOAD tool
 - Fixes for some memory leaks and C++ compile support
 - Make ANDROID default uid/gid to 65534
 - Allow the READDIRPLUS emulation to still work if some objects
   in the direcotry can not be lookedup (NFSv4 ACL denying READ-ATTRIBUTES)
 - Have libnfs retry any read/write operations where the server responds
   with a short read/write. Some servers do this when they are overloaded?
2014-03-19 18:12:45 -07:00
Ronnie Sahlberg 0a63cc7258 Remove chdir changes for now. Needs more testing. 2014-01-30 18:30:25 -08:00
Ronnie Sahlberg 1d95217b2f New version 1.9.1
Add back the libnfs-raw-*.h headers to make install
2014-01-28 06:41:31 -08:00
Ronnie Sahlberg 5392b1cfbc New version : 1.9.0
- Use _stat64 on windows so file sizes become 64bit always.
 - Increase default marshalling buffer so we can marshall large PDUs.
 - RPC layer support for NFSv2
 - Win32 updates and fixes
 - Add URL parsing functions and URL argument support.
 - New utility: nfs-io
 - nfs-ls enhancements
 - RPC layer support for NSM
 - Add example FUSE filesystem.
 - Minor fixes.
2014-01-27 20:47:24 -08:00
Peter Lieven d43a8953f5 make adjustments for v6 of the qemu NFS driver
Signed-off-by: Peter Lieven <pl@kamp.de>
2014-01-13 11:22:21 +01:00
Peter Lieven eb2759c62b bump version to 1.8.90
I need this to detect that we have (almost) version 1.9.0 in qemu,
but I think we should do some more testing before releasing 1.9.0.

Signed-off-by: Peter Lieven <pl@kamp.de>
2013-12-26 12:49:28 +01:00
Peter Lieven 1c8b4547ce add tcp-syncnt URL param to adjust TCP_SYNCNT sockopt
This allows indirect support for a configurable connect timeout.

Linux uses a exponential backoff for SYN retries starting
with 1 second.

This means for a value n for TCP_SYNCNT, the connect will
effectively timeout after 2^(n+1)-1 seconds.

Example:
 examples/nfs-ls nfs://10.0.0.1/export?tcp-syncnt=1

Signed-off-by: Peter Lieven <pl@kamp.de>
2013-12-23 14:03:18 +01:00
Ronnie Sahlberg ed09b5676f Initial support for NSM 2013-11-05 17:37:16 -08:00
Ronnie Sahlberg 558aefc736 New version 1.8
Fix nasty memory leak
2013-10-30 18:17:49 -07:00