Skip to content

Conversation

wu-eee
Copy link

@wu-eee wu-eee commented Oct 8, 2025

…d listing

Introduce the DynamicLookup trait to support dynamic directory lookup and listing in the kernel filesystem (kernfs). The trait provides:

  • dynamic_find: Looks up a dynamic entry by name, returning an IndexNode or None if not found.
  • dynamic_list: Lists all dynamic entries as a vector of strings.
  • is_valid_entry: Checks if a given entry name is valid without creating it.
  • create_temporary_entry: Optional method for creating temporary entries (defaults to None).

The trait is Send, Sync, and Debug to ensure thread-safety and debuggability, enabling flexible dynamic filesystem operations while maintaining compatibility with static lookups.

…d listing

Introduce the `DynamicLookup` trait to support dynamic directory lookup and listing in the kernel filesystem (kernfs). The trait provides:

- `dynamic_find`: Looks up a dynamic entry by name, returning an `IndexNode` or `None` if not found.
- `dynamic_list`: Lists all dynamic entries as a vector of strings.
- `is_valid_entry`: Checks if a given entry name is valid without creating it.
- `create_temporary_entry`: Optional method for creating temporary entries (defaults to `None`).

The trait is `Send`, `Sync`, and `Debug` to ensure thread-safety and debuggability, enabling flexible dynamic filesystem operations while maintaining compatibility with static lookups.
@github-actions github-actions bot added the enhancement New feature or request label Oct 8, 2025
Add current_id method to IdAllocator struct to get the current ID pointer position, mainly for debugging purposes.

This method returns the value of the current_id field of IdAllocator, which is convenient for viewing the current allocated ID position during debugging.
@fslongjin
Copy link
Member

这个trait没见到哪里使用到了,这个目的是什么?能否把用到的地方也pr了

@wu-eee
Copy link
Author

wu-eee commented Oct 8, 2025

这个trait没见到哪里使用到了,这个目的是什么?能否把用到的地方也pr了

这个trait用在PID目录、cgroup目录的动态查阅,涉及部分有些多,后续会逐步pr

- Introduce DynamicLookup trait for dynamic file/directory resolution
- Add temporary node support for non-persistent dynamic content
- Implement KernFS mount functionality with known path auto-mounting
- Extend find() and list() methods to support dynamic content
- Improve node management with enhanced recursive deletion
- Provide infrastructure support for procfs and other dynamic filesystems

Key changes:
* Add dynamic_lookup and is_temporary fields to KernFSInode
* New temporary node creation methods create_temporary_dir/file
* Implement IndexNode::mount() method
* Extend lookup and listing capabilities for dynamic content
* Improve node deletion and resource cleanup logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants