public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* RE: Yet another design for /proc. Or actually /kernel.
@ 2001-11-07 21:13 Brenneke, Matthew Jeffrey (UMR-Student)
  2001-11-08  0:00 ` H. Peter Anvin
                   ` (4 more replies)
  0 siblings, 5 replies; 27+ messages in thread
From: Brenneke, Matthew Jeffrey (UMR-Student) @ 2001-11-07 21:13 UTC (permalink / raw)
  To: 'H. Peter Anvin'; +Cc: 'linux-kernel@vger.kernel.org'

>-----Original Message-----
>From: H. Peter Anvin [mailto:hpa@zytor.com]
>Sent: Wednesday, November 07, 2001 2:58 PM
>To: linux-kernel@vger.kernel.org
>Subject: Re: Yet another design for /proc. Or actually /kernel.


>Followup to:  <slrn9uj1nf.5lj.spamtrap@dexter.hensema.xs4all.nl>
>By author:    spamtrap@use.reply-to (Erik Hensema)
>In newsgroup: linux.dev.kernel
>> 
>> - Multiple values per file when needed
>> 	A file is a two dimensional array: it has lines and every line
>> 	can consist of multiple fields.
>> 	A good example of this is the current /proc/mounts.
>> 	This can be parsed very easily in all languages.
>> 	No need for single-value files, that's oversimplification.
>> 

>Actually, /proc/mounts is currently broken, and is an excellent
>example of why the above statement simply isn't true unless you apply
>another level of indirection: try mounting something on a directory
>the name of which contains whitespace in any form (remember, depending
>on your setup this may be doable by an unprivileged user...)

>	-hpa


mbrennek@spaceheater:/home/mbrennek# mkdir stuff\ and
mbrennek@spaceheater:/home/mbrennek# mount -t vfat /dev/hda1
/home/mbrennek/stuff\ and/
mbrennek@spaceheater:/home/mbrennek# cat /proc/mounts
/dev/ide/host0/bus0/target1/lun0/part1 / reiserfs rw 0 0
/dev/hdb2 /home reisferfs rw 0 0
none /dev/pts devpts rw 0 0
non /proc proc rw 0 0
/dev/hda5 /mnt/stuff vfat rw,nosuid,nodev,noexec 0 0
/dev/hda1 /home/mbrennek/stuff\040and vfat rw 0 0
mbrennek@spaceheater:/home/mbrennek#

Are you refering to the 040?

-Matt

^ permalink raw reply	[flat|nested] 27+ messages in thread
* Yet another design for /proc. Or actually /kernel.
@ 2001-11-07 19:09 Erik Hensema
  2001-11-07 19:27 ` Alan Cox
                   ` (4 more replies)
  0 siblings, 5 replies; 27+ messages in thread
From: Erik Hensema @ 2001-11-07 19:09 UTC (permalink / raw)
  To: linux-kernel


Here's my go at a new design for /proc. I designed it from a userland
point of view and tried not to drown myself into details.

Design goals
============

- Backward compatibility
	The current /proc interface is coded into many applications.
	A new design must leave room for backward compatibility.
- Forward compatibility
	The new interface must be clearly defined and must not change
	in the future, unless that change is clearly indicated and it
	would cause horrible pain maintaining the current interface.
	(Note: I mean the interface to userland, kernel interfaces may
	change as much as they like)
- Parsable by applications
	Information in /proc isn't really meant for humans to read.
	Maybe programmers, but they aren't human anyway. The new /proc
	interface must be parsable by applications as easily as
	possible.
- Readable by humans
	When there's no compelling need to obscure information, don't.
- As simple as possible
	Don't bloat the interface with all kinds of fancy decorations.
	Let's leave that to userspace.


>From these goals I come to the following design:

Design
======

- Multiple values per file when needed
	A file is a two dimensional array: it has lines and every line
	can consist of multiple fields.
	A good example of this is the current /proc/mounts.
	This can be parsed very easily in all languages.
	No need for single-value files, that's oversimplification.
- No headers, no pretty formatting
	Headers are nice to humans, but applications tend to dislike
	them. Same goes for formatting.
	An example of this is in /proc/partitions or -- horrors --
	/proc/meminfo.
- ASCII values
	ASCII is the only format which can be read by humans, shell
	scripts, perl, C and the rest of the world.
- Maybe we should move out of /proc
	Since this design must leave room for backwards compatibility
	we must assume the current /proc stays around for a while. I
	propose we create a new kernelfs which is to be mounted at
	/kernel.
- Mandatory documentation
	Each and every value must be documented. This documentation
	may be very, very basic, but it must clearly define the entry
	and its intention. This is forward compatibility.


As an example, this is how I would organize the info currently in
/proc/meminfo (any boy, that file is UGLY!):

Every value is in bytes. Rounding to kbytes or mbytes should be done
in userspace.

New		Current entry in /proc/meminfo
--------------- -----------------------------------
mem/total	MemTotal
mem/free	MemFree
mem/shared	MemShared
mem/buffers	Buffers
mem/cached	Cached
mem/active	Active
mem/inactive	Inactive

mem/high/total	HighTotal
mem/high/free	HighFree

mem/low/total	LowTotal
mem/low/free	LowFree

mem/swap/total	SwapTotal
mem/swap/free	SwapFree
mem/swap/cached	SwapCached
mem/swap/files	(current /proc/swaps)
-- 
Erik Hensema (erik@hensema.net)
I'm on the list, no need to Cc: me, though I appreciate one if your
mailer doesn't support the References header.

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2001-11-12 13:39 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <w_knop@hotmail.com>
2001-11-07 19:41 ` Yet another design for /proc. Or actually /kernel William Knop
2001-11-08  0:27   ` John Levon
2001-11-08  8:56     ` Erik Hensema
2001-11-08 10:00   ` Remco Post
2001-11-09 16:44     ` Ricky Beam
2001-11-12 13:31       ` Horst von Brand
2001-11-12 14:31         ` Martin Dalecki
2001-11-07 21:13 Brenneke, Matthew Jeffrey (UMR-Student)
2001-11-08  0:00 ` H. Peter Anvin
2001-11-08  0:20 ` antirez
2001-11-08  0:32   ` H. Peter Anvin
2001-11-08  0:54   ` David Ford
2001-11-08  1:10     ` antirez
2001-11-08  1:26       ` H. Peter Anvin
2001-11-08  1:51         ` antirez
2001-11-08  0:44 ` Stephen Satchell
2001-11-08  1:04   ` antirez
2001-11-08  0:55 ` Jonathan Lundell
2001-11-08  3:07 ` Stuart Young
  -- strict thread matches above, loose matches on Subject: below --
2001-11-07 19:09 Erik Hensema
2001-11-07 19:27 ` Alan Cox
2001-11-07 19:42 ` Daniel R. Warner
2001-11-07 22:35   ` Allen Campbell
2001-11-07 20:58 ` H. Peter Anvin
2001-11-07 21:19   ` Justin A
2001-11-07 23:44 ` Rusty Russell
2001-11-08  0:35 ` Stephen Satchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox