diff --git a/components/vfs/CMakeLists.txt b/components/vfs/CMakeLists.txt index 3e73e520..63c5ab46 100644 --- a/components/vfs/CMakeLists.txt +++ b/components/vfs/CMakeLists.txt @@ -1,9 +1,12 @@ if(CONFIG_USING_ESP_VFS) set(COMPONENT_SRCS "vfs.c" "vfs_uart.c") - set(COMPONENT_ADD_INCLUDEDIRS "include") - - set(COMPONENT_REQUIRES) - - register_component() +else() + set(COMPONENT_SRCDIRS "port") endif() + +set(COMPONENT_ADD_INCLUDEDIRS "include") + +set(COMPONENT_REQUIRES) + +register_component() diff --git a/components/vfs/component.mk b/components/vfs/component.mk index 158503ff..dfc08a88 100644 --- a/components/vfs/component.mk +++ b/components/vfs/component.mk @@ -4,7 +4,6 @@ # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) ifndef CONFIG_USING_ESP_VFS -COMPONENT_ADD_INCLUDEDIRS := -COMPONENT_SRCDIRS := +COMPONENT_SRCDIRS := port endif diff --git a/components/vfs/port/fcntl.c b/components/vfs/port/fcntl.c new file mode 100644 index 00000000..af6692a5 --- /dev/null +++ b/components/vfs/port/fcntl.c @@ -0,0 +1,37 @@ +// Copyright 2019-2020 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "sdkconfig.h" + +#ifndef CONFIG_USING_ESP_VFS + +#include +#include + +int fcntl(int fd, int request, ...) +{ + int val, ret; + va_list va; + + va_start(va, request); + + val = va_arg(va, int); + ret = lwip_fcntl(fd, request, val); + + va_end(va); + + return ret; +} + +#endif /* !CONFIG_USING_ESP_VFS */ diff --git a/components/vfs/port/ioctl.c b/components/vfs/port/ioctl.c new file mode 100644 index 00000000..72e0993b --- /dev/null +++ b/components/vfs/port/ioctl.c @@ -0,0 +1,42 @@ +// Copyright 2019-2020 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "sdkconfig.h" + +#ifndef CONFIG_USING_ESP_VFS + +#include +#include + +#undef ioctl + +#include + +int ioctl(int fd, int request, ...) +{ + int ret; + void *p; + va_list va; + + va_start(va, request); + + p = va_arg(va, void *); + ret = lwip_ioctl(fd, request, p); + + va_end(va); + + return ret; +} + +#endif /* !CONFIG_USING_ESP_VFS */