Subject: Re: fsctl(2) [was: Re: Interface to change NFS exports]
To: None <jmmv84@gmail.com, tech-kern@netbsd.org>
From: Ben Harris <bjh21@netbsd.org>
List: tech-kern
Date: 09/12/2005 22:08:04
In article <6b2d1e1905091212206c59c5ea@mail.gmail.com> you write:
>On 9/12/05, Bill Studenmund <wrstuden@netbsd.org> wrote:
>> On Mon, Sep 12, 2005 at 11:05:21AM +0200, Julio M. Merino Vidal wrote:
>> > We all agree in that a new system call is needed.  Some also want this
>> > new interface to not only manage NFS exports but also to allow changing
>> > other settings from a mount point.  I think this is a good idea too.
>> >
>> > Given these comments, I've started the implementation of a fsctl(2)
>> > function call, with the following signature:
>> >
>> >     int fsctl(const char *path, enum fsctl_command command, void *data);
>> >
>> > At the moment, command can be one of FSCTL_EXPORT_NFS_GET or
>> > FSCTL_EXPORT_NFS_SET, to query or set NFS export lists respectively
>> > based on the given path.  (Minor question: can an enum be used as a
>> > system call argument, or should I better use an integer?  If not, why?)
>>
>> Use and integer and steal the implementation from ioctl() and fcntl(). Or
>
>OK, but is it anything wrong in using an enum? (Such as the type to
>represent it may change or something like that?)

Precisely that.  The ARM EABI, for instance (not that NetBSD follows it
yet), requires that enums be stored in the smallest integer type that will
hold them.  This kind of thing makes them dangerous to use in any interface,
since they're liable to change size when new values are introduced.

-- 
Ben Harris