os: add zephyr virtual filesystem (zvfs) api #72894
Labels
area: File System
area: Networking
area: POSIX
POSIX API Library
area: Sockets
Networking sockets
Enhancement
Changes/Updates/Additions to existing features
Milestone
Is your enhancement proposal related to a problem? Please describe.
As part of the POSIX Roadmap for LTSv3, we should implement a common abstraction for
FILE *
andint
file descriptors that can be used throughout Zephyr applications.Describe the solution you'd like
The abstraction serves to support
FILE *
operations)FILE *
operations andint
operations on files, devices, sockets, etc)and should call into existing Zephyr subsystems such as Networking and Filesystem, which are part of Zephyr.
Other APIs such as POSIX, and C should call into ZVFS and not the opposite in order to eliminate API-level dependency cycles and to provide a more fully-featured and standard-conformant API.
Describe alternatives you've considered
Additional context
Details to be worked-out:
struct fd_entry
could betypedef
ed astypedef struct zvfs_entry FILE
fdtable[]
could server as a LUT mappingint
toFILE *
struct zvfs_mode
, which could betypedef
ed tomode_t
struct fd_entry
requires astruct zvfs_mode
to differentiate between block, char special files, links, directories, sockets, pipes, etcZVFS_
mode prefixFILE *
orint
file descriptor operations (i.e. duplicate all functions, macros enabled withPOSIX_DEVICE_IO
,POSIX_FILE_SYSTEM
,POSIX_NETWORKING
,POSIX_MAPPED_FILES
,POSIX_FD_MGMT
) but prefix them withzvfs_
.struct fd_op_vtable
. However, keep in mind, that Zephyr overloadsioctl()
to achieve a lot of optional POSIX file descriptor functionality. E.g.lseek()
->ZFD_IOCTL_FSYNC
./usr/include/linux/sockios.h
in Linuxstruct zvfs_fdset
->fdset
,struct zsock_poll
->struct zvfs_poll
,FD_ISSET()
->ZVFS_FD_ISSET()
).The text was updated successfully, but these errors were encountered: