aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2021-02-12 01:01:10 +0000
committerAlan Somers <asomers@FreeBSD.org>2021-02-13 04:50:52 +0000
commit71befc35061b3c9d8cc07e34c5dce622c848fcdb (patch)
tree7c296063a70d10acf7c5d1c72d46b4ced2741486 /sys
parenta375ec52a7b423133f66878ecf002efc3b6e9fca (diff)
downloadsrc-71befc35061b3c9d8cc07e34c5dce622c848fcdb.tar.gz
src-71befc35061b3c9d8cc07e34c5dce622c848fcdb.zip
fusefs: set d_off during VOP_READDIR
This allows d_off to be used with lseek to position the file so that getdirentries(2) will return the next entry. It is not used by readdir(3). PR: 253411 Reported by: John Millikin <jmillikin@gmail.com> Reviewed by: cem MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28605
Diffstat (limited to 'sys')
-rw-r--r--sys/fs/fuse/fuse_internal.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/fs/fuse/fuse_internal.c b/sys/fs/fuse/fuse_internal.c
index 60f9a7319e00..a5f646e5f449 100644
--- a/sys/fs/fuse/fuse_internal.c
+++ b/sys/fs/fuse/fuse_internal.c
@@ -583,7 +583,7 @@ fuse_internal_readdir_processdata(struct uio *uio,
u_long **cookiesp)
{
int err = 0;
- int bytesavail;
+ int oreclen;
size_t freclen;
struct dirent *de;
@@ -620,10 +620,10 @@ fuse_internal_readdir_processdata(struct uio *uio,
err = EINVAL;
break;
}
- bytesavail = GENERIC_DIRSIZ((struct pseudo_dirent *)
+ oreclen = GENERIC_DIRSIZ((struct pseudo_dirent *)
&fudge->namelen);
- if (bytesavail > uio_resid(uio)) {
+ if (oreclen > uio_resid(uio)) {
/* Out of space for the dir so we are done. */
err = -1;
break;
@@ -633,12 +633,13 @@ fuse_internal_readdir_processdata(struct uio *uio,
* the requested offset in the directory is found.
*/
if (*fnd_start != 0) {
- fiov_adjust(cookediov, bytesavail);
- bzero(cookediov->base, bytesavail);
+ fiov_adjust(cookediov, oreclen);
+ bzero(cookediov->base, oreclen);
de = (struct dirent *)cookediov->base;
de->d_fileno = fudge->ino;
- de->d_reclen = bytesavail;
+ de->d_off = fudge->off;
+ de->d_reclen = oreclen;
de->d_type = fudge->type;
de->d_namlen = fudge->namelen;
memcpy((char *)cookediov->base + sizeof(struct dirent) -