<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2005/05/9836970433da1634f5b0fa4ba2b89b8b"
  from="Taras &lt;taras.judge@s...&gt;"
  author="Taras"
  date="2005-05-25T06:06:42"
  subject="partition tables and ocaml"
  prev="2005/05/862042e593e450d6eee4b134aaf7cd07"
  next="2005/05/9b4cbf578590a187898d9b32c31ff96e"
  prev-in-thread="2005/04/a12322328dfb6e6b09ac66c1d1b5e5d6"
  next-in-thread="2005/05/a8f5c477160bb3cc4aa068162914bbbf"
  prev-thread="2005/04/7349e621d7f272fd7313c84e88b13074"
  next-thread="2005/04/991431ac19702879e6829a56086fdbf4"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="ocaml, int32/64, bigarray and unsigned values ...">
<msg 
  url="2005/04/f707d022b14efc479d8d5ff1f89950cf"
  from="Sven Luther &lt;sven.luther@w...&gt;"
  author="Sven Luther"
  date="2005-04-11T07:51:11"
  subject="ocaml, int32/64, bigarray and unsigned values ...">
<msg 
  url="2005/04/ce15c3e12a00a6bf2ac5dfea8884249d"
  from="Eric Cooper &lt;ecc@c...&gt;"
  author="Eric Cooper"
  date="2005-04-11T13:01:22"
  subject="Re: [Caml-list] ocaml, int32/64, bigarray and unsigned values ...">
<msg 
  url="2005/04/a12322328dfb6e6b09ac66c1d1b5e5d6"
  from="Sven Luther &lt;sven.luther@w...&gt;"
  author="Sven Luther"
  date="2005-04-11T15:40:47"
  subject="Re: [Caml-list] ocaml, int32/64, bigarray and unsigned values ...">
<msg 
  url="2005/05/9836970433da1634f5b0fa4ba2b89b8b"
  from="Taras &lt;taras.judge@s...&gt;"
  author="Taras"
  date="2005-05-25T06:06:42"
  subject="partition tables and ocaml">
<msg 
  url="2005/05/a8f5c477160bb3cc4aa068162914bbbf"
  from="Sven Luther &lt;sven.luther@w...&gt;"
  author="Sven Luther"
  date="2005-05-25T09:15:05"
  subject="Re: partition tables and ocaml">
</msg>
</msg>
<msg 
  url="2005/04/0e542679bec7321e9131a8ccc2a52cda"
  from="Eric Cooper &lt;ecc@c...&gt;"
  author="Eric Cooper"
  date="2005-04-11T16:15:10"
  subject="Re: [Caml-list] ocaml, int32/64, bigarray and unsigned values ...">
</msg>
<msg 
  url="2005/04/c13333b6aaafe9e53f26097dce193cdf"
  from="Florian Hars &lt;hars@b...&gt;"
  author="Florian Hars"
  date="2005-04-13T06:55:13"
  subject="Re: [Caml-list] ocaml, int32/64, bigarray and unsigned values ...">
</msg>
<msg 
  url="2005/04/fe3b5efe4fbeac99b2f3b0aec7fd584d"
  from="Ken Rose &lt;kenrose@t...&gt;"
  author="Ken Rose"
  date="2005-04-13T18:29:03"
  subject="Re: [Caml-list] ocaml, int32/64, bigarray and unsigned values ...">
</msg>
</msg>
<msg 
  url="2005/04/0c6d36541e08ecd33ca9f45a5b70a1e6"
  from="Paul Snively &lt;psnively@m...&gt;"
  author="Paul Snively"
  date="2005-04-12T17:19:29"
  subject="Re: [Caml-list] ocaml, int32/64, bigarray and unsigned values ...">
</msg>
</msg>
</msg>
</thread>

<contents>
Sven Luther wrote:

&gt;On Mon, Apr 11, 2005 at 08:57:05AM -0400, Eric Cooper wrote:
&gt;  
&gt;
&gt;&gt;On Mon, Apr 11, 2005 at 09:46:19AM +0200, Sven Luther wrote:
&gt;&gt;    
&gt;&gt;
&gt;&gt;&gt;I had plans to do a rewrite of GNU parted, a project which i am
&gt;&gt;&gt;involved with, in ocaml, and am being blocked by a few issues.
&gt;&gt;&gt;[...]
&gt;&gt;&gt;  1) most disk partition tables and filesystem have a mapping from a
&gt;&gt;&gt;  given disk 512 byte sector to a descriptive structure.
&gt;&gt;&gt;  [...]
&gt;&gt;&gt;  or to have access functions which transform parts of
&gt;&gt;&gt;  a byte array into values. The first one is ugly, as i was aiming
&gt;&gt;&gt;  for a purely ocaml solution (so i can build and arch/plateform
&gt;&gt;&gt;  independent bytecode tool), and the second would probably be a
&gt;&gt;&gt;  disaster speed wise, and also somewhat ugly unless properly
&gt;&gt;&gt;  encapsulated in an abstract module.
&gt;&gt;&gt;      
&gt;&gt;&gt;
&gt;&gt;I would use the second approach.  I would define a logically
&gt;&gt;equivalent OCaml record or class, and conversion functions between
&gt;&gt;that object and a string + offset (or Bigarray of bytes, plus
&gt;&gt;offset).  Passing around an offset into a larger byte array can save a
&gt;&gt;lot of copying.
&gt;&gt;
&gt;&gt;You can probably structure your code so that you only convert to/from
&gt;&gt;bytes in a few places, not likely to be performance-critical.
&gt;&gt;    
&gt;&gt;
&gt;
&gt;Mmm, one could imagine a generic set of access function inside a byte array
&gt;(would have to handle endianess and such though), and then a structure defined
&gt;as a set of lazy values corresponding to the access functions in question, so
&gt;only values actually accessed get computed.
&gt;
&gt;That said, 
&gt;  
&gt;
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

</contents>

</message>

