1#ifndef _DATA_H 2# define _DATA_H 3 4/* 5 * Data-manipulating functions and structures, used to 6 * create the skeleton copy. 7 */ 8struct DeviceInfo; 9struct VolumeDescriptor; 10struct IOWrapper; 11 12/* 13 * We treat each data structure in the filesystem as 14 * a <start, length> pair. 15 */ 16struct Extents { 17 off_t base; 18 off_t length; 19}; 20typedef 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 */ 28struct ExtentList { 29 size_t count; 30 Extents_t extents[kExtentCount]; 31 struct ExtentList *next; 32}; 33typedef 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 */ 41struct VolumeObjects { 42 struct DeviceInfo *devp; 43 struct VolumeDescriptor *vdp; 44 size_t count; 45 off_t byteCount; 46 ExtentList_t *list; 47}; 48typedef struct VolumeObjects VolumeObjects_t; 49 50extern VolumeObjects_t *InitVolumeObject(struct DeviceInfo *devp, struct VolumeDescriptor *vdp); 51extern int AddExtent(VolumeObjects_t *vop, off_t start, off_t length); 52extern void PrintVolumeObject(VolumeObjects_t*); 53extern int CopyObjectsToDest(VolumeObjects_t*, struct IOWrapper *wrapper, off_t skip); 54 55extern void WriteGatheredData(const char *, VolumeObjects_t*); 56 57#endif /* _DATA_H */ 58