Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 269069
b: refs/heads/master
c: c00b060
h: refs/heads/master
i:
  269067: fa741e6
v: v3
  • Loading branch information
Jiri Olsa authored and Steven Rostedt committed Aug 19, 2011
1 parent a57c201 commit cd4d79d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 34 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f03f5979945c573801c25ba3089ef17c4d7edc61
refs/heads/master: c00b060f36e1238816ebcf2c8cccd5e9fa068980
47 changes: 14 additions & 33 deletions trunk/kernel/trace/trace_events_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1418,43 +1418,24 @@ static int check_pred_tree(struct event_filter *filter,
check_pred_tree_cb, &data);
}

static int count_leafs(struct filter_pred *preds, struct filter_pred *root)
static int count_leafs_cb(enum move_type move, struct filter_pred *pred,
int *err, void *data)
{
struct filter_pred *pred;
enum move_type move = MOVE_DOWN;
int count = 0;
int done = 0;
int *count = data;

pred = root;
if ((move == MOVE_DOWN) &&
(pred->left == FILTER_PRED_INVALID))
(*count)++;

do {
switch (move) {
case MOVE_DOWN:
if (pred->left != FILTER_PRED_INVALID) {
pred = &preds[pred->left];
continue;
}
/* A leaf at the root is just a leaf in the tree */
if (pred == root)
return 1;
count++;
pred = get_pred_parent(pred, preds,
pred->parent, &move);
continue;
case MOVE_UP_FROM_LEFT:
pred = &preds[pred->right];
move = MOVE_DOWN;
continue;
case MOVE_UP_FROM_RIGHT:
if (pred == root)
break;
pred = get_pred_parent(pred, preds,
pred->parent, &move);
continue;
}
done = 1;
} while (!done);
return WALK_PRED_DEFAULT;
}

static int count_leafs(struct filter_pred *preds, struct filter_pred *root)
{
int count = 0, ret;

ret = walk_pred_tree(preds, root, count_leafs_cb, &count);
WARN_ON(ret);
return count;
}

Expand Down

0 comments on commit cd4d79d

Please sign in to comment.