]> git.saurik.com Git - apple/hfs.git/blob - CopyHFSMeta/Data.h
hfs-191.1.tar.gz
[apple/hfs.git] / CopyHFSMeta / Data.h
1 #ifndef _DATA_H
2 # define _DATA_H
3
4 /*
5 * Data-manipulating functions and structures, used to
6 * create the skeleton copy.
7 */
8 struct DeviceInfo;
9 struct VolumeDescriptor;
10 struct IOWrapper;
11
12 /*
13 * We treat each data structure in the filesystem as
14 * a <start, length> pair.
15 */
16 struct Extents {
17 off_t base;
18 off_t length;
19 };
20 typedef struct Extents Extents_t;
21
22 #define kExtentCount 100
23
24 /*
25 * The in-core representation consists of a linked
26 * list of an array of extents, up to 100 in each element.
27 */
28 struct ExtentList {
29 size_t count;
30 Extents_t extents[kExtentCount];
31 struct ExtentList *next;
32 };
33 typedef struct ExtentList ExtentList_t;
34
35 /*
36 * The in-core description of the volume: an input source,
37 * a description of the volume, the linked list of extents,
38 * the total number of bytes, and the number of linked list
39 * elements.
40 */
41 struct VolumeObjects {
42 struct DeviceInfo *devp;
43 struct VolumeDescriptor *vdp;
44 size_t count;
45 off_t byteCount;
46 ExtentList_t *list;
47 };
48 typedef struct VolumeObjects VolumeObjects_t;
49
50 extern VolumeObjects_t *InitVolumeObject(struct DeviceInfo *devp, struct VolumeDescriptor *vdp);
51 extern int AddExtent(VolumeObjects_t *vop, off_t start, off_t length);
52 extern void PrintVolumeObject(VolumeObjects_t*);
53 extern int CopyObjectsToDest(VolumeObjects_t*, struct IOWrapper *wrapper, off_t skip);
54
55 extern void WriteGatheredData(const char *, VolumeObjects_t*);
56
57 #endif /* _DATA_H */