blob: d35b12c02761642aa0eb6e08319e8807c7b9f809 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) 2021 LG Electronics.
*
* Author(s): Hyunchul Lee <hyc.lee@gmail.com>
*/
#ifndef _EXFAT_FS_H_
#define _EXFAT_FS_H_
#include "list.h"
struct exfat_dentry;
struct exfat_inode {
struct exfat_inode *parent;
struct list_head children;
struct list_head sibling;
struct list_head list;
clus_t first_clus;
__u16 attr;
uint64_t size;
bool is_contiguous;
struct exfat_dentry *dentry_set;
int dentry_count;
off_t dev_offset;
__le16 name[0]; /* only for directory */
};
#define EXFAT_NAME_MAX 255
#define NAME_BUFFER_SIZE ((EXFAT_NAME_MAX + 1) * 2)
struct exfat {
struct exfat_blk_dev *blk_dev;
struct pbr *bs;
char volume_label[VOLUME_LABEL_BUFFER_SIZE];
struct exfat_inode *root;
struct list_head dir_list;
clus_t clus_count;
unsigned int clus_size;
unsigned int sect_size;
char *disk_bitmap;
char *alloc_bitmap;
char *ohead_bitmap;
clus_t disk_bitmap_clus;
unsigned int disk_bitmap_size;
__u16 *upcase_table;
clus_t start_clu;
char *zero_cluster;
};
struct exfat_dentry_loc {
struct exfat_inode *parent;
off_t file_offset;
off_t dev_offset;
};
struct path_resolve_ctx {
struct exfat_inode *ancestors[255];
__le16 utf16_path[PATH_MAX + 2];
char local_path[PATH_MAX * MB_LEN_MAX + 1];
};
struct buffer_desc {
__u32 p_clus;
unsigned int offset;
char *buffer;
char *dirty;
};
struct exfat *exfat_alloc_exfat(struct exfat_blk_dev *blk_dev, struct pbr *bs);
void exfat_free_exfat(struct exfat *exfat);
struct exfat_inode *exfat_alloc_inode(__u16 attr);
void exfat_free_inode(struct exfat_inode *node);
void exfat_free_children(struct exfat_inode *dir, bool file_only);
void exfat_free_file_children(struct exfat_inode *dir);
void exfat_free_ancestors(struct exfat_inode *child);
void exfat_free_dir_list(struct exfat *exfat);
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);
#endif
|