Skip to content

Commit d4fbebe

Browse files
author
rcitach
committed
style: format code with clang-format [skip ci]
1 parent 30ae787 commit d4fbebe

10 files changed

Lines changed: 71 additions & 70 deletions

File tree

components/lwp/arch/common/vdso_kernel.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ enum rt_vdso_binary_id
3333

3434
struct rt_vdso_binary_info
3535
{
36-
const char *name;
37-
const char *image_start;
38-
const char *image_end;
36+
const char *name;
37+
const char *image_start;
38+
const char *image_end;
3939
unsigned long page_count;
4040
};
4141

@@ -47,15 +47,16 @@ static struct rt_vdso_binary_info rt_vdso_binaries[] = {
4747
},
4848
};
4949

50-
static union {
50+
static union
51+
{
5152
struct rt_vdso_data_page data_page;
52-
uint8_t raw[RT_VDSO_DATA_PAGE_COUNT * ARCH_PAGE_SIZE];
53+
uint8_t raw[RT_VDSO_DATA_PAGE_COUNT * ARCH_PAGE_SIZE];
5354
} rt_vdso_data_page_store RT_VDSO_DATA_PAGE_ALIGNED;
5455
struct rt_vdso_data_page *rt_vdso_kernel_data_page = &rt_vdso_data_page_store.data_page;
5556
static int rt_vdso_runtime_status = RT_EOK;
5657

5758
static struct timespec rt_vdso_realtime_offset;
58-
static rt_bool_t rt_vdso_realtime_offset_ready;
59+
static rt_bool_t rt_vdso_realtime_offset_ready;
5960

6061
#ifndef MMU_MAP_U_ROCB
6162
#define MMU_MAP_U_ROCB MMU_MAP_U_RWCB
@@ -113,8 +114,8 @@ static struct timespec rt_vdso_add_timespec(const struct timespec *lhs,
113114
}
114115

115116
static int rt_vdso_read_monotonic_snapshot(struct timespec *monotonic_time,
116-
rt_uint64_t *counter_value,
117-
rt_uint64_t *counter_freq)
117+
rt_uint64_t *counter_value,
118+
rt_uint64_t *counter_freq)
118119
{
119120
*counter_value = rt_clock_time_get_counter();
120121
*counter_freq = rt_clock_time_get_freq();
@@ -129,8 +130,8 @@ static int rt_vdso_read_monotonic_snapshot(struct timespec *monotonic_time,
129130
}
130131

131132
static void rt_vdso_store_clock_snapshot(const struct timespec *monotonic_time,
132-
rt_uint64_t counter_value,
133-
rt_uint64_t counter_freq)
133+
rt_uint64_t counter_value,
134+
rt_uint64_t counter_freq)
134135
{
135136
rt_vdso_kernel_data_page->counter_last = counter_value;
136137
rt_vdso_kernel_data_page->counter_freq = counter_freq;
@@ -190,10 +191,10 @@ static void *rt_vdso_map_physical_pages(struct rt_lwp *lwp, void *user_va,
190191

191192

192193
static int rt_vdso_map_binary_pages(enum rt_vdso_binary_id binary_id,
193-
struct rt_lwp *lwp)
194+
struct rt_lwp *lwp)
194195
{
195-
void *data_page_base = RT_NULL;
196-
void *image_base = RT_NULL;
196+
void *data_page_base = RT_NULL;
197+
void *image_base = RT_NULL;
197198
unsigned long data_page_len;
198199
unsigned long image_len;
199200

components/lwp/lwp_elf.c

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,27 @@
3737
#endif
3838
#include <rtdbg.h>
3939

40-
#define ELF_INVALID_FD -1
40+
#define ELF_INVALID_FD -1
4141
#define ELF_PHDR_NUM_MAX 128
42-
#define FILE_LENGTH_MAX 0xC0000000
43-
#define MEM_SIZE_MAX 0xC0000000
44-
#define ELF_PATH_MAX 256
45-
#define FLF_PATH_MIN 1
42+
#define FILE_LENGTH_MAX 0xC0000000
43+
#define MEM_SIZE_MAX 0xC0000000
44+
#define ELF_PATH_MAX 256
45+
#define FLF_PATH_MIN 1
4646

47-
#define ELF_PAGESTART(_v) ((_v) & ~(rt_ubase_t)(ARCH_PAGE_SIZE - 1))
47+
#define ELF_PAGESTART(_v) ((_v) & ~(rt_ubase_t)(ARCH_PAGE_SIZE - 1))
4848
#define ELF_PAGEOFFSET(_v) ((_v) & (ARCH_PAGE_SIZE - 1))
49-
#define ELF_PAGEALIGN(_v) (((_v) + ARCH_PAGE_SIZE - 1) & ~(ARCH_PAGE_SIZE - 1))
49+
#define ELF_PAGEALIGN(_v) (((_v) + ARCH_PAGE_SIZE - 1) & ~(ARCH_PAGE_SIZE - 1))
5050

51-
#define ELF_EXEC_LOAD_ADDR USER_VADDR_START
51+
#define ELF_EXEC_LOAD_ADDR USER_VADDR_START
5252
#define ELF_INTERP_LOAD_ADDR LDSO_LOAD_VADDR
5353

54-
#define ELF_AUX_ENT(aux, id, val) \
55-
do \
56-
{ \
57-
rt_base_t a = id; \
58-
lwp_data_put(lwp, aux++, &a, sizeof(rt_ubase_t)); \
59-
a = val; \
60-
lwp_data_put(lwp, aux++, &a, sizeof(rt_ubase_t)); \
54+
#define ELF_AUX_ENT(aux, id, val) \
55+
do \
56+
{ \
57+
rt_base_t a = id; \
58+
lwp_data_put(lwp, aux++, &a, sizeof(rt_ubase_t)); \
59+
a = val; \
60+
lwp_data_put(lwp, aux++, &a, sizeof(rt_ubase_t)); \
6161
} while (0)
6262

6363
/**
@@ -127,10 +127,10 @@ static void elf_user_dump(struct rt_lwp *lwp, void *va, size_t len)
127127

128128
for (size_t i = 0; i < len; i += 16)
129129
{
130-
rt_kprintf(" %02x %02x %02x %02x %02x %02x %02x %02x ", k_va[i], k_va[i+1], k_va[i+2], k_va[i+3],
131-
k_va[i+4], k_va[i+5], k_va[i+6], k_va[i+7]);
132-
rt_kprintf(" %02x %02x %02x %02x %02x %02x %02x %02x \n", k_va[i+8], k_va[i+9], k_va[i+10], k_va[i+11],
133-
k_va[i+12], k_va[i+13], k_va[i+14], k_va[i+15]);
130+
rt_kprintf(" %02x %02x %02x %02x %02x %02x %02x %02x ", k_va[i], k_va[i + 1], k_va[i + 2], k_va[i + 3],
131+
k_va[i + 4], k_va[i + 5], k_va[i + 6], k_va[i + 7]);
132+
rt_kprintf(" %02x %02x %02x %02x %02x %02x %02x %02x \n", k_va[i + 8], k_va[i + 9], k_va[i + 10], k_va[i + 11],
133+
k_va[i + 12], k_va[i + 13], k_va[i + 14], k_va[i + 15]);
134134
}
135135
rt_kprintf("\r\n");
136136
rt_free(k_va);
@@ -169,7 +169,7 @@ rt_ubase_t elf_random_offset(void)
169169
* @return Virtual address where the file is mapped on success, NULL on failure.
170170
*/
171171
static void *file_mmap(struct rt_lwp *lwp, int fd, rt_ubase_t load_addr,
172-
rt_ubase_t map_size, size_t prot, size_t flags, rt_ubase_t offset)
172+
rt_ubase_t map_size, size_t prot, size_t flags, rt_ubase_t offset)
173173
{
174174
uint8_t *map_va;
175175

@@ -478,7 +478,7 @@ static int elf_load_interp(elf_load_info_t *load_info)
478478
}
479479

480480
ret = elf_file_read(load_info->exec_info.fd, (rt_uint8_t *)load_info->interp_info.filename,
481-
phdr->p_filesz, phdr->p_offset);
481+
phdr->p_filesz, phdr->p_offset);
482482
if (ret != RT_EOK)
483483
{
484484
LOG_E("%s : elf_file_read failed, ret = %d", __func__, ret);
@@ -543,7 +543,7 @@ static int total_mapping_size(elf_info_t *elf_info)
543543
return -1;
544544

545545
elf_info->map_size = elf_info->phdr[last_idx].p_vaddr + elf_info->phdr[last_idx].p_memsz -
546-
ELF_PAGESTART(elf_info->phdr[first_idx].p_vaddr);
546+
ELF_PAGESTART(elf_info->phdr[first_idx].p_vaddr);
547547

548548
return 0;
549549
}
@@ -592,7 +592,7 @@ static rt_ubase_t elf_map(struct rt_lwp *lwp, const Elf_Phdr *elf_phdr, int fd,
592592
}
593593

594594
static int elf_zero_bss(struct rt_lwp *lwp, int fd, const Elf_Phdr *phdr, rt_ubase_t bss_start,
595-
rt_ubase_t bss_end)
595+
rt_ubase_t bss_end)
596596
{
597597
lwp_data_set(lwp, (void *)bss_start, 0, bss_end - bss_start);
598598

@@ -617,7 +617,7 @@ static int elf_zero_bss(struct rt_lwp *lwp, int fd, const Elf_Phdr *phdr, rt_uba
617617
* @return -ENOMEM if memory allocation fails.
618618
*/
619619
static int elf_file_mmap(elf_load_info_t *load_info, elf_info_t *elf_info, rt_ubase_t *elfload_addr,
620-
rt_uint32_t map_size, rt_ubase_t *load_base)
620+
rt_uint32_t map_size, rt_ubase_t *load_base)
621621
{
622622
int ret, i;
623623
rt_ubase_t map_va, bss_start, bss_end;
@@ -688,7 +688,7 @@ static int elf_file_mmap(elf_load_info_t *load_info, elf_info_t *elf_info, rt_ub
688688
{
689689
*elfload_addr = map_va + ELF_PAGEOFFSET(tmp_phdr->p_vaddr);
690690
LOG_D("%s elf_load_addr : %p, vAddr : %p, load_base : %p, map_va : %p", __func__,
691-
*elfload_addr, tmp_phdr->p_vaddr, *load_base, map_va);
691+
*elfload_addr, tmp_phdr->p_vaddr, *load_base, map_va);
692692
}
693693

694694
if ((*load_base == 0) && (ehdr->e_type == ET_DYN))
@@ -722,7 +722,7 @@ static int load_elf_interp(elf_load_info_t *load_info, rt_ubase_t *interp_base)
722722
LOG_D("%s : total_mapping_size 0x%x", __func__, load_info->interp_info.map_size);
723723

724724
return elf_file_mmap(load_info, &load_info->interp_info, interp_base,
725-
load_info->interp_info.map_size, &load_base);
725+
load_info->interp_info.map_size, &load_base);
726726
}
727727

728728
/**
@@ -783,7 +783,7 @@ static int elf_aux_fill(elf_load_info_t *load_info)
783783
ELF_AUX_ENT(aux_info, AT_SECURE, 0);
784784

785785
#ifdef RT_USING_VDSO
786-
if(RT_EOK == rt_vdso_map_process_image(load_info->lwp))
786+
if (RT_EOK == rt_vdso_map_process_image(load_info->lwp))
787787
{
788788
ELF_AUX_ENT(aux_info, AT_SYSINFO_EHDR, (size_t)load_info->lwp->vdso_vbase);
789789
}
@@ -834,7 +834,7 @@ static int elf_load_segment(elf_load_info_t *load_info)
834834

835835
/* Map the segments of the ELF file into memory */
836836
ret = elf_file_mmap(load_info, &load_info->exec_info, &load_info->load_addr,
837-
load_info->exec_info.map_size, &app_load_base);
837+
load_info->exec_info.map_size, &app_load_base);
838838
elf_file_close(load_info->exec_info.fd);
839839
if (ret != RT_EOK)
840840
{
@@ -1015,7 +1015,7 @@ static int elf_file_load(elf_load_info_t *load_info)
10151015
* @see dfs_normalize_path, elf_file_load
10161016
*/
10171017
int lwp_load(const char *filename, struct rt_lwp *lwp, uint8_t *load_addr, size_t addr_size,
1018-
struct process_aux *aux_ua)
1018+
struct process_aux *aux_ua)
10191019
{
10201020
elf_load_info_t load_info = { 0 };
10211021
int len;
@@ -1072,4 +1072,4 @@ int lwp_load(const char *filename, struct rt_lwp *lwp, uint8_t *load_addr, size_
10721072
return RT_EOK;
10731073
}
10741074

1075-
#endif
1075+
#endif

components/lwp/vdso/kernel/vdso_kernel.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ extern "C" {
2222
extern char __rt_vdso_image_start[];
2323
extern char __rt_vdso_image_end[];
2424

25-
#define RT_VDSO_IMAGE_ELF_MAGIC "\177ELF"
25+
#define RT_VDSO_IMAGE_ELF_MAGIC "\177ELF"
2626
#define RT_VDSO_IMAGE_ELF_MAGIC_LEN 4
27-
#define RT_VDSO_DATA_PAGE_ALIGNED \
27+
#define RT_VDSO_DATA_PAGE_ALIGNED \
2828
__attribute__((section(".data.vdso.datapage"))) \
2929
__attribute__((aligned(RT_VDSO_PAGE_SIZE)))
3030

components/lwp/vdso/kernel/vdso_kernel_internal.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,18 @@ extern "C" {
2020

2121
extern struct rt_vdso_data_page *rt_vdso_kernel_data_page;
2222

23-
rt_inline
24-
struct rt_vdso_data_page *rt_vdso_get_kernel_data_page(void)
23+
rt_inline struct rt_vdso_data_page *rt_vdso_get_kernel_data_page(void)
2524
{
2625
return rt_vdso_kernel_data_page;
2726
}
2827

29-
rt_inline
30-
void rt_vdso_data_page_write_begin(struct rt_vdso_data_page *data_page)
28+
rt_inline void rt_vdso_data_page_write_begin(struct rt_vdso_data_page *data_page)
3129
{
3230
rt_atomic_add(&data_page->seq_counter, 1);
3331
rt_hw_dmb();
3432
}
3533

36-
rt_inline
37-
void rt_vdso_data_page_write_end(struct rt_vdso_data_page *data_page)
34+
rt_inline void rt_vdso_data_page_write_end(struct rt_vdso_data_page *data_page)
3835
{
3936
rt_hw_dmb();
4037
rt_atomic_add(&data_page->seq_counter, 1);

components/lwp/vdso/user/arch/aarch64/vdso_arch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#define RT_STRINGIFY(x...) __RT_STRINGIFY(x)
88

99
#define rt_vdso_arch_barrier(cmd, ...) \
10-
__asm__ volatile(RT_STRINGIFY(cmd) " " RT_STRINGIFY(__VA_ARGS__) ::: "memory")
10+
__asm__ volatile(RT_STRINGIFY(cmd) " " RT_STRINGIFY(__VA_ARGS__)::: "memory")
1111

1212
static inline uint64_t rt_vdso_arch_read_counter(void)
1313
{

components/lwp/vdso/user/arch/risc-v/vdso_arch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#define RT_STRINGIFY(x...) __RT_STRINGIFY(x)
1818

1919
#define rt_vdso_arch_barrier(cmd, ...) \
20-
__asm__ volatile(RT_STRINGIFY(cmd) " " RT_STRINGIFY(__VA_ARGS__) ::: "memory")
20+
__asm__ volatile(RT_STRINGIFY(cmd) " " RT_STRINGIFY(__VA_ARGS__)::: "memory")
2121

2222
static inline uint64_t rt_vdso_arch_read_counter(void)
2323
{

components/lwp/vdso/user/common/vdso_user_internal.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ static inline void rt_vdso_read_once_size(const volatile void *ptr, void *dst, i
5151
}
5252
}
5353

54-
#define READ_ONCE(x) \
55-
({ \
56-
union \
57-
{ \
58-
typeof(x) value; \
59-
char bytes[sizeof(x)]; \
60-
} once; \
61-
rt_vdso_read_once_size(&(x), once.bytes, sizeof(x)); \
62-
once.value; \
54+
#define READ_ONCE(x) \
55+
({ \
56+
union \
57+
{ \
58+
typeof(x) value; \
59+
char bytes[sizeof(x)]; \
60+
} once; \
61+
rt_vdso_read_once_size(&(x), once.bytes, sizeof(x)); \
62+
once.value; \
6363
})
6464

6565
extern const struct rt_vdso_data_page __rt_vdso_data_page[] __attribute__((visibility("hidden")));
@@ -83,7 +83,7 @@ static inline uint32_t rt_vdso_data_read_begin(const struct rt_vdso_data_page *d
8383
}
8484

8585
static inline uint32_t rt_vdso_data_read_retry(const struct rt_vdso_data_page *data_page,
86-
uint32_t start)
86+
uint32_t start)
8787
{
8888
rt_vdso_arch_rmb();
8989
return READ_ONCE(data_page->seq_counter) != start;

components/lwp/vdso/vdso_constants.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ extern "C" {
2020
#define RT_VDSO_PAGE_SIZE (1 << RT_VDSO_PAGE_SHIFT)
2121

2222
#ifndef read_barrier_depends
23-
#define read_barrier_depends() do { } while (0)
23+
#define read_barrier_depends() \
24+
do \
25+
{ \
26+
} while (0)
2427
#endif
2528

2629
#ifndef smp_read_barrier_depends
27-
#define smp_read_barrier_depends() read_barrier_depends()
30+
#define smp_read_barrier_depends() read_barrier_depends()
2831
#endif
2932

3033
#if defined(__aarch64__)

components/lwp/vdso/vdso_data_page.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ enum rt_vdso_clock_data_index
3232

3333
struct rt_vdso_data_page
3434
{
35-
uint32_t seq_counter;
36-
uint32_t flags;
37-
uint64_t counter_last;
38-
uint64_t counter_freq;
35+
uint32_t seq_counter;
36+
uint32_t flags;
37+
uint64_t counter_last;
38+
uint64_t counter_freq;
3939
struct timespec base_time[RT_VDSO_CLOCK_DATA_COUNT];
4040
};
4141

src/clock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ rt_weak rt_tick_t rt_tick_get_millisecond(void)
252252
#if 1000 % RT_TICK_PER_SECOND == 0u
253253
return rt_tick_get() * (1000u / RT_TICK_PER_SECOND);
254254
#else
255-
#warning "rt-thread cannot provide a correct 1ms-based tick any longer,\
255+
#warning "rt-thread cannot provide a correct 1ms-based tick any longer,\
256256
please redefine this function in another file by using a high-precision hard-timer."
257257
return 0;
258258
#endif /* 1000 % RT_TICK_PER_SECOND == 0u */

0 commit comments

Comments
 (0)