Beispiel #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;
}
Beispiel #2
0
/*CREATE LIST OF TOKENS*/
void Createlist(char *exp,List infix_l)
{
	char p[MAXNAME];	//store var name
	int cnt;		
	

	while((*exp == ' ' || *exp == '\t')  && *exp!='\0')	//remove spaces
		exp++;
	if(*exp=='\'')				//override check eval symbol.
		exp++;
	
	if(*exp == '\0')
		return;
	while(*exp!='\0')			//read till end of line
	{
		while((*exp == ' ' || *exp == '\t') && *exp!='\0')
                exp++;

		if(match_char(*exp)==0)		//if variable
		{
			exp = Extract_word(exp,p);	
			cnt = Count(infix_l);
			InsertAfter(p,infix_l,cnt);
		}
		else if(match_num(*exp)==0)	//if number
		{
			exp = Extract_num(exp,p);
			cnt = Count(infix_l);
			InsertAfter(p,infix_l,cnt);
			add_value(p,0,p);
		}
		else if(match_bool(*exp)==0)	//if boolean op
		{
			exp = Extract_bool(exp,p);
			cnt = Count(infix_l);
			InsertAfter(p,infix_l,cnt);
		}
		else
		{
			p[0] = *exp;		//else single letter operator
			p[1]='\0';
			cnt = Count(infix_l);
			InsertAfter(p,infix_l,cnt);
			exp++;
		}
	}
}
Beispiel #3
0
char* Extract_bool(char *exp,char p[])		//extract bool operator
{
	int i=0;
	p[i] = *exp;
	exp++;
	i++;

	if(match_bool(*exp)==0)
	{
		p[i]=*exp;
		exp++;
		i++;
	}

	p[i] = '\0';
	return exp;
}
Beispiel #4
0
void json_value() {
	if(look_ahead == '{')
		json_object();
	else if(look_ahead == '[')
		json_array();
	else if(look_ahead == '\"'){
		std::string d = match_str();
		std::cout << "Get Value: " << d <<std::endl;
	}else{
		// number,true, false, null
		if(look_ahead == '\"')
			match_str();
		else if(look_ahead == 't' || look_ahead == 'f'){
			match_bool(look_ahead);
		}else if(look_ahead<='9' && look_ahead >='0'){
			match_digit();
		}else
		;
	}
}