Commit Graph

67 Commits (20b39fd25155b8618b4a7c3a2b2a2b7e753883c7)

Author SHA1 Message Date
Ronnie Sahlberg 20b39fd251 PS2_EE: update to compile on latest ps2 sdk
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-10-15 18:14:18 +10:00
Ronnie Sahlberg f965ec74cf ps2ee: PS2 EE support
Initial support for building a library for PS2 EmotionEngine

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-09-17 07:27:44 +10:00
Ronnie Sahlberg f88cca547d nfsv4: fix inode in readdir and nulltermination of readlink
Reported-by: Hemambara Kurma <hemambara.kurma@rubrik.com>
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-09-08 10:27:57 +10:00
Ronnie Sahlberg cdb377532a acl: add support and helpers to read nfsv4 acls
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-07-17 20:11:56 +10:00
Damian c7ad0762d8 Porting library to PS3 (psl1ght) 2020-08-14 11:47:39 -03:00
Ronnie Sahlberg f79745d281
Merge pull request #319 from dmeister/large_write
Allocate larger buffer for write operations in NFS4
2020-05-20 07:32:57 +10:00
Dirk Meister 483be177fe Allocate larger buffer for write operations in NFS4
The NFS4 pwrite operations contains a memory corruption if a write
is large than 4KB. The reason is that the buffer allocated within
nfs4_compund_async has a size of 4K and it does not account
for the size of the write buffer. To fix this the patch
padds a rpc_allocate_ndu2 function which an additional parameter
as an extra hint for the allocation.
2020-05-18 20:57:06 -07:00
Dirk Meister 1336b5280e Fix NFS4 behavior of chmod/chown/utimes
This patch fixes various issues around chmod/chown/utimes:
- The chmod/chown/utimes approach uses open_async_internal, which only works
  for files. This patch uses lookup_path so that chmod/chown is also
  possible on directories.
- Implements SET_TO_SERVER for utimes

I never succeeded in getting all tests passing even without
these changes. Nor did I succeed in getting the CMake compilation to
work. Sorry. The patch includes extra unit tests for these calls.
We use the libary as part of a test harness to test an NFS server
implementation, so I am reasonably confident that the changes work.
They are also manually tested against the Linux Kernel NFS Server.
2020-05-18 20:50:01 -07:00
Ronnie Sahlberg 56287de123 nfs_statvfs64() initialize/clear the nfs_statvs_64 structure.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-12-28 07:10:52 +10:00
Ronnie Sahlberg 48a559cb47 Add nfs_statvfs64()
Add a new function nfs_statvfs64() that returns a struct nfs_statvfs_64
where all fields are uint64_t.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-12-26 13:33:38 +10:00
Ronnie Sahlberg 9454d9f4c1 Implement O_EXCL for NFSv4
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-09-15 08:42:44 +10:00
Ronnie Sahlberg 21e208b092 fix bug in nfsv4 opendir where it stripped off the final path component
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-07-12 18:42:44 +10:00
Ronnie Sahlberg 456e52507b Don't use portmapper to discover the port for NFSv4
Default to use port 2049. If server runs on a different port then
we must manually override this with the nfsport flag.
NFSv4 servers can run without any portmapper daemon at all and we
must be prepared for that.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-04-29 13:46:22 +10:00
Daniel Abrecht b3fd3ca7e4 Move win32/win32_compat.h to include/win32/win32_compat.h 2018-04-16 19:42:38 +00:00
Ronnie Sahlberg 61584229d5
Merge pull request #243 from Daniel-Abrecht/master
The check for getpwnam wrongly succeeded on some systems
2018-04-08 17:04:39 +10:00
Ronnie Sahlberg b54fc96e00 Add nfsport/mountport arguments
Add two arguments to set which port to use for MOUNT (only used in NFSv3)
as well as for the NFS protocols.
When set to non-zero libnfs will connect directly to that port and bypass
the use of portmapper completely.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-04-08 14:36:37 +10:00
Daniel Abrecht 24ca14101f The check for getpwnam wrongly succeeded on some systems.
It didn't fail if pwd.h is missing because #includes must be seperated with a newline, a comma won't work.
The compile works anyway because the "struct passwd *pwd" implicitly declares an anonymus struct type "passwd"
and using an undeclared function is an implicit function declaration. Here's the output of configure in that case:

  configure:13381: checking whether getpwnam() is available
  configure:13396: i686-w64-mingw32-gcc -c -I/home/daniel/fsetmp/dokany/src/dokan_fuse/include/  -I/home/daniel/fsetmp/dokany/src/dokan_fuse/include/  conftest.c >&5
  conftest.c:23:23: warning: extra tokens at end of #include directive
   #include <sys/types.h>, #include <pwd.h>
                         ^
  conftest.c: In function 'main':
  conftest.c:28:30: warning: implicit declaration of function 'getpwnam' [-Wimplicit-function-declaration]
           struct passwd *pwd = getpwnam("nobody");
                                ^~~~~~~~
  conftest.c:28:30: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
  configure:13396: $? = 0
  configure:13403: result: yes
2018-04-07 16:40:44 +00:00
Ronnie Sahlberg 54405d994e don't log an error if we cailed the name to uid/gid mapping
we already convert this into "65534" anyway so there is no point in
also logging an error if we failed the name to uid/gid mapping.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-02-16 11:43:04 +10:00
Ronnie Sahlberg c5eca214fc add conditional support for getpwnam()
Some nfsv4 servers return a user/group name in the attributes instead
of a uid/gid number. At least for the "nobody" user.

For those, try to use getpwnam() where available to map the string back
to a uid/gid or return uid/gid==65534 (common value for nobody)
if not available or failing.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-02-16 08:24:26 +10:00
Ronnie Sahlberg 086c2ec138 improve error strings for rpc_connect_program_async() failures.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-02-01 13:28:05 +10:00
Ronnie Sahlberg 4dda1f87a4 nfsv4: add support for utime()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-01-10 17:09:14 +10:00
Ronnie Sahlberg 50068b8432 NFSv4: add support for fcntl locking
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-01-08 14:38:30 +10:00
Ronnie Sahlberg 09f8a621fb nfsv4: lock_owner is by client, not by filehandle
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-01-07 10:54:09 +10:00
Ronnie Sahlberg 208dd08039 NFSv4: add lockf emulation
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-01-07 08:35:42 +10:00
Ronnie Sahlberg 1da019ad71 NFSv4: Fix some compiler warnings
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-09-04 08:51:20 +10:00
Ronnie Sahlberg 8489557694 NFSv4: add utimes/lutimes support
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-09-03 06:25:55 +10:00
Ronnie Sahlberg 5ebd10f54c NFSv4: Add access()/access2()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-09-03 05:43:04 +10:00
Ronnie Sahlberg 4c6d19b3b8 NFSv4: Add support for chown/lchown/fchown
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-09-02 06:42:59 +10:00
Ronnie Sahlberg 6c034223fd NFSv4: Add support for chmod/lchmod/fchmod
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-09-01 14:02:43 +10:00
Ronnie Sahlberg c7655f90ca NFSv4: Add support for statvfs()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-27 07:56:19 +10:00
Ronnie Sahlberg 8f12f7f0a0 NFSv4: Add lseek() support.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-26 08:05:12 +10:00
Ronnie Sahlberg 73b81297e7 NFSv4: Add support for ftruncate()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-26 01:31:25 +10:00
Ronnie Sahlberg 80d3f48199 NFSv4: Add support for fsync()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-26 01:07:22 +10:00
Ronnie Sahlberg 8e1baa9d83 NFSv4: more nfs_op_* helpers to marshall compound command components
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-25 17:48:31 +10:00
Ronnie Sahlberg 81361d3aa3 NFSv4: re-work the nfs4_op_*() functions a bit and make them less overloaded
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-25 11:41:59 +10:00
Ronnie Sahlberg 2b6216dd6f NFSv4: add nfs_truncate() support
Rework the open() flow so we can append a extra callback to be invoked
once the open has completed.
Use this new feature to implement both nfs_truncate() as well as simplify
open(O_TRUNC) support.

Later this can be used for other commands too that need to open a path
and do something.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-25 10:37:07 +10:00
Ronnie Sahlberg 3928dac482 NFSv4: Update the way we increment seqid
RFC3530 8.1.5 decribes when we hould bump eqid
and when not to.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-21 10:53:29 +10:00
Ronnie Sahlberg cea99f8ed5 NFSv4: Add support for opendir()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-20 09:08:46 +10:00
Ronnie Sahlberg bd95371005 NFSv4: Add support for mknod()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-15 20:05:47 +10:00
Ronnie Sahlberg de9da5689d NFSv4: Add rename() support.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-14 09:20:08 +10:00
Ronnie Sahlberg 840c9b7367 NFSv4: Standardize how we create cb data for split path lookups.
Split path lookups is where we have a path '/this/is/the/path'
and we split it up into doing a lookup on '/this/is/the'
and append a different operation on 'path'.

Create a dedicated function that performs this initialization
and remove a lot of code duplication.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-11 06:24:53 +10:00
Ronnie Sahlberg a72dbc248d NFSv4: change populate_getattr to populate_getfh
The two functions are identical but in this case it is the fh we are
interested in and not the attributes.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-09 19:17:16 +10:00
Ronnie Sahlberg ffafa5fd9c NFSv4: add nfs_link() support.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-08 20:47:22 +10:00
Ronnie Sahlberg 352325169c NFSv4: Add support for nfs_unlink()
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>
2017-08-06 19:24:05 +10:00
Ronnie Sahlberg 9854c0d574 NFSv4: Add support for open_create() by plumbing it into open(O_CREAT)
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-06 19:15:04 +10:00
Ronnie Sahlberg efb21535ab NFSv4: Use nfs->mask when create the default mode for open(O_CREAT)
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-06 18:57:55 +10:00
Ronnie Sahlberg 65a0110476 NFSv4: Add support for open(O_CREAT)
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>
2017-08-06 18:43:28 +10:00
Ronnie Sahlberg 0ce4917afd nfs_open2(): Add a new nfs_open2() function that takes a mode argument.
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>
2017-08-06 16:02:39 +10:00
Ronnie Sahlberg 8c59fe7f24 NFSv4: Create a nice free-er function for the lookup blob
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-06 15:50:26 +10:00
Ronnie Sahlberg 65de83140a NFSv4: Add support (and tests) for open(O_APPEND)
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-03 20:25:59 +10:00