Skip to content

unix: remove custome file.c code and use extmod's VFS-POSIX version instead - #5769

Merged
dpgeorge merged 2 commits into
micropython:masterfrom
dpgeorge:unix-use-vfs-posix-file
Mar 18, 2020
Merged

dpgeorge merged 2 commits into
micropython:masterfrom
dpgeorge:unix-use-vfs-posix-file

Conversation

@dpgeorge

Copy link
Copy Markdown
Member

Even if the unix port doesn't use the VFS subsystem it can still use the VFS POSIX file code because it's equivalent to the custom code in ports/unix/file.c.

@stinos

stinos commented Mar 18, 2020 •

Copy link
Copy Markdown
Contributor

This is good. For Windows you'll have to explcicitly add vfs_posix_file.c in both Makefile and sources.props. Or maybe these files should just default to use extmod/*.c but I assume there's a reason they don't. I can look into that if you want?

Edit: too fast, py.mk also doesn't use extmod/*.o so the Windows ports should also explicitly add the files they need.

@dpgeorge

Copy link
Copy Markdown
Member Author

Thanks for the review and suggestion. I think I have the Windows and MSVC builds worked out now.

Also support MP_STREAM_GET_FILENO ioctl.  The stdio flush change was done
previously for the unix port in 3e0b46b.
These changes make this POSIX file implementation equivalent to the unix
file implementation.
The implementation in extmod/vfs_posix_file.c is now equivalent to that in
ports/unix/file.c, so remove the latter and use the former instead.
@dpgeorge
dpgeorge force-pushed the unix-use-vfs-posix-file branch from b54f835 to 2cdf1d2 Compare March 18, 2020 10:02
@stinos

stinos commented Mar 18, 2020

Copy link
Copy Markdown
Contributor

Yes should be good. Tests still pass and they cover this pretty well I think.

@dpgeorge
dpgeorge merged commit 2cdf1d2 into micropython:master Mar 18, 2020
@dpgeorge
dpgeorge deleted the unix-use-vfs-posix-file branch March 18, 2020 10:17
@dpgeorge

Copy link
Copy Markdown
Member Author

Tests still pass and they cover this pretty well I think.

Yes, there are tests/io/* for this.

tannewt pushed a commit to tannewt/circuitpython that referenced this pull request Dec 29, 2021
…n-main

Translations update from Hosted Weblate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants