Checking to see if a bit is _not_ set in a ftrace event filter

From: Theodore Ts'o
Date: Mon Dec 01 2014 - 21:19:48 EST


I was trying to do something like this:

filter="events/writeback/writeback_mark_inode_dirty/filter"
echo "(flags & 2048) && ((state & 2048) == 0)" > $filter

... but that doesn't work.

This works:

echo "flags & 2048" > $filter

But the problem is this:

echo "(state & 2048) == 0" > $filter

The simplest patch to add this would be add a new filter_ops so we
could do this:

echo "(state !& 2048)" > $filter

... but that's pretty ugly. But adding more general expression
parsing in the ftrace event filter code would be non-trivial, and if
we start trying to make things like "!(state & 2048)" or "(state &
2048) == 0", then at some point some crazy person might request
supporting something like this: "(state ^ flags) == 2048". :-)

So I guess the main question I want to ask is your opinion about
whether a patch that adds support for the operator "!&" is too ugly to
live?

Thanks,

- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/