Subject: Re: filehandle
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Martin Husemann <martin@duskware.de>
List: tech-kern
Date: 07/21/2006 22:49:58
On Fri, Jul 21, 2006 at 07:10:20PM +0100, David Laight wrote:
> So you continue to export fhandle_y, but don't expose the header file
> that defines any contents.
Hmmm, we could actually define a special version (completely independend
of the kernel fhandle_t) for userland:
typedef struct fhandle {
size_t fh_size;
} fhandle_t;
and then use small libc wrappers around the real syscall, that keep the
old signature:
int fhopen(fhandle_t *fh, int flags)
{
return fhopen2(((char*)fh)+sizeof(fhandle_t), fh->fh_size, flags);
}
and
int getfh2(const char *path, fhandle_t *fh, size_t *fh_size)
{
int err;
size_t s = *fh_size;
if (s > sizeof(fhandle_t))
s -= sizeof(fhandle_t);
err = sys__getfh30(path, ((char*)fh)+sizeof(fhandle_t), &s);
if (err == 0)
fh->fh_size = s;
*fh_size = s + sizeof(fhandle_t);
}
But I'm not realy sure I like this.
Martin