diff options
| author | Olivier Certner <olce@FreeBSD.org> | 2024-12-06 16:35:08 +0000 |
|---|---|---|
| committer | Olivier Certner <olce@FreeBSD.org> | 2024-12-13 14:04:42 +0000 |
| commit | cf0ede720391de986e350f23229da21c13bc7e9d (patch) | |
| tree | 5dfd763d21971fb6fabce8255e7ca907c235d344 | |
| parent | a1097094c4c5d810287aca092f4ab5f9f86a426a (diff) | |
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
| -rw-r--r-- | sys/fs/tarfs/tarfs.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/fs/tarfs/tarfs.h b/sys/fs/tarfs/tarfs.h index ffb95d2c0ac5..46fa8b55b3ad 100644 --- a/sys/fs/tarfs/tarfs.h +++ b/sys/fs/tarfs/tarfs.h @@ -74,7 +74,7 @@ struct tarfs_node { struct timespec mtime; struct timespec ctime; struct timespec birthtime; - unsigned long gen; + uint32_t gen; /* Block map */ size_t nblk; @@ -161,11 +161,10 @@ struct tarfs_zio { }; struct tarfs_fid { - u_short len; /* length of data in bytes */ - u_short data0; /* force alignment */ - ino_t ino; - unsigned long gen; -} __packed; + u_short len; /* length of data in bytes */ + uint32_t gen; + ino_t ino; +}; #define TARFS_NODE_LOCK(tnp) \ mtx_lock(&(tnp)->lock) |
