jingfei195887 opened a new pull request, #21773:
URL: https://github.com/apache/nuttx/pull/21773

   ## Summary
   
   NFS has no `ioctl` method, so `FIOC_FILEPATH` (and `fcntl(F_GETPATH)`)
   on an NFS file fails: the VFS fallback in `file_ioctl()` only covers
   non-mountpoint inodes.
   
   - **fs/nfs: support FIOC_FILEPATH.** Keep the path relative to the mount
     point in the `nfsnode` at open time and return the mount point path joined
     with it, the same way hostfs does.
   
   ## Impact
   
   NFS only: `F_GETPATH` on an NFS file now returns its full path. Each open
   NFS file keeps a copy of its relative path (`strlen(relpath)` extra bytes).
   
   ## Testing
   
   Host: Ubuntu x86_64, gcc (Ubuntu 13.1.0-8ubuntu1~22.04) 13.1.0, master 
dc9481383e, `sim:nsh` with `CONFIG_NET`,
   `CONFIG_NET_TCP`, `CONFIG_NET_UDP`, `CONFIG_NET_SOCKOPTS`, `CONFIG_NFS` and
   a TAP device on a host bridge. The host runs the Linux kernel NFS server
   (NFSv3 over TCP). The test mounts the export with `nfsmount`, opens two
   files and calls `fcntl(fd, F_GETPATH, buf)`:
   
   | file | master | this PR |
   |---|---|---|
   | `/nfs/top.txt` | -1, empty path | 0, `/nfs/top.txt` |
   | `/nfs/sub/file.txt` | -1, empty path | 0, `/nfs/sub/file.txt` |
   
   - `./tools/checkpatch.sh -g master..HEAD`: all checks pass.
   - Make and CMake builds pass with no new warnings; `ostest` exits with 
status 0.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to