Received: from eggs.gnu.org ([208.118.235.92]:39826) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ufk0g-00031R-Bo for qemu-devel@nongnu.org; Fri, 24 May 2013 00:53:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ufk0c-00024d-7d for qemu-devel@nongnu.org; Fri, 24 May 2013 00:53:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21911) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ufk0c-000244-0g for qemu-devel@nongnu.org; Fri, 24 May 2013 00:53:42 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4O4reXh030949 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 24 May 2013 00:53:40 -0400 Date: Fri, 24 May 2013 12:53:37 +0800 From: Amos Kong Message-ID: <20130524045337.GD1550@t430s.nay.redhat.com> References: <1369300080-31377-1-git-send-email-akong@redhat.com> <1369300080-31377-3-git-send-email-akong@redhat.com> <20130523102340.GC16892@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130523102340.GC16892@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 2/2] net: introduce command to query rx-filter information List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org, stefanha@redhat.com, lcapitulino@redhat.com On Thu, May 23, 2013 at 01:23:40PM +0300, Michael S. Tsirkin wrote: > On Thu, May 23, 2013 at 05:08:00PM +0800, Amos Kong wrote: > > + info->broadcast_allowed = n->nobcast; > > + info->multicast_overflow = n->mac_table.multi_overflow; > > + info->unicast_overflow = n->mac_table.uni_overflow; > > + info->main_mac = g_strdup_printf("%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", > > + n->mac[0], n->mac[1], n->mac[2], > > + n->mac[3], n->mac[4], n->mac[5]); > > We really want a helper for this g_strdup_printf thing IMO. entry->value = mac_strdup_printf(n->mac_table.macs + i * ETH_ALEN); static char *mac_strdup_printf(uint8_t *mac) { return g_strdup_printf("%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); } -- Amos.