From: Taras <taras.judge@shaw.ca>
To: Sven Luther <sven.luther@wanadoo.fr>
Cc: caml-list@inria.fr
Subject: partition tables and ocaml
Date: Tue, 24 May 2005 23:06:12 -0700 [thread overview]
Message-ID: <429415D4.4090601@shaw.ca> (raw)
In-Reply-To: <20050411153551.GA10362@pegasos>
Sven Luther wrote:
>On Mon, Apr 11, 2005 at 08:57:05AM -0400, Eric Cooper wrote:
>
>
>>On Mon, Apr 11, 2005 at 09:46:19AM +0200, Sven Luther wrote:
>>
>>
>>>I had plans to do a rewrite of GNU parted, a project which i am
>>>involved with, in ocaml, and am being blocked by a few issues.
>>>[...]
>>> 1) most disk partition tables and filesystem have a mapping from a
>>> given disk 512 byte sector to a descriptive structure.
>>> [...]
>>> or to have access functions which transform parts of
>>> a byte array into values. The first one is ugly, as i was aiming
>>> for a purely ocaml solution (so i can build and arch/plateform
>>> independent bytecode tool), and the second would probably be a
>>> disaster speed wise, and also somewhat ugly unless properly
>>> encapsulated in an abstract module.
>>>
>>>
>>I would use the second approach. I would define a logically
>>equivalent OCaml record or class, and conversion functions between
>>that object and a string + offset (or Bigarray of bytes, plus
>>offset). Passing around an offset into a larger byte array can save a
>>lot of copying.
>>
>>You can probably structure your code so that you only convert to/from
>>bytes in a few places, not likely to be performance-critical.
>>
>>
>
>Mmm, one could imagine a generic set of access function inside a byte array
>(would have to handle endianess and such though), and then a structure defined
>as a set of lazy values corresponding to the access functions in question, so
>only values actually accessed get computed.
>
>That said,
>
>
Hello,
Is a port of Parted to OCaml still in the works? In case you are still
wondering, I would like to show out that OCaml can indeed deal with
partitions in a painless manner.
See http://glek.net/subversion/os/kernel/modules/PartitionTable.ml
The read_tables function is capable of doing primary and extended
partition table parsing in next to no code. Obviously Parted would need
a bit more code than that, but things wouldn't get much hairier since
partition entries are only 16 bytes and that code parses 6 of them :)
Cheers,
Taras
next prev parent reply other threads:[~2005-05-25 6:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-11 7:46 ocaml, int32/64, bigarray and unsigned values Sven Luther
2005-04-11 12:57 ` [Caml-list] " Eric Cooper
2005-04-11 15:35 ` Sven Luther
2005-04-11 16:13 ` Eric Cooper
2005-04-13 6:54 ` Florian Hars
2005-04-13 18:28 ` Ken Rose
2005-05-25 6:06 ` Taras [this message]
2005-05-25 9:09 ` partition tables and ocaml Sven Luther
2005-04-12 17:19 ` [Caml-list] ocaml, int32/64, bigarray and unsigned values Paul Snively
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=429415D4.4090601@shaw.ca \
--to=taras.judge@shaw.ca \
--cc=caml-list@inria.fr \
--cc=sven.luther@wanadoo.fr \
/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