Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1lNRxW-0007uC-N0 for mharc-grub-devel@gnu.org; Fri, 19 Mar 2021 23:07:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lNRxT-0007o1-40 for grub-devel@gnu.org; Fri, 19 Mar 2021 23:07:23 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:42532) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lNRxR-0002Nn-9A for grub-devel@gnu.org; Fri, 19 Mar 2021 23:07:22 -0400 Received: by mail-pf1-x434.google.com with SMTP id 11so7172358pfn.9 for ; Fri, 19 Mar 2021 20:07:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2UBuY6m89gRvtiVMm/ggqRiPybWVyzHOTx78wWpkvZ4=; b=lYLqGlOv7ThDRgi96szHH9AlOBVoq5UjLiic5yK1nZoHRP86IC+Fpm/+6k/xnMV1qV eH9huX3dBGniTagJ9D0qJ+RPxptZLfngE+PdiCmxUiJB9+NVRu/rxHV98RXEdJGTjAg3 CTY3u3U2K+1Zc7VNW4CXdkB+leumIM1/CoLTSCZW981wr7iqcjD/faTlPfRZ8z5YkjxI 1j6hmpC9o17Q01aDs0xUSUo4T4Y9j3TTveyaXRSoZ0WuU3V2L6mMV0W27vv7aJvp9Tj9 TguQE/XzwQxqGH8nkE9c60zAmvREOV5tZlKN1u5ghqPuSHal3Uu2lg6cthCukMFZ+1C+ mjYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2UBuY6m89gRvtiVMm/ggqRiPybWVyzHOTx78wWpkvZ4=; b=LYj8/1yLPVMXSj7IL7wHEBA04td+YsuFNV8L9gT+K1sw+1axettwkgBHdy93lBFBk2 gOQsKUS0egZgliw24EjeIaRQ+OlDRa27+C4ipwGRZaV6p1H6B0o4C3D/xYqT0DyoDF0X PaW95Z7yeHHAsoGaNGJsK3b1REjHGq1lBnKS5kWfMSCfo1Ez74kfGtFOnTnly8RJhsQ1 nLI8HprHZT9evsECZcqf6wpF9CIV3h7e8QnCg3UGNDNTv0ycEJjdfaMI1bs3oXpC5d1V JTQfzBkPWG/aQsk8iBPA5rera67tW7IkGXY2jq6z6kgI9W1IUkXN3xbxUpL//k2YHmfZ tutw== X-Gm-Message-State: AOAM532ob4Cm4sX4m3Z0GCY6JzTtVX5BQ7JPe4WM7XM95/nylMsgiX8J y/mscuzmxrtzTA8hxtNtaXf1Al+d1ghr5w== X-Google-Smtp-Source: ABdhPJyLEoO9TqbRdzYO3/RqV8Z0KJsWYrf5iArEZceq5Iy3ycfsuT7lhtdsiuQ3sweEkrYu2lqGDQ== X-Received: by 2002:aa7:8f04:0:b029:1f7:d71b:6a51 with SMTP id x4-20020aa78f040000b02901f7d71b6a51mr12027600pfr.4.1616209638842; Fri, 19 Mar 2021 20:07:18 -0700 (PDT) Received: from localhost.localdomain ([2605:a601:ab16:db00:2328:d973:f35b:5c6b]) by smtp.gmail.com with ESMTPSA id a20sm7096092pfl.97.2021.03.19.20.07.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 20:07:18 -0700 (PDT) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper Cc: Glenn Washburn Subject: [PATCH 3/4] misc: Allow selective disabling of debug conditionals Date: Fri, 19 Mar 2021 22:06:48 -0500 Message-Id: <6afb0bfd50583e12cfbdb147e18794234402fed4.1616208843.git.development@efficientek.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=development@efficientek.com; helo=mail-pf1-x434.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: Sat, 20 Mar 2021 03:07:23 -0000 Sometimes you know only know which debug logging conditionals you want to turn off. Now debug log messages can be excluded by specifying the conditional in the $debug string with a prepended dash. So say you want all debug logging on except for btrfs and scripting, then set debug=all,-btrfs,-scripting. Signed-off-by: Glenn Washburn --- grub-core/kern/misc.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c index 11b8592c8..73563b59b 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -168,7 +168,19 @@ grub_debug_enabled (const char * condition) if (!debug) return 0; - if (grub_strword (debug, "all") || grub_strword (debug, condition)) + if (grub_strword (debug, "all")) + { + if (debug[3] == '\0') + return 1; + const char *ptr = NULL; + ptr = grub_strstr (debug, condition); + if (ptr > debug && *(ptr-1) == '-' + && (*(ptr + grub_strlen (condition)) == '\0' + || grub_iswordseparator (*(ptr + grub_strlen (condition))))) + return 0; + return 1; + } + else if (grub_strword (debug, condition)) return 1; return 0; -- 2.27.0