From patchwork Sun Mar 3 06:13:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 224532 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 E57D52C02FF for ; Sun, 3 Mar 2013 17:14:26 +1100 (EST) Received: from localhost ([::1]:40534 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UC2Bj-0007wm-SE for incoming@patchwork.ozlabs.org; Sun, 03 Mar 2013 01:14:23 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52507) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UC2BX-0007wB-KT for qemu-devel@nongnu.org; Sun, 03 Mar 2013 01:14:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UC2BW-0001jB-L6 for qemu-devel@nongnu.org; Sun, 03 Mar 2013 01:14:11 -0500 Received: from mail-da0-f51.google.com ([209.85.210.51]:46329) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UC2BW-0001j6-Er for qemu-devel@nongnu.org; Sun, 03 Mar 2013 01:14:10 -0500 Received: by mail-da0-f51.google.com with SMTP id z17so2025880dal.38 for ; Sat, 02 Mar 2013 22:14:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:in-reply-to:references:x-gm-message-state; bh=mKkVvosZg4EIkIyDYJOmaJXHrQp76e3KmKmYdisA3Lg=; b=pUQFmq5TNQM7OI3JnGpQdHlTFY2UKLnnRMOGVLAi9BuHo0ZschfqT66x351AMlZgVR e3FWuVhZbMhI6/jbL1vzaqz1g7/Psu59sWFBajcjMpnUL9e5GABX99/Cr7MqrXXET59Q GLt+t8Jtk3zVgmSMTiONRaN9Qnk8X0fZIuUoUI38wTHgjZO49gKLt8NktYIPVZUwLB/t lsyrxPGGaaaB+o/nrXjMB+yspIgLTXAh/ngD9eiSKIP0yH0GIgMoIpB1Ja+OQ3DsuYsN FLehjKV5kG5CGcVkYWHFE5cuXtQ8iNMqdsoDddxY/BhIJjDCkmETJpyALW+pKD0oQIiA fUEA== X-Received: by 10.68.218.166 with SMTP id ph6mr22823701pbc.33.1362291249784; Sat, 02 Mar 2013 22:14:09 -0800 (PST) Received: from localhost ([149.199.62.254]) by mx.google.com with ESMTPS id hs8sm17811311pbc.27.2013.03.02.22.14.07 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sat, 02 Mar 2013 22:14:08 -0800 (PST) From: Peter Crosthwaite To: qemu-devel@nongnu.org Date: Sun, 3 Mar 2013 16:13:01 +1000 Message-Id: <3671922c9400f7a40c802c9a522f9b85c350340f.1362290776.git.peter.crosthwaite@xilinx.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQl3h/lgWtJuy8cS4H3KI7yl2zKydAlwzh8qu0T3LAWGZ/EXUda65v+69xVPEtEj8wQfCmYv X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.210.51 Cc: peter.maydell@linaro.org, Peter Crosthwaite , kraxel@redhat.com Subject: [Qemu-devel] [RFC PATCH v1 1/4] qemu-log: Allow checking of the current mask 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 Useful for heavy users of qemu_log_mask that want to avoid executing expensive logic that sets up a qemu_log_mask when that mask is disabled. E.G. if (qemu_log_get_mask() && LOG_GUEST_ERROR) { /* do my expensive logging data query */ } qemu_log_mask(LOG_GUEST_ERROR, ...) Signed-off-by: Peter Crosthwaite --- include/qemu/log.h | 2 ++ qemu-log.c | 5 +++++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/include/qemu/log.h b/include/qemu/log.h index 6b0db02..68188f0 100644 --- a/include/qemu/log.h +++ b/include/qemu/log.h @@ -154,6 +154,8 @@ static inline void qemu_set_log(int log_flags) #endif } +int qemu_get_log_flags(void); + void qemu_set_log_filename(const char *filename); int qemu_str_to_log_mask(const char *str); diff --git a/qemu-log.c b/qemu-log.c index 797f2af..2ffee1d 100644 --- a/qemu-log.c +++ b/qemu-log.c @@ -82,6 +82,11 @@ void do_qemu_set_log(int log_flags, bool use_own_buffers) } } +int qemu_get_log_flags(void) +{ + return qemu_loglevel; +} + void qemu_set_log_filename(const char *filename) { g_free(logfilename);