X-Git-Url: https://git.sven.stormbind.net/?a=blobdiff_plain;f=libexfat%2Fexfat.h;h=939fec06f7a15c9e205222c7c48b34bb778b1313;hb=1e7534bbaa34e6c2a8c9809dfcf6588112cbdee4;hp=e0d33e24ddb109783b235f65c882f591fd781a93;hpb=cf3a99e1e63d87069d44c05821a83da3b80cdbc4;p=sven%2Ffuse-exfat.git diff --git a/libexfat/exfat.h b/libexfat/exfat.h index e0d33e2..939fec0 100644 --- a/libexfat/exfat.h +++ b/libexfat/exfat.h @@ -24,7 +24,10 @@ #ifndef EXFAT_H_INCLUDED #define EXFAT_H_INCLUDED +#ifndef ANDROID +/* Android.bp is used instead of autotools when targeting Android */ #include "config.h" +#endif #include "compiler.h" #include "exfatfs.h" #include @@ -61,6 +64,9 @@ #define BMAP_CLR(bitmap, index) \ ((bitmap)[BMAP_BLOCK(index)] &= ~BMAP_MASK(index)) +#define EXFAT_REPAIR(hook, ef, ...) \ + (exfat_ask_to_fix(ef) && exfat_fix_ ## hook(ef, __VA_ARGS__)) + /* The size of off_t type must be 64 bits. File systems larger than 2 GB will be corrupted with 32-bit off_t. */ STATIC_ASSERT(sizeof(off_t) == 8); @@ -119,6 +125,7 @@ struct exfat gid_t gid; int ro; bool noatime; + enum { EXFAT_REPAIR_NO, EXFAT_REPAIR_ASK, EXFAT_REPAIR_YES } repair; }; /* in-core nodes iterator */ @@ -135,6 +142,7 @@ struct exfat_human_bytes }; extern int exfat_errors; +extern int exfat_errors_fixed; void exfat_bug(const char* format, ...) PRINTF NORETURN; void exfat_error(const char* format, ...) PRINTF; @@ -193,12 +201,13 @@ le16_t exfat_calc_name_hash(const struct exfat* ef, const le16_t* name, void exfat_humanize_bytes(uint64_t value, struct exfat_human_bytes* hb); void exfat_print_info(const struct exfat_super_block* sb, uint32_t free_clusters); +bool exfat_match_option(const char* options, const char* option_name); -int utf16_to_utf8(char* output, const le16_t* input, size_t outsize, +int exfat_utf16_to_utf8(char* output, const le16_t* input, size_t outsize, size_t insize); -int utf8_to_utf16(le16_t* output, const char* input, size_t outsize, +int exfat_utf8_to_utf16(le16_t* output, const char* input, size_t outsize, size_t insize); -size_t utf16_length(const le16_t* str); +size_t exfat_utf16_length(const le16_t* str); struct exfat_node* exfat_get_node(struct exfat_node* node); void exfat_put_node(struct exfat* ef, struct exfat_node* node); @@ -217,12 +226,22 @@ void exfat_update_mtime(struct exfat_node* node); const char* exfat_get_label(struct exfat* ef); int exfat_set_label(struct exfat* ef, const char* label); +int exfat_soil_super_block(const struct exfat* ef); int exfat_mount(struct exfat* ef, const char* spec, const char* options); void exfat_unmount(struct exfat* ef); -time_t exfat_exfat2unix(le16_t date, le16_t time, uint8_t centisec); +time_t exfat_exfat2unix(le16_t date, le16_t time, uint8_t centisec, + uint8_t tzoffset); void exfat_unix2exfat(time_t unix_time, le16_t* date, le16_t* time, - uint8_t* centisec); + uint8_t* centisec, uint8_t* tzoffset); void exfat_tzset(void); +bool exfat_ask_to_fix(const struct exfat* ef); +bool exfat_fix_invalid_vbr_checksum(const struct exfat* ef, void* sector, + uint32_t vbr_checksum); +bool exfat_fix_invalid_node_checksum(const struct exfat* ef, + struct exfat_node* node); +bool exfat_fix_unknown_entry(struct exfat* ef, struct exfat_node* dir, + const struct exfat_entry* entry, off_t offset); + #endif /* ifndef EXFAT_H_INCLUDED */