From patchwork Thu Feb 21 04:24:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 222172 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 9B4662C0079 for ; Thu, 21 Feb 2013 15:26:02 +1100 (EST) Received: from localhost ([::1]:44018 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8NjM-00079A-LX for incoming@patchwork.ozlabs.org; Wed, 20 Feb 2013 23:26:00 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8Nj2-00071H-20 for qemu-devel@nongnu.org; Wed, 20 Feb 2013 23:25:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8Niy-0002BG-48 for qemu-devel@nongnu.org; Wed, 20 Feb 2013 23:25:39 -0500 Received: from cantor2.suse.de ([195.135.220.15]:49351 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8Nix-0002B0-Uf for qemu-devel@nongnu.org; Wed, 20 Feb 2013 23:25:36 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6BEFDA51F5 for ; Thu, 21 Feb 2013 05:25:35 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Thu, 21 Feb 2013 05:24:59 +0100 Message-Id: <1361420711-15698-4-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1361420711-15698-1-git-send-email-afaerber@suse.de> References: <1361420711-15698-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH v2 03/15] qemu-log: Introduce qemu_log_mask_vprintf() 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 Corresponds to existing qemu_log_vprintf() but uses a mask. Signed-off-by: Andreas Färber --- include/qemu/log.h | 16 ++++++++++++++++ 1 Datei geändert, 16 Zeilen hinzugefügt(+) diff --git a/include/qemu/log.h b/include/qemu/log.h index 5a46555..9dd7a3e 100644 --- a/include/qemu/log.h +++ b/include/qemu/log.h @@ -64,6 +64,22 @@ qemu_log_vprintf(const char *fmt, va_list va) */ void GCC_FMT_ATTR(2, 3) qemu_log_mask(int mask, const char *fmt, ...); +/** + * qemu_log_mask_vprintf: + * @mask: The loglevel mask. + * @fmt: The format string. + * @va: The list of arguments to insert into the log. + * + * Equivalent of qemu_log_mask(). + */ +static inline void GCC_FMT_ATTR(2, 0) +qemu_log_mask_vprintf(int mask, const char *fmt, va_list va) +{ + if ((qemu_loglevel & mask) && qemu_logfile) { + vfprintf(qemu_logfile, fmt, va); + } +} + /* Special cases: */