Skip to content

Change to stateless filesystem API#3484

Open
cpq wants to merge 2 commits intomasterfrom
fs2
Open

Change to stateless filesystem API#3484
cpq wants to merge 2 commits intomasterfrom
fs2

Conversation

@cpq
Copy link
Copy Markdown
Member

@cpq cpq commented Mar 27, 2026

This PR depends on #3477

No open/close anymore. Reads and writes are stateless

@cpq cpq requested a review from scaprile March 27, 2026 08:05
@scaprile scaprile force-pushed the fs2 branch 2 times, most recently from b6c373c to 40a4368 Compare March 27, 2026 14:24
Comment on lines +177 to 178
static FILE *std_open(const char *path, bool readonly) {
#if MG_ARCH == MG_ARCH_WIN32
Copy link
Copy Markdown
Collaborator

@scaprile scaprile Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've already had issues with sockets, we had to define MG_SOCKET_TYPE to support different types returned by different stacks.
I think we should stick to what is already working and building everywhere, or use MG_FILE_TYPE instead.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm could you elaborate please? FS abstraction seem unrelated to sockets.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm trying to point out the fact that every implementation may have its own internal type.
We deal with different socket implementations and needed to define our own type to accommodate to differences among those implementations.
The same is bound to happen with different filesystem implementations, and the current type usage hasn't had that problem so far, so I wouldn't risk introducing that issue, so I vote for keeping function signatures and argument types as they are now. Otherwise, go for a definable type like MG_FILE_TYPE, that can be defined at the arch level to the one that particular file system implementation uses.

@scaprile scaprile force-pushed the fs2 branch 2 times, most recently from 9b10dad to 68927e9 Compare April 1, 2026 19:28
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