1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (C) 2021 LG Electronics.
5 * Author(s): Hyunchul Lee <hyc.lee@gmail.com>
15 struct exfat_inode *parent;
16 struct list_head children;
17 struct list_head sibling;
18 struct list_head list;
23 struct exfat_dentry *dentry_set;
26 __le16 name[0]; /* only for directory */
29 #define EXFAT_NAME_MAX 255
30 #define NAME_BUFFER_SIZE ((EXFAT_NAME_MAX + 1) * 2)
33 struct exfat_blk_dev *blk_dev;
35 char volume_label[VOLUME_LABEL_BUFFER_SIZE];
36 struct exfat_inode *root;
37 struct list_head dir_list;
39 unsigned int clus_size;
40 unsigned int sect_size;
44 clus_t disk_bitmap_clus;
45 unsigned int disk_bitmap_size;
48 unsigned int buffer_count;
49 struct buffer_desc *lookup_buffer; /* for dentry set lookup */
52 struct exfat_dentry_loc {
53 struct exfat_inode *parent;
58 struct path_resolve_ctx {
59 struct exfat_inode *ancestors[255];
60 __le16 utf16_path[PATH_MAX + 2];
61 char local_path[PATH_MAX * MB_LEN_MAX + 1];
68 char dirty[EXFAT_BITMAP_SIZE(4 * KB / 512)];
71 struct exfat *exfat_alloc_exfat(struct exfat_blk_dev *blk_dev, struct pbr *bs);
72 void exfat_free_exfat(struct exfat *exfat);
74 struct exfat_inode *exfat_alloc_inode(__u16 attr);
75 void exfat_free_inode(struct exfat_inode *node);
77 void exfat_free_children(struct exfat_inode *dir, bool file_only);
78 void exfat_free_file_children(struct exfat_inode *dir);
79 void exfat_free_ancestors(struct exfat_inode *child);
80 void exfat_free_dir_list(struct exfat *exfat);
82 int exfat_resolve_path(struct path_resolve_ctx *ctx, struct exfat_inode *child);
83 int exfat_resolve_path_parent(struct path_resolve_ctx *ctx,
84 struct exfat_inode *parent, struct exfat_inode *child);
86 struct buffer_desc *exfat_alloc_buffer(struct exfat *exfat);
87 void exfat_free_buffer(const struct exfat *exfat, struct buffer_desc *bd);
89 static inline unsigned int exfat_get_read_size(const struct exfat *exfat)
91 return MIN(exfat->clus_size, 4 * KB);