6 * Exit status values. We use some errno values because
8 * kGoodExit: we finished copying, and no problems.
9 * kNoSpaceExit: Not enough space for the skeleton copy.
10 * kCopyIOExit: An I/O error occurred. This may not be fatal,
11 * as it may just mean the source device went away. We
12 * can continue later, perhaps.
13 * kIntrExit: The copying was interrupted. As above, this may
15 * kBadExit: Any other problem.
19 kNoSpaceExit
= ENOSPC
,
26 * Data-manipulating functions and structures, used to
27 * create the skeleton copy.
30 struct VolumeDescriptor
;
34 * We treat each data structure in the filesystem as
35 * a <start, length> pair.
40 unsigned int fid
; // Optional, may not be set
42 typedef struct Extents Extents_t
;
44 #define kExtentCount 100
47 * The in-core representation consists of a linked
48 * list of an array of extents, up to 100 in each element.
52 Extents_t extents
[kExtentCount
];
53 struct ExtentList
*next
;
55 typedef struct ExtentList ExtentList_t
;
57 * The in-core description of the volume: an input source,
58 * a description of the volume, the linked list of extents,
59 * the total number of bytes, and the number of linked list
62 struct VolumeObjects
{
63 struct DeviceInfo
*devp
;
64 struct VolumeDescriptor
*vdp
;
69 typedef struct VolumeObjects VolumeObjects_t
;
71 typedef int (^extent_handler_t
)(int fid
, off_t start
, off_t len
);
73 extern VolumeObjects_t
*InitVolumeObject(struct DeviceInfo
*devp
, struct VolumeDescriptor
*vdp
);
74 extern int AddExtent(VolumeObjects_t
*vop
, off_t start
, off_t length
);
75 extern int AddExtentForFile(VolumeObjects_t
*vop
, off_t start
, off_t length
, unsigned int fid
);
76 extern void PrintVolumeObject(VolumeObjects_t
*);
77 extern int CopyObjectsToDest(VolumeObjects_t
*, struct IOWrapper
*wrapper
, off_t skip
);
79 extern void WriteGatheredData(const char *, VolumeObjects_t
*);
81 extern struct DeviceInfo
*OpenDevice(const char *, int);
82 extern struct VolumeDescriptor
*VolumeInfo(struct DeviceInfo
*);
83 extern int AddHeaders(VolumeObjects_t
*, int);
84 extern void AddJournal(VolumeObjects_t
*);
85 extern void AddFileExtents(VolumeObjects_t
*);
86 extern int FindOtherMetadata(VolumeObjects_t
*, extent_handler_t
);
87 extern int CompareVolumeHeaders(struct VolumeDescriptor
*);
89 void ReleaseDeviceInfo(struct DeviceInfo
*);
90 void ReleaseVolumeDescriptor(struct VolumeDescriptor
*);
91 void ReleaseVolumeObjects(VolumeObjects_t
*);