/* chain pattern in the expression */
LIST_APPEND(&expr->patterns, &patl->list);
+ patl->expr = expr;
/* and from the reference */
patl->from_ref = pat->ref->list_head;
pat->ref->list_head = &patl->from_ref;
/* chain pattern in the expression */
LIST_APPEND(&expr->patterns, &patl->list);
+ patl->expr = expr;
/* and from the reference */
patl->from_ref = pat->ref->list_head;
pat->ref->list_head = &patl->from_ref;
/* chain pattern in the expression */
LIST_APPEND(&expr->patterns, &patl->list);
+ patl->expr = expr;
/* and from the reference */
patl->from_ref = pat->ref->list_head;
pat->ref->list_head = &patl->from_ref;
/* chain pattern in the expression */
LIST_APPEND(&expr->patterns, &patl->list);
+ patl->expr = expr;
/* and from the reference */
patl->from_ref = pat->ref->list_head;
pat->ref->list_head = &patl->from_ref;
/* Insert the entry. */
ebmb_insert_prefix(&expr->pattern_tree, &node->node, 4);
+
+ node->expr = expr;
node->from_ref = pat->ref->tree_head;
pat->ref->tree_head = &node->from_ref;
expr->ref->revision = rdtsc();
/* Insert the entry. */
ebmb_insert_prefix(&expr->pattern_tree_2, &node->node, 16);
+
+ node->expr = expr;
node->from_ref = pat->ref->tree_head;
pat->ref->tree_head = &node->from_ref;
expr->ref->revision = rdtsc();
/* index the new node */
ebst_insert(&expr->pattern_tree, &node->node);
+
+ node->expr = expr;
node->from_ref = pat->ref->tree_head;
pat->ref->tree_head = &node->from_ref;
expr->ref->revision = rdtsc();
/* index the new node */
ebmb_insert_prefix(&expr->pattern_tree, &node->node, len);
+
+ node->expr = expr;
node->from_ref = pat->ref->tree_head;
pat->ref->tree_head = &node->from_ref;
expr->ref->revision = rdtsc();
struct sample_data **data;
char *sample;
struct sample_data test;
+ struct pattern_tree *tree;
+ struct pattern_list *pat;
+ void **node;
+
/* Try all needed converters. */
list_for_each_entry(expr, &ref->pat, list) {
/* Load sample in each reference. All the conversions are tested
* below, normally these calls don't fail.
*/
- list_for_each_entry(expr, &ref->pat, list) {
+ for (node = elt->tree_head; node;) {
+ tree = container_of(node, struct pattern_tree, from_ref);
+ node = *node;
+ BUG_ON(tree->ref != elt);
+ expr = tree->expr;
if (!expr->pat_head->parse_smp)
continue;
- HA_RWLOCK_WRLOCK(PATEXP_LOCK, &expr->lock);
- data = pattern_find_smp(expr, elt);
- if (data && *data && !expr->pat_head->parse_smp(sample, *data))
- *data = NULL;
- HA_RWLOCK_WRUNLOCK(PATEXP_LOCK, &expr->lock);
+ data = &tree->data;
+ if (data && *data) {
+ HA_RWLOCK_WRLOCK(PATEXP_LOCK, &expr->lock);
+ if (!expr->pat_head->parse_smp(sample, *data))
+ *data = NULL;
+ HA_RWLOCK_WRUNLOCK(PATEXP_LOCK, &expr->lock);
+ }
+ }
+
+ for (node = elt->list_head; node;) {
+ pat = container_of(node, struct pattern_list, from_ref);
+ node = *node;
+ BUG_ON(pat->pat.ref != elt);
+ expr = pat->expr;
+ if (!expr->pat_head->parse_smp)
+ continue;
+
+ data = &pat->pat.data;
+ if (data && *data) {
+ HA_RWLOCK_WRLOCK(PATEXP_LOCK, &expr->lock);
+ if (!expr->pat_head->parse_smp(sample, *data))
+ *data = NULL;
+ HA_RWLOCK_WRUNLOCK(PATEXP_LOCK, &expr->lock);
+ }
}
/* free old sample only when all exprs are updated */
}
}
-/* This function searches occurrences of pattern reference element <ref> in
- * expression <expr> and returns a pointer to a pointer of the sample storage.
- * If <ref> is not found, NULL is returned.
- */
-struct sample_data **pattern_find_smp(struct pattern_expr *expr, struct pat_ref_elt *ref)
-{
- struct ebmb_node *node;
- struct pattern_tree *elt;
- struct pattern_list *pat;
-
- for (node = ebmb_first(&expr->pattern_tree);
- node;
- node = ebmb_next(node)) {
- elt = container_of(node, struct pattern_tree, node);
- if (elt->ref == ref)
- return &elt->data;
- }
-
- for (node = ebmb_first(&expr->pattern_tree_2);
- node;
- node = ebmb_next(node)) {
- elt = container_of(node, struct pattern_tree, node);
- if (elt->ref == ref)
- return &elt->data;
- }
-
- list_for_each_entry(pat, &expr->patterns, list)
- if (pat->pat.ref == ref)
- return &pat->pat.data;
-
- return NULL;
-}
-
/* This function compares two pat_ref** on their unique_id, and returns -1/0/1
* depending on their order (suitable for sorting).
*/