1
0
Fork 0

Merging upstream version 2.13.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-04-13 11:50:38 +02:00
parent adb2e5e05d
commit 8599c7290c
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
579 changed files with 6165 additions and 1687 deletions

View file

@ -10,14 +10,12 @@
#include <string.h>
#include <stdio.h>
#include "ccan/ilog/ilog.h"
#define LOG_ENTRY_HEADER_SIZE 1
#define LOG_ENTRY_TIMESTAMP_SIZE 2
#define LOG_ENTRY_NUM_ARGS_MAX 8
#define LOG_ENTRY_NUM_ARGS_MASK 0xF
#define LOG_ENTRY_MAX_SIZE (LOG_ENTRY_HEADER_SIZE + LOG_ENTRY_TIMESTAMP_SIZE + \
LOG_ENTRY_NUM_ARGS_MAX)
#define NUM_ARGS_MASK ((1 << ((int)STATIC_ILOG_32(LOG_ENTRY_NUM_ARGS_MAX))) - 1)
#define MAX_HEADER_MISMATCH_TRACK 10
static int formats_find(struct json_object *formats, uint32_t val, struct json_object **format)
@ -41,13 +39,13 @@ static uint32_t nlog_get_events(const uint32_t *nlog, const uint32_t nlog_size,
uint32_t tail_count = 0;
for (int i = nlog_size - start_offset - 1; i >= -start_offset; i--) {
struct json_object *format;
struct json_object *format = NULL;
uint32_t header = nlog_get_pos(nlog, nlog_size, i);
uint32_t num_data;
if (header == 0 || !formats_find(formats, header, &format)) {
if (event_count > 0) {
//check if fould circular buffer tail
//check if found circular buffer tail
if (i != (last_bad_header_pos - 1)) {
if (tail_mismatches &&
(tail_count < MAX_HEADER_MISMATCH_TRACK))
@ -58,7 +56,7 @@ static uint32_t nlog_get_events(const uint32_t *nlog, const uint32_t nlog_size,
}
continue;
}
num_data = header & NUM_ARGS_MASK;
num_data = header & LOG_ENTRY_NUM_ARGS_MASK;
if (events) {
struct json_object *event = json_object_new_array();
struct json_object *param = json_object_new_array();