From: Luiz Augusto von Dentz <[email protected]>
This introduces DBG_IS_ENABLE macro which can be used to check if
BTD_DEBUG_FLAG_PRINT has been enabled for the current file.
---
src/log.c | 12 ++++++++++++
src/log.h | 11 +++++++++++
2 files changed, 23 insertions(+)
diff --git a/src/log.c b/src/log.c
index 0155a6bba..1157859ef 100644
--- a/src/log.c
+++ b/src/log.c
@@ -179,6 +179,18 @@ void __btd_log_init(const char *debug, int detach)
info("Bluetooth daemon %s", VERSION);
}
+bool __btd_log_is_enabled(const char *file)
+{
+ struct btd_debug_desc *desc;
+
+ for (desc = __start___debug; desc < __stop___debug; desc++) {
+ if (desc->file && g_pattern_match_simple(file, desc->file))
+ return desc->flags & BTD_DEBUG_FLAG_PRINT;
+ }
+
+ return false;
+}
+
void __btd_log_cleanup(void)
{
closelog();
diff --git a/src/log.h b/src/log.h
index 74941beb2..e35238870 100644
--- a/src/log.h
+++ b/src/log.h
@@ -9,6 +9,7 @@
*/
#include <stdint.h>
+#include <stdbool.h>
void info(const char *format, ...) __attribute__((format(printf, 1, 2)));
@@ -27,6 +28,7 @@ void btd_debug(uint16_t index, const char *format, ...)
void __btd_log_init(const char *debug, int detach);
void __btd_log_cleanup(void);
void __btd_toggle_debug(void);
+bool __btd_log_is_enabled(const char *file);
struct btd_debug_desc {
const char *file;
@@ -38,6 +40,15 @@ struct btd_debug_desc {
void __btd_enable_debug(struct btd_debug_desc *start,
struct btd_debug_desc *stop);
+/* DBG_IS_ENABLED:
+ *
+ * Simple macro that can be used to check if debug has been enabled for the
+ * __FILE__.
+ * Note: This does a lookup thus why it was not used by the likes of
+ * DBG/DBG_IDX which loads it directly from section("__debug").
+ */
+#define DBG_IS_ENABLED() __btd_log_is_enabled(__FILE__)
+
/**
* DBG:
* @fmt: format string
--
2.35.1
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=625843
---Test result---
Test Summary:
CheckPatch FAIL 13.58 seconds
GitLint PASS 9.04 seconds
Prep - Setup ELL PASS 50.00 seconds
Build - Prep PASS 0.85 seconds
Build - Configure PASS 9.97 seconds
Build - Make PASS 1675.05 seconds
Make Check PASS 12.27 seconds
Make Check w/Valgrind PASS 485.16 seconds
Make Distcheck PASS 265.91 seconds
Build w/ext ELL - Configure PASS 9.87 seconds
Build w/ext ELL - Make PASS 1641.50 seconds
Incremental Build with patchesPASS 15009.23 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
[BlueZ,v3,3/9] mgmt: Introduce mgmt_set_verbose
WARNING:REPEATED_WORD: Possible repeated word: 'the'
#83:
the the likes hexdump of packets, by default it is disabled since in
/github/workspace/src/12790083.patch total: 0 errors, 1 warnings, 61 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/12790083.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
---
Regards,
Linux Bluetooth
Hello:
This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <[email protected]>:
On Wed, 23 Mar 2022 13:13:33 -0700 you wrote:
> From: Luiz Augusto von Dentz <[email protected]>
>
> This introduces DBG_IS_ENABLE macro which can be used to check if
> BTD_DEBUG_FLAG_PRINT has been enabled for the current file.
> ---
> src/log.c | 12 ++++++++++++
> src/log.h | 11 +++++++++++
> 2 files changed, 23 insertions(+)
Here is the summary with links:
- [BlueZ,v2,1/9] log: Introduce DBG_IS_ENABLED
(no matching commit)
- [BlueZ,v3,2/9] mgmt: Add DBG macro
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=f9cb7c802f27
- [BlueZ,v3,3/9] mgmt: Introduce mgmt_set_verbose
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=b7c807269f1f
- [BlueZ,v3,4/9] adapter: Don't use DBG in mgmt_debug
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=62c6037ea02b
- [BlueZ,v3,5/9] att: Log file and function names
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8039d42687fd
- [BlueZ,v3,6/9] gatt-client: Add DBG macro
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=e0870ce5e1fe
- [BlueZ,v3,7/9] gatt-server: Add DBG macro
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=55c25d91e4d6
- [BlueZ,v3,8/9] att: Rename att_debug and att_verbose to DBG and VERBOSE
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=e1b808c128fa
- [BlueZ,v3,9/9] device: Don't use DBG in gatt_debug
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=71cec503c8da
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html