diff options
author | Simon Glass | 2020-09-12 12:28:47 -0600 |
---|---|---|
committer | Tom Rini | 2020-10-10 16:50:11 -0400 |
commit | b45203004ec3f3e5a259e68eddb3eb572d37f56d (patch) | |
tree | b43d3a931abfa4e558aca75872952402f0a8adfb /include/log.h | |
parent | 26637e2e4c7235e4fe01b78a9646471c65e28aea (diff) |
log: Add a flag to enable log drivers
At present there is no way to disable a log driver. But the syslog driver
causes (attempted) network traffic in sandbox every time a log message
is printed, which is often.
Add a flag to enable a log driver. Adjust struct log_device to use a short
for next_filter_num so that no more memory is used for devices. Also fix
a missing line in the struct log_driver comment while here.
To maintain compatibility, enable it for all drivers for now.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/log.h')
-rw-r--r-- | include/log.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/include/log.h b/include/log.h index 86c8d7be09d..d28bc1ef0e4 100644 --- a/include/log.h +++ b/include/log.h @@ -307,10 +307,16 @@ struct log_rec { struct log_device; +enum log_device_flags { + LOGDF_ENABLE = BIT(0), /* Device is enabled */ +}; + /** * struct log_driver - a driver which accepts and processes log records * * @name: Name of driver + * @emit: Method to call to emit a log record via this device + * @flags: Initial value for flags (use LOGDF_ENABLE to enable on start-up) */ struct log_driver { const char *name; @@ -321,6 +327,7 @@ struct log_driver { * for processing. The filter is checked before calling this function. */ int (*emit)(struct log_device *ldev, struct log_rec *rec); + unsigned short flags; }; /** @@ -333,12 +340,14 @@ struct log_driver { * @next_filter_num: Seqence number of next filter filter added (0=no filters * yet). This increments with each new filter on the device, but never * decrements + * @flags: Flags for this filter (enum log_device_flags) * @drv: Pointer to driver for this device * @filter_head: List of filters for this device * @sibling_node: Next device in the list of all devices */ struct log_device { - int next_filter_num; + unsigned short next_filter_num; + unsigned short flags; struct log_driver *drv; struct list_head filter_head; struct list_head sibling_node; |