Ronnie Sahlberg
8ae943f608
PORTMAP: Add support for V3 DUMP command
...
This implements the missing procedure from Issue #65
2014-03-16 14:17:06 -07:00
Ronnie Sahlberg
f0cb804219
Improve error reporting when unmarshalling of message headers fail.
2014-03-11 18:52:48 -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
Arne Redlich
8406bfe465
{nfs,rpc}_set_error: add __attribute__((format(printf))) annotations
...
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:58:48 -08:00
Arne Redlich
e94d5a7d51
libnfs-raw.h: rename export -> exportname to avoid clash with C++ keyword
...
From http://en.cppreference.com/w/cpp/keyword/export :
Until C++11:
"Used to mark a template definition exported, which allows the same
template to be declared, but not defined, in other translation units."
Since C++11:
"The keyword is unused and reserved."
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:43:16 -08:00
Arne Redlich
d48be00c5e
libnfs.h: wrap in extern "C" for C++ compatibility
...
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:42:03 -08:00
Arne Redlich
a81c5ea1d2
libnfs-zdr.h: wrap in extern "C" for C++ compatibility
...
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:40:30 -08:00
Arne Redlich
4641d36ef4
libnfs-raw.h: wrap in extern "C" for C++ compatibility
...
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:40:11 -08:00
Arne Redlich
324234ee10
libnfs-private.h: wrap in extern "C" for C++ compatibility
...
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:39:52 -08:00
Arne Redlich
17876230a9
slist.h: add include guards
...
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:39:28 -08:00
Arne Redlich
83a446dd8d
libnfs-private.h: add include guards
...
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:38:59 -08:00
Arne Redlich
3751901fc4
libnfs-raw.h: remove trailing whitespace
...
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:38:34 -08:00
Arne Redlich
52014ebf37
libnfs.h: add include guards
...
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:37:59 -08:00
Ronnie Sahlberg
22a0f15bee
Add support for O_TRUNC with nfs_open()
...
O_TRUNC will attempt to truncate the file when opened with O_RDWR
or O_WRONLY.
Normal posix open(O_RDONLY|O_TRUNC) is undefined.
libnfs nfs_open() only uses the O_TRUNC flag when used in combination with either O_RDWR or O_WRONLY.
When O_TRUNC is used together with O_RDONLY libnfs will silently ignore the O_TRUNC flag.
Libnfs nfs_open(O_RDONLY|O_TRUNC) is thus the same as nfs_open(O_RDONLY)
2014-02-02 12:16:07 -08:00
Ronnie Sahlberg
3cea44dc54
Rename the nfs_open() argument from mode to flags
2014-02-02 11:41:22 -08:00
Ronnie Sahlberg
6ec481d3fa
Add a rpc_set_fd() fucntion which can be used to swap the underlying socket file descriptor
...
This is mainly needed when having to track and control the file descriptors that are used by libnfs, for example when trying to emulate dup2() ontop
of libnfs.
2014-02-02 08:45:21 -08:00
Ronnie Sahlberg
f893b680f2
Add support for chdir and getcwd
...
Add chdir and getcwd and store cwd in the nfs_context.
Add functions to process the paths specified and normalize them
by performing the transforms :
// -> /
/./ -> /
^/../ -> error
^[^/] -> error
/string/../ -> /
/$ -> \0
/.$ -> \0
^/..$ -> error
/string/..$ -> /
Update the path lookup function to allow specifying relative paths based on
cwd for all functions.
2014-01-30 20:06:57 -08:00
Ronnie Sahlberg
0df47959c4
Revert "Add support for chdir and getcwd"
...
This reverts commit fb6f315257
.
2014-01-30 18:26:39 -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
bcb4f1bd1c
We need the libnfs-raw-*.h files in include/Makefile.am
...
or else the autotools (which I dont really understand how it works)
will not install the headers.
2014-01-28 06:35:52 -08:00
Ronnie Sahlberg
fb6f315257
Add support for chdir and getcwd
...
Add chdir and getcwd and store cwd in the nfs_context.
Add functions to process the paths specified and normalize them
by performing the transforms :
// -> /
/./ -> /
^/../ -> error
^[^/] -> error
/string/../ -> /
/$ -> \0
/.$ -> \0
^/..$ -> error
/string/..$ -> /
Update the path lookup function to allow specifying relative paths based on
cwd for all functions.
2014-01-27 20:54:59 -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
Ronnie Sahlberg
c9cc77a538
Merge pull request #47 from Memphiz/win32fix3
...
[win32] - fixed bad number casting when using libnfs on 64bit win8 syste...
2014-01-12 15:18:59 -08:00
Memphiz
be184101ca
[win32] - fixed bad number casting when using libnfs on 64bit win8 systems - force the usage of struct __stat64 as its done on other platforms implicitly
2014-01-12 14:42:56 +01:00
Ronnie Sahlberg
7bda8bad00
Add uid/gid to the stat data returned in the readdir directoryentry
...
We also get uid/gid for free when using READDIRPLU3 (and READDIRPLUS3 emulation)
so store these too so applications that needs to look at the uid/gid can avoid
the extra call to nfs_stat()
2013-12-31 16:25:01 -08:00
Ronnie Sahlberg
0961765a56
Document the URL syntax
2013-12-25 16:27:10 -08:00
Ronnie Sahlberg
6d89ace041
Merge pull request #43 from plieven/master
...
URL parsing functions and minor fixes + enhancements
2013-12-25 16:11:29 -08:00
Ronnie Sahlberg
04e9034165
MOUNT: Add RPC support for MOUNTv1
2013-12-24 12:20:41 -08:00
Ronnie Sahlberg
f38aacf8c9
Add NFSv2 RPC support
2013-12-24 11:28:56 -08:00
Ronnie Sahlberg
463d59bf8e
NFS: Add new function signatures for rpc_nfs3_ that takes *3args arguments
...
to match the XDR.
Leave the existing ad-hoc rpc_nfs_* functions for backward compatibility.
2013-12-24 11:16:21 -08:00
Ronnie Sahlberg
21668dcef4
Add missing symbols to libnfs-win32.def and make them EXTERN
2013-12-24 08:54:28 -08:00
Peter Lieven
9126c9c036
add uid and gid URL param to specify alternate uid and/or gid
...
This allows to connect with an alternate uid or gid than that
of the current user.
Example:
examples/nfs-ls nfs://10.0.0.1/export?uid=1000&gid=33
Signed-off-by: Peter Lieven <pl@kamp.de>
2013-12-23 14:03:26 +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
Peter Lieven
d2ec73c75a
add URL parsing functions
...
this adds the following 4 functions. see libnfs.h for details.
struct nfs_url *nfs_parse_url_full(struct nfs_context *nfs, char *url);
struct nfs_url *nfs_parse_url_dir(struct nfs_context *nfs, char *url);
struct nfs_url *nfs_parse_url_incomplete(struct nfs_context *nfs, char *url);
void nfs_destroy_url(struct nfs_url *url);
Signed-off-by: Peter Lieven <pl@kamp.de>
2013-12-23 14:03:00 +01:00
Ronnie Sahlberg
1e7a5136de
Finish the NSM support
2013-11-06 06:56:44 -08:00
Ronnie Sahlberg
ed09b5676f
Initial support for NSM
2013-11-05 17:37:16 -08:00
Ronnie Sahlberg
8733f38d23
Add an async helper function to connect an rpc context to a program/version
2013-10-26 13:16:09 -07:00
Ronnie Sahlberg
3b943d2f68
Add a mechanism to control what the next XID value on a session will be.
...
This makes it possible for multiple processes/contexts to use the same
target and (with some synchronization) avoid XID collissions across processes/contexts.
2013-10-26 07:44:29 -07:00
Ronnie Sahlberg
b93082da2b
Make xid be a uint32_t and not either unsigned long or unsigned int
2013-10-21 19:15:11 -07:00
Ronnie Sahlberg
6f914247fb
Add support for NFS/PATHCONF
2013-10-20 10:07:19 -07:00
Ronnie Sahlberg
67a9f57e67
WIN32 fixes
2013-05-28 16:15:16 -07:00
Ronnie Sahlberg
c40efafc33
remove obsolete comment
2013-04-14 10:46:08 -07:00
Ronnie Sahlberg
ece9f02c59
Dont include config.h from libnfs-zdr.h
2013-04-14 10:44:14 -07:00
Ronnie Sahlberg
0f9fe7c64d
SOCKADDR_STORAGE: it is called HAVE_SOCKADDR_LEN not HAVE_SA_LEN
2013-04-12 19:13:11 -07:00
Ronnie Sahlberg
d7c6e9aaa9
Initial AROS support.
...
The test app doesnt link yet since we are missing a bunch of symbols
but it is a start
2013-04-10 20:28:40 -07:00
Ronnie Sahlberg
e803ae5760
Rearrange the header files.
...
Move the headers we install to ./include/nfsc
and start including nfsc/libnfs-zdr.h from all the other header files.
2012-11-28 20:21:53 -08:00
Ronnie Sahlberg
f9bb21ad7d
Add ifndef's to protect libnfs-raw.h from being included multiple times
2012-11-28 19:26:54 -08:00
Cory Fields
252aa90dc8
[droid] Support building for android
...
These are the changes necessary to build for android. Working status is yet
untested.
2012-11-28 12:04:10 -05:00
Ronnie Sahlberg
db0c9f4212
Install libnfs-zdr.h
2012-11-28 06:36:06 -08:00
Ronnie Sahlberg
aab6538bbd
Implement 'rejected_reply' and switch to RFC5531 definitions
...
Switch to using fields and names from RFC5531. that is the standard
for RPC.
2012-11-26 19:42:10 -08:00
Ronnie Sahlberg
f3a7507806
Add an assert to track if we try to use an rpc_context after it has been destroyed
2012-11-24 08:18:54 -08:00
Ronnie Sahlberg
442b829a05
Dont just cast *enum_t to *uint32_t
...
go via a temporary variable in case these scalars are different size
2012-07-05 21:13:04 +10:00
Ronnie Sahlberg
67ba2239cb
Get rid of AUTH completely and replace all uses with 'struct AUTH'
2012-07-05 10:23:19 +10:00
Ronnie Sahlberg
45670bd0d6
fix compiler warnings
2012-07-05 07:37:37 +10:00
Ronnie Sahlberg
d14e28387f
squelch compiler warnings in socket.c about integer sizes
2012-07-05 07:21:48 +10:00
Ronnie Sahlberg
763cd6e3e2
ZDR: New builtin replacement for RPC/XDR called ZDR
...
This patch switches libnfs over to use precompiled rpcgen files
and using ZDR. ZDR is a trivial reimplementation of XDR that is built in
into libnfs.
This removes the dependencies of rpc/xdr completely and allow us to build on any
system, even systems where rpcgen and librpc/libxdr are not generally available.
2012-07-04 16:53:12 +10:00
Ronnie Sahlberg
a171d4dada
NLM add helper functions to send async calls for the NLM functions
2012-03-10 22:50:10 +11:00
Ronnie Sahlberg
e01ed6a239
NLM add TEST procedure
2012-03-10 21:38:29 +11:00
Ronnie Sahlberg
6916a66546
NLM: initial support for NLM
2012-03-10 20:46:03 +11:00
Ronnie Sahlberg
0118a5f0de
GETACL: change the signature for the raw getacl3 function to take GETACL3args pointer instead of a discrete arguments
2012-03-08 22:52:20 +11:00
Ronnie Sahlberg
fa3c25beee
NFSACL: Add support for SETACL3
2012-03-08 21:25:21 +11:00
Ronnie Sahlberg
8e25581668
change rpc_nfs_symlink_async to take a full SYMLINK3args as parameter
2012-01-14 08:18:19 +11:00
Ronnie Sahlberg
16104b27bd
make low level readlink_async function take READLINK3args as argument
2012-01-14 08:11:09 +11:00
Ronnie Sahlberg
7edc9026db
make mkdir_async take a full MKDIR3args argument
2012-01-12 16:02:32 +11:00
Ronnie Sahlberg
c985c015f2
change crate_async low level function to take a full RATE3args structure as argument instead of just name and mode
2012-01-12 15:31:49 +11:00
Ronnie Sahlberg
b426ef0404
read returns a READ3res, not a ACCESS3res
2012-01-12 15:19:45 +11:00
Ronnie Sahlberg
8724c83390
Add function to get root filehandle from a nfs context
2012-01-11 07:04:01 +11:00
Ronnie Sahlberg
1fbe408023
PORTMAPPER: Add set/unset functions
2011-12-31 15:01:38 +11:00
Ronnie Sahlberg
5c6b1176c2
PMAP: allow to ask for tcp/udp port, dont assume users only ever want the tcp port
2011-12-31 14:24:20 +11:00
Ronnie Sahlberg
183451cff5
Remove all [s]size_t / off_t and replace with [u]int64_t making libnfs 64-bit pure
2011-11-27 14:49:08 +11:00
Ronnie Sahlberg
1ec6b50aef
Add MKNOD command support
...
Add support for raw nfs3 mknod and sync and async posixlike api
2011-11-27 14:08:24 +11:00
Ronnie Sahlberg
8704724f83
Change remaining "struct AUTH *" to "AUTH *"
2011-10-09 15:22:05 +11:00
Memphiz
fa33813ed4
[fix] - fix improper definition of struct AUTH from osx (caution - API change - not clear if typedef is there on all plattforms...)
2011-10-08 18:10:06 +02:00
Ronnie Sahlberg
d678b73e4d
Fragment reassembly. Add reassembly of fragmented RPC PDUs
2011-10-04 12:31:56 +11:00
Ronnie Sahlberg
1744ef9011
Autoreconnect: autoreconnect was completely broken. Reimplement it so that it reconnects properly on session failure.
2011-10-04 11:25:10 +11:00
Ronnie Sahlberg
762621fa3d
Donr declate AUTH as a struct in libnfs.h
...
make it include rpc/auth.h properly instead
2011-09-19 20:23:45 +10:00
Ronnie Sahlberg
83aa785d92
Add a call to find the queue-length so we can see how many I/O we have in flight from the application layer.
2011-09-11 21:32:48 +10:00
Ronnie Sahlberg
41d82d7d82
Merge branch 'win32' into win32-3
2011-09-03 10:57:42 +10:00
Ronnie Sahlberg
0804e67d7a
using READDIRPLUS3 we get some extra fields for the direentry structure for free, such as type, mode, size, timestamps
2011-09-02 20:45:30 +10:00
Ronnie Sahlberg
f390f18157
nfs_opendir() switch to using READDIRPLUS3 instead of READDIR3 when reading directories.
2011-09-02 20:27:01 +10:00
Ronnie Sahlberg
66ad6d8438
Win32: make the sympols public in a dll
2011-08-30 15:56:53 +10:00
Ronnie Sahlberg
dd8fc17555
win32 oncrpc environment needx xdr.h before including auth.h
2011-08-28 19:46:12 +10:00
Ronnie Sahlberg
eecdc4f3cd
Win32 changes, include files we need when compiling under win32
...
and some socket ops are slightly different
2011-08-28 19:24:18 +10:00
Ronnie Sahlberg
b84208a613
Dont install slist.h or libnfs-private.h
2011-07-31 18:29:10 +10:00
Ronnie Sahlberg
b077fdeb65
Add automatic reconnect after TCP session failure for the sync interface.
...
Once a NFS TCP connection has been idle for a very long time, say
10-15 minutes, it is common that NFS servers will tear down the TCP connection.
So add code to re-connect to the NFS server and re-issue any i/o that might have been in flight (unlikely unless the server has hung)
While it is sufficient to just reconnect to tcp port 2049, it was much simplet to just utilize the nfs_mount() function.
This means that instead of just reconnecting TCP port 2049, we do a full blown
nfs mount via portmapper and mountd protocols.
2011-07-31 10:49:47 +10:00
Memphiz
4431432424
[fix] - install the raw headers ...
2011-07-19 20:12:31 +02:00
Ronnie Sahlberg
3847f8f6ae
add support got NFSACL protocol and NULL and GETACL procedures.
...
add example of raw interface for NFSACL
2011-07-03 15:30:18 +10:00
Ronnie Sahlberg
2e4db0d145
Merge remote branch 't-nelson/automake'
2011-07-02 11:10:36 +10:00
Ronnie Sahlberg
9c4212bf55
document the find_all_servers function
2011-07-02 10:33:19 +10:00
Ronnie Sahlberg
552c766578
add example for sync interface to probe for all local servers
2011-07-02 10:30:16 +10:00
Trent Nelson
6c437065d3
Rewrite build system using automake
...
Initial commit, only linux tested so far.
2011-06-29 14:15:16 -04:00
Ronnie Sahlberg
fd59fd0da3
add a function for portmap/callit
...
for the low level raw interface
2011-06-26 18:52:03 +10:00
Ronnie Sahlberg
c481da67f2
add function to extract the sockaddr from which we received the current rpc pdu
...
(useful when parsing replies from broadcast rpc calls)
2011-06-26 18:45:38 +10:00
Ronnie Sahlberg
5bf60dc601
add function to set the target for UDP rpc calls.
...
including doing broadcast calls
2011-06-26 18:42:53 +10:00
Ronnie Sahlberg
485bc9b9a7
add function to bind a udp rpc context to a local port/address
2011-06-26 18:40:00 +10:00
Ronnie Sahlberg
2d0c44ced1
add a sockaddr_storage so we can store the socket UPD packets came in from
2011-06-26 18:29:49 +10:00
Ronnie Sahlberg
a9b241622f
add a sockaddr_storage to the rpc context so we can store the socket a upd packet came in from
2011-06-26 18:22:45 +10:00
Ronnie Sahlberg
2ae460667b
add a 'is broadcast' flag to the rpc context structure
...
this is used for broadcast udp rpc calls (==pormatp/callit)
2011-06-26 18:18:59 +10:00
Ronnie Sahlberg
9e00b8c663
add function to request a UDP context
...
(private use only since we dont want applications to use UDP)
2011-06-26 17:27:40 +10:00
Ronnie Sahlberg
d16a3ca4bb
add rpc_context field to track if a UDP connection was requested
2011-06-26 17:17:59 +10:00
Ronnie Sahlberg
cdb19ec164
Redo the buffer handling for input buffers and make sure we only read one PDU at a time
2011-06-20 00:56:47 +10:00
Ronnie Sahlberg
e210bd2af8
remove the need for an explicit rpc context for the highlevel function mount_getexports()
2011-06-19 23:20:35 +10:00
Ronnie Sahlberg
df5af25fd2
add a sync function to get the export list from a server and add an example of how to use this functio n to nfsclient-sync
2011-06-19 22:31:34 +10:00
Ronnie Sahlberg
7f0242ca9a
Add a high-level async function to read the export list
2011-06-19 14:54:17 +10:00
Ronnie Sahlberg
1896d37bfa
get rid of all remaining printfs from the library
...
add a helper function nfs_set_error() to use instead of the printfs
2011-06-19 09:38:20 +10:00
Ronnie Sahlberg
e2ba5764d4
Remove the _sync postfix for the synchronous functions
2011-06-18 15:07:53 +10:00
Ronnie Sahlberg
77c23b46c0
Add support for version 2 of the rquota protocol
2011-06-02 22:16:42 +10:00
Ronnie Sahlberg
19e74f5a32
Add RQUOTA1/GETACTIVEQUOTA call to the raw low level API
2011-06-02 22:06:25 +10:00
Memphis
d6ced294d8
- refactored parametername from reserved keyword "export" to "exportname"
2011-06-01 18:05:18 +02:00
Ronnie Sahlberg
05a777d98a
Initial support for RQUOTA protocol
2011-06-01 20:55:27 +10:00
Ronnie Sahlberg
17ef62fad7
Read the max read/write sizes supported when connecting to NFS
...
and store in the nfs context.
Privide accessor functions to read the max sizes.
2011-06-01 00:08:29 +10:00
Ronnie Sahlberg
1058201ef0
Add support for async version of NFS/FSINFO3 call
2011-05-31 23:50:18 +10:00
Ronnie Sahlberg
84004dbf9b
initial libnfs checkin
2011-02-06 15:45:09 +11:00