Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1maB44-00015y-4E for mharc-grub-devel@gnu.org; Tue, 12 Oct 2021 02:15:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1maB42-00015m-EZ for grub-devel@gnu.org; Tue, 12 Oct 2021 02:15:02 -0400 Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]:47080) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1maB40-0006mP-4i for grub-devel@gnu.org; Tue, 12 Oct 2021 02:15:01 -0400 Received: by mail-qk1-x72e.google.com with SMTP id bk7so9464051qkb.13 for ; Mon, 11 Oct 2021 23:14:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=fk/kqkbSZnJv+2sa3u1tx9htnM9CtsjjGc5P2Lj7TEk=; b=JSmSEHobg8z4AvyY9bcIr/5x1itA6wWl2piRYaGSBNWgV8kU71esdZ2+SrvZ3izq62 oT4JqYJyz0knLjnPTMMlFF/2KA8qq6tr69sUzunTeD3wXM8GBG72oQEVxfkNWevc8HSI 438LygFndo6eSydSFDTR//H/9TTnFfGP9SuRaso3N94UAVsZn/Taf0mg5W72qxMSzGDR NOWzHIrF7DXhGGTJxo9+iVrN8Lbo/HUpFFy18fIHzuQCofM9jzD4yD05Er+pJbTdbuRV JjXU5pQNCMt9EOf07sjKqT5nheJIzq3BTfDsB3WUo1tznuAFlFsqLEJdkFq2zavTFD2r RQRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=fk/kqkbSZnJv+2sa3u1tx9htnM9CtsjjGc5P2Lj7TEk=; b=UXN33TYedaPXy8vEasJEzlpG1h905z5RIb/iQcS3PeO4bdAnPv1zQfmN7cnRMXYqdH SILh90prS9nKiTWCFwwnZ1IBed1UB7BIGgDpWWqgixb/J3FVeKdaLCOD+Cg2NAprWSQP Ho+VmsUZYZoR4fFcr1prjFWUGR8mM6hKA0A7No7VxHqTwFtBFdYmUllbZ/wMaeTkwnzf 6AKcZikQVlVkcid2dkbguCOAbPRR/TSJfPD/206sI9HRG+MUf5bHRy+vaBk/zLZ8QjtM UL0/qkMl8O6kef0/R/C9sztZ0Fa0DD3aOCWmk8rDAbGhFPpTDZYC+bQhyyMWgJRzQZBN VP6g== X-Gm-Message-State: AOAM531gzv+/k+JhvPsYEtZJGxhpeOFXfBSpqYA7FyYws/8PnqxrzZBK K6N0V8NvavLABQFIoqtx96DS4A== X-Google-Smtp-Source: ABdhPJyqdrd1RIImPMmnl4IU4cEZymTTkk4kxv1VxrxE4X5Wzm+rfiZ+8Wc3OIHx9qCnyxE2hI8org== X-Received: by 2002:a37:9185:: with SMTP id t127mr18216617qkd.228.1634019298678; Mon, 11 Oct 2021 23:14:58 -0700 (PDT) Received: from crass-HP-ZBook-15-G2 ([37.218.244.251]) by smtp.gmail.com with ESMTPSA id k2sm5629370qtg.35.2021.10.11.23.14.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Oct 2021 23:14:58 -0700 (PDT) Date: Tue, 12 Oct 2021 01:14:52 -0500 From: Glenn Washburn To: Robbie Harwood Cc: The development of GNU GRUB , Peter Jones Subject: Re: [PATCH 1/2] Add grub_qdprintf() - grub_dprintf() without the file+line number. Message-ID: <20211012011452.3166ebed@crass-HP-ZBook-15-G2> In-Reply-To: <20211011184843.137930-2-rharwood@redhat.com> References: <20211011184843.137930-1-rharwood@redhat.com> <20211011184843.137930-2-rharwood@redhat.com> Reply-To: development@efficientek.com X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::72e; envelope-from=development@efficientek.com; helo=mail-qk1-x72e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: Tue, 12 Oct 2021 06:15:02 -0000 On Mon, 11 Oct 2021 14:48:43 -0400 Robbie Harwood wrote: > 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)) Is there a good reason why this is done like this instead of using grub_debug_enabled as in grub_real_dprintf. > + { > + va_start (args, fmt); > + grub_vprintf (fmt, args); > + va_end (args); > + grub_refresh (); > + } I don't particularly like, that this function is mostly a copy of grub_real_dprintf. What about modifying grub_real_dprintf to not print the file:line if file == NULL? Then have grub_qdprintf be a macro to grub_real_dprintf as grub_dprintf is. This would obviate the concern above. > +} > + > #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))); Glenn