11da177e4SLinus Torvalds #ifndef __COW_H__ 21da177e4SLinus Torvalds #define __COW_H__ 31da177e4SLinus Torvalds 41da177e4SLinus Torvalds #include <asm/types.h> 51da177e4SLinus Torvalds 6*855ec613SPaolo 'Blaisorblade' Giarrusso #if __BYTE_ORDER == __BIG_ENDIAN 71da177e4SLinus Torvalds # define ntohll(x) (x) 81da177e4SLinus Torvalds # define htonll(x) (x) 9*855ec613SPaolo 'Blaisorblade' Giarrusso #elif __BYTE_ORDER == __LITTLE_ENDIAN 101da177e4SLinus Torvalds # define ntohll(x) bswap_64(x) 111da177e4SLinus Torvalds # define htonll(x) bswap_64(x) 121da177e4SLinus Torvalds #else 131da177e4SLinus Torvalds #error "__BYTE_ORDER not defined" 141da177e4SLinus Torvalds #endif 151da177e4SLinus Torvalds 161da177e4SLinus Torvalds extern int init_cow_file(int fd, char *cow_file, char *backing_file, 171da177e4SLinus Torvalds int sectorsize, int alignment, int *bitmap_offset_out, 181da177e4SLinus Torvalds unsigned long *bitmap_len_out, int *data_offset_out); 191da177e4SLinus Torvalds 201da177e4SLinus Torvalds extern int file_reader(__u64 offset, char *buf, int len, void *arg); 211da177e4SLinus Torvalds extern int read_cow_header(int (*reader)(__u64, char *, int, void *), 221da177e4SLinus Torvalds void *arg, __u32 *version_out, 231da177e4SLinus Torvalds char **backing_file_out, time_t *mtime_out, 241da177e4SLinus Torvalds unsigned long long *size_out, int *sectorsize_out, 251da177e4SLinus Torvalds __u32 *align_out, int *bitmap_offset_out); 261da177e4SLinus Torvalds 271da177e4SLinus Torvalds extern int write_cow_header(char *cow_file, int fd, char *backing_file, 281da177e4SLinus Torvalds int sectorsize, int alignment, 291da177e4SLinus Torvalds unsigned long long *size); 301da177e4SLinus Torvalds 311da177e4SLinus Torvalds extern void cow_sizes(int version, __u64 size, int sectorsize, int align, 321da177e4SLinus Torvalds int bitmap_offset, unsigned long *bitmap_len_out, 331da177e4SLinus Torvalds int *data_offset_out); 341da177e4SLinus Torvalds 351da177e4SLinus Torvalds #endif 361da177e4SLinus Torvalds 371da177e4SLinus Torvalds /* 381da177e4SLinus Torvalds * --------------------------------------------------------------------------- 391da177e4SLinus Torvalds * Local variables: 401da177e4SLinus Torvalds * c-file-style: "linux" 411da177e4SLinus Torvalds * End: 421da177e4SLinus Torvalds */ 43