ocamlfuse
ocamlfuse copied to clipboard
Query on semantics of buffers
This is probably a FUSE question, rather than an ocamlfuse question, but perhaps someone can help...
Suppose a user has an ocamlfuse filesystem mounted, and the user application calls write(somepath,buf,off,len) on some file in the ocamlfuse filesystem.
I know that ocamlfuse tries to avoid making copies of buffers.
My question: Suppose we want to cache the write inside the ocamlfuse filesystem. Perhaps we store (buf,off,len) somewhere, and later we asynchronously look at the data (buf,off,len) and do something with it (say, actually write it to some other filesystem). Now, my guess is that the buffer is only valid during the write call, and any attempt to access the buffer outside the call is a serious error. Is this correct? If so, are we forced to copy the buffer slice in order to implement this caching scenario?
Thanks