Commit Graph

95 Commits (65de83140aa6264b75a8cb5eda9e0ba1b1f56b9b)

Author SHA1 Message Date
Ronnie Sahlberg 61e071d448 NFSv4: Add support for nfs_[p]write()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-29 19:52:41 +10:00
Ronnie Sahlberg 5c2d989887 NFSv4: Add support for readlink()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-26 14:26:29 +10:00
Ronnie Sahlberg dce044ab53 NFSv4: Add support for read() and pread()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-26 14:26:29 +10:00
Ronnie Sahlberg 0d9dd0ee44 NFSv4 Add support for nfs_open() nfs_fstat64() nfs_close()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-26 14:26:29 +10:00
Ronnie Sahlberg 4ed461ffee TESTS Add tests for nfs_open()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-04 08:18:13 +10:00
Ronnie Sahlberg 6ea6002e08 Fix nfs_creat() so it works with local directories and add tests
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-03 07:01:07 +10:00
Ronnie Sahlberg 9fdc774bf3 TESTS: add tests for mknod
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-02 12:28:06 +10:00
Ronnie Sahlberg c6ac1b5a14 Make nfs_unlink work for local paths and add tests
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-02 09:31:17 +10:00
Ronnie Sahlberg e1a2f9f5e7 Allow mkdir/rmdir to work for the local directory and add tests
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-02 08:52:36 +10:00
Ronnie Sahlberg 903021ed59 TESTS: Tests and fixes for nfs_rename
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-01 17:10:23 +10:00
Ronnie Sahlberg 9776ca3a95 Merge branch 'nfsv4' 2017-07-01 08:43:23 +10:00
Ronnie Sahlberg db6d0836f4 TESTS: add tests for symlink/readlink
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-01 08:40:59 +10:00
Ronnie Sahlberg 1e01500007 Clear revents before calling poll in the event loops for the sync API.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-06-30 13:55:31 +10:00
Ronnie Sahlberg 0160cbfa39 NFSv4: Rename all V3 specific internal functions from nfs_ to nfs3_
Change all public posix like functions to switch on the protocol version
and call out to the existing functions when NFS v3 is selected.

Rename all internal functions that are v3 specific to have a nfs3_ prefix.

We do not yet have any v4 support but we now have the framework to start plugging it in.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-06-30 13:48:59 +10:00
Ronnie Sahlberg de9e123099 Clear revents before calling poll in the event loops for the sync API.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-06-30 13:48:16 +10:00
Ronnie Sahlberg 3ba14aabc2 Add timeout support in wait_for_nfs_reply
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-06-15 13:16:23 -07:00
Ronnie Sahlberg 128ac2f725 Update the event-loop for sync NFS commands to handle timeouts better.
Change the loop so poll will timeout after 100ms so that we get 100ms
granularity on the timer that drives the timeouts.

Secondly, stop treating poll returning 0 as an error as this will be normal
if an application use sync NOF commands set to >>100ms for the timeout.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-31 21:23:03 -07:00
Ronnie Sahlberg f8ce80d454 Merge branch 'master' into issues-216 2017-05-11 18:30:30 -07:00
Kevin Vigor 4cd723fb7a Fix crash on timed out mount-nfs calls.
If wait_for_nfs_reply() times out, nfs_mount can return with RPCs
still pending. In that case when the RPCs complete (perhaps because
someone calls destroy_context()), the callbacks run, and private_data
is pointing at what was the stack-allocated cb_data structure. Stack
smashing and segfaulty fun ensue.

Fix by ensuring no RPCs are pending before returning from nfs_mount()
by disconnecting on errors.
2017-05-11 15:19:01 -06:00
Earl Chew 5a2afb8872 Deliver poll(2) errors to callbacks when running the sync event loop
Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2017-05-11 07:00:49 -07:00
Ronnie Sahlberg 973d368867 Merge pull request #194 from earlchew/issues-187
nfs_readlink2: Return symlink without incurring ENAMETOOLONG
2017-05-09 14:55:27 -07:00
Earl Chew e74846219a nfs_readlink2: Return symlink without incurring ENAMETOOLONG
Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2017-05-08 21:56:50 -07:00
Earl Chew e788078e20 Revert "nfs_readlink2: Return symlink without incurring ENAMETOOLONG"
This reverts commit 1af36b4c77.

Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2017-05-08 21:55:54 -07:00
Ronnie Sahlberg 2589086ce5 Merge pull request #193 from earlchew/issues-189
nfs_mkdir2: Include permissions when creating a new directory
2017-05-08 20:52:55 -07:00
Earl Chew 1af36b4c77 nfs_readlink2: Return symlink without incurring ENAMETOOLONG
Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2017-05-05 07:57:28 -07:00
Earl Chew adcfda60fa nfs_mkdir2: Include permissions when creating a new directory
Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2017-05-05 07:55:09 -07:00
Ronnie Sahlberg 24064e96d2 Add example util for nfs_link()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-02 17:36:27 -07:00
Max Kellermann 03ac15de5e Allow passing void* buffers, and make write buffers const
Enables callers to pass any opaque data chunk without having to cast
it explicitly.

A write never modifies the source buffer, and thus the pointer should
be const.

Signed-off-by: Max Kellermann <max.kellermann@gmail.com>
2017-02-03 19:42:12 +01:00
Peter Lieven 5a660d5afc libnfs-sync: make send_nfsd_probes portable
Signed-off-by: Peter Lieven <pl@kamp.de>
2016-05-31 12:03:10 +02:00
Ronnie Sahlberg 3c26ce1e6b Merge pull request #143 from jbkempf/android_ndk_statvfs
Android: only redefine statvfs if it is not already defined
2016-03-14 19:16:28 -07:00
Kuldeep Kumar 83d1005c6b sync apis with timeout values
Add support to timeout sync functions.
Add a field to the rpc context to specify the timeout for functions.
Currently only sync functions support a timeout.
2016-03-14 19:04:53 -07:00
Jean-Baptiste Kempf 41c41aec0b Android: only redefine statvfs if it is not already defined
It is defined with recent platforms version 21 and more recent
2016-03-11 00:09:16 +01: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
Jean-Baptiste Kempf d02d5d0f5e The correct NDK define for Android is __ANDROID__
The ANDROID macro is not recommended
2016-01-09 13:35:11 +01:00
Jean-Baptiste Kempf 4f0d26258e Win32: Fix nfs_stat declaration for Win32
So that the definition and declaration match.

There might be another way, with stat64i32 but I'm not confident it will
work with MSVC
2016-01-08 23:41:56 +01: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
Ross Lagerwall 23b10e1f18 libnfs: Add access2()
Add nfs_access2(), like nfs_access() but it returns the individual
statuses of R_OK, W_OK and X_OK rather than a single success or failure
status.  This saves the latency and overhead of multiple lookups if an
application tries to determine the status of each of R_OK, W_OK and
X_OK.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-09-14 15:41:04 +01:00
Mike Frysinger 10a1a78115 fix implicit decl warnings
Include the proper headers to fix warnings like:
libnfs-sync.c:1529:3: warning: implicit declaration of function 'gettimeofday' [-Wimplicit-function-declaration]
libnfs-zdr.c:506:2: warning: implicit declaration of function 'getuid' [-Wimplicit-function-declaration]

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

sys/time.h needs to be protected with an ifdef

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-08-11 06:08:05 -07:00
Ross Lagerwall 8d59066720 libnfs: Add lchmod
Add lchmod which is like chmod but operates on the symbolic link itself
if the destination is a symbolic link.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-27 21:26:54 +01:00
Ross Lagerwall 6505b53967 libnfs: Add lutimes
Add lutimes which is like utimes but operates on the symbolic link
itself if the destination is a symbolic link.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-27 21:26:54 +01:00
Ross Lagerwall bf769f960d libnfs: Add lstat
Add lstat which is like stat but operates on the symbolic link itself if
the destination is a symbolic link.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-27 21:26:54 +01:00
Ross Lagerwall 5935a28a0e libnfs: Add lchown
Add lchown which is like chown but operates on the symbolic link itself
if the destination is a symbolic link.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-27 21:26:54 +01:00
Ross Lagerwall 3e020c15fd libnfs: Add fstat64, analagous to stat64
Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-20 23:13:16 +01:00
Ross Lagerwall 037a1061dd libnfs.c: add nfs_create
Add a new family of functions, nfs_create, like nfs_creat but takes an
additional flags argument which allows extra flags like O_SYNC, O_EXCL
and O_APPEND to be specified.
2014-07-17 22:32:09 +01:00
Memphiz bd2f43c8a6 [osx] - fix compile 2014-04-10 20:35:44 +02:00
Arne Redlich 9e6ac3d4ee libnfs-sync: nfs_{read,write}: use their _async counterparts internally
Previously nfs_read and nfs_write used to use nfs_pread and nfs_pwrite respectively.
In preparation of getting the file position handling right this has to be detangled.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-04-03 18:04:41 -07:00
Arne Redlich 1f1b6cb0a7 nfs_lseek{,_async}: allow negative offsets and guard against file positions < 0
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-04-03 18:03:21 -07:00
Ronnie Sahlberg 0f0e352f49 PORTMAP: Rename the functions in PMAP to PMAP2 to desribe the version of PMAP we use.
Future patches will add PMAP3 which we will need for IPv6 support.
2014-03-19 18:25:49 -07:00
Ronnie Sahlberg 479302f729 Add a new nfs_stat64() function that operates on a always-64-bit stat structure 2014-03-04 19:40:05 -08:00
Ronnie Sahlberg 3cea44dc54 Rename the nfs_open() argument from mode to flags 2014-02-02 11:41:22 -08:00