static int parse_options(char *options, befs_mount_options * opts) { char *p; substring_t args[MAX_OPT_ARGS]; int option; /* Initialize options */ opts->uid = 0; opts->gid = 0; opts->use_uid = 0; opts->use_gid = 0; opts->iocharset = NULL; opts->debug = 0; if (!options) return 1; while ((p = strsep(&options, ",")) != NULL) { int token; if (!*p) continue; token = match_token(p, befs_tokens, args); switch (token) { case Opt_uid: if (match_int(&args[0], &option)) return 0; if (option < 0) { printk(KERN_ERR "BeFS: Invalid uid %d, " "using default\n", option); break; } opts->uid = option; opts->use_uid = 1; break; case Opt_gid: if (match_int(&args[0], &option)) return 0; if (option < 0) { printk(KERN_ERR "BeFS: Invalid gid %d, " "using default\n", option); break; } opts->gid = option; opts->use_gid = 1; break; case Opt_charset: kfree(opts->iocharset); opts->iocharset = match_strdup(&args[0]); if (!opts->iocharset) { printk(KERN_ERR "BeFS: allocation failure for " "iocharset string\n"); return 0; } break; case Opt_debug: opts->debug = 1; break; default: printk(KERN_ERR "BeFS: Unrecognized mount option \"%s\" " "or missing value\n", p); return 0; } } return 1; }
static int parse_options(struct super_block *sb, char *options) { struct f2fs_sb_info *sbi = F2FS_SB(sb); substring_t args[MAX_OPT_ARGS]; char *p, *name; int arg = 0; if (!options) return 0; while ((p = strsep(&options, ",")) != NULL) { int token; if (!*p) continue; /* * Initialize args struct so we know whether arg was * found; some options take optional arguments. */ args[0].to = args[0].from = NULL; token = match_token(p, f2fs_tokens, args); switch (token) { case Opt_gc_background: name = match_strdup(&args[0]); if (!name) return -ENOMEM; if (strlen(name) == 2 && !strncmp(name, "on", 2)) set_opt(sbi, BG_GC); else if (strlen(name) == 3 && !strncmp(name, "off", 3)) clear_opt(sbi, BG_GC); else { kfree(name); return -EINVAL; } kfree(name); break; case Opt_disable_roll_forward: set_opt(sbi, DISABLE_ROLL_FORWARD); break; case Opt_norecovery: /* this option mounts f2fs with ro */ set_opt(sbi, DISABLE_ROLL_FORWARD); if (!f2fs_readonly(sb)) return -EINVAL; break; case Opt_discard: set_opt(sbi, DISCARD); break; case Opt_noheap: set_opt(sbi, NOHEAP); break; #ifdef CONFIG_F2FS_FS_XATTR case Opt_user_xattr: set_opt(sbi, XATTR_USER); break; case Opt_nouser_xattr: clear_opt(sbi, XATTR_USER); break; case Opt_inline_xattr: set_opt(sbi, INLINE_XATTR); break; #else case Opt_user_xattr: f2fs_msg(sb, KERN_INFO, "user_xattr options not supported"); break; case Opt_nouser_xattr: f2fs_msg(sb, KERN_INFO, "nouser_xattr options not supported"); break; case Opt_inline_xattr: f2fs_msg(sb, KERN_INFO, "inline_xattr options not supported"); break; #endif #ifdef CONFIG_F2FS_FS_POSIX_ACL case Opt_acl: set_opt(sbi, POSIX_ACL); break; case Opt_noacl: clear_opt(sbi, POSIX_ACL); break; #else case Opt_acl: f2fs_msg(sb, KERN_INFO, "acl options not supported"); break; case Opt_noacl: f2fs_msg(sb, KERN_INFO, "noacl options not supported"); break; #endif case Opt_active_logs: if (args->from && match_int(args, &arg)) return -EINVAL; if (arg != 2 && arg != 4 && arg != NR_CURSEG_TYPE) return -EINVAL; sbi->active_logs = arg; break; case Opt_disable_ext_identify: set_opt(sbi, DISABLE_EXT_IDENTIFY); break; case Opt_inline_data: set_opt(sbi, INLINE_DATA); break; case Opt_inline_dentry: set_opt(sbi, INLINE_DENTRY); break; case Opt_flush_merge: set_opt(sbi, FLUSH_MERGE); break; case Opt_nobarrier: set_opt(sbi, NOBARRIER); break; case Opt_fastboot: set_opt(sbi, FASTBOOT); break; case Opt_extent_cache: set_opt(sbi, EXTENT_CACHE); break; case Opt_noinline_data: clear_opt(sbi, INLINE_DATA); break; default: f2fs_msg(sb, KERN_ERR, "Unrecognized mount option \"%s\" or missing value", p); return -EINVAL; } } return 0; }
static int jffs2_parse_options(struct jffs2_sb_info *c, char *data) { substring_t args[MAX_OPT_ARGS]; char *p, *name; unsigned int opt; if (!data) return 0; while ((p = strsep(&data, ","))) { int token; if (!*p) continue; token = match_token(p, tokens, args); switch (token) { case Opt_override_compr: name = match_strdup(&args[0]); if (!name) return -ENOMEM; if (!strcmp(name, "none")) c->mount_opts.compr = JFFS2_COMPR_MODE_NONE; #ifdef CONFIG_JFFS2_LZO else if (!strcmp(name, "lzo")) c->mount_opts.compr = JFFS2_COMPR_MODE_FORCELZO; #endif #ifdef CONFIG_JFFS2_ZLIB else if (!strcmp(name, "zlib")) c->mount_opts.compr = JFFS2_COMPR_MODE_FORCEZLIB; #endif else { pr_err("Error: unknown compressor \"%s\"\n", name); kfree(name); return -EINVAL; } kfree(name); c->mount_opts.override_compr = true; break; case Opt_rp_size: if (match_int(&args[0], &opt)) return -EINVAL; opt *= 1024; if (opt > c->mtd->size) { pr_warn("Too large reserve pool specified, max " "is %llu KB\n", c->mtd->size / 1024); return -EINVAL; } c->mount_opts.rp_size = opt; break; default: pr_err("Error: unrecognized mount option '%s' or missing value\n", p); return -EINVAL; } } return 0; }
static int parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s32 *root, int *blocksize, char **prefix, char *volume, unsigned long *mount_opts) { char *p; substring_t args[MAX_OPT_ARGS]; /* Fill in defaults */ *uid = current->uid; *gid = current->gid; *reserved = 2; *root = -1; *blocksize = -1; volume[0] = ':'; volume[1] = 0; *mount_opts = 0; if (!options) return 1; while ((p = strsep(&options, ",")) != NULL) { int token, n, option; if (!*p) continue; token = match_token(p, tokens, args); switch (token) { case Opt_bs: if (match_int(&args[0], &n)) return -EINVAL; if (n != 512 && n != 1024 && n != 2048 && n != 4096) { printk ("AFFS: Invalid blocksize (512, 1024, 2048, 4096 allowed)\n"); return 0; } *blocksize = n; break; case Opt_mode: if (match_octal(&args[0], &option)) return 1; *mode = option & 0777; *mount_opts |= SF_SETMODE; break; case Opt_mufs: *mount_opts |= SF_MUFS; break; case Opt_prefix: if (*prefix) { /* Free any previous prefix */ kfree(*prefix); *prefix = NULL; } *prefix = match_strdup(&args[0]); if (!*prefix) return 0; *mount_opts |= SF_PREFIX; break; case Opt_protect: *mount_opts |= SF_IMMUTABLE; break; case Opt_reserved: if (match_int(&args[0], reserved)) return 1; break; case Opt_root: if (match_int(&args[0], root)) return 1; break; case Opt_setgid: if (match_int(&args[0], &option)) return 1; *gid = option; *mount_opts |= SF_SETGID; break; case Opt_setuid: if (match_int(&args[0], &option)) return -EINVAL; *uid = option; *mount_opts |= SF_SETUID; break; case Opt_verbose: *mount_opts |= SF_VERBOSE; break; case Opt_volume: { char *vol = match_strdup(&args[0]); strlcpy(volume, vol, 32); kfree(vol); break; } case Opt_ignore: /* Silently ignore the quota options */ break; default: printk("AFFS: Unrecognized mount option \"%s\" " "or missing value\n", p); return 0; } } return 1; }
static int parse_options(struct super_block *sb, char *options, int silent, int *debug, struct sdcardfs_mount_options *opts) { char *p; substring_t args[MAX_OPT_ARGS]; int option; char *string_option; /* by default, we use AID_MEDIA_RW as uid, gid */ opts->fs_low_uid = AID_MEDIA_RW; opts->fs_low_gid = AID_MEDIA_RW; /* by default, we use AID_SDCARD_RW as write_gid */ opts->write_gid = AID_SDCARD_RW; /* default permission policy * (DERIVE_NONE | DERIVE_LEGACY | DERIVE_UNIFIED) */ opts->derive = DERIVE_NONE; opts->split_perms = 0; /* by default, we use LOWER_FS_EXT4 as lower fs type */ opts->lower_fs = LOWER_FS_EXT4; /* by default, 0MB is reserved */ opts->reserved_mb = 0; *debug = 0; if (!options) return 0; while ((p = strsep(&options, ",")) != NULL) { int token; if (!*p) continue; token = match_token(p, sdcardfs_tokens, args); switch (token) { case Opt_debug: *debug = 1; break; case Opt_uid: if (match_int(&args[0], &option)) return 0; opts->fs_low_uid = option; break; case Opt_gid: if (match_int(&args[0], &option)) return 0; opts->fs_low_gid = option; break; case Opt_wgid: if (match_int(&args[0], &option)) return 0; opts->write_gid = option; break; case Opt_split: opts->split_perms=1; break; case Opt_derive: string_option = match_strdup(&args[0]); if (!string_option) return -ENOMEM; if (!strcmp("none", string_option)) { opts->derive = DERIVE_NONE; } else if (!strcmp("legacy", string_option)) { opts->derive = DERIVE_LEGACY; } else if (!strcmp("unified", string_option)) { opts->derive = DERIVE_UNIFIED; } else { kfree(string_option); goto invalid_option; } kfree(string_option); break; case Opt_lower_fs: string_option = match_strdup(&args[0]); if (!string_option) return -ENOMEM; if (!strcmp("ext4", string_option)) { opts->lower_fs = LOWER_FS_EXT4; } else if (!strcmp("fat", string_option)) { opts->lower_fs = LOWER_FS_FAT; } else { kfree(string_option); goto invalid_option; } kfree(string_option); break; case Opt_reserved_mb: if (match_int(&args[0], &option)) return 0; opts->reserved_mb = option; break; /* unknown option */ default: invalid_option: if (!silent) { printk( KERN_ERR "Unrecognized mount option \"%s\" " "or missing value", p); } return -EINVAL; } } if (*debug) { printk( KERN_INFO "sdcardfs : options - debug:%d\n", *debug); printk( KERN_INFO "sdcardfs : options - uid:%d\n", opts->fs_low_uid); printk( KERN_INFO "sdcardfs : options - gid:%d\n", opts->fs_low_gid); } return 0; }
/* * parse_options() * * adapted from linux/fs/msdos/inode.c written 1992,93 by Werner Almesberger * This function is called by hfs_read_super() to parse the mount options. */ static int parse_options(char *options, struct hfs_sb_info *hsb) { char *p; substring_t args[MAX_OPT_ARGS]; int tmp, token; hsb->s_uid = current_uid(); hsb->s_gid = current_gid(); hsb->s_file_umask = 0133; hsb->s_dir_umask = 0022; hsb->s_type = hsb->s_creator = cpu_to_be32(0x3f3f3f3f); hsb->s_quiet = 0; hsb->part = -1; hsb->session = -1; if (!options) return 1; while ((p = strsep(&options, ",")) != NULL) { if (!*p) continue; token = match_token(p, tokens, args); switch (token) { case opt_uid: if (match_int(&args[0], &tmp)) { printk(KERN_ERR "hfs: uid requires an argument\n"); return 0; } hsb->s_uid = (uid_t)tmp; break; case opt_gid: if (match_int(&args[0], &tmp)) { printk(KERN_ERR "hfs: gid requires an argument\n"); return 0; } hsb->s_gid = (gid_t)tmp; break; case opt_umask: if (match_octal(&args[0], &tmp)) { printk(KERN_ERR "hfs: umask requires a value\n"); return 0; } hsb->s_file_umask = (umode_t)tmp; hsb->s_dir_umask = (umode_t)tmp; break; case opt_file_umask: if (match_octal(&args[0], &tmp)) { printk(KERN_ERR "hfs: file_umask requires a value\n"); return 0; } hsb->s_file_umask = (umode_t)tmp; break; case opt_dir_umask: if (match_octal(&args[0], &tmp)) { printk(KERN_ERR "hfs: dir_umask requires a value\n"); return 0; } hsb->s_dir_umask = (umode_t)tmp; break; case opt_part: if (match_int(&args[0], &hsb->part)) { printk(KERN_ERR "hfs: part requires an argument\n"); return 0; } break; case opt_session: if (match_int(&args[0], &hsb->session)) { printk(KERN_ERR "hfs: session requires an argument\n"); return 0; } break; case opt_type: if (match_fourchar(&args[0], &hsb->s_type)) { printk(KERN_ERR "hfs: type requires a 4 character value\n"); return 0; } break; case opt_creator: if (match_fourchar(&args[0], &hsb->s_creator)) { printk(KERN_ERR "hfs: creator requires a 4 character value\n"); return 0; } break; case opt_quiet: hsb->s_quiet = 1; break; case opt_codepage: if (hsb->nls_disk) { printk(KERN_ERR "hfs: unable to change codepage\n"); return 0; } p = match_strdup(&args[0]); if (p) hsb->nls_disk = load_nls(p); if (!hsb->nls_disk) { printk(KERN_ERR "hfs: unable to load codepage \"%s\"\n", p); kfree(p); return 0; } kfree(p); break; case opt_iocharset: if (hsb->nls_io) { printk(KERN_ERR "hfs: unable to change iocharset\n"); return 0; } p = match_strdup(&args[0]); if (p) hsb->nls_io = load_nls(p); if (!hsb->nls_io) { printk(KERN_ERR "hfs: unable to load iocharset \"%s\"\n", p); kfree(p); return 0; } kfree(p); break; default: return 0; } } if (hsb->nls_disk && !hsb->nls_io) { hsb->nls_io = load_nls_default(); if (!hsb->nls_io) { printk(KERN_ERR "hfs: unable to load default iocharset\n"); return 0; } } hsb->s_dir_umask &= 0777; hsb->s_file_umask &= 0577; return 1; }
int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi) { char *p; substring_t args[MAX_OPT_ARGS]; int tmp, token; if (!input) goto done; while ((p = strsep(&input, ",")) != NULL) { if (!*p) continue; token = match_token(p, tokens, args); switch (token) { case opt_creator: if (match_fourchar(&args[0], &sbi->creator)) { printk(KERN_ERR "hfs: creator requires a 4 character value\n"); return 0; } break; case opt_type: if (match_fourchar(&args[0], &sbi->type)) { printk(KERN_ERR "hfs: type requires a 4 character value\n"); return 0; } break; case opt_umask: if (match_octal(&args[0], &tmp)) { printk(KERN_ERR "hfs: umask requires a value\n"); return 0; } sbi->umask = (umode_t)tmp; break; case opt_uid: if (match_int(&args[0], &tmp)) { printk(KERN_ERR "hfs: uid requires an argument\n"); return 0; } sbi->uid = (uid_t)tmp; break; case opt_gid: if (match_int(&args[0], &tmp)) { printk(KERN_ERR "hfs: gid requires an argument\n"); return 0; } sbi->gid = (gid_t)tmp; break; case opt_part: if (match_int(&args[0], &sbi->part)) { printk(KERN_ERR "hfs: part requires an argument\n"); return 0; } break; case opt_session: if (match_int(&args[0], &sbi->session)) { printk(KERN_ERR "hfs: session requires an argument\n"); return 0; } break; case opt_nls: if (sbi->nls) { printk(KERN_ERR "hfs: unable to change nls mapping\n"); return 0; } p = match_strdup(&args[0]); if (p) sbi->nls = load_nls(p); if (!sbi->nls) { printk(KERN_ERR "hfs: unable to load " "nls mapping \"%s\"\n", p); kfree(p); return 0; } kfree(p); break; case opt_decompose: clear_bit(HFSPLUS_SB_NODECOMPOSE, &sbi->flags); break; case opt_nodecompose: set_bit(HFSPLUS_SB_NODECOMPOSE, &sbi->flags); break; case opt_barrier: clear_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags); break; case opt_nobarrier: set_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags); break; case opt_force: set_bit(HFSPLUS_SB_FORCE, &sbi->flags); break; default: return 0; } } done: if (!sbi->nls) { /* */ sbi->nls = load_nls("utf8"); if (!sbi->nls) sbi->nls = load_nls_default(); if (!sbi->nls) return 0; } return 1; }
static ssize_t iblock_set_configfs_dev_params(struct se_device *dev, const char *page, ssize_t count) { struct iblock_dev *ib_dev = IBLOCK_DEV(dev); char *orig, *ptr, *arg_p, *opts; substring_t args[MAX_OPT_ARGS]; int ret = 0, token; unsigned long tmp_readonly; opts = kstrdup(page, GFP_KERNEL); if (!opts) return -ENOMEM; orig = opts; while ((ptr = strsep(&opts, ",\n")) != NULL) { if (!*ptr) continue; token = match_token(ptr, tokens, args); switch (token) { case Opt_udev_path: if (ib_dev->ibd_bd) { pr_err("Unable to set udev_path= while" " ib_dev->ibd_bd exists\n"); ret = -EEXIST; goto out; } if (match_strlcpy(ib_dev->ibd_udev_path, &args[0], SE_UDEV_PATH_LEN) == 0) { ret = -EINVAL; break; } pr_debug("IBLOCK: Referencing UDEV path: %s\n", ib_dev->ibd_udev_path); ib_dev->ibd_flags |= IBDF_HAS_UDEV_PATH; break; case Opt_readonly: arg_p = match_strdup(&args[0]); if (!arg_p) { ret = -ENOMEM; break; } ret = strict_strtoul(arg_p, 0, &tmp_readonly); kfree(arg_p); if (ret < 0) { pr_err("strict_strtoul() failed for" " readonly=\n"); goto out; } ib_dev->ibd_readonly = tmp_readonly; pr_debug("IBLOCK: readonly: %d\n", ib_dev->ibd_readonly); break; case Opt_force: break; default: break; } } out: kfree(orig); return (!ret) ? count : ret; }
static int parse_options(struct super_block *sb, char *options) { struct esdfs_sb_info *sbi = ESDFS_SB(sb); substring_t args[MAX_OPT_ARGS]; char *p; if (!options) return 0; while ((p = strsep(&options, ",")) != NULL) { int token; if (!*p) continue; /* * Initialize args struct so we know whether arg was * found; some options take optional arguments. */ args[0].to = args[0].from = NULL; token = match_token(p, esdfs_tokens, args); switch (token) { case Opt_lower_perms: if (args->from) { int ret; char *perms = match_strdup(args); ret = parse_perms(&sbi->lower_perms, perms); kfree(perms); if (ret) return -EINVAL; } else return -EINVAL; break; case Opt_upper_perms: if (args->from) { int ret; char *perms = match_strdup(args); ret = parse_perms(&sbi->upper_perms, perms); kfree(perms); if (ret) return -EINVAL; } else return -EINVAL; break; case Opt_derive_none: clear_opt(sbi, DERIVE_LEGACY); clear_opt(sbi, DERIVE_UNIFIED); break; case Opt_derive_legacy: set_opt(sbi, DERIVE_LEGACY); clear_opt(sbi, DERIVE_UNIFIED); break; case Opt_derive_unified: clear_opt(sbi, DERIVE_LEGACY); set_opt(sbi, DERIVE_UNIFIED); break; case Opt_split: set_opt(sbi, DERIVE_SPLIT); break; case Opt_nosplit: clear_opt(sbi, DERIVE_SPLIT); break; default: esdfs_msg(sb, KERN_ERR, "unrecognized mount option \"%s\" or missing value\n", p); return -EINVAL; } } return 0; }
static int parse_options(char *options, struct befs_mount_options *opts) { char *p; substring_t args[MAX_OPT_ARGS]; int option; kuid_t uid; kgid_t gid; /* Initialize options */ opts->uid = GLOBAL_ROOT_UID; opts->gid = GLOBAL_ROOT_GID; opts->use_uid = 0; opts->use_gid = 0; opts->iocharset = NULL; opts->debug = 0; if (!options) return 1; while ((p = strsep(&options, ",")) != NULL) { int token; if (!*p) continue; token = match_token(p, befs_tokens, args); switch (token) { case Opt_uid: if (match_int(&args[0], &option)) return 0; uid = INVALID_UID; if (option >= 0) uid = make_kuid(current_user_ns(), option); if (!uid_valid(uid)) { pr_err("Invalid uid %d, " "using default\n", option); break; } opts->uid = uid; opts->use_uid = 1; break; case Opt_gid: if (match_int(&args[0], &option)) return 0; gid = INVALID_GID; if (option >= 0) gid = make_kgid(current_user_ns(), option); if (!gid_valid(gid)) { pr_err("Invalid gid %d, " "using default\n", option); break; } opts->gid = gid; opts->use_gid = 1; break; case Opt_charset: kfree(opts->iocharset); opts->iocharset = match_strdup(&args[0]); if (!opts->iocharset) { pr_err("allocation failure for " "iocharset string\n"); return 0; } break; case Opt_debug: opts->debug = 1; break; default: pr_err("Unrecognized mount option \"%s\" " "or missing value\n", p); return 0; } } return 1; }
/* * This function fills in xfs_mount_t fields based on mount args. * Note: the superblock has _not_ yet been read in. * * Note that this function leaks the various device name allocations on * failure. The caller takes care of them. * * *sb is const because this is also used to test options on the remount * path, and we don't want this to have any side effects at remount time. * Today this function does not change *sb, but just to future-proof... */ STATIC int xfs_parseargs( struct xfs_mount *mp, char *options) { const struct super_block *sb = mp->m_super; char *p; substring_t args[MAX_OPT_ARGS]; int dsunit = 0; int dswidth = 0; int iosize = 0; __uint8_t iosizelog = 0; /* * set up the mount name first so all the errors will refer to the * correct device. */ mp->m_fsname = kstrndup(sb->s_id, MAXNAMELEN, GFP_KERNEL); if (!mp->m_fsname) return -ENOMEM; mp->m_fsname_len = strlen(mp->m_fsname) + 1; /* * Copy binary VFS mount flags we are interested in. */ if (sb->s_flags & MS_RDONLY) mp->m_flags |= XFS_MOUNT_RDONLY; if (sb->s_flags & MS_DIRSYNC) mp->m_flags |= XFS_MOUNT_DIRSYNC; if (sb->s_flags & MS_SYNCHRONOUS) mp->m_flags |= XFS_MOUNT_WSYNC; /* * Set some default flags that could be cleared by the mount option * parsing. */ mp->m_flags |= XFS_MOUNT_BARRIER; mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE; /* * These can be overridden by the mount option parsing. */ mp->m_logbufs = -1; mp->m_logbsize = -1; if (!options) goto done; while ((p = strsep(&options, ",")) != NULL) { int token; if (!*p) continue; token = match_token(p, tokens, args); switch (token) { case Opt_logbufs: if (match_int(args, &mp->m_logbufs)) return -EINVAL; break; case Opt_logbsize: if (suffix_kstrtoint(args, 10, &mp->m_logbsize)) return -EINVAL; break; case Opt_logdev: mp->m_logname = match_strdup(args); if (!mp->m_logname) return -ENOMEM; break; case Opt_mtpt: xfs_warn(mp, "%s option not allowed on this system", p); return -EINVAL; case Opt_rtdev: mp->m_rtname = match_strdup(args); if (!mp->m_rtname) return -ENOMEM; break; case Opt_allocsize: case Opt_biosize: if (suffix_kstrtoint(args, 10, &iosize)) return -EINVAL; iosizelog = ffs(iosize) - 1; break; case Opt_grpid: case Opt_bsdgroups: mp->m_flags |= XFS_MOUNT_GRPID; break; case Opt_nogrpid: case Opt_sysvgroups: mp->m_flags &= ~XFS_MOUNT_GRPID; break; case Opt_wsync: mp->m_flags |= XFS_MOUNT_WSYNC; break; case Opt_norecovery: mp->m_flags |= XFS_MOUNT_NORECOVERY; break; case Opt_noalign: mp->m_flags |= XFS_MOUNT_NOALIGN; break; case Opt_swalloc: mp->m_flags |= XFS_MOUNT_SWALLOC; break; case Opt_sunit: if (match_int(args, &dsunit)) return -EINVAL; break; case Opt_swidth: if (match_int(args, &dswidth)) return -EINVAL; break; case Opt_inode32: mp->m_flags |= XFS_MOUNT_SMALL_INUMS; break; case Opt_inode64: mp->m_flags &= ~XFS_MOUNT_SMALL_INUMS; break; case Opt_nouuid: mp->m_flags |= XFS_MOUNT_NOUUID; break; case Opt_barrier: mp->m_flags |= XFS_MOUNT_BARRIER; break; case Opt_nobarrier: mp->m_flags &= ~XFS_MOUNT_BARRIER; break; case Opt_ikeep: mp->m_flags |= XFS_MOUNT_IKEEP; break; case Opt_noikeep: mp->m_flags &= ~XFS_MOUNT_IKEEP; break; case Opt_largeio: mp->m_flags &= ~XFS_MOUNT_COMPAT_IOSIZE; break; case Opt_nolargeio: mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE; break; case Opt_attr2: mp->m_flags |= XFS_MOUNT_ATTR2; break; case Opt_noattr2: mp->m_flags &= ~XFS_MOUNT_ATTR2; mp->m_flags |= XFS_MOUNT_NOATTR2; break; case Opt_filestreams: mp->m_flags |= XFS_MOUNT_FILESTREAMS; break; case Opt_noquota: mp->m_qflags &= ~XFS_ALL_QUOTA_ACCT; mp->m_qflags &= ~XFS_ALL_QUOTA_ENFD; mp->m_qflags &= ~XFS_ALL_QUOTA_ACTIVE; break; case Opt_quota: case Opt_uquota: case Opt_usrquota: mp->m_qflags |= (XFS_UQUOTA_ACCT | XFS_UQUOTA_ACTIVE | XFS_UQUOTA_ENFD); break; case Opt_qnoenforce: case Opt_uqnoenforce: mp->m_qflags |= (XFS_UQUOTA_ACCT | XFS_UQUOTA_ACTIVE); mp->m_qflags &= ~XFS_UQUOTA_ENFD; break; case Opt_pquota: case Opt_prjquota: mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE | XFS_PQUOTA_ENFD); break; case Opt_pqnoenforce: mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE); mp->m_qflags &= ~XFS_PQUOTA_ENFD; break; case Opt_gquota: case Opt_grpquota: mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE | XFS_GQUOTA_ENFD); break; case Opt_gqnoenforce: mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE); mp->m_qflags &= ~XFS_GQUOTA_ENFD; break; case Opt_discard: mp->m_flags |= XFS_MOUNT_DISCARD; break; case Opt_nodiscard: mp->m_flags &= ~XFS_MOUNT_DISCARD; break; #ifdef CONFIG_FS_DAX case Opt_dax: mp->m_flags |= XFS_MOUNT_DAX; break; #endif default: xfs_warn(mp, "unknown mount option [%s].", p); return -EINVAL; } } /* * no recovery flag requires a read-only mount */ if ((mp->m_flags & XFS_MOUNT_NORECOVERY) && !(mp->m_flags & XFS_MOUNT_RDONLY)) { xfs_warn(mp, "no-recovery mounts must be read-only."); return -EINVAL; } if ((mp->m_flags & XFS_MOUNT_NOALIGN) && (dsunit || dswidth)) { xfs_warn(mp, "sunit and swidth options incompatible with the noalign option"); return -EINVAL; } #ifndef CONFIG_XFS_QUOTA if (XFS_IS_QUOTA_RUNNING(mp)) { xfs_warn(mp, "quota support not available in this kernel."); return -EINVAL; } #endif if ((dsunit && !dswidth) || (!dsunit && dswidth)) { xfs_warn(mp, "sunit and swidth must be specified together"); return -EINVAL; } if (dsunit && (dswidth % dsunit != 0)) { xfs_warn(mp, "stripe width (%d) must be a multiple of the stripe unit (%d)", dswidth, dsunit); return -EINVAL; } done: if (dsunit && !(mp->m_flags & XFS_MOUNT_NOALIGN)) { /* * At this point the superblock has not been read * in, therefore we do not know the block size. * Before the mount call ends we will convert * these to FSBs. */ mp->m_dalign = dsunit; mp->m_swidth = dswidth; } if (mp->m_logbufs != -1 && mp->m_logbufs != 0 && (mp->m_logbufs < XLOG_MIN_ICLOGS || mp->m_logbufs > XLOG_MAX_ICLOGS)) { xfs_warn(mp, "invalid logbufs value: %d [not %d-%d]", mp->m_logbufs, XLOG_MIN_ICLOGS, XLOG_MAX_ICLOGS); return -EINVAL; } if (mp->m_logbsize != -1 && mp->m_logbsize != 0 && (mp->m_logbsize < XLOG_MIN_RECORD_BSIZE || mp->m_logbsize > XLOG_MAX_RECORD_BSIZE || !is_power_of_2(mp->m_logbsize))) { xfs_warn(mp, "invalid logbufsize: %d [not 16k,32k,64k,128k or 256k]", mp->m_logbsize); return -EINVAL; } if (iosizelog) { if (iosizelog > XFS_MAX_IO_LOG || iosizelog < XFS_MIN_IO_LOG) { xfs_warn(mp, "invalid log iosize: %d [not %d-%d]", iosizelog, XFS_MIN_IO_LOG, XFS_MAX_IO_LOG); return -EINVAL; } mp->m_flags |= XFS_MOUNT_DFLT_IOSIZE; mp->m_readio_log = iosizelog; mp->m_writeio_log = iosizelog; } return 0; }