summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2025-04-16 12:44:55 +0200
committerMiklos Szeredi <mszeredi@redhat.com>2025-05-29 12:31:23 +0200
commit467e245d47e6662a4cbf4184d9e6d0b1b120c0bf (patch)
treefd2d80f962cc098e4352343bd3f85400da457041 /include/linux
parentc31f91c6af96a5eb0632f4aee8d4e39cad7d7559 (diff)
readdir: supply dir_context.count as readdir buffer size hint
This is a preparation for large readdir buffers in fuse. Simply setting the fuse buffer size to the userspace buffer size should work, the record sizes are similar (fuse's is slightly larger than libc's, so no overflow should ever happen). Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Jaco Kroon <jaco@uls.co.za>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/fs.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 0f2a1a572e3a..dfc5a3327124 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2071,6 +2071,13 @@ typedef bool (*filldir_t)(struct dir_context *, const char *, int, loff_t, u64,
struct dir_context {
filldir_t actor;
loff_t pos;
+ /*
+ * Filesystems MUST NOT MODIFY count, but may use as a hint:
+ * 0 unknown
+ * > 0 space in buffer (assume at least one entry)
+ * INT_MAX unlimited
+ */
+ int count;
};
/* If OR-ed with d_type, pending signals are not checked */