Пример #1
0
static int parse_options(char *options, struct super_block *sb)
{
	struct nilfs_sb_info *sbi = NILFS_SB(sb);
	char *p;
	substring_t args[MAX_OPT_ARGS];
	int option;

	if (!options)
		return 1;

	while ((p = strsep(&options, ",")) != NULL) {
		int token;
		if (!*p)
			continue;

		token = match_token(p, tokens, args);
		switch (token) {
		case Opt_barrier:
			if (match_bool(&args[0], &option))
				return 0;
			if (option)
				nilfs_set_opt(sbi, BARRIER);
			else
				nilfs_clear_opt(sbi, BARRIER);
			break;
		case Opt_order:
			if (strcmp(args[0].from, "relaxed") == 0)
				/* Ordered data semantics */
				nilfs_clear_opt(sbi, STRICT_ORDER);
			else if (strcmp(args[0].from, "strict") == 0)
				/* Strict in-order semantics */
				nilfs_set_opt(sbi, STRICT_ORDER);
			else
				return 0;
			break;
		case Opt_err_panic:
			nilfs_write_opt(sbi, ERROR_MODE, ERRORS_PANIC);
			break;
		case Opt_err_ro:
			nilfs_write_opt(sbi, ERROR_MODE, ERRORS_RO);
			break;
		case Opt_err_cont:
			nilfs_write_opt(sbi, ERROR_MODE, ERRORS_CONT);
			break;
		case Opt_snapshot:
			if (match_int(&args[0], &option) || option <= 0)
				return 0;
			if (!(sb->s_flags & MS_RDONLY))
				return 0;
			sbi->s_snapshot_cno = option;
			nilfs_set_opt(sbi, SNAPSHOT);
			break;
		default:
			printk(KERN_ERR
			       "NILFS: Unrecognized mount option \"%s\"\n", p);
			return 0;
		}
	}
	return 1;
}
Пример #2
0
static int parse_options(char *options, struct super_block *sb, int is_remount)
{
	struct nilfs_sb_info *sbi = NILFS_SB(sb);
	char *p;
	substring_t args[MAX_OPT_ARGS];

	if (!options)
		return 1;

	while ((p = strsep(&options, ",")) != NULL) {
		int token;
		if (!*p)
			continue;

		token = match_token(p, tokens, args);
		switch (token) {
		case Opt_barrier:
			nilfs_set_opt(sbi, BARRIER);
			break;
		case Opt_nobarrier:
			nilfs_clear_opt(sbi, BARRIER);
			break;
		case Opt_order:
			if (strcmp(args[0].from, "relaxed") == 0)
				/* Ordered data semantics */
				nilfs_clear_opt(sbi, STRICT_ORDER);
			else if (strcmp(args[0].from, "strict") == 0)
				/* Strict in-order semantics */
				nilfs_set_opt(sbi, STRICT_ORDER);
			else
				return 0;
			break;
		case Opt_err_panic:
			nilfs_write_opt(sbi, ERROR_MODE, ERRORS_PANIC);
			break;
		case Opt_err_ro:
			nilfs_write_opt(sbi, ERROR_MODE, ERRORS_RO);
			break;
		case Opt_err_cont:
			nilfs_write_opt(sbi, ERROR_MODE, ERRORS_CONT);
			break;
		case Opt_snapshot:
			if (is_remount) {
				printk(KERN_ERR
				       "NILFS: \"%s\" option is invalid "
				       "for remount.\n", p);
				return 0;
			}
			break;
		case Opt_norecovery:
			nilfs_set_opt(sbi, NORECOVERY);
			break;
		case Opt_discard:
			nilfs_set_opt(sbi, DISCARD);
			break;
		case Opt_nodiscard:
			nilfs_clear_opt(sbi, DISCARD);
			break;
		default:
			printk(KERN_ERR
			       "NILFS: Unrecognized mount option \"%s\"\n", p);
			return 0;
		}
	}
	return 1;
}
Пример #3
0
static int parse_options(char *options, struct super_block *sb, int is_remount)
{
    struct nilfs_sb_info *sbi = NILFS_SB(sb);
    char *p;
    substring_t args[MAX_OPT_ARGS];
    int option;

    if (!options)
        return 1;

    while ((p = strsep(&options, ",")) != NULL) {
        int token;
        if (!*p)
            continue;

        token = match_token(p, tokens, args);
        switch (token) {
        case Opt_barrier:
            nilfs_set_opt(sbi, BARRIER);
            break;
        case Opt_nobarrier:
            nilfs_clear_opt(sbi, BARRIER);
            break;
        case Opt_order:
            if (strcmp(args[0].from, "relaxed") == 0)
                /* Ordered data semantics */
                nilfs_clear_opt(sbi, STRICT_ORDER);
            else if (strcmp(args[0].from, "strict") == 0)
                /* Strict in-order semantics */
                nilfs_set_opt(sbi, STRICT_ORDER);
            else
                return 0;
            break;
        case Opt_err_panic:
            nilfs_write_opt(sbi, ERROR_MODE, ERRORS_PANIC);
            break;
        case Opt_err_ro:
            nilfs_write_opt(sbi, ERROR_MODE, ERRORS_RO);
            break;
        case Opt_err_cont:
            nilfs_write_opt(sbi, ERROR_MODE, ERRORS_CONT);
            break;
        case Opt_snapshot:
            if (match_int(&args[0], &option) || option <= 0)
                return 0;
            if (is_remount) {
                if (!nilfs_test_opt(sbi, SNAPSHOT)) {
                    printk(KERN_ERR
                           "NILFS: cannot change regular "
                           "mount to snapshot.\n");
                    return 0;
                } else if (option != sbi->s_snapshot_cno) {
                    printk(KERN_ERR
                           "NILFS: cannot remount to a "
                           "different snapshot.\n");
                    return 0;
                }
                break;
            }
            if (!(sb->s_flags & MS_RDONLY)) {
                printk(KERN_ERR "NILFS: cannot mount snapshot "
                       "read/write.  A read-only option is "
                       "required.\n");
                return 0;
            }
            sbi->s_snapshot_cno = option;
            nilfs_set_opt(sbi, SNAPSHOT);
            break;
        case Opt_norecovery:
            nilfs_set_opt(sbi, NORECOVERY);
            break;
        case Opt_discard:
            nilfs_set_opt(sbi, DISCARD);
            break;
        case Opt_nodiscard:
            nilfs_clear_opt(sbi, DISCARD);
            break;
        default:
            printk(KERN_ERR
                   "NILFS: Unrecognized mount option \"%s\"\n", p);
            return 0;
        }
    }
    return 1;
}