On Thu, Jun 20, 2024 at 08:10:06PM +0800, Hongyi Lu wrote:
> Oh, thank you for the suggestions.
>
> I'll give CONDITION_HOOK a try. It's just that I really need to know the
> "source location" of the condition so the WHOLE_CONDITION_HOOK makes sure
> composited conditions like A and B in (A && B) appear together.
I mean, if you want to and it's working then that's great. But
generally we wouldn't want to differentiate between:
ONE:
if (A && B)
return;
TWO:
if (A) {
if (B)
return;
}
I guess, what I'm imagining you want is something like this. How is
some_function() reachable from the user?
int driver_ioctl(...)
{
if (!foo)
return -EINVAL;
if (bar)
return -EINVAL;
return some_function();
}
If we did something like stored conditions we could make a list of all
the conditions which are true and which are false when we call
some_function().
regards,
dan carpenter