Skip to content

Conversation

@Koichi98
Copy link
Contributor

@Koichi98 Koichi98 commented Jun 10, 2025

Description

Summary

This PR introduces an asynchronous file system service using a channel-based, client-server architecture.
It provides a user-facing FileDescriptor API that communicates with a backend MemoryFileSystemServer. All operations like open, read, and write are async functions.

Architecture Overview

Single Request Channel: The MemoryFileSystemServer listens on a single, shared channel for all incoming requests (Open, Read, Write, etc.).
Per-FD Response Channel: When a file is opened or created, a unique response channel is established for that specific file descriptor. The server uses this dedicated channel to send all subsequent I/O results (ReadResult, WriteBytes, etc.) back to the correct FileDescriptor instance, ensuring responses are routed correctly.

File System Operations Supported in this PR

  • Dir::create_file
  • Dir::open_file
  • Dir::open_dir
  • Dir::create_dir
  • Dir::remove_dir
  • Dir::remove_file
  • Dir::rename
  • File::abs_pos
  • File::set_accessed
  • File::set_created
  • File::set_modified
  • File::truncate
  • File::extents
  • File::read
  • File::write
  • File::seek

The names and types of commands exchanged between async_lib and the service will be added or modified as we introduce new features and support in the future.

Related links

How was this PR tested?

Notes for reviewers

In the current implementation, all requests from async_lib to the service use a single channel that was created during the service's initialization. However, it's not ideal for operations on all file descriptors to use the same channel, as an operation on one file descriptor by a task could affect another task's operation on a different file descriptor.

To solve this, we would need to create a separate, dedicated channel for file system operations for each file descriptor after it's generated by open, create, etc. But, this would require the service to handle I/O multiplexing (using select), which would increase the code's complexity. Therefore, we'll merge it as-is for now and fix this later.

Koichi98 and others added 30 commits April 17, 2025 11:01
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: koichiimai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: koichiimai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Koichi98 and others added 7 commits June 11, 2025 14:28
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
Signed-off-by: Koichi Imai <[email protected]>
@Koichi98 Koichi98 marked this pull request as ready for review June 12, 2025 02:05
Signed-off-by: Koichi <[email protected]>
@Koichi98 Koichi98 marked this pull request as draft June 12, 2025 06:30
@Koichi98 Koichi98 closed this Jun 17, 2025
@Koichi98 Koichi98 self-assigned this Jul 1, 2025
@Koichi98 Koichi98 deleted the fatfs_service branch July 9, 2025 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants