Commit Graph

772 Commits (6f860fd874bfb78ac1a74285fefecc339258bb03)

Author SHA1 Message Date
Ronnie Sahlberg 6f860fd874 Add ZDR* and void* as arguments to zr_void so that it can be used as a zdrproc_t
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-12-17 10:44:12 -08:00
Ronnie Sahlberg be2c87c2cd Update portmap.x to use nicer names for procedure arguments and responses
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-12-17 10:44:12 -08:00
Ronnie Sahlberg f4273cf9ff Change type of zdrproc_t to return uint32_t instead of int
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-12-17 10:44:12 -08:00
Ronnie Sahlberg 7596d0f300 Use a static sockaddr_storage for rpc.udp_dest
There is no need to allocate and deallocate this structue every time
we update the udp destinateion.

For the client side, where we set the destination just once per lifetime
of the context it might not matter too much but once we add udp server support
we will need to update the sockaddr for every rpc we receive.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-12-17 10:44:12 -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 9eaa36c4bf Remove sockaddr argument to rpc_connect_sockaddr_async
We always use the rpc->s as the sockaddr so no need to pass it by argument

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-12-01 15:02:46 -08:00
Ronnie Sahlberg dccffb86ee Create a new helper function to set the sockaddr for a rpc context
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-12-01 15:02:34 -08:00
Ronnie Sahlberg 6f8b2f85ca socketsize is of type socklen_t not int
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-12-01 08:37:55 -08:00
Ronnie Sahlberg 11f85665fc Add a PDU flag for discard after sending.
Add a flags field to rpc_pdu and add a flag that indicates that the PDU
should be discarded as soon as it has been written to the socket.
We do not put it on the waitpdu queue nor do we wait for a reply.

This will later be used for when we are sending replies back to a client
when operating in a server context.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-11-29 05:12:03 -08:00
Ronnie Sahlberg 6f27daf6d4 Create a generic RPC NULL function
This allows us to use the NULL function for any arbitrary
program/version from rpc_connect_program() instead of the hardcoded support
for mount v3 and nfs v3

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-11-27 12:50:06 -08:00
Ronnie Sahlberg 468424c475 ZDR_ARRAY: remove the check for element-size * num-objects
In zdr_array we can not use the check that num_elements * element_size
will fit inside the remaining bytes in the ZDR buffer.
The reason for this is that IF it is an array of unions, then
element-size will have the size of the largest arm in that union.

If the array consists of union items that are smaller than the largest arm,
then it becomes likely that this will pack in less than num_elements *
element_size and this it is possible that the array WILL fir in the remaining
bytes.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-11-25 14:47:00 -08:00
Ronnie Sahlberg a2b37349fa Update README about capability support and fix some typos.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-11-06 15:16:31 -08:00
Ronnie Sahlberg 85760ec4d6 Fixes to build nfs-ls and nfs-cp on win32
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-11-06 14:44:03 -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
Ronnie Sahlberg 235cb45e69 Conditionally define _GNU_SOURCE
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-10-09 11:23:11 -07:00
sahlberg 048e7737d9 WIN32: map open to _open. Same for lseek, read, write 2016-09-21 15:47:19 -07:00
sahlberg 8c8e615e54 nfs-cp change uint64_t to size_t for the read/write wrappers 2016-09-21 11:35:59 -07:00
sahlberg 2ff6131244 nfs-cp remove unused variable ret 2016-09-21 11:27:27 -07:00
sahlberg 232c9da7cf WIN32: conditionally remove some stat fields that are not present under win32 2016-09-21 11:24:00 -07:00
sahlberg 84c894c8a4 nfs-cp: add casts between the nfs stat elements and the normal stat elements 2016-09-21 11:17:09 -07:00
sahlberg 72bcd185db WIN32: remove the nfsclient-* examples from the project 2016-09-21 11:05:20 -07:00
sahlberg adc46ec1b0 WIN32: Change examples -> utils for nfs-ls and nfs-cp project filter 2016-09-21 11:02:53 -07:00
sahlberg dc8e10df07 WIN32: compiler warnings 2016-09-21 10:49:59 -07:00
sahlberg 6b6d6084d0 WIN32: Fix types for max_watch_len st_dev and st_ino 2016-09-21 09:45:55 -07:00
sahlberg 3d1351bf82 WIN32: make pagecache ttl of type time_t
We both compare and compute using the ttl value with variables of
type time_t. Thus is makes most sense to have ttl as time_t too.
2016-09-21 09:32:45 -07:00
Ronnie Sahlberg c000bf2acc WIN32: Add include paths for include/nfsc for x64 builds
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-09-20 18:42:54 -07:00
Ronnie Sahlberg 2601b42496 WIN32: remove references to onc-rpc
We have not needed an external onc-rpc library for libnfs in a long
long time since the re-write to use a builtin XDR replacement (ZDR).

Remove all references from the project files to my old port of a onc-rpc
library to win32.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-09-20 18:42:17 -07:00
Ronnie Sahlberg 9a65270510 WIN32: Add portmap to the include paths
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-09-20 18:17:24 -07:00
Ronnie Sahlberg b70d5b6dac WIN32: No need to run rpcgen.exe anymore. Remove from project.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-09-20 18:09:25 -07:00
Ronnie Sahlberg fc2501dc45 Merge branch 'master' of github.com:sahlberg/libnfs 2016-09-20 17:45:37 -07:00
sahlberg e53758fc43 compiler warnings 2016-09-20 17:45:05 -07:00
sahlberg 6d3e9814fa more win32 fixes 2016-09-20 17:44:42 -07:00
sahlberg c672db8351 WIN32: Use size_t for the rpc fragment size 2016-09-20 17:43:53 -07:00
sahlberg 563c112343 WIN32: fix compile warnings in nfs.c 2016-09-20 17:43:26 -07:00
Ronnie Sahlberg 53f634468c WIN32: Update the path to nfs-{cp|ls}.c
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-09-20 17:42:46 -07:00
sahlberg b741a44f81 WIN32: Add portmap to more include directives 2016-09-20 17:40:18 -07:00
sahlberg 4c3d809e07 WIN32: Don't call assert() before all variables are declared.
VisualStudioOnline does not like when you intermingle variable
definitions and code so move the assert() to after the variables
are all declared.
2016-09-20 17:37:48 -07:00
sahlberg 799abde68d WIN32: win32 does not have IFNAMSIZ 2016-09-20 17:36:59 -07:00
Ronnie Sahlberg 6cde2aca64 Conditionally include unistd.h from libnfs-zdr.c as some platforms lack this header
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-09-20 17:36:19 -07:00
Ronnie Sahlberg b0c3cb3415 Conditionally include unistd.h from libnfs-zdr.c a some platforms lack this header
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-09-19 18:36:59 -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
Ronnie Sahlberg fac3a95453 Make rpc_disconnect() a no-op if the session is already disconnected
This addresses a bug causing a segfault if we destroy the nfs context/
disconnect the session while the mount_8_cb callbacks for checking the
filehandle for nested mountpoints are still in flight.

Issue found and reported by doktorstick

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-07-05 13:18:17 -07:00
Ronnie Sahlberg 28e01e67b1 Add seekdir and telldir support
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-07-05 10:14:49 -07:00
Ronnie Sahlberg cdbcdfd736 Update some comment and fix typos
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-07-05 09:59:30 -07:00
Ronnie Sahlberg d9e75d56fa Add comment that nfs_rewinddir will never block.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-06-21 19:30:00 -07:00
Ronnie Sahlberg 4388570dc4 Merge pull request #151 from benoit-canet/rewinddir
nfs_rewinddir: introduce additional nfs_rewinddir()
2016-06-21 19:28:20 -07:00
Ronnie Sahlberg 4cc09b972a Fix crash in nfs_truncate due to dereference of uninitialized data
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-06-21 19:25:27 -07:00
Benoît Canet 352fb5bb70 nfs_rewinddir: introduce additional nfs_rewinddir()
Introduce the nfs_rewinddir() utility function used
to cancel previous nfs_readdir() side effects.

Signed-off-by: Benoît Canet <benoit@scylladb.com>
2016-06-07 08:36:27 +02:00
Ronnie Sahlberg cdd1643c76 Merge pull request #150 from plieven/for_upstream
For upstream
2016-06-03 05:07:45 -07:00
Peter Lieven 10546da322 pagecache: define hash constant as UL
Signed-off-by: Peter Lieven <pl@kamp.de>
2016-06-03 13:46:48 +02:00