Re: Suggested dual human/binary interface for proc/devfs

From: Pavel Machek (pavel@suse.cz)
Date: Thu Apr 06 2000 - 18:12:00 EST


Hi!

> > Binary interfaces are the natural interface for programmes. ASCII
> > interfaces are the natural interface for humans. We need to support
> > both.
>
> OK, tell me when was the last time when you've used a lot of
> ioctl()s in your code. How often were they called? Examples,
> please.

[You wanted example, here you are].

Take a look how usbdevfs is done. AFAICS, it is build on ioctls
[example from usbd/example]:

static int usb_control_msg(int fd, u_int8_t requesttype, u_int8_t
request, u_int16_t value,
                           u_int16_t index, unsigned int size, void
*data)
{
        struct usb_proc_ctrltransfer ctrl;

        ctrl.requesttype = requesttype;
        ctrl.request = request;
        ctrl.value = value;
        ctrl.index = index;
        ctrl.length = size;
        ctrl.data = data;
        return ioctl(fd, USB_PROC_CONTROL, &ctrl);
}

Communication with usb device will be mostly done with stuff like
that...

...and you are probably right if you say "write(fd, ctrl,
sizeof(ctrl)", but I do not believe that fprintf(fd, "CONTROL MSG: %d
%d %d %d %d %d %d \n", .... ) is good idea.

                                                                Pavel

-- 
I'm pavel@ucw.cz. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents me at discuss@linmodems.org

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Apr 07 2000 - 21:00:18 EST