mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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
This commit is contained in:
parent
155987e201
commit
4634282f89
1 changed files with 5 additions and 6 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue