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

From: Andrew Morton (andrewm@uow.edu.au)
Date: Tue Apr 04 2000 - 19:49:23 EST


"H. Peter Anvin" wrote:
>
> I do think we need some canned functions to parse standard ASCII
> formats *in user memory*. With standard formats I mean integer arrays
> and escapable strings.

Seconded.

pwold011:/usr/src/linux-2.3.99-pre3> egrep -r "strto|strcmp|strncmp" . |
wc
   2324 15070 168444

There are a huge number of little hand-rolled open-coded string
parsers in the kernel. These are a source of bloat, possible
buffer overruns, race conditions, unconsistent user interface,
dubious error handling and general putridness.

A really nice 'scank' function would be a good thing to have.

- Table driven as well as functional interfaces

- Able to log config changes to syslog

- Accepts a spinlock ref from caller for atomic
  modification of multiple values.

- Accepts template for error messages

- Perhaps the place to check reconfiguration capabilities.

"Show me the code", you say. Well, it is on my list of things-to-do.
Unfortunately, this list which _should_ be FIFO is turning out to be
plain FI. (Thanks, Jeff).

-- 
-akpm-

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