Re: [PATCH] vfs: new O_NODE open flag

From: Miklos Szeredi
Date: Fri Sep 25 2009 - 01:52:41 EST


On Fri, 25 Sep 2009, Andreas Gruenbacher wrote:
> On Thursday, 24 September 2009 16:51:58 Miklos Szeredi wrote:
> > This patch adds a new open flag, O_NODE. This flag means: open just
> > the filesystem node instead of the object referenced by the node.
>
> What is the intended use for O_NODE?

It lets userspace file descriptors reference a inode without actually
"dereferencing" it to get the underlying object. This allows for a
couple of new things:

- opening a special file (device/socket/fifo) without side effects

- opening a symlink

- opening any type of file without any permission is also possible
(of course the resuling file descriptor may not be read or written)

The above allows fstat(), fchmod(), ioctl(), etc to be used for files
previously not possible. AFS for example wanted a "pioctl()" syscall
for various things, but the same can be done without having to define
a new syscall:

fd = open(path, O_NODE);
ioctl(fd, ...);
close(fd);

Another important use would be opening a directory without read
permission (see O_SEARCH from the POSIX draft for what this is useful
for). O_NODE is not quite equivalent to O_SEARCH, but similar and
equally useful.

Thanks,
Miklos
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/