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:	Tue, 17 Apr 2007 10:29:45 -0700
From:	Randy Dunlap <randy.dunlap@...cle.com>
To:	Pavel Emelianov <xemul@...ru>
Cc:	Andrew Morton <akpm@...l.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	devel@...nvz.org, Kirill Korotaev <dev@...nvz.org>
Subject: Re: [PATCH] Introduce a handy list_first_entry macro

On Tue, 17 Apr 2007 15:18:56 +0400 Pavel Emelianov wrote:

> There are many places in the kernel where the construction like
> 
>    foo = list_entry(head->next, struct foo_struct, list);
> 
> are used. 
> The code might look more descriptive and neat if using the macro
> 
>    list_first_entry(head, type, member) \
>              list_entry((head)->next, type, member)
> 
> Here is the macro itself and the examples of its usage in the
> generic code. If it will turn out to be useful, I can prepare
> the set of patches to inject in into arch-specific code, drivers,
> networking, etc.
> 
> Signed-off-by: Pavel Emelianov <xemul@...nvz.org>
> Signed-off-by: Kirill Korotaev <dev@...nvz.org>
> 
> ---
> diff --git a/include/linux/list.h b/include/linux/list.h
> index fd59659..71318fc 100644
> --- a/include/linux/list.h
> +++ b/include/linux/list.h
> @@ -425,6 +425,9 @@ static inline void list_splice_init_rcu(
>  #define list_entry(ptr, type, member) \
>  	container_of(ptr, type, member)
>  
> +#define list_first_entry(ptr, type, member) \
> +	list_entry((ptr)->next, type, member)
> +

Please provide kernel-doc for that like the rest of list.h has.

>  /**
>   * list_for_each	-	iterate over a list
>   * @pos:	the &struct list_head to use as a loop cursor.


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
-
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