From patchwork Mon Mar 21 18:58:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ben@skyportsystems.com X-Patchwork-Id: 600273 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3qTQBF6X1wz9s3s for ; Tue, 22 Mar 2016 06:00:05 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=skyportsystems.com header.i=@skyportsystems.com header.b=Wx3sJjrN; dkim-atps=neutral Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 7DBF210535; Mon, 21 Mar 2016 11:58:57 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 3B60510325 for ; Mon, 21 Mar 2016 11:58:51 -0700 (PDT) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id A80E5161A26 for ; Mon, 21 Mar 2016 12:58:50 -0600 (MDT) X-ASG-Debug-ID: 1458586724-0b323727636b4b50001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar6.cudamail.com with ESMTP id R6iGCcGt4fp14ETE (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 21 Mar 2016 12:58:45 -0600 (MDT) X-Barracuda-Envelope-From: ben@skyportsystems.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO mail-pf0-f179.google.com) (209.85.192.179) by mx1-pf2.cudamail.com with ESMTPS (RC4-SHA encrypted); 21 Mar 2016 18:58:44 -0000 Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at _netblocks.google.com designates 209.85.192.179 as permitted sender) X-Barracuda-RBL-Trusted-Forwarder: 209.85.192.179 Received: by mail-pf0-f179.google.com with SMTP id u190so276261042pfb.3 for ; Mon, 21 Mar 2016 11:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skyportsystems.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=zKbCbJ7igPGYcHKUnQQHBmbCB0ediq53JlUM9YIVqQk=; b=Wx3sJjrN4v9FW+K588qnMvnOiO5wlPknsCqwy+3FWILCPrmnhxbVhiVHNpkJNr+Fay M0spLKV8W8q+9qi8umDbnXz7QNxXrhYdcVPBdpulenZCOrjkp8xChp71JgN4q0+gWFSP 48fy+abi1a0A/JCYNTNtSPsYoKrOVdvfXJrH4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=zKbCbJ7igPGYcHKUnQQHBmbCB0ediq53JlUM9YIVqQk=; b=kAgTA+GC2JFmn4QpkOcCkIqsHrwToV3jNA9HIOEZNNKjz6toa/XJAhygMOpL/AIuCU ANCcgOyC/nWyMYvrE0SEYjTxQBu9CC7AFsHJ9YnXCg8QMKoLVUSlUOHZQ5q/tVBU31zb Zv855GDYgWJBSwECkzZRU+bSUBfgAXpUpftbmMTbT6stAVUQ1hufzBkaWj1yOjZteDcc 1tAbwapTPxSy3Zdv5+nXxzCabPP5DNzOZIEhmT27pWHZzwk3pauOae0z4MAGfiqlA36d 2vd0RB/ZuhEfx/DMlfu6z9iKsRHkPucEW4ExJ6eIZfWVKt0oAMTopHlYyGyNI2MeJF4g l8cw== X-Gm-Message-State: AD7BkJKy1ond1BFQSCkXKFxjNrLaZrxNh7PSkWL62ph1BjkBLDEzypEPQ7I+reO8vmVZh+8k X-Received: by 10.66.141.76 with SMTP id rm12mr48207773pab.30.1458586723480; Mon, 21 Mar 2016 11:58:43 -0700 (PDT) Received: from Arrow.corp.skyportsystems.com (67-207-112-138.static.wiline.com. [67.207.112.138]) by smtp.gmail.com with ESMTPSA id a22sm42472831pfj.2.2016.03.21.11.58.42 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 21 Mar 2016 11:58:42 -0700 (PDT) X-CudaMail-Envelope-Sender: ben@skyportsystems.com X-Barracuda-Apparent-Source-IP: 67.207.112.138 From: ben@skyportsystems.com To: dev@openvswitch.org X-CudaMail-MID: CM-E2-320059242 X-CudaMail-DTE: 032116 X-CudaMail-Originating-IP: 209.85.192.179 Date: Mon, 21 Mar 2016 11:58:11 -0700 X-ASG-Orig-Subj: [##CM-E2-320059242##][PATCH v3 03/21] Rename all functions in list.h with ovs_ prefix Message-Id: <900863fcdb34348d736b93987907ba5d03e3795f.1458586228.git.ben@skyportsystems.com> X-Mailer: git-send-email 2.5.4 (Apple Git-61) In-Reply-To: References: In-Reply-To: References: X-GBUdb-Analysis: 0, 209.85.192.179, Ugly c=0.430172 p=-0.353846 Source Normal X-MessageSniffer-Rules: 0-0-0-32767-c X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1458586725 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Barracuda-BRTS-Status: 1 X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-Spam-Score: 1.60 X-Barracuda-Spam-Status: No, SCORE=1.60 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_RULE7568M, BSF_SC0_MV0713, BSF_SC5_MJ1963, DKIM_SIGNED, NO_REAL_NAME, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.28028 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 NO_REAL_NAME From: does not include a real name 0.00 DKIM_SIGNED Domain Keys Identified Mail: message has a signature 0.50 BSF_RULE7568M Custom Rule 7568M 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC0_MV0713 Custom rule MV0713 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Cc: Ben Warren Subject: [ovs-dev] [PATCH v3 03/21] Rename all functions in list.h with ovs_ prefix X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" From: Ben Warren This attempts to prevent namespace collisions with other list libraries Signed-off-by: Ben Warren --- include/openvswitch/list.h | 94 ++++++++++++++-------------- lib/dpif-netdev.c | 6 +- lib/fat-rwlock.c | 8 +-- lib/guarded-list.c | 10 +-- lib/jsonrpc.c | 12 ++-- lib/lacp.c | 4 +- lib/lldp/lldp.c | 10 +-- lib/lldp/lldpd-structs.c | 12 ++-- lib/lldp/lldpd.c | 22 +++---- lib/lldp/lldpd.h | 2 +- lib/mac-learning.c | 26 ++++---- lib/mcast-snooping.c | 50 +++++++-------- lib/netdev-dpdk.c | 10 +-- lib/netdev-dummy.c | 36 +++++------ lib/netdev.c | 8 +-- lib/netlink-notifier.c | 10 +-- lib/nx-match.c | 4 +- lib/ofp-msgs.c | 14 ++--- lib/ofp-parse.c | 12 ++-- lib/ofp-util.c | 50 +++++++-------- lib/ofpbuf.c | 2 +- lib/ovs-atomic.h | 2 +- lib/ovs-lldp.c | 46 +++++++------- lib/ovs-numa.c | 12 ++-- lib/ovs-rcu.c | 8 +-- lib/ovs-thread.c | 14 ++--- lib/ovsdb-idl.c | 48 +++++++-------- lib/process.c | 6 +- lib/rconn.c | 24 ++++---- lib/rstp.c | 4 +- lib/rtbsd.c | 6 +- lib/seq.c | 6 +- lib/seq.h | 6 +- lib/stp.c | 4 +- lib/tnl-ports.c | 12 ++-- lib/tun-metadata.c | 4 +- lib/unixctl.c | 6 +- lib/vlog.c | 2 +- ofproto/bond.c | 38 ++++++------ ofproto/bundles.c | 4 +- ofproto/connmgr.c | 14 ++--- ofproto/ofproto-dpif-ipfix.c | 8 +-- ofproto/ofproto-dpif-rid.c | 10 +-- ofproto/ofproto-dpif-upcall.c | 8 +-- ofproto/ofproto-dpif-xlate.c | 20 +++--- ofproto/ofproto-dpif.c | 28 ++++----- ofproto/ofproto.c | 52 ++++++++-------- ofproto/pinsched.c | 16 ++--- ovn/controller/ofctrl.c | 4 +- ovn/lib/expr.c | 138 +++++++++++++++++++++--------------------- ovn/northd/ovn-northd.c | 46 +++++++------- ovsdb/jsonrpc-server.c | 18 +++--- ovsdb/monitor.c | 14 ++--- ovsdb/ovsdb.c | 12 ++-- ovsdb/row.c | 12 ++-- ovsdb/server.c | 16 ++--- ovsdb/transaction.c | 18 +++--- ovsdb/trigger.c | 8 +-- tests/test-aa.c | 10 +-- tests/test-classifier.c | 2 +- tests/test-list.c | 14 ++--- tests/test-ovn.c | 4 +- tests/test-ovsdb.c | 4 +- utilities/ovs-ofctl.c | 12 ++-- utilities/ovs-vsctl.c | 16 ++--- vswitchd/bridge.c | 44 +++++++------- vtep/vtep-ctl.c | 18 +++--- 67 files changed, 610 insertions(+), 610 deletions(-) diff --git a/include/openvswitch/list.h b/include/openvswitch/list.h index 961928d..575bf51 100644 --- a/include/openvswitch/list.h +++ b/include/openvswitch/list.h @@ -36,33 +36,33 @@ struct ovs_list { (struct ovs_list) { (struct ovs_list *) (uintptr_t) 0xccccccccccccccccULL, \ (struct ovs_list *) (uintptr_t) 0xccccccccccccccccULL } -static inline void list_init(struct ovs_list *); -static inline void list_poison(struct ovs_list *); +static inline void ovs_list_init(struct ovs_list *); +static inline void ovs_list_poison(struct ovs_list *); /* List insertion. */ -static inline void list_insert(struct ovs_list *, struct ovs_list *); -static inline void list_splice(struct ovs_list *before, struct ovs_list *first, +static inline void ovs_list_insert(struct ovs_list *, struct ovs_list *); +static inline void ovs_list_splice(struct ovs_list *before, struct ovs_list *first, struct ovs_list *last); -static inline void list_push_front(struct ovs_list *, struct ovs_list *); -static inline void list_push_back(struct ovs_list *, struct ovs_list *); -static inline void list_replace(struct ovs_list *, const struct ovs_list *); -static inline void list_moved(struct ovs_list *, const struct ovs_list *orig); -static inline void list_move(struct ovs_list *dst, struct ovs_list *src); +static inline void ovs_list_push_front(struct ovs_list *, struct ovs_list *); +static inline void ovs_list_push_back(struct ovs_list *, struct ovs_list *); +static inline void ovs_list_replace(struct ovs_list *, const struct ovs_list *); +static inline void ovs_list_moved(struct ovs_list *, const struct ovs_list *orig); +static inline void ovs_list_move(struct ovs_list *dst, struct ovs_list *src); /* List removal. */ -static inline struct ovs_list *list_remove(struct ovs_list *); -static inline struct ovs_list *list_pop_front(struct ovs_list *); -static inline struct ovs_list *list_pop_back(struct ovs_list *); +static inline struct ovs_list *ovs_list_remove(struct ovs_list *); +static inline struct ovs_list *ovs_list_pop_front(struct ovs_list *); +static inline struct ovs_list *ovs_list_pop_back(struct ovs_list *); /* List elements. */ -static inline struct ovs_list *list_front(const struct ovs_list *); -static inline struct ovs_list *list_back(const struct ovs_list *); +static inline struct ovs_list *ovs_list_front(const struct ovs_list *); +static inline struct ovs_list *ovs_list_back(const struct ovs_list *); /* List properties. */ -static inline size_t list_size(const struct ovs_list *); -static inline bool list_is_empty(const struct ovs_list *); -static inline bool list_is_singleton(const struct ovs_list *); -static inline bool list_is_short(const struct ovs_list *); +static inline size_t ovs_list_size(const struct ovs_list *); +static inline bool ovs_list_is_empty(const struct ovs_list *); +static inline bool ovs_list_is_singleton(const struct ovs_list *); +static inline bool ovs_list_is_short(const struct ovs_list *); #define LIST_FOR_EACH(ITER, MEMBER, LIST) \ for (INIT_CONTAINER(ITER, (LIST)->next, MEMBER); \ @@ -87,14 +87,14 @@ static inline bool list_is_short(const struct ovs_list *); : 0); \ (ITER) = (NEXT)) #define LIST_FOR_EACH_POP(ITER, MEMBER, LIST) \ - while (!list_is_empty(LIST) \ - && (INIT_CONTAINER(ITER, list_pop_front(LIST), MEMBER), 1)) + while (!ovs_list_is_empty(LIST) \ + && (INIT_CONTAINER(ITER, ovs_list_pop_front(LIST), MEMBER), 1)) /* Inline implementations. */ /* Initializes 'list' as an empty list. */ static inline void -list_init(struct ovs_list *list) +ovs_list_init(struct ovs_list *list) { list->next = list->prev = list; } @@ -102,14 +102,14 @@ list_init(struct ovs_list *list) /* Initializes 'list' with pointers that will (probably) cause segfaults if * dereferenced and, better yet, show up clearly in a debugger. */ static inline void -list_poison(struct ovs_list *list) +ovs_list_poison(struct ovs_list *list) { *list = OVS_LIST_POISON; } /* Inserts 'elem' just before 'before'. */ static inline void -list_insert(struct ovs_list *before, struct ovs_list *elem) +ovs_list_insert(struct ovs_list *before, struct ovs_list *elem) { elem->prev = before->prev; elem->next = before; @@ -120,7 +120,7 @@ list_insert(struct ovs_list *before, struct ovs_list *elem) /* Removes elements 'first' though 'last' (exclusive) from their current list, then inserts them just before 'before'. */ static inline void -list_splice(struct ovs_list *before, struct ovs_list *first, struct ovs_list *last) +ovs_list_splice(struct ovs_list *before, struct ovs_list *first, struct ovs_list *last) { if (first == last) { return; @@ -141,23 +141,23 @@ list_splice(struct ovs_list *before, struct ovs_list *first, struct ovs_list *la /* Inserts 'elem' at the beginning of 'list', so that it becomes the front in 'list'. */ static inline void -list_push_front(struct ovs_list *list, struct ovs_list *elem) +ovs_list_push_front(struct ovs_list *list, struct ovs_list *elem) { - list_insert(list->next, elem); + ovs_list_insert(list->next, elem); } /* Inserts 'elem' at the end of 'list', so that it becomes the back in * 'list'. */ static inline void -list_push_back(struct ovs_list *list, struct ovs_list *elem) +ovs_list_push_back(struct ovs_list *list, struct ovs_list *elem) { - list_insert(list, elem); + ovs_list_insert(list, elem); } /* Puts 'elem' in the position currently occupied by 'position'. * Afterward, 'position' is not part of a list. */ static inline void -list_replace(struct ovs_list *element, const struct ovs_list *position) +ovs_list_replace(struct ovs_list *element, const struct ovs_list *position) { element->next = position->next; element->next->prev = element; @@ -174,10 +174,10 @@ list_replace(struct ovs_list *element, const struct ovs_list *position) * language lawyer sense, this still yields undefined behavior, but it works * with actual compilers.) */ static inline void -list_moved(struct ovs_list *list, const struct ovs_list *orig) +ovs_list_moved(struct ovs_list *list, const struct ovs_list *orig) { if (list->next == orig) { - list_init(list); + ovs_list_init(list); } else { list->prev->next = list->next->prev = list; } @@ -187,16 +187,16 @@ list_moved(struct ovs_list *list, const struct ovs_list *orig) * around in memory. The effect is that, if 'src' was the head of a list, now * 'dst' is the head of a list containing the same elements. */ static inline void -list_move(struct ovs_list *dst, struct ovs_list *src) +ovs_list_move(struct ovs_list *dst, struct ovs_list *src) { *dst = *src; - list_moved(dst, src); + ovs_list_moved(dst, src); } /* Removes 'elem' from its list and returns the element that followed it. Undefined behavior if 'elem' is not in a list. */ static inline struct ovs_list * -list_remove(struct ovs_list *elem) +ovs_list_remove(struct ovs_list *elem) { elem->prev->next = elem->next; elem->next->prev = elem->prev; @@ -206,33 +206,33 @@ list_remove(struct ovs_list *elem) /* Removes the front element from 'list' and returns it. Undefined behavior if 'list' is empty before removal. */ static inline struct ovs_list * -list_pop_front(struct ovs_list *list) +ovs_list_pop_front(struct ovs_list *list) { struct ovs_list *front = list->next; - list_remove(front); + ovs_list_remove(front); return front; } /* Removes the back element from 'list' and returns it. Undefined behavior if 'list' is empty before removal. */ static inline struct ovs_list * -list_pop_back(struct ovs_list *list) +ovs_list_pop_back(struct ovs_list *list) { struct ovs_list *back = list->prev; - list_remove(back); + ovs_list_remove(back); return back; } /* Returns the front element in 'list_'. Undefined behavior if 'list_' is empty. */ static inline struct ovs_list * -list_front(const struct ovs_list *list_) +ovs_list_front(const struct ovs_list *list_) { struct ovs_list *list = CONST_CAST(struct ovs_list *, list_); - ovs_assert(!list_is_empty(list)); + ovs_assert(!ovs_list_is_empty(list)); return list->next; } @@ -240,11 +240,11 @@ list_front(const struct ovs_list *list_) /* Returns the back element in 'list_'. Undefined behavior if 'list_' is empty. */ static inline struct ovs_list * -list_back(const struct ovs_list *list_) +ovs_list_back(const struct ovs_list *list_) { struct ovs_list *list = CONST_CAST(struct ovs_list *, list_); - ovs_assert(!list_is_empty(list)); + ovs_assert(!ovs_list_is_empty(list)); return list->prev; } @@ -252,7 +252,7 @@ list_back(const struct ovs_list *list_) /* Returns the number of elements in 'list'. Runs in O(n) in the number of elements. */ static inline size_t -list_size(const struct ovs_list *list) +ovs_list_size(const struct ovs_list *list) { const struct ovs_list *e; size_t cnt = 0; @@ -265,21 +265,21 @@ list_size(const struct ovs_list *list) /* Returns true if 'list' is empty, false otherwise. */ static inline bool -list_is_empty(const struct ovs_list *list) +ovs_list_is_empty(const struct ovs_list *list) { return list->next == list; } /* Returns true if 'list' has exactly 1 element, false otherwise. */ static inline bool -list_is_singleton(const struct ovs_list *list) +ovs_list_is_singleton(const struct ovs_list *list) { - return list_is_short(list) && !list_is_empty(list); + return ovs_list_is_short(list) && !ovs_list_is_empty(list); } /* Returns true if 'list' has 0 or 1 elements, false otherwise. */ static inline bool -list_is_short(const struct ovs_list *list) +ovs_list_is_short(const struct ovs_list *list) { return list->next == list->prev; } diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 8558732..f25c32c 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -2864,7 +2864,7 @@ dp_netdev_configure_pmd(struct dp_netdev_pmd_thread *pmd, struct dp_netdev *dp, ovs_mutex_init(&pmd->poll_mutex); dpcls_init(&pmd->cls); cmap_init(&pmd->flow_table); - list_init(&pmd->poll_list); + ovs_list_init(&pmd->poll_list); /* init the 'flow_cache' since there is no * actual thread created for NON_PMD_CORE_ID. */ if (core_id == NON_PMD_CORE_ID) { @@ -3017,7 +3017,7 @@ dp_netdev_del_port_from_pmd(struct dp_netdev_port *port, if (poll->port == port) { found = true; port_unref(poll->port); - list_remove(&poll->node); + ovs_list_remove(&poll->node); pmd->poll_cnt--; free(poll); } @@ -3076,7 +3076,7 @@ dp_netdev_add_rxq_to_pmd(struct dp_netdev_pmd_thread *pmd, poll->port = port; poll->rx = rx; - list_push_back(&pmd->poll_list, &poll->node); + ovs_list_push_back(&pmd->poll_list, &poll->node); pmd->poll_cnt++; } diff --git a/lib/fat-rwlock.c b/lib/fat-rwlock.c index b36cd4c..2f42b05 100644 --- a/lib/fat-rwlock.c +++ b/lib/fat-rwlock.c @@ -66,7 +66,7 @@ free_slot(struct fat_rwlock_slot *slot) abort(); } - list_remove(&slot->list_node); + ovs_list_remove(&slot->list_node); free_cacheline(slot); } @@ -88,7 +88,7 @@ fat_rwlock_init(struct fat_rwlock *rwlock) ovsthread_key_create(&rwlock->key, slot_destructor); ovs_mutex_init(&rwlock->mutex); ovs_mutex_lock(&rwlock->mutex); - list_init(&rwlock->threads); + ovs_list_init(&rwlock->threads); ovs_mutex_unlock(&rwlock->mutex); } @@ -129,7 +129,7 @@ fat_rwlock_get_slot__(struct fat_rwlock *rwlock) slot->depth = 0; ovs_mutex_lock(&rwlock->mutex); - list_push_back(&rwlock->threads, &slot->list_node); + ovs_list_push_back(&rwlock->threads, &slot->list_node); ovs_mutex_unlock(&rwlock->mutex); ovsthread_setspecific(rwlock->key, slot); @@ -181,7 +181,7 @@ fat_rwlock_try_get_slot__(struct fat_rwlock *rwlock) ovs_mutex_init(&slot->mutex); slot->depth = 0; - list_push_back(&rwlock->threads, &slot->list_node); + ovs_list_push_back(&rwlock->threads, &slot->list_node); ovs_mutex_unlock(&rwlock->mutex); ovsthread_setspecific(rwlock->key, slot); } diff --git a/lib/guarded-list.c b/lib/guarded-list.c index da0a43e..2186d07 100644 --- a/lib/guarded-list.c +++ b/lib/guarded-list.c @@ -22,7 +22,7 @@ void guarded_list_init(struct guarded_list *list) { ovs_mutex_init(&list->mutex); - list_init(&list->list); + ovs_list_init(&list->list); list->n = 0; } @@ -57,7 +57,7 @@ guarded_list_push_back(struct guarded_list *list, ovs_mutex_lock(&list->mutex); if (list->n < max) { - list_push_back(&list->list, node); + ovs_list_push_back(&list->list, node); retval = ++list->n; } ovs_mutex_unlock(&list->mutex); @@ -72,7 +72,7 @@ guarded_list_pop_front(struct guarded_list *list) ovs_mutex_lock(&list->mutex); if (list->n) { - node = list_pop_front(&list->list); + node = ovs_list_pop_front(&list->list); list->n--; } ovs_mutex_unlock(&list->mutex); @@ -86,10 +86,10 @@ guarded_list_pop_all(struct guarded_list *list, struct ovs_list *elements) size_t n; ovs_mutex_lock(&list->mutex); - list_move(elements, &list->list); + ovs_list_move(elements, &list->list); n = list->n; - list_init(&list->list); + ovs_list_init(&list->list); list->n = 0; ovs_mutex_unlock(&list->mutex); diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c index 33d23e1..c1e50ad 100644 --- a/lib/jsonrpc.c +++ b/lib/jsonrpc.c @@ -87,7 +87,7 @@ jsonrpc_open(struct stream *stream) rpc->name = xstrdup(stream_get_name(stream)); rpc->stream = stream; byteq_init(&rpc->input, rpc->input_buffer, sizeof rpc->input_buffer); - list_init(&rpc->output); + ovs_list_init(&rpc->output); return rpc; } @@ -113,7 +113,7 @@ jsonrpc_run(struct jsonrpc *rpc) } stream_run(rpc->stream); - while (!list_is_empty(&rpc->output)) { + while (!ovs_list_is_empty(&rpc->output)) { struct ofpbuf *buf = ofpbuf_from_list(rpc->output.next); int retval; @@ -122,7 +122,7 @@ jsonrpc_run(struct jsonrpc *rpc) rpc->backlog -= retval; ofpbuf_pull(buf, retval); if (!buf->size) { - list_remove(&buf->list_node); + ovs_list_remove(&buf->list_node); rpc->output_count--; ofpbuf_delete(buf); } @@ -144,7 +144,7 @@ jsonrpc_wait(struct jsonrpc *rpc) { if (!rpc->status) { stream_run_wait(rpc->stream); - if (!list_is_empty(&rpc->output)) { + if (!ovs_list_is_empty(&rpc->output)) { stream_send_wait(rpc->stream); } } @@ -255,7 +255,7 @@ jsonrpc_send(struct jsonrpc *rpc, struct jsonrpc_msg *msg) buf = xmalloc(sizeof *buf); ofpbuf_use_ds(buf, &ds); - list_push_back(&rpc->output, &buf->list_node); + ovs_list_push_back(&rpc->output, &buf->list_node); rpc->output_count++; rpc->backlog += length; @@ -384,7 +384,7 @@ jsonrpc_send_block(struct jsonrpc *rpc, struct jsonrpc_msg *msg) for (;;) { jsonrpc_run(rpc); - if (list_is_empty(&rpc->output) || rpc->status) { + if (ovs_list_is_empty(&rpc->output) || rpc->status) { return rpc->status; } jsonrpc_wait(rpc); diff --git a/lib/lacp.c b/lib/lacp.c index 8ecef06..a9d6e1e 100644 --- a/lib/lacp.c +++ b/lib/lacp.c @@ -236,7 +236,7 @@ lacp_create(void) OVS_EXCLUDED(mutex) ovs_refcount_init(&lacp->ref_cnt); lacp_lock(); - list_push_back(all_lacps, &lacp->node); + ovs_list_push_back(all_lacps, &lacp->node); lacp_unlock(); return lacp; } @@ -264,7 +264,7 @@ lacp_unref(struct lacp *lacp) OVS_EXCLUDED(mutex) } hmap_destroy(&lacp->slaves); - list_remove(&lacp->node); + ovs_list_remove(&lacp->node); free(lacp->name); free(lacp); lacp_unlock(); diff --git a/lib/lldp/lldp.c b/lib/lldp/lldp.c index 0340f67..74f747f 100644 --- a/lib/lldp/lldp.c +++ b/lib/lldp/lldp.c @@ -295,7 +295,7 @@ lldp_send(struct lldpd *global OVS_UNUSED, lldp_tlv_end(p, start); } - if (!list_is_empty(&port->p_isid_vlan_maps)) { + if (!ovs_list_is_empty(&port->p_isid_vlan_maps)) { memset(msg_auth_digest, 0, sizeof msg_auth_digest); @@ -372,10 +372,10 @@ lldp_decode(struct lldpd *cfg OVS_UNUSED, char *frame, int s, VLOG_DBG("receive LLDP PDU on %s", hardware->h_ifname); chassis = xzalloc(sizeof *chassis); - list_init(&chassis->c_mgmt); + ovs_list_init(&chassis->c_mgmt); port = xzalloc(sizeof *port); - list_init(&port->p_isid_vlan_maps); + ovs_list_init(&port->p_isid_vlan_maps); length = s; pos = (u_int8_t*) frame; @@ -501,7 +501,7 @@ lldp_decode(struct lldpd *cfg OVS_UNUSED, char *frame, int s, VLOG_WARN("unable to allocate memory for management address"); goto malformed; } - list_push_back(&chassis->c_mgmt, &mgmt->m_entries); + ovs_list_push_back(&chassis->c_mgmt, &mgmt->m_entries); break; case LLDP_TLV_ORG: @@ -599,7 +599,7 @@ lldp_decode(struct lldpd *cfg OVS_UNUSED, char *frame, int s, PEEK_BYTES(isid, 3); isid_vlan_map->isid_vlan_data.isid = (isid[0] << 16) | (isid[1] << 8) | isid[2]; - list_push_back(&port->p_isid_vlan_maps, + ovs_list_push_back(&port->p_isid_vlan_maps, &isid_vlan_map->m_entries); isid_vlan_map = NULL; } diff --git a/lib/lldp/lldpd-structs.c b/lib/lldp/lldpd-structs.c index 71c4f5e..499b441 100644 --- a/lib/lldp/lldpd-structs.c +++ b/lib/lldp/lldpd-structs.c @@ -37,7 +37,7 @@ lldpd_chassis_mgmt_cleanup(struct lldpd_chassis *chassis) free(mgmt); } - list_init(&chassis->c_mgmt); + ovs_list_init(&chassis->c_mgmt); } void @@ -82,14 +82,14 @@ lldpd_remote_cleanup(struct lldpd_hardware *hw, } if (!all) { - list_remove(&port->p_entries); + ovs_list_remove(&port->p_entries); } lldpd_port_cleanup(port, true); free(port); } } if (all) { - list_init(&hw->h_rports); + ovs_list_init(&hw->h_rports); } } @@ -101,16 +101,16 @@ lldpd_aa_maps_cleanup(struct lldpd_port *port) struct lldpd_aa_isid_vlan_maps_tlv *isid_vlan_map = NULL; struct lldpd_aa_isid_vlan_maps_tlv *isid_vlan_map_next = NULL; - if (!list_is_empty(&port->p_isid_vlan_maps)) { + if (!ovs_list_is_empty(&port->p_isid_vlan_maps)) { LIST_FOR_EACH_SAFE (isid_vlan_map, isid_vlan_map_next, m_entries, &port->p_isid_vlan_maps) { - list_remove(&isid_vlan_map->m_entries); + ovs_list_remove(&isid_vlan_map->m_entries); free(isid_vlan_map); } - list_init(&port->p_isid_vlan_maps); + ovs_list_init(&port->p_isid_vlan_maps); } } diff --git a/lib/lldp/lldpd.c b/lib/lldp/lldpd.c index da86083..60858b0 100644 --- a/lib/lldp/lldpd.c +++ b/lib/lldp/lldpd.c @@ -85,10 +85,10 @@ lldpd_alloc_hardware(struct lldpd *cfg, char *name, int index) hw->h_cfg = cfg; ovs_strlcpy(hw->h_ifname, name, sizeof hw->h_ifname); hw->h_ifindex = index; - hw->h_lport.p_chassis = CONTAINER_OF(list_front(&cfg->g_chassis), + hw->h_lport.p_chassis = CONTAINER_OF(ovs_list_front(&cfg->g_chassis), struct lldpd_chassis, list); hw->h_lport.p_chassis->c_refcount++; - list_init(&hw->h_rports); + ovs_list_init(&hw->h_rports); return hw; } @@ -139,7 +139,7 @@ lldpd_cleanup(struct lldpd *cfg) LIST_FOR_EACH_SAFE (hw, hw_next, h_entries, &cfg->g_hardware) { if (!hw->h_flags) { - list_remove(&hw->h_entries); + ovs_list_remove(&hw->h_entries); lldpd_remote_cleanup(hw, NULL, true); lldpd_hardware_cleanup(cfg, hw); } else { @@ -151,7 +151,7 @@ lldpd_cleanup(struct lldpd *cfg) LIST_FOR_EACH_SAFE (chassis, chassis_next, list, &cfg->g_chassis) { if (chassis->c_refcount == 0) { - list_remove(&chassis->list); + ovs_list_remove(&chassis->list); lldpd_chassis_cleanup(chassis, 1); } } @@ -179,11 +179,11 @@ lldpd_move_chassis(struct lldpd_chassis *ochassis, * marshaling. */ memcpy(ochassis, chassis, sizeof *ochassis); - list_init(&ochassis->c_mgmt); + ovs_list_init(&ochassis->c_mgmt); /* Copy of management addresses */ LIST_FOR_EACH_POP (mgmt, m_entries, &chassis->c_mgmt) { - list_insert(&ochassis->c_mgmt, &mgmt->m_entries); + ovs_list_insert(&ochassis->c_mgmt, &mgmt->m_entries); } /* Restore saved values */ @@ -360,7 +360,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s, if (oport) { /* The port is known, remove it before adding it back */ - list_remove(&oport->p_entries); + ovs_list_remove(&oport->p_entries); lldpd_port_cleanup(oport, 1); free(oport); } @@ -373,8 +373,8 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s, VLOG_DBG("unknown chassis, add it to the list"); chassis->c_index = ++cfg->g_lastrid; chassis->c_refcount = 0; - list_push_back(&cfg->g_chassis, &chassis->list); - listsize = list_size(&cfg->g_chassis); + ovs_list_push_back(&cfg->g_chassis, &chassis->list); + listsize = ovs_list_size(&cfg->g_chassis); VLOG_DBG("%"PRIuSIZE " different systems are known", listsize); } @@ -383,7 +383,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s, port->p_lastframe = xmalloc(s + sizeof(struct lldpd_frame)); port->p_lastframe->size = s; memcpy(port->p_lastframe->frame, frame, s); - list_insert(&hw->h_rports, &port->p_entries); + ovs_list_insert(&hw->h_rports, &port->p_entries); port->p_chassis = chassis; port->p_chassis->c_refcount++; @@ -400,7 +400,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s, * freed with lldpd_port_cleanup() and therefore, the refcount * of the chassis that was attached to it is decreased. */ - i = list_size(&hw->h_rports); + i = ovs_list_size(&hw->h_rports); VLOG_DBG("%"PRIuSIZE " neighbors for %s", i, hw->h_ifname); if (!oport) { diff --git a/lib/lldp/lldpd.h b/lib/lldp/lldpd.h index fc2ae53..f77c6d5 100644 --- a/lib/lldp/lldpd.h +++ b/lib/lldp/lldpd.h @@ -71,7 +71,7 @@ struct lldpd { static inline struct lldpd_hardware * lldpd_first_hardware(struct lldpd *lldpd) { - return CONTAINER_OF(list_front(&lldpd->g_hardware), + return CONTAINER_OF(ovs_list_front(&lldpd->g_hardware), struct lldpd_hardware, h_entries); } diff --git a/lib/mac-learning.c b/lib/mac-learning.c index 6eda1fa..5a2ccba 100644 --- a/lib/mac-learning.c +++ b/lib/mac-learning.c @@ -101,9 +101,9 @@ mac_entry_set_port(struct mac_learning *ml, struct mac_entry *e, void *port) if (e->mlport) { struct mac_learning_port *mlport = e->mlport; - list_remove(&e->port_lru_node); + ovs_list_remove(&e->port_lru_node); - if (list_is_empty(&mlport->port_lrus)) { + if (ovs_list_is_empty(&mlport->port_lrus)) { ovs_assert(mlport->heap_node.priority == 1); hmap_remove(&ml->ports_by_ptr, &mlport->hmap_node); heap_remove(&ml->ports_by_usage, &mlport->heap_node); @@ -126,12 +126,12 @@ mac_entry_set_port(struct mac_learning *ml, struct mac_entry *e, void *port) hash_pointer(port, ml->secret)); heap_insert(&ml->ports_by_usage, &mlport->heap_node, 1); mlport->port = port; - list_init(&mlport->port_lrus); + ovs_list_init(&mlport->port_lrus); } else { heap_change(&ml->ports_by_usage, &mlport->heap_node, mlport->heap_node.priority + 1); } - list_push_back(&mlport->port_lrus, &e->port_lru_node); + ovs_list_push_back(&mlport->port_lrus, &e->port_lru_node); e->mlport = mlport; } } @@ -148,7 +148,7 @@ evict_mac_entry_fairly(struct mac_learning *ml) mlport = CONTAINER_OF(heap_max(&ml->ports_by_usage), struct mac_learning_port, heap_node); - e = CONTAINER_OF(list_front(&mlport->port_lrus), + e = CONTAINER_OF(ovs_list_front(&mlport->port_lrus), struct mac_entry, port_lru_node); mac_learning_expire(ml, e); } @@ -160,7 +160,7 @@ static bool get_lru(struct mac_learning *ml, struct mac_entry **e) OVS_REQ_RDLOCK(ml->rwlock) { - if (!list_is_empty(&ml->lrus)) { + if (!ovs_list_is_empty(&ml->lrus)) { *e = mac_entry_from_lru_node(ml->lrus.next); return true; } else { @@ -186,7 +186,7 @@ mac_learning_create(unsigned int idle_time) struct mac_learning *ml; ml = xmalloc(sizeof *ml); - list_init(&ml->lrus); + ovs_list_init(&ml->lrus); hmap_init(&ml->table); ml->secret = random_uint32(); ml->flood_vlans = NULL; @@ -321,14 +321,14 @@ mac_learning_insert(struct mac_learning *ml, e->mlport = NULL; COVERAGE_INC(mac_learning_learned); } else { - list_remove(&e->lru_node); + ovs_list_remove(&e->lru_node); } /* Mark 'e' as recently used. */ - list_push_back(&ml->lrus, &e->lru_node); + ovs_list_push_back(&ml->lrus, &e->lru_node); if (e->mlport) { - list_remove(&e->port_lru_node); - list_push_back(&e->mlport->port_lrus, &e->port_lru_node); + ovs_list_remove(&e->port_lru_node); + ovs_list_push_back(&e->mlport->port_lrus, &e->port_lru_node); } e->expires = time_now() + ml->idle_time; @@ -364,7 +364,7 @@ mac_learning_expire(struct mac_learning *ml, struct mac_entry *e) ml->need_revalidate = true; mac_entry_set_port(ml, e, NULL); hmap_remove(&ml->table, &e->hmap_node); - list_remove(&e->lru_node); + ovs_list_remove(&e->lru_node); free(e); } @@ -405,7 +405,7 @@ mac_learning_wait(struct mac_learning *ml) if (hmap_count(&ml->table) > ml->max_entries || ml->need_revalidate) { poll_immediate_wake(); - } else if (!list_is_empty(&ml->lrus)) { + } else if (!ovs_list_is_empty(&ml->lrus)) { struct mac_entry *e = mac_entry_from_lru_node(ml->lrus.next); poll_timer_wait_until(e->expires * 1000LL); } diff --git a/lib/mcast-snooping.c b/lib/mcast-snooping.c index 3560069..7fd0b9a 100644 --- a/lib/mcast-snooping.c +++ b/lib/mcast-snooping.c @@ -141,7 +141,7 @@ static bool group_get_lru(const struct mcast_snooping *ms, struct mcast_group **grp) OVS_REQ_RDLOCK(ms->rwlock) { - if (!list_is_empty(&ms->group_lru)) { + if (!ovs_list_is_empty(&ms->group_lru)) { *grp = mcast_group_from_lru_node(ms->group_lru.next); return true; } else { @@ -168,10 +168,10 @@ mcast_snooping_create(void) ms = xmalloc(sizeof *ms); hmap_init(&ms->table); - list_init(&ms->group_lru); - list_init(&ms->mrouter_lru); - list_init(&ms->fport_list); - list_init(&ms->rport_list); + ovs_list_init(&ms->group_lru); + ovs_list_init(&ms->mrouter_lru); + ovs_list_init(&ms->fport_list); + ovs_list_init(&ms->rport_list); ms->secret = random_uint32(); ms->idle_time = MCAST_ENTRY_DEFAULT_IDLE_TIME; ms->max_entries = MCAST_DEFAULT_MAX_ENTRIES; @@ -281,15 +281,15 @@ mcast_group_insert_bundle(struct mcast_snooping *ms OVS_UNUSED, b = mcast_group_bundle_lookup(ms, grp, port); if (b) { - list_remove(&b->bundle_node); + ovs_list_remove(&b->bundle_node); } else { b = xmalloc(sizeof *b); - list_init(&b->bundle_node); + ovs_list_init(&b->bundle_node); b->port = port; } b->expires = time_now() + idle_time; - list_push_back(&grp->bundle_lru, &b->bundle_node); + ovs_list_push_back(&grp->bundle_lru, &b->bundle_node); return b; } @@ -298,7 +298,7 @@ mcast_group_insert_bundle(struct mcast_snooping *ms OVS_UNUSED, static bool mcast_group_has_bundles(struct mcast_group *grp) { - return !list_is_empty(&grp->bundle_lru); + return !ovs_list_is_empty(&grp->bundle_lru); } /* Delete 'grp' from the 'ms' hash table. @@ -307,9 +307,9 @@ static void mcast_snooping_flush_group__(struct mcast_snooping *ms, struct mcast_group *grp) { - ovs_assert(list_is_empty(&grp->bundle_lru)); + ovs_assert(ovs_list_is_empty(&grp->bundle_lru)); hmap_remove(&ms->table, &grp->hmap_node); - list_remove(&grp->group_node); + ovs_list_remove(&grp->group_node); free(grp); } @@ -339,7 +339,7 @@ mcast_group_delete_bundle(struct mcast_snooping *ms OVS_UNUSED, LIST_FOR_EACH (b, bundle_node, &grp->bundle_lru) { if (b->port == port) { - list_remove(&b->bundle_node); + ovs_list_remove(&b->bundle_node); free(b); return true; } @@ -364,7 +364,7 @@ mcast_snooping_prune_expired(struct mcast_snooping *ms, if (b->expires > timenow) { break; } - list_remove(&b->bundle_node); + ovs_list_remove(&b->bundle_node); free(b); expired++; } @@ -414,17 +414,17 @@ mcast_snooping_add_group(struct mcast_snooping *ms, hmap_insert(&ms->table, &grp->hmap_node, hash); grp->addr = *addr; grp->vlan = vlan; - list_init(&grp->bundle_lru); + ovs_list_init(&grp->bundle_lru); learned = true; ms->need_revalidate = true; COVERAGE_INC(mcast_snooping_learned); } else { - list_remove(&grp->group_node); + ovs_list_remove(&grp->group_node); } mcast_group_insert_bundle(ms, grp, port, ms->idle_time); /* Mark 'grp' as recently used. */ - list_push_back(&ms->group_lru, &grp->group_node); + ovs_list_push_back(&ms->group_lru, &grp->group_node); return learned; } @@ -617,7 +617,7 @@ mrouter_get_lru(const struct mcast_snooping *ms, struct mcast_mrouter_bundle **m) OVS_REQ_RDLOCK(ms->rwlock) { - if (!list_is_empty(&ms->mrouter_lru)) { + if (!ovs_list_is_empty(&ms->mrouter_lru)) { *m = mcast_mrouter_from_lru_node(ms->mrouter_lru.next); return true; } else { @@ -655,7 +655,7 @@ mcast_snooping_add_mrouter(struct mcast_snooping *ms, uint16_t vlan, mrouter = mcast_snooping_mrouter_lookup(ms, vlan, port); if (mrouter) { - list_remove(&mrouter->mrouter_node); + ovs_list_remove(&mrouter->mrouter_node); } else { mrouter = xmalloc(sizeof *mrouter); mrouter->vlan = vlan; @@ -665,14 +665,14 @@ mcast_snooping_add_mrouter(struct mcast_snooping *ms, uint16_t vlan, } mrouter->expires = time_now() + MCAST_MROUTER_PORT_IDLE_TIME; - list_push_back(&ms->mrouter_lru, &mrouter->mrouter_node); + ovs_list_push_back(&ms->mrouter_lru, &mrouter->mrouter_node); return ms->need_revalidate; } static void mcast_snooping_flush_mrouter(struct mcast_mrouter_bundle *mrouter) { - list_remove(&mrouter->mrouter_node); + ovs_list_remove(&mrouter->mrouter_node); free(mrouter); } @@ -690,7 +690,7 @@ static bool mcast_snooping_port_get(const struct ovs_list *list, struct mcast_port_bundle **f) { - if (!list_is_empty(list)) { + if (!ovs_list_is_empty(list)) { *f = mcast_port_from_list_node(list->next); return true; } else { @@ -719,13 +719,13 @@ mcast_snooping_add_port(struct ovs_list *list, void *port) pbundle = xmalloc(sizeof *pbundle); pbundle->port = port; - list_insert(list, &pbundle->node); + ovs_list_insert(list, &pbundle->node); } static void mcast_snooping_flush_port(struct mcast_port_bundle *pbundle) { - list_remove(&pbundle->node); + ovs_list_remove(&pbundle->node); free(pbundle); } @@ -912,13 +912,13 @@ mcast_snooping_wait__(struct mcast_snooping *ms) long long int mrouter_msec; long long int msec = 0; - if (!list_is_empty(&ms->group_lru)) { + if (!ovs_list_is_empty(&ms->group_lru)) { grp = mcast_group_from_lru_node(ms->group_lru.next); bundle = mcast_group_bundle_from_lru_node(grp->bundle_lru.next); msec = bundle->expires * 1000LL; } - if (!list_is_empty(&ms->mrouter_lru)) { + if (!ovs_list_is_empty(&ms->mrouter_lru)) { mrouter = mcast_mrouter_from_lru_node(ms->mrouter_lru.next); mrouter_msec = mrouter->expires * 1000LL; msec = msec ? MIN(msec, mrouter_msec) : mrouter_msec; diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index b3e4d49..4bd60f4 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -455,7 +455,7 @@ dpdk_mp_get(int socket_id, int mtu) OVS_REQUIRES(dpdk_mutex) VLOG_DBG("Allocated \"%s\" mempool with %u mbufs", mp_name, mp_size ); } - list_push_back(&dpdk_mp_list, &dmp->list_node); + ovs_list_push_back(&dpdk_mp_list, &dmp->list_node); return dmp; } @@ -733,7 +733,7 @@ netdev_dpdk_init(struct netdev *netdev_, unsigned int port_no, netdev_dpdk_alloc_txq(netdev, OVS_VHOST_MAX_QUEUE_NUM); } - list_push_back(&dpdk_list, &netdev->list_node); + ovs_list_push_back(&dpdk_list, &netdev->list_node); unlock: if (err) { @@ -859,7 +859,7 @@ netdev_dpdk_destruct(struct netdev *netdev_) ovs_mutex_lock(&dpdk_mutex); rte_free(dev->tx_q); - list_remove(&dev->list_node); + ovs_list_remove(&dev->list_node); dpdk_mp_put(dev->dpdk_mp); ovs_mutex_unlock(&dpdk_mutex); } @@ -883,7 +883,7 @@ netdev_dpdk_vhost_destruct(struct netdev *netdev_) ovs_mutex_lock(&dpdk_mutex); rte_free(dev->tx_q); - list_remove(&dev->list_node); + ovs_list_remove(&dev->list_node); dpdk_mp_put(dev->dpdk_mp); ovs_mutex_unlock(&dpdk_mutex); } @@ -2314,7 +2314,7 @@ dpdk_ring_create(const char dev_name[], unsigned int port_no, ivshmem->user_port_id = port_no; ivshmem->eth_port_id = rte_eth_dev_count() - 1; - list_push_back(&dpdk_ring_list, &ivshmem->list_node); + ovs_list_push_back(&dpdk_ring_list, &ivshmem->list_node); *eth_port_id = ivshmem->eth_port_id; return 0; diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c index 95b4c5f..a5a6e2b 100644 --- a/lib/netdev-dummy.c +++ b/lib/netdev-dummy.c @@ -127,7 +127,7 @@ struct netdev_rxq_dummy { struct netdev_rxq up; struct ovs_list node; /* In netdev_dummy's "rxes" list. */ struct ovs_list recv_queue; - int recv_queue_len; /* list_size(&recv_queue). */ + int recv_queue_len; /* ovs_list_size(&recv_queue). */ struct seq *seq; /* Reports newly queued packets. */ }; @@ -165,7 +165,7 @@ dummy_packet_stream_init(struct dummy_packet_stream *s, struct stream *stream) int rxbuf_size = stream ? 2048 : 0; s->stream = stream; dp_packet_init(&s->rxbuf, rxbuf_size); - list_init(&s->txq); + ovs_list_init(&s->txq); } static struct dummy_packet_stream * @@ -183,7 +183,7 @@ static void dummy_packet_stream_wait(struct dummy_packet_stream *s) { stream_run_wait(s->stream); - if (!list_is_empty(&s->txq)) { + if (!ovs_list_is_empty(&s->txq)) { stream_send_wait(s->stream); } stream_recv_wait(s->stream); @@ -192,7 +192,7 @@ dummy_packet_stream_wait(struct dummy_packet_stream *s) static void dummy_packet_stream_send(struct dummy_packet_stream *s, const void *buffer, size_t size) { - if (list_size(&s->txq) < NETDEV_DUMMY_MAX_QUEUE) { + if (ovs_list_size(&s->txq) < NETDEV_DUMMY_MAX_QUEUE) { struct dp_packet *b; struct pkt_list_node *node; @@ -201,7 +201,7 @@ dummy_packet_stream_send(struct dummy_packet_stream *s, const void *buffer, size node = xmalloc(sizeof *node); node->pkt = b; - list_push_back(&s->txq, &node->list_node); + ovs_list_push_back(&s->txq, &node->list_node); } } @@ -213,19 +213,19 @@ dummy_packet_stream_run(struct netdev_dummy *dev, struct dummy_packet_stream *s) stream_run(s->stream); - if (!list_is_empty(&s->txq)) { + if (!ovs_list_is_empty(&s->txq)) { struct pkt_list_node *txbuf_node; struct dp_packet *txbuf; int retval; - ASSIGN_CONTAINER(txbuf_node, list_front(&s->txq), list_node); + ASSIGN_CONTAINER(txbuf_node, ovs_list_front(&s->txq), list_node); txbuf = txbuf_node->pkt; retval = stream_send(s->stream, dp_packet_data(txbuf), dp_packet_size(txbuf)); if (retval > 0) { dp_packet_pull(txbuf, retval); if (!dp_packet_size(txbuf)) { - list_remove(&txbuf_node->list_node); + ovs_list_remove(&txbuf_node->list_node); free(txbuf_node); dp_packet_delete(txbuf); } @@ -664,11 +664,11 @@ netdev_dummy_construct(struct netdev *netdev_) dummy_packet_conn_init(&netdev->conn); - list_init(&netdev->rxes); + ovs_list_init(&netdev->rxes); ovs_mutex_unlock(&netdev->mutex); ovs_mutex_lock(&dummy_list_mutex); - list_push_back(&dummy_list, &netdev->list_node); + ovs_list_push_back(&dummy_list, &netdev->list_node); ovs_mutex_unlock(&dummy_list_mutex); return 0; @@ -680,7 +680,7 @@ netdev_dummy_destruct(struct netdev *netdev_) struct netdev_dummy *netdev = netdev_dummy_cast(netdev_); ovs_mutex_lock(&dummy_list_mutex); - list_remove(&netdev->list_node); + ovs_list_remove(&netdev->list_node); ovs_mutex_unlock(&dummy_list_mutex); ovs_mutex_lock(&netdev->mutex); @@ -820,8 +820,8 @@ netdev_dummy_rxq_construct(struct netdev_rxq *rxq_) struct netdev_dummy *netdev = netdev_dummy_cast(rx->up.netdev); ovs_mutex_lock(&netdev->mutex); - list_push_back(&netdev->rxes, &rx->node); - list_init(&rx->recv_queue); + ovs_list_push_back(&netdev->rxes, &rx->node); + ovs_list_init(&rx->recv_queue); rx->recv_queue_len = 0; rx->seq = seq_create(); ovs_mutex_unlock(&netdev->mutex); @@ -836,7 +836,7 @@ netdev_dummy_rxq_destruct(struct netdev_rxq *rxq_) struct netdev_dummy *netdev = netdev_dummy_cast(rx->up.netdev); ovs_mutex_lock(&netdev->mutex); - list_remove(&rx->node); + ovs_list_remove(&rx->node); pkt_list_delete(&rx->recv_queue); ovs_mutex_unlock(&netdev->mutex); seq_destroy(rx->seq); @@ -859,10 +859,10 @@ netdev_dummy_rxq_recv(struct netdev_rxq *rxq_, struct dp_packet **arr, struct dp_packet *packet; ovs_mutex_lock(&netdev->mutex); - if (!list_is_empty(&rx->recv_queue)) { + if (!ovs_list_is_empty(&rx->recv_queue)) { struct pkt_list_node *pkt_node; - ASSIGN_CONTAINER(pkt_node, list_pop_front(&rx->recv_queue), list_node); + ASSIGN_CONTAINER(pkt_node, ovs_list_pop_front(&rx->recv_queue), list_node); packet = pkt_node->pkt; free(pkt_node); rx->recv_queue_len--; @@ -895,7 +895,7 @@ netdev_dummy_rxq_wait(struct netdev_rxq *rxq_) uint64_t seq = seq_read(rx->seq); ovs_mutex_lock(&netdev->mutex); - if (!list_is_empty(&rx->recv_queue)) { + if (!ovs_list_is_empty(&rx->recv_queue)) { poll_immediate_wake(); } else { seq_wait(rx->seq, seq); @@ -1319,7 +1319,7 @@ netdev_dummy_queue_packet__(struct netdev_rxq_dummy *rx, struct dp_packet *packe struct pkt_list_node *pkt_node = xmalloc(sizeof *pkt_node); pkt_node->pkt = packet; - list_push_back(&rx->recv_queue, &pkt_node->list_node); + ovs_list_push_back(&rx->recv_queue, &pkt_node->list_node); rx->recv_queue_len++; seq_change(rx->seq); } diff --git a/lib/netdev.c b/lib/netdev.c index fdcf405..0f0473e 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -381,7 +381,7 @@ netdev_open(const char *name, const char *type, struct netdev **netdevp) netdev->n_rxq = netdev->netdev_class->rxq_alloc ? 1 : 0; netdev->requested_n_rxq = netdev->n_rxq; - list_init(&netdev->saved_flags_list); + ovs_list_init(&netdev->saved_flags_list); error = rc->class->construct(netdev); if (!error) { @@ -389,7 +389,7 @@ netdev_open(const char *name, const char *type, struct netdev **netdevp) netdev_change_seq_changed(netdev); } else { free(netdev->name); - ovs_assert(list_is_empty(&netdev->saved_flags_list)); + ovs_assert(ovs_list_is_empty(&netdev->saved_flags_list)); shash_delete(&netdev_shash, netdev->node); rc->class->dealloc(netdev); } @@ -1178,7 +1178,7 @@ do_update_flags(struct netdev *netdev, enum netdev_flags off, ovs_mutex_lock(&netdev_mutex); *sfp = sf = xmalloc(sizeof *sf); sf->netdev = netdev; - list_push_front(&netdev->saved_flags_list, &sf->node); + ovs_list_push_front(&netdev->saved_flags_list, &sf->node); sf->saved_flags = changed_flags; sf->saved_values = changed_flags & new_flags; @@ -1259,7 +1259,7 @@ netdev_restore_flags(struct netdev_saved_flags *sf) &old_flags); ovs_mutex_lock(&netdev_mutex); - list_remove(&sf->node); + ovs_list_remove(&sf->node); free(sf); netdev_unref(netdev); } diff --git a/lib/netlink-notifier.c b/lib/netlink-notifier.c index 45c9188..4db5e3c 100644 --- a/lib/netlink-notifier.c +++ b/lib/netlink-notifier.c @@ -73,7 +73,7 @@ nln_create(int protocol, int multicast_group, nln_parse_func *parse, nln->change = change; nln->has_run = false; - list_init(&nln->all_notifiers); + ovs_list_init(&nln->all_notifiers); return nln; } @@ -86,7 +86,7 @@ void nln_destroy(struct nln *nln) { if (nln) { - ovs_assert(list_is_empty(&nln->all_notifiers)); + ovs_assert(ovs_list_is_empty(&nln->all_notifiers)); nl_sock_destroy(nln->notify_sock); free(nln); } @@ -127,7 +127,7 @@ nln_notifier_create(struct nln *nln, nln_notify_func *cb, void *aux) } notifier = xmalloc(sizeof *notifier); - list_push_back(&nln->all_notifiers, ¬ifier->node); + ovs_list_push_back(&nln->all_notifiers, ¬ifier->node); notifier->cb = cb; notifier->aux = aux; notifier->nln = nln; @@ -142,8 +142,8 @@ nln_notifier_destroy(struct nln_notifier *notifier) if (notifier) { struct nln *nln = notifier->nln; - list_remove(¬ifier->node); - if (list_is_empty(&nln->all_notifiers)) { + ovs_list_remove(¬ifier->node); + if (ovs_list_is_empty(&nln->all_notifiers)) { nl_sock_destroy(nln->notify_sock); nln->notify_sock = NULL; } diff --git a/lib/nx-match.c b/lib/nx-match.c index 5cad24c..6b02eb1 100644 --- a/lib/nx-match.c +++ b/lib/nx-match.c @@ -2010,7 +2010,7 @@ nxm_init(void) hmap_init(&nxm_header_map); hmap_init(&nxm_name_map); for (int i = 0; i < MFF_N_IDS; i++) { - list_init(&nxm_mf_map[i]); + ovs_list_init(&nxm_mf_map[i]); } for (struct nxm_field_index *nfi = all_nxm_fields; nfi < &all_nxm_fields[ARRAY_SIZE(all_nxm_fields)]; nfi++) { @@ -2018,7 +2018,7 @@ nxm_init(void) hash_uint64(nxm_no_len(nfi->nf.header))); hmap_insert(&nxm_name_map, &nfi->name_node, hash_string(nfi->nf.name, 0)); - list_push_back(&nxm_mf_map[nfi->nf.id], &nfi->mf_node); + ovs_list_push_back(&nxm_mf_map[nfi->nf.id], &nfi->mf_node); } ovsthread_once_done(&once); } diff --git a/lib/ofp-msgs.c b/lib/ofp-msgs.c index 9d35df6..9f623c0 100644 --- a/lib/ofp-msgs.c +++ b/lib/ofp-msgs.c @@ -921,10 +921,10 @@ ofpmp_init(struct ovs_list *replies, const struct ofp_header *request) { struct ofpbuf *msg; - list_init(replies); + ovs_list_init(replies); msg = ofpraw_alloc_stats_reply(request, 1000); - list_push_back(replies, &msg->list_node); + ovs_list_push_back(replies, &msg->list_node); } /* Prepares to append up to 'len' bytes to the series of statistics replies in @@ -937,7 +937,7 @@ ofpmp_init(struct ovs_list *replies, const struct ofp_header *request) struct ofpbuf * ofpmp_reserve(struct ovs_list *replies, size_t len) { - struct ofpbuf *msg = ofpbuf_from_list(list_back(replies)); + struct ofpbuf *msg = ofpbuf_from_list(ovs_list_back(replies)); if (msg->size + len <= UINT16_MAX) { ofpbuf_prealloc_tailroom(msg, len); @@ -954,7 +954,7 @@ ofpmp_reserve(struct ovs_list *replies, size_t len) ofpbuf_put(next, msg->data, hdrs_len); next->header = next->data; next->msg = ofpbuf_tail(next); - list_push_back(replies, &next->list_node); + ovs_list_push_back(replies, &next->list_node); *ofpmp_flags__(msg->data) |= htons(OFPSF_REPLY_MORE); @@ -983,7 +983,7 @@ ofpmp_append(struct ovs_list *replies, size_t len) void ofpmp_postappend(struct ovs_list *replies, size_t start_ofs) { - struct ofpbuf *msg = ofpbuf_from_list(list_back(replies)); + struct ofpbuf *msg = ofpbuf_from_list(ovs_list_back(replies)); ovs_assert(start_ofs <= UINT16_MAX); if (msg->size > UINT16_MAX) { @@ -999,7 +999,7 @@ ofpmp_postappend(struct ovs_list *replies, size_t start_ofs) enum ofp_version ofpmp_version(struct ovs_list *replies) { - struct ofpbuf *msg = ofpbuf_from_list(list_back(replies)); + struct ofpbuf *msg = ofpbuf_from_list(ovs_list_back(replies)); const struct ofp_header *oh = msg->data; return oh->version; @@ -1010,7 +1010,7 @@ ofpmp_version(struct ovs_list *replies) enum ofpraw ofpmp_decode_raw(struct ovs_list *replies) { - struct ofpbuf *msg = ofpbuf_from_list(list_back(replies)); + struct ofpbuf *msg = ofpbuf_from_list(ovs_list_back(replies)); enum ofperr error; enum ofpraw raw; diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c index 438270a..9b6db3a 100644 --- a/lib/ofp-parse.c +++ b/lib/ofp-parse.c @@ -1399,7 +1399,7 @@ parse_ofp_group_mod_str__(struct ofputil_group_mod *gm, uint16_t command, gm->command = command; gm->group_id = OFPG_ANY; gm->command_bucket_id = OFPG15_BUCKET_ALL; - list_init(&gm->buckets); + ovs_list_init(&gm->buckets); if (command == OFPGC11_DELETE && string[0] == '\0') { gm->group_id = OFPG_ALL; return NULL; @@ -1569,7 +1569,7 @@ parse_ofp_group_mod_str__(struct ofputil_group_mod *gm, uint16_t command, free(bucket); goto out; } - list_push_back(&gm->buckets, &bucket->list_node); + ovs_list_push_back(&gm->buckets, &bucket->list_node); if (gm->type != OFPGT11_SELECT && bucket->weight) { error = xstrdup("Only select groups can have bucket weights."); @@ -1578,7 +1578,7 @@ parse_ofp_group_mod_str__(struct ofputil_group_mod *gm, uint16_t command, bkt_str = next_bkt_str; } - if (gm->type == OFPGT11_INDIRECT && !list_is_short(&gm->buckets)) { + if (gm->type == OFPGT11_INDIRECT && !ovs_list_is_short(&gm->buckets)) { error = xstrdup("Indirect groups can have at most one bucket."); goto out; } @@ -1638,7 +1638,7 @@ parse_ofp_group_mod_file(const char *file_name, uint16_t command, new_gms = x2nrealloc(*gms, &allocated_gms, sizeof **gms); for (i = 0; i < *n_gms; i++) { - list_moved(&new_gms[i].buckets, &(*gms)[i].buckets); + ovs_list_moved(&new_gms[i].buckets, &(*gms)[i].buckets); } *gms = new_gms; } @@ -1680,7 +1680,7 @@ parse_ofp_tlv_table_mod_str(struct ofputil_tlv_table_mod *ttm, *usable_protocols = OFPUTIL_P_NXM_OXM_ANY; ttm->command = command; - list_init(&ttm->mappings); + ovs_list_init(&ttm->mappings); while (*s) { struct ofputil_tlv_map *map = xmalloc(sizeof *map); @@ -1690,7 +1690,7 @@ parse_ofp_tlv_table_mod_str(struct ofputil_tlv_table_mod *ttm, s++; } - list_push_back(&ttm->mappings, &map->list_node); + ovs_list_push_back(&ttm->mappings, &map->list_node); if (!ovs_scan(s, "{class=%"SCNi16",type=%"SCNi8",len=%"SCNi8"}->tun_metadata%"SCNi16"%n", &map->option_class, &map->option_type, &map->option_len, diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 97e4608..7729138 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -1879,7 +1879,7 @@ void ofputil_append_meter_config(struct ovs_list *replies, const struct ofputil_meter_config *mc) { - struct ofpbuf *msg = ofpbuf_from_list(list_back(replies)); + struct ofpbuf *msg = ofpbuf_from_list(ovs_list_back(replies)); size_t start_ofs = msg->size; struct ofp13_meter_config *reply; @@ -2418,8 +2418,8 @@ ofputil_start_queue_get_config_reply(const struct ofp_header *request, OVS_NOT_REACHED(); } - list_init(replies); - list_push_back(replies, &reply->list_node); + ovs_list_init(replies); + ovs_list_push_back(replies, &reply->list_node); } static void @@ -2450,7 +2450,7 @@ ofputil_append_queue_get_config_reply(const struct ofputil_queue_config *qc, struct ovs_list *replies) { enum ofp_version ofp_version = ofpmp_version(replies); - struct ofpbuf *reply = ofpbuf_from_list(list_back(replies)); + struct ofpbuf *reply = ofpbuf_from_list(ovs_list_back(replies)); size_t start_ofs = reply->size; size_t len_ofs; ovs_be16 *len; @@ -2995,7 +2995,7 @@ void ofputil_append_flow_stats_reply(const struct ofputil_flow_stats *fs, struct ovs_list *replies) { - struct ofpbuf *reply = ofpbuf_from_list(list_back(replies)); + struct ofpbuf *reply = ofpbuf_from_list(ovs_list_back(replies)); size_t start_ofs = reply->size; enum ofp_version version = ofpmp_version(replies); enum ofpraw raw = ofpmp_decode_raw(replies); @@ -4535,7 +4535,7 @@ void ofputil_append_port_desc_stats_reply(const struct ofputil_phy_port *pp, struct ovs_list *replies) { - struct ofpbuf *reply = ofpbuf_from_list(list_back(replies)); + struct ofpbuf *reply = ofpbuf_from_list(ovs_list_back(replies)); size_t start_ofs = reply->size; ofputil_put_phy_port(ofpmp_version(replies), pp, reply); @@ -5403,7 +5403,7 @@ void ofputil_append_table_features_reply(const struct ofputil_table_features *tf, struct ovs_list *replies) { - struct ofpbuf *reply = ofpbuf_from_list(list_back(replies)); + struct ofpbuf *reply = ofpbuf_from_list(ovs_list_back(replies)); enum ofp_version version = ofpmp_version(replies); size_t start_ofs = reply->size; struct ofp13_table_features *otf; @@ -5549,7 +5549,7 @@ ofputil_append_table_desc_reply(const struct ofputil_table_desc *td, struct ovs_list *replies, enum ofp_version version) { - struct ofpbuf *reply = ofpbuf_from_list(list_back(replies)); + struct ofpbuf *reply = ofpbuf_from_list(ovs_list_back(replies)); size_t start_otd; struct ofp14_table_desc *otd; @@ -6744,8 +6744,8 @@ ofputil_start_flow_update(struct ovs_list *replies) msg = ofpraw_alloc_xid(OFPRAW_NXST_FLOW_MONITOR_REPLY, OFP10_VERSION, htonl(0), 1024); - list_init(replies); - list_push_back(replies, &msg->list_node); + ovs_list_init(replies); + ovs_list_push_back(replies, &msg->list_node); } void @@ -6757,7 +6757,7 @@ ofputil_append_flow_update(const struct ofputil_flow_update *update, struct ofpbuf *msg; size_t start_ofs; - msg = ofpbuf_from_list(list_back(replies)); + msg = ofpbuf_from_list(ovs_list_back(replies)); start_ofs = msg->size; if (update->event == NXFME_ABBREV) { @@ -7828,7 +7828,7 @@ ofputil_bucket_clone_list(struct ovs_list *dest, const struct ovs_list *src, } new_bucket = ofputil_bucket_clone_data(bucket); - list_push_back(dest, &new_bucket->list_node); + ovs_list_push_back(dest, &new_bucket->list_node); } } @@ -7880,7 +7880,7 @@ ofputil_bucket_list_front(const struct ovs_list *buckets) { static struct ofputil_bucket *bucket; - ASSIGN_CONTAINER(bucket, list_front(buckets), list_node); + ASSIGN_CONTAINER(bucket, ovs_list_front(buckets), list_node); return bucket; } @@ -7892,7 +7892,7 @@ ofputil_bucket_list_back(const struct ovs_list *buckets) { static struct ofputil_bucket *bucket; - ASSIGN_CONTAINER(bucket, list_back(buckets), list_node); + ASSIGN_CONTAINER(bucket, ovs_list_back(buckets), list_node); return bucket; } @@ -8318,7 +8318,7 @@ ofputil_append_ofp11_group_desc_reply(const struct ofputil_group_desc *gds, struct ovs_list *replies, enum ofp_version version) { - struct ofpbuf *reply = ofpbuf_from_list(list_back(replies)); + struct ofpbuf *reply = ofpbuf_from_list(ovs_list_back(replies)); struct ofp11_group_desc_stats *ogds; struct ofputil_bucket *bucket; size_t start_ogds; @@ -8342,7 +8342,7 @@ ofputil_append_ofp15_group_desc_reply(const struct ofputil_group_desc *gds, struct ovs_list *replies, enum ofp_version version) { - struct ofpbuf *reply = ofpbuf_from_list(list_back(replies)); + struct ofpbuf *reply = ofpbuf_from_list(ovs_list_back(replies)); struct ofp15_group_desc_stats *ogds; struct ofputil_bucket *bucket; size_t start_ogds, start_buckets; @@ -8406,7 +8406,7 @@ ofputil_pull_ofp11_buckets(struct ofpbuf *msg, size_t buckets_length, struct ofp11_bucket *ob; uint32_t bucket_id = 0; - list_init(buckets); + ovs_list_init(buckets); while (buckets_length > 0) { struct ofputil_bucket *bucket; struct ofpbuf ofpacts; @@ -8457,7 +8457,7 @@ ofputil_pull_ofp11_buckets(struct ofpbuf *msg, size_t buckets_length, bucket->ofpacts = ofpbuf_steal_data(&ofpacts); bucket->ofpacts_len = ofpacts.size; - list_push_back(buckets, &bucket->list_node); + ovs_list_push_back(buckets, &bucket->list_node); } return 0; @@ -8470,7 +8470,7 @@ ofputil_pull_ofp15_buckets(struct ofpbuf *msg, size_t buckets_length, { struct ofp15_bucket *ob; - list_init(buckets); + ovs_list_init(buckets); while (buckets_length > 0) { struct ofputil_bucket *bucket = NULL; struct ofpbuf ofpacts; @@ -8570,7 +8570,7 @@ ofputil_pull_ofp15_buckets(struct ofpbuf *msg, size_t buckets_length, bucket->ofpacts = ofpbuf_steal_data(&ofpacts); bucket->ofpacts_len = ofpacts.size; - list_push_back(buckets, &bucket->list_node); + ovs_list_push_back(buckets, &bucket->list_node); continue; @@ -9042,7 +9042,7 @@ ofputil_pull_ofp11_group_mod(struct ofpbuf *msg, enum ofp_version ofp_version, if (!error && ofp_version >= OFP13_VERSION && gm->command == OFPGC11_DELETE - && !list_is_empty(&gm->buckets)) { + && !ovs_list_is_empty(&gm->buckets)) { error = OFPERR_OFPGMFC_INVALID_GROUP; } @@ -9140,7 +9140,7 @@ ofputil_decode_group_mod(const struct ofp_header *oh, switch (gm->type) { case OFPGT11_INDIRECT: - if (!list_is_singleton(&gm->buckets)) { + if (!ovs_list_is_singleton(&gm->buckets)) { return OFPERR_OFPGMFC_INVALID_GROUP; } break; @@ -9159,7 +9159,7 @@ ofputil_decode_group_mod(const struct ofp_header *oh, case OFPGC15_INSERT_BUCKET: break; case OFPGC15_REMOVE_BUCKET: - if (!list_is_empty(&gm->buckets)) { + if (!ovs_list_is_empty(&gm->buckets)) { return OFPERR_OFPGMFC_BAD_BUCKET; } break; @@ -9764,7 +9764,7 @@ static enum ofperr decode_tlv_table_mappings(struct ofpbuf *msg, unsigned int max_fields, struct ovs_list *mappings) { - list_init(mappings); + ovs_list_init(mappings); while (msg->size) { struct nx_tlv_map *nx_map; @@ -9772,7 +9772,7 @@ decode_tlv_table_mappings(struct ofpbuf *msg, unsigned int max_fields, nx_map = ofpbuf_pull(msg, sizeof *nx_map); map = xmalloc(sizeof *map); - list_push_back(mappings, &map->list_node); + ovs_list_push_back(mappings, &map->list_node); map->option_class = ntohs(nx_map->option_class); map->option_type = nx_map->option_type; diff --git a/lib/ofpbuf.c b/lib/ofpbuf.c index cd83b57..22ebce6 100644 --- a/lib/ofpbuf.c +++ b/lib/ofpbuf.c @@ -29,7 +29,7 @@ ofpbuf_init__(struct ofpbuf *b, size_t allocated, enum ofpbuf_source source) b->source = source; b->header = NULL; b->msg = NULL; - list_poison(&b->list_node); + ovs_list_poison(&b->list_node); } static void diff --git a/lib/ovs-atomic.h b/lib/ovs-atomic.h index b38c9ef..c8e616c 100644 --- a/lib/ovs-atomic.h +++ b/lib/ovs-atomic.h @@ -596,7 +596,7 @@ ovs_refcount_try_ref_rcu(struct ovs_refcount *refcount) * * if (stp && ovs_refcount_unref_relaxed(&stp->ref_cnt) == 1) { * ovs_mutex_lock(&mutex); - * list_remove(&stp->node); + * ovs_list_remove(&stp->node); * ovs_mutex_unlock(&mutex); * free(stp->name); * free(stp); diff --git a/lib/ovs-lldp.c b/lib/ovs-lldp.c index b789677..55fc232 100644 --- a/lib/ovs-lldp.c +++ b/lib/ovs-lldp.c @@ -257,7 +257,7 @@ aa_print_isid_status_port_isid(struct lldp *lldp, struct lldpd_port *port) { struct lldpd_aa_isid_vlan_maps_tlv *mapping; - if (list_is_empty(&port->p_isid_vlan_maps)) { + if (ovs_list_is_empty(&port->p_isid_vlan_maps)) { return; } @@ -396,7 +396,7 @@ update_mapping_on_lldp(struct lldp *lldp, struct lldpd_hardware *hardware, lm->isid_vlan_data.isid = m->isid; lm->isid_vlan_data.vlan = m->vlan; - list_push_back(&hardware->h_lport.p_isid_vlan_maps, &lm->m_entries); + ovs_list_push_back(&hardware->h_lport.p_isid_vlan_maps, &lm->m_entries); /* TODO Should be done in the Auto Attach state machine when a mapping goes * from "pending" to "active". @@ -407,7 +407,7 @@ update_mapping_on_lldp(struct lldp *lldp, struct lldpd_hardware *hardware, node->vlan = m->vlan; node->oper = BRIDGE_AA_VLAN_OPER_ADD; - list_push_back(&lldp->active_mapping_queue, &node->list_node); + ovs_list_push_back(&lldp->active_mapping_queue, &node->list_node); } /* Bridge will poll the list of VLAN that needs to be auto configure based on @@ -431,7 +431,7 @@ aa_get_vlan_queued(struct ovs_list *list) copy->vlan = node->vlan; copy->oper = node->oper; - list_push_back(list, ©->list_node); + ovs_list_push_back(list, ©->list_node); /* Cleanup */ free(node->port_name); @@ -455,7 +455,7 @@ aa_get_vlan_queue_size(void) ovs_mutex_lock(&mutex); HMAP_FOR_EACH (lldp, hmap_node, all_lldps) { - size += list_size(&lldp->active_mapping_queue); + size += ovs_list_size(&lldp->active_mapping_queue); } ovs_mutex_unlock(&mutex); @@ -570,7 +570,7 @@ aa_mapping_unregister_mapping(struct lldp *lldp, isid, lm->isid_vlan_data.vlan); - list_remove(&lm->m_entries); + ovs_list_remove(&lm->m_entries); /* TODO Should be done in the AA SM when a mapping goes * from "pending" to "active". @@ -581,7 +581,7 @@ aa_mapping_unregister_mapping(struct lldp *lldp, node->vlan = m->vlan; node->oper = BRIDGE_AA_VLAN_OPER_REMOVE; - list_push_back(&lldp->active_mapping_queue, &node->list_node); + ovs_list_push_back(&lldp->active_mapping_queue, &node->list_node); break; } @@ -784,7 +784,7 @@ lldp_create(const struct netdev *netdev, hmap_init(&lldp->mappings_by_isid); hmap_init(&lldp->mappings_by_aux); - list_init(&lldp->active_mapping_queue); + ovs_list_init(&lldp->active_mapping_queue); lchassis = xzalloc(sizeof *lchassis); lchassis->c_cap_available = LLDP_CAP_BRIDGE; @@ -796,13 +796,13 @@ lldp_create(const struct netdev *netdev, netdev_get_etheraddr(netdev, mac); lchassis->c_id = &mac->ea[0]; - list_init(&lchassis->c_mgmt); + ovs_list_init(&lchassis->c_mgmt); lchassis->c_ttl = lldp->lldpd->g_config.c_tx_interval * lldp->lldpd->g_config.c_tx_hold; lchassis->c_ttl = LLDP_CHASSIS_TTL; lldpd_assign_cfg_to_protocols(lldp->lldpd); - list_init(&lldp->lldpd->g_chassis); - list_push_back(&lldp->lldpd->g_chassis, &lchassis->list); + ovs_list_init(&lldp->lldpd->g_chassis); + ovs_list_push_back(&lldp->lldpd->g_chassis, &lchassis->list); if ((hw = lldpd_alloc_hardware(lldp->lldpd, (char *) netdev_get_name(netdev), @@ -834,9 +834,9 @@ lldp_create(const struct netdev *netdev, hw->h_lport.p_element.system_id.rsvd2[0] = 0; hw->h_lport.p_element.system_id.rsvd2[1] = 0; - list_init(&hw->h_lport.p_isid_vlan_maps); - list_init(&lldp->lldpd->g_hardware); - list_push_back(&lldp->lldpd->g_hardware, &hw->h_entries); + ovs_list_init(&hw->h_lport.p_isid_vlan_maps); + ovs_list_init(&lldp->lldpd->g_hardware); + ovs_list_push_back(&lldp->lldpd->g_hardware, &hw->h_entries); ovs_mutex_lock(&mutex); @@ -880,7 +880,7 @@ lldp_create_dummy(void) hmap_init(&lldp->mappings_by_isid); hmap_init(&lldp->mappings_by_aux); - list_init(&lldp->active_mapping_queue); + ovs_list_init(&lldp->active_mapping_queue); lchassis = xzalloc(sizeof *lchassis); lchassis->c_cap_available = LLDP_CAP_BRIDGE; @@ -888,11 +888,11 @@ lldp_create_dummy(void) lchassis->c_id_subtype = LLDP_CHASSISID_SUBTYPE_LLADDR; lchassis->c_id_len = ETH_ADDR_LEN; - list_init(&lchassis->c_mgmt); + ovs_list_init(&lchassis->c_mgmt); lchassis->c_ttl = LLDP_CHASSIS_TTL; lldpd_assign_cfg_to_protocols(lldp->lldpd); - list_init(&lldp->lldpd->g_chassis); - list_push_back(&lldp->lldpd->g_chassis, &lchassis->list); + ovs_list_init(&lldp->lldpd->g_chassis); + ovs_list_push_back(&lldp->lldpd->g_chassis, &lchassis->list); hw = lldpd_alloc_hardware(lldp->lldpd, "dummy-hw", 0); @@ -916,9 +916,9 @@ lldp_create_dummy(void) hw->h_lport.p_element.system_id.rsvd2[0] = 0; hw->h_lport.p_element.system_id.rsvd2[1] = 0; - list_init(&hw->h_lport.p_isid_vlan_maps); - list_init(&lldp->lldpd->g_hardware); - list_push_back(&lldp->lldpd->g_hardware, &hw->h_entries); + ovs_list_init(&hw->h_lport.p_isid_vlan_maps); + ovs_list_init(&lldp->lldpd->g_hardware); + ovs_list_push_back(&lldp->lldpd->g_hardware, &hw->h_entries); return lldp; } @@ -973,13 +973,13 @@ lldp_destroy_dummy(struct lldp *lldp) cfg = lldp->lldpd; LIST_FOR_EACH_SAFE (hw, hw_next, h_entries, &cfg->g_hardware) { - list_remove(&hw->h_entries); + ovs_list_remove(&hw->h_entries); free(hw->h_lport.p_lastframe); free(hw); } LIST_FOR_EACH_SAFE (chassis, chassis_next, list, &cfg->g_chassis) { - list_remove(&chassis->list); + ovs_list_remove(&chassis->list); free(chassis); } diff --git a/lib/ovs-numa.c b/lib/ovs-numa.c index b92522d..747648a 100644 --- a/lib/ovs-numa.c +++ b/lib/ovs-numa.c @@ -127,7 +127,7 @@ discover_numa_and_core(void) struct dirent *subdir; hmap_insert(&all_numa_nodes, &n->hmap_node, hash_int(i, 0)); - list_init(&n->cores); + ovs_list_init(&n->cores); n->numa_id = i; while ((subdir = readdir(dir)) != NULL) { @@ -139,7 +139,7 @@ discover_numa_and_core(void) core_id = strtoul(subdir->d_name + 3, NULL, 10); hmap_insert(&all_cpu_cores, &c->hmap_node, hash_int(core_id, 0)); - list_insert(&n->cores, &c->list_node); + ovs_list_insert(&n->cores, &c->list_node); c->core_id = core_id; c->numa = n; c->available = true; @@ -147,7 +147,7 @@ discover_numa_and_core(void) } } VLOG_INFO("Discovered %"PRIuSIZE" CPU cores on NUMA node %d", - list_size(&n->cores), n->numa_id); + ovs_list_size(&n->cores), n->numa_id); closedir(dir); } else if (errno != ENOENT) { VLOG_WARN("opendir(%s) failed (%s)", path, @@ -272,7 +272,7 @@ ovs_numa_get_n_cores_on_numa(int numa_id) struct numa_node *numa = get_numa_by_numa_id(numa_id); if (numa) { - return list_size(&numa->cores); + return ovs_list_size(&numa->cores); } return OVS_CORE_UNSPEC; @@ -380,13 +380,13 @@ ovs_numa_dump_cores_on_numa(int numa_id) struct cpu_core *core; dump = xmalloc(sizeof *dump); - list_init(&dump->dump); + ovs_list_init(&dump->dump); LIST_FOR_EACH(core, list_node, &numa->cores) { struct ovs_numa_info *info = xmalloc(sizeof *info); info->numa_id = numa->numa_id; info->core_id = core->core_id; - list_insert(&dump->dump, &info->list_node); + ovs_list_insert(&dump->dump, &info->list_node); } } diff --git a/lib/ovs-rcu.c b/lib/ovs-rcu.c index b71b075..0ff508e 100644 --- a/lib/ovs-rcu.c +++ b/lib/ovs-rcu.c @@ -81,7 +81,7 @@ ovsrcu_perthread_get(void) sizeof perthread->name); ovs_mutex_lock(&ovsrcu_threads_mutex); - list_push_back(&ovsrcu_threads, &perthread->list_node); + ovs_list_push_back(&ovsrcu_threads, &perthread->list_node); ovs_mutex_unlock(&ovsrcu_threads_mutex); pthread_setspecific(perthread_key, perthread); @@ -257,7 +257,7 @@ ovsrcu_call_postponed(void) struct ovs_list cbsets; guarded_list_pop_all(&flushed_cbsets, &cbsets); - if (list_is_empty(&cbsets)) { + if (ovs_list_is_empty(&cbsets)) { return false; } @@ -312,7 +312,7 @@ ovsrcu_unregister__(struct ovsrcu_perthread *perthread) } ovs_mutex_lock(&ovsrcu_threads_mutex); - list_remove(&perthread->list_node); + ovs_list_remove(&perthread->list_node); ovs_mutex_unlock(&ovsrcu_threads_mutex); ovs_mutex_destroy(&perthread->mutex); @@ -347,7 +347,7 @@ ovsrcu_init_module(void) global_seqno = seq_create(); xpthread_key_create(&perthread_key, ovsrcu_thread_exit_cb); fatal_signal_add_hook(ovsrcu_cancel_thread_exit_cb, NULL, NULL, true); - list_init(&ovsrcu_threads); + ovs_list_init(&ovsrcu_threads); ovs_mutex_init(&ovsrcu_threads_mutex); guarded_list_init(&flushed_cbsets); diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c index 04677c6..ff0ff38 100644 --- a/lib/ovs-thread.c +++ b/lib/ovs-thread.c @@ -693,7 +693,7 @@ ovsthread_key_destruct__(void *slots_) int i; ovs_mutex_lock(&key_mutex); - list_remove(&slots->list_node); + ovs_list_remove(&slots->list_node); LIST_FOR_EACH (key, list_node, &inuse_keys) { void *value = clear_slot(slots, key->index); if (value && key->destructor) { @@ -743,17 +743,17 @@ ovsthread_key_create(ovsthread_key_t *keyp, void (*destructor)(void *)) } ovs_mutex_lock(&key_mutex); - if (list_is_empty(&free_keys)) { + if (ovs_list_is_empty(&free_keys)) { key = xmalloc(sizeof *key); key->index = n_keys++; if (key->index >= MAX_KEYS) { abort(); } } else { - key = CONTAINER_OF(list_pop_back(&free_keys), + key = CONTAINER_OF(ovs_list_pop_back(&free_keys), struct ovsthread_key, list_node); } - list_push_back(&inuse_keys, &key->list_node); + ovs_list_push_back(&inuse_keys, &key->list_node); key->destructor = destructor; ovs_mutex_unlock(&key_mutex); @@ -772,8 +772,8 @@ ovsthread_key_delete(ovsthread_key_t key) ovs_mutex_lock(&key_mutex); /* Move 'key' from 'inuse_keys' to 'free_keys'. */ - list_remove(&key->list_node); - list_push_back(&free_keys, &key->list_node); + ovs_list_remove(&key->list_node); + ovs_list_push_back(&free_keys, &key->list_node); /* Clear this slot in all threads. */ LIST_FOR_EACH (slots, list_node, &slots_list) { @@ -795,7 +795,7 @@ ovsthread_key_lookup__(const struct ovsthread_key *key) ovs_mutex_lock(&key_mutex); pthread_setspecific(tsd_key, slots); - list_push_back(&slots_list, &slots->list_node); + ovs_list_push_back(&slots_list, &slots->list_node); ovs_mutex_unlock(&key_mutex); } diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index 9769216..c43e602 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -256,7 +256,7 @@ ovsdb_idl_create(const char *remote, const struct ovsdb_idl_class *class, shash_add_assert(&table->columns, column->name, column); } hmap_init(&table->rows); - list_init(&table->track_list); + ovs_list_init(&table->track_list); table->change_seqno[OVSDB_IDL_CHANGE_INSERT] = table->change_seqno[OVSDB_IDL_CHANGE_MODIFY] = table->change_seqno[OVSDB_IDL_CHANGE_DELETE] = 0; @@ -327,8 +327,8 @@ ovsdb_idl_clear(struct ovsdb_idl *idl) /* No need to do anything with dst_arcs: some node has those arcs * as forward arcs and will destroy them itself. */ - if (!list_is_empty(&row->track_node)) { - list_remove(&row->track_node); + if (!ovs_list_is_empty(&row->track_node)) { + ovs_list_remove(&row->track_node); } ovsdb_idl_row_destroy(row); @@ -782,8 +782,8 @@ ovsdb_idl_track_get_first(const struct ovsdb_idl *idl, struct ovsdb_idl_table *table = ovsdb_idl_table_from_class(idl, table_class); - if (!list_is_empty(&table->track_list)) { - return CONTAINER_OF(list_front(&table->track_list), struct ovsdb_idl_row, track_node); + if (!ovs_list_is_empty(&table->track_list)) { + return CONTAINER_OF(ovs_list_front(&table->track_list), struct ovsdb_idl_row, track_node); } return NULL; } @@ -836,7 +836,7 @@ ovsdb_idl_track_clear(const struct ovsdb_idl *idl) for (i = 0; i < idl->class->n_tables; i++) { struct ovsdb_idl_table *table = &idl->tables[i]; - if (!list_is_empty(&table->track_list)) { + if (!ovs_list_is_empty(&table->track_list)) { struct ovsdb_idl_row *row, *next; LIST_FOR_EACH_SAFE(row, next, track_node, &table->track_list) { @@ -844,8 +844,8 @@ ovsdb_idl_track_clear(const struct ovsdb_idl *idl) free(row->updated); row->updated = NULL; } - list_remove(&row->track_node); - list_init(&row->track_node); + ovs_list_remove(&row->track_node); + ovs_list_init(&row->track_node); if (ovsdb_idl_row_is_orphan(row)) { ovsdb_idl_row_clear_old(row); free(row); @@ -1367,8 +1367,8 @@ ovsdb_idl_row_change__(struct ovsdb_idl_row *row, const struct json *row_json, = row->table->change_seqno[change] = row->table->idl->change_seqno + 1; if (table->modes[column_idx] & OVSDB_IDL_TRACK) { - if (list_is_empty(&row->track_node)) { - list_push_front(&row->table->track_list, + if (ovs_list_is_empty(&row->track_node)) { + ovs_list_push_front(&row->table->track_list, &row->track_node); } if (!row->updated) { @@ -1519,15 +1519,15 @@ ovsdb_idl_row_clear_arcs(struct ovsdb_idl_row *row, bool destroy_dsts) * freed. */ LIST_FOR_EACH_SAFE (arc, next, src_node, &row->src_arcs) { - list_remove(&arc->dst_node); + ovs_list_remove(&arc->dst_node); if (destroy_dsts && ovsdb_idl_row_is_orphan(arc->dst) - && list_is_empty(&arc->dst->dst_arcs)) { + && ovs_list_is_empty(&arc->dst->dst_arcs)) { ovsdb_idl_row_destroy(arc->dst); } free(arc); } - list_init(&row->src_arcs); + ovs_list_init(&row->src_arcs); } /* Force nodes that reference 'row' to reparse. */ @@ -1560,10 +1560,10 @@ ovsdb_idl_row_create__(const struct ovsdb_idl_table_class *class) { struct ovsdb_idl_row *row = xzalloc(class->allocation_size); class->row_init(row); - list_init(&row->src_arcs); - list_init(&row->dst_arcs); + ovs_list_init(&row->src_arcs); + ovs_list_init(&row->dst_arcs); hmap_node_nullify(&row->txn_node); - list_init(&row->track_node); + ovs_list_init(&row->track_node); return row; } @@ -1588,8 +1588,8 @@ ovsdb_idl_row_destroy(struct ovsdb_idl_row *row) = row->table->change_seqno[OVSDB_IDL_CHANGE_DELETE] = row->table->idl->change_seqno + 1; } - if (list_is_empty(&row->track_node)) { - list_push_front(&row->table->track_list, &row->track_node); + if (ovs_list_is_empty(&row->track_node)) { + ovs_list_push_front(&row->table->track_list, &row->track_node); } } } @@ -1602,12 +1602,12 @@ ovsdb_idl_row_destroy_postprocess(struct ovsdb_idl *idl) for (i = 0; i < idl->class->n_tables; i++) { struct ovsdb_idl_table *table = &idl->tables[i]; - if (!list_is_empty(&table->track_list)) { + if (!ovs_list_is_empty(&table->track_list)) { struct ovsdb_idl_row *row, *next; LIST_FOR_EACH_SAFE(row, next, track_node, &table->track_list) { if (!ovsdb_idl_track_is_set(row->table)) { - list_remove(&row->track_node); + ovs_list_remove(&row->track_node); free(row); } } @@ -1638,7 +1638,7 @@ ovsdb_idl_delete_row(struct ovsdb_idl_row *row) ovsdb_idl_row_unparse(row); ovsdb_idl_row_clear_arcs(row, true); ovsdb_idl_row_clear_old(row); - if (list_is_empty(&row->dst_arcs)) { + if (ovs_list_is_empty(&row->dst_arcs)) { ovsdb_idl_row_destroy(row); } else { ovsdb_idl_row_reparse_backrefs(row); @@ -1691,7 +1691,7 @@ may_add_arc(const struct ovsdb_idl_row *src, const struct ovsdb_idl_row *dst) * at 'src', since we add all of the arcs from a given source in a clump * (in a single call to ovsdb_idl_row_parse()) and new arcs are always * added at the front of the dst_arcs list. */ - if (list_is_empty(&dst->dst_arcs)) { + if (ovs_list_is_empty(&dst->dst_arcs)) { return true; } arc = CONTAINER_OF(dst->dst_arcs.next, struct ovsdb_idl_arc, dst_node); @@ -1740,8 +1740,8 @@ ovsdb_idl_get_row_arc(struct ovsdb_idl_row *src, /* The arc *must* be added at the front of the dst_arcs list. See * ovsdb_idl_row_reparse_backrefs() for details. */ arc = xmalloc(sizeof *arc); - list_push_front(&src->src_arcs, &arc->src_node); - list_push_front(&dst->dst_arcs, &arc->dst_node); + ovs_list_push_front(&src->src_arcs, &arc->src_node); + ovs_list_push_front(&dst->dst_arcs, &arc->dst_node); arc->src = src; arc->dst = dst; } diff --git a/lib/process.c b/lib/process.c index 5c257ed..e9d0ba9 100644 --- a/lib/process.c +++ b/lib/process.c @@ -161,7 +161,7 @@ process_register(const char *name, pid_t pid) p->name = xstrdup(slash ? slash + 1 : name); p->exited = false; - list_push_back(&all_processes, &p->node); + ovs_list_push_back(&all_processes, &p->node); return p; } @@ -275,7 +275,7 @@ void process_destroy(struct process *p) { if (p) { - list_remove(&p->node); + ovs_list_remove(&p->node); free(p->name); free(p); } @@ -367,7 +367,7 @@ process_run(void) #ifndef _WIN32 char buf[_POSIX_PIPE_BUF]; - if (!list_is_empty(&all_processes) && read(fds[0], buf, sizeof buf) > 0) { + if (!ovs_list_is_empty(&all_processes) && read(fds[0], buf, sizeof buf) > 0) { struct process *p; LIST_FOR_EACH (p, node, &all_processes) { diff --git a/lib/rconn.c b/lib/rconn.c index 5706c3f..bfed745 100644 --- a/lib/rconn.c +++ b/lib/rconn.c @@ -251,7 +251,7 @@ rconn_create(int probe_interval, int max_backoff, uint8_t dscp, rc->target = xstrdup("void"); rc->reliable = false; - list_init(&rc->txq); + ovs_list_init(&rc->txq); rc->backoff = 0; rc->max_backoff = max_backoff ? max_backoff : 8; @@ -521,17 +521,17 @@ static void do_tx_work(struct rconn *rc) OVS_REQUIRES(rc->mutex) { - if (list_is_empty(&rc->txq)) { + if (ovs_list_is_empty(&rc->txq)) { return; } - while (!list_is_empty(&rc->txq)) { + while (!ovs_list_is_empty(&rc->txq)) { int error = try_send(rc); if (error) { break; } rc->last_activity = time_now(); } - if (list_is_empty(&rc->txq)) { + if (ovs_list_is_empty(&rc->txq)) { poll_immediate_wake(); } } @@ -672,7 +672,7 @@ rconn_run_wait(struct rconn *rc) ovs_mutex_lock(&rc->mutex); if (rc->vconn) { vconn_run_wait(rc->vconn); - if ((rc->state & (S_ACTIVE | S_IDLE)) && !list_is_empty(&rc->txq)) { + if ((rc->state & (S_ACTIVE | S_IDLE)) && !ovs_list_is_empty(&rc->txq)) { vconn_wait(rc->vconn, WAIT_SEND); } } @@ -751,7 +751,7 @@ rconn_send__(struct rconn *rc, struct ofpbuf *b, /* Reuse 'frame' as a private pointer while 'b' is in txq. */ b->header = counter; - list_push_back(&rc->txq, &b->list_node); + ovs_list_push_back(&rc->txq, &b->list_node); /* If the queue was empty before we added 'b', try to send some * packets. (But if the queue had packets in it, it's because the @@ -1005,7 +1005,7 @@ rconn_count_txqlen(const struct rconn *rc) unsigned int len; ovs_mutex_lock(&rc->mutex); - len = list_size(&rc->txq); + len = ovs_list_size(&rc->txq); ovs_mutex_unlock(&rc->mutex); return len; @@ -1120,13 +1120,13 @@ try_send(struct rconn *rc) /* Eagerly remove 'msg' from the txq. We can't remove it from the list * after sending, if sending is successful, because it is then owned by the * vconn, which might have freed it already. */ - list_remove(&msg->list_node); + ovs_list_remove(&msg->list_node); msg->header = NULL; retval = vconn_send(rc->vconn, msg); if (retval) { msg->header = counter; - list_push_front(&rc->txq, &msg->list_node); + ovs_list_push_front(&rc->txq, &msg->list_node); if (retval != EAGAIN) { report_error(rc, retval); disconnect(rc, retval); @@ -1221,11 +1221,11 @@ static void flush_queue(struct rconn *rc) OVS_REQUIRES(rc->mutex) { - if (list_is_empty(&rc->txq)) { + if (ovs_list_is_empty(&rc->txq)) { return; } - while (!list_is_empty(&rc->txq)) { - struct ofpbuf *b = ofpbuf_from_list(list_pop_front(&rc->txq)); + while (!ovs_list_is_empty(&rc->txq)) { + struct ofpbuf *b = ofpbuf_from_list(ovs_list_pop_front(&rc->txq)); struct rconn_packet_counter *counter = b->header; if (counter) { rconn_packet_counter_dec(counter, b->size); diff --git a/lib/rstp.c b/lib/rstp.c index f24ca01..280bc6c 100644 --- a/lib/rstp.c +++ b/lib/rstp.c @@ -184,7 +184,7 @@ rstp_unref(struct rstp *rstp) * means that there should be not ports at this time. */ ovs_assert(hmap_is_empty(&rstp->ports)); - list_remove(&rstp->node); + ovs_list_remove(&rstp->node); ovs_mutex_unlock(&rstp_mutex); hmap_destroy(&rstp->ports); free(rstp->name); @@ -287,7 +287,7 @@ rstp_create(const char *name, rstp_identifier bridge_address, ovs_refcount_init(&rstp->ref_cnt); - list_push_back(all_rstps, &rstp->node); + ovs_list_push_back(all_rstps, &rstp->node); ovs_mutex_unlock(&rstp_mutex); VLOG_DBG("RSTP instance creation done"); diff --git a/lib/rtbsd.c b/lib/rtbsd.c index 33fb9fd..8660da9 100644 --- a/lib/rtbsd.c +++ b/lib/rtbsd.c @@ -74,7 +74,7 @@ rtbsd_notifier_register(struct rtbsd_notifier *notifier, } } - list_push_back(&all_notifiers, ¬ifier->node); + ovs_list_push_back(&all_notifiers, ¬ifier->node); notifier->cb = cb; notifier->aux = aux; @@ -90,8 +90,8 @@ rtbsd_notifier_unregister(struct rtbsd_notifier *notifier) OVS_EXCLUDED(rtbsd_mutex) { ovs_mutex_lock(&rtbsd_mutex); - list_remove(¬ifier->node); - if (list_is_empty(&all_notifiers)) { + ovs_list_remove(¬ifier->node); + if (ovs_list_is_empty(&all_notifiers)) { close(notify_sock); notify_sock = -1; } diff --git a/lib/seq.c b/lib/seq.c index 7043405..57e0775 100644 --- a/lib/seq.c +++ b/lib/seq.c @@ -159,7 +159,7 @@ seq_wait__(struct seq *seq, uint64_t value, const char *where) waiter->ovsthread_id = id; waiter->value = value; waiter->thread = seq_thread_get(); - list_push_back(&waiter->thread->waiters, &waiter->list_node); + ovs_list_push_back(&waiter->thread->waiters, &waiter->list_node); if (!waiter->thread->waiting) { latch_wait_at(&waiter->thread->latch, where); @@ -230,7 +230,7 @@ seq_thread_get(void) struct seq_thread *thread = pthread_getspecific(seq_thread_key); if (!thread) { thread = xmalloc(sizeof *thread); - list_init(&thread->waiters); + ovs_list_init(&thread->waiters); latch_init(&thread->latch); thread->waiting = false; @@ -270,7 +270,7 @@ seq_waiter_destroy(struct seq_waiter *waiter) OVS_REQUIRES(seq_mutex) { hmap_remove(&waiter->seq->waiters, &waiter->hmap_node); - list_remove(&waiter->list_node); + ovs_list_remove(&waiter->list_node); free(waiter); } diff --git a/lib/seq.h b/lib/seq.h index b0ec6bf..f3f4b53 100644 --- a/lib/seq.h +++ b/lib/seq.h @@ -82,8 +82,8 @@ * To add an element to the queue: * * ovs_mutex_lock(&mutex); - * list_push_back(&queue, ...element...); - * if (list_is_singleton(&queue)) { // The 'if' test here is optional. + * ovs_list_push_back(&queue, ...element...); + * if (ovs_list_is_singleton(&queue)) { // The 'if' test here is optional. * seq_change(&nonempty_seq); * } * ovs_mutex_unlock(&mutex); @@ -91,7 +91,7 @@ * To wait for the queue to become nonempty: * * ovs_mutex_lock(&mutex); - * if (list_is_empty(&queue)) { + * if (ovs_list_is_empty(&queue)) { * seq_wait(&nonempty_seq, seq_read(&nonempty_seq)); * } else { * poll_immediate_wake(); diff --git a/lib/stp.c b/lib/stp.c index 467b0ba..ba09965 100644 --- a/lib/stp.c +++ b/lib/stp.c @@ -313,7 +313,7 @@ stp_create(const char *name, stp_identifier bridge_id, } ovs_refcount_init(&stp->ref_cnt); - list_push_back(all_stps, &stp->node); + ovs_list_push_back(all_stps, &stp->node); ovs_mutex_unlock(&mutex); return stp; } @@ -336,7 +336,7 @@ stp_unref(struct stp *stp) size_t i; ovs_mutex_lock(&mutex); - list_remove(&stp->node); + ovs_list_remove(&stp->node); ovs_mutex_unlock(&mutex); free(stp->name); diff --git a/lib/tnl-ports.c b/lib/tnl-ports.c index 72aa9f2..707ae4a 100644 --- a/lib/tnl-ports.c +++ b/lib/tnl-ports.c @@ -168,7 +168,7 @@ tnl_port_map_insert(odp_port_t port, p->port = port; p->udp_port = udp_port; ovs_strlcpy(p->dev_name, dev_name, sizeof p->dev_name); - list_insert(&port_list, &p->node); + ovs_list_insert(&port_list, &p->node); LIST_FOR_EACH(ip_dev, node, &addr_list) { if (ip_dev->addr4 != INADDR_ANY) { @@ -220,7 +220,7 @@ tnl_port_map_delete(ovs_be16 udp_port) ovs_mutex_lock(&mutex); LIST_FOR_EACH_SAFE(p, next, node, &port_list) { if (p->udp_port == udp_port) { - list_remove(&p->node); + ovs_list_remove(&p->node); found = true; break; } @@ -379,7 +379,7 @@ insert_ipdev(const char dev_name[]) } ovs_strlcpy(ip_dev->dev_name, netdev_get_name(dev), sizeof ip_dev->dev_name); - list_insert(&addr_list, &ip_dev->node); + ovs_list_insert(&addr_list, &ip_dev->node); map_insert_ipdev(ip_dev); } @@ -398,7 +398,7 @@ delete_ipdev(struct ip_device *ip_dev) } } - list_remove(&ip_dev->node); + ovs_list_remove(&ip_dev->node); netdev_close(ip_dev->dev); free(ip_dev); } @@ -465,7 +465,7 @@ void tnl_port_map_init(void) { classifier_init(&cls, flow_segment_u64s); - list_init(&addr_list); - list_init(&port_list); + ovs_list_init(&addr_list); + ovs_list_init(&port_list); unixctl_command_register("tnl/ports/show", "-v", 0, 1, tnl_port_show, NULL); } diff --git a/lib/tun-metadata.c b/lib/tun-metadata.c index ececee5..1e6ef46 100644 --- a/lib/tun-metadata.c +++ b/lib/tun-metadata.c @@ -208,7 +208,7 @@ tun_metadata_table_request(struct ofputil_tlv_table_reply *ttr) ttr->max_option_space = TUN_METADATA_TOT_OPT_SIZE; ttr->max_fields = TUN_METADATA_NUM_OPTS; - list_init(&ttr->mappings); + ovs_list_init(&ttr->mappings); for (i = 0; i < TUN_METADATA_NUM_OPTS; i++) { struct tun_meta_entry *entry = &map->entries[i]; @@ -224,7 +224,7 @@ tun_metadata_table_request(struct ofputil_tlv_table_reply *ttr) map->option_len = entry->loc.len; map->index = i; - list_push_back(&ttr->mappings, &map->list_node); + ovs_list_push_back(&ttr->mappings, &map->list_node); } } diff --git a/lib/unixctl.c b/lib/unixctl.c index c91dd0a..935c145 100644 --- a/lib/unixctl.c +++ b/lib/unixctl.c @@ -256,7 +256,7 @@ unixctl_server_create(const char *path, struct unixctl_server **serverp) server = xmalloc(sizeof *server); server->listener = listener; - list_init(&server->conns); + ovs_list_init(&server->conns); *serverp = server; exit: @@ -362,7 +362,7 @@ run_connection(struct unixctl_conn *conn) static void kill_connection(struct unixctl_conn *conn) { - list_remove(&conn->node); + ovs_list_remove(&conn->node); jsonrpc_close(conn->rpc); json_destroy(conn->request_id); free(conn); @@ -385,7 +385,7 @@ unixctl_server_run(struct unixctl_server *server) error = pstream_accept(server->listener, &stream); if (!error) { struct unixctl_conn *conn = xzalloc(sizeof *conn); - list_push_back(&server->conns, &conn->node); + ovs_list_push_back(&server->conns, &conn->node); conn->rpc = jsonrpc_open(stream); } else if (error == EAGAIN) { break; diff --git a/lib/vlog.c b/lib/vlog.c index 4c36f1b..6babdca 100644 --- a/lib/vlog.c +++ b/lib/vlog.c @@ -215,7 +215,7 @@ void vlog_insert_module(struct ovs_list *vlog) { ovs_mutex_lock(&log_file_mutex); - list_insert(&vlog_modules, vlog); + ovs_list_insert(&vlog_modules, vlog); ovs_mutex_unlock(&log_file_mutex); } diff --git a/ofproto/bond.c b/ofproto/bond.c index 534ed28..f3bc656 100644 --- a/ofproto/bond.c +++ b/ofproto/bond.c @@ -234,7 +234,7 @@ bond_create(const struct bond_settings *s, struct ofproto_dpif *ofproto) bond = xzalloc(sizeof *bond); bond->ofproto = ofproto; hmap_init(&bond->slaves); - list_init(&bond->enabled_slaves); + ovs_list_init(&bond->enabled_slaves); ovs_mutex_init(&bond->mutex); ovs_refcount_init(&bond->ref_cnt); @@ -1000,12 +1000,12 @@ log_bals(struct bond *bond, const struct ovs_list *bals) if (!slave->enabled) { ds_put_cstr(&ds, " (disabled)"); } - if (!list_is_empty(&slave->entries)) { + if (!ovs_list_is_empty(&slave->entries)) { struct bond_entry *e; ds_put_cstr(&ds, " ("); LIST_FOR_EACH (e, list_node, &slave->entries) { - if (&e->list_node != list_front(&slave->entries)) { + if (&e->list_node != ovs_list_front(&slave->entries)) { ds_put_cstr(&ds, " + "); } ds_put_format(&ds, "h%"PRIdPTR": %"PRIu64"kB", @@ -1058,7 +1058,7 @@ choose_entry_to_migrate(const struct bond_slave *from, uint64_t to_tx_bytes) { struct bond_entry *e; - if (list_is_short(&from->entries)) { + if (ovs_list_is_short(&from->entries)) { /* 'from' carries no more than one MAC hash, so shifting load away from * it would be pointless. */ return NULL; @@ -1102,7 +1102,7 @@ insert_bal(struct ovs_list *bals, struct bond_slave *slave) break; } } - list_insert(&pos->bal_node, &slave->bal_node); + ovs_list_insert(&pos->bal_node, &slave->bal_node); } /* Removes 'slave' from its current list and then inserts it into 'bals' so @@ -1110,7 +1110,7 @@ insert_bal(struct ovs_list *bals, struct bond_slave *slave) static void reinsert_bal(struct ovs_list *bals, struct bond_slave *slave) { - list_remove(&slave->bal_node); + ovs_list_remove(&slave->bal_node); insert_bal(bals, slave); } @@ -1146,12 +1146,12 @@ bond_rebalance(struct bond *bond) * Compute each slave's tx_bytes as the sum of its entries' tx_bytes. */ HMAP_FOR_EACH (slave, hmap_node, &bond->slaves) { slave->tx_bytes = 0; - list_init(&slave->entries); + ovs_list_init(&slave->entries); } for (e = &bond->hash[0]; e <= &bond->hash[BOND_MASK]; e++) { if (e->slave && e->tx_bytes) { e->slave->tx_bytes += e->tx_bytes; - list_push_back(&e->slave->entries, &e->list_node); + ovs_list_push_back(&e->slave->entries, &e->list_node); } } @@ -1159,7 +1159,7 @@ bond_rebalance(struct bond *bond) * * XXX This is O(n**2) in the number of slaves but it could be O(n lg n) * with a proper list sort algorithm. */ - list_init(&bals); + ovs_list_init(&bals); HMAP_FOR_EACH (slave, hmap_node, &bond->slaves) { if (slave->enabled) { insert_bal(&bals, slave); @@ -1168,9 +1168,9 @@ bond_rebalance(struct bond *bond) log_bals(bond, &bals); /* Shift load from the most-loaded slaves to the least-loaded slaves. */ - while (!list_is_short(&bals)) { - struct bond_slave *from = bond_slave_from_bal_node(list_front(&bals)); - struct bond_slave *to = bond_slave_from_bal_node(list_back(&bals)); + while (!ovs_list_is_short(&bals)) { + struct bond_slave *from = bond_slave_from_bal_node(ovs_list_front(&bals)); + struct bond_slave *to = bond_slave_from_bal_node(ovs_list_back(&bals)); uint64_t overload; overload = from->tx_bytes - to->tx_bytes; @@ -1192,7 +1192,7 @@ bond_rebalance(struct bond *bond) * We don't add the element to to->hashes. That would only allow * 'e' to be migrated to another slave in this rebalancing run, and * there is no point in doing that. */ - list_remove(&e->list_node); + ovs_list_remove(&e->list_node); /* Re-sort 'bals'. */ reinsert_bal(&bals, from); @@ -1201,7 +1201,7 @@ bond_rebalance(struct bond *bond) } else { /* Can't usefully migrate anything away from 'from'. * Don't reconsider it. */ - list_remove(&from->bal_node); + ovs_list_remove(&from->bal_node); } } @@ -1656,9 +1656,9 @@ bond_enable_slave(struct bond_slave *slave, bool enable) ovs_mutex_lock(&slave->bond->mutex); if (enable) { - list_insert(&slave->bond->enabled_slaves, &slave->list_node); + ovs_list_insert(&slave->bond->enabled_slaves, &slave->list_node); } else { - list_remove(&slave->list_node); + ovs_list_remove(&slave->list_node); } ovs_mutex_unlock(&slave->bond->mutex); @@ -1746,13 +1746,13 @@ get_enabled_slave(struct bond *bond) struct ovs_list *node; ovs_mutex_lock(&bond->mutex); - if (list_is_empty(&bond->enabled_slaves)) { + if (ovs_list_is_empty(&bond->enabled_slaves)) { ovs_mutex_unlock(&bond->mutex); return NULL; } - node = list_pop_front(&bond->enabled_slaves); - list_push_back(&bond->enabled_slaves, node); + node = ovs_list_pop_front(&bond->enabled_slaves); + ovs_list_push_back(&bond->enabled_slaves, node); ovs_mutex_unlock(&bond->mutex); return CONTAINER_OF(node, struct bond_slave, list_node); diff --git a/ofproto/bundles.c b/ofproto/bundles.c index 003b20b..85ea79f 100644 --- a/ofproto/bundles.c +++ b/ofproto/bundles.c @@ -53,7 +53,7 @@ ofp_bundle_create(uint32_t id, uint16_t flags) bundle->flags = flags; bundle->state = BS_OPEN; - list_init(&bundle->msg_list); + ovs_list_init(&bundle->msg_list); return bundle; } @@ -166,6 +166,6 @@ ofp_bundle_add_message(struct ofconn *ofconn, uint32_t id, uint16_t flags, return OFPERR_OFPBFC_BAD_FLAGS; } - list_push_back(&bundle->msg_list, &bmsg->node); + ovs_list_push_back(&bundle->msg_list, &bmsg->node); return 0; } diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c index 9c31516..326d10e 100644 --- a/ofproto/connmgr.c +++ b/ofproto/connmgr.c @@ -237,7 +237,7 @@ connmgr_create(struct ofproto *ofproto, mgr->local_port_name = xstrdup(local_port_name); hmap_init(&mgr->controllers); - list_init(&mgr->all_conns); + ovs_list_init(&mgr->all_conns); mgr->master_election_id = 0; mgr->master_election_id_defined = false; @@ -1222,13 +1222,13 @@ ofconn_create(struct connmgr *mgr, struct rconn *rconn, enum ofconn_type type, ofconn = xzalloc(sizeof *ofconn); ofconn->connmgr = mgr; - list_push_back(&mgr->all_conns, &ofconn->node); + ovs_list_push_back(&mgr->all_conns, &ofconn->node); ofconn->rconn = rconn; ofconn->type = type; ofconn->enable_async_msgs = enable_async_msgs; hmap_init(&ofconn->monitors); - list_init(&ofconn->updates); + ovs_list_init(&ofconn->updates); hmap_init(&ofconn->bundles); @@ -1306,7 +1306,7 @@ ofconn_destroy(struct ofconn *ofconn) hmap_destroy(&ofconn->bundles); hmap_destroy(&ofconn->monitors); - list_remove(&ofconn->node); + ovs_list_remove(&ofconn->node); rconn_destroy(ofconn->rconn); rconn_packet_counter_destroy(ofconn->packet_in_counter); rconn_packet_counter_destroy(ofconn->reply_counter); @@ -2139,7 +2139,7 @@ ofmonitor_report(struct connmgr *mgr, struct rule *rule, } if (flags) { - if (list_is_empty(&ofconn->updates)) { + if (ovs_list_is_empty(&ofconn->updates)) { ofputil_start_flow_update(&ofconn->updates); ofconn->sent_abbrev_update = false; } @@ -2225,12 +2225,12 @@ ofmonitor_resume(struct ofconn *ofconn) ofmonitor_collect_resume_rules(m, ofconn->monitor_paused, &rules); } - list_init(&msgs); + ovs_list_init(&msgs); ofmonitor_compose_refresh_updates(&rules, &msgs); resumed = ofpraw_alloc_xid(OFPRAW_NXT_FLOW_MONITOR_RESUMED, OFP10_VERSION, htonl(0), 0); - list_push_back(&msgs, &resumed->list_node); + ovs_list_push_back(&msgs, &resumed->list_node); ofconn_send_replies(ofconn, &msgs); ofconn->monitor_paused = 0; diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c index 9d605b2..4607fc3 100644 --- a/ofproto/ofproto-dpif-ipfix.c +++ b/ofproto/ofproto-dpif-ipfix.c @@ -496,7 +496,7 @@ dpif_ipfix_exporter_init(struct dpif_ipfix_exporter *exporter) exporter->seq_number = 1; exporter->last_template_set_time = TIME_MIN; hmap_init(&exporter->cache_flow_key_map); - list_init(&exporter->cache_flow_start_timestamp_list); + ovs_list_init(&exporter->cache_flow_start_timestamp_list); exporter->cache_active_timeout = 0; exporter->cache_max_flows = 0; } @@ -1344,7 +1344,7 @@ ipfix_cache_update(struct dpif_ipfix_exporter *exporter, /* As the latest entry added into the cache, it should * logically have the highest flow_start_timestamp_usec, so * append it at the tail. */ - list_push_back(&exporter->cache_flow_start_timestamp_list, + ovs_list_push_back(&exporter->cache_flow_start_timestamp_list, &entry->cache_flow_start_timestamp_list_node); /* Enforce exporter->cache_max_flows limit. */ @@ -1772,7 +1772,7 @@ dpif_ipfix_cache_expire(struct dpif_ipfix_exporter *exporter, bool template_msg_sent = false; enum ipfix_flow_end_reason flow_end_reason; - if (list_is_empty(&exporter->cache_flow_start_timestamp_list)) { + if (ovs_list_is_empty(&exporter->cache_flow_start_timestamp_list)) { return; } @@ -1795,7 +1795,7 @@ dpif_ipfix_cache_expire(struct dpif_ipfix_exporter *exporter, break; } - list_remove(&entry->cache_flow_start_timestamp_list_node); + ovs_list_remove(&entry->cache_flow_start_timestamp_list_node); hmap_remove(&exporter->cache_flow_key_map, &entry->flow_key_map_node); diff --git a/ofproto/ofproto-dpif-rid.c b/ofproto/ofproto-dpif-rid.c index 84c997c..67027c1 100644 --- a/ofproto/ofproto-dpif-rid.c +++ b/ofproto/ofproto-dpif-rid.c @@ -49,8 +49,8 @@ recirc_init(void) next_id = 1; /* 0 is not a valid ID. */ cmap_init(&id_map); cmap_init(&metadata_map); - list_init(&expiring); - list_init(&expired); + ovs_list_init(&expiring); + ovs_list_init(&expired); ovs_mutex_unlock(&mutex); ovsthread_once_done(&once); @@ -93,9 +93,9 @@ recirc_run(void) ovsrcu_postpone(recirc_id_node_free, node); } - if (!list_is_empty(&expiring)) { + if (!ovs_list_is_empty(&expiring)) { /* 'expired' is now empty, move nodes in 'expiring' to it. */ - list_splice(&expired, list_front(&expiring), &expiring); + ovs_list_splice(&expired, ovs_list_front(&expiring), &expiring); } } ovs_mutex_unlock(&mutex); @@ -329,7 +329,7 @@ recirc_id_node_unref(const struct recirc_id_node *node_) cmap_remove(&metadata_map, &node->metadata_node, node->hash); /* We keep the node in the 'id_map' so that it can be found as long * as it lingers, and add it to the 'expiring' list. */ - list_insert(&expiring, &node->exp_node); + ovs_list_insert(&expiring, &node->exp_node); ovs_mutex_unlock(&mutex); } } diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index 9c64b6b..55e6b4c 100644 --- a/ofproto/ofproto-dpif-upcall.c +++ b/ofproto/ofproto-dpif-upcall.c @@ -400,7 +400,7 @@ udpif_create(struct dpif_backer *backer, struct dpif *dpif) udpif->dump_seq = seq_create(); latch_init(&udpif->exit_latch); latch_init(&udpif->pause_latch); - list_push_back(&all_udpifs, &udpif->list_node); + ovs_list_push_back(&all_udpifs, &udpif->list_node); atomic_init(&udpif->enable_ufid, false); atomic_init(&udpif->n_flows, 0); atomic_init(&udpif->n_flows_timestamp, LLONG_MIN); @@ -444,7 +444,7 @@ udpif_destroy(struct udpif *udpif) free(udpif->ukeys); udpif->ukeys = NULL; - list_remove(&udpif->list_node); + ovs_list_remove(&udpif->list_node); latch_destroy(&udpif->exit_latch); latch_destroy(&udpif->pause_latch); seq_destroy(udpif->reval_seq); @@ -2474,11 +2474,11 @@ upcall_unixctl_dump_wait(struct unixctl_conn *conn, const char *argv[] OVS_UNUSED, void *aux OVS_UNUSED) { - if (list_is_singleton(&all_udpifs)) { + if (ovs_list_is_singleton(&all_udpifs)) { struct udpif *udpif = NULL; size_t len; - udpif = OBJECT_CONTAINING(list_front(&all_udpifs), udpif, list_node); + udpif = OBJECT_CONTAINING(ovs_list_front(&all_udpifs), udpif, list_node); len = (udpif->n_conns + 1) * sizeof *udpif->conns; udpif->conn_seq = seq_read(udpif->dump_seq); udpif->conns = xrealloc(udpif->conns, len); diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 20b2069..b7f12b9 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -614,7 +614,7 @@ xlate_report_actions(struct xlate_ctx *ctx, const char *title, static void xlate_xbridge_init(struct xlate_cfg *xcfg, struct xbridge *xbridge) { - list_init(&xbridge->xbundles); + ovs_list_init(&xbridge->xbundles); hmap_init(&xbridge->xports); hmap_insert(&xcfg->xbridges, &xbridge->hmap_node, hash_pointer(xbridge->ofproto, 0)); @@ -623,8 +623,8 @@ xlate_xbridge_init(struct xlate_cfg *xcfg, struct xbridge *xbridge) static void xlate_xbundle_init(struct xlate_cfg *xcfg, struct xbundle *xbundle) { - list_init(&xbundle->xports); - list_insert(&xbundle->xbridge->xbundles, &xbundle->list_node); + ovs_list_init(&xbundle->xports); + ovs_list_insert(&xbundle->xbridge->xbundles, &xbundle->list_node); hmap_insert(&xcfg->xbundles, &xbundle->hmap_node, hash_pointer(xbundle->ofbundle, 0)); } @@ -837,7 +837,7 @@ xlate_xport_copy(struct xbridge *xbridge, struct xbundle *xbundle, if (xbundle) { new_xport->xbundle = xbundle; - list_insert(&new_xport->xbundle->xports, &new_xport->bundle_node); + ovs_list_insert(&new_xport->xbundle->xports, &new_xport->bundle_node); } HMAP_FOR_EACH (pdscp, hmap_node, &xport->skb_priorities) { @@ -1035,7 +1035,7 @@ xlate_xbundle_remove(struct xlate_cfg *xcfg, struct xbundle *xbundle) } hmap_remove(&xcfg->xbundles, &xbundle->hmap_node); - list_remove(&xbundle->list_node); + ovs_list_remove(&xbundle->list_node); bond_unref(xbundle->bond); lacp_unref(xbundle->lacp); free(xbundle->name); @@ -1095,11 +1095,11 @@ xlate_ofport_set(struct ofproto_dpif *ofproto, struct ofbundle *ofbundle, } if (xport->xbundle) { - list_remove(&xport->bundle_node); + ovs_list_remove(&xport->bundle_node); } xport->xbundle = xbundle_lookup(new_xcfg, ofbundle); if (xport->xbundle) { - list_insert(&xport->xbundle->xports, &xport->bundle_node); + ovs_list_insert(&xport->xbundle->xports, &xport->bundle_node); } clear_skb_priorities(xport); @@ -1133,7 +1133,7 @@ xlate_xport_remove(struct xlate_cfg *xcfg, struct xport *xport) } if (xport->xbundle) { - list_remove(&xport->bundle_node); + ovs_list_remove(&xport->bundle_node); } clear_skb_priorities(xport); @@ -1846,11 +1846,11 @@ output_normal(struct xlate_ctx *ctx, const struct xbundle *out_xbundle, bool use_recirc = false; vid = output_vlan_to_vid(out_xbundle, vlan); - if (list_is_empty(&out_xbundle->xports)) { + if (ovs_list_is_empty(&out_xbundle->xports)) { /* Partially configured bundle with no slaves. Drop the packet. */ return; } else if (!out_xbundle->bond) { - xport = CONTAINER_OF(list_front(&out_xbundle->xports), struct xport, + xport = CONTAINER_OF(ovs_list_front(&out_xbundle->xports), struct xport, bundle_node); } else { struct xlate_cfg *xcfg = ovsrcu_get(struct xlate_cfg *, &xcfgp); diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 04fdc9f..65e34d9 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -953,14 +953,14 @@ open_dpif_backer(const char *type, struct dpif_backer **backerp) /* Loop through the ports already on the datapath and remove any * that we don't need anymore. */ - list_init(&garbage_list); + ovs_list_init(&garbage_list); dpif_port_dump_start(&port_dump, backer->dpif); while (dpif_port_dump_next(&port_dump, &port)) { node = shash_find(&init_ofp_ports, port.name); if (!node && strcmp(port.name, dpif_base_name(backer->dpif))) { garbage = xmalloc(sizeof *garbage); garbage->odp_port = port.port_no; - list_push_front(&garbage_list, &garbage->list_node); + ovs_list_push_front(&garbage_list, &garbage->list_node); } } dpif_port_dump_done(&port_dump); @@ -2762,7 +2762,7 @@ bundle_del_port(struct ofport_dpif *port) bundle->ofproto->backer->need_revalidate = REV_RECONFIGURE; - list_remove(&port->bundle_node); + ovs_list_remove(&port->bundle_node); port->bundle = NULL; if (bundle->lacp) { @@ -2793,7 +2793,7 @@ bundle_add_port(struct ofbundle *bundle, ofp_port_t ofp_port, } port->bundle = bundle; - list_push_back(&bundle->ports, &port->bundle_node); + ovs_list_push_back(&bundle->ports, &port->bundle_node); if (port->up.pp.config & OFPUTIL_PC_NO_FLOOD || port->is_layer3 || (bundle->ofproto->stp && !stp_forward_in_state(port->stp_state)) @@ -2870,7 +2870,7 @@ bundle_set(struct ofproto *ofproto_, void *aux, bundle->aux = aux; bundle->name = NULL; - list_init(&bundle->ports); + ovs_list_init(&bundle->ports); bundle->vlan_mode = PORT_VLAN_TRUNK; bundle->vlan = -1; bundle->trunks = NULL; @@ -2908,7 +2908,7 @@ bundle_set(struct ofproto *ofproto_, void *aux, ok = false; } } - if (!ok || list_size(&bundle->ports) != s->n_slaves) { + if (!ok || ovs_list_size(&bundle->ports) != s->n_slaves) { struct ofport_dpif *next_port; LIST_FOR_EACH_SAFE (port, next_port, bundle_node, &bundle->ports) { @@ -2922,9 +2922,9 @@ bundle_set(struct ofproto *ofproto_, void *aux, found: ; } } - ovs_assert(list_size(&bundle->ports) <= s->n_slaves); + ovs_assert(ovs_list_size(&bundle->ports) <= s->n_slaves); - if (list_is_empty(&bundle->ports)) { + if (ovs_list_is_empty(&bundle->ports)) { bundle_destroy(bundle); return EINVAL; } @@ -2992,7 +2992,7 @@ bundle_set(struct ofproto *ofproto_, void *aux, } /* Bonding. */ - if (!list_is_short(&bundle->ports)) { + if (!ovs_list_is_short(&bundle->ports)) { bundle->ofproto->has_bonded_bundles = true; if (bundle->bond) { if (bond_reconfigure(bundle->bond, s->bond)) { @@ -3029,9 +3029,9 @@ bundle_remove(struct ofport *port_) if (bundle) { bundle_del_port(port); - if (list_is_empty(&bundle->ports)) { + if (ovs_list_is_empty(&bundle->ports)) { bundle_destroy(bundle); - } else if (list_is_short(&bundle->ports)) { + } else if (ovs_list_is_short(&bundle->ports)) { bond_unref(bundle->bond); bundle->bond = NULL; } @@ -3078,7 +3078,7 @@ bundle_send_learning_packets(struct ofbundle *bundle) } *pkt_node; struct ovs_list packets; - list_init(&packets); + ovs_list_init(&packets); ovs_rwlock_rdlock(&ofproto->ml->rwlock); LIST_FOR_EACH (e, lru_node, &ofproto->ml->lrus) { if (mac_entry_get_port(ofproto->ml, e) != bundle) { @@ -3086,7 +3086,7 @@ bundle_send_learning_packets(struct ofbundle *bundle) pkt_node->pkt = bond_compose_learning_packet(bundle->bond, e->mac, e->vlan, (void **)&pkt_node->port); - list_push_back(&packets, &pkt_node->list_node); + ovs_list_push_back(&packets, &pkt_node->list_node); } } ovs_rwlock_unlock(&ofproto->ml->rwlock); @@ -4564,7 +4564,7 @@ ofproto_unixctl_mcast_snooping_flush(struct unixctl_conn *conn, int argc, static struct ofport_dpif * ofbundle_get_a_port(const struct ofbundle *bundle) { - return CONTAINER_OF(list_front(&bundle->ports), struct ofport_dpif, + return CONTAINER_OF(ovs_list_front(&bundle->ports), struct ofport_dpif, bundle_node); } diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index be7c030..82559d2 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -556,7 +556,7 @@ ofproto_create(const char *datapath_name, const char *datapath_type, ofproto->tables_version = CLS_MIN_VERSION; hindex_init(&ofproto->cookies); hmap_init(&ofproto->learned_cookies); - list_init(&ofproto->expirable); + ovs_list_init(&ofproto->expirable); ofproto->connmgr = connmgr_create(ofproto, datapath_name, datapath_name); guarded_list_init(&ofproto->rule_executes); ofproto->vlan_bitmap = NULL; @@ -2944,7 +2944,7 @@ static void rule_execute_destroy(struct rule_execute *e) { ofproto_rule_unref(e->rule); - list_remove(&e->list_node); + ovs_list_remove(&e->list_node); free(e); } @@ -3014,7 +3014,7 @@ learned_cookies_update_one__(struct ofproto *ofproto, if (!c->n) { hmap_remove(&ofproto->learned_cookies, &c->u.hmap_node); - list_push_back(dead_cookies, &c->u.list_node); + ovs_list_push_back(dead_cookies, &c->u.list_node); } return; @@ -4778,9 +4778,9 @@ replace_rule_create(struct ofproto *ofproto, struct ofputil_flow_mod *fm, rule->flags = fm->flags & OFPUTIL_FF_STATE; *CONST_CAST(const struct rule_actions **, &rule->actions) = rule_actions_create(fm->ofpacts, fm->ofpacts_len); - list_init(&rule->meter_list_node); + ovs_list_init(&rule->meter_list_node); rule->eviction_group = NULL; - list_init(&rule->expirable); + ovs_list_init(&rule->expirable); rule->monitor_flags = 0; rule->add_seqno = 0; rule->modify_seqno = 0; @@ -5312,8 +5312,8 @@ ofproto_rule_reduce_timeouts(struct rule *rule, } ovs_mutex_lock(&ofproto_mutex); - if (list_is_empty(&rule->expirable)) { - list_insert(&rule->ofproto->expirable, &rule->expirable); + if (ovs_list_is_empty(&rule->expirable)) { + ovs_list_insert(&rule->ofproto->expirable, &rule->expirable); } ovs_mutex_unlock(&ofproto_mutex); @@ -5551,7 +5551,7 @@ ofproto_compose_flow_refresh_update(const struct rule *rule, fu.ofpacts = actions ? actions->ofpacts : NULL; fu.ofpacts_len = actions ? actions->ofpacts_len : 0; - if (list_is_empty(msgs)) { + if (ovs_list_is_empty(msgs)) { ofputil_start_flow_update(msgs); } ofputil_append_flow_update(&fu, msgs); @@ -5801,7 +5801,7 @@ meter_insert_rule(struct rule *rule) uint32_t meter_id = ofpacts_get_meter(a->ofpacts, a->ofpacts_len); struct meter *meter = rule->ofproto->meters[meter_id]; - list_insert(&meter->rules, &rule->meter_list_node); + ovs_list_insert(&meter->rules, &rule->meter_list_node); } static void @@ -5824,7 +5824,7 @@ meter_create(const struct ofputil_meter_config *config, meter = xzalloc(sizeof *meter); meter->provider_meter_id = provider_meter_id; meter->created = time_msec(); - list_init(&meter->rules); + ovs_list_init(&meter->rules); meter_update(meter, config); @@ -5916,7 +5916,7 @@ handle_delete_meter(struct ofconn *ofconn, struct ofputil_meter_mod *mm) ovs_mutex_lock(&ofproto_mutex); for (meter_id = first; meter_id <= last; ++meter_id) { struct meter *meter = ofproto->meters[meter_id]; - if (meter && !list_is_empty(&meter->rules)) { + if (meter && !ovs_list_is_empty(&meter->rules)) { struct rule *rule; LIST_FOR_EACH (rule, meter_list_node, &meter->rules) { @@ -6060,7 +6060,7 @@ handle_meter_request(struct ofconn *ofconn, const struct ofp_header *request, stats.meter_id = meter_id; /* Provider sets the packet and byte counts, we do the rest. */ - stats.flow_count = list_size(&meter->rules); + stats.flow_count = ovs_list_size(&meter->rules); calc_duration(meter->created, time_msec(), &stats.duration_sec, &stats.duration_nsec); stats.n_bands = meter->n_bands; @@ -6400,11 +6400,11 @@ init_group(struct ofproto *ofproto, const struct ofputil_group_mod *gm, *CONST_CAST(long long int *, &((*ofgroup)->modified)) = now; ovs_refcount_init(&(*ofgroup)->ref_count); - list_init(&(*ofgroup)->buckets); + ovs_list_init(&(*ofgroup)->buckets); ofputil_bucket_clone_list(&(*ofgroup)->buckets, &gm->buckets, NULL); *CONST_CAST(uint32_t *, &(*ofgroup)->n_buckets) = - list_size(&(*ofgroup)->buckets); + ovs_list_size(&(*ofgroup)->buckets); memcpy(CONST_CAST(struct ofputil_group_props *, &(*ofgroup)->props), &gm->props, sizeof (struct ofputil_group_props)); @@ -6489,7 +6489,7 @@ copy_buckets_for_insert_bucket(const struct ofgroup *ofgroup, return OFPERR_OFPGMFC_UNKNOWN_BUCKET; } - if (!list_is_empty(&new_ofgroup->buckets)) { + if (!ovs_list_is_empty(&new_ofgroup->buckets)) { last = ofputil_bucket_list_back(&new_ofgroup->buckets); } } @@ -6503,7 +6503,7 @@ copy_buckets_for_insert_bucket(const struct ofgroup *ofgroup, /* Rearrange list according to command_bucket_id */ if (command_bucket_id == OFPG15_BUCKET_LAST) { - if (!list_is_empty(&ofgroup->buckets)) { + if (!ovs_list_is_empty(&ofgroup->buckets)) { struct ofputil_bucket *new_first; const struct ofputil_bucket *first; @@ -6511,7 +6511,7 @@ copy_buckets_for_insert_bucket(const struct ofgroup *ofgroup, new_first = ofputil_bucket_find(&new_ofgroup->buckets, first->bucket_id); - list_splice(new_ofgroup->buckets.next, &new_first->list_node, + ovs_list_splice(new_ofgroup->buckets.next, &new_first->list_node, &new_ofgroup->buckets); } } else if (command_bucket_id <= OFPG15_BUCKET_MAX && last) { @@ -6520,7 +6520,7 @@ copy_buckets_for_insert_bucket(const struct ofgroup *ofgroup, /* Presence of bucket is checked above so after should never be NULL */ after = ofputil_bucket_find(&new_ofgroup->buckets, command_bucket_id); - list_splice(after->list_node.next, new_ofgroup->buckets.next, + ovs_list_splice(after->list_node.next, new_ofgroup->buckets.next, last->list_node.next); } @@ -6543,11 +6543,11 @@ copy_buckets_for_remove_bucket(const struct ofgroup *ofgroup, } if (command_bucket_id == OFPG15_BUCKET_FIRST) { - if (!list_is_empty(&ofgroup->buckets)) { + if (!ovs_list_is_empty(&ofgroup->buckets)) { skip = ofputil_bucket_list_front(&ofgroup->buckets); } } else if (command_bucket_id == OFPG15_BUCKET_LAST) { - if (!list_is_empty(&ofgroup->buckets)) { + if (!ovs_list_is_empty(&ofgroup->buckets)) { skip = ofputil_bucket_list_back(&ofgroup->buckets); } } else { @@ -7846,7 +7846,7 @@ ofproto_rule_insert__(struct ofproto *ofproto, struct rule *rule) ovs_assert(rule->removed); if (rule->hard_timeout || rule->idle_timeout) { - list_insert(&ofproto->expirable, &rule->expirable); + ovs_list_insert(&ofproto->expirable, &rule->expirable); } cookies_insert(ofproto, rule); eviction_group_add_rule(rule); @@ -7867,12 +7867,12 @@ ofproto_rule_remove__(struct ofproto *ofproto, struct rule *rule) cookies_remove(ofproto, rule); eviction_group_remove_rule(rule); - if (!list_is_empty(&rule->expirable)) { - list_remove(&rule->expirable); + if (!ovs_list_is_empty(&rule->expirable)) { + ovs_list_remove(&rule->expirable); } - if (!list_is_empty(&rule->meter_list_node)) { - list_remove(&rule->meter_list_node); - list_init(&rule->meter_list_node); + if (!ovs_list_is_empty(&rule->meter_list_node)) { + ovs_list_remove(&rule->meter_list_node); + ovs_list_init(&rule->meter_list_node); } rule->removed = true; diff --git a/ofproto/pinsched.c b/ofproto/pinsched.c index c7118a6..469ba23 100644 --- a/ofproto/pinsched.c +++ b/ofproto/pinsched.c @@ -69,7 +69,7 @@ advance_txq(struct pinsched *ps) static struct ofpbuf * dequeue_packet(struct pinsched *ps, struct pinqueue *q) { - struct ofpbuf *packet = ofpbuf_from_list(list_pop_front(&q->packets)); + struct ofpbuf *packet = ofpbuf_from_list(ovs_list_pop_front(&q->packets)); q->n--; ps->n_queued--; return packet; @@ -113,7 +113,7 @@ pinqueue_get(struct pinsched *ps, ofp_port_t port_no) q = xmalloc(sizeof *q); hmap_insert(&ps->queues, &q->node, hash); q->port_no = port_no; - list_init(&q->packets); + ovs_list_init(&q->packets); q->n = 0; return q; } @@ -185,14 +185,14 @@ void pinsched_send(struct pinsched *ps, ofp_port_t port_no, struct ofpbuf *packet, struct ovs_list *txq) { - list_init(txq); + ovs_list_init(txq); if (!ps) { - list_push_back(txq, &packet->list_node); + ovs_list_push_back(txq, &packet->list_node); } else if (!ps->n_queued && get_token(ps)) { /* In the common case where we are not constrained by the rate limit, * let the packet take the normal path. */ ps->n_normal++; - list_push_back(txq, &packet->list_node); + ovs_list_push_back(txq, &packet->list_node); } else { /* Otherwise queue it up for the periodic callback to drain out. */ if (ps->n_queued * 1000 >= ps->token_bucket.burst) { @@ -200,7 +200,7 @@ pinsched_send(struct pinsched *ps, ofp_port_t port_no, } struct pinqueue *q = pinqueue_get(ps, port_no); - list_push_back(&q->packets, &packet->list_node); + ovs_list_push_back(&q->packets, &packet->list_node); q->n++; ps->n_queued++; ps->n_limited++; @@ -210,7 +210,7 @@ pinsched_send(struct pinsched *ps, ofp_port_t port_no, void pinsched_run(struct pinsched *ps, struct ovs_list *txq) { - list_init(txq); + ovs_list_init(txq); if (ps) { int i; @@ -218,7 +218,7 @@ pinsched_run(struct pinsched *ps, struct ovs_list *txq) * number of iterations to allow other code to get work done too. */ for (i = 0; ps->n_queued && get_token(ps) && i < 50; i++) { struct ofpbuf *packet = get_tx_packet(ps); - list_push_back(txq, &packet->list_node); + ovs_list_push_back(txq, &packet->list_node); } } } diff --git a/ovn/controller/ofctrl.c b/ovn/controller/ofctrl.c index 5f4982f..a1e5d50 100644 --- a/ovn/controller/ofctrl.c +++ b/ovn/controller/ofctrl.c @@ -212,8 +212,8 @@ recv_S_TLV_TABLE_REQUESTED(const struct ofp_header *oh, enum ofptype type) struct ofputil_tlv_table_mod ttm; ttm.command = NXTTMC_ADD; - list_init(&ttm.mappings); - list_push_back(&ttm.mappings, &tm.list_node); + ovs_list_init(&ttm.mappings); + ovs_list_push_back(&ttm.mappings, &tm.list_node); xid = queue_msg(ofputil_encode_tlv_table_mod(OFP13_VERSION, &ttm)); xid2 = queue_msg(ofputil_encode_barrier_request(OFP13_VERSION)); diff --git a/ovn/lib/expr.c b/ovn/lib/expr.c index 2b8df84..aae5df6 100644 --- a/ovn/lib/expr.c +++ b/ovn/lib/expr.c @@ -124,7 +124,7 @@ expr_create_andor(enum expr_type type) { struct expr *e = xmalloc(sizeof *e); e->type = type; - list_init(&e->andor); + ovs_list_init(&e->andor); return e; } @@ -147,19 +147,19 @@ expr_combine(enum expr_type type, struct expr *a, struct expr *b) return a; } else if (a->type == type) { if (b->type == type) { - list_splice(&a->andor, b->andor.next, &b->andor); + ovs_list_splice(&a->andor, b->andor.next, &b->andor); free(b); } else { - list_push_back(&a->andor, &b->node); + ovs_list_push_back(&a->andor, &b->node); } return a; } else if (b->type == type) { - list_push_front(&b->andor, &a->node); + ovs_list_push_front(&b->andor, &a->node); return b; } else { struct expr *e = expr_create_andor(type); - list_push_back(&e->andor, &a->node); - list_push_back(&e->andor, &b->node); + ovs_list_push_back(&e->andor, &a->node); + ovs_list_push_back(&e->andor, &b->node); return e; } } @@ -171,10 +171,10 @@ expr_insert_andor(struct expr *andor, struct expr *before, struct expr *new) if (andor->type == EXPR_T_AND) { /* Conjunction junction, what's your function? */ } - list_splice(&before->node, new->andor.next, &new->andor); + ovs_list_splice(&before->node, new->andor.next, &new->andor); free(new); } else { - list_insert(&before->node, &new->node); + ovs_list_insert(&before->node, &new->node); } } @@ -225,18 +225,18 @@ expr_fix_andor(struct expr *expr, bool short_circuit) expr_destroy(expr); return expr_create_boolean(short_circuit); } else { - list_remove(&sub->node); + ovs_list_remove(&sub->node); expr_destroy(sub); } } } - if (list_is_short(&expr->andor)) { - if (list_is_empty(&expr->andor)) { + if (ovs_list_is_short(&expr->andor)) { + if (ovs_list_is_empty(&expr->andor)) { free(expr); return expr_create_boolean(!short_circuit); } else { - sub = expr_from_node(list_front(&expr->andor)); + sub = expr_from_node(ovs_list_front(&expr->andor)); free(expr); return sub; } @@ -1269,7 +1269,7 @@ expr_clone_andor(struct expr *expr) LIST_FOR_EACH (sub, node, &expr->andor) { struct expr *new_sub = expr_clone(sub); - list_push_back(&new->andor, &new_sub->node); + ovs_list_push_back(&new->andor, &new_sub->node); } return new; } @@ -1313,7 +1313,7 @@ expr_destroy(struct expr *expr) case EXPR_T_AND: case EXPR_T_OR: LIST_FOR_EACH_SAFE (sub, next, node, &expr->andor) { - list_remove(&sub->node); + ovs_list_remove(&sub->node); expr_destroy(sub); } break; @@ -1377,7 +1377,7 @@ expr_annotate_cmp(struct expr *expr, const struct shash *symtab, struct annotation_nesting an; an.symbol = symbol; - list_push_back(nesting, &an.node); + ovs_list_push_back(nesting, &an.node); struct expr *prereqs = NULL; if (symbol->prereqs) { @@ -1419,13 +1419,13 @@ expr_annotate_cmp(struct expr *expr, const struct shash *symtab, } } - list_remove(&an.node); + ovs_list_remove(&an.node); return prereqs ? expr_combine(EXPR_T_AND, expr, prereqs) : expr; error: expr_destroy(expr); expr_destroy(prereqs); - list_remove(&an.node); + ovs_list_remove(&an.node); return NULL; } @@ -1442,7 +1442,7 @@ expr_annotate__(struct expr *expr, const struct shash *symtab, struct expr *sub, *next; LIST_FOR_EACH_SAFE (sub, next, node, &expr->andor) { - list_remove(&sub->node); + ovs_list_remove(&sub->node); struct expr *new_sub = expr_annotate__(sub, symtab, nesting, errorp); if (!new_sub) { @@ -1568,7 +1568,7 @@ expr_simplify(struct expr *expr) case EXPR_T_AND: case EXPR_T_OR: LIST_FOR_EACH_SAFE (sub, next, node, &expr->andor) { - list_remove(&sub->node); + ovs_list_remove(&sub->node); expr_insert_andor(expr, next, expr_simplify(sub)); } return expr_fix(expr); @@ -1633,8 +1633,8 @@ compare_expr_sort(const void *a_, const void *b_) enum expr_type b_type = a->expr->type; return a_type < b_type ? -1 : a_type > b_type; } else if (a->type == EXPR_T_AND || a->type == EXPR_T_OR) { - size_t a_len = list_size(&a->expr->andor); - size_t b_len = list_size(&b->expr->andor); + size_t a_len = ovs_list_size(&a->expr->andor); + size_t b_len = ovs_list_size(&b->expr->andor); return a_len < b_len ? -1 : a_len > b_len; } else { return 0; @@ -1662,7 +1662,7 @@ disjunction_matches_string(const struct expr *or, const char *s) static struct expr * crush_and_string(struct expr *expr, const struct expr_symbol *symbol) { - ovs_assert(!list_is_short(&expr->andor)); + ovs_assert(!ovs_list_is_short(&expr->andor)); struct expr *singleton = NULL; @@ -1670,12 +1670,12 @@ crush_and_string(struct expr *expr, const struct expr_symbol *symbol) * EXPR_T_OR with EXPR_T_CMP subexpressions. */ struct expr *sub, *next = NULL; LIST_FOR_EACH_SAFE (sub, next, node, &expr->andor) { - list_remove(&sub->node); + ovs_list_remove(&sub->node); struct expr *new = crush_cmps(sub, symbol); switch (new->type) { case EXPR_T_CMP: if (!singleton) { - list_insert(&next->node, &new->node); + ovs_list_insert(&next->node, &new->node); singleton = new; } else { bool match = !strcmp(new->cmp.string, singleton->cmp.string); @@ -1689,7 +1689,7 @@ crush_and_string(struct expr *expr, const struct expr_symbol *symbol) case EXPR_T_AND: OVS_NOT_REACHED(); case EXPR_T_OR: - list_insert(&next->node, &new->node); + ovs_list_insert(&next->node, &new->node); break; case EXPR_T_BOOLEAN: if (!new->boolean) { @@ -1711,7 +1711,7 @@ crush_and_string(struct expr *expr, const struct expr_symbol *symbol) return expr_create_boolean(false); } } - list_remove(&singleton->node); + ovs_list_remove(&singleton->node); expr_destroy(expr); return singleton; } @@ -1747,7 +1747,7 @@ crush_and_string(struct expr *expr, const struct expr_symbol *symbol) sub->type = EXPR_T_CMP; sub->cmp.symbol = symbol; sub->cmp.string = xstrdup(string); - list_push_back(&expr->andor, &sub->node); + ovs_list_push_back(&expr->andor, &sub->node); } sset_destroy(&result); return expr_fix(expr); @@ -1758,7 +1758,7 @@ crush_and_string(struct expr *expr, const struct expr_symbol *symbol) static struct expr * crush_and_numeric(struct expr *expr, const struct expr_symbol *symbol) { - ovs_assert(!list_is_short(&expr->andor)); + ovs_assert(!ovs_list_is_short(&expr->andor)); union mf_subvalue value, mask; memset(&value, 0, sizeof value); @@ -1766,7 +1766,7 @@ crush_and_numeric(struct expr *expr, const struct expr_symbol *symbol) struct expr *sub, *next = NULL; LIST_FOR_EACH_SAFE (sub, next, node, &expr->andor) { - list_remove(&sub->node); + ovs_list_remove(&sub->node); struct expr *new = crush_cmps(sub, symbol); switch (new->type) { case EXPR_T_CMP: @@ -1782,7 +1782,7 @@ crush_and_numeric(struct expr *expr, const struct expr_symbol *symbol) case EXPR_T_AND: OVS_NOT_REACHED(); case EXPR_T_OR: - list_insert(&next->node, &new->node); + ovs_list_insert(&next->node, &new->node); break; case EXPR_T_BOOLEAN: if (!new->boolean) { @@ -1793,7 +1793,7 @@ crush_and_numeric(struct expr *expr, const struct expr_symbol *symbol) break; } } - if (list_is_empty(&expr->andor)) { + if (ovs_list_is_empty(&expr->andor)) { if (is_all_zeros(&mask, sizeof mask)) { expr_destroy(expr); return expr_create_boolean(true); @@ -1808,35 +1808,35 @@ crush_and_numeric(struct expr *expr, const struct expr_symbol *symbol) expr_destroy(expr); return cmp; } - } else if (list_is_short(&expr->andor)) { + } else if (ovs_list_is_short(&expr->andor)) { /* Transform "a && (b || c || d)" into "ab || ac || ad" where "ab" is * computed as "a && b", etc. */ - struct expr *disjuncts = expr_from_node(list_pop_front(&expr->andor)); + struct expr *disjuncts = expr_from_node(ovs_list_pop_front(&expr->andor)); struct expr *or; or = xmalloc(sizeof *or); or->type = EXPR_T_OR; - list_init(&or->andor); + ovs_list_init(&or->andor); ovs_assert(disjuncts->type == EXPR_T_OR); LIST_FOR_EACH_SAFE (sub, next, node, &disjuncts->andor) { ovs_assert(sub->type == EXPR_T_CMP); - list_remove(&sub->node); + ovs_list_remove(&sub->node); if (mf_subvalue_intersect(&value, &mask, &sub->cmp.value, &sub->cmp.mask, &sub->cmp.value, &sub->cmp.mask)) { - list_push_back(&or->andor, &sub->node); + ovs_list_push_back(&or->andor, &sub->node); } else { expr_destroy(sub); } } free(disjuncts); free(expr); - if (list_is_empty(&or->andor)) { + if (ovs_list_is_empty(&or->andor)) { free(or); return expr_create_boolean(false); - } else if (list_is_short(&or->andor)) { - struct expr *cmp = expr_from_node(list_pop_front(&or->andor)); + } else if (ovs_list_is_short(&or->andor)) { + struct expr *cmp = expr_from_node(ovs_list_pop_front(&or->andor)); free(or); return cmp; } else { @@ -1845,14 +1845,14 @@ crush_and_numeric(struct expr *expr, const struct expr_symbol *symbol) } else { /* Transform "x && (a0 || a1) && (b0 || b1) && ..." into * "(xa0b0 || xa0b1 || xa1b0 || xa1b1) && ...". */ - struct expr *as = expr_from_node(list_pop_front(&expr->andor)); - struct expr *bs = expr_from_node(list_pop_front(&expr->andor)); + struct expr *as = expr_from_node(ovs_list_pop_front(&expr->andor)); + struct expr *bs = expr_from_node(ovs_list_pop_front(&expr->andor)); struct expr *new = NULL; struct expr *or; or = xmalloc(sizeof *or); or->type = EXPR_T_OR; - list_init(&or->andor); + ovs_list_init(&or->andor); struct expr *a; LIST_FOR_EACH (a, node, &as->andor) { @@ -1877,7 +1877,7 @@ crush_and_numeric(struct expr *expr, const struct expr_symbol *symbol) if (mf_subvalue_intersect(&a_value, &a_mask, &b->cmp.value, &b->cmp.mask, &new->cmp.value, &new->cmp.mask)) { - list_push_back(&or->andor, &new->node); + ovs_list_push_back(&or->andor, &new->node); new = NULL; } } @@ -1886,22 +1886,22 @@ crush_and_numeric(struct expr *expr, const struct expr_symbol *symbol) expr_destroy(bs); free(new); - if (list_is_empty(&or->andor)) { + if (ovs_list_is_empty(&or->andor)) { expr_destroy(expr); free(or); return expr_create_boolean(false); - } else if (list_is_short(&or->andor)) { - struct expr *cmp = expr_from_node(list_pop_front(&or->andor)); + } else if (ovs_list_is_short(&or->andor)) { + struct expr *cmp = expr_from_node(ovs_list_pop_front(&or->andor)); free(or); - if (list_is_empty(&expr->andor)) { + if (ovs_list_is_empty(&expr->andor)) { expr_destroy(expr); return crush_cmps(cmp, symbol); } else { return crush_cmps(expr_combine(EXPR_T_AND, cmp, expr), symbol); } - } else if (!list_is_empty(&expr->andor)) { + } else if (!ovs_list_is_empty(&expr->andor)) { struct expr *e = expr_combine(EXPR_T_AND, or, expr); - ovs_assert(!list_is_short(&e->andor)); + ovs_assert(!ovs_list_is_short(&e->andor)); return crush_cmps(e, symbol); } else { expr_destroy(expr); @@ -1945,7 +1945,7 @@ crush_or(struct expr *expr, const struct expr_symbol *symbol) * OR-expression entirely; if so, return the result. Otherwise, 'expr' * is now a disjunction of cmps over the same symbol. */ LIST_FOR_EACH_SAFE (sub, next, node, &expr->andor) { - list_remove(&sub->node); + ovs_list_remove(&sub->node); expr_insert_andor(expr, next, crush_cmps(sub, symbol)); } expr = expr_fix(expr); @@ -1954,7 +1954,7 @@ crush_or(struct expr *expr, const struct expr_symbol *symbol) } /* Sort subexpressions by value and mask, to bring together duplicates. */ - size_t n = list_size(&expr->andor); + size_t n = ovs_list_size(&expr->andor); struct expr **subs = xmalloc(n * sizeof *subs); size_t i = 0; @@ -1966,13 +1966,13 @@ crush_or(struct expr *expr, const struct expr_symbol *symbol) qsort(subs, n, sizeof *subs, compare_cmps_cb); /* Eliminate duplicates. */ - list_init(&expr->andor); - list_push_back(&expr->andor, &subs[0]->node); + ovs_list_init(&expr->andor); + ovs_list_push_back(&expr->andor, &subs[0]->node); for (i = 1; i < n; i++) { - struct expr *a = expr_from_node(list_back(&expr->andor)); + struct expr *a = expr_from_node(ovs_list_back(&expr->andor)); struct expr *b = subs[i]; if (compare_cmps_3way(a, b)) { - list_push_back(&expr->andor, &b->node); + ovs_list_push_back(&expr->andor, &b->node); } else { expr_destroy(b); } @@ -2011,7 +2011,7 @@ crush_cmps(struct expr *expr, const struct expr_symbol *symbol) static struct expr * expr_sort(struct expr *expr) { - size_t n = list_size(&expr->andor); + size_t n = ovs_list_size(&expr->andor); struct expr_sort *subs = xmalloc(n * sizeof *subs); struct expr *sub; size_t i; @@ -2027,7 +2027,7 @@ expr_sort(struct expr *expr) qsort(subs, n, sizeof *subs, compare_expr_sort); - list_init(&expr->andor); + ovs_list_init(&expr->andor); for (int i = 0; i < n; ) { if (subs[i].relop) { int j; @@ -2046,7 +2046,7 @@ expr_sort(struct expr *expr) combined = expr_combine(EXPR_T_AND, combined, subs[k].expr); } - ovs_assert(!list_is_short(&combined->andor)); + ovs_assert(!ovs_list_is_short(&combined->andor)); crushed = crush_cmps(combined, subs[i].relop); } if (crushed->type == EXPR_T_BOOLEAN) { @@ -2099,15 +2099,15 @@ expr_normalize_and(struct expr *expr) &b->cmp.value, &b->cmp.mask, &b->cmp.value, &b->cmp.mask) : !strcmp(a->cmp.string, b->cmp.string)) { - list_remove(&a->node); + ovs_list_remove(&a->node); expr_destroy(a); } else { expr_destroy(expr); return expr_create_boolean(false); } } - if (list_is_short(&expr->andor)) { - struct expr *sub = expr_from_node(list_front(&expr->andor)); + if (ovs_list_is_short(&expr->andor)) { + struct expr *sub = expr_from_node(ovs_list_front(&expr->andor)); free(expr); return sub; } @@ -2135,14 +2135,14 @@ expr_normalize_and(struct expr *expr) LIST_FOR_EACH (p, node, &term->andor) { struct expr *new = expr_clone(p); - list_push_back(&and->andor, &new->node); + ovs_list_push_back(&and->andor, &new->node); } } else { struct expr *new = expr_clone(term); - list_push_back(&and->andor, &new->node); + ovs_list_push_back(&and->andor, &new->node); } } - list_push_back(&or->andor, &and->node); + ovs_list_push_back(&or->andor, &and->node); } expr_destroy(expr); return expr_normalize_or(or); @@ -2158,7 +2158,7 @@ expr_normalize_or(struct expr *expr) LIST_FOR_EACH_SAFE (sub, next, node, &expr->andor) { if (sub->type == EXPR_T_AND) { - list_remove(&sub->node); + ovs_list_remove(&sub->node); struct expr *new = expr_normalize_and(sub); if (new->type == EXPR_T_BOOLEAN) { @@ -2174,12 +2174,12 @@ expr_normalize_or(struct expr *expr) ovs_assert(sub->type == EXPR_T_CMP); } } - if (list_is_empty(&expr->andor)) { + if (ovs_list_is_empty(&expr->andor)) { free(expr); return expr_create_boolean(false); } - if (list_is_short(&expr->andor)) { - struct expr *sub = expr_from_node(list_pop_front(&expr->andor)); + if (ovs_list_is_short(&expr->andor)) { + struct expr *sub = expr_from_node(ovs_list_pop_front(&expr->andor)); free(expr); return sub; } @@ -2567,7 +2567,7 @@ expr_honors_invariants(const struct expr *expr) case EXPR_T_AND: case EXPR_T_OR: - if (list_is_short(&expr->andor)) { + if (ovs_list_is_short(&expr->andor)) { return false; } LIST_FOR_EACH (sub, node, &expr->andor) { diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index 19609c9..7918401 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -321,9 +321,9 @@ join_datapaths(struct northd_context *ctx, struct hmap *datapaths, struct ovs_list *both) { hmap_init(datapaths); - list_init(sb_only); - list_init(nb_only); - list_init(both); + ovs_list_init(sb_only); + ovs_list_init(nb_only); + ovs_list_init(both); const struct sbrec_datapath_binding *sb, *sb_next; SBREC_DATAPATH_BINDING_FOR_EACH_SAFE (sb, sb_next, ctx->ovnsb_idl) { @@ -352,7 +352,7 @@ join_datapaths(struct northd_context *ctx, struct hmap *datapaths, struct ovn_datapath *od = ovn_datapath_create(datapaths, &key, NULL, NULL, sb); - list_push_back(sb_only, &od->list); + ovs_list_push_back(sb_only, &od->list); } const struct nbrec_logical_switch *nbs; @@ -361,12 +361,12 @@ join_datapaths(struct northd_context *ctx, struct hmap *datapaths, &nbs->header_.uuid); if (od) { od->nbs = nbs; - list_remove(&od->list); - list_push_back(both, &od->list); + ovs_list_remove(&od->list); + ovs_list_push_back(both, &od->list); } else { od = ovn_datapath_create(datapaths, &nbs->header_.uuid, nbs, NULL, NULL); - list_push_back(nb_only, &od->list); + ovs_list_push_back(nb_only, &od->list); } } @@ -377,8 +377,8 @@ join_datapaths(struct northd_context *ctx, struct hmap *datapaths, if (od) { if (!od->nbs) { od->nbr = nbr; - list_remove(&od->list); - list_push_back(both, &od->list); + ovs_list_remove(&od->list); + ovs_list_push_back(both, &od->list); } else { /* Can't happen! */ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1); @@ -390,7 +390,7 @@ join_datapaths(struct northd_context *ctx, struct hmap *datapaths, } else { od = ovn_datapath_create(datapaths, &nbr->header_.uuid, NULL, nbr, NULL); - list_push_back(nb_only, &od->list); + ovs_list_push_back(nb_only, &od->list); } od->gateway = 0; @@ -429,7 +429,7 @@ build_datapaths(struct northd_context *ctx, struct hmap *datapaths) join_datapaths(ctx, datapaths, &sb_only, &nb_only, &both); - if (!list_is_empty(&nb_only)) { + if (!ovs_list_is_empty(&nb_only)) { /* First index the in-use datapath tunnel IDs. */ struct hmap dp_tnlids = HMAP_INITIALIZER(&dp_tnlids); struct ovn_datapath *od; @@ -460,7 +460,7 @@ build_datapaths(struct northd_context *ctx, struct hmap *datapaths) /* Delete southbound records without northbound matches. */ struct ovn_datapath *od, *next; LIST_FOR_EACH_SAFE (od, next, list, &sb_only) { - list_remove(&od->list); + ovs_list_remove(&od->list); sbrec_datapath_binding_delete(od->sb); ovn_datapath_destroy(datapaths, od); } @@ -548,15 +548,15 @@ join_logical_ports(struct northd_context *ctx, struct ovs_list *both) { hmap_init(ports); - list_init(sb_only); - list_init(nb_only); - list_init(both); + ovs_list_init(sb_only); + ovs_list_init(nb_only); + ovs_list_init(both); const struct sbrec_port_binding *sb; SBREC_PORT_BINDING_FOR_EACH (sb, ctx->ovnsb_idl) { struct ovn_port *op = ovn_port_create(ports, sb->logical_port, NULL, NULL, sb); - list_push_back(sb_only, &op->list); + ovs_list_push_back(sb_only, &op->list); } struct ovn_datapath *od; @@ -574,11 +574,11 @@ join_logical_ports(struct northd_context *ctx, continue; } op->nbs = nbs; - list_remove(&op->list); - list_push_back(both, &op->list); + ovs_list_remove(&op->list); + ovs_list_push_back(both, &op->list); } else { op = ovn_port_create(ports, nbs->name, nbs, NULL, NULL); - list_push_back(nb_only, &op->list); + ovs_list_push_back(nb_only, &op->list); } op->od = od; @@ -616,11 +616,11 @@ join_logical_ports(struct northd_context *ctx, continue; } op->nbr = nbr; - list_remove(&op->list); - list_push_back(both, &op->list); + ovs_list_remove(&op->list); + ovs_list_push_back(both, &op->list); } else { op = ovn_port_create(ports, nbr->name, NULL, nbr, NULL); - list_push_back(nb_only, &op->list); + ovs_list_push_back(nb_only, &op->list); } op->ip = ip; @@ -751,7 +751,7 @@ build_ports(struct northd_context *ctx, struct hmap *datapaths, /* Delete southbound records without northbound matches. */ LIST_FOR_EACH_SAFE(op, next, list, &sb_only) { - list_remove(&op->list); + ovs_list_remove(&op->list); sbrec_port_binding_delete(op->sb); ovn_port_destroy(ports, op); } diff --git a/ovsdb/jsonrpc-server.c b/ovsdb/jsonrpc-server.c index 14cff68..4913d7e 100644 --- a/ovsdb/jsonrpc-server.c +++ b/ovsdb/jsonrpc-server.c @@ -254,7 +254,7 @@ ovsdb_jsonrpc_server_add_remote(struct ovsdb_jsonrpc_server *svr, remote = xmalloc(sizeof *remote); remote->server = svr; remote->listener = listener; - list_init(&remote->sessions); + ovs_list_init(&remote->sessions); remote->dscp = options->dscp; shash_add(&svr->remotes, name, remote); @@ -298,8 +298,8 @@ ovsdb_jsonrpc_server_get_remote_status( if (remote->listener) { status->bound_port = pstream_get_bound_port(remote->listener); - status->is_connected = !list_is_empty(&remote->sessions); - status->n_connections = list_size(&remote->sessions); + status->is_connected = !ovs_list_is_empty(&remote->sessions); + status->n_connections = ovs_list_size(&remote->sessions); return true; } @@ -427,7 +427,7 @@ ovsdb_jsonrpc_session_create(struct ovsdb_jsonrpc_remote *remote, s = xzalloc(sizeof *s); ovsdb_session_init(&s->up, &remote->server->up); s->remote = remote; - list_push_back(&remote->sessions, &s->node); + ovs_list_push_back(&remote->sessions, &s->node); hmap_init(&s->triggers); hmap_init(&s->monitors); s->js = js; @@ -449,7 +449,7 @@ ovsdb_jsonrpc_session_close(struct ovsdb_jsonrpc_session *s) hmap_destroy(&s->triggers); jsonrpc_session_close(s->js); - list_remove(&s->node); + ovs_list_remove(&s->node); s->remote->server->n_sessions--; ovsdb_session_destroy(&s->up); free(s); @@ -607,12 +607,12 @@ ovsdb_jsonrpc_active_session_get_status( const struct ovs_list *sessions = &remote->sessions; const struct ovsdb_jsonrpc_session *s; - if (list_is_empty(sessions)) { + if (ovs_list_is_empty(sessions)) { return false; } - ovs_assert(list_is_singleton(sessions)); - s = CONTAINER_OF(list_front(sessions), struct ovsdb_jsonrpc_session, node); + ovs_assert(ovs_list_is_singleton(sessions)); + s = CONTAINER_OF(ovs_list_front(sessions), struct ovsdb_jsonrpc_session, node); ovsdb_jsonrpc_session_get_status(s, status); status->n_connections = 1; @@ -1046,7 +1046,7 @@ ovsdb_jsonrpc_trigger_complete_all(struct ovsdb_jsonrpc_session *s) static void ovsdb_jsonrpc_trigger_complete_done(struct ovsdb_jsonrpc_session *s) { - while (!list_is_empty(&s->up.completions)) { + while (!ovs_list_is_empty(&s->up.completions)) { struct ovsdb_jsonrpc_trigger *t = CONTAINER_OF(s->up.completions.next, struct ovsdb_jsonrpc_trigger, trigger.node); diff --git a/ovsdb/monitor.c b/ovsdb/monitor.c index a393c24..bbeb0e1 100644 --- a/ovsdb/monitor.c +++ b/ovsdb/monitor.c @@ -313,7 +313,7 @@ ovsdb_monitor_add_jsonrpc_monitor(struct ovsdb_monitor *dbmon, jm = xzalloc(sizeof *jm); jm->jsonrpc_monitor = jsonrpc_monitor; - list_push_back(&dbmon->jsonrpc_monitors, &jm->node); + ovs_list_push_back(&dbmon->jsonrpc_monitors, &jm->node); } struct ovsdb_monitor * @@ -326,7 +326,7 @@ ovsdb_monitor_create(struct ovsdb *db, ovsdb_replica_init(&dbmon->replica, &ovsdb_jsonrpc_replica_class); ovsdb_add_replica(db, &dbmon->replica); - list_init(&dbmon->jsonrpc_monitors); + ovs_list_init(&dbmon->jsonrpc_monitors); dbmon->db = db; dbmon->n_transactions = 0; shash_init(&dbmon->tables); @@ -964,7 +964,7 @@ ovsdb_monitor_remove_jsonrpc_monitor(struct ovsdb_monitor *dbmon, { struct jsonrpc_monitor_node *jm; - if (list_is_empty(&dbmon->jsonrpc_monitors)) { + if (ovs_list_is_empty(&dbmon->jsonrpc_monitors)) { ovsdb_monitor_destroy(dbmon); return; } @@ -978,11 +978,11 @@ ovsdb_monitor_remove_jsonrpc_monitor(struct ovsdb_monitor *dbmon, struct ovsdb_monitor_table *mt = node->data; ovsdb_monitor_table_untrack_changes(mt, unflushed); } - list_remove(&jm->node); + ovs_list_remove(&jm->node); free(jm); /* Destroy ovsdb monitor if this is the last user. */ - if (list_is_empty(&dbmon->jsonrpc_monitors)) { + if (ovs_list_is_empty(&dbmon->jsonrpc_monitors)) { ovsdb_monitor_destroy(dbmon); } @@ -1076,7 +1076,7 @@ ovsdb_monitor_add(struct ovsdb_monitor *new_dbmon) /* New_dbmon should be associated with only one jsonrpc * connections. */ - ovs_assert(list_is_singleton(&new_dbmon->jsonrpc_monitors)); + ovs_assert(ovs_list_is_singleton(&new_dbmon->jsonrpc_monitors)); hash = ovsdb_monitor_hash(new_dbmon, 0); HMAP_FOR_EACH_WITH_HASH(dbmon, hmap_node, hash, &ovsdb_monitors) { @@ -1094,7 +1094,7 @@ ovsdb_monitor_destroy(struct ovsdb_monitor *dbmon) { struct shash_node *node; - list_remove(&dbmon->replica.node); + ovs_list_remove(&dbmon->replica.node); if (!hmap_node_is_null(&dbmon->hmap_node)) { hmap_remove(&ovsdb_monitors, &dbmon->hmap_node); diff --git a/ovsdb/ovsdb.c b/ovsdb/ovsdb.c index 56d2333..b7cc655 100644 --- a/ovsdb/ovsdb.c +++ b/ovsdb/ovsdb.c @@ -328,8 +328,8 @@ ovsdb_create(struct ovsdb_schema *schema) db = xmalloc(sizeof *db); db->schema = schema; - list_init(&db->replicas); - list_init(&db->triggers); + ovs_list_init(&db->replicas); + ovs_list_init(&db->triggers); db->run_triggers = false; shash_init(&db->tables); @@ -361,9 +361,9 @@ ovsdb_destroy(struct ovsdb *db) struct shash_node *node; /* Remove all the replicas. */ - while (!list_is_empty(&db->replicas)) { + while (!ovs_list_is_empty(&db->replicas)) { struct ovsdb_replica *r - = CONTAINER_OF(list_pop_back(&db->replicas), + = CONTAINER_OF(ovs_list_pop_back(&db->replicas), struct ovsdb_replica, node); ovsdb_remove_replica(db, r); } @@ -420,12 +420,12 @@ ovsdb_replica_init(struct ovsdb_replica *r, void ovsdb_add_replica(struct ovsdb *db, struct ovsdb_replica *r) { - list_push_back(&db->replicas, &r->node); + ovs_list_push_back(&db->replicas, &r->node); } void ovsdb_remove_replica(struct ovsdb *db OVS_UNUSED, struct ovsdb_replica *r) { - list_remove(&r->node); + ovs_list_remove(&r->node); (r->class->destroy)(r); } diff --git a/ovsdb/row.c b/ovsdb/row.c index d332407..23b0243 100644 --- a/ovsdb/row.c +++ b/ovsdb/row.c @@ -37,8 +37,8 @@ allocate_row(const struct ovsdb_table *table) struct ovsdb_row *row = xmalloc(row_size); row->table = CONST_CAST(struct ovsdb_table *, table); row->txn_row = NULL; - list_init(&row->src_refs); - list_init(&row->dst_refs); + ovs_list_init(&row->src_refs); + ovs_list_init(&row->dst_refs); row->n_refs = 0; return row; } @@ -85,14 +85,14 @@ ovsdb_row_destroy(struct ovsdb_row *row) const struct shash_node *node; LIST_FOR_EACH_SAFE (weak, next, dst_node, &row->dst_refs) { - list_remove(&weak->src_node); - list_remove(&weak->dst_node); + ovs_list_remove(&weak->src_node); + ovs_list_remove(&weak->dst_node); free(weak); } LIST_FOR_EACH_SAFE (weak, next, src_node, &row->src_refs) { - list_remove(&weak->src_node); - list_remove(&weak->dst_node); + ovs_list_remove(&weak->src_node); + ovs_list_remove(&weak->dst_node); free(weak); } diff --git a/ovsdb/server.c b/ovsdb/server.c index 82f55cb..eca9151 100644 --- a/ovsdb/server.c +++ b/ovsdb/server.c @@ -25,7 +25,7 @@ void ovsdb_session_init(struct ovsdb_session *session, struct ovsdb_server *server) { session->server = server; - list_init(&session->completions); + ovs_list_init(&session->completions); hmap_init(&session->waiters); } @@ -60,7 +60,7 @@ ovsdb_session_get_lock_waiter(const struct ovsdb_session *session, struct ovsdb_lock_waiter * ovsdb_lock_get_owner(const struct ovsdb_lock *lock) { - return CONTAINER_OF(list_front(&lock->waiters), + return CONTAINER_OF(ovs_list_front(&lock->waiters), struct ovsdb_lock_waiter, lock_node); } @@ -77,10 +77,10 @@ ovsdb_lock_waiter_remove(struct ovsdb_lock_waiter *waiter) { struct ovsdb_lock *lock = waiter->lock; - list_remove(&waiter->lock_node); + ovs_list_remove(&waiter->lock_node); waiter->lock = NULL; - if (list_is_empty(&lock->waiters)) { + if (ovs_list_is_empty(&lock->waiters)) { hmap_remove(&lock->server->locks, &lock->hmap_node); free(lock->name); free(lock); @@ -169,7 +169,7 @@ ovsdb_server_create_lock__(struct ovsdb_server *server, const char *lock_name, lock->server = server; lock->name = xstrdup(lock_name); hmap_insert(&server->locks, &lock->hmap_node, hash); - list_init(&lock->waiters); + ovs_list_init(&lock->waiters); return lock; } @@ -197,7 +197,7 @@ ovsdb_server_lock(struct ovsdb_server *server, struct ovsdb_lock *lock; lock = ovsdb_server_create_lock__(server, lock_name, hash); - victim = (mode == OVSDB_LOCK_STEAL && !list_is_empty(&lock->waiters) + victim = (mode == OVSDB_LOCK_STEAL && !ovs_list_is_empty(&lock->waiters) ? ovsdb_lock_get_owner(lock) : NULL); @@ -206,9 +206,9 @@ ovsdb_server_lock(struct ovsdb_server *server, waiter->lock_name = xstrdup(lock_name); waiter->lock = lock; if (mode == OVSDB_LOCK_STEAL) { - list_push_front(&lock->waiters, &waiter->lock_node); + ovs_list_push_front(&lock->waiters, &waiter->lock_node); } else { - list_push_back(&lock->waiters, &waiter->lock_node); + ovs_list_push_back(&lock->waiters, &waiter->lock_node); } waiter->session = session; hmap_insert(&waiter->session->waiters, &waiter->session_node, hash); diff --git a/ovsdb/transaction.c b/ovsdb/transaction.c index 725c6f5..84ccfa3 100644 --- a/ovsdb/transaction.c +++ b/ovsdb/transaction.c @@ -102,7 +102,7 @@ ovsdb_txn_create(struct ovsdb *db) { struct ovsdb_txn *txn = xmalloc(sizeof *txn); txn->db = db; - list_init(&txn->txn_tables); + ovs_list_init(&txn->txn_tables); ds_init(&txn->comment); return txn; } @@ -110,7 +110,7 @@ ovsdb_txn_create(struct ovsdb *db) static void ovsdb_txn_free(struct ovsdb_txn *txn) { - ovs_assert(list_is_empty(&txn->txn_tables)); + ovs_assert(ovs_list_is_empty(&txn->txn_tables)); ds_destroy(&txn->comment); free(txn); } @@ -448,9 +448,9 @@ add_weak_ref(struct ovsdb_txn *txn, dst = ovsdb_txn_row_modify(txn, dst); - if (!list_is_empty(&dst->dst_refs)) { + if (!ovs_list_is_empty(&dst->dst_refs)) { /* Omit duplicates. */ - weak = CONTAINER_OF(list_back(&dst->dst_refs), + weak = CONTAINER_OF(ovs_list_back(&dst->dst_refs), struct ovsdb_weak_ref, dst_node); if (weak->src == src) { return; @@ -459,8 +459,8 @@ add_weak_ref(struct ovsdb_txn *txn, weak = xmalloc(sizeof *weak); weak->src = src; - list_push_back(&dst->dst_refs, &weak->dst_node); - list_push_back(&src->src_refs, &weak->src_node); + ovs_list_push_back(&dst->dst_refs, &weak->dst_node); + ovs_list_push_back(&src->src_refs, &weak->src_node); } static struct ovsdb_error * OVS_WARN_UNUSED_RESULT @@ -774,7 +774,7 @@ ovsdb_txn_commit_(struct ovsdb_txn *txn, bool durable) if (error) { return OVSDB_WRAP_BUG("can't happen", error); } - if (list_is_empty(&txn->txn_tables)) { + if (ovs_list_is_empty(&txn->txn_tables)) { ovsdb_txn_abort(txn); return NULL; } @@ -883,7 +883,7 @@ ovsdb_txn_create_txn_table(struct ovsdb_txn *txn, struct ovsdb_table *table) for (i = 0; i < table->schema->n_indexes; i++) { hmap_init(&txn_table->txn_indexes[i]); } - list_push_back(&txn->txn_tables, &txn_table->node); + ovs_list_push_back(&txn->txn_tables, &txn_table->node); } return table->txn_table; } @@ -1024,7 +1024,7 @@ ovsdb_txn_table_destroy(struct ovsdb_txn_table *txn_table) txn_table->table->txn_table = NULL; hmap_destroy(&txn_table->txn_rows); - list_remove(&txn_table->node); + ovs_list_remove(&txn_table->node); free(txn_table); } diff --git a/ovsdb/trigger.c b/ovsdb/trigger.c index 74a1b0f..3392fb7 100644 --- a/ovsdb/trigger.c +++ b/ovsdb/trigger.c @@ -35,7 +35,7 @@ ovsdb_trigger_init(struct ovsdb_session *session, struct ovsdb *db, { trigger->session = session; trigger->db = db; - list_push_back(&trigger->db->triggers, &trigger->node); + ovs_list_push_back(&trigger->db->triggers, &trigger->node); trigger->request = request; trigger->result = NULL; trigger->created = now; @@ -46,7 +46,7 @@ ovsdb_trigger_init(struct ovsdb_session *session, struct ovsdb *db, void ovsdb_trigger_destroy(struct ovsdb_trigger *trigger) { - list_remove(&trigger->node); + ovs_list_remove(&trigger->node); json_destroy(trigger->request); json_destroy(trigger->result); } @@ -124,6 +124,6 @@ static void ovsdb_trigger_complete(struct ovsdb_trigger *t) { ovs_assert(t->result != NULL); - list_remove(&t->node); - list_push_back(&t->session->completions, &t->node); + ovs_list_remove(&t->node); + ovs_list_push_back(&t->session->completions, &t->node); } diff --git a/tests/test-aa.c b/tests/test-aa.c index eedefeb..2c26fc5 100644 --- a/tests/test-aa.c +++ b/tests/test-aa.c @@ -96,7 +96,7 @@ check_received_aa(struct lldpd_port *sport, sport->p_element.system_id.rsvd2[1]); /* Should receive 2 mappings */ - assert(!list_is_empty(&rport->p_isid_vlan_maps)); + assert(!ovs_list_is_empty(&rport->p_isid_vlan_maps)); /* For each received isid/vlan mapping */ LIST_FOR_EACH (received_map, m_entries, &rport->p_isid_vlan_maps) { @@ -187,7 +187,7 @@ test_aa_send(void) lldp = lldp_create_dummy(); if ((lldp == NULL) || (lldp->lldpd == NULL) || - list_is_empty(&lldp->lldpd->g_hardware)) { + ovs_list_is_empty(&lldp->lldpd->g_hardware)) { printf("Error: unable to create dummy lldp instance"); return 1; } @@ -235,9 +235,9 @@ test_aa_send(void) map[1].isid_vlan_data.vlan = map_init[1].isid_vlan_data.vlan; map[1].isid_vlan_data.isid = map_init[1].isid_vlan_data.isid; - list_init(&hw->h_lport.p_isid_vlan_maps); - list_push_back(&hw->h_lport.p_isid_vlan_maps, &map[0].m_entries); - list_push_back(&hw->h_lport.p_isid_vlan_maps, &map[1].m_entries); + ovs_list_init(&hw->h_lport.p_isid_vlan_maps); + ovs_list_push_back(&hw->h_lport.p_isid_vlan_maps, &map[0].m_entries); + ovs_list_push_back(&hw->h_lport.p_isid_vlan_maps, &map[1].m_entries); /* Construct LLDPPDU (including Ethernet header) */ eth_compose(&packet, eth_addr_lldp, eth_src, ETH_TYPE_LLDP, 0); diff --git a/tests/test-classifier.c b/tests/test-classifier.c index 675d47d..fbd4b7b 100644 --- a/tests/test-classifier.c +++ b/tests/test-classifier.c @@ -1225,7 +1225,7 @@ test_many_rules_in_n_tables(int n_tables) &tcls); check_tables(&cls, -1, -1, -1, n_invisible_rules, version); - list_push_back(&list, &rule->list_node); + ovs_list_push_back(&list, &rule->list_node); } else if (classifier_remove(&cls, &rule->cls_rule)) { ovsrcu_postpone(free_rule, rule); } diff --git a/tests/test-list.c b/tests/test-list.c index 7789dac..761f634 100644 --- a/tests/test-list.c +++ b/tests/test-list.c @@ -38,10 +38,10 @@ make_list(struct ovs_list *list, struct element elements[], { size_t i; - list_init(list); + ovs_list_init(list); for (i = 0; i < n; i++) { elements[i].value = i; - list_push_back(list, &elements[i].node); + ovs_list_push_back(list, &elements[i].node); values[i] = i; } } @@ -72,10 +72,10 @@ check_list(struct ovs_list *list, const int values[], size_t n) assert(&e->node == list); assert(i == n); - assert(list_is_empty(list) == !n); - assert(list_is_singleton(list) == (n == 1)); - assert(list_is_short(list) == (n < 2)); - assert(list_size(list) == n); + assert(ovs_list_is_empty(list) == !n); + assert(ovs_list_is_singleton(list) == (n == 1)); + assert(ovs_list_is_short(list) == (n < 2)); + assert(ovs_list_size(list) == n); } #if 0 @@ -136,7 +136,7 @@ test_list_for_each_safe(void) LIST_FOR_EACH_SAFE (e, next, node, &list) { assert(i < n); if (pattern & (1ul << i)) { - list_remove(&e->node); + ovs_list_remove(&e->node); n_remaining--; memmove(&values[values_idx], &values[values_idx + 1], sizeof *values * (n_remaining - values_idx)); diff --git a/tests/test-ovn.c b/tests/test-ovn.c index 043194b..19a19ed 100644 --- a/tests/test-ovn.c +++ b/tests/test-ovn.c @@ -841,7 +841,7 @@ build_simple_tree(enum expr_type type, int n, struct expr ***terminalp) struct expr *e = expr_create_andor(type); for (int i = 0; i < 2; i++) { struct expr *sub = make_terminal(terminalp); - list_push_back(&e->andor, &sub->node); + ovs_list_push_back(&e->andor, &sub->node); } return e; } else if (n == 1) { @@ -864,7 +864,7 @@ build_tree_shape(enum expr_type type, const struct tree_shape **tsp, struct expr *sub = (ts->s[i] > 2 ? build_tree_shape(t, tsp, terminalp) : build_simple_tree(t, ts->s[i], terminalp)); - list_push_back(&e->andor, &sub->node); + ovs_list_push_back(&e->andor, &sub->node); } return e; } diff --git a/tests/test-ovsdb.c b/tests/test-ovsdb.c index f0bbfcd..e6af729 100644 --- a/tests/test-ovsdb.c +++ b/tests/test-ovsdb.c @@ -1415,8 +1415,8 @@ do_trigger(struct ovs_cmdl_context *ctx) } ovsdb_trigger_run(db, now); - while (!list_is_empty(&session.completions)) { - do_trigger_dump(CONTAINER_OF(list_pop_front(&session.completions), + while (!ovs_list_is_empty(&session.completions)) { + do_trigger_dump(CONTAINER_OF(ovs_list_pop_front(&session.completions), struct test_trigger, trigger.node), now, "delayed"); } diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index 713edc7..bd6d848 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -672,8 +672,8 @@ transact_noreply(struct vconn *vconn, struct ofpbuf *request) { struct ovs_list requests; - list_init(&requests); - list_push_back(&requests, &request->list_node); + ovs_list_init(&requests); + ovs_list_push_back(&requests, &request->list_node); transact_multiple_noreply(vconn, &requests); } @@ -1351,7 +1351,7 @@ bundle_flow_mod__(const char *remote, struct ofputil_flow_mod *fms, struct ovs_list requests; size_t i; - list_init(&requests); + ovs_list_init(&requests); /* Bundles need OpenFlow 1.3+. */ usable_protocols &= OFPUTIL_P_OF13_UP; @@ -1361,7 +1361,7 @@ bundle_flow_mod__(const char *remote, struct ofputil_flow_mod *fms, struct ofputil_flow_mod *fm = &fms[i]; struct ofpbuf *request = ofputil_encode_flow_mod(fm, protocol); - list_push_back(&requests, &request->list_node); + ovs_list_push_back(&requests, &request->list_node); free(CONST_CAST(struct ofpact *, fm->ofpacts)); } @@ -3040,7 +3040,7 @@ fte_make_flow_mod(const struct fte *fte, int index, uint16_t command, } ofm = ofputil_encode_flow_mod(&fm, protocol); - list_push_back(packets, &ofm->list_node); + ovs_list_push_back(packets, &ofm->list_node); } static void @@ -3062,7 +3062,7 @@ ofctl_replace_flows(struct ovs_cmdl_context *ctx) read_flows_from_switch(vconn, protocol, &tables, SWITCH_IDX); - list_init(&requests); + ovs_list_init(&requests); FOR_EACH_TABLE (cls, &tables) { /* Delete flows that exist on the switch but not in the file. */ diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index c0a5d11..c9c0f6d 100644 --- a/utilities/ovs-vsctl.c +++ b/utilities/ovs-vsctl.c @@ -543,7 +543,7 @@ add_bridge_to_cache(struct vsctl_context *vsctl_ctx, struct vsctl_bridge *br = xmalloc(sizeof *br); br->br_cfg = br_cfg; br->name = xstrdup(name); - list_init(&br->ports); + ovs_list_init(&br->ports); br->parent = parent; br->vlan = vlan; hmap_init(&br->children); @@ -582,7 +582,7 @@ ovs_delete_bridge(const struct ovsrec_open_vswitch *ovs, static void del_cached_bridge(struct vsctl_context *vsctl_ctx, struct vsctl_bridge *br) { - ovs_assert(list_is_empty(&br->ports)); + ovs_assert(ovs_list_is_empty(&br->ports)); ovs_assert(hmap_is_empty(&br->children)); if (br->parent) { hmap_remove(&br->parent->children, &br->children_node); @@ -637,8 +637,8 @@ add_port_to_cache(struct vsctl_context *vsctl_ctx, struct vsctl_bridge *parent, } port = xmalloc(sizeof *port); - list_push_back(&parent->ports, &port->ports_node); - list_init(&port->ifaces); + ovs_list_push_back(&parent->ports, &port->ports_node); + ovs_list_init(&port->ifaces); port->port_cfg = port_cfg; port->bridge = parent; shash_add(&vsctl_ctx->ports, port_cfg->name, port); @@ -649,8 +649,8 @@ add_port_to_cache(struct vsctl_context *vsctl_ctx, struct vsctl_bridge *parent, static void del_cached_port(struct vsctl_context *vsctl_ctx, struct vsctl_port *port) { - ovs_assert(list_is_empty(&port->ifaces)); - list_remove(&port->ports_node); + ovs_assert(ovs_list_is_empty(&port->ifaces)); + ovs_list_remove(&port->ports_node); shash_find_and_delete(&vsctl_ctx->ports, port->port_cfg->name); ovsrec_port_delete(port->port_cfg); free(port); @@ -663,7 +663,7 @@ add_iface_to_cache(struct vsctl_context *vsctl_ctx, struct vsctl_port *parent, struct vsctl_iface *iface; iface = xmalloc(sizeof *iface); - list_push_back(&parent->ifaces, &iface->ifaces_node); + ovs_list_push_back(&parent->ifaces, &iface->ifaces_node); iface->iface_cfg = iface_cfg; iface->port = parent; shash_add(&vsctl_ctx->ifaces, iface_cfg->name, iface); @@ -674,7 +674,7 @@ add_iface_to_cache(struct vsctl_context *vsctl_ctx, struct vsctl_port *parent, static void del_cached_iface(struct vsctl_context *vsctl_ctx, struct vsctl_iface *iface) { - list_remove(&iface->ifaces_node); + ovs_list_remove(&iface->ifaces_node); shash_find_and_delete(&vsctl_ctx->ifaces, iface->iface_cfg->name); ovsrec_interface_delete(iface->iface_cfg); free(iface); diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 968781d..960fd34 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -861,7 +861,7 @@ bridge_delete_or_reconfigure_ports(struct bridge *br) } } - if (list_is_empty(&port->ifaces)) { + if (ovs_list_is_empty(&port->ifaces)) { port_destroy(port); } } @@ -925,7 +925,7 @@ port_configure(struct port *port) /* Get slaves. */ s.n_slaves = 0; - s.slaves = xmalloc(list_size(&port->ifaces) * sizeof *s.slaves); + s.slaves = xmalloc(ovs_list_size(&port->ifaces) * sizeof *s.slaves); LIST_FOR_EACH (iface, port_elem, &port->ifaces) { s.slaves[s.n_slaves++] = iface->ofp_port; } @@ -1288,14 +1288,14 @@ port_configure_stp(const struct ofproto *ofproto, struct port *port, } /* STP over bonds is not supported. */ - if (!list_is_singleton(&port->ifaces)) { + if (!ovs_list_is_singleton(&port->ifaces)) { VLOG_ERR("port %s: cannot enable STP on bonds, disabling", port->name); port_s->enable = false; return; } - iface = CONTAINER_OF(list_front(&port->ifaces), struct iface, port_elem); + iface = CONTAINER_OF(ovs_list_front(&port->ifaces), struct iface, port_elem); /* Internal ports shouldn't participate in spanning tree, so * skip them. */ @@ -1376,14 +1376,14 @@ port_configure_rstp(const struct ofproto *ofproto, struct port *port, } /* RSTP over bonds is not supported. */ - if (!list_is_singleton(&port->ifaces)) { + if (!ovs_list_is_singleton(&port->ifaces)) { VLOG_ERR("port %s: cannot enable RSTP on bonds, disabling", port->name); port_s->enable = false; return; } - iface = CONTAINER_OF(list_front(&port->ifaces), struct iface, port_elem); + iface = CONTAINER_OF(ovs_list_front(&port->ifaces), struct iface, port_elem); /* Internal ports shouldn't participate in spanning tree, so * skip them. */ @@ -1677,7 +1677,7 @@ bridge_has_bond_fake_iface(const struct bridge *br, const char *name) static bool port_is_bond_fake_iface(const struct port *port) { - return port->cfg->bond_fake_iface && !list_is_short(&port->ifaces); + return port->cfg->bond_fake_iface && !ovs_list_is_short(&port->ifaces); } static void @@ -1829,7 +1829,7 @@ iface_create(struct bridge *br, const struct ovsrec_interface *iface_cfg, /* Create the iface structure. */ iface = xzalloc(sizeof *iface); - list_push_back(&port->ifaces, &iface->port_elem); + ovs_list_push_back(&port->ifaces, &iface->port_elem); hmap_insert(&br->iface_by_name, &iface->name_node, hash_string(iface_cfg->name, 0)); iface->port = port; @@ -2437,12 +2437,12 @@ port_refresh_stp_status(struct port *port) } /* STP doesn't currently support bonds. */ - if (!list_is_singleton(&port->ifaces)) { + if (!ovs_list_is_singleton(&port->ifaces)) { ovsrec_port_set_status(port->cfg, NULL); return; } - iface = CONTAINER_OF(list_front(&port->ifaces), struct iface, port_elem); + iface = CONTAINER_OF(ovs_list_front(&port->ifaces), struct iface, port_elem); if (ofproto_port_get_stp_status(ofproto, iface->ofp_port, &status)) { return; } @@ -2476,11 +2476,11 @@ port_refresh_stp_stats(struct port *port) } /* STP doesn't currently support bonds. */ - if (!list_is_singleton(&port->ifaces)) { + if (!ovs_list_is_singleton(&port->ifaces)) { return; } - iface = CONTAINER_OF(list_front(&port->ifaces), struct iface, port_elem); + iface = CONTAINER_OF(ovs_list_front(&port->ifaces), struct iface, port_elem); if (ofproto_port_get_stp_stats(ofproto, iface->ofp_port, &stats)) { return; } @@ -2547,12 +2547,12 @@ port_refresh_rstp_status(struct port *port) } /* RSTP doesn't currently support bonds. */ - if (!list_is_singleton(&port->ifaces)) { + if (!ovs_list_is_singleton(&port->ifaces)) { ovsrec_port_set_rstp_status(port->cfg, NULL); return; } - iface = CONTAINER_OF(list_front(&port->ifaces), struct iface, port_elem); + iface = CONTAINER_OF(ovs_list_front(&port->ifaces), struct iface, port_elem); if (ofproto_port_get_rstp_status(ofproto, iface->ofp_port, &status)) { return; } @@ -2600,7 +2600,7 @@ port_refresh_bond_status(struct port *port, bool force_update) struct eth_addr mac; /* Return if port is not a bond */ - if (list_is_singleton(&port->ifaces)) { + if (ovs_list_is_singleton(&port->ifaces)) { return; } @@ -3947,7 +3947,7 @@ bridge_aa_refresh_queued(struct bridge *br) struct ovs_list *list = xmalloc(sizeof *list); struct bridge_aa_vlan *node, *next; - list_init(list); + ovs_list_init(list); ofproto_aa_vlan_get_queued(br->ofproto, list); LIST_FOR_EACH_SAFE (node, next, list_node, list) { @@ -3961,7 +3961,7 @@ bridge_aa_refresh_queued(struct bridge *br) bridge_aa_update_trunks(port, node); } - list_remove(&node->list_node); + ovs_list_remove(&node->list_node); free(node->port_name); free(node); } @@ -3981,7 +3981,7 @@ port_create(struct bridge *br, const struct ovsrec_port *cfg) port->bridge = br; port->name = xstrdup(cfg->name); port->cfg = cfg; - list_init(&port->ifaces); + ovs_list_init(&port->ifaces); hmap_insert(&br->ports, &port->hmap_node, hash_string(port->name, 0)); return port; @@ -4106,7 +4106,7 @@ port_configure_lacp(struct port *port, struct lacp_settings *s) 0); s->priority = (priority > 0 && priority <= UINT16_MAX ? priority - : UINT16_MAX - !list_is_short(&port->ifaces)); + : UINT16_MAX - !ovs_list_is_short(&port->ifaces)); lacp_time = smap_get(&port->cfg->other_config, "lacp-time"); s->fast = lacp_time && !strcasecmp(lacp_time, "fast"); @@ -4269,7 +4269,7 @@ iface_destroy__(struct iface *iface) hmap_remove(&br->ifaces, &iface->ofp_port_node); } - list_remove(&iface->port_elem); + ovs_list_remove(&iface->port_elem); hmap_remove(&br->iface_by_name, &iface->name_node); /* The user is changing configuration here, so netdev_remove needs to be @@ -4288,7 +4288,7 @@ iface_destroy(struct iface *iface) struct port *port = iface->port; iface_destroy__(iface); - if (list_is_empty(&port->ifaces)) { + if (ovs_list_is_empty(&port->ifaces)) { port_destroy(port); } } @@ -4964,7 +4964,7 @@ configure_splinter_port(struct port *port) ofproto_bundle_unregister(port->bridge->ofproto, port); - vlandev = CONTAINER_OF(list_front(&port->ifaces), struct iface, + vlandev = CONTAINER_OF(ovs_list_front(&port->ifaces), struct iface, port_elem); realdev_name = smap_get(&port->cfg->other_config, "realdev"); diff --git a/vtep/vtep-ctl.c b/vtep/vtep-ctl.c index 3c93f77..29d9a17 100644 --- a/vtep/vtep-ctl.c +++ b/vtep/vtep-ctl.c @@ -521,7 +521,7 @@ add_port_to_cache(struct vtep_ctl_context *vtepctl_ctx, struct vtep_ctl_port *port; port = xmalloc(sizeof *port); - list_push_back(&ps->ports, &port->ports_node); + ovs_list_push_back(&ps->ports, &port->ports_node); port->port_cfg = port_cfg; port->ps = ps; shash_add(&vtepctl_ctx->ports, cache_name, port); @@ -537,7 +537,7 @@ del_cached_port(struct vtep_ctl_context *vtepctl_ctx, { char *cache_name = xasprintf("%s+%s", port->ps->name, port->port_cfg->name); - list_remove(&port->ports_node); + ovs_list_remove(&port->ports_node); shash_find_and_delete(&vtepctl_ctx->ports, cache_name); vteprec_physical_port_delete(port->port_cfg); free(cache_name); @@ -551,7 +551,7 @@ add_pswitch_to_cache(struct vtep_ctl_context *vtepctl_ctx, struct vtep_ctl_pswitch *ps = xmalloc(sizeof *ps); ps->ps_cfg = ps_cfg; ps->name = xstrdup(ps_cfg->name); - list_init(&ps->ports); + ovs_list_init(&ps->ports); shash_add(&vtepctl_ctx->pswitches, ps->name, ps); } @@ -576,7 +576,7 @@ vtep_delete_pswitch(const struct vteprec_global *vtep_global, static void del_cached_pswitch(struct vtep_ctl_context *ctx, struct vtep_ctl_pswitch *ps) { - ovs_assert(list_is_empty(&ps->ports)); + ovs_assert(ovs_list_is_empty(&ps->ports)); if (ps->ps_cfg) { vteprec_physical_switch_delete(ps->ps_cfg); vtep_delete_pswitch(ctx->vtep_global, ps->ps_cfg); @@ -723,7 +723,7 @@ add_ploc_to_mcast_mac(struct vtep_ctl_mcast_mac *mcast_mac, ploc = xmalloc(sizeof *ploc); ploc->ploc_cfg = ploc_cfg; - list_push_back(&mcast_mac->locators, &ploc->locators_node); + ovs_list_push_back(&mcast_mac->locators, &ploc->locators_node); } static void @@ -734,7 +734,7 @@ del_ploc_from_mcast_mac(struct vtep_ctl_mcast_mac *mcast_mac, LIST_FOR_EACH (ploc, locators_node, &mcast_mac->locators) { if (ploc->ploc_cfg == ploc_cfg) { - list_remove(&ploc->locators_node); + ovs_list_remove(&ploc->locators_node); free(ploc); return; } @@ -755,7 +755,7 @@ add_mcast_mac_to_cache(struct vtep_ctl_context *vtepctl_ctx, mcast_shash = local ? &ls->mcast_local : &ls->mcast_remote; mcast_mac->ploc_set_cfg = ploc_set_cfg; - list_init(&mcast_mac->locators); + ovs_list_init(&mcast_mac->locators); shash_add(mcast_shash, mac, mcast_mac); for (i = 0; i < ploc_set_cfg->n_locators; i++) { @@ -1732,7 +1732,7 @@ commit_mcast_entries(struct vtep_ctl_mcast_mac *mcast_mac) size_t n_locators; int i; - n_locators = list_size(&mcast_mac->locators); + n_locators = ovs_list_size(&mcast_mac->locators); ovs_assert(n_locators); locators = xmalloc(n_locators * sizeof *locators); @@ -1841,7 +1841,7 @@ del_mcast_entry(struct ctl_context *ctx, mcast_mac->ploc_set_cfg = ploc_set_cfg; del_ploc_from_mcast_mac(mcast_mac, ploc_cfg); - if (list_is_empty(&mcast_mac->locators)) { + if (ovs_list_is_empty(&mcast_mac->locators)) { struct shash_node *node = shash_find(mcast_shash, mac); vteprec_physical_locator_set_delete(ploc_set_cfg);