walnux/drivers
Ville Juven b8e30b54ec fs/vfs: Separate file descriptors from file descriptions
This patch is a rework of the NuttX file descriptor implementation. The
goal is two-fold:

1. Improve POSIX compliance. The old implementation tied file description
to inode only, not the file struct. POSIX however dictates otherwise.
2. Fix a bug with descriptor duplication (dup2() and dup3()). There is
an existing race condition with this POSIX API that currently results
in a kernel side crash.

The crash occurs when a partially open / closed file descriptor is
duplicated. The reason for the crash is that even if the descriptor is
closed, the file might still be in use by the kernel (due to e.g. ongoing
write to file). The open file data is changed by file_dup3() and this
causes a crash in the device / drivers themselves as they lose access to
the inode and private data.

The fix is done by separating struct file into file and file descriptor
structs. The file struct can live on even if the descriptor is closed,
fixing the crash. This also fixes the POSIX issue, as two descriptors
can now point to the same file.

Signed-off-by: Ville Juven <ville.juven@unikie.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-12 18:12:42 +08:00
..
1wire drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
aie drivers: unify Private Types banners 2025-05-28 10:17:15 +08:00
analog analog/ads1115: Speed up channel measurement delays 2025-05-29 15:23:06 +08:00
audio style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
bch drivers/bch: Add CONFIG_BCH_FORCE_INDIRECT 2025-04-03 16:21:51 +08:00
can style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
clk style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
contactless drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
coresight arch | boards | drivers: fix whitespace issues for switch case statements 2025-05-23 10:48:41 +08:00
crypto crypto/se05x: Allow set_enable_pin to be NULL and fix error handling 2024-11-07 11:37:58 +08:00
devicetree style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
dma drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
dummy drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
eeprom drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
efuse drivers: unify Private Types banners 2025-05-28 10:17:15 +08:00
i2c fs/drivers: Avoid causing a busy loop in the program due to context switching induced by sem_post. 2025-03-17 10:44:26 +01:00
i2s drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
i3c style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
input style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
ioexpander style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
ipcc style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
lcd drivers: unify Private Types banners 2025-05-28 10:17:15 +08:00
leds drivers: unify Private Types banners 2025-05-28 10:17:15 +08:00
loop drivers/iovec: revert vector io implement from loop/null/zero driver 2025-01-22 11:29:39 +08:00
math drivers: unify Private Types banners 2025-05-28 10:17:15 +08:00
misc fs/vfs: Separate file descriptors from file descriptions 2025-06-12 18:12:42 +08:00
mmcsd style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
modem drivers: unify Private Types banners 2025-05-28 10:17:15 +08:00
motor style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
mtd drivers/mtd: fix compile warning 2025-06-03 17:33:14 +08:00
net fs/file: unify prefix about file_xxx api, like file_open, file_ioctl 2025-06-12 18:12:42 +08:00
note drivers/note: Fix compilation with -Werr for note driver 2025-06-06 09:46:08 +08:00
pci style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
pinctrl drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
pipes fs/drivers: Avoid causing a busy loop in the program due to context switching induced by sem_post. 2025-03-17 10:44:26 +01:00
power drivers: unify Private Types banners 2025-05-28 10:17:15 +08:00
rc style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
regmap style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
reset style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
rf drivers/rf: migrate license to ASF 2024-11-06 19:46:13 +08:00
rmt drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
rpmsg style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
rptun style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
segger drivers/segger: Add support for System View post-mortem mode 2025-06-06 09:46:08 +08:00
sensors sensors/nau7802: Fix format warning 2025-06-04 15:26:47 +08:00
serial style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
spi style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
syslog syslog/rpmsg: disable force put char to lower putc 2025-06-03 17:33:03 +08:00
thermal style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
timers arch: Flag all definitions of up_perf_* functions with CONFIG_ARCH_HAVE_PERF_EVENTS 2025-06-06 17:31:10 +08:00
usbdev drivers/usbdev/cdcncm.c: Fix issue with unplug/replug of USB causing link not to re-establish 2025-05-24 12:29:07 +08:00
usbhost style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
usbmisc style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
usbmonitor drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
usrsock drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
vhost style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
video arch | boards | drivers: fix whitespace issues for switch case statements 2025-05-23 10:48:41 +08:00
virtio style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
wireless style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
.gitignore build: Remve the unnecessary .gitignore 2020-05-23 18:00:40 +01:00
CMakeLists.txt drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
drivers_initialize.c usbhost: add common usb host waiter and drivers initialization 2025-05-15 21:58:57 +08:00
Kconfig AI engine driver 2024-10-16 13:57:23 +08:00
Makefile drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00