[Libwebsockets] Enabling/disabling LWS_WITH_FILE_OPS consequences
Bram.Peeters at dekimo.com
Mon Nov 23 19:07:50 CET 2020
I noticed there are still some 'naked' posix file operation calls (open, fstat) even after enabling LWS_WITH_FILE_OPS
- In libwebsockets.c function:
int lws_open(const char *__file, int __oflag, ...)
- In cached-file.c function:
lwsac_cached_file(const char *filepath, lwsac_cached_file_t *cache, size_t *len)
Are these intentional or should they be redirected to the VFS ?
(especially the first one is a bit weird since it is only activated when LWS_WITH_FILE_OPS is set)
From: Bram Peeters
Sent: Monday, November 23, 2020 11:49
To: 'Andy Green' <andy at warmcat.com>; libwebsockets at ml.libwebsockets.org
Subject: RE: [Libwebsockets] Enabling/disabling LWS_WITH_FILE_OPS consequences
Ok, thank you !
From: Andy Green <andy at warmcat.com>
Sent: Monday, November 23, 2020 11:38
To: Bram Peeters <Bram.Peeters at dekimo.com>; libwebsockets at ml.libwebsockets.org
Subject: Re: [Libwebsockets] Enabling/disabling LWS_WITH_FILE_OPS consequences
On 11/23/20 10:27 AM, Bram Peeters wrote:
> I (noob user) am porting libwebsockets to a new platform and I am
> wondering what functionality I loose if I disable support for file
> operations (LWS_WITH_FILE_OPS) ?
Basically the lws VFS support.
> I tried googling but it did not immediately give me an answer.
> Also what kind of write operations happen if you enable it (volumes &
> frequency). This is to know if this can be redirected to internal
> program flash, or if something big is needed/something with wear leveling.
It doesn't cause any file operations.
If enabled, it will provide a generic VFS struct you can override on your platform to make file operations do whatever makes sense for your platform. Lws will use the vfs to, eg, read files to serve. By default the vfs maps to the generic POSIX file apis but you can override it.
If disabled, if your platform supports files at all it will directly use the POSIX file access apis on your platform.
> My apologies if this has been asked before, I do not immediately see a
> way to search the mailing archives.
You would probably want to find it out yourself by git grep the sources and see what it does, it's pretty esoteric.
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
More information about the Libwebsockets