From patchwork Mon Feb 16 06:57:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 23204 X-Patchwork-Delegate: jk@ozlabs.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 68894DDF00 for ; Mon, 16 Feb 2009 18:03:42 +1100 (EST) X-Original-To: cbe-oss-dev@ozlabs.org Delivered-To: cbe-oss-dev@ozlabs.org Received: from hera.kernel.org (hera.kernel.org [140.211.167.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6D6A5DDE0E; Mon, 16 Feb 2009 18:03:00 +1100 (EST) Received: from hera.kernel.org (IDENT:U2FsdGVkX1/n8XjCF2OSonQbx5UB/+/rcubSmIrsIF0@localhost [127.0.0.1]) by hera.kernel.org (8.14.2/8.14.2) with ESMTP id n1G72rh0021661 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 16 Feb 2009 07:02:53 GMT Received: (from geoff@localhost) by hera.kernel.org (8.14.2/8.13.1/Submit) id n1G72rlk021660; Mon, 16 Feb 2009 07:02:53 GMT Message-Id: <20090216065712.752142589@am.sony.com> References: <20090216065712.595147007@am.sony.com> In-reply-to: <20090216065712.595147007@am.sony.com> User-Agent: quilt/0.46-1 Date: Sun, 15 Feb 2009 22:57:14 -0800 From: Geoff Levand To: Jeremy Kerr Content-Disposition: inline; filename=list-continue-each-entry.diff X-Virus-Scanned: ClamAV 0.93.3/8994/Sun Feb 15 23:37:25 2009 on hera.kernel.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on hera.kernel.org X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (hera.kernel.org [127.0.0.1]); Mon, 16 Feb 2009 07:02:54 +0000 (UTC) Cc: cbe-oss-dev@ozlabs.org Subject: [Cbe-oss-dev] [patch 2/8] petitboot: Add list_continue_each_entry routine X-BeenThere: cbe-oss-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Discussion about Open Source Software for the Cell Broadband Engine List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: cbe-oss-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: cbe-oss-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Add a new list iteration routine list_continue_each_entry(). Continues iteration from a user specified list item. Signed-off-by: Geoff Levand --- lib/list/list.h | 4 ++++ 1 file changed, 4 insertions(+) --- a/lib/list/list.h +++ b/lib/list/list.h @@ -30,6 +30,10 @@ struct list { &pos->member != &(list)->head; \ pos = list_entry(pos->member.next, typeof(*pos), member)) +#define list_continue_each_entry(_list, _pos, _member) \ + for (; &_pos->_member != &(_list)->head; \ + _pos = list_entry(_pos->_member.next, typeof(*_pos), _member)) + void list_init(struct list *list); void list_insert_before(struct list_item *next, struct list_item *new); void list_insert_after(struct list_item *prev, struct list_item *new);