From: Ben Pfaff Date: Mon, 5 May 2008 18:14:02 +0000 (-0700) Subject: Compile fix for Linux 2.6.26-rc1: don't use the removed list_for_each_safe_rcu macro. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=726bd6832740c404d5fe6a3fb96908f7b3adabcc;p=openvswitch Compile fix for Linux 2.6.26-rc1: don't use the removed list_for_each_safe_rcu macro. There is no need for a "safe" version of the RCU list iteration macros, because the ordinary version of the macros is "safe". Linux 2.6.26-rc1 removed these "safe" versions, so this change modifies OpenFlow's uses of these macros to use the ordinary versions. This also simplifies the code because we don't need to use the list_entry macros any longer. --- diff --git a/datapath/linux-2.4/compat-2.4/include/linux/list.h b/datapath/linux-2.4/compat-2.4/include/linux/list.h index af98d8c6..5841b696 100644 --- a/datapath/linux-2.4/compat-2.4/include/linux/list.h +++ b/datapath/linux-2.4/compat-2.4/include/linux/list.h @@ -135,23 +135,6 @@ static inline void list_replace_rcu(struct list_head *old, rcu_dereference(pos) != (head); \ pos = pos->next) -/** - * list_for_each_safe_rcu - * @pos: the &struct list_head to use as a loop cursor. - * @n: another &struct list_head to use as temporary storage - * @head: the head for your list. - * - * Iterate over an rcu-protected list, safe against removal of list entry. - * - * This list-traversal primitive may safely run concurrently with - * the _rcu list-mutation primitives such as list_add_rcu() - * as long as the traversal is guarded by rcu_read_lock(). - */ -#define list_for_each_safe_rcu(pos, n, head) \ - for (pos = (head)->next; \ - n = rcu_dereference(pos)->next, pos != (head); \ - pos = n) - /** * list_for_each_entry_rcu - iterate over rcu list of given type * @pos: the type * to use as a loop cursor. diff --git a/datapath/table-linear.c b/datapath/table-linear.c index c965b497..2275c486 100644 --- a/datapath/table-linear.c +++ b/datapath/table-linear.c @@ -93,11 +93,10 @@ static int table_linear_delete(struct sw_table *swt, const struct sw_flow_key *key, uint16_t priority, int strict) { struct sw_table_linear *tl = (struct sw_table_linear *) swt; - struct list_head *pos, *n; + struct sw_flow *flow; unsigned int count = 0; - list_for_each_safe_rcu (pos, n, &tl->flows) { - struct sw_flow *flow = list_entry(pos, struct sw_flow, node); + list_for_each_entry_rcu (flow, &tl->flows, node) { if (flow_del_matches(&flow->key, key, strict) && (strict && (flow->priority == priority))) count += do_delete(swt, flow); @@ -110,11 +109,10 @@ static int table_linear_delete(struct sw_table *swt, static int table_linear_timeout(struct datapath *dp, struct sw_table *swt) { struct sw_table_linear *tl = (struct sw_table_linear *) swt; - struct list_head *pos, *n; + struct sw_flow *flow; int count = 0; - list_for_each_safe_rcu (pos, n, &tl->flows) { - struct sw_flow *flow = list_entry(pos, struct sw_flow, node); + list_for_each_entry_rcu (flow, &tl->flows, node) { if (flow_timeout(flow)) { count += do_delete(swt, flow); if (dp->flags & OFPC_SEND_FLOW_EXP)