Re: vfs: is there any way to distinguish read() for different file descriptors
Is there any way to distinguish if operations (read/write/..) are run against different descriptors? Currently fuse4x does an ugly hack - it stores 3 descriptors per vnode - for read-only/write-only/rdrw descriptors. It means if the same file is open 2 times with there same mode (e.g. RDONLY) then fuse4x uses only one file descriptor. For fuse userspace it looks like the file was opened only once and all read operations are done for the same file descriptor.
I feel your pain, because I ported a Linux filesystem to MacOS X and I had to deal with a ton of issues like this. Shantonu has already given you the authoritative answer (no), but it occurs to me that you have some alternate options. You get notified of an open with a VOP_OPEN, and you get the mode of the open at that time. So you could use that to create new file descriptors ... although you will probably have a hard time in practice matching up a request with a descriptor. You could at least distinguish between different modes of open. But something occurs to me - let's say three different processes open the same file with the same mode, so the fuse backend shares a descriptor among the different open requests. So what? I mean, how exactly is that a problem? You get a file offset and size with every request, so it's not an issue of tracking the offset in the descriptor. Seems to me this isn't a problem in practice ... unless I'm missing something (which is always possible). --Ken _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com
participants (1)
-
Ken Hornstein