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

From: Alexander Viro (viro@math.psu.edu)
Date: Thu Apr 06 2000 - 03:20:36 EST


On Tue, 4 Apr 2000, Richard Gooch wrote:

> The reality is that real input is more complicated than you
> describe. For a start, your code doesn't handle mixed
> datatypes. Something that a structure handles very well.

Who. Asks. You. To. Introduce arbitrary complex formats?

> It's a fundamental fact that ASCII parsers require more code (even
> with atoi(3) and similar functions) than direct structure accessing.

Numbers, please. Direct structure accessing means that we are going to get
tons of dreck thrown to us when we will decide to change the data type.
And compatibility crap around the place.

> > > Frankly, I'm surprised that someone hasn't submitted a patch to make
> > > some procfs file output the right escape codes to generate a
> > > multi-coloured output line.
> > > "But it looks so *pretty*".
> >
> > BS. It's not about "pretty", it's about "doesn't depend on magic
> > constants, is bytesex-independednt and can be used with any regular
> > UNIX tools, starting with echo".
>
> I'm not saying ASCII interfaces are there to be pretty. I've already
> acknowledged that they have good reason. I'm not at all suggesting
> that we have binary only interfaces. My point about "pretty" is that
> there is too much temptation to go in and beautify ASCII output. It's
> happened multiple times. If the ASCII interfaces were only read by
> humans, it wouldn't be an issue. But they're read by computers too.

So LART the idiots who play with "beautify" patches. BFD.

> A binary interface doesn't have all the problems you're trying to
> suggest:
>
> - no magic constants needed

Uh-oh... Kinda hard to do with ioctl() - mind you, its second argument
looks awfully like a magic constant.

> - byte ordering doesn't matter since we're reading from the same
> machine

Now. For some kinds of objects.

> - regular Unix tools can use the ASCII interface, specialised
> programmes can use the binary interface.
 
Sigh... You do realize that the only reason why many of those "specialized
tools" exist at all is the lack of ASCII interface?

> 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.
Binary interfaces are _not_ natural - they are OK when you talk to
yourself, but _not_ when you talk to another program. Or to the kernel,
for that matter. Yes, for simple data types it's OK. For anything complex
- nope.

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