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

   ## Summary
   
   - **fs/procfs: list registered entries once and in their directory.**
     `procfs_readdir()` assumes that the entries of one directory are adjacent
     in `g_procfs_entries`, and drops a first-level name only when it repeats
     the name reported just before it. `procfs_register()` appends to the end
     of the table, so after registering `fs/foo` and `foo_bar`, `ls /proc`
     shows `fs` twice and hides `foo_bar`, and `ls /proc/fs` never reaches
     `foo`. Each directory now scans the rest of the table and skips a name
     an earlier entry already yields.
   - **fs/procfs: drop redundant uint8_t casts in the proc node table.** The
     field is already `uint8_t`.
   - **fs/procfs: call running_regs() directly in tcbinfo.**
     `tcbinfo_running_regs()` is a non-optimized wrapper that kept
     `g_running_tasks` from being optimized out; the scheduler now uses
     `g_running_tasks` on every configuration.
   
   ## Impact
   
   Only directory listings of procfs change, and only when entries were added
   with `procfs_register()`. The built-in table lists as before.
   
   ## Testing
   
   Host: Ubuntu x86_64, gcc (Ubuntu 13.1.0-8ubuntu1~22.04) 13.1.0, master 
5fbae0c401 (rebased onto 5fbae0c401; no new
   commit touches fs/procfs), `sim:nsh` with `CONFIG_FS_PROCFS_REGISTER`,
   `CONFIG_NET_LOOPBACK` and `CONFIG_NET_ROUTE`. A small test program calls
   `procfs_register()` for `fs/fsup_a` and `fsup_nodup`, then lists the
   directories with `opendir()`/`readdir()`:
   
   | | master | this PR |
   |---|---|---|
   | `/proc` | `... uptime version fs` (`fs` twice, no `fsup_nodup`) | `... 
uptime version fsup_nodup` |
   | `/proc/fs` | `blocks mount usage` | `blocks mount usage fsup_a` |
   | `/proc/net` | `route lo` | `route lo` |
   | `/proc/net/route` | `ipv4` | `ipv4` |
   
   `cat /proc/tcbinfo` still prints the current regs pointer.
   
   - `./tools/checkpatch.sh -g master..HEAD`: all checks pass.
   - Make and CMake builds pass; `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