Skip to content

Commit 634440b

Browse files
Eric Sandeenbrauner
authored andcommitted
fat: Convert to new mount api
vfat and msdos share a common set of options, with additional, unique options for each filesystem. Each filesystem calls common fc initialization and parsing routines, with an "is_vfat" parameter. For parsing, if the option is not found in the common parameter_spec, parsing is retried with the fs-specific parameter_spec. This patch leaves nls loading to fill_super, so the codepage and charset options are not validated as they are requested. This matches current behavior. It would be possible to test-load as each option is parsed, but that would make i.e. mount -o "iocharset=nope,iocharset=iso8859-1" fail, where it does not fail today because only the last iocharset option is considered. The obsolete "conv=" option is set up with an enum of acceptable values; currently invalid "conv=" options are rejected as such, even though the option is obsolete, so this patch preserves that behavior. Signed-off-by: Eric Sandeen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: OGAWA Hirofumi <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 206d3d8 commit 634440b

File tree

4 files changed

+419
-355
lines changed

4 files changed

+419
-355
lines changed

fs/fat/fat.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include <linux/hash.h>
88
#include <linux/ratelimit.h>
99
#include <linux/msdos_fs.h>
10+
#include <linux/fs_context.h>
11+
#include <linux/fs_parser.h>
1012

1113
/*
1214
* vfat shortname flags
@@ -416,12 +418,21 @@ extern struct inode *fat_iget(struct super_block *sb, loff_t i_pos);
416418
extern struct inode *fat_build_inode(struct super_block *sb,
417419
struct msdos_dir_entry *de, loff_t i_pos);
418420
extern int fat_sync_inode(struct inode *inode);
419-
extern int fat_fill_super(struct super_block *sb, void *data, int silent,
420-
int isvfat, void (*setup)(struct super_block *));
421+
extern int fat_fill_super(struct super_block *sb, struct fs_context *fc,
422+
void (*setup)(struct super_block *));
421423
extern int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de);
422424

423425
extern int fat_flush_inodes(struct super_block *sb, struct inode *i1,
424426
struct inode *i2);
427+
428+
extern const struct fs_parameter_spec fat_param_spec[];
429+
int fat_init_fs_context(struct fs_context *fc, bool is_vfat);
430+
void fat_free_fc(struct fs_context *fc);
431+
432+
int fat_parse_param(struct fs_context *fc, struct fs_parameter *param,
433+
bool is_vfat);
434+
int fat_reconfigure(struct fs_context *fc);
435+
425436
static inline unsigned long fat_dir_hash(int logstart)
426437
{
427438
return hash_32(logstart, FAT_HASH_BITS);

0 commit comments

Comments
 (0)