From patchwork Thu Jun 13 09:03:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: pingfan liu X-Patchwork-Id: 251016 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6D3772C007E for ; Thu, 13 Jun 2013 19:07:05 +1000 (EST) Received: from localhost ([::1]:45827 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Un3Ul-0001L4-3h for incoming@patchwork.ozlabs.org; Thu, 13 Jun 2013 05:07:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Un3SQ-0006BQ-HF for qemu-devel@nongnu.org; Thu, 13 Jun 2013 05:04:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Un3SP-0003av-AU for qemu-devel@nongnu.org; Thu, 13 Jun 2013 05:04:38 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:57660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Un3SP-0003ao-3L for qemu-devel@nongnu.org; Thu, 13 Jun 2013 05:04:37 -0400 Received: by mail-pd0-f173.google.com with SMTP id v14so7202993pde.18 for ; Thu, 13 Jun 2013 02:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=d2yJ5Us/UiLRu0HRG9XZQQ54ydmulOqd6Bkvv7QG0wE=; b=oV4Z4AIXYVDhnBG0Ld17lOt60EBQxOWloYSpdi8r7mEKojUwI/gWpaX58a139cnrlE sm/l4TVa9VqjN2n9pP2Lru2rKIC8NlsHTfzK+nSKJeDRQ/j28aRsDPuLtgHqbtAdooo5 iELI3PwaGySH3zQWsVIlDz7u40r73iRXURyfRyRRTlnVWM956l9GW9jttTd3PxkU3VBK 65egXzaQN4ZJ7pYZZuM1jDqUerEBoaDfPJXQzP/yI6Gw46lwYUjMd4/hW4+FbGXGMlJ9 su0DyWwQx+RoacJtGw6O52HnLm3APg8acN+6dEbDfsRnXNOAc2VpxpTng45phIUlX7br D26Q== X-Received: by 10.66.244.42 with SMTP id xd10mr1910048pac.100.1371114276271; Thu, 13 Jun 2013 02:04:36 -0700 (PDT) Received: from localhost ([202.108.130.138]) by mx.google.com with ESMTPSA id vv6sm28491643pab.6.2013.06.13.02.04.32 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 13 Jun 2013 02:04:35 -0700 (PDT) From: Liu Ping Fan To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2013 17:03:04 +0800 Message-Id: <1371114186-8854-5-git-send-email-qemulist@gmail.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1371114186-8854-1-git-send-email-qemulist@gmail.com> References: <1371114186-8854-1-git-send-email-qemulist@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.192.173 Cc: mdroth , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH v2 4/6] net: force NetQue opaque to be NetClientState X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Liu Ping Fan qemu_net_client_setup() is the only user of qemu_new_net_queue(), which will pass in NetClientState. By forcing it be a NetClientState, we can ref/unref NetQueue's owner Signed-off-by: Liu Ping Fan --- include/net/queue.h | 2 +- net/queue.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/net/queue.h b/include/net/queue.h index fc02b33..ddb6d98 100644 --- a/include/net/queue.h +++ b/include/net/queue.h @@ -34,7 +34,7 @@ typedef void (NetPacketSent) (NetClientState *sender, ssize_t ret); #define QEMU_NET_PACKET_FLAG_NONE 0 #define QEMU_NET_PACKET_FLAG_RAW (1<<0) -NetQueue *qemu_new_net_queue(void *opaque); +NetQueue *qemu_new_net_queue(NetClientState *opaque); void qemu_del_net_queue(NetQueue *queue); diff --git a/net/queue.c b/net/queue.c index 7d6c52e..58222b0 100644 --- a/net/queue.c +++ b/net/queue.c @@ -49,7 +49,7 @@ struct NetPacket { }; struct NetQueue { - void *opaque; + NetClientState *opaque; uint32_t nq_maxlen; uint32_t nq_count; @@ -59,7 +59,7 @@ struct NetQueue { unsigned delivering : 1; }; -NetQueue *qemu_new_net_queue(void *opaque) +NetQueue *qemu_new_net_queue(NetClientState *opaque) { NetQueue *queue;