HomeFreeBSD

tarfs: 'struct tarfs_fid': Switch 'gen' to 'u_int', avoid packing

Description

tarfs: 'struct tarfs_fid': Switch 'gen' to 'u_int', avoid packing

As the 'gen' field in 'struct tarfs_node' (and then 'struct tarfs_fid')
is filled with arc4random() which returns an unsigned int, change its
type in both structures. This allows reordering fields in 'struct
tarfs_fid' to reduce its size, finally avoiding the use of '__packed' to
ensure it fits into 'struct fid'.

While here, remove the 'data0' field which wasn't necessary from the
start.

Reviewed by: markj, rmacklem, des
Approved by: markj (mentor)
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D47954

(cherry picked from commit cf0ede720391de986e350f23229da21c13bc7e9d)

Sponsored by: The FreeBSD Foundation

Details

Provenance
olceAuthored on Dec 6 2024, 4:35 PM
Reviewer
markj
Differential Revision
D47954: tarfs: 'struct tarfs_fid': Switch 'gen' to 'u_int', avoid packing
Parents
rG155987e20190: tarfs: Fix the size of struct tarfs_fid and add a static assert
Branches
Unknown
Tags
Unknown