CV-Bowen opened a new pull request, #22087:
URL: https://github.com/apache/nuttx/pull/22087

   ## Summary
   
   Changes to the RPMsg file system (`fs/rpmsgfs/`):
   
   - `let the client pass a file offset with read and write`: the read and
     write messages get an `offset` field. The server seeks to it before
     the transfer when it is not negative, so a client that tracks the
     file position itself (the Linux rpmsgfs client does) can say where to
     read or write. The NuttX client sends -1 and keeps using the server's
     file position, so its behaviour does not change.
   - `check the buffer size in readdir` and `check the buffer size in
     readlink`: both server handlers stored the rpmsg buffer size in an
     unsigned variable, so a negative error from
     `rpmsg_get_tx_buffer_size()` / `rpmsg_get_rx_buffer_size()`, or a
     buffer not larger than the message header, let the name or link be
     copied past the end of the message. Reply with the error instead.
   - `copy the mount options into a temporary buffer`: `rpmsgfs_bind()`
     only needs its copy of the option string while it tokenizes it; take
     it from `lib_get_tempbuffer()` instead of the file system heap.
   - `run the client callbacks in the rx interrupt`: every client reply
     handler only copies the result into the waiting request and posts its
     semaphore, so the client endpoint is set to `RPMSG_PRIO_RT` and
     rpmsg_virtio runs it straight from the rx interrupt instead of a
     worker thread. The server endpoint keeps the default priority.
   - `rename the endpoint callback`: the server's `rpmsgfs_ept_cb` becomes
     `rpmsgfs_server_ept_cb`, so the two sides' callbacks have different
     names in an image that links both. No functional change.
   
   ## Impact
   
   - The read/write message grows by 8 bytes (`int64_t offset`), so both
     sides of an rpmsgfs link must run the same version.
   - The client endpoint callback runs in interrupt context on
     rpmsg_virtio transports.
   - No API or Kconfig change.
   
   ## Testing
   
   Host: Ubuntu 22.04.5 LTS x86_64, QEMU version 10.2.1, sim: cc (Ubuntu 
13.1.0-8ubuntu1~22.04) 13.1.0, qemu-armv8a: aarch64-none-elf-gcc (Arm GNU 
Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 20221205
   
   sim:rpserver + sim:rpproxy and qemu-armv8a:rpserver + qemu-armv8a:rpproxy,
   each with `CONFIG_FS_TMPFS=y CONFIG_FS_LINKS=y` added on both sides
   (qemu-armv8a also with the baseline overlay below). The server creates
   a pseudo-fs link, then the proxy mounts the server's `/tmp` and `/`:
   
   ```
   server> ln -s /proc /p120lnk
   proxy>  mount -t rpmsgfs -o cpu=server,fs=/tmp /srv
   proxy>  echo p120data > /srv/f1
   proxy>  cat /srv/f1
   proxy>  echo p120more >> /srv/f1
   proxy>  cat /srv/f1
   proxy>  mv /srv/f1 /srv/f2
   proxy>  mkdir /srv/d1
   proxy>  ls -l /srv
   server> cat /tmp/f2
   proxy>  rm /srv/f2
   proxy>  rmdir /srv/d1
   proxy>  mount -t rpmsgfs -o cpu=server,fs=/ /srvroot
   proxy>  readlink /srvroot/p120lnk
   proxy>  rpmsg dump all
   proxy>  umount /srvroot
   proxy>  umount /srv
   ```
   
   | | master | this PR |
   |---|---|---|
   | sim: 18 steps (2 runs) | all pass | all pass |
   | qemu-armv8a: 18 steps (2 runs) | all pass | all pass |
   | file contents, `ls -l`, server-side `cat`, `readlink` | same | same |
   | proxy `rpmsgfs-*` endpoint priority | 127 | 255 |
   
   <details><summary>this PR, sim proxy</summary>
   
   ```
   proxy> cat /srv/f1
   p120data
   p120more
   proxy> ls -l /srv
   /srv:
    drwxrwxrwx           0 2026-11-19 19:42 d1/
    -rwxrwxrwx          18 2026-11-19 19:42 f2
   server> cat /tmp/f2
   p120data
   p120more
   proxy> readlink /srvroot/p120lnk
   /proc
   proxy> rpmsg dump all
   [proxy]     ept rpmsgfs-0xec044ab8 0xec044ab8: addr=1040 dest=1040 refcnt=1 
priority=255 priv=0xec044ab8
   [proxy]     ept rpmsgfs-0xec044cb0 0xec044cb0: addr=1041 dest=1041 refcnt=1 
priority=255 priv=0xec044cb0
   ```
   </details>
   
   Not tested: a client that sends a real offset (no such client in the
   tree; the NuttX client always sends -1), and the new error paths in
   readdir/readlink, which need `rpmsg_get_tx_buffer_size()` to fail or a
   buffer no larger than the message header.
   
   Each commit builds without warnings on sim:rpserver, sim:rpproxy,
   qemu-armv8a:rpserver and qemu-armv8a:rpproxy with
   `CONFIG_FS_LINKS=y`.
   
   No regression in rpmsg: sim:rpserver/rpproxy and 
qemu-armv8a:rpserver/rpproxy boot and pass the fixed rpmsg cases (dump, ping, 
rpmsgfs; 15/15). qemu-armv8a was built with LIBC_ENVPATH and BINFMT_CHECKEXEC 
disabled, which current master needs for nxinit to start nsh there; unrelated 
to this change.
   


-- 
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