lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 12 Oct 2012 15:37:43 +0300
From:	Pekka Enberg <penberg@...nel.org>
To:	Anton Vorontsov <anton.vorontsov@...aro.org>
Cc:	John Stultz <john.stultz@...aro.org>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org, linaro-kernel@...ts.linaro.org,
	patches@...aro.org
Subject: Re: [PATCH 2/3] vmevent: Factor vmevent_match_attr() out of vmevent_match()

On Thu, Oct 4, 2012 at 1:21 PM, Anton Vorontsov
<anton.vorontsov@...aro.org> wrote:
> Soon we'll use this new function for other code; plus this makes code less
> indented.
>
> Signed-off-by: Anton Vorontsov <anton.vorontsov@...aro.org>
> ---
>  mm/vmevent.c | 107 +++++++++++++++++++++++++++++++----------------------------
>  1 file changed, 57 insertions(+), 50 deletions(-)
>
> diff --git a/mm/vmevent.c b/mm/vmevent.c
> index 39ef786..d434c11 100644
> --- a/mm/vmevent.c
> +++ b/mm/vmevent.c
> @@ -77,6 +77,59 @@ enum {
>         VMEVENT_ATTR_STATE_VALUE_WAS_GT = (1UL << 31),
>  };
>
> +static bool vmevent_match_attr(struct vmevent_attr *attr, u64 value)
> +{
> +       u32 state = attr->state;
> +       bool attr_lt = state & VMEVENT_ATTR_STATE_VALUE_LT;
> +       bool attr_gt = state & VMEVENT_ATTR_STATE_VALUE_GT;
> +       bool attr_eq = state & VMEVENT_ATTR_STATE_VALUE_EQ;
> +       bool edge = state & VMEVENT_ATTR_STATE_EDGE_TRIGGER;
> +       u32 was_lt_mask = VMEVENT_ATTR_STATE_VALUE_WAS_LT;
> +       u32 was_gt_mask = VMEVENT_ATTR_STATE_VALUE_WAS_GT;
> +       bool lt = value < attr->value;
> +       bool gt = value > attr->value;
> +       bool eq = value == attr->value;
> +       bool was_lt = state & was_lt_mask;
> +       bool was_gt = state & was_gt_mask;

[snip]

So I merged this patch but vmevent_match_attr() is still too ugly for
words. It really could use some serious cleanups.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ