On Tue, 19 Nov 2002, Brad Hards wrote:

| -----BEGIN PGP SIGNED MESSAGE-----
| Hash: SHA1
|
| On Tue, 19 Nov 2002 20:06, Ian Molton wrote:
| > On Mon, 18 Nov 2002 21:30:29 -0800
| >
| > Greg KH <[EMAIL PROTECTED]> wrote:
| > > > partly because of comments on this list about it being better than
| > > > just leaving users to do everything through file i/o :-)
| > >
| > > Hm, no, not a good idea :)
| >
| > why do people hate IOCTLs ?
| Different people hate them for different reasons. There is a lot to hate :)
|
| 1. Some people don't like the lack of portability.
|
| 2. Lots of people worry about the way the security aspects. The Stanford
| checker is still finding bugs.
|
| 3. Architects worry about the ad-hoc nature. Basically, you can just shove an
| ioctl() in anywhere, and blow off a proper API. This is the probably the
| biggest issue, and you can do _decent_ design with ioctl()s. (You can write
| maintainable code in assembler too, however both are pretty rare)
|
| 4. Some people don't like the unstructured nature. It is often next to
| impossible to tell how you are meant to use the beast, unless you have an
| example.
|
| 5. The documentation is always terrible.
|
| Here is an example, from <linux/input.h>,(not because it is particularly bad,
| but just because I'm familiar with it):
| #define EVIOCGREP               _IOR('E', 0x03, int[2])
|
| What do you think that does?
|
| Now if you had the comment:
| /* get repeat settings */
| (which is in the header), do you have any more idea?
|
| How about this one:
| #define EVIOCGSND(len)          _IOC(_IOC_READ, 'E', 0x1a, len)         /* get
| all sounds status */
|
| Does that make the problem any clearer?
|
| To be fair to the OP, Greg suggested using usbfs/libusb. That is really only
| swapping one set of ioctl()s for another. However at least they are a fairly
| well designed set of ioctl()s, and if you use libusb, you are probably
| insulated from API changes in the kernel.

6.  ioctl's aren't scriptable (unless you use an intermediate program or
interface like usbfs), and Linus likes to have interfaces that are
scriptable.  usbfs wouldn't exist if we could have come up with a decent
alternative.

-- 
~Randy



-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing 
your web site with SSL, click here to get a FREE TRIAL of a Thawte 
Server Certificate: http://www.gothawte.com/rd524.html
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to