4 # include <libkern/OSByteOrder.h>
5 # include <hfs/hfs_format.h>
10 * The in-core description of the volume. We care about
11 * the primary and alternate header locations, the alternate
12 * and primary journal offset locations, the size of the device,
13 * the two headers, and the two journal info blocks.
15 struct VolumeDescriptor
{
16 off_t priOffset
; // Offset of primary volume header
17 off_t altOffset
; // Offset of alternate volume header
18 off_t priJInfoOffset
; // Offset of journal info block from primary header
19 off_t altJInfoOffset
; // and for the alt. May be the same as the above.
20 off_t deviceSize
; // The size of the entire device
21 JournalInfoBlock priJournal
; // Primary journal block
22 JournalInfoBlock altJournal
; // Alternate journal, if different
23 HFSPlusVolumeHeader priHeader
; // The primary header
24 HFSPlusVolumeHeader altHeader
; // And the alternate
26 typedef struct VolumeDescriptor VolumeDescriptor_t
;
29 * The input device description.
38 typedef struct DeviceInfo DeviceInfo_t
;
40 # define S16(x) OSSwapBigToHostInt16(x)
41 # define S32(x) OSSwapBigToHostInt32(x)
42 # define S64(x) OSSwapBigToHostInt64(x)
44 ssize_t
GetBlock(DeviceInfo_t
*, off_t
, uint8_t*);
45 int ScanExtents(VolumeObjects_t
*, int);
48 * The IOWrapper structure is used to do input and output on
49 * the target -- which may be a device node, or a sparse bundle.
50 * writer() is used to copy a particular amount of data from the source device;
51 * reader() is used to get some data from the destination device (e.g., the header);
52 * getprog() is used to find what the stored progress was (if any);
53 * setprog() is used to write out the progress status so far.
54 * cleanup() is called when the copy is done.
57 ssize_t (*writer
)(struct IOWrapper
*ctx
,DeviceInfo_t
*devp
, off_t start
, off_t len
, void (^bp
)(off_t
));
58 ssize_t (*reader
)(struct IOWrapper
*ctx
, off_t start
, void *buffer
, off_t len
);
59 off_t (*getprog
)(struct IOWrapper
*ctx
);
60 void (*setprog
)(struct IOWrapper
*ctx
, off_t prog
);
61 int (*cleanup
)(struct IOWrapper
*ctx
);
64 typedef struct IOWrapper IOWrapper_t
;
66 extern ssize_t
UnalignedRead(DeviceInfo_t
*, void *, size_t, off_t
);
68 extern int debug
, verbose
, printProgress
;
70 #endif /* _HFS_META_H */