On 11/13/2017 09:19 PM, Fu, Rodney wrote:
Yes, an ioctl open is possible but not ideal. The interface would require an
additional open to perform the ioctl against. The open system call is really a
great place to pass control information to the filesystem and any other solution
seems less elegant.
But with the FS-specific open flag, you would have to do an open call
with O_PATH, check that the file system is what you expect, and then
openat the O_PATH descriptor to get a full descriptor. If you don't
follow this protocol, you might end up using a custom open flag with a
different file system which has completely different semantics for the flag.
So ioctl actually is much simpler here and needs fewer system calls.
(Due to per-file bind mounts, there is no way to figure out the file
system on which a file is located without actually opening the file.)
Thanks,
Florian