162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef __COW_H__ 362306a36Sopenharmony_ci#define __COW_H__ 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#include <asm/types.h> 662306a36Sopenharmony_ci 762306a36Sopenharmony_ciextern int init_cow_file(int fd, char *cow_file, char *backing_file, 862306a36Sopenharmony_ci int sectorsize, int alignment, int *bitmap_offset_out, 962306a36Sopenharmony_ci unsigned long *bitmap_len_out, int *data_offset_out); 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ciextern int file_reader(__u64 offset, char *buf, int len, void *arg); 1262306a36Sopenharmony_ciextern int read_cow_header(int (*reader)(__u64, char *, int, void *), 1362306a36Sopenharmony_ci void *arg, __u32 *version_out, 1462306a36Sopenharmony_ci char **backing_file_out, long long *mtime_out, 1562306a36Sopenharmony_ci unsigned long long *size_out, int *sectorsize_out, 1662306a36Sopenharmony_ci __u32 *align_out, int *bitmap_offset_out); 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ciextern int write_cow_header(char *cow_file, int fd, char *backing_file, 1962306a36Sopenharmony_ci int sectorsize, int alignment, 2062306a36Sopenharmony_ci unsigned long long *size); 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ciextern void cow_sizes(int version, __u64 size, int sectorsize, int align, 2362306a36Sopenharmony_ci int bitmap_offset, unsigned long *bitmap_len_out, 2462306a36Sopenharmony_ci int *data_offset_out); 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci#endif 27