Lines Matching defs:state
211 pr_err("AppArmor DFA state with invalid match flags");
216 pr_err("AppArmor DFA diff encoded transition state without header flag");
226 pr_err("AppArmor DFA out of bad transition state without header flag");
409 #define match_char(state, def, base, next, check, C) \
411 u32 b = (base)[(state)]; \
413 if ((check)[pos] != (state)) { \
414 (state) = (def)[(state)]; \
419 (state) = (next)[pos]; \
424 * aa_dfa_match_len - traverse @dfa to find state @str stops at
426 * @start: the state of the dfa to start matching in
430 * aa_dfa_match_len will match @str against the dfa and return the state it
431 * finished matching in. The final state can be used to look up the accepting
432 * label, or as the start state of a continuing match.
437 * Returns: final state reached after input is consumed
446 unsigned int state = start;
448 if (state == 0)
451 /* current state is <state>, matching character *str */
456 match_char(state, def, base, next, check,
459 /* default is direct to next state */
461 match_char(state, def, base, next, check, (u8) *str++);
464 return state;
468 * aa_dfa_match - traverse @dfa to find state @str stops at
470 * @start: the state of the dfa to start matching in
473 * aa_dfa_match will match @str against the dfa and return the state it
474 * finished matching in. The final state can be used to look up the accepting
475 * label, or as the start state of a continuing match.
477 * Returns: final state reached after input is consumed
486 unsigned int state = start;
488 if (state == 0)
491 /* current state is <state>, matching character *str */
495 /* default is direct to next state */
497 match_char(state, def, base, next, check,
500 /* default is direct to next state */
502 match_char(state, def, base, next, check, (u8) *str++);
505 return state;
509 * aa_dfa_next - step one character to the next state in the dfa
511 * @state: the state to start in
516 * Returns: state reach after input @c
518 unsigned int aa_dfa_next(struct aa_dfa *dfa, unsigned int state,
526 /* current state is <state>, matching character *str */
530 match_char(state, def, base, next, check, equiv[(u8) c]);
532 match_char(state, def, base, next, check, (u8) c);
534 return state;
537 unsigned int aa_dfa_outofband_transition(struct aa_dfa *dfa, unsigned int state)
543 u32 b = (base)[(state)];
549 match_char(state, def, base, next, check, -1);
551 return state;
555 * aa_dfa_match_until - traverse @dfa until accept state or end of input
557 * @start: the state of the dfa to start matching in
561 * aa_dfa_match will match @str against the dfa and return the state it
562 * finished matching in. The final state can be used to look up the accepting
563 * label, or as the start state of a continuing match.
565 * Returns: final state reached after input is consumed
575 unsigned int state = start, pos;
577 if (state == 0)
580 /* current state is <state>, matching character *str */
584 /* default is direct to next state */
586 pos = base_idx(base[state]) + equiv[(u8) *str++];
587 if (check[pos] == state)
588 state = next[pos];
590 state = def[state];
591 if (accept[state])
595 /* default is direct to next state */
597 pos = base_idx(base[state]) + (u8) *str++;
598 if (check[pos] == state)
599 state = next[pos];
601 state = def[state];
602 if (accept[state])
608 return state;
614 * @start: the state of the dfa to start matching in
619 * aa_dfa_match_len will match @str against the dfa and return the state it
620 * finished matching in. The final state can be used to look up the accepting
621 * label, or as the start state of a continuing match.
626 * Returns: final state reached after input is consumed
636 unsigned int state = start, pos;
639 if (state == 0)
642 /* current state is <state>, matching character *str */
646 /* default is direct to next state */
648 pos = base_idx(base[state]) + equiv[(u8) *str++];
649 if (check[pos] == state)
650 state = next[pos];
652 state = def[state];
653 if (accept[state])
657 /* default is direct to next state */
659 pos = base_idx(base[state]) + (u8) *str++;
660 if (check[pos] == state)
661 state = next[pos];
663 state = def[state];
664 if (accept[state])
670 return state;
680 static bool is_loop(struct match_workbuf *wb, unsigned int state,
686 if (wb->history[pos] < state)
690 if (wb->history[pos] == state) {
711 unsigned int state = start, pos;
719 if (state == 0)
722 /* current state is <state>, matching character *str */
726 /* default is direct to next state */
730 wb->history[wb->pos] = state;
731 pos = base_idx(base[state]) + equiv[(u8) *str++];
732 if (check[pos] == state)
733 state = next[pos];
735 state = def[state];
736 if (is_loop(wb, state, &adjust)) {
737 state = aa_dfa_match(dfa, state, str);
745 /* default is direct to next state */
749 wb->history[wb->pos] = state;
750 pos = base_idx(base[state]) + (u8) *str++;
751 if (check[pos] == state)
752 state = next[pos];
754 state = def[state];
755 if (is_loop(wb, state, &adjust)) {
756 state = aa_dfa_match(dfa, state, str);
766 if (!state)
768 return state;
772 * aa_dfa_leftmatch - traverse @dfa to find state @str stops at
774 * @start: the state of the dfa to start matching in
778 * aa_dfa_match will match @str against the dfa and return the state it
779 * finished matching in. The final state can be used to look up the accepting
780 * label, or as the start state of a continuing match.
782 * Returns: final state reached after input is consumed
789 /* TODO: match for extended state dfas */