Re: silent semantic changes with reiser4

From: viro
Date: Sun Aug 29 2004 - 11:21:35 EST


On Sat, Aug 28, 2004 at 10:01:23PM -0700, Linus Torvalds wrote:
>
>
> On Sat, 28 Aug 2004, Hans Reiser wrote:
> >
> > I object to openat().....
>
> Sound slike you object to O_XATTRS, not openat() itself.
>
> Realize that openat() works independently of any special streams, it's
> fundamentally a "look up name starting from this file" (rather than
> "starting from root" or "starting from cwd").

Linus, openat() is trivial to implement in userland *IF* we are talking
about stuff already in namespace. Proof:

int openat(int fd, char *path, int flags, mode_t mode)
{
int len = snprintf(NULL, 0, "/proc/self/%d/%s", fd, path);
char name[len + 1];
sprintf(name, "/proc/self/%d/%s", fd, path);
return open(name, flags, mode);
}

7 lines. Replace VLA with alloca() or malloc() in pre-C99 environment.

In other words, there's nothing magical about syscall itself - compatibility
with Solaris is not an issue here. And basic functionality (i.e. what you've
described above) can be trivially achieved with no extra primitives at all.

Now, if you want to use that puppy as explicit indicator of magic steps taken,
fine, but that again says nothing about the primitives we want to express the
magic steps in question - reproducing openat() as one of the libc functions
won't be hard anyway.

So I have to agree with Hans on that one - I believe that as a fundamental
primitive it's wrong choice. Convenient to have in libc - sure, why not?
-
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/