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

From: Mark H. Wood (mwood@IUPUI.Edu)
Date: Wed Apr 05 2000 - 12:56:42 EST


On Tue, 4 Apr 2000, Richard Gooch wrote:
[much, snipped]
> WE NEED TO BE FORCEFUL ABOUT MAINTAINING A CONSISTENT INTERFACE SO
> THAT WE DON'T BREAK USER-SPACE CODE. IF A "SPELLING" PATCH GOES IN,
> THE PATCH AUTHOR SHOULD BE RELENTLESSLY HOUNDED UNTIL IT'S FIXED.
> "Fixed" means: old user-space code still works.
>
> If the API could be made tolerant of (resonable) changes to the
> interface (such as a new parameter in a "structure"), this would help
> a lot. But spelling "fixes" should be absolutely banned!

Amen! See below.

> Ideally, the API would allow you to pass a structure pointer which
> contains the data to be read/written. A structure is the natural way
> of dealing with mixed data. This would mean you'd need to pass in a
> descriptor as well, when converting.

Well, there's another way: a scatter/gather list:

        struct item
        {
          caddr_t buffer;
          long name;
          long buffer_size;
          long *data_length;
        };

        struct item getstuff = {
                                { &here, this, sizeof(here), &herelen },
                                { &there, that, sizeof(there), &therelen },
                                { 0, 0, 0, 0 }
                               };

        rc = getsysinfo(&getstuff);

This allows the addition of new data without breaking existing code that
doesn't ask for them, and removes ordering issues. It still allows you to
make one syscall and get lots of stuff back. You can even compose these
things on the fly if you like, and get back just what you ask for and no
more. You can choose to return some stuff and not others based on the
user's identity, if some items are considered sensitive information.

-- 
Mark H. Wood, Lead System Programmer   mwood@IUPUI.Edu
"Where's the kaboom?  There was supposed to be an Earth-shattering kaboom!"
	 -- Marvin Martian, 01/01/2000 00:00:00

- 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:15 EST