#ifndef _HFS_META_H
# define _HFS_META_H
# include <libkern/OSByteOrder.h>
# include <hfs/hfs_format.h>
# include "Data.h"
struct VolumeDescriptor {
off_t priOffset; off_t altOffset; off_t priJInfoOffset; off_t altJInfoOffset; off_t deviceSize; JournalInfoBlock priJournal; JournalInfoBlock altJournal; HFSPlusVolumeHeader priHeader; HFSPlusVolumeHeader altHeader; };
typedef struct VolumeDescriptor VolumeDescriptor_t;
struct DeviceInfo {
char *devname;
int fd;
off_t size;
int blockSize;
off_t blockCount;
};
typedef struct DeviceInfo DeviceInfo_t;
# define S16(x) OSSwapBigToHostInt16(x)
# define S32(x) OSSwapBigToHostInt32(x)
# define S64(x) OSSwapBigToHostInt64(x)
ssize_t GetBlock(DeviceInfo_t*, off_t, uint8_t*);
int ScanExtents(VolumeObjects_t *, int);
struct IOWrapper {
ssize_t (*writer)(struct IOWrapper *ctx,DeviceInfo_t *devp, off_t start, off_t len, void (^bp)(off_t));
ssize_t (*reader)(struct IOWrapper *ctx, off_t start, void *buffer, off_t len);
off_t (*getprog)(struct IOWrapper *ctx);
void (*setprog)(struct IOWrapper *ctx, off_t prog);
int (*cleanup)(struct IOWrapper *ctx);
void *context;
};
typedef struct IOWrapper IOWrapper_t;
extern ssize_t UnalignedRead(DeviceInfo_t *, void *, size_t, off_t);
extern int debug, verbose, printProgress;
#endif