From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 868B7BCAB for ; Wed, 25 May 2005 11:15:05 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j4P9F4Rq008888 for ; Wed, 25 May 2005 11:15:05 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA21958 for ; Wed, 25 May 2005 11:15:04 +0200 (MET DST) Received: from smtp11.wanadoo.fr (smtp11.wanadoo.fr [193.252.22.31]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j4P9F4g3017788 for ; Wed, 25 May 2005 11:15:04 +0200 Received: from me-wanadoo.net (unknown [127.0.0.1]) by mwinf1102.wanadoo.fr (SMTP Server) with ESMTP id 3E36A1C00055 for ; Wed, 25 May 2005 11:15:04 +0200 (CEST) Received: from pegasos (AStrasbourg-251-1-59-4.w82-126.abo.wanadoo.fr [82.126.135.4]) by mwinf1102.wanadoo.fr (SMTP Server) with ESMTP id BD7651C000A1; Wed, 25 May 2005 11:15:03 +0200 (CEST) X-ME-UUID: 20050525091503776.BD7651C000A1@mwinf1102.wanadoo.fr Received: from luther by pegasos with local (Exim 4.50) id 1DartW-0004uS-VH; Wed, 25 May 2005 11:09:43 +0200 Date: Wed, 25 May 2005 11:09:40 +0200 To: Taras Cc: Sven Luther , caml-list@inria.fr Subject: Re: partition tables and ocaml Message-ID: <20050525090940.GA18133@pegasos> References: <20050411074619.GA26797@pegasos> <20050411125705.GB14415@localhost> <20050411153551.GA10362@pegasos> <429415D4.4090601@shaw.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <429415D4.4090601@shaw.ca> User-Agent: Mutt/1.5.6+20040907i From: Sven Luther X-Miltered: at concorde with ID 42944219.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 42944218.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ocaml:01 sven:01 luther:01 sven:01 luther:01 ocaml:01 byte:01 byte:01 plateform:01 bytecode:01 encapsulated:01 bigarray:01 lazy:01 computed:01 altough:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: On Tue, May 24, 2005 at 11:06:12PM -0700, Taras wrote: > 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 Yes, altough i am a bit short on time right now. > 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 Cool, will look at this. Also maybe you would be interested in cooperating on the project ? > 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 :) Yes, but fdisk/mbr like partition tables are trivial, parted supports many kind of partition table, among them the mac/amiga ones which i am most familiar with, and which handle linked lists of partitions. Friendly, Sven Luther