Date: Wed, 10 Feb 2021 14:05:31 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 253411] FUSE driver doesn't populate dirent->d_off Message-ID: <bug-253411-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253411 Bug ID: 253411 Summary: FUSE driver doesn't populate dirent->d_off Product: Base System Version: 12.2-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: jmillikin@gmail.com Documentation for functions such as getdirentries(2) or getdents(2) describe a `d_off' field of `struct dirent' as a cookie that can be passed to lseek(2) to resume a directory seek at a given position. This field is not set for dirents read from a FUSE filesystem. I believe this may be caused by a missing field assignment in `fuse_internal_readdir_processdata()'. Below is a simple test driver that will print out dirent fields for a provided directory. Run it on a UFS volume and a fusefs volume to see different `d_off' behavior. ------------ #include <sys/types.h> #include <dirent.h> #include <stdio.h> int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, "usage: %s DIRPATH\n", argv[0]); return 1; } DIR *dir_p = opendir(argv[1]); int dir_fd = dirfd(dir_p); char buf[4096]; ssize_t rc = getdents(dir_fd, buf, 4096); ssize_t offset = 0; int ii = 0; while (offset < rc) { struct dirent *dent = (struct dirent*)(buf + offset); printf("dents[%d] = {\n", ii); printf(" .d_fileno = %lu,\n", dent->d_fileno); printf(" .d_off = %ld,\n", dent->d_off); printf(" .d_name = \"%s\",\n", dent->d_name); printf("}\n"); offset += dent->d_reclen; ii += 1; } return 0; } -- You are receiving this mail because: You are the assignee for the bug.help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-253411-227>
