Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1ma0NN-0002mo-Ot for mharc-grub-devel@gnu.org; Mon, 11 Oct 2021 14:50:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41580) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ma0NK-0002ma-07 for grub-devel@gnu.org; Mon, 11 Oct 2021 14:50:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:22435) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ma0NI-0001PW-DK for grub-devel@gnu.org; Mon, 11 Oct 2021 14:50:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633978211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5zwSrSyB1j/B5DbVJ+9wlDUMurYGglIZ9AjQ7ucA5yY=; b=BOHUMmF7vLF2VDk7FLAj7Boj+MsCpeINWrUl8Jeuto9Uh1UDQuqi7/BGZVKrhbOFNn43O5 KySLEnTk4peSaIxc9Nym10T32yjdCzVftL9Vx57eLjFoEJE/ra4Svm5SLZeL7JMKbpmD+G mXL7YAxA9bzaKkruOTReB+ODTk28PkE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-572-81iVTp3pPcqqqbH48w1k2w-1; Mon, 11 Oct 2021 14:49:02 -0400 X-MC-Unique: 81iVTp3pPcqqqbH48w1k2w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 19233CC62D for ; Mon, 11 Oct 2021 18:49:02 +0000 (UTC) Received: from eesha.redhat.com (unknown [10.22.50.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22B7360BE5; Mon, 11 Oct 2021 18:49:00 +0000 (UTC) From: Robbie Harwood To: grub-devel@gnu.org Cc: Peter Jones , Robbie Harwood Subject: [PATCH 1/2] Add grub_qdprintf() - grub_dprintf() without the file+line number. Date: Mon, 11 Oct 2021 14:48:43 -0400 Message-Id: <20211011184843.137930-2-rharwood@redhat.com> In-Reply-To: <20211011184843.137930-1-rharwood@redhat.com> References: <20211011184843.137930-1-rharwood@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=rharwood@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Received-SPF: pass client-ip=170.10.133.124; envelope-from=rharwood@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.049, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Oct 2021 18:50:15 -0000 From: Peter Jones This just makes copy+paste of our debug loading info easier. Signed-off-by: Peter Jones Signed-off-by: Robbie Harwood --- grub-core/kern/misc.c | 18 ++++++++++++++++++ include/grub/misc.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c index 3af336ee2..633fb48ec 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -190,6 +190,24 @@ grub_real_dprintf (const char *file, const int line, const char *condition, } } +void +grub_qdprintf (const char *condition, const char *fmt, ...) +{ + va_list args; + const char *debug = grub_env_get ("debug"); + + if (! debug) + return; + + if (grub_strword (debug, "all") || grub_strword (debug, condition)) + { + va_start (args, fmt); + grub_vprintf (fmt, args); + va_end (args); + grub_refresh (); + } +} + #define PREALLOC_SIZE 255 int diff --git a/include/grub/misc.h b/include/grub/misc.h index 7d2b55196..b9b22b2ec 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -345,6 +345,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file, const int line, const char *condition, const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 4, 5))); +void EXPORT_FUNC(grub_qdprintf) (const char *condition, + const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 2, 3))); int EXPORT_FUNC(grub_vprintf) (const char *fmt, va_list args); int EXPORT_FUNC(grub_snprintf) (char *str, grub_size_t n, const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 3, 4))); -- 2.33.0