/* Read entries from a directory. The NFSv3/4 verifier we ignore for now.  */
__be32 nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, struct readdir_cd *cdp, filldir_t func)
/* Read entries from a directory. The NFSv3/4 verifier we ignore for now.  */
__be32 nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, struct readdir_cd *cdp, filldir_t func)
{
	__be32		err;
	struct file	*file;
	loff_t		offset = *offsetp;
	err = nfsd_open(rqstp, fhp, S_IFDIR, NFSD_MAY_READ, &file);
	if (err)
		goto out;
	offset = vfs_llseek(file, offset, 0);
	if (offset < 0) {
		err = nfserrno((int)offset);
		goto out_close;
	}
	err = nfsd_buffered_readdir(file, func, cdp, offsetp);
	if (err == nfserr_eof || err == nfserr_toosmall)
		err = nfs_ok;
out_close:
	nfsd_close(file);
out:
	return err;
}