libhfsp
This library can be used to prorammatically acces HFS+
volumes. The library in turn is used by utilities allowing
user access to the volume.
objects exposed
The library has some top level objects that are to be used
by other programs:
- volume identifies the volume as a whole.
The btree is used a cache for the records used
later (this object will eventually be included in the volume later
on).
- The record represent a file or folder.
Design principles
In contrast to the original library by Robert Leslie this libray
rarely uses malloc/free. This impoes, that all memory is contained
in the objects shown above. As of now only the current two
blocks are "cached". Performance may be poor when doing large
transactions. function returning int return 0 on success and any
other value (normally -1) on failure unless stated otherwise.
functions returning pointers return NULL on error. In most
cases hfsp_error
and errno
should be set.
Byte swapping happens when reading structure from raw memory,
this avoids any alignment problems. (In contrast to Brad Boyers
aproach wich needs to swap (and assemble) the bytes on every acces.)
The contentes of the raw HFS+ structures is usually not
copied to other structures and remains embedded in the high
level strcutures. In case you need such a value acces it directly
(e.G. volume->vol.create_date - HFSPTIMEDIFF )
Call volume_open()
to open a volume.
You must call volume_close()
to close the volume.
all other volume_
functions are used internally only
use them when you really know what you are doing.
The btree as of now is the catalog-file btree, althoug there are
other btrees like the extends-file btree. I intend to make the
btree a (more or less) private member of the volume. This will
be done together with implementing a catalog-node cache superseeding
the simple block cache at the volume.
The record is used whenever a file or folder is needed. There
is a sufficient set of methods to navigate around with records.
Folders and FolderThreads can both be used when acces to the
files of a folder is needed. File Threads are supported, althoug
Apple does not use them. (The utility functions like hpls however
suppress then since I dont know what to do with them.)
As of now there is no concept of "opening" a record, for
readonlny acces just take one of the forks and use the
fork functkions found at the volume to acces the raw data. See
hpcopy for examples how to do that.
This is work in progress, either be patient or provide help.
$Id: libhfsp.html,v 1.1.1.1 2002/03/05 19:50:28 klaus Exp $