CVS: cvs.openbsd.org: src
Helg Bredow <[email protected]> Tue, 4 Aug 2026 09:20:28 -0600 (MDT)
| Newsgroups | gmane.os.openbsd.cvs |
|---|---|
| Message-ID | <[email protected]> |
CVSROOT: /cvs Module name: src Changes by: [email protected] 2026/08/04 09:20:28 Modified files: lib/libfuse : fuse_ops.c fuse_private.h Log message: When using the high-level FUSE API, the filesystem may choose between two modes of operation when implementing readdir(). 1) The readdir implementation ignores the offset parameter, and passes zero to the filler function's offset. The filler function will not return '1' (unless an error happens), so the whole directory is read in a single readdir operation. 2) The readdir implementation keeps track of the offsets of the directory entries. It uses the offset parameter and always passes non-zero offset to the filler function. When the buffer is full (or an error happens) the filler function will return '1'. We currently don't support 1) and instead implement an alternative mode that is stateless but emulates the behaviour. For each FUSE_READDIR received from the kernel, it will invoke the file system's readdir() callback and ask it to completely fill the buffer again, but ignore any entries that are before the given offset or exceed the size of the buffer. This of course has a performance penalty. This change introduces a stateful buffer that is filled by the file system on the first FUSE_READDIR message and then read from on subsequent FUSE_READDIR messages on the same directory vnode until FUSE_RELEASEDIR is received. If a 0 offset is passed to readdir, then the buffer is refreshed. This ensures that the buffer does not become stale when the file handle remains open due to the directory being the current directory for a process.