Permalink
Browse files

[tools] port filesystem crunch over to cstruct

This 'simulates' a RAM disk by blitting strings into freshly allocated
IO_page for every read.
  • Loading branch information...
1 parent a7df66a commit 73c59455756254330485d69584e49b72214b7496 @avsm committed Jun 8, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 tools/crunch/crunch.ml
View
5 tools/crunch/crunch.ml
@@ -119,7 +119,10 @@ let read name =
match !chunks with
|hd :: tl ->
chunks := tl;
- return (Some (Bitstring.bitstring_of_string hd))
+ let pg = OS.Io_page.get () in
+ let len = String.length hd in
+ Cstruct.set_buffer hd 0 pg 0 len;
+ return (Some (Cstruct.sub pg 0 len))
|[] -> return None
)))

0 comments on commit 73c5945

Please sign in to comment.