Skip to content

Commit

Permalink
FreeBSD: Update argument types for VOP_READDIR
Browse files Browse the repository at this point in the history
A recent commit to FreeBSD changed the type of
vop_readdir_args.a_cookies to a uint64_t**.  There is no functional
impact to ZFS because ZFS only uses 32-bit cookies, which will be
zero-extended to 64-bits by the existing code.

freebsd/freebsd-src@b214fcc

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Alan Somers <asomers@gmail.com>
Closes openzfs#12874
  • Loading branch information
asomers authored and Ryan Moeller committed Jan 18, 2022
1 parent 903b641 commit cd6d553
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions module/os/freebsd/zfs/zfs_vnops_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ VFS_SMR_DECLARE;
#define VNCHECKREF(vp)
#endif

#if __FreeBSD_version >= 1400045
typedef uint64_t cookie_t;
#else
typedef ulong_t cookie_t;
#endif

/*
* Programming rules.
*
Expand Down Expand Up @@ -1679,7 +1685,7 @@ zfs_rmdir(znode_t *dzp, const char *name, znode_t *cwd, cred_t *cr, int flags)
/* ARGSUSED */
static int
zfs_readdir(vnode_t *vp, zfs_uio_t *uio, cred_t *cr, int *eofp,
int *ncookies, ulong_t **cookies)
int *ncookies, cookie_t **cookies)
{
znode_t *zp = VTOZ(vp);
iovec_t *iovp;
Expand All @@ -1701,7 +1707,7 @@ zfs_readdir(vnode_t *vp, zfs_uio_t *uio, cred_t *cr, int *eofp,
boolean_t check_sysattrs;
uint8_t type;
int ncooks;
ulong_t *cooks = NULL;
cookie_t *cooks = NULL;
int flags = 0;

ZFS_ENTER(zfsvfs);
Expand Down Expand Up @@ -1778,7 +1784,7 @@ zfs_readdir(vnode_t *vp, zfs_uio_t *uio, cred_t *cr, int *eofp,
*/
ncooks = zfs_uio_resid(uio) / (sizeof (struct dirent) -
sizeof (((struct dirent *)NULL)->d_name) + 1);
cooks = malloc(ncooks * sizeof (ulong_t), M_TEMP, M_WAITOK);
cooks = malloc(ncooks * sizeof (*cooks), M_TEMP, M_WAITOK);
*cookies = cooks;
*ncookies = ncooks;
}
Expand Down Expand Up @@ -4732,7 +4738,7 @@ struct vop_readdir_args {
struct ucred *a_cred;
int *a_eofflag;
int *a_ncookies;
ulong_t **a_cookies;
cookie_t **a_cookies;
};
#endif

Expand Down

0 comments on commit cd6d553

Please sign in to comment.