Lines Matching refs:dfa

198 static int verify_dfa(struct aa_dfa *dfa)  in verify_dfa()  argument
203 state_count = dfa->tables[YYTD_ID_BASE]->td_lolen; in verify_dfa()
204 trans_count = dfa->tables[YYTD_ID_NXT]->td_lolen; in verify_dfa()
206 if (!(BASE_TABLE(dfa)[i] & MATCH_FLAG_DIFF_ENCODE) && in verify_dfa()
207 (DEFAULT_TABLE(dfa)[i] >= state_count)) in verify_dfa()
209 if (base_idx(BASE_TABLE(dfa)[i]) + 255 >= trans_count) { in verify_dfa()
216 if (NEXT_TABLE(dfa)[i] >= state_count) in verify_dfa() local
218 if (CHECK_TABLE(dfa)[i] >= state_count) in verify_dfa() local
227 (BASE_TABLE(dfa)[j] & MATCH_FLAG_DIFF_ENCODE) && in verify_dfa()
228 !(BASE_TABLE(dfa)[j] & MARK_DIFF_ENCODE); in verify_dfa()
230 k = DEFAULT_TABLE(dfa)[j]; in verify_dfa()
235 BASE_TABLE(dfa)[j] |= MARK_DIFF_ENCODE; in verify_dfa() local
250 static void dfa_free(struct aa_dfa *dfa) in dfa_free() argument
252 if (dfa) { in dfa_free()
255 for (i = 0; i < ARRAY_SIZE(dfa->tables); i++) { in dfa_free()
256 kvfree(dfa->tables[i]); in dfa_free()
257 dfa->tables[i] = NULL; in dfa_free()
259 kfree(dfa); in dfa_free()
269 struct aa_dfa *dfa = container_of(kref, struct aa_dfa, count); in aa_dfa_free_kref() local
270 dfa_free(dfa); in aa_dfa_free_kref()
291 struct aa_dfa *dfa = kzalloc(sizeof(struct aa_dfa), GFP_KERNEL); in aa_dfa_unpack() local
292 if (!dfa) in aa_dfa_unpack()
295 kref_init(&dfa->count); in aa_dfa_unpack()
310 dfa->flags = ntohs(*(__be16 *) (data + 12)); in aa_dfa_unpack()
311 if (dfa->flags != 0 && dfa->flags != YYTH_FLAG_DIFF_ENCODE) in aa_dfa_unpack()
349 if (dfa->tables[table->td_id]) in aa_dfa_unpack()
351 dfa->tables[table->td_id] = table; in aa_dfa_unpack()
356 error = verify_table_headers(dfa->tables, flags); in aa_dfa_unpack()
361 error = verify_dfa(dfa); in aa_dfa_unpack()
366 return dfa; in aa_dfa_unpack()
370 dfa_free(dfa); in aa_dfa_unpack()
404 unsigned int aa_dfa_match_len(struct aa_dfa *dfa, unsigned int start, in aa_dfa_match_len() argument
407 u16 *def = DEFAULT_TABLE(dfa); in aa_dfa_match_len()
408 u32 *base = BASE_TABLE(dfa); in aa_dfa_match_len()
409 u16 *next = NEXT_TABLE(dfa); in aa_dfa_match_len()
410 u16 *check = CHECK_TABLE(dfa); in aa_dfa_match_len()
417 if (dfa->tables[YYTD_ID_EC]) { in aa_dfa_match_len()
419 u8 *equiv = EQUIV_TABLE(dfa); in aa_dfa_match_len()
444 unsigned int aa_dfa_match(struct aa_dfa *dfa, unsigned int start, in aa_dfa_match() argument
447 u16 *def = DEFAULT_TABLE(dfa); in aa_dfa_match()
448 u32 *base = BASE_TABLE(dfa); in aa_dfa_match()
449 u16 *next = NEXT_TABLE(dfa); in aa_dfa_match()
450 u16 *check = CHECK_TABLE(dfa); in aa_dfa_match()
457 if (dfa->tables[YYTD_ID_EC]) { in aa_dfa_match()
459 u8 *equiv = EQUIV_TABLE(dfa); in aa_dfa_match()
483 unsigned int aa_dfa_next(struct aa_dfa *dfa, unsigned int state, in aa_dfa_next() argument
486 u16 *def = DEFAULT_TABLE(dfa); in aa_dfa_next()
487 u32 *base = BASE_TABLE(dfa); in aa_dfa_next()
488 u16 *next = NEXT_TABLE(dfa); in aa_dfa_next()
489 u16 *check = CHECK_TABLE(dfa); in aa_dfa_next()
492 if (dfa->tables[YYTD_ID_EC]) { in aa_dfa_next()
494 u8 *equiv = EQUIV_TABLE(dfa); in aa_dfa_next()
515 unsigned int aa_dfa_match_until(struct aa_dfa *dfa, unsigned int start, in aa_dfa_match_until() argument
518 u16 *def = DEFAULT_TABLE(dfa); in aa_dfa_match_until()
519 u32 *base = BASE_TABLE(dfa); in aa_dfa_match_until()
520 u16 *next = NEXT_TABLE(dfa); in aa_dfa_match_until()
521 u16 *check = CHECK_TABLE(dfa); in aa_dfa_match_until()
522 u32 *accept = ACCEPT_TABLE(dfa); in aa_dfa_match_until()
529 if (dfa->tables[YYTD_ID_EC]) { in aa_dfa_match_until()
531 u8 *equiv = EQUIV_TABLE(dfa); in aa_dfa_match_until()
576 unsigned int aa_dfa_matchn_until(struct aa_dfa *dfa, unsigned int start, in aa_dfa_matchn_until() argument
579 u16 *def = DEFAULT_TABLE(dfa); in aa_dfa_matchn_until()
580 u32 *base = BASE_TABLE(dfa); in aa_dfa_matchn_until()
581 u16 *next = NEXT_TABLE(dfa); in aa_dfa_matchn_until()
582 u16 *check = CHECK_TABLE(dfa); in aa_dfa_matchn_until()
583 u32 *accept = ACCEPT_TABLE(dfa); in aa_dfa_matchn_until()
591 if (dfa->tables[YYTD_ID_EC]) { in aa_dfa_matchn_until()
593 u8 *equiv = EQUIV_TABLE(dfa); in aa_dfa_matchn_until()
651 static unsigned int leftmatch_fb(struct aa_dfa *dfa, unsigned int start, in leftmatch_fb() argument
655 u16 *def = DEFAULT_TABLE(dfa); in leftmatch_fb()
656 u32 *base = BASE_TABLE(dfa); in leftmatch_fb()
657 u16 *next = NEXT_TABLE(dfa); in leftmatch_fb()
658 u16 *check = CHECK_TABLE(dfa); in leftmatch_fb()
661 AA_BUG(!dfa); in leftmatch_fb()
671 if (dfa->tables[YYTD_ID_EC]) { in leftmatch_fb()
673 u8 *equiv = EQUIV_TABLE(dfa); in leftmatch_fb()
685 state = aa_dfa_match(dfa, state, str); in leftmatch_fb()
704 state = aa_dfa_match(dfa, state, str); in leftmatch_fb()
732 unsigned int aa_dfa_leftmatch(struct aa_dfa *dfa, unsigned int start, in aa_dfa_leftmatch() argument
739 return leftmatch_fb(dfa, start, str, &wb, count); in aa_dfa_leftmatch()