From patchwork Fri Jun 8 10:02:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 163744 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E4201B7008 for ; Fri, 8 Jun 2012 20:02:56 +1000 (EST) Received: from localhost ([::1]:36315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Scw1u-0008Tb-6p for incoming@patchwork.ozlabs.org; Fri, 08 Jun 2012 06:02:54 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Scw1Z-0007zV-Ah for qemu-devel@nongnu.org; Fri, 08 Jun 2012 06:02:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Scw1U-0007qc-EH for qemu-devel@nongnu.org; Fri, 08 Jun 2012 06:02:32 -0400 Received: from e06smtp13.uk.ibm.com ([195.75.94.109]:52376) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Scw1U-0007qM-5U for qemu-devel@nongnu.org; Fri, 08 Jun 2012 06:02:28 -0400 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 8 Jun 2012 11:02:24 +0100 Received: from d06nrmr1407.portsmouth.uk.ibm.com (9.149.38.185) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 8 Jun 2012 11:02:21 +0100 Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by d06nrmr1407.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q58A2KJu2531482 for ; Fri, 8 Jun 2012 11:02:20 +0100 Received: from d06av11.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q58A2GuD015295 for ; Fri, 8 Jun 2012 04:02:16 -0600 Received: from localhost (stefanha-thinkpad.manchester-maybrook.uk.ibm.com [9.174.219.145]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q58A2FXL015278; Fri, 8 Jun 2012 04:02:15 -0600 From: Stefan Hajnoczi To: Anthony Liguori Date: Fri, 8 Jun 2012 11:02:08 +0100 Message-Id: <1339149729-26331-3-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1339149729-26331-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1339149729-26331-1-git-send-email-stefanha@linux.vnet.ibm.com> x-cbid: 12060810-2966-0000-0000-000004562865 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 195.75.94.109 Cc: Harsh Prateek Bora , qemu-devel@nongnu.org, Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 2/3] trace/simple.c: fix deprecated glib2 interface 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: Harsh Prateek Bora Signed-off-by: Harsh Prateek Bora Signed-off-by: Stefan Hajnoczi --- trace/simple.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/trace/simple.c b/trace/simple.c index 33ae486..b4a3c6e 100644 --- a/trace/simple.c +++ b/trace/simple.c @@ -161,8 +161,11 @@ static void trace(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t x3, } timestamp = get_clock(); - +#if GLIB_CHECK_VERSION(2, 30, 0) + idx = g_atomic_int_add((gint *)&trace_idx, 1) % TRACE_BUF_LEN; +#else idx = g_atomic_int_exchange_and_add((gint *)&trace_idx, 1) % TRACE_BUF_LEN; +#endif trace_buf[idx] = (TraceRecord){ .event = event, .timestamp_ns = timestamp,