Skip to content

eBPF-based security platform

treewide: align continuation lines with their open parenthesis

Daniel Borkmann40db29486e26
diff --git a/builtin-bpm.c b/builtin-bpm.c
index df11f332..25c8a31f 100644
--- a/builtin-bpm.c
+++ b/builtin-bpm.c
@@ -163,8 +163,8 @@ static int download_package(const char *raw, const char *destination)
if (destination) {
bpm_copy_string(filename, sizeof(filename), destination);
} else if (title[0] && !strchr(title, '/') &&
- strlen(title) >= strlen(".bee") &&
- !strcmp(title + strlen(title) - strlen(".bee"), ".bee")) {
+ strlen(title) >= strlen(".bee") &&
+ !strcmp(title + strlen(title) - strlen(".bee"), ".bee")) {
bpm_copy_string(filename, sizeof(filename), title);
} else {
const char *base = strrchr(repository, '/');
@@ -285,7 +285,7 @@ static int load_source(const char *name, struct bpm_source *s)
while (fgets(line, sizeof(line), fp)) {
rc = shirudo_bpm_parse_source_line(line,
s->endpoint, sizeof(s->endpoint),
- s->key_file, sizeof(s->key_file));
+ s->key_file, sizeof(s->key_file));
if (rc) {
fclose(fp);
return rc;
@@ -716,7 +716,7 @@ static int list_keys(void)
}
if (!valid || snprintf(path, sizeof(path), "%s/%s",
SHIRUDO_KEYS_DIR, entry->d_name) >=
- (int)sizeof(path))
+ (int)sizeof(path))
continue;
if (lstat(path, &st) || !S_ISREG(st.st_mode) ||
key_file_fingerprint(path, hex) ||
@@ -768,7 +768,7 @@ static int on_state_entry(void *ud)
return -EINVAL;
if (snprintf(expected, sizeof(expected), "%s/%s/%s",
SHIRUDO_BPM_PACKAGES_DIR, s->scratch.name,
- s->scratch.version) >= (int)sizeof(expected) ||
+ s->scratch.version) >= (int)sizeof(expected) ||
strcmp(expected, s->scratch.path))
return -EINVAL;
s->items[s->n++] = s->scratch;
@@ -1326,7 +1326,7 @@ rollback:
if (name_len < strlen(".upatch") ||
dir_len + 1 + name_len - strlen(".upatch") +
- strlen(".unload.upatch") + 1 >= sizeof(unload))
+ strlen(".unload.upatch") + 1 >= sizeof(unload))
continue;
memcpy(unload, loaded[active_i], dir_len);
unload[dir_len] = '/';
@@ -1545,18 +1545,18 @@ static bool tree_digest_valid(const char *digest)
static int tree_fetch_publication(const struct bpm_tree_config *cfg,
struct shirudo_tree_publication *pub,
- char *manifest_digest, size_t digest_sz)
+ char *manifest_digest, size_t digest_sz)
{
struct bpm_oci_client c = {};
char repository[BPM_MAX_ENDPOINT];
int rc = parse_tree_repository(cfg->endpoint, &c,
- repository, sizeof(repository));
+ repository, sizeof(repository));
if (rc)
return rc;
return bpm_tree_fetch_publication(&c, repository, cfg->reference,
- SHIRUDO_CERT_PATH, pub,
- manifest_digest, digest_sz);
+ SHIRUDO_CERT_PATH, pub,
+ manifest_digest, digest_sz);
}
static int tree_verify_upatch(const char *path, const char *expected,
@@ -1665,8 +1665,8 @@ out:
static int tree_write_report(const char *path, const struct shirudo_tree_state *s,
int selected, int skipped, int applied,
- int module_skipped, int dry_run,
- int tpm_available)
+ int module_skipped, int dry_run,
+ int tpm_available)
{
char buf[4096];
struct shirudo_json_emit e = { .buf = buf, .cap = sizeof(buf) };
@@ -2639,8 +2639,8 @@ int cmd_bpm(int argc, const char **argv)
direct ? "direct" : source);
if (snprintf(state[n_state].path, sizeof(state[n_state].path),
"%s/%s/%s", SHIRUDO_BPM_PACKAGES_DIR,
- direct ? selected.name : name,
- selected.version) >= (int)sizeof(state[n_state].path))
+ direct ? selected.name : name,
+ selected.version) >= (int)sizeof(state[n_state].path))
return bpm_finish(lock, -ENAMETOOLONG, "install");
rc = state_write(state, n_state + 1);
return bpm_finish(lock, rc, "write state");
@@ -2739,7 +2739,7 @@ int cmd_bpm(int argc, const char **argv)
selected.version);
if (snprintf(state[i].path, sizeof(state[i].path), "%s/%s/%s",
SHIRUDO_BPM_PACKAGES_DIR, state[i].name,
- selected.version) >= (int)sizeof(state[i].path)) {
+ selected.version) >= (int)sizeof(state[i].path)) {
rc = -ENAMETOOLONG;
break;
}
diff --git a/builtin-status.c b/builtin-status.c
index 10ef7d30..d02f6af1 100644
--- a/builtin-status.c
+++ b/builtin-status.c
@@ -761,7 +761,7 @@ int cmd_status(int argc, const char **argv)
keyring_present, keyring_pinned >= 1,
keyring_present && keyring_pinned >= 1,
keyring_present && keyring_pinned >= 1 &&
- keyring_serial == keyring_pinned,
+ keyring_serial == keyring_pinned,
chain_rc == 0,
match == 1, match >= 0,
nv_index);
@@ -1049,7 +1049,7 @@ int cmd_status(int argc, const char **argv)
keyring_present, keyring_pinned >= 1,
keyring_present && keyring_pinned >= 1,
keyring_present && keyring_pinned >= 1 &&
- keyring_serial == keyring_pinned,
+ keyring_serial == keyring_pinned,
chain_rc == 0,
match == 1, match >= 0,
nv_index);
@@ -1110,8 +1110,8 @@ int cmd_status(int argc, const char **argv)
printf(" %-22s %lld%s\n", "Frozen serial:",
(long long)keyring_pinned, !keyring_present ? "" :
keyring_serial == keyring_pinned ?
- " (matches)" :
- " (MISMATCH -- swapped?)");
+ " (matches)" :
+ " (MISMATCH -- swapped?)");
if (certs_rc == 0) {
printf(" %-22s %zu trusted, %zu revoked, %zu "
"unvouched", "Certificates:", certs.n,
diff --git a/builtin-upatch.c b/builtin-upatch.c
index 4404a4c3..fefafbf6 100644
--- a/builtin-upatch.c
+++ b/builtin-upatch.c
@@ -1236,7 +1236,7 @@ static int prog_specs_parse(const void *metadata, uint32_t metadata_len,
cursor += sizeof(offset);
spec->uprobe_offsets[j] = le64toh(offset);
if (j && spec->uprobe_offsets[j] <=
- spec->uprobe_offsets[j - 1])
+ spec->uprobe_offsets[j - 1])
goto out;
}
}
@@ -1612,7 +1612,7 @@ static int pin_upatch_maps(const struct shirudo_loader_ctx *cx,
return 0;
if (snprintf(dir, sizeof(dir), "%s/%s",
SHIRUDO_BPFFS_UPATCHES_DIR, bpffs_name) >=
- (int)sizeof(dir))
+ (int)sizeof(dir))
return -ENAMETOOLONG;
if (snprintf(maps_dir, sizeof(maps_dir), "%s/maps", dir) >=
(int)sizeof(maps_dir))
diff --git a/include/shirudo/upatch.h b/include/shirudo/upatch.h
index d5c3c758..f4e87e49 100644
--- a/include/shirudo/upatch.h
+++ b/include/shirudo/upatch.h
@@ -61,7 +61,7 @@ struct shirudo_upatch_header {
};
_Static_assert(sizeof(struct shirudo_upatch_header) ==
- SHIRUDO_UPATCH_HEADER_SIZE, "unexpected upatch header padding");
+ SHIRUDO_UPATCH_HEADER_SIZE, "unexpected upatch header padding");
/*
* Optional decoder metadata embedded inside the signature-covered data
diff --git a/testing/helper/test-config.c b/testing/helper/test-config.c
index 1587de3b..c344d2a8 100644
--- a/testing/helper/test-config.c
+++ b/testing/helper/test-config.c
@@ -102,7 +102,7 @@ int main(void)
failed += check_invalid(path, "map_export.otel_insecure = yes\n");
failed += check_invalid(path, "map_export.otlp_max_bytes = 0\n");
failed += check_invalid(path, "map_export.otlp_max_bytes = 1024\n"
- "map_export.log_record_max_bytes = 2048\n");
+ "map_export.log_record_max_bytes = 2048\n");
failed += check_invalid(path, "map_export.tenant_id = tenant uuid\n");
failed += check_invalid(path, "map_export.tenant_id = tenant/id\n");
failed += check_invalid(path,
diff --git a/testing/helper/test-otel-map.c b/testing/helper/test-otel-map.c
index 1ccecac7..a44691da 100644
--- a/testing/helper/test-otel-map.c
+++ b/testing/helper/test-otel-map.c
@@ -85,7 +85,7 @@ static int make_decoder(bool metric, bool counter, bool snapshot,
if (file_len > UINT32_MAX || decoder_len > UINT32_MAX ||
source_len > UINT32_MAX || snprintf(path, path_sz, "%s", template) >=
- (int)path_sz)
+ (int)path_sz)
return -EOVERFLOW;
file = xcalloc(1, file_len);
if (!file)
@@ -119,8 +119,8 @@ static int make_decoder(bool metric, bool counter, bool snapshot,
entry.api_version = htole32(1);
entry.input_format = htole32(SHIRUDO_UPATCH_DECODER_INPUT_MAP_V1);
entry.export_signal = htole32(metric ?
- SHIRUDO_UPATCH_DECODER_EXPORT_METRIC :
- SHIRUDO_UPATCH_DECODER_EXPORT_LOG);
+ SHIRUDO_UPATCH_DECODER_EXPORT_METRIC :
+ SHIRUDO_UPATCH_DECODER_EXPORT_LOG);
strncpy(entry.upatch, "test-upatch", sizeof(entry.upatch) - 1);
strncpy(entry.map, "hits_total", sizeof(entry.map) - 1);
strncpy(entry.source, "test.lua", sizeof(entry.source) - 1);
@@ -575,10 +575,10 @@ int main(int argc, char **argv)
return send_metric(argv[2]);
if (strcmp(argv[1], "send-s3") == 0 && argc == 4)
return send_s3(argv[2],
- (unsigned int)strtoul(argv[3], NULL, 10), false);
+ (unsigned int)strtoul(argv[3], NULL, 10), false);
if (strcmp(argv[1], "send-s3-large") == 0 && argc == 4)
return send_s3(argv[2],
- (unsigned int)strtoul(argv[3], NULL, 10), true);
+ (unsigned int)strtoul(argv[3], NULL, 10), true);
if (strcmp(argv[1], "s3-validation") == 0)
return s3_validation();
if (strcmp(argv[1], "tenant-validation") == 0)
diff --git a/tools/shirudo-build/bpm-build.c b/tools/shirudo-build/bpm-build.c
index e0ee3a9b..d070f36a 100644
--- a/tools/shirudo-build/bpm-build.c
+++ b/tools/shirudo-build/bpm-build.c
@@ -351,7 +351,7 @@ static int build_default_targets(struct bpm_build_upatch *u)
return -ENAMETOOLONG;
if (!u->unload_target[0] && snprintf(u->unload_target,
sizeof(u->unload_target), "upatches/%s.unload.upatch",
- base) >= (int)sizeof(u->unload_target))
+ base) >= (int)sizeof(u->unload_target))
return -ENAMETOOLONG;
return 0;
}
@@ -864,7 +864,7 @@ static int build_upatches(struct bpm_build_spec *spec, const char *pkey,
static int build_environment(const struct bpm_build_spec *spec,
const char *version, const char *fingerprint,
- unsigned char **out, size_t *out_len)
+ unsigned char **out, size_t *out_len)
{
char *body = xmalloc(BPM_BUILD_MAX_JSON);
struct shirudo_json_emit e = { .buf = body, .cap = BPM_BUILD_MAX_JSON };
@@ -908,10 +908,10 @@ static int build_environment(const struct bpm_build_spec *spec,
shirudo_json_kv_string(&e, "type", u->type);
shirudo_json_kv_string(&e, "load_target", u->load_target);
shirudo_json_kv_string(&e, "load_output", strrchr(u->load_target, '/') ?
- strrchr(u->load_target, '/') + 1 : u->load_target);
+ strrchr(u->load_target, '/') + 1 : u->load_target);
shirudo_json_kv_string(&e, "unload_target", u->unload_target);
shirudo_json_kv_string(&e, "unload_output", strrchr(u->unload_target, '/') ?
- strrchr(u->unload_target, '/') + 1 : u->unload_target);
+ strrchr(u->unload_target, '/') + 1 : u->unload_target);
shirudo_json_kv_string(&e, "upatch_name", u->name);
shirudo_json_kv_string(&e, "payload_sha256", u->payload_sha256);
shirudo_json_obj_close(&e);
diff --git a/tools/shirudo-build/bpm-publish.c b/tools/shirudo-build/bpm-publish.c
index 4816306f..015ca61d 100644
--- a/tools/shirudo-build/bpm-publish.c
+++ b/tools/shirudo-build/bpm-publish.c
@@ -304,7 +304,7 @@ static int push_index(struct bpm_oci_client *c, const char *repository,
}
rc = bpm_oci_put_manifest(c, BPM_INDEX_REPOSITORY, BPM_INDEX_TAG,
(const unsigned char *)manifest, e.len, digest,
- sizeof(digest));
+ sizeof(digest));
out:
if (manifest)
xfree(manifest, BPM_MANIFEST_CAP);
@@ -401,7 +401,7 @@ static int push_package(const char *package_path, const char *raw_repository,
manifest = (unsigned char *)manifest_body;
if (bpm_sha256_hex(manifest, manifest_len, hex, sizeof(hex)) ||
snprintf(package_digest, sizeof(package_digest), "sha256:%s", hex) >=
- (int)sizeof(package_digest)) {
+ (int)sizeof(package_digest)) {
rc = -EINVAL;
goto out;
}
@@ -460,7 +460,7 @@ static int push_package(const char *package_path, const char *raw_repository,
if (bpm_sha256_hex(key_manifest_body, key_manifest_len, hex,
sizeof(hex)) ||
snprintf(key_digest, sizeof(key_digest), "sha256:%s", hex) >=
- (int)sizeof(key_digest)) {
+ (int)sizeof(key_digest)) {
rc = -EINVAL;
goto out;
}
@@ -600,8 +600,8 @@ static int tree_push_artifact(struct bpm_oci_client *c, const char *repository,
if (!rc)
rc = bpm_oci_put_manifest(c, repository, tag,
(const unsigned char *)manifest, e.len,
- out->manifest_digest,
- sizeof(out->manifest_digest));
+ out->manifest_digest,
+ sizeof(out->manifest_digest));
xfree(manifest, BPM_MANIFEST_CAP);
if (rc)
return rc;
@@ -838,7 +838,7 @@ static int cmd_bpm_tree_append(int argc, char **argv)
if (!rc)
rc = bpm_oci_put_manifest(&c, repository, reference,
(const unsigned char *)manifest, e.len,
- digest, sizeof(digest));
+ digest, sizeof(digest));
if (!rc)
printf("oci://%s/%s:%s %s\n", c.registry, repository, reference,
digest);
diff --git a/util/bpm_oci.c b/util/bpm_oci.c
index 5b1747ff..887d454c 100644
--- a/util/bpm_oci.c
+++ b/util/bpm_oci.c
@@ -482,8 +482,8 @@ static int curl_once_ex(struct bpm_oci_client *c, const char *method,
static int curl_once(struct bpm_oci_client *c, const char *method,
const char *url, const char *accept, const char *auth,
- struct bpm_http_response *r, struct bpm_file_sink *file,
- bool follow)
+ struct bpm_http_response *r, struct bpm_file_sink *file,
+ bool follow)
{
return curl_once_ex(c, method, url, accept, NULL, NULL, 0, auth, r, file,
follow);
@@ -844,8 +844,8 @@ static int on_descriptor(void *ud)
int bpm_oci_parse_manifest(const unsigned char *body, size_t len,
struct bpm_descriptor *layers, int max_layers,
- int *n_layers, char *package_name,
- size_t package_name_sz)
+ int *n_layers, char *package_name,
+ size_t package_name_sz)
{
struct desc_sink sink = { .items = layers, .max = max_layers };
struct shirudo_json_array arr = { on_descriptor, &sink };
@@ -899,7 +899,7 @@ bool bpm_package_name_ok(const char *s)
int bpm_oci_parse_pull_ref(const char *raw, struct bpm_oci_client *c,
char *repository, size_t repository_sz,
- char *tag, size_t tag_sz)
+ char *tag, size_t tag_sz)
{
const char *p, *slash, *colon, *last_slash;
char endpoint[BPM_MAX_ENDPOINT];
@@ -1061,7 +1061,7 @@ static int upload_location(const struct bpm_oci_client *c, const char *location,
int bpm_oci_push_blob(struct bpm_oci_client *c, const char *repository,
const void *body, size_t body_len, const char *media,
- struct bpm_descriptor *out)
+ struct bpm_descriptor *out)
{
struct bpm_http_response r = {};
char hex[65], digest[72], url[PATH_MAX], upload[PATH_MAX];
@@ -1143,7 +1143,7 @@ void bpm_oci_emit_descriptor(struct shirudo_json_emit *e, const char *key,
int bpm_oci_put_manifest(struct bpm_oci_client *c, const char *repository,
const char *reference, const unsigned char *body,
- size_t body_len, char *digest, size_t digest_sz)
+ size_t body_len, char *digest, size_t digest_sz)
{
struct bpm_http_response r = {};
char hex[65], url[PATH_MAX];
diff --git a/util/bpm_package.c b/util/bpm_package.c
index e2e6a5d0..808560f7 100644
--- a/util/bpm_package.c
+++ b/util/bpm_package.c
@@ -161,8 +161,8 @@ static bool package_member_name_ok(const char *name, const char *member)
int bpm_pkg_read_member_in(const char *archive, const char *member,
const char *package_dir, char *found_dir,
- size_t found_dir_sz, unsigned char **out,
- size_t *out_len, size_t max)
+ size_t found_dir_sz, unsigned char **out,
+ size_t *out_len, size_t max)
{
gzFile gz = gzopen(archive, "rb");
unsigned char h[512];
@@ -421,10 +421,10 @@ out:
int bpm_tree_fetch_publication(struct bpm_oci_client *c,
const char *repository,
- const char *reference,
- const char *cert_path,
- struct shirudo_tree_publication *pub,
- char *manifest_digest, size_t digest_sz)
+ const char *reference,
+ const char *cert_path,
+ struct shirudo_tree_publication *pub,
+ char *manifest_digest, size_t digest_sz)
{
struct bpm_buffer manifest = {}, payload = {}, sig = {};
struct bpm_descriptor *layers = NULL;
diff --git a/util/bpm_tree.c b/util/bpm_tree.c
index 46d68396..bd277f37 100644
--- a/util/bpm_tree.c
+++ b/util/bpm_tree.c
@@ -277,7 +277,7 @@ static int tp_selector(struct tree_parser *p, struct shirudo_tree_selector *s)
SHIRUDO_TREE_MAX_SELECTOR_VALUES))
return -EINVAL;
} else if (!strcmp(key, "kconfig") ||
- !strcmp(key, "kernel_config")) {
+ !strcmp(key, "kernel_config")) {
if (tp_selector_string_map(p, s->kconfig, &s->n_kconfig,
SHIRUDO_TREE_MAX_KCONFIG))
return -EINVAL;
diff --git a/util/bpm_tree_state.c b/util/bpm_tree_state.c
index dd13c120..36036826 100644
--- a/util/bpm_tree_state.c
+++ b/util/bpm_tree_state.c
@@ -181,14 +181,14 @@ static void selector_hash_build(const struct shirudo_tree_selector *s,
static int selector_hash_find(const struct shirudo_tree_selector *s,
const int slots[SHIRUDO_TREE_SELECTOR_HASH_SIZE],
- const char *key)
+ const char *key)
{
unsigned int slot = selector_hash(key) &
(SHIRUDO_TREE_SELECTOR_HASH_SIZE - 1);
for (int probes = 0; probes < SHIRUDO_TREE_SELECTOR_HASH_SIZE;
probes++, slot = (slot + 1) &
- (SHIRUDO_TREE_SELECTOR_HASH_SIZE - 1)) {
+ (SHIRUDO_TREE_SELECTOR_HASH_SIZE - 1)) {
if (slots[slot] < 0)
return -1;
if (!strcmp(s->kconfig[slots[slot]].key, key))
@@ -260,9 +260,9 @@ static int selector_config_line(const char *line,
static int read_selector_config_file(const char *path,
const struct shirudo_tree_selector *s,
- const int slots[SHIRUDO_TREE_SELECTOR_HASH_SIZE],
- char values[][SHIRUDO_TREE_STRING_MAX],
- bool found[], bool gz)
+ const int slots[SHIRUDO_TREE_SELECTOR_HASH_SIZE],
+ char values[][SHIRUDO_TREE_STRING_MAX],
+ bool found[], bool gz)
{
char line[1024];
int rc = 0;
diff --git a/util/chain.c b/util/chain.c
index 84787c8e..903d70ed 100644
--- a/util/chain.c
+++ b/util/chain.c
@@ -66,8 +66,8 @@ static int member_cmp(const void *a, const void *b)
void shirudo_chain_init_event(const uint8_t cert_sha[32],
struct shirudo_measured_upatch *set, size_t n,
- const uint8_t tree_root[32],
- uint8_t set_digest[32], uint8_t event[32])
+ const uint8_t tree_root[32],
+ uint8_t set_digest[32], uint8_t event[32])
{
uint8_t tag[sizeof("shirudo-init") + 96];
size_t taglen = sizeof("shirudo-init"), listing_len = 0, off = 0, i;
diff --git a/util/chain.h b/util/chain.h
index be7defd1..98f787f9 100644
--- a/util/chain.h
+++ b/util/chain.h
@@ -54,8 +54,8 @@ struct shirudo_measured_upatch {
*/
void shirudo_chain_init_event(const uint8_t cert_sha[32],
struct shirudo_measured_upatch *set, size_t n,
- const uint8_t tree_root[32],
- uint8_t set_digest[32], uint8_t event[32]);
+ const uint8_t tree_root[32],
+ uint8_t set_digest[32], uint8_t event[32]);
/* SHA256(tag || NUL || cert_sha256), tag "shirudo-key-revoke". */
void shirudo_chain_key_event(const char *tag, const uint8_t cert_sha[32],
uint8_t event[32]);
diff --git a/util/conditions.c b/util/conditions.c
index 44a51982..a810dc00 100644
--- a/util/conditions.c
+++ b/util/conditions.c
@@ -20,8 +20,8 @@ size_t shirudo_conditions(const struct shirudo_conditions_input *in,
c[n].status = in->lsm_attached ? "OK" : "ALERT";
snprintf(c[n].detail, sizeof(c[n].detail), "%s",
in->lsm_attached ?
- "lsm/bpf link present and pinned" :
- "lsm/bpf absent -- enforcement OFF");
+ "lsm/bpf link present and pinned" :
+ "lsm/bpf absent -- enforcement OFF");
n++;
}
if (n < cap) {
diff --git a/util/sysinfo.c b/util/sysinfo.c
index 22cd4561..f579373a 100644
--- a/util/sysinfo.c
+++ b/util/sysinfo.c
@@ -179,7 +179,7 @@ int shirudo_sysinfo_kernel_config_foreach(const char *kernel_release,
if (!kernel_release || !kernel_release[0] || !cb ||
snprintf(path, sizeof(path), "/boot/config-%s", kernel_release) >=
- (int)sizeof(path))
+ (int)sizeof(path))
return -1;
f = fopen(path, "re");
if (!f)
diff --git a/util/sysinfo.h b/util/sysinfo.h
index f85b8173..c5a8b48a 100644
--- a/util/sysinfo.h
+++ b/util/sysinfo.h
@@ -34,7 +34,7 @@ void shirudo_sysinfo_gather(struct shirudo_sysinfo *si);
struct shirudo_json_emit;
typedef void (*shirudo_kernel_config_cb)(void *ctx, const char *key,
- const char *value);
+ const char *value);
int shirudo_sysinfo_kernel_config_foreach(const char *kernel_release,
shirudo_kernel_config_cb cb,
diff --git a/util/upatch_decode.c b/util/upatch_decode.c
index 7c31398d..6da29abc 100644
--- a/util/upatch_decode.c
+++ b/util/upatch_decode.c
@@ -1338,8 +1338,8 @@ int shirudo_upatch_decode_map_json(const struct shirudo_map_view *v,
char **out, size_t *out_len)
{
return shirudo_upatch_decode_map_json_limit(v,
- SHIRUDO_JSON_MAX_BYTES,
- out, out_len);
+ SHIRUDO_JSON_MAX_BYTES,
+ out, out_len);
}
int shirudo_upatch_decode_map_json_limit(const struct shirudo_map_view *v,
@@ -1362,8 +1362,8 @@ int shirudo_upatch_decode_map_file_json(const char *path,
char **out, size_t *out_len)
{
return shirudo_upatch_decode_map_file_json_limit(path, v,
- SHIRUDO_JSON_MAX_BYTES,
- out, out_len);
+ SHIRUDO_JSON_MAX_BYTES,
+ out, out_len);
}
int shirudo_upatch_decode_map_file_json_limit(const char *path,
@@ -1381,7 +1381,7 @@ int shirudo_upatch_decode_map_file_otel(const char *path,
char **out, size_t *out_len)
{
return decode_map_file(path, v, true, SHIRUDO_JSON_MAX_BYTES,
- out, out_len);
+ out, out_len);
}
#endif /* SHIRUDO_HAVE_LUAJIT */
diff --git a/util/upatch_maps.c b/util/upatch_maps.c
index 2ec37903..5e698982 100644
--- a/util/upatch_maps.c
+++ b/util/upatch_maps.c
@@ -444,7 +444,7 @@ static char *btf_format_value(const struct btf *btf, uint32_t type_id,
for (i = 0; i < (uint32_t)vlen; i++) {
if ((uint32_t)e[i].val == v) {
const char *nm = btf__name_by_offset(btf,
- e[i].name_off);
+ e[i].name_off);
return fmt_alloc("%s", nm && nm[0] ? nm : "?");
}
}
@@ -468,7 +468,7 @@ static char *btf_format_value(const struct btf *btf, uint32_t type_id,
if (ev == v) {
const char *nm = btf__name_by_offset(btf,
- e[i].name_off);
+ e[i].name_off);
return fmt_alloc("%s", nm && nm[0] ? nm : "?");
}
}
@@ -530,7 +530,7 @@ static char *btf_format_value(const struct btf *btf, uint32_t type_id,
fmt_alloc("%s%s=%s",
i ? ", " : "",
fname && fname[0] ?
- fname : "?",
+ fname : "?",
fval ? fval : "?"));
xstrfree(fval);
}
@@ -554,8 +554,8 @@ static char *btf_format_value(const struct btf *btf, uint32_t type_id,
strbuf_append_take(&out, &cap, &off, fmt_alloc("[ "));
for (i = 0; i < n && i < 16; i++) {
char *ev = btf_format_value(btf, a->type,
- (const char *)bytes + i * (size_t)esz,
- (uint32_t)esz, depth + 1);
+ (const char *)bytes + i * (size_t)esz,
+ (uint32_t)esz, depth + 1);
strbuf_append_take(&out, &cap, &off,
fmt_alloc("%s%s",
@@ -768,7 +768,7 @@ static int open_serializer_pin(const char *upatch, const char *map_name)
return -ENAMETOOLONG;
if ((size_t)snprintf(path, sizeof(path), "%s/%s/serializers/%s",
SHIRUDO_BPFFS_UPATCHES_DIR, bpffs_name, map_name) >=
- sizeof(path))
+ sizeof(path))
return -ENAMETOOLONG;
fd = bpf_obj_get(path);
if (fd < 0)
@@ -1122,7 +1122,7 @@ static int read_entries(int fd, struct shirudo_map_view *v,
return -ENOMEM;
}
memcpy(key, &i, sizeof(i) <= v->key_size ?
- sizeof(i) : v->key_size);
+ sizeof(i) : v->key_size);
if (v->key_size > sizeof(i))
memset((char *)key + sizeof(i), 0,
v->key_size - sizeof(i));
@@ -1167,8 +1167,8 @@ static int read_entries(int fd, struct shirudo_map_view *v,
}
if (v->n_entries == entries_cap) {
void *p = xreallocarray(v->entries,
- entries_cap, entries_cap * 2,
- sizeof(*v->entries));
+ entries_cap, entries_cap * 2,
+ sizeof(*v->entries));
if (!p) {
xfree(key, v->key_size);
xfree(value, value_alloc);
@@ -1633,7 +1633,7 @@ void shirudo_upatch_maps_emit_json_fields(struct shirudo_json_emit *e,
const struct shirudo_serial_page *page =
&v->serial_pages[p];
char *hex = shirudo_hex_alloc(page->data,
- page->bytes);
+ page->bytes);
shirudo_json_obj_open(e);
shirudo_json_kv_int(e, "page_index",
@@ -1657,7 +1657,7 @@ void shirudo_upatch_maps_emit_json_fields(struct shirudo_json_emit *e,
if (v->skipped) {
shirudo_json_kv_string(e, "skipped",
v->skipped_reason ?
- v->skipped_reason : "");
+ v->skipped_reason : "");
return;
}
shirudo_json_kv_bool(e, "truncated", v->truncated);
@@ -1670,7 +1670,7 @@ void shirudo_upatch_maps_emit_json_fields(struct shirudo_json_emit *e,
: "");
shirudo_json_kv_string(e, "value_type",
v->btf_value_type[0] ?
- v->btf_value_type : "");
+ v->btf_value_type : "");
if (v->key_type_def[0])
shirudo_json_kv_string(e, "key_type_def",
v->key_type_def);
diff --git a/util/upatch_maps_otel.c b/util/upatch_maps_otel.c
index 2d733106..580e04dd 100644
--- a/util/upatch_maps_otel.c
+++ b/util/upatch_maps_otel.c
@@ -617,7 +617,7 @@ static void u64_decimal(uint64_t value, char out[32])
}
static __attribute__((unused)) void emit_log_map_data(struct shirudo_json_emit *e,
- const struct shirudo_map_view *v)
+ const struct shirudo_map_view *v)
{
uint32_t i, j;
@@ -638,7 +638,7 @@ static __attribute__((unused)) void emit_log_map_data(struct shirudo_json_emit *
for (p = 0; p < v->n_serial_pages; p++) {
const struct shirudo_serial_page *page = &v->serial_pages[p];
char *hex = shirudo_hex_alloc(page->data,
- page->bytes);
+ page->bytes);
otlp_array_kvlist_begin(e);
otlp_kv_int(e, "page_index", page->page_index);
@@ -722,8 +722,8 @@ static __attribute__((unused)) void emit_log_map_data(struct shirudo_json_emit *
/* record_max bounds the decoded body, 0 for none. */
static int build_log_payload(const char *path,
const struct shirudo_map_view *v,
- size_t record_max,
- char **out, size_t *out_len)
+ size_t record_max,
+ char **out, size_t *out_len)
{
struct shirudo_json_emit e = {};
char *decoded = NULL;
@@ -759,7 +759,7 @@ static int build_log_payload(const char *path,
shirudo_json_kv_string(&e, "severityText", "INFO");
shirudo_json_kv_string(&e, "eventName", "shirudo.bpf.map.snapshot");
decode_rc = path ? shirudo_upatch_decode_map_file_otel(path, v,
- &decoded, &decoded_len) :
+ &decoded, &decoded_len) :
shirudo_upatch_decode_map_otel(v, &decoded, &decoded_len);
if (!decode_rc && record_max && decoded_len > record_max) {
xfree(decoded, decoded_len + 1);
@@ -857,7 +857,7 @@ static int entry_metric_value(const struct shirudo_map_view *v,
unsigned __int128 u = 0;
int rc = read_integer((const char *)en->value +
- (size_t)i * stride, mt, &s, &u);
+ (size_t)i * stride, mt, &s, &u);
if (rc)
return rc;
@@ -963,8 +963,8 @@ static int validate_metric_view(const struct otel_state *st,
}
static __attribute__((unused)) int build_metric_payload(const struct otel_state *st,
- const struct shirudo_map_view *v,
- char **out, size_t *out_len)
+ const struct shirudo_map_view *v,
+ char **out, size_t *out_len)
{
struct shirudo_json_emit e = {};
struct metric_type mt;
@@ -1021,7 +1021,7 @@ static __attribute__((unused)) int build_metric_payload(const struct otel_state
st->opts.metric_unit ?: "1");
shirudo_json_obj_open_key(&e,
st->opts.metric_kind == SHIRUDO_OTEL_METRIC_COUNTER ?
- "sum" : "gauge");
+ "sum" : "gauge");
if (st->opts.metric_kind == SHIRUDO_OTEL_METRIC_COUNTER) {
shirudo_json_kv_int(&e, "aggregationTemporality", 2);
shirudo_json_kv_bool(&e, "isMonotonic", true);
@@ -1087,7 +1087,7 @@ static int build_metric_decoded_payload(const char *path,
(void)opts;
rc = path ? shirudo_upatch_decode_map_file_json(path, v,
- &decoded, &decoded_len) :
+ &decoded, &decoded_len) :
shirudo_upatch_decode_map_json(v, &decoded, &decoded_len);
if (rc)
return rc;
@@ -1204,7 +1204,7 @@ static int resolve_endpoint(struct otel_state *st, const char *spec,
if (spec && spec[0]) {
if (spec_is_base)
return append_signal_path(spec, st->signal, st->endpoint,
- sizeof(st->endpoint));
+ sizeof(st->endpoint));
if (strlen(spec) >= sizeof(st->endpoint))
return -ENAMETOOLONG;
snprintf(st->endpoint, sizeof(st->endpoint), "%s", spec);
@@ -1743,8 +1743,8 @@ static int otel_post(struct otel_state *st, const char *json, size_t json_len)
static int otel_open_transport(enum shirudo_otel_signal signal,
const char *spec,
- const struct shirudo_otel_opts *opts,
- const char *decoder_path, void **state)
+ const struct shirudo_otel_opts *opts,
+ const char *decoder_path, void **state)
{
struct otel_state *st;
int rc;
@@ -1787,8 +1787,8 @@ err:
static int otel_open_common(const char *spec, const struct shirudo_map_view *v,
const struct shirudo_otel_opts *opts,
- bool automatic, enum shirudo_otel_signal forced,
- const char *decoder_path, void **state)
+ bool automatic, enum shirudo_otel_signal forced,
+ const char *decoder_path, void **state)
{
enum shirudo_otel_signal signal;
char reason[160];
@@ -1948,13 +1948,13 @@ static int build_generic_log_payload(const char *scope_name,
int shirudo_otel_send_log_json(const struct shirudo_otel_opts *opts,
const char *scope_name,
- const char *event_name,
- int severity_number,
- const char *severity_text,
- const char *status,
- const char *version_id,
- int64_t tamper_attempts,
- const char *body_json, size_t body_len)
+ const char *event_name,
+ int severity_number,
+ const char *severity_text,
+ const char *status,
+ const char *version_id,
+ int64_t tamper_attempts,
+ const char *body_json, size_t body_len)
{
char *payload = NULL;
void *state = NULL;
@@ -1967,10 +1967,10 @@ int shirudo_otel_send_log_json(const struct shirudo_otel_opts *opts,
return rc;
rc = build_generic_log_payload(scope_name, event_name,
severity_number, severity_text,
- status, version_id,
- tamper_attempts,
- body_json, body_len,
- &payload, &payload_len, &alloc_len);
+ status, version_id,
+ tamper_attempts,
+ body_json, body_len,
+ &payload, &payload_len, &alloc_len);
if (!rc)
rc = otel_post(state, payload, payload_len);
if (payload)
@@ -2145,7 +2145,7 @@ static int snapshot_writer_finish(struct snapshot_writer *w,
static int build_s3_snapshot(const char *decoder_path,
const struct shirudo_map_view *v,
- struct s3_snapshot *snapshot)
+ struct s3_snapshot *snapshot)
{
struct snapshot_writer writer;
char *decoded = NULL;
@@ -2682,8 +2682,8 @@ static void otel_s3_state_free(struct otel_s3_state *st)
static int otel_s3_open(const char *spec, const struct shirudo_map_view *v,
const struct shirudo_otel_opts *opts,
- const char *decoder_path,
- void **state)
+ const char *decoder_path,
+ void **state)
{
struct otel_s3_state *st;
void *otel = NULL;
diff --git a/util/upatch_maps_otel.h b/util/upatch_maps_otel.h
index cebe9884..adbf0bbb 100644
--- a/util/upatch_maps_otel.h
+++ b/util/upatch_maps_otel.h
@@ -72,12 +72,12 @@ int shirudo_upatch_maps_otel_send_decoded(const struct shirudo_map_view *v,
*/
int shirudo_otel_send_log_json(const struct shirudo_otel_opts *opts,
const char *scope_name,
- const char *event_name,
- int severity_number,
- const char *severity_text,
- const char *status,
- const char *version_id,
- int64_t tamper_attempts,
- const char *body_json, size_t body_len);
+ const char *event_name,
+ int severity_number,
+ const char *severity_text,
+ const char *status,
+ const char *version_id,
+ int64_t tamper_attempts,
+ const char *body_json, size_t body_len);
#endif /* SHIRUDO_UTIL_UPATCH_MAPS_OTEL_H */