123456789101112131415161718192021222324252627282930313233343536373839404142(*
* Copyright (C) 2011-2013 Citrix Inc
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; version 2.1 only. with the special
* exception on linking described in file LICENSE.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*)type'at=[|`Copyof('a*int64*int64)|`SectorsofCstruct.t|`Emptyofint64]letsector_size=512letto_string=function|`Copy(_,offset,1L)->Printf.sprintf"1 sector copied starting at offset %Ld"offset|`Copy(_,offset,len)->Printf.sprintf"%Ld sectors copied starting at offset %Ld"lenoffset|`Sectorsx->lettext=String.escaped(Cstruct.to_string(Cstruct.subx016))inifCstruct.lengthx=sector_sizethenPrintf.sprintf"1 sector \"%s...\""textelsePrintf.sprintf"%d sectors \"%s...\""(Cstruct.lengthx/sector_size)text|`Empty1L->"1 empty sector"|`Emptyx->Printf.sprintf"%Ld empty sectors"xletlen=function|`Copy(_,_,len)->len|`Sectorsx->Int64.of_int(Cstruct.lengthx/sector_size)|`Emptyx->x