Commit Graph

772 Commits (6f860fd874bfb78ac1a74285fefecc339258bb03)

Author SHA1 Message Date
Ronnie Sahlberg 5f6442d1b2 libnfs.c: fix typo, it is readahead not readahaed
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-12-05 08:44:15 -08:00
Ronnie Sahlberg 080d231129 New version 1.9.6
- Add O_TRUNC support for nfs_create
 - Handle OOM during create
 - Return more stats fields as part of readdir since we get these for "free"
   when we use READDIRPLUS
 - Follow symlinks during path resolution
 - Add lchown, lstat and lutimes
 - Replace all [u_]quad types with [u]int types in our RPC layer
 - Solaris build fixes

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-11-25 06:47:55 -08:00
Stefan Blanke 4a58e61455 Issue READIRPLUS calls with a sensible dircount maxcount ratio
The NFS spec states:

"The ratio of the directory entry size to the size of the attributes plus the
size of the file handle is usually at least 8 to 1."

Though implementation dependent the spec implies that the previous 1 to 1 ratio
could have a detrimental impact on the performance of the server due to most of
the data per VOP_READDIR call being wasted.

The Linux kernel uses the 8 to 1 ratio.

Signed-off-by: Stefan Blanke <stefan.blanke@framestore.com>
Signed-off-by: Mark Hills <mark.hills@framestore.com>
2014-11-03 17:23:17 -08:00
Ronnie Sahlberg ab1af6953c Merge pull request #100 from rosslagerwall/access-improve
access() improvements
2014-09-14 08:10:17 -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
Ross Lagerwall c50173cf0d libnfs: Give correct access() results for directories
Map ACCESS3_{MODIFY,EXTEND,DELETE} to W_OK and ACCESS3_{LOOKUP,EXECUTE}
to X_OK so that nfs_access() gives sensible results for directories.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-09-14 15:38:57 +01:00
Ronnie Sahlberg 49397f0706 README.win32.txt: delete this obsolete file
This file has been obsolete for a long time. At least since libfs got
its own internal marshalling support: ZDR.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-09-10 19:22:23 -07:00
Ronnie Sahlberg 5fe97d1088 solaris: we need -lsocket and -lnsl for all builds not just examples
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-08-16 16:17:06 -07:00
Ronnie Sahlberg bce63d849c types: remove the [u_]quad type and replace with [u]int64
All current platforms have a quad type that maps to a 64bit scalar.
But there are platforms where quad maps to a 64bit non-scalar.

Replace quad with int64 in the protocol definitions and the ZDR layer
so that these fields will map to a 64 bit scalar also on those platforms
where quad can not be used.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-08-16 14:51:53 -07:00
Ronnie Sahlberg 8768f8cc2b Merge pull request #99 from mheijkoop/fuse-nfs-usage
Fix help message for fuse_nfs example
2014-08-16 14:37:53 -07:00
Marlies Heijkoop 7e967f4de2 Print usage when missing mandatory arguments 2014-08-16 16:38:25 +02:00
Marlies Heijkoop 6a88df2924 Fix usage message to match expected arguments 2014-08-16 16:26:17 +02:00
Ronnie Sahlberg 2e630bbd76 fix linebreak in README 2014-08-14 19:05:28 -07:00
Ronnie Sahlberg cc3e372de4 socket.c: we need netinet/in.h on some platforms 2014-08-14 18:56:39 -07:00
Ronnie Sahlberg a8c840e834 Merge pull request #97 from rosslagerwall/read-close-crash
libnfs: Don't perform operations on nfsfh after user callback
2014-08-11 06:15:16 -07:00
Ronnie Sahlberg 34e6b2cf94 Merge pull request #96 from rosslagerwall/enotempty
Map NFS3ERR_NOTEMPTY to ENOTEMPTY
2014-08-11 06:14:16 -07:00
Mike Frysinger e48cfe9622 fix implicit decls of rpc_{g,s}et_error
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-08-11 06:08:33 -07:00
Mike Frysinger 8d4559dc14 fix typo in chmod funcs
These were accidentally calling chown instead of chmod.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-08-11 06:08:33 -07: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 9cac8a6340 libnfs: Don't perform operations on nfsfh after user callback
Since the user callback may perform operations on the nfsfh (e.g. it
might close it), all updates should be done before the user callback is
called.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-08-10 12:18:56 +01:00
Ross Lagerwall 11cf77ceca Map NFS3ERR_NOTEMPTY to ENOTEMPTY
Map NFS3ERR_NOTEMPTY to ENOTEMPTY rather than EEXIST.  POSIX allows
either EEXIST or ENOTEMPTY for rmdir on a non-empty directory but
ENOTEMPTY is more explicit and in line with Linux, OS X, FreeBSD and
OpenBSD's behavior.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-08-08 20:21:58 +01:00
Ross Lagerwall 408cd870b8 libnfs: Fix segfault if O_TRUNC fails when creating
Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-08-07 20:45:42 +01:00
Ronnie Sahlberg a64800f373 Merge pull request #92 from rosslagerwall/symlink-resolution
Follow symlinks during path resolution
2014-08-02 08:03:45 -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 1d15199152 libnfs.c: Follow symlinks during path resolution
Follow symlinks during path resolution.  If the symlink points outside
the mount, -ENOENT is returned.  This is slightly different behavior
from the in-kernel NFS client where symlinks pointing outside the mount
get resolved to local paths.

The algorithm for symlink resolution is simple and stupid.  If a symlink
is encountered, the path is rewritten and path resolution begins again
from the root filehandle.  A count is kept to prevent loops.  This is
not particularly efficient but it is good enough for now.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-27 21:24:17 +01:00
Ross Lagerwall c4d5f5b874 libnfs.c: Fix a warning
Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-27 21:22:34 +01:00
Ronnie Sahlberg 42f916635d Merge pull request #90 from rosslagerwall/stat-improvements
Stat improvements
2014-07-23 17:30:13 -07: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 fc08ac459c libnfs: Set as much stat information as possible
Set as much stat information as possible for stat, stat64, fstat and
readdir.

Fill in dev to the given fsid.
Fill in rdev to the given major and minor numbers.
Set the file type bits in the mode from the type returned by the server.
Set the number of blocks used based on the number of bytes used in
blocks of size 512 (which is what stat(2) uses), rounded up.
Fill in the nanosecond timestamps.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-20 22:06:34 +01:00
Ronnie Sahlberg 0672f75b57 Merge pull request #89 from rosslagerwall/create-trunc
Support use of O_TRUNC with nfs_create
2014-07-20 11:13:04 -07:00
Ross Lagerwall 00b29d10cb libnfs.h: Update open() flags docs
Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-20 08:18:47 +01:00
Ross Lagerwall ece11036ff libnfs.c: Handle OOM condition
Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-20 08:13:45 +01:00
Ross Lagerwall 370c59e351 libnfs.c: Support use of O_TRUNC with nfs_create
Simplify usage for application programmers by supporting the use of
O_TRUNC with nfs_create.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-20 08:08:39 +01:00
Ronnie Sahlberg 8dea7c3e2d Merge pull request #88 from rosslagerwall/76-no-autoreconnect
libnfs.c: Fix autoreconnect
2014-07-19 16:01:13 -07:00
Ronnie Sahlberg fda800dc02 Merge pull request #86 from rosslagerwall/75-create
libnfs.c: add nfs_create
2014-07-19 15:58:30 -07:00
Ronnie Sahlberg e591967437 Merge pull request #87 from rbalint/master
Use sockaddr_in6 on FreeBSD
2014-07-19 15:56:59 -07:00
Ronnie Sahlberg b9e5039f49 New version 1.9.5
This version removes old ONC-RPC symbols and automatically includes the
RPC/ZDR layer include from the raw low level headers.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-07-19 15:47:35 -07:00
Petr Salinger 18c94b4633 Use sockaddr_in6 instead of sockaddr6_in 2014-07-19 18:07:13 +02:00
Ross Lagerwall 28ee9de2e4 libnfs.c: Fix autoreconnect
Since rpc_connect_async sets autoreconnect to 0, turn autoreconnect on
after the connection has completed, not before.

This fixes #76.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-19 11:35:23 +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
Ronnie Sahlberg ea283cd792 RPC: include libnfs-zdr.h from all raw libnfs-raw-*.h files
Include the zdr header from all raw lowlevel headers so that we don't have to
include it manually from apps.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-07-13 15:36:59 -07:00
Ronnie Sahlberg 3429037ab7 Merge pull request #85 from rsahlberg/remove-zhr.h-dependency
Remove zhr.h dependency
2014-07-13 15:20:09 -07:00
Ronnie Sahlberg 2db42ce2fc ZDR: remove dependency on zdr.h from the examples and nfs-ls
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-07-05 12:44:18 -07:00
Ronnie Sahlberg af8d37c8b7 RPC: get rid of bool_t
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-07-05 09:14:01 -07:00
Ronnie Sahlberg d663ff20d0 RPC: get rid of references to SCVXPRT
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-07-05 09:13:55 -07:00
Ronnie Sahlberg ef1f869943 RPC: get rid of all references to CLIENT
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-07-05 09:13:49 -07:00
Ronnie Sahlberg 3c769bb1bd New version 1.9.4
New version of libnfs:

- IPv6 support
- Support for Portmapper version 3 and an example portmap client.
- Directory caching top make repeated opendir() calls faster
- Readahead support
- Build manpages for the utilities (==nfs-ls)
- Support for O_APPEND
- Rename the list macros to avoid collission on *BSD

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-06-29 14:57:45 -07:00