This function is identical to nfs_rmdir() so create a common
function that we call from both unlink and rmdir.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Add support for O_CREAT for NFSv4. Note, it is not implemented for NFSv3.
While it creates files we still need to add plumbing to get umask
implemented or else all files created will have mode 0.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Pass mode all the way down to nfs*_open_async() but we do not yet have any
plumbing to actually use it. That will come later as we implement O_CREAT
support.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
The populate functions will soon start appending varying number of operations.
For examle the case of open(O_TRUNC) where we would append an extra
SETATTR(size=0) at the end of the compound chain.
Thus use the number of ops that the populate function retured for when
we compute the length of the compound chain instead of assuming it is always
a constant.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Send a GETATTR for the final component in the path lookup so that
we can detect and act on it being a symlink.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
We can create a initial verifier that is good enough by just using
the current time and the pid.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
If we fallback to time() we have 1 second granularity of our timestamps.
Thus we need to bump the pdu timestamp we set by this granularity or
the timeout will trigger too early.
For a 1s timeout, this means that we now will trigger the timeout between
1.0 - 2.0 seconds instead of the previous 0.0 - 1.0 seconds.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Fix a bug in hte symlink code that required that linkname contained at least one
path component and thus prevented us from creating symlinks in the current
directory.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
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>
This only allow selecting the version for the context.
There is still no real v4 support and all I/O is still using v3.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
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>