fops: allow setting from context creation and introduce lws_select_fops_by_vfs_path
authorAndy Green <andy@warmcat.com>
Wed, 1 Mar 2017 06:28:56 +0000 (14:28 +0800)
committerAndy Green <andy@warmcat.com>
Wed, 1 Mar 2017 06:59:48 +0000 (14:59 +0800)
commit1ada132932cae03be572b6886c7ad683943921f0
treef811bdc00e959a2100fe6be974fc3ae40c1721af
parentbe8d791b5e5e601207011c0454371dcb97e28b53
fops: allow setting from context creation and introduce lws_select_fops_by_vfs_path

1) There's now a .fops pointer that can be set in the context creation info.  If set, the array of
fops it points to (terminated by an entry with .open = NULL) is walked to find out the best vfs filesystem
path match (comparing the vfs path to fops.path_prefix) for which fops to use.

If none given (.fops is NULL in info) then behaviour is as before, fops are the platform-provided one only.

2) The built in fileserving now walks any array of fops looking for the best fops match automatically.

3) lws_plat_file_... apis are renamed to lws_vfs_file_...
12 files changed:
lib/context.c
lib/libwebsockets.c
lib/libwebsockets.h
lib/lws-plat-esp32.c
lib/lws-plat-optee.c
lib/lws-plat-unix.c
lib/lws-plat-win.c
lib/output.c
lib/private-libwebsockets.h
lib/server.c
test-server/test-server-http.c
test-server/test-server.c