From 4d9f4a769ce0892eb129fa53c68b69850e46fad2 Mon Sep 17 00:00:00 2001 From: Leonmmcoset <152147508+Leonmmcoset@users.noreply.github.com> Date: Wed, 22 Apr 2026 14:13:30 +0000 Subject: [PATCH] style: auto-format C/C++ sources with clang-format --- cleonos/c/apps/partctl_main.c | 16 ++++++++-------- clks/kernel/storage/disk.c | 21 ++++++++++++--------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/cleonos/c/apps/partctl_main.c b/cleonos/c/apps/partctl_main.c index a21d6d1..def597a 100644 --- a/cleonos/c/apps/partctl_main.c +++ b/cleonos/c/apps/partctl_main.c @@ -9,7 +9,8 @@ #define PARTCTL_MBR_SIG_OFFSET 510U static unsigned int partctl_read_u32_le(const unsigned char *ptr) { - return (unsigned int)ptr[0] | ((unsigned int)ptr[1] << 8U) | ((unsigned int)ptr[2] << 16U) | ((unsigned int)ptr[3] << 24U); + return (unsigned int)ptr[0] | ((unsigned int)ptr[1] << 8U) | ((unsigned int)ptr[2] << 16U) | + ((unsigned int)ptr[3] << 24U); } static void partctl_write_u32_le(unsigned char *ptr, unsigned int value) { @@ -157,9 +158,9 @@ static int partctl_cmd_list(void) { end_lba = (u64)start + (u64)size - 1ULL; } - (void)printf("%llu %s 0x%02X %-12llu %-12llu ", - (unsigned long long)(i + 1ULL), (boot == 0x80U) ? "yes " : "no ", (unsigned int)type, - (unsigned long long)start, (unsigned long long)size); + (void)printf("%llu %s 0x%02X %-12llu %-12llu ", (unsigned long long)(i + 1ULL), + (boot == 0x80U) ? "yes " : "no ", (unsigned int)type, (unsigned long long)start, + (unsigned long long)size); if (size == 0U) { (void)fputs("-\n", 1); @@ -371,9 +372,9 @@ static int partctl_cmd_create(const char *index_text, const char *start_text, co return 0; } - (void)printf("partctl: created p%llu start=%llu sectors=%llu type=0x%02X boot=%llu\n", - (unsigned long long)index, (unsigned long long)start_lba, (unsigned long long)sectors, - (unsigned int)((unsigned char)type), (unsigned long long)boot); + (void)printf("partctl: created p%llu start=%llu sectors=%llu type=0x%02X boot=%llu\n", (unsigned long long)index, + (unsigned long long)start_lba, (unsigned long long)sectors, (unsigned int)((unsigned char)type), + (unsigned long long)boot); return 1; } @@ -466,4 +467,3 @@ int cleonos_app_main(void) { return (success != 0) ? 0 : 1; } - diff --git a/clks/kernel/storage/disk.c b/clks/kernel/storage/disk.c index 122548d..7f83284 100644 --- a/clks/kernel/storage/disk.c +++ b/clks/kernel/storage/disk.c @@ -740,8 +740,7 @@ static i32 clks_disk_alloc_slot(void) { return (i32)(clks_disk_nodes_used - 1U); } -static i32 clks_disk_create_or_update_node(const char *relative_path, u8 type, u16 parent, const void *data, - u64 size) { +static i32 clks_disk_create_or_update_node(const char *relative_path, u8 type, u16 parent, const void *data, u64 size) { i32 existing; i32 slot; usize path_len; @@ -851,7 +850,8 @@ static clks_bool clks_disk_ensure_dir_hierarchy(const char *relative_dir_path) { node_index = clks_disk_find_node_by_relative(prefix); if (node_index < 0) { - node_index = clks_disk_create_or_update_node(prefix, (u8)CLKS_DISK_NODE_DIR, current_parent, CLKS_NULL, 0ULL); + node_index = + clks_disk_create_or_update_node(prefix, (u8)CLKS_DISK_NODE_DIR, current_parent, CLKS_NULL, 0ULL); if (node_index < 0) { return CLKS_FALSE; @@ -1013,8 +1013,7 @@ static clks_bool clks_disk_meta_load(void) { } for (i = 0ULL; i < entry_count; i++) { - const u8 *entry_ptr = - meta_base + CLKS_DISK_META_HEADER_SIZE + (usize)(i * (u64)CLKS_DISK_META_ENTRY_SIZE); + const u8 *entry_ptr = meta_base + CLKS_DISK_META_HEADER_SIZE + (usize)(i * (u64)CLKS_DISK_META_ENTRY_SIZE); u8 type = entry_ptr[0]; u64 size = clks_disk_read_u64(entry_ptr + 4U); u64 data_offset = clks_disk_read_u64(entry_ptr + 12U); @@ -1497,7 +1496,8 @@ clks_bool clks_disk_stat(const char *path, u64 *out_type, u64 *out_size) { char relative[CLKS_DISK_PATH_MAX]; i32 node_index; - if (out_type == CLKS_NULL || out_size == CLKS_NULL || clks_disk_path_to_relative(path, relative, sizeof(relative)) == CLKS_FALSE) { + if (out_type == CLKS_NULL || out_size == CLKS_NULL || + clks_disk_path_to_relative(path, relative, sizeof(relative)) == CLKS_FALSE) { return CLKS_FALSE; } @@ -1511,7 +1511,8 @@ clks_bool clks_disk_stat(const char *path, u64 *out_type, u64 *out_size) { return CLKS_FALSE; } - *out_type = (clks_disk_nodes[(u16)node_index].type == (u8)CLKS_DISK_NODE_DIR) ? CLKS_DISK_NODE_DIR : CLKS_DISK_NODE_FILE; + *out_type = + (clks_disk_nodes[(u16)node_index].type == (u8)CLKS_DISK_NODE_DIR) ? CLKS_DISK_NODE_DIR : CLKS_DISK_NODE_FILE; *out_size = clks_disk_nodes[(u16)node_index].size; return CLKS_TRUE; } @@ -1610,7 +1611,8 @@ clks_bool clks_disk_get_child_name(const char *dir_path, u64 index, char *out_na const char *base; usize base_len; - if (clks_disk_nodes[i].used == CLKS_FALSE || clks_disk_nodes[i].parent != (u16)dir_index || i == (u16)dir_index) { + if (clks_disk_nodes[i].used == CLKS_FALSE || clks_disk_nodes[i].parent != (u16)dir_index || + i == (u16)dir_index) { continue; } @@ -1706,7 +1708,8 @@ clks_bool clks_disk_write_all(const char *path, const void *data, u64 size) { clks_disk_node_release_heap_data((u16)node_index); } - node_index = clks_disk_create_or_update_node(relative, (u8)CLKS_DISK_NODE_FILE, (u16)parent_index, payload_data, size); + node_index = + clks_disk_create_or_update_node(relative, (u8)CLKS_DISK_NODE_FILE, (u16)parent_index, payload_data, size); if (node_index < 0) { if (payload_heap_owned == CLKS_TRUE) {