opnsense-src/sys/fs/tmpfs
Olivier Certner 1ccbdf561f
tmpfs: Rework file handles
Change 'struct tmpfs_fid_data' to behave consistently with the private
structure other FSes use.  In a nutshell, make it a full alias of
'struct fid', instead of just using it to fill 'fid_data'.  This implies
adding a length field at start (aliasing 'fid_len' of 'struct fid'), and
filling 'fid_len' with the full size of the aliased structure.

To ensure that the new 'struct tmpfs_fid_data' is smaller than 'struct
fid', which the compile-time assert introduced in commit
91b5592a1e ("fs: Add static asserts for the size of fid
structures") checks (and thus was not strong enough when added), use
'__packed'.

A consequence of this change is that copying the 'struct tmpfs_fid_data'
into a stack-allocated variable becomes unnecessary, we simply rely on
the compiler emitting the proper code on seeing '__packed' (and on the
start of 'struct tmpfs_fid_data' being naturally aligned, which is
normally guaranteed by kernel's malloc() and/or inclusion in 'struct
fhandle').

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D47956
2024-12-23 15:46:55 +01:00
..
tmpfs.h tmpfs: Rework file handles 2024-12-23 15:46:55 +01:00
tmpfs_fifoops.c sys: Remove $FreeBSD$: two-line .c pattern 2023-08-16 11:54:30 -06:00
tmpfs_fifoops.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
tmpfs_subr.c tmpfs: Account for whiteouts during rename/rmdir 2024-09-08 18:34:15 -05:00
tmpfs_vfsops.c tmpfs: Rework file handles 2024-12-23 15:46:55 +01:00
tmpfs_vnops.c tmpfs: Rework file handles 2024-12-23 15:46:55 +01:00
tmpfs_vnops.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00