FBSD: Accommodate 12.0's 64-bit inodes

In FreeBSD 12 (see: https://reviews.freebsd.org/rS318736), the layout
of struct dirent changed to allow for 64-bit inodes and a few other
changes. Update our struct min_direct to accommodate, to allow our
readdir() results to be accurate. Without this, readdir() can yield
garbage entries, due to the mismatch in the structure definitions.

Change-Id: I36c2bf1f35b4d1ab61a2b4d51da7514827b3551b
Reviewed-on: https://gerrit.openafs.org/13854
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Tim Creech 2019-08-29 21:35:36 -04:00 committed by Benjamin Kaduk
parent c0b7367253
commit 14cbd02b8a

View File

@ -158,6 +158,15 @@ struct min_direct { /* miniature direct structure */
uint16_t d_reclen; /* length of this record */ uint16_t d_reclen; /* length of this record */
uint16_t d_namlen; /* length of string in d_name */ uint16_t d_namlen; /* length of string in d_name */
uint8_t d_type; /* file type, see below */ uint8_t d_type; /* file type, see below */
#elif defined(AFS_FBSD120_ENV)
/* FreeBSD 12.0 moved to 64-bit inodes and bumped d_namlen to 16 bits. */
ino_t d_fileno;
off_t d_off;
u_short d_reclen;
u_char d_type;
u_char d_pad0;
u_short d_namlen;
u_short d_pad1;
#elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) #elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
afs_uint32 d_fileno; afs_uint32 d_fileno;
u_short d_reclen; u_short d_reclen;
@ -317,6 +326,7 @@ afs_readdir_move(struct DirEntry *de, struct vcache *vc, struct uio *auio,
#endif /* AFS_SUN5_ENV */ #endif /* AFS_SUN5_ENV */
#ifndef AFS_SGI53_ENV #ifndef AFS_SGI53_ENV
struct min_direct sdirEntry; struct min_direct sdirEntry;
memset(&sdirEntry, 0, sizeof(sdirEntry));
#endif /* AFS_SGI53_ENV */ #endif /* AFS_SGI53_ENV */
AFS_STATCNT(afs_readdir_move); AFS_STATCNT(afs_readdir_move);