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: [email protected]
Reporter: [email protected]
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.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"