qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Yang Hongyang <yanghy@cn.fujitsu.com>
To: qemu-devel@nongnu.org
Cc: jasowang@redhat.com, mrhines@linux.vnet.ibm.com,
	thuth@redhat.com, stefanha@redhat.com,
	Yang Hongyang <yanghy@cn.fujitsu.com>
Subject: [Qemu-devel] [PATCH 6/9] introduce qemu_find_net_clients_by_model
Date: Fri, 24 Jul 2015 18:55:56 +0800	[thread overview]
Message-ID: <1437735359-17415-7-git-send-email-yanghy@cn.fujitsu.com> (raw)
In-Reply-To: <1437735359-17415-1-git-send-email-yanghy@cn.fujitsu.com>

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
---
 include/net/net.h |  2 ++
 net/net.c         | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/include/net/net.h b/include/net/net.h
index 250f365..10927e1 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -108,6 +108,8 @@ char *qemu_mac_strdup_printf(const uint8_t *macaddr);
 NetClientState *qemu_find_netdev(const char *id);
 int qemu_find_net_clients_except(const char *id, NetClientState **ncs,
                                  NetClientOptionsKind type, int max);
+int qemu_find_net_clients_by_model(const char *model, NetClientState **ncs,
+                                   int max);
 NetClientState *qemu_new_net_client(NetClientInfo *info,
                                     NetClientState *peer,
                                     const char *model,
diff --git a/net/net.c b/net/net.c
index 856a0fe..7b62e52 100644
--- a/net/net.c
+++ b/net/net.c
@@ -780,6 +780,24 @@ int qemu_find_net_clients_except(const char *id, NetClientState **ncs,
     return ret;
 }
 
+int qemu_find_net_clients_by_model(const char *model, NetClientState **ncs,
+                                   int max)
+{
+    NetClientState *nc;
+    int ret = 0;
+
+    QTAILQ_FOREACH(nc, &net_clients, next) {
+        if (!strcmp(nc->model, model)) {
+            if (ret < max) {
+                ncs[ret] = nc;
+            }
+            ret++;
+        }
+    }
+
+    return ret;
+}
+
 static int nic_get_free_idx(void)
 {
     int index;
-- 
1.9.1

  parent reply	other threads:[~2015-07-24 10:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-24 10:55 [Qemu-devel] [PATCH 0/9] For QEMU 2.5: Add a net filter and a netbuffer plugin based on the filter Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 1/9] netdev: Add a net filter Yang Hongyang
2015-07-27 12:38   ` Thomas Huth
2015-07-27 13:15     ` Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 2/9] virtio-net: add filter support Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 3/9] filter: remove plugins when remove filter Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 4/9] filter: remove filter before remove network backend Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 5/9] filter: add netbuffer plugin Yang Hongyang
2015-07-24 10:55 ` Yang Hongyang [this message]
2015-07-24 10:55 ` [Qemu-devel] [PATCH 7/9] net/queue: export qemu_net_queue_append Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 8/9] move out net queue structs define Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 9/9] add a public api to release buffer Yang Hongyang
2015-07-25  5:06 ` [Qemu-devel] [PATCH 0/9] For QEMU 2.5: Add a net filter and a netbuffer plugin based on the filter zhanghailiang
2015-07-26 14:13   ` Yang Hongyang
2015-07-27 10:32     ` Daniel P. Berrange
2015-07-27 13:23       ` Yang Hongyang
2015-07-27  4:53 ` Jason Wang
2015-07-27  5:01   ` Yang Hongyang
2015-07-29 10:34 ` Yang Hongyang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1437735359-17415-7-git-send-email-yanghy@cn.fujitsu.com \
    --to=yanghy@cn.fujitsu.com \
    --cc=jasowang@redhat.com \
    --cc=mrhines@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).