diff options
Diffstat (limited to 'drivers/staging/exfat')
-rw-r--r-- | drivers/staging/exfat/Kconfig | 26 | ||||
-rw-r--r-- | drivers/staging/exfat/Makefile | 2 | ||||
-rw-r--r-- | drivers/staging/exfat/exfat.h | 93 | ||||
-rw-r--r-- | drivers/staging/exfat/exfat_blkdev.c | 16 | ||||
-rw-r--r-- | drivers/staging/exfat/exfat_core.c | 211 | ||||
-rw-r--r-- | drivers/staging/exfat/exfat_super.c | 175 |
6 files changed, 234 insertions, 289 deletions
diff --git a/drivers/staging/exfat/Kconfig b/drivers/staging/exfat/Kconfig index 0130019cbec2..292a19dfcaf5 100644 --- a/drivers/staging/exfat/Kconfig +++ b/drivers/staging/exfat/Kconfig @@ -1,41 +1,41 @@ # SPDX-License-Identifier: GPL-2.0 -config EXFAT_FS +config STAGING_EXFAT_FS tristate "exFAT fs support" depends on BLOCK select NLS help This adds support for the exFAT file system. -config EXFAT_DISCARD +config STAGING_EXFAT_DISCARD bool "enable discard support" - depends on EXFAT_FS + depends on STAGING_EXFAT_FS default y -config EXFAT_DELAYED_SYNC +config STAGING_EXFAT_DELAYED_SYNC bool "enable delayed sync" - depends on EXFAT_FS + depends on STAGING_EXFAT_FS default n -config EXFAT_KERNEL_DEBUG +config STAGING_EXFAT_KERNEL_DEBUG bool "enable kernel debug features via ioctl" - depends on EXFAT_FS + depends on STAGING_EXFAT_FS default n -config EXFAT_DEBUG_MSG +config STAGING_EXFAT_DEBUG_MSG bool "print debug messages" - depends on EXFAT_FS + depends on STAGING_EXFAT_FS default n -config EXFAT_DEFAULT_CODEPAGE +config STAGING_EXFAT_DEFAULT_CODEPAGE int "Default codepage for exFAT" default 437 - depends on EXFAT_FS + depends on STAGING_EXFAT_FS help This option should be set to the codepage of your exFAT filesystems. -config EXFAT_DEFAULT_IOCHARSET +config STAGING_EXFAT_DEFAULT_IOCHARSET string "Default iocharset for exFAT" default "utf8" - depends on EXFAT_FS + depends on STAGING_EXFAT_FS help Set this to the default input/output character set you'd like exFAT to use. diff --git a/drivers/staging/exfat/Makefile b/drivers/staging/exfat/Makefile index 6c90aec83feb..057556eeca0c 100644 --- a/drivers/staging/exfat/Makefile +++ b/drivers/staging/exfat/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later -obj-$(CONFIG_EXFAT_FS) += exfat.o +obj-$(CONFIG_STAGING_EXFAT_FS) += exfat.o exfat-y := exfat_core.o \ exfat_super.o \ diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h index 51c665a924b7..4d87360fab35 100644 --- a/drivers/staging/exfat/exfat.h +++ b/drivers/staging/exfat/exfat.h @@ -9,7 +9,7 @@ #include <linux/types.h> #include <linux/buffer_head.h> -#ifdef CONFIG_EXFAT_KERNEL_DEBUG +#ifdef CONFIG_STAGING_EXFAT_KERNEL_DEBUG /* For Debugging Purpose */ /* IOCTL code 'f' used by * - file systems typically #0~0x1F @@ -22,9 +22,9 @@ #define EXFAT_DEBUGFLAGS_INVALID_UMOUNT 0x01 #define EXFAT_DEBUGFLAGS_ERROR_RW 0x02 -#endif /* CONFIG_EXFAT_KERNEL_DEBUG */ +#endif /* CONFIG_STAGING_EXFAT_KERNEL_DEBUG */ -#ifdef CONFIG_EXFAT_DEBUG_MSG +#ifdef CONFIG_STAGING_EXFAT_DEBUG_MSG #define DEBUG 1 #else #undef DEBUG @@ -516,49 +516,6 @@ struct buf_cache_t { struct buffer_head *buf_bh; }; -struct fs_func { - s32 (*alloc_cluster)(struct super_block *sb, s32 num_alloc, - struct chain_t *p_chain); - void (*free_cluster)(struct super_block *sb, struct chain_t *p_chain, - s32 do_relse); - s32 (*count_used_clusters)(struct super_block *sb); - - s32 (*init_dir_entry)(struct super_block *sb, struct chain_t *p_dir, - s32 entry, u32 type, u32 start_clu, u64 size); - s32 (*init_ext_entry)(struct super_block *sb, struct chain_t *p_dir, - s32 entry, s32 num_entries, - struct uni_name_t *p_uniname, - struct dos_name_t *p_dosname); - s32 (*find_dir_entry)(struct super_block *sb, struct chain_t *p_dir, - struct uni_name_t *p_uniname, s32 num_entries, - struct dos_name_t *p_dosname, u32 type); - void (*delete_dir_entry)(struct super_block *sb, - struct chain_t *p_dir, s32 entry, - s32 offset, s32 num_entries); - void (*get_uni_name_from_ext_entry)(struct super_block *sb, - struct chain_t *p_dir, s32 entry, - u16 *uniname); - s32 (*count_ext_entries)(struct super_block *sb, - struct chain_t *p_dir, s32 entry, - struct dentry_t *p_entry); - s32 (*calc_num_entries)(struct uni_name_t *p_uniname); - - u32 (*get_entry_type)(struct dentry_t *p_entry); - void (*set_entry_type)(struct dentry_t *p_entry, u32 type); - u32 (*get_entry_attr)(struct dentry_t *p_entry); - void (*set_entry_attr)(struct dentry_t *p_entry, u32 attr); - u8 (*get_entry_flag)(struct dentry_t *p_entry); - void (*set_entry_flag)(struct dentry_t *p_entry, u8 flag); - u32 (*get_entry_clu0)(struct dentry_t *p_entry); - void (*set_entry_clu0)(struct dentry_t *p_entry, u32 clu0); - u64 (*get_entry_size)(struct dentry_t *p_entry); - void (*set_entry_size)(struct dentry_t *p_entry, u64 size); - void (*get_entry_time)(struct dentry_t *p_entry, - struct timestamp_t *tp, u8 mode); - void (*set_entry_time)(struct dentry_t *p_entry, - struct timestamp_t *tp, u8 mode); -}; - struct fs_info_t { u32 drv; /* drive ID */ u32 vol_type; /* volume FAT type */ @@ -597,7 +554,6 @@ struct fs_info_t { u32 dev_ejected; /* block device operation error flag */ - struct fs_func *fs_func; struct mutex v_mutex; /* FAT cache */ @@ -661,10 +617,10 @@ struct exfat_mount_options { /* on error: continue, panic, remount-ro */ unsigned char errors; -#ifdef CONFIG_EXFAT_DISCARD +#ifdef CONFIG_STAGING_EXFAT_DISCARD /* flag on if -o dicard specified and device support discard() */ unsigned char discard; -#endif /* CONFIG_EXFAT_DISCARD */ +#endif /* CONFIG_STAGING_EXFAT_DISCARD */ }; #define EXFAT_HASH_BITS 8 @@ -700,9 +656,9 @@ struct exfat_sb_info { spinlock_t inode_hash_lock; struct hlist_head inode_hashtable[EXFAT_HASH_SIZE]; -#ifdef CONFIG_EXFAT_KERNEL_DEBUG +#ifdef CONFIG_STAGING_EXFAT_KERNEL_DEBUG long debug_flags; -#endif /* CONFIG_EXFAT_KERNEL_DEBUG */ +#endif /* CONFIG_STAGING_EXFAT_KERNEL_DEBUG */ }; /* @@ -829,5 +785,40 @@ int exfat_bdev_write(struct super_block *sb, sector_t secno, struct buffer_head *bh, u32 num_secs, bool sync); int exfat_bdev_sync(struct super_block *sb); +/* cluster operation functions */ +s32 exfat_alloc_cluster(struct super_block *sb, s32 num_alloc, + struct chain_t *p_chain); +void exfat_free_cluster(struct super_block *sb, struct chain_t *p_chain, + s32 do_relse); +s32 exfat_count_used_clusters(struct super_block *sb); + +/* dir operation functions */ +s32 exfat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir, + struct uni_name_t *p_uniname, s32 num_entries, + struct dos_name_t *p_dosname, u32 type); +void exfat_delete_dir_entry(struct super_block *sb, struct chain_t *p_dir, + s32 entry, s32 order, s32 num_entries); +void exfat_get_uni_name_from_ext_entry(struct super_block *sb, + struct chain_t *p_dir, s32 entry, + u16 *uniname); +s32 exfat_count_ext_entries(struct super_block *sb, struct chain_t *p_dir, + s32 entry, struct dentry_t *p_entry); +s32 exfat_calc_num_entries(struct uni_name_t *p_uniname); + +/* dir entry getter/setter */ +u32 exfat_get_entry_type(struct dentry_t *p_entry); +u32 exfat_get_entry_attr(struct dentry_t *p_entry); +void exfat_set_entry_attr(struct dentry_t *p_entry, u32 attr); +u8 exfat_get_entry_flag(struct dentry_t *p_entry); +void exfat_set_entry_flag(struct dentry_t *p_entry, u8 flags); +u32 exfat_get_entry_clu0(struct dentry_t *p_entry); +void exfat_set_entry_clu0(struct dentry_t *p_entry, u32 start_clu); +u64 exfat_get_entry_size(struct dentry_t *p_entry); +void exfat_set_entry_size(struct dentry_t *p_entry, u64 size); +void exfat_get_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp, + u8 mode); +void exfat_set_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp, + u8 mode); + extern const u8 uni_upcase[]; #endif /* _EXFAT_H */ diff --git a/drivers/staging/exfat/exfat_blkdev.c b/drivers/staging/exfat/exfat_blkdev.c index 7bcd98b13109..0a3dc3568293 100644 --- a/drivers/staging/exfat/exfat_blkdev.c +++ b/drivers/staging/exfat/exfat_blkdev.c @@ -31,17 +31,17 @@ void exfat_bdev_close(struct super_block *sb) } int exfat_bdev_read(struct super_block *sb, sector_t secno, struct buffer_head **bh, - u32 num_secs, bool read) + u32 num_secs, bool read) { struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info); struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); -#ifdef CONFIG_EXFAT_KERNEL_DEBUG +#ifdef CONFIG_STAGING_EXFAT_KERNEL_DEBUG struct exfat_sb_info *sbi = EXFAT_SB(sb); long flags = sbi->debug_flags; if (flags & EXFAT_DEBUGFLAGS_ERROR_RW) return -EIO; -#endif /* CONFIG_EXFAT_KERNEL_DEBUG */ +#endif /* CONFIG_STAGING_EXFAT_KERNEL_DEBUG */ if (!p_bd->opened) return -ENODEV; @@ -66,19 +66,19 @@ int exfat_bdev_read(struct super_block *sb, sector_t secno, struct buffer_head * } int exfat_bdev_write(struct super_block *sb, sector_t secno, struct buffer_head *bh, - u32 num_secs, bool sync) + u32 num_secs, bool sync) { s32 count; struct buffer_head *bh2; struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info); struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); -#ifdef CONFIG_EXFAT_KERNEL_DEBUG +#ifdef CONFIG_STAGING_EXFAT_KERNEL_DEBUG struct exfat_sb_info *sbi = EXFAT_SB(sb); long flags = sbi->debug_flags; if (flags & EXFAT_DEBUGFLAGS_ERROR_RW) return -EIO; -#endif /* CONFIG_EXFAT_KERNEL_DEBUG */ +#endif /* CONFIG_STAGING_EXFAT_KERNEL_DEBUG */ if (!p_bd->opened) return -ENODEV; @@ -121,13 +121,13 @@ no_bh: int exfat_bdev_sync(struct super_block *sb) { struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info); -#ifdef CONFIG_EXFAT_KERNEL_DEBUG +#ifdef CONFIG_STAGING_EXFAT_KERNEL_DEBUG struct exfat_sb_info *sbi = EXFAT_SB(sb); long flags = sbi->debug_flags; if (flags & EXFAT_DEBUGFLAGS_ERROR_RW) return -EIO; -#endif /* CONFIG_EXFAT_KERNEL_DEBUG */ +#endif /* CONFIG_STAGING_EXFAT_KERNEL_DEBUG */ if (!p_bd->opened) return -ENODEV; diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c index 794000e7bc6f..07b460d01334 100644 --- a/drivers/staging/exfat/exfat_core.c +++ b/drivers/staging/exfat/exfat_core.c @@ -177,11 +177,11 @@ static s32 clr_alloc_bitmap(struct super_block *sb, u32 clu) { int i, b; sector_t sector; -#ifdef CONFIG_EXFAT_DISCARD +#ifdef CONFIG_STAGING_EXFAT_DISCARD struct exfat_sb_info *sbi = EXFAT_SB(sb); struct exfat_mount_options *opts = &sbi->options; int ret; -#endif /* CONFIG_EXFAT_DISCARD */ +#endif /* CONFIG_STAGING_EXFAT_DISCARD */ struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info); @@ -192,7 +192,7 @@ static s32 clr_alloc_bitmap(struct super_block *sb, u32 clu) exfat_bitmap_clear((u8 *)p_fs->vol_amap[i]->b_data, b); -#ifdef CONFIG_EXFAT_DISCARD +#ifdef CONFIG_STAGING_EXFAT_DISCARD if (opts->discard) { ret = sb_issue_discard(sb, START_SECTOR(clu), (1 << p_fs->sectors_per_clu_bits), @@ -204,7 +204,7 @@ static s32 clr_alloc_bitmap(struct super_block *sb, u32 clu) return ret; } } -#endif /* CONFIG_EXFAT_DISCARD */ +#endif /* CONFIG_STAGING_EXFAT_DISCARD */ return sector_write(sb, sector, p_fs->vol_amap[i], 0); } @@ -249,7 +249,7 @@ static u32 test_alloc_bitmap(struct super_block *sb, u32 clu) return CLUSTER_32(~0); } -static s32 exfat_alloc_cluster(struct super_block *sb, s32 num_alloc, +s32 exfat_alloc_cluster(struct super_block *sb, s32 num_alloc, struct chain_t *p_chain) { s32 num_clusters = 0; @@ -328,7 +328,7 @@ static s32 exfat_alloc_cluster(struct super_block *sb, s32 num_alloc, return num_clusters; } -static void exfat_free_cluster(struct super_block *sb, struct chain_t *p_chain, +void exfat_free_cluster(struct super_block *sb, struct chain_t *p_chain, s32 do_relse) { s32 num_clusters = 0; @@ -434,7 +434,7 @@ s32 count_num_clusters(struct super_block *sb, struct chain_t *p_chain) return count; } -static s32 exfat_count_used_clusters(struct super_block *sb) +s32 exfat_count_used_clusters(struct super_block *sb) { int i, map_i, map_b, count = 0; u8 k; @@ -499,7 +499,7 @@ s32 load_alloc_bitmap(struct super_block *sb) if (!ep) return -ENOENT; - type = p_fs->fs_func->get_entry_type((struct dentry_t *)ep); + type = exfat_get_entry_type((struct dentry_t *)ep); if (type == TYPE_UNUSED) break; @@ -745,7 +745,7 @@ s32 load_upcase_table(struct super_block *sb) if (!ep) return -ENOENT; - type = p_fs->fs_func->get_entry_type((struct dentry_t *)ep); + type = exfat_get_entry_type((struct dentry_t *)ep); if (type == TYPE_UNUSED) break; @@ -787,7 +787,7 @@ void free_upcase_table(struct super_block *sb) * Directory Entry Management Functions */ -static u32 exfat_get_entry_type(struct dentry_t *p_entry) +u32 exfat_get_entry_type(struct dentry_t *p_entry) { struct file_dentry_t *ep = (struct file_dentry_t *)p_entry; @@ -862,56 +862,56 @@ static void exfat_set_entry_type(struct dentry_t *p_entry, u32 type) } } -static u32 exfat_get_entry_attr(struct dentry_t *p_entry) +u32 exfat_get_entry_attr(struct dentry_t *p_entry) { struct file_dentry_t *ep = (struct file_dentry_t *)p_entry; return (u32)GET16_A(ep->attr); } -static void exfat_set_entry_attr(struct dentry_t *p_entry, u32 attr) +void exfat_set_entry_attr(struct dentry_t *p_entry, u32 attr) { struct file_dentry_t *ep = (struct file_dentry_t *)p_entry; SET16_A(ep->attr, (u16)attr); } -static u8 exfat_get_entry_flag(struct dentry_t *p_entry) +u8 exfat_get_entry_flag(struct dentry_t *p_entry) { struct strm_dentry_t *ep = (struct strm_dentry_t *)p_entry; return ep->flags; } -static void exfat_set_entry_flag(struct dentry_t *p_entry, u8 flags) +void exfat_set_entry_flag(struct dentry_t *p_entry, u8 flags) { struct strm_dentry_t *ep = (struct strm_dentry_t *)p_entry; ep->flags = flags; } -static u32 exfat_get_entry_clu0(struct dentry_t *p_entry) +u32 exfat_get_entry_clu0(struct dentry_t *p_entry) { struct strm_dentry_t *ep = (struct strm_dentry_t *)p_entry; return GET32_A(ep->start_clu); } -static void exfat_set_entry_clu0(struct dentry_t *p_entry, u32 start_clu) +void exfat_set_entry_clu0(struct dentry_t *p_entry, u32 start_clu) { struct strm_dentry_t *ep = (struct strm_dentry_t *)p_entry; SET32_A(ep->start_clu, start_clu); } -static u64 exfat_get_entry_size(struct dentry_t *p_entry) +u64 exfat_get_entry_size(struct dentry_t *p_entry) { struct strm_dentry_t *ep = (struct strm_dentry_t *)p_entry; return GET64_A(ep->valid_size); } -static void exfat_set_entry_size(struct dentry_t *p_entry, u64 size) +void exfat_set_entry_size(struct dentry_t *p_entry, u64 size) { struct strm_dentry_t *ep = (struct strm_dentry_t *)p_entry; @@ -919,7 +919,7 @@ static void exfat_set_entry_size(struct dentry_t *p_entry, u64 size) SET64_A(ep->size, size); } -static void exfat_get_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp, +void exfat_get_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp, u8 mode) { u16 t = 0x00, d = 0x21; @@ -948,7 +948,7 @@ static void exfat_get_entry_time(struct dentry_t *p_entry, struct timestamp_t *t tp->year = (d >> 9); } -static void exfat_set_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp, +void exfat_set_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp, u8 mode) { u16 t, d; @@ -1013,7 +1013,7 @@ static void init_name_entry(struct name_dentry_t *ep, u16 *uniname) } static s32 exfat_init_dir_entry(struct super_block *sb, struct chain_t *p_dir, - s32 entry, u32 type, u32 start_clu, u64 size) + s32 entry, u32 type, u32 start_clu, u64 size) { sector_t sector; u8 flags; @@ -1088,20 +1088,19 @@ static s32 exfat_init_ext_entry(struct super_block *sb, struct chain_t *p_dir, return 0; } -static void exfat_delete_dir_entry(struct super_block *sb, struct chain_t *p_dir, +void exfat_delete_dir_entry(struct super_block *sb, struct chain_t *p_dir, s32 entry, s32 order, s32 num_entries) { int i; sector_t sector; struct dentry_t *ep; - struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); for (i = order; i < num_entries; i++) { ep = get_entry_in_dir(sb, p_dir, entry + i, §or); if (!ep) return; - p_fs->fs_func->set_entry_type(ep, TYPE_DELETED); + exfat_set_entry_type(ep, TYPE_DELETED); exfat_buf_modify(sb, sector); } } @@ -1256,7 +1255,7 @@ static s32 _walk_fat_chain(struct super_block *sb, struct chain_t *p_dir, } static s32 find_location(struct super_block *sb, struct chain_t *p_dir, s32 entry, - sector_t *sector, s32 *offset) + sector_t *sector, s32 *offset) { s32 off, ret; u32 clu = 0; @@ -1366,7 +1365,7 @@ struct entry_set_cache_t *get_entry_set_in_dir(struct super_block *sb, goto err_out; ep = (struct dentry_t *)(buf + off); - entry_type = p_fs->fs_func->get_entry_type(ep); + entry_type = exfat_get_entry_type(ep); if ((entry_type != TYPE_FILE) && (entry_type != TYPE_DIR)) goto err_out; @@ -1396,7 +1395,7 @@ struct entry_set_cache_t *get_entry_set_in_dir(struct super_block *sb, * instead of copying whole sector, we will check every entry. * this will provide minimum stablity and consistency. */ - entry_type = p_fs->fs_func->get_entry_type(ep); + entry_type = exfat_get_entry_type(ep); if ((entry_type == TYPE_UNUSED) || (entry_type == TYPE_DELETED)) goto err_out; @@ -1492,7 +1491,8 @@ void release_entry_set(struct entry_set_cache_t *es) /* search EMPTY CONTINUOUS "num_entries" entries */ static s32 search_deleted_or_unused_entry(struct super_block *sb, - struct chain_t *p_dir, s32 num_entries) + struct chain_t *p_dir, + s32 num_entries) { int i, dentry, num_empty = 0; s32 dentries_per_clu; @@ -1539,7 +1539,7 @@ static s32 search_deleted_or_unused_entry(struct super_block *sb, if (!ep) return -1; - type = p_fs->fs_func->get_entry_type(ep); + type = exfat_get_entry_type(ep); if (type == TYPE_UNUSED) { num_empty++; @@ -1613,7 +1613,7 @@ static s32 find_empty_entry(struct inode *inode, struct chain_t *p_dir, s32 num_ clu.flags = p_dir->flags; /* (1) allocate a cluster */ - ret = p_fs->fs_func->alloc_cluster(sb, 1, &clu); + ret = exfat_alloc_cluster(sb, 1, &clu); if (ret < 1) return -EIO; @@ -1649,8 +1649,8 @@ static s32 find_empty_entry(struct inode *inode, struct chain_t *p_dir, s32 num_ fid->entry + 1, §or); if (!ep) return -ENOENT; - p_fs->fs_func->set_entry_size(ep, size); - p_fs->fs_func->set_entry_flag(ep, p_dir->flags); + exfat_set_entry_size(ep, size); + exfat_set_entry_flag(ep, p_dir->flags); exfat_buf_modify(sb, sector); update_dir_checksum(sb, &fid->dir, @@ -1668,7 +1668,7 @@ static s32 find_empty_entry(struct inode *inode, struct chain_t *p_dir, s32 num_ } static s32 extract_uni_name_from_name_entry(struct name_dentry_t *ep, u16 *uniname, - s32 order) + s32 order) { int i, len = 0; @@ -1689,7 +1689,7 @@ static s32 extract_uni_name_from_name_entry(struct name_dentry_t *ep, u16 *unina * -1 : (root dir, ".") it is the root dir itself * -2 : entry with the name does not exist */ -static s32 exfat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir, +s32 exfat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir, struct uni_name_t *p_uniname, s32 num_entries, struct dos_name_t *p_dosname, u32 type) { @@ -1735,7 +1735,7 @@ static s32 exfat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir, if (!ep) return -2; - entry_type = p_fs->fs_func->get_entry_type(ep); + entry_type = exfat_get_entry_type(ep); step = 1; if ((entry_type == TYPE_UNUSED) || (entry_type == TYPE_DELETED)) { @@ -1832,21 +1832,20 @@ static s32 exfat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir, return -2; } -static s32 exfat_count_ext_entries(struct super_block *sb, struct chain_t *p_dir, +s32 exfat_count_ext_entries(struct super_block *sb, struct chain_t *p_dir, s32 entry, struct dentry_t *p_entry) { int i, count = 0; u32 type; struct file_dentry_t *file_ep = (struct file_dentry_t *)p_entry; struct dentry_t *ext_ep; - struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); for (i = 0, entry++; i < file_ep->num_ext; i++, entry++) { ext_ep = get_entry_in_dir(sb, p_dir, entry, NULL); if (!ext_ep) return -1; - type = p_fs->fs_func->get_entry_type(ext_ep); + type = exfat_get_entry_type(ext_ep); if ((type == TYPE_EXTEND) || (type == TYPE_STREAM)) count++; else @@ -1884,7 +1883,7 @@ s32 count_dos_name_entries(struct super_block *sb, struct chain_t *p_dir, if (!ep) return -ENOENT; - entry_type = p_fs->fs_func->get_entry_type(ep); + entry_type = exfat_get_entry_type(ep); if (entry_type == TYPE_UNUSED) return count; @@ -1940,7 +1939,7 @@ bool is_dir_empty(struct super_block *sb, struct chain_t *p_dir) if (!ep) break; - type = p_fs->fs_func->get_entry_type(ep); + type = exfat_get_entry_type(ep); if (type == TYPE_UNUSED) return true; @@ -1984,9 +1983,8 @@ s32 get_num_entries_and_dos_name(struct super_block *sb, struct chain_t *p_dir, struct dos_name_t *p_dosname) { s32 num_entries; - struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); - num_entries = p_fs->fs_func->calc_num_entries(p_uniname); + num_entries = exfat_calc_num_entries(p_uniname); if (num_entries == 0) return -EINVAL; @@ -1995,14 +1993,13 @@ s32 get_num_entries_and_dos_name(struct super_block *sb, struct chain_t *p_dir, return 0; } -static void exfat_get_uni_name_from_ext_entry(struct super_block *sb, +void exfat_get_uni_name_from_ext_entry(struct super_block *sb, struct chain_t *p_dir, s32 entry, u16 *uniname) { int i; struct dentry_t *ep; struct entry_set_cache_t *es; - struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); es = get_entry_set_in_dir(sb, p_dir, entry, ES_ALL_ENTRIES, &ep); if (!es || es->num_entries < 3) { @@ -2020,7 +2017,7 @@ static void exfat_get_uni_name_from_ext_entry(struct super_block *sb, * So, the index of first file-name dentry should start from 2. */ for (i = 2; i < es->num_entries; i++, ep++) { - if (p_fs->fs_func->get_entry_type(ep) == TYPE_EXTEND) + if (exfat_get_entry_type(ep) == TYPE_EXTEND) extract_uni_name_from_name_entry((struct name_dentry_t *) ep, uniname, i); else @@ -2032,7 +2029,7 @@ out: release_entry_set(es); } -static s32 exfat_calc_num_entries(struct uni_name_t *p_uniname) +s32 exfat_calc_num_entries(struct uni_name_t *p_uniname) { s32 len; @@ -2100,36 +2097,6 @@ s32 resolve_path(struct inode *inode, char *path, struct chain_t *p_dir, return 0; } -/* - * File Operation Functions - */ -static struct fs_func exfat_fs_func = { - .alloc_cluster = exfat_alloc_cluster, - .free_cluster = exfat_free_cluster, - .count_used_clusters = exfat_count_used_clusters, - - .init_dir_entry = exfat_init_dir_entry, - .init_ext_entry = exfat_init_ext_entry, - .find_dir_entry = exfat_find_dir_entry, - .delete_dir_entry = exfat_delete_dir_entry, - .get_uni_name_from_ext_entry = exfat_get_uni_name_from_ext_entry, - .count_ext_entries = exfat_count_ext_entries, - .calc_num_entries = exfat_calc_num_entries, - - .get_entry_type = exfat_get_entry_type, - .set_entry_type = exfat_set_entry_type, - .get_entry_attr = exfat_get_entry_attr, - .set_entry_attr = exfat_set_entry_attr, - .get_entry_flag = exfat_get_entry_flag, - .set_entry_flag = exfat_set_entry_flag, - .get_entry_clu0 = exfat_get_entry_clu0, - .set_entry_clu0 = exfat_set_entry_clu0, - .get_entry_size = exfat_get_entry_size, - .set_entry_size = exfat_set_entry_size, - .get_entry_time = exfat_get_entry_time, - .set_entry_time = exfat_set_entry_time, -}; - s32 exfat_mount(struct super_block *sb, struct pbr_sector_t *p_pbr) { struct bpbex_t *p_bpb = (struct bpbex_t *)p_pbr->bpb; @@ -2173,8 +2140,6 @@ s32 exfat_mount(struct super_block *sb, struct pbr_sector_t *p_pbr) p_fs->clu_srch_ptr = 2; p_fs->used_clusters = UINT_MAX; - p_fs->fs_func = &exfat_fs_func; - return 0; } @@ -2187,7 +2152,6 @@ s32 create_dir(struct inode *inode, struct chain_t *p_dir, struct dos_name_t dos_name; struct super_block *sb = inode->i_sb; struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); - struct fs_func *fs_func = p_fs->fs_func; ret = get_num_entries_and_dos_name(sb, p_dir, p_uniname, &num_entries, &dos_name); @@ -2204,7 +2168,7 @@ s32 create_dir(struct inode *inode, struct chain_t *p_dir, clu.flags = (p_fs->vol_type == EXFAT) ? 0x03 : 0x01; /* (1) allocate a cluster */ - ret = fs_func->alloc_cluster(sb, 1, &clu); + ret = exfat_alloc_cluster(sb, 1, &clu); if (ret < 0) return ret; else if (ret == 0) @@ -2218,13 +2182,13 @@ s32 create_dir(struct inode *inode, struct chain_t *p_dir, /* (2) update the directory entry */ /* make sub-dir entry in parent directory */ - ret = fs_func->init_dir_entry(sb, p_dir, dentry, TYPE_DIR, clu.dir, - size); + ret = exfat_init_dir_entry(sb, p_dir, dentry, TYPE_DIR, clu.dir, + size); if (ret != 0) return ret; - ret = fs_func->init_ext_entry(sb, p_dir, dentry, num_entries, p_uniname, - &dos_name); + ret = exfat_init_ext_entry(sb, p_dir, dentry, num_entries, p_uniname, + &dos_name); if (ret != 0) return ret; @@ -2252,7 +2216,6 @@ s32 create_file(struct inode *inode, struct chain_t *p_dir, struct dos_name_t dos_name; struct super_block *sb = inode->i_sb; struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); - struct fs_func *fs_func = p_fs->fs_func; ret = get_num_entries_and_dos_name(sb, p_dir, p_uniname, &num_entries, &dos_name); @@ -2268,13 +2231,13 @@ s32 create_file(struct inode *inode, struct chain_t *p_dir, /* fill the dos name directory entry information of the created file. * the first cluster is not determined yet. (0) */ - ret = fs_func->init_dir_entry(sb, p_dir, dentry, TYPE_FILE | mode, - CLUSTER_32(0), 0); + ret = exfat_init_dir_entry(sb, p_dir, dentry, TYPE_FILE | mode, + CLUSTER_32(0), 0); if (ret != 0) return ret; - ret = fs_func->init_ext_entry(sb, p_dir, dentry, num_entries, p_uniname, - &dos_name); + ret = exfat_init_ext_entry(sb, p_dir, dentry, num_entries, p_uniname, + &dos_name); if (ret != 0) return ret; @@ -2301,8 +2264,6 @@ void remove_file(struct inode *inode, struct chain_t *p_dir, s32 entry) sector_t sector; struct dentry_t *ep; struct super_block *sb = inode->i_sb; - struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); - struct fs_func *fs_func = p_fs->fs_func; ep = get_entry_in_dir(sb, p_dir, entry, §or); if (!ep) @@ -2311,7 +2272,7 @@ void remove_file(struct inode *inode, struct chain_t *p_dir, s32 entry) exfat_buf_lock(sb, sector); /* exfat_buf_lock() before call count_ext_entries() */ - num_entries = fs_func->count_ext_entries(sb, p_dir, entry, ep); + num_entries = exfat_count_ext_entries(sb, p_dir, entry, ep); if (num_entries < 0) { exfat_buf_unlock(sb, sector); return; @@ -2321,7 +2282,7 @@ void remove_file(struct inode *inode, struct chain_t *p_dir, s32 entry) exfat_buf_unlock(sb, sector); /* (1) update the directory entry */ - fs_func->delete_dir_entry(sb, p_dir, entry, 0, num_entries); + exfat_delete_dir_entry(sb, p_dir, entry, 0, num_entries); } s32 exfat_rename_file(struct inode *inode, struct chain_t *p_dir, s32 oldentry, @@ -2332,8 +2293,6 @@ s32 exfat_rename_file(struct inode *inode, struct chain_t *p_dir, s32 oldentry, struct dos_name_t dos_name; struct dentry_t *epold, *epnew; struct super_block *sb = inode->i_sb; - struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); - struct fs_func *fs_func = p_fs->fs_func; epold = get_entry_in_dir(sb, p_dir, oldentry, §or_old); if (!epold) @@ -2342,8 +2301,8 @@ s32 exfat_rename_file(struct inode *inode, struct chain_t *p_dir, s32 oldentry, exfat_buf_lock(sb, sector_old); /* exfat_buf_lock() before call count_ext_entries() */ - num_old_entries = fs_func->count_ext_entries(sb, p_dir, oldentry, - epold); + num_old_entries = exfat_count_ext_entries(sb, p_dir, oldentry, + epold); if (num_old_entries < 0) { exfat_buf_unlock(sb, sector_old); return -ENOENT; @@ -2371,10 +2330,10 @@ s32 exfat_rename_file(struct inode *inode, struct chain_t *p_dir, s32 oldentry, } memcpy((void *)epnew, (void *)epold, DENTRY_SIZE); - if (fs_func->get_entry_type(epnew) == TYPE_FILE) { - fs_func->set_entry_attr(epnew, - fs_func->get_entry_attr(epnew) | - ATTR_ARCHIVE); + if (exfat_get_entry_type(epnew) == TYPE_FILE) { + exfat_set_entry_attr(epnew, + exfat_get_entry_attr(epnew) | + ATTR_ARCHIVE); fid->attr |= ATTR_ARCHIVE; } exfat_buf_modify(sb, sector_new); @@ -2395,33 +2354,33 @@ s32 exfat_rename_file(struct inode *inode, struct chain_t *p_dir, s32 oldentry, exfat_buf_modify(sb, sector_new); exfat_buf_unlock(sb, sector_old); - ret = fs_func->init_ext_entry(sb, p_dir, newentry, - num_new_entries, p_uniname, - &dos_name); + ret = exfat_init_ext_entry(sb, p_dir, newentry, + num_new_entries, p_uniname, + &dos_name); if (ret != 0) return ret; - fs_func->delete_dir_entry(sb, p_dir, oldentry, 0, - num_old_entries); + exfat_delete_dir_entry(sb, p_dir, oldentry, 0, + num_old_entries); fid->entry = newentry; } else { - if (fs_func->get_entry_type(epold) == TYPE_FILE) { - fs_func->set_entry_attr(epold, - fs_func->get_entry_attr(epold) | - ATTR_ARCHIVE); + if (exfat_get_entry_type(epold) == TYPE_FILE) { + exfat_set_entry_attr(epold, + exfat_get_entry_attr(epold) | + ATTR_ARCHIVE); fid->attr |= ATTR_ARCHIVE; } exfat_buf_modify(sb, sector_old); exfat_buf_unlock(sb, sector_old); - ret = fs_func->init_ext_entry(sb, p_dir, oldentry, - num_new_entries, p_uniname, - &dos_name); + ret = exfat_init_ext_entry(sb, p_dir, oldentry, + num_new_entries, p_uniname, + &dos_name); if (ret != 0) return ret; - fs_func->delete_dir_entry(sb, p_dir, oldentry, num_new_entries, - num_old_entries); + exfat_delete_dir_entry(sb, p_dir, oldentry, num_new_entries, + num_old_entries); } return 0; @@ -2436,23 +2395,21 @@ s32 move_file(struct inode *inode, struct chain_t *p_olddir, s32 oldentry, struct dos_name_t dos_name; struct dentry_t *epmov, *epnew; struct super_block *sb = inode->i_sb; - struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); - struct fs_func *fs_func = p_fs->fs_func; epmov = get_entry_in_dir(sb, p_olddir, oldentry, §or_mov); if (!epmov) return -ENOENT; /* check if the source and target directory is the same */ - if (fs_func->get_entry_type(epmov) == TYPE_DIR && - fs_func->get_entry_clu0(epmov) == p_newdir->dir) + if (exfat_get_entry_type(epmov) == TYPE_DIR && + exfat_get_entry_clu0(epmov) == p_newdir->dir) return -EINVAL; exfat_buf_lock(sb, sector_mov); /* exfat_buf_lock() before call count_ext_entries() */ - num_old_entries = fs_func->count_ext_entries(sb, p_olddir, oldentry, - epmov); + num_old_entries = exfat_count_ext_entries(sb, p_olddir, oldentry, + epmov); if (num_old_entries < 0) { exfat_buf_unlock(sb, sector_mov); return -ENOENT; @@ -2479,9 +2436,9 @@ s32 move_file(struct inode *inode, struct chain_t *p_olddir, s32 oldentry, } memcpy((void *)epnew, (void *)epmov, DENTRY_SIZE); - if (fs_func->get_entry_type(epnew) == TYPE_FILE) { - fs_func->set_entry_attr(epnew, fs_func->get_entry_attr(epnew) | - ATTR_ARCHIVE); + if (exfat_get_entry_type(epnew) == TYPE_FILE) { + exfat_set_entry_attr(epnew, exfat_get_entry_attr(epnew) | + ATTR_ARCHIVE); fid->attr |= ATTR_ARCHIVE; } exfat_buf_modify(sb, sector_new); @@ -2501,12 +2458,12 @@ s32 move_file(struct inode *inode, struct chain_t *p_olddir, s32 oldentry, exfat_buf_modify(sb, sector_new); exfat_buf_unlock(sb, sector_mov); - ret = fs_func->init_ext_entry(sb, p_newdir, newentry, num_new_entries, - p_uniname, &dos_name); + ret = exfat_init_ext_entry(sb, p_newdir, newentry, num_new_entries, + p_uniname, &dos_name); if (ret != 0) return ret; - fs_func->delete_dir_entry(sb, p_olddir, oldentry, 0, num_old_entries); + exfat_delete_dir_entry(sb, p_olddir, oldentry, 0, num_old_entries); fid->dir.dir = p_newdir->dir; fid->dir.size = p_newdir->size; diff --git a/drivers/staging/exfat/exfat_super.c b/drivers/staging/exfat/exfat_super.c index 9f91853b189b..b81d2a87b82e 100644 --- a/drivers/staging/exfat/exfat_super.c +++ b/drivers/staging/exfat/exfat_super.c @@ -38,8 +38,8 @@ static struct kmem_cache *exfat_inode_cachep; -static int exfat_default_codepage = CONFIG_EXFAT_DEFAULT_CODEPAGE; -static char exfat_default_iocharset[] = CONFIG_EXFAT_DEFAULT_IOCHARSET; +static int exfat_default_codepage = CONFIG_STAGING_EXFAT_DEFAULT_CODEPAGE; +static char exfat_default_iocharset[] = CONFIG_STAGING_EXFAT_DEFAULT_IOCHARSET; #define INC_IVERSION(x) (inode_inc_iversion(x)) #define GET_IVERSION(x) (inode_peek_iversion_raw(x)) @@ -365,7 +365,7 @@ static int ffsMountVol(struct super_block *sb) if (p_bd->sector_size < sb->s_blocksize) { printk(KERN_INFO "EXFAT: mount failed - sector size %d less than blocksize %ld\n", - p_bd->sector_size, sb->s_blocksize); + p_bd->sector_size, sb->s_blocksize); ret = -EINVAL; goto out; } @@ -492,7 +492,7 @@ static int ffsGetVolInfo(struct super_block *sb, struct vol_info_t *info) mutex_lock(&p_fs->v_mutex); if (p_fs->used_clusters == UINT_MAX) - p_fs->used_clusters = p_fs->fs_func->count_used_clusters(sb); + p_fs->used_clusters = exfat_count_used_clusters(sb); info->FatType = p_fs->vol_type; info->ClusterSize = p_fs->cluster_size; @@ -565,8 +565,8 @@ static int ffsLookupFile(struct inode *inode, char *path, struct file_id_t *fid) goto out; /* search the file name for directories */ - dentry = p_fs->fs_func->find_dir_entry(sb, &dir, &uni_name, num_entries, - &dos_name, TYPE_ALL); + dentry = exfat_find_dir_entry(sb, &dir, &uni_name, num_entries, + &dos_name, TYPE_ALL); if (dentry < -1) { ret = -ENOENT; goto out; @@ -595,18 +595,18 @@ static int ffsLookupFile(struct inode *inode, char *path, struct file_id_t *fid) } ep2 = ep + 1; - fid->type = p_fs->fs_func->get_entry_type(ep); + fid->type = exfat_get_entry_type(ep); fid->rwoffset = 0; fid->hint_last_off = -1; - fid->attr = p_fs->fs_func->get_entry_attr(ep); + fid->attr = exfat_get_entry_attr(ep); - fid->size = p_fs->fs_func->get_entry_size(ep2); + fid->size = exfat_get_entry_size(ep2); if ((fid->type == TYPE_FILE) && (fid->size == 0)) { fid->flags = (p_fs->vol_type == EXFAT) ? 0x03 : 0x01; fid->start_clu = CLUSTER_32(~0); } else { - fid->flags = p_fs->fs_func->get_entry_flag(ep2); - fid->start_clu = p_fs->fs_func->get_entry_clu0(ep2); + fid->flags = exfat_get_entry_flag(ep2); + fid->start_clu = exfat_get_entry_clu0(ep2); } release_entry_set(es); @@ -647,7 +647,7 @@ static int ffsCreateFile(struct inode *inode, char *path, u8 mode, /* create a new file */ ret = create_file(inode, &dir, &uni_name, mode, fid); -#ifndef CONFIG_EXFAT_DELAYED_SYNC +#ifndef CONFIG_STAGING_EXFAT_DELAYED_SYNC fs_sync(sb, true); fs_set_vol_flags(sb, VOL_CLEAN); #endif @@ -886,9 +886,9 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid, new_clu.flags = fid->flags; /* (1) allocate a chain of clusters */ - num_alloced = p_fs->fs_func->alloc_cluster(sb, - num_alloc, - &new_clu); + num_alloced = exfat_alloc_cluster(sb, + num_alloc, + &new_clu); if (num_alloced == 0) break; if (num_alloced < 0) { @@ -991,24 +991,24 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid, goto err_out; ep2 = ep + 1; - p_fs->fs_func->set_entry_time(ep, tm_current(&tm), TM_MODIFY); - p_fs->fs_func->set_entry_attr(ep, fid->attr); + exfat_set_entry_time(ep, tm_current(&tm), TM_MODIFY); + exfat_set_entry_attr(ep, fid->attr); if (modified) { - if (p_fs->fs_func->get_entry_flag(ep2) != fid->flags) - p_fs->fs_func->set_entry_flag(ep2, fid->flags); + if (exfat_get_entry_flag(ep2) != fid->flags) + exfat_set_entry_flag(ep2, fid->flags); - if (p_fs->fs_func->get_entry_size(ep2) != fid->size) - p_fs->fs_func->set_entry_size(ep2, fid->size); + if (exfat_get_entry_size(ep2) != fid->size) + exfat_set_entry_size(ep2, fid->size); - if (p_fs->fs_func->get_entry_clu0(ep2) != fid->start_clu) - p_fs->fs_func->set_entry_clu0(ep2, fid->start_clu); + if (exfat_get_entry_clu0(ep2) != fid->start_clu) + exfat_set_entry_clu0(ep2, fid->start_clu); } update_dir_checksum_with_entry_set(sb, es); release_entry_set(es); -#ifndef CONFIG_EXFAT_DELAYED_SYNC +#ifndef CONFIG_STAGING_EXFAT_DELAYED_SYNC fs_sync(sb, true); fs_set_vol_flags(sb, VOL_CLEAN); #endif @@ -1108,13 +1108,13 @@ static int ffsTruncateFile(struct inode *inode, u64 old_size, u64 new_size) } ep2 = ep + 1; - p_fs->fs_func->set_entry_time(ep, tm_current(&tm), TM_MODIFY); - p_fs->fs_func->set_entry_attr(ep, fid->attr); + exfat_set_entry_time(ep, tm_current(&tm), TM_MODIFY); + exfat_set_entry_attr(ep, fid->attr); - p_fs->fs_func->set_entry_size(ep2, new_size); + exfat_set_entry_size(ep2, new_size); if (new_size == 0) { - p_fs->fs_func->set_entry_flag(ep2, 0x01); - p_fs->fs_func->set_entry_clu0(ep2, CLUSTER_32(0)); + exfat_set_entry_flag(ep2, 0x01); + exfat_set_entry_clu0(ep2, CLUSTER_32(0)); } update_dir_checksum_with_entry_set(sb, es); @@ -1127,14 +1127,14 @@ static int ffsTruncateFile(struct inode *inode, u64 old_size, u64 new_size) } /* (3) free the clusters */ - p_fs->fs_func->free_cluster(sb, &clu, 0); + exfat_free_cluster(sb, &clu, 0); /* hint information */ fid->hint_last_off = -1; if (fid->rwoffset > fid->size) fid->rwoffset = fid->size; -#ifndef CONFIG_EXFAT_DELAYED_SYNC +#ifndef CONFIG_STAGING_EXFAT_DELAYED_SYNC fs_sync(sb, true); fs_set_vol_flags(sb, VOL_CLEAN); #endif @@ -1217,7 +1217,7 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid, goto out2; } - if (p_fs->fs_func->get_entry_attr(ep) & ATTR_READONLY) { + if (exfat_get_entry_attr(ep) & ATTR_READONLY) { ret = -EPERM; goto out2; } @@ -1237,7 +1237,7 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid, if (!ep) goto out; - entry_type = p_fs->fs_func->get_entry_type(ep); + entry_type = exfat_get_entry_type(ep); if (entry_type == TYPE_DIR) { struct chain_t new_clu; @@ -1274,15 +1274,15 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid, if (!ep) goto out; - num_entries = p_fs->fs_func->count_ext_entries(sb, p_dir, - new_entry, ep); + num_entries = exfat_count_ext_entries(sb, p_dir, + new_entry, ep); if (num_entries < 0) goto out; - p_fs->fs_func->delete_dir_entry(sb, p_dir, new_entry, 0, - num_entries + 1); + exfat_delete_dir_entry(sb, p_dir, new_entry, 0, + num_entries + 1); } out: -#ifndef CONFIG_EXFAT_DELAYED_SYNC +#ifndef CONFIG_STAGING_EXFAT_DELAYED_SYNC fs_sync(sb, true); fs_set_vol_flags(sb, VOL_CLEAN); #endif @@ -1324,7 +1324,7 @@ static int ffsRemoveFile(struct inode *inode, struct file_id_t *fid) goto out; } - if (p_fs->fs_func->get_entry_attr(ep) & ATTR_READONLY) { + if (exfat_get_entry_attr(ep) & ATTR_READONLY) { ret = -EPERM; goto out; } @@ -1338,13 +1338,13 @@ static int ffsRemoveFile(struct inode *inode, struct file_id_t *fid) clu_to_free.flags = fid->flags; /* (2) free the clusters */ - p_fs->fs_func->free_cluster(sb, &clu_to_free, 0); + exfat_free_cluster(sb, &clu_to_free, 0); fid->size = 0; fid->start_clu = CLUSTER_32(~0); fid->flags = (p_fs->vol_type == EXFAT) ? 0x03 : 0x01; -#ifndef CONFIG_EXFAT_DELAYED_SYNC +#ifndef CONFIG_STAGING_EXFAT_DELAYED_SYNC fs_sync(sb, true); fs_set_vol_flags(sb, VOL_CLEAN); #endif @@ -1398,7 +1398,7 @@ static int ffsSetAttr(struct inode *inode, u32 attr) goto out; } - type = p_fs->fs_func->get_entry_type(ep); + type = exfat_get_entry_type(ep); if (((type == TYPE_FILE) && (attr & ATTR_SUBDIR)) || ((type == TYPE_DIR) && (!(attr & ATTR_SUBDIR)))) { @@ -1415,12 +1415,12 @@ static int ffsSetAttr(struct inode *inode, u32 attr) /* set the file attribute */ fid->attr = attr; - p_fs->fs_func->set_entry_attr(ep, attr); + exfat_set_entry_attr(ep, attr); update_dir_checksum_with_entry_set(sb, es); release_entry_set(es); -#ifndef CONFIG_EXFAT_DELAYED_SYNC +#ifndef CONFIG_STAGING_EXFAT_DELAYED_SYNC fs_sync(sb, true); fs_set_vol_flags(sb, VOL_CLEAN); #endif @@ -1481,7 +1481,7 @@ static int ffsReadStat(struct inode *inode, struct dir_entry_t *info) count = count_dos_name_entries(sb, &dir, TYPE_DIR); if (count < 0) { - ret = count; /* propogate error upward */ + ret = count; /* propagate error upward */ goto out; } info->NumSubdirs = count; @@ -1502,9 +1502,9 @@ static int ffsReadStat(struct inode *inode, struct dir_entry_t *info) ep2 = ep + 1; /* set FILE_INFO structure using the acquired struct dentry_t */ - info->Attr = p_fs->fs_func->get_entry_attr(ep); + info->Attr = exfat_get_entry_attr(ep); - p_fs->fs_func->get_entry_time(ep, &tm, TM_CREATE); + exfat_get_entry_time(ep, &tm, TM_CREATE); info->CreateTimestamp.Year = tm.year; info->CreateTimestamp.Month = tm.mon; info->CreateTimestamp.Day = tm.day; @@ -1513,7 +1513,7 @@ static int ffsReadStat(struct inode *inode, struct dir_entry_t *info) info->CreateTimestamp.Second = tm.sec; info->CreateTimestamp.MilliSecond = 0; - p_fs->fs_func->get_entry_time(ep, &tm, TM_MODIFY); + exfat_get_entry_time(ep, &tm, TM_MODIFY); info->ModifyTimestamp.Year = tm.year; info->ModifyTimestamp.Month = tm.mon; info->ModifyTimestamp.Day = tm.day; @@ -1528,13 +1528,13 @@ static int ffsReadStat(struct inode *inode, struct dir_entry_t *info) /* XXX this is very bad for exfat cuz name is already included in es. * API should be revised */ - p_fs->fs_func->get_uni_name_from_ext_entry(sb, &fid->dir, fid->entry, - uni_name.name); + exfat_get_uni_name_from_ext_entry(sb, &fid->dir, fid->entry, + uni_name.name); nls_uniname_to_cstring(sb, info->Name, &uni_name); info->NumSubdirs = 2; - info->Size = p_fs->fs_func->get_entry_size(ep2); + info->Size = exfat_get_entry_size(ep2); release_entry_set(es); @@ -1548,7 +1548,7 @@ static int ffsReadStat(struct inode *inode, struct dir_entry_t *info) count = count_dos_name_entries(sb, &dir, TYPE_DIR); if (count < 0) { - ret = count; /* propogate error upward */ + ret = count; /* propagate error upward */ goto out; } info->NumSubdirs += count; @@ -1602,7 +1602,7 @@ static int ffsWriteStat(struct inode *inode, struct dir_entry_t *info) } ep2 = ep + 1; - p_fs->fs_func->set_entry_attr(ep, info->Attr); + exfat_set_entry_attr(ep, info->Attr); /* set FILE_INFO structure using the acquired struct dentry_t */ tm.sec = info->CreateTimestamp.Second; @@ -1611,7 +1611,7 @@ static int ffsWriteStat(struct inode *inode, struct dir_entry_t *info) tm.day = info->CreateTimestamp.Day; tm.mon = info->CreateTimestamp.Month; tm.year = info->CreateTimestamp.Year; - p_fs->fs_func->set_entry_time(ep, &tm, TM_CREATE); + exfat_set_entry_time(ep, &tm, TM_CREATE); tm.sec = info->ModifyTimestamp.Second; tm.min = info->ModifyTimestamp.Minute; @@ -1619,9 +1619,9 @@ static int ffsWriteStat(struct inode *inode, struct dir_entry_t *info) tm.day = info->ModifyTimestamp.Day; tm.mon = info->ModifyTimestamp.Month; tm.year = info->ModifyTimestamp.Year; - p_fs->fs_func->set_entry_time(ep, &tm, TM_MODIFY); + exfat_set_entry_time(ep, &tm, TM_MODIFY); - p_fs->fs_func->set_entry_size(ep2, info->Size); + exfat_set_entry_size(ep2, info->Size); update_dir_checksum_with_entry_set(sb, es); release_entry_set(es); @@ -1704,7 +1704,7 @@ static int ffsMapCluster(struct inode *inode, s32 clu_offset, u32 *clu) new_clu.flags = fid->flags; /* (1) allocate a cluster */ - num_alloced = p_fs->fs_func->alloc_cluster(sb, 1, &new_clu); + num_alloced = exfat_alloc_cluster(sb, 1, &new_clu); if (num_alloced < 0) { ret = -EIO; goto out; @@ -1744,13 +1744,11 @@ static int ffsMapCluster(struct inode *inode, s32 clu_offset, u32 *clu) /* (3) update directory entry */ if (modified) { - if (p_fs->fs_func->get_entry_flag(ep) != fid->flags) - p_fs->fs_func->set_entry_flag(ep, fid->flags); - - if (p_fs->fs_func->get_entry_clu0(ep) != fid->start_clu) - p_fs->fs_func->set_entry_clu0(ep, - fid->start_clu); + if (exfat_get_entry_flag(ep) != fid->flags) + exfat_set_entry_flag(ep, fid->flags); + if (exfat_get_entry_clu0(ep) != fid->start_clu) + exfat_set_entry_clu0(ep, fid->start_clu); } update_dir_checksum_with_entry_set(sb, es); @@ -1804,7 +1802,7 @@ static int ffsCreateDir(struct inode *inode, char *path, struct file_id_t *fid) ret = create_dir(inode, &dir, &uni_name, fid); -#ifndef CONFIG_EXFAT_DELAYED_SYNC +#ifndef CONFIG_STAGING_EXFAT_DELAYED_SYNC fs_sync(sb, true); fs_set_vol_flags(sb, VOL_CLEAN); #endif @@ -1831,7 +1829,6 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry) struct dentry_t *ep; struct super_block *sb = inode->i_sb; struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); - struct fs_func *fs_func = p_fs->fs_func; struct file_id_t *fid = &(EXFAT_I(inode)->fid); /* check the validity of pointer parameters */ @@ -1913,7 +1910,7 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry) ret = -ENOENT; goto out; } - type = fs_func->get_entry_type(ep); + type = exfat_get_entry_type(ep); if (type == TYPE_UNUSED) break; @@ -1922,9 +1919,9 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry) continue; exfat_buf_lock(sb, sector); - dir_entry->Attr = fs_func->get_entry_attr(ep); + dir_entry->Attr = exfat_get_entry_attr(ep); - fs_func->get_entry_time(ep, &tm, TM_CREATE); + exfat_get_entry_time(ep, &tm, TM_CREATE); dir_entry->CreateTimestamp.Year = tm.year; dir_entry->CreateTimestamp.Month = tm.mon; dir_entry->CreateTimestamp.Day = tm.day; @@ -1933,7 +1930,7 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry) dir_entry->CreateTimestamp.Second = tm.sec; dir_entry->CreateTimestamp.MilliSecond = 0; - fs_func->get_entry_time(ep, &tm, TM_MODIFY); + exfat_get_entry_time(ep, &tm, TM_MODIFY); dir_entry->ModifyTimestamp.Year = tm.year; dir_entry->ModifyTimestamp.Month = tm.mon; dir_entry->ModifyTimestamp.Day = tm.day; @@ -1946,8 +1943,8 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry) sizeof(struct date_time_t)); *uni_name.name = 0x0; - fs_func->get_uni_name_from_ext_entry(sb, &dir, dentry, - uni_name.name); + exfat_get_uni_name_from_ext_entry(sb, &dir, dentry, + uni_name.name); nls_uniname_to_cstring(sb, dir_entry->Name, &uni_name); exfat_buf_unlock(sb, sector); @@ -1957,7 +1954,7 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry) goto out; } - dir_entry->Size = fs_func->get_entry_size(ep); + dir_entry->Size = exfat_get_entry_size(ep); /* hint information */ if (dir.dir == CLUSTER_32(0)) { /* FAT16 root_dir */ @@ -2047,13 +2044,13 @@ static int ffsRemoveDir(struct inode *inode, struct file_id_t *fid) remove_file(inode, &dir, dentry); /* (2) free the clusters */ - p_fs->fs_func->free_cluster(sb, &clu_to_free, 1); + exfat_free_cluster(sb, &clu_to_free, 1); fid->size = 0; fid->start_clu = CLUSTER_32(~0); fid->flags = (p_fs->vol_type == EXFAT) ? 0x03 : 0x01; -#ifndef CONFIG_EXFAT_DELAYED_SYNC +#ifndef CONFIG_STAGING_EXFAT_DELAYED_SYNC fs_sync(sb, true); fs_set_vol_flags(sb, VOL_CLEAN); #endif @@ -2176,14 +2173,14 @@ static long exfat_generic_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { struct inode *inode = filp->f_path.dentry->d_inode; -#ifdef CONFIG_EXFAT_KERNEL_DEBUG +#ifdef CONFIG_STAGING_EXFAT_KERNEL_DEBUG unsigned int flags; -#endif /* CONFIG_EXFAT_KERNEL_DEBUG */ +#endif /* CONFIG_STAGING_EXFAT_KERNEL_DEBUG */ switch (cmd) { case EXFAT_IOCTL_GET_VOLUME_ID: return exfat_ioctl_volume_id(inode); -#ifdef CONFIG_EXFAT_KERNEL_DEBUG +#ifdef CONFIG_STAGING_EXFAT_KERNEL_DEBUG case EXFAT_IOC_GET_DEBUGFLAGS: { struct super_block *sb = inode->i_sb; struct exfat_sb_info *sbi = EXFAT_SB(sb); @@ -2207,7 +2204,7 @@ static long exfat_generic_ioctl(struct file *filp, unsigned int cmd, return 0; } -#endif /* CONFIG_EXFAT_KERNEL_DEBUG */ +#endif /* CONFIG_STAGING_EXFAT_KERNEL_DEBUG */ default: return -ENOTTY; /* Inappropriate ioctl for device */ } @@ -3400,7 +3397,7 @@ static int exfat_show_options(struct seq_file *m, struct dentry *root) seq_puts(m, ",errors=panic"); else seq_puts(m, ",errors=remount-ro"); -#ifdef CONFIG_EXFAT_DISCARD +#ifdef CONFIG_STAGING_EXFAT_DISCARD if (opts->discard) seq_puts(m, ",discard"); #endif @@ -3481,7 +3478,7 @@ enum { Opt_err_ro, Opt_utf8_hack, Opt_err, -#ifdef CONFIG_EXFAT_DISCARD +#ifdef CONFIG_STAGING_EXFAT_DISCARD Opt_discard, #endif /* EXFAT_CONFIG_DISCARD */ }; @@ -3501,9 +3498,9 @@ static const match_table_t exfat_tokens = { {Opt_err_panic, "errors=panic"}, {Opt_err_ro, "errors=remount-ro"}, {Opt_utf8_hack, "utf8"}, -#ifdef CONFIG_EXFAT_DISCARD +#ifdef CONFIG_STAGING_EXFAT_DISCARD {Opt_discard, "discard"}, -#endif /* CONFIG_EXFAT_DISCARD */ +#endif /* CONFIG_STAGING_EXFAT_DISCARD */ {Opt_err, NULL} }; @@ -3524,7 +3521,7 @@ static int parse_options(char *options, int silent, int *debug, opts->iocharset = exfat_default_iocharset; opts->casesensitive = 0; opts->errors = EXFAT_ERRORS_RO; -#ifdef CONFIG_EXFAT_DISCARD +#ifdef CONFIG_STAGING_EXFAT_DISCARD opts->discard = 0; #endif *debug = 0; @@ -3595,11 +3592,11 @@ static int parse_options(char *options, int silent, int *debug, case Opt_debug: *debug = 1; break; -#ifdef CONFIG_EXFAT_DISCARD +#ifdef CONFIG_STAGING_EXFAT_DISCARD case Opt_discard: opts->discard = 1; break; -#endif /* CONFIG_EXFAT_DISCARD */ +#endif /* CONFIG_STAGING_EXFAT_DISCARD */ case Opt_utf8_hack: break; default: @@ -3803,7 +3800,7 @@ static void __exit exfat_destroy_inodecache(void) kmem_cache_destroy(exfat_inode_cachep); } -#ifdef CONFIG_EXFAT_KERNEL_DEBUG +#ifdef CONFIG_STAGING_EXFAT_KERNEL_DEBUG static void exfat_debug_kill_sb(struct super_block *sb) { struct exfat_sb_info *sbi = EXFAT_SB(sb); @@ -3831,17 +3828,17 @@ static void exfat_debug_kill_sb(struct super_block *sb) kill_block_super(sb); } -#endif /* CONFIG_EXFAT_KERNEL_DEBUG */ +#endif /* CONFIG_STAGING_EXFAT_KERNEL_DEBUG */ static struct file_system_type exfat_fs_type = { .owner = THIS_MODULE, .name = "exfat", .mount = exfat_fs_mount, -#ifdef CONFIG_EXFAT_KERNEL_DEBUG +#ifdef CONFIG_STAGING_EXFAT_KERNEL_DEBUG .kill_sb = exfat_debug_kill_sb, #else .kill_sb = kill_block_super, -#endif /* CONFIG_EXFAT_KERNEL_DEBUG */ +#endif /* CONFIG_STAGING_EXFAT_KERNEL_DEBUG */ .fs_flags = FS_REQUIRES_DEV, }; |