Subject: Re: PROPOSAL: API for environmental sensors
To: None <tech-kern@netbsd.org>
From: Greg A. Woods <woods@most.weird.com>
List: tech-kern
Date: 11/13/1999 01:22:39
[ On Thursday, November 11, 1999 at 01:16:18 (-0800), Todd Whitesel wrote: ]
> Subject: Re: PROPOSAL:  API for environmental sensors
>
> Ah yes, another addition to the maze of twisty little ioctl's, all different,
> that unix is slowly acquiring to compete with other OS's "manager" APIs.

Indeed!  ;-)

When I first designed the ioctl() interface for my LM7x driver I
considered several other options, including sysctl and kernfs.

Unfortunately sysctl was in a major flux in FreeBSD at the time (though
headed in a useful direction) and NetBSD's sysctl innards are far too
primitive to be of use yet, so that ruled it right out.

Simiarly I found kernfs was a wee bit too weird to work with too -- all
the examples were badly written and I didn't have time to learn how to
properly write a good example virtual filesystem (the linux guys have
some good ideas on this front, BTW).

I did consider a simple Plan-9 style device with a simple ASCII
protocol, but I ended up falling back on trusty old ioctl() because I
didn't really want to invent a little language for talking to such
devices just for the LM7x chip (I really just wanted to get basic
support up and running and then think further in the future about the
other more advanced things like SES and Intel's BMC BIOS, etc.).

I think I still lean towards a virtual filesystem as my first choice and
a sysctl style interface (assuming it can be made much more dynamic than
it is today) as my second choice; even for an SES front end on a real
SCSI bus.  At the same time though I think most of the fancy stuff
should be kept in user land.

Ioctl() really does suck majorly for this kind of thing, but for a tiny
little LM7x it was terribly easy and cleaner than trying to define even
a read/write interface, never mind something that could use select() to
poll for events.

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>