public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Touloumtzis <miket@bluemug.com>
To: "Albert D. Cahalan" <acahalan@cs.uml.edu>
Cc: Alexander Viro <viro@math.psu.edu>,
	Thunder from the hill <thunder@ngforever.de>,
	Peter Chubb <peter@chubb.wattle.id.au>,
	Pavel Machek <pavel@ucw.cz>,
	Matt_Domsch@Dell.com, Andries.Brouwer@cwi.nl,
	linux-kernel@vger.kernel.org
Subject: Re: 2.5.28 and partitions
Date: Fri, 2 Aug 2002 15:53:47 -0700	[thread overview]
Message-ID: <20020802225347.GI4116@bluemug.com> (raw)
In-Reply-To: <200208022212.g72MCsu456903@saturn.cs.uml.edu>

On Fri, Aug 02, 2002 at 06:12:54PM -0400, Albert D. Cahalan wrote:
>
> > Of course you have to stuff the values into native binary formats
> > eventually.  I'm just talking about on-disk representation,
> > not in-memory.
> 
> Ah, but it has to get into memory at some point.
> There it will need a data type. Changing the data
> type involves changing the parser and inventing
> yet another in-memory struct anyway.

Right, but if each of your in-memory structs is localized to the
kernel (i.e. not present in the partition table, and not exported
to userspace via /proc or syscalls), then you can just increase
field sizes and recompile the kernel, without the need to support
both structure layouts in the kernel in perpetuity.

For efficiency reasons the kernel will always need to export
structs to userspace but partition information probably shouldn't
get a performance exemption.

> Fine, no operator overloading:
> 
> err = ascii_math_make_number(baz, 512); // baz = 512
> if(err){
>   // handle error here
> }
> err = ascii_math_add(foo, bar, baz); // foo = bar + baz
> if(err){
>   // handle error here
> }

Yes, this is more or less what a bignum package would implement,
albeit with a much more efficient representation that ASCII
strings.  But actually manipulating values in bignum format
should be left to utilities like fdisk that want to be generic.
The kernel and boot loaders would just load values into 'u32
a' and 'u32 b' (or whatever type) and add them with 'a + b'.
I'm not in any way advocating bignum arithmetic in the kernel.

> With a 32-bit binary field, programs will use 32-bit types.
> With a 64-bit binary field, programs will use 64-bit types.
> With an ASCII format, every program will use a different type.

Right, which would allow intelligence on the part of the programs,
like using 32-bit types on 32-bit architectures where values are
known to max out at 32-bits (I'm thinking of, say, /proc here)
and 64-bit values on 64-bit architectures.

> It does, a bit, but it sure beats hidden per-program
> limits caused by every program converting the ASCII
> to a different in-memory structure.

So create a library and flame people who don't link against it
and screw up their parsing.  At least this way only some programs
would have hidden limits, not all of them.

> >> Yeah, just what we need. The /proc mess expanding
> >> into partition tables. That sounds like a great way
> >> to increase filesystem destruction performance.
> >
> > The /proc mess exists because people chose N ad hoc output
> > formats for /proc files.  If they had a consistent format like
> > s-expressions or one-value-per-file most problems with /proc
> > would not exist.
> 
> That only solves a superficial problem. It doesn't let
> you reliably handle changing data types and keywords.

s-expressions do--the first value in each parenthesized expression
is the keyword.  For instance, if you have the tree:

/proc
    /sys
        /net
            /ipsec
                /inbound_policy_check (== 1)
            /ipv4
                /icmp_echo_ignore_all (== 0)
                /icmp_echo_ignore_broadcasts (== 0)

Via, say, a magic 'cat /proc/serialize', you could view this as:

(sys (net (ipsec (inbound_policy_check 1)
          (ipv4 (icmp_echo_ignore_all 0)
                (icmp_echo_ignore_broadcasts 0)))))

without the pretty-printing, of course.  Likewise you could
cat /proc/sys/serialize to see just that subtree.

All this information is available already in the kernel and
'parsing' the resulting s-expressions is mostly a matter of
counting parenthesis nesting depth, matching keywords, and doing
ASCII->numeric conversions.

I'm not religious about s-expressions but they do solve this
problem fairly well.  People who are religiously anti-LISP should
pretend I used { } in the above.

Of course this all relies on a one-value-per-file /proc, which is
regrettably not the case now; that's why I chose /proc/sys for
the above example.

miket

  reply	other threads:[~2002-08-02 22:50 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <15688.25919.138565.6427@wombat.chubb.wattle.id.au>
2002-07-31 22:39 ` 2.5.28 and partitions Alexander Viro
2002-08-01 10:08   ` Marcin Dalecki
2002-08-01 12:31     ` Kai Henningsen
2002-08-01 19:29   ` Thunder from the hill
2002-08-01 20:31     ` Alexander Viro
2002-08-01 20:45       ` Thunder from the hill
2002-08-01 21:08         ` Alexander Viro
2002-08-01 21:25           ` Marcin Dalecki
2002-08-01 21:41             ` Alexander Viro
2002-08-02 19:40               ` Mike Touloumtzis
2002-08-01 21:02       ` Marcin Dalecki
2002-08-01 21:27         ` Alexander Viro
2002-08-01 21:45           ` Marcin Dalecki
2002-08-02  5:21           ` Ryan Anderson
2002-08-01 21:24       ` Albert D. Cahalan
2002-08-02 19:47         ` Mike Touloumtzis
2002-08-02 20:49           ` Albert D. Cahalan
2002-08-02 21:21             ` Mike Touloumtzis
2002-08-02 21:36               ` [RFC] " Thunder from the hill
2002-08-02 22:12               ` Albert D. Cahalan
2002-08-02 22:53                 ` Mike Touloumtzis [this message]
2002-08-02 14:54 Jesse Pollard
2002-08-02 18:33 ` Kai Henningsen
     [not found] <15688.27022.143541.447952@wombat.chubb.wattle.id.au>
2002-07-31 23:42 ` Alexander Viro
  -- strict thread matches above, loose matches on Subject: below --
2002-07-31 23:38 Matt_Domsch
     [not found] <F44891A593A6DE4B99FDCB7CC537BBBBB839AC@AUSXMPS308.aus.amer .dell.com>
2002-07-31 22:58 ` Anton Altaparmakov
2002-07-31 22:47 Matt_Domsch
2002-07-25 17:50 Andries.Brouwer
2002-07-25 13:24 Petr Vandrovec
2002-07-25 13:45 ` Anton Altaparmakov
2002-07-26  5:13   ` Adrian Bunk
2002-07-25 12:43 Petr Vandrovec
2002-07-25  3:22 Matt_Domsch
2002-07-25  5:27 ` Linus Torvalds
2002-07-25 11:44   ` Alexander Viro
2002-07-25 15:57     ` Linus Torvalds
2002-07-30  9:58     ` Pavel Machek
     [not found]   ` <Pine.GSO.4.21.0207250739390.17037-100000@weyl.math.psu.edu >
2002-07-25 13:03     ` Anton Altaparmakov
2002-07-25 16:50       ` Alexander Viro
2002-07-25 17:35         ` Jason L Tibbitts III
2002-07-25 17:57         ` Rik van Riel
2002-07-25 18:27           ` Alexander Viro
2002-07-27  5:56         ` Austin Gonyou
     [not found]       ` <Pine.GSO.4.21.0207251245530.17621-100000@weyl.math.psu.edu >
2002-07-25 17:39         ` Anton Altaparmakov
2002-07-25 10:42 ` Alan Cox
2002-07-24 22:42 Andries.Brouwer
2002-07-24 23:42 ` Alexander Viro
2002-07-25  0:20   ` kwijibo
2002-07-25  4:00   ` Jason L Tibbitts III
     [not found] ` <Pine.GSO.4.21.0207241925450.14656-100000@weyl.math.psu.edu >
2002-07-25  2:11   ` Anton Altaparmakov
2002-07-25  5:15     ` Linus Torvalds
     [not found]     ` <Pine.LNX.4.44.0207242213540.1231-100000@home.transmeta.com >
2002-07-25  8:43       ` Anton Altaparmakov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020802225347.GI4116@bluemug.com \
    --to=miket@bluemug.com \
    --cc=Andries.Brouwer@cwi.nl \
    --cc=Matt_Domsch@Dell.com \
    --cc=acahalan@cs.uml.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=peter@chubb.wattle.id.au \
    --cc=thunder@ngforever.de \
    --cc=viro@math.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox