diff options
Diffstat (limited to '')
-rw-r--r-- | include/exfat_dir.h | 2 | ||||
-rw-r--r-- | include/exfat_fs.h | 15 | ||||
-rw-r--r-- | include/exfat_ondisk.h | 20 | ||||
-rw-r--r-- | include/libexfat.h | 6 | ||||
-rw-r--r-- | include/version.h | 2 |
5 files changed, 36 insertions, 9 deletions
diff --git a/include/exfat_dir.h b/include/exfat_dir.h index d450c61..6a3acfd 100644 --- a/include/exfat_dir.h +++ b/include/exfat_dir.h @@ -16,7 +16,7 @@ struct buffer_desc; struct exfat_de_iter { struct exfat *exfat; struct exfat_inode *parent; - struct buffer_desc *buffer_desc; /* cluster * 2 */ + struct buffer_desc *buffer_desc; __u32 ra_next_clus; unsigned int ra_begin_offset; unsigned int ra_partial_size; diff --git a/include/exfat_fs.h b/include/exfat_fs.h index d35b12c..e120707 100644 --- a/include/exfat_fs.h +++ b/include/exfat_fs.h @@ -45,7 +45,8 @@ struct exfat { unsigned int disk_bitmap_size; __u16 *upcase_table; clus_t start_clu; - char *zero_cluster; + unsigned int buffer_count; + struct buffer_desc *lookup_buffer; /* for dentry set lookup */ }; struct exfat_dentry_loc { @@ -64,7 +65,7 @@ struct buffer_desc { __u32 p_clus; unsigned int offset; char *buffer; - char *dirty; + char dirty[EXFAT_BITMAP_SIZE(4 * KB / 512)]; }; struct exfat *exfat_alloc_exfat(struct exfat_blk_dev *blk_dev, struct pbr *bs); @@ -82,7 +83,11 @@ int exfat_resolve_path(struct path_resolve_ctx *ctx, struct exfat_inode *child); int exfat_resolve_path_parent(struct path_resolve_ctx *ctx, struct exfat_inode *parent, struct exfat_inode *child); -struct buffer_desc *exfat_alloc_buffer(int count, - unsigned int clu_size, unsigned int sect_size); -void exfat_free_buffer(struct buffer_desc *bd, int count); +struct buffer_desc *exfat_alloc_buffer(struct exfat *exfat); +void exfat_free_buffer(const struct exfat *exfat, struct buffer_desc *bd); + +static inline unsigned int exfat_get_read_size(const struct exfat *exfat) +{ + return MIN(exfat->clus_size, 4 * KB); +} #endif diff --git a/include/exfat_ondisk.h b/include/exfat_ondisk.h index 42cdadf..2137226 100644 --- a/include/exfat_ondisk.h +++ b/include/exfat_ondisk.h @@ -41,6 +41,7 @@ #define MAX_EXFAT_DENTRIES 8388608 #define MIN_FILE_DENTRIES 3 #define MAX_NAME_DENTRIES 17 +#define MAX_EXT_DENTRIES 0xFF /* dentry types */ #define MSDOS_DELETED 0xE5 /* deleted mark */ @@ -60,6 +61,8 @@ #define EXFAT_STREAM 0xC0 /* stream entry */ #define EXFAT_NAME 0xC1 /* file name entry */ #define EXFAT_ACL 0xC2 /* stream entry */ +#define EXFAT_VENDOR_EXT 0xE0 +#define EXFAT_VENDOR_ALLOC 0xE1 /* checksum types */ #define CS_DIR_ENTRY 0 @@ -134,7 +137,7 @@ struct pbr { }; #define VOLUME_LABEL_MAX_LEN 11 -#define VOLUME_GUID_LEN 16 +#define EXFAT_GUID_LEN 16 #define ENTRY_NAME_MAX 15 struct exfat_dentry { @@ -196,9 +199,22 @@ struct exfat_dentry { __u8 num_ext; __le16 checksum; __u16 flags; - __u8 guid[VOLUME_GUID_LEN]; + __u8 guid[EXFAT_GUID_LEN]; __u8 reserved[10]; } __attribute__((packed)) guid; /* volume GUID directory entry */ + struct { + __u8 flags; + __u8 guid[EXFAT_GUID_LEN]; + __u8 vendor_defined[14]; + } __attribute__((packed)) vendor_ext ; /* vendor extension entry */ + struct { + __u8 flags; + __u8 guid[EXFAT_GUID_LEN]; + __u8 vendor_defined[2]; + __le32 start_clu; + __le64 size; + } __attribute__((packed)) vendor_alloc; /* vendor allocation entry */ + } __attribute__((packed)) dentry; } __attribute__((packed)); diff --git a/include/libexfat.h b/include/libexfat.h index 9e853a8..2ed9aa7 100644 --- a/include/libexfat.h +++ b/include/libexfat.h @@ -80,6 +80,7 @@ struct exfat_blk_dev { struct exfat_user_input { char dev_name[255]; bool writeable; + unsigned int sector_size; unsigned int cluster_size; unsigned int sec_per_clu; unsigned int boundary_align; @@ -113,6 +114,9 @@ typedef __u32 bitmap_t; #define BITMAP_SET(bmap, bit) \ (((bitmap_t *)(bmap))[BIT_ENTRY(bit)] |= BIT_MASK(bit)) +#define BITMAP_CLEAR(bmap, bit) \ + (((bitmap_t *)(bmap))[BIT_ENTRY(bit)] &= ~BIT_MASK(bit)) + static inline bool exfat_bitmap_get(char *bmap, clus_t c) { clus_t cc = c - EXFAT_FIRST_CLUSTER; @@ -150,6 +154,7 @@ int exfat_get_blk_dev_info(struct exfat_user_input *ui, struct exfat_blk_dev *bd); ssize_t exfat_read(int fd, void *buf, size_t size, off_t offset); ssize_t exfat_write(int fd, void *buf, size_t size, off_t offset); +ssize_t exfat_write_zero(int fd, size_t size, off_t offset); size_t exfat_utf16_len(const __le16 *str, size_t max_size); ssize_t exfat_utf16_enc(const char *in_str, __u16 *out_str, size_t out_size); @@ -184,6 +189,7 @@ int exfat_o2c(struct exfat *exfat, off_t device_offset, bool exfat_heap_clus(struct exfat *exfat, clus_t clus); int exfat_root_clus_count(struct exfat *exfat); int read_boot_sect(struct exfat_blk_dev *bdev, struct pbr **bs); +int exfat_parse_ulong(const char *s, unsigned long *out); /* * Exfat Print diff --git a/include/version.h b/include/version.h index f3cf9e2..bef66aa 100644 --- a/include/version.h +++ b/include/version.h @@ -5,6 +5,6 @@ #ifndef _VERSION_H -#define EXFAT_PROGS_VERSION "1.2.2" +#define EXFAT_PROGS_VERSION "1.2.3" #endif /* !_VERSION_H */ |