Fat_name
val epoch : datetime
type lfn = {
lfn_deleted : bool; | |
lfn_last : bool; | (* marks the highest sequence number *) |
lfn_seq : int; | |
lfn_checksum : int; | |
lfn_utf16_name : string; |
}
Long filename entry: the same size as an original DOS disk entry
type dos = {
filename : string; | (* 8 chars *) |
ext : string; | (* 3 chars *) |
deleted : bool; | |
read_only : bool; | |
system : bool; | |
volume : bool; | |
subdir : bool; | |
archive : bool; | |
create : datetime; | |
access : datetime; | |
modify : datetime; | |
start_cluster : int; | |
file_size : int32; | |
is_dot : bool; | |
is_dotdot : bool; |
}
A DOS disk entry
A high-level directory entry, complete with reconstructed UTF name and offsets of each individual entry on the disk
val fake_root_entry : r
val file_size_of : r -> int32
val deleted : r -> bool
val filename_of : r -> string
val to_single_entries : r -> single_entry list
val compute_checksum : dos -> int
Returns the checksum corresponding to the 8.3 DOS filename
val make : ?read_only:bool -> ?system:bool -> ?subdir:bool -> string -> r
val to_string : r -> string
to_string r
returns a canonical version of the name in UTF-8
val to_pretty_string : r -> string
to_pretty_string r
returns a pretty version of the filename, containing both legacy DOS, extra UTF16, size and time components.
val int_of_time : datetime -> int
val time_of_int : int -> int -> int -> datetime
val int_of_date : datetime -> int
val unmarshal : Cstruct.t -> single_entry
unmarshal slot
parses a single directory entry from slot
val marshal : Cstruct.t -> single_entry -> unit
marshal slot single_entry
writes single_entry
into slot
blocks bits
returns the directory chopped into individual bitstrings, each one containing a possible name (fragment)
val fold : ( 'a -> int -> r -> 'a ) -> 'a -> Cstruct.t -> 'a
fold f initial bits
folds f acc offset dir_entry
across all the reconstructed directory entries contained in bits.
val list : Cstruct.t -> r list
list bits
returns a list of valid (not deleted) directory entries contained within the directory bits
next bits
returns the bit offset of a free directory slot. Note this function does not recycle deleted elements.
val add : Cstruct.t -> r -> Fat_update.t list
add block t
return the update required to add t
to the directory block
. Note the update may be beyond the end of block
indicating more space needs to be allocated.
val name_match : string -> r -> bool
find name list
returns Some d
where d
is a name with name name
(or None)
val remove : Cstruct.t -> string -> Fat_update.t list
remove buf filename
erases any entries corresponding to filename
from buf
val modify : Cstruct.t -> string -> int32 -> int -> Fat_update.t list
modify buf filename file_size start_cluster
changes any entry corresponding to filename
in buf
to have file_size
and start_cluster