Along the lines of one-value-per-file I have another suggestion:
Now, that multiple dentrys are possible in one filesystem,
wouldn't it be cool to give every possible type a identifier
(long = 4, short = 2, long long [64bit] = 8, struct task_struct = 0x1080, ...),
and make some data structures with this kind of info?
let me explain.
for every (simple) type there is a field of pointer for bin->ascii, ascii->bin.
for extended types (structs) there is an array with the typed as lying in memory.
eg: task_struct (type 0x1080):
long state = 4
long flags = 4
int sigpending = 4 (on 32bit)
struct mm_segment_t = 0x2020
struct exec_domain * = 0x80000000 | 0x3020
...
so simple types can be represented in /proc as files,
and pointers as symlinks, and structs as directories.
So /proc/net is a array with references to
protocols ->net_proto_families,
ipv4 -> ipv4_tables,
...
This type-table could/should be generated from the source, and
include (in the lowest 12bit) the length. see later why.
I know that it's not as easy as I wrote here - but it's relatively easy
and extensible to operate. AND the .dump would be VERY easy -
just copy the structure (length known as low bits from type)
in another area (that's atomically possible) and dump each member - voila!
So there's 1 parser in the kernel; it knows how to traverse
the tree of structures in memory; and it's table-based.
Comments???
-
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 : Sun Apr 23 2000 - 21:00:14 EST