I'm writing an FUSE overlay fs (notifyfs), which can be an database clients can get data from through queries. My intention is to make it a cache/overlayfs/database clients can get data from when showing entries and their properties (attributes but also mimetype, icon etc).
A query is to get the contents of a directory. The client, which has already a connection (=fd) to notifyfs, asks for the data via a "list_message". My question is now howto programm the response notifyfs has to give. I'm thinking about three/two different methods. Note the following:
notifyfs responses in the basic form with different entries, where every entry is sort of:
int mode
uid_t uid
gid_t gid
size_t size
timespec ctime
timespec mtime
timespec atime
int lenname
char name[]
(call this notifyfs_entry_struct)
Note that the len of the name is not fixed, and is maximum 255. Futher clients ask for a certain number of entries, with a maximum. I'm not sure about this maximum exactly, but it will be something like 80.
a. one big buffer. The size is something like:
80 x (255+sizeof(struct notifyfs_entry_struct))
which will be more than 20400 bytes to be sure.
b. chunks of fixed size, using something like iovec or readdir.
What is the best option? The first method uses a buffer which will be at least 20400 bytes, it's a lot, but is it still doable?
Stef