On Thu, 2 Feb 2023 at 12:30, Muhammad Usama Anjum usama.anjum@collabora.com wrote: [...]
- The masks are specified in required_mask, anyof_mask, excluded_ mask and return_mask.
[...]
May I suggest a slightly modified interface for the flags?
As I understand, the return_mask is what is applied to page flags to aggregate the list. This is a separate thing, and I think it doesn't need changes except maybe an improvement in the documentation and visual distinction.
For the page-selection mechanism, currently required_mask and excluded_mask have conflicting responsibilities. I suggest to rework that to: 1. negated_flags: page flags which are to be negated before applying the page selection using following masks; 2. required_flags: flags which all have to be set in the (negation-applied) page flags; 3. anyof_flags: flags of which at least one has to be set in the (negation-applied) page flags;
IOW, the resulting algorithm would be:
tested_flags = page_flags ^ negated_flags; if (~tested_flags & required_flags) skip page; if (!(tested_flags & anyof_flags)) skip_page;
aggregate_on(page_flags & return_flags);
Best Regards Michał Mirosław