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>
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>
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.
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>
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.
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>
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>
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>
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>
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>
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>
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>
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.
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>