Subject: Re: Understanding foo_open, foo_read, etc.
To: None <email@example.com>
From: Peter Seebach <firstname.lastname@example.org>
Date: 08/29/2006 17:14:59
In message <20060829210114.GW3689@gallia.cubidou.net>, Quentin Garnier writes:
>AFAIK, but I know or remember very little about that, but FreeBSD allows
>having close() called for each call of the system call, instead of only
>the last one. I prefer the NetBSD approach which is I think clearer in
>What's so complicated about calling fdalloc and returning the ressult
Nothing particularly awful about it, it's just that I'm trying to minimize
the changes I make from an existing driver that's expecting everything to
be using cdevsw operations rather than fileops operations. I can do it,
it's just extra work. :) I have about a dozen routines to deal with,
each of which is currently:
int zt_read(struct cdev *dev, struct uio *uio, int ioflag)
and needs to become:
int zt_read(struct file * fp, off_t * off, struct uio * uio, struct ucred * active_cred, int flags)
so it's a fair amount of nuisance, and makes it harder to integrate changes
back in, if the zaptel-freebsd people are even interested. It means a lot
of code duplication, probably. In practice, I think I can ignore the offset
and active_cred parameters, and indeed, even the flags; I just need to
use the first argument to identify a device, and then process the uio.
So it's not awful. And at least now I understand WHY I'm doing it.