diff options
author | Damjan Marion <damarion@cisco.com> | 2020-10-17 13:32:25 +0200 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2020-10-17 21:01:42 +0000 |
commit | dae1c7ed38e9f7a86e66f3674de62778cc981331 (patch) | |
tree | c84fd7a94e1249233d5533e15d54bef52582ee4c | |
parent | ada5bbf3303e8fb6f53ff39e6074ae820457224d (diff) |
vppinfra: explicitly export symbols
Type: improvement
Change-Id: I57a9f85f7df1fc48656b72592349f4c544302f77
Signed-off-by: Damjan Marion <damarion@cisco.com>
40 files changed, 229 insertions, 225 deletions
diff --git a/src/vppinfra/CMakeLists.txt b/src/vppinfra/CMakeLists.txt index 3d54be2307f..de880624bb3 100644 --- a/src/vppinfra/CMakeLists.txt +++ b/src/vppinfra/CMakeLists.txt @@ -36,6 +36,8 @@ install( COMPONENT vpp-dev ) +add_definitions(-fvisibility=hidden) + ############################################################################## # vppinfra sources ############################################################################## diff --git a/src/vppinfra/backtrace.c b/src/vppinfra/backtrace.c index ca7591c5168..e713bae6876 100644 --- a/src/vppinfra/backtrace.c +++ b/src/vppinfra/backtrace.c @@ -45,7 +45,7 @@ #include <vppinfra/asm_mips.h> -uword +__clib_export uword clib_backtrace (uword * callers, uword max_callers, uword n_frames_to_skip) { u32 *pc; @@ -222,7 +222,7 @@ backtrace_done: /* use glibc backtrace for stack trace */ #include <execinfo.h> -uword +__clib_export uword clib_backtrace (uword * callers, uword max_callers, uword n_frames_to_skip) { int size; diff --git a/src/vppinfra/bihash_all_vector.c b/src/vppinfra/bihash_all_vector.c index 35355b54062..04c13745402 100644 --- a/src/vppinfra/bihash_all_vector.c +++ b/src/vppinfra/bihash_all_vector.c @@ -16,10 +16,10 @@ #include <vppinfra/mem.h> /* Vector of all bihashes */ -void **clib_all_bihashes; +__clib_export void **clib_all_bihashes; static clib_mem_heap_t *clib_all_bihash_heap; -clib_mem_heap_t * +__clib_export clib_mem_heap_t * clib_all_bihash_set_heap (void) { if (PREDICT_FALSE (clib_all_bihash_heap == 0)) @@ -32,7 +32,7 @@ clib_all_bihash_set_heap (void) * Leave it to Beaver to change the size of a bihash * by making a clone in a stack local and then copying it... */ -void +__clib_export void clib_bihash_copied (void *dst, void *src) { int i; diff --git a/src/vppinfra/clib.h b/src/vppinfra/clib.h index 6c82f869653..9474350c6da 100644 --- a/src/vppinfra/clib.h +++ b/src/vppinfra/clib.h @@ -100,6 +100,7 @@ #define __clib_aligned(x) __attribute__ ((aligned(x))) #define __clib_section(s) __attribute__ ((section(s))) #define __clib_warn_unused_result __attribute__ ((warn_unused_result)) +#define __clib_export __attribute__ ((visibility("default"))) #define never_inline __attribute__ ((__noinline__)) diff --git a/src/vppinfra/cpu.c b/src/vppinfra/cpu.c index 5ad8c2001eb..4631eb3b896 100644 --- a/src/vppinfra/cpu.c +++ b/src/vppinfra/cpu.c @@ -82,7 +82,7 @@ _(0x43, 0x0b1, "Marvell", "OCTEON TX2 CN98XX", 1) \ _(0x43, 0x0b2, "Marvell", "OCTEON TX2 CN96XX", 1) -u8 * +__clib_export u8 * format_cpu_uarch (u8 * s, va_list * args) { #if __x86_64__ @@ -146,7 +146,7 @@ format(s, "[0x%x] %s ([0x%02x] %s) stepping 0x%x", f, a, m, c, stepping); #endif } -u8 * +__clib_export u8 * format_cpu_model_name (u8 * s, va_list * args) { #if __x86_64__ @@ -202,7 +202,7 @@ flag_skip_prefix (char const *flag, const char *pfx, int len) return flag; } -u8 * +__clib_export u8 * format_cpu_flags (u8 * s, va_list * args) { #if defined(__x86_64__) diff --git a/src/vppinfra/dlmalloc.c b/src/vppinfra/dlmalloc.c index e01ac94b8c0..7c4664bf8fd 100644 --- a/src/vppinfra/dlmalloc.c +++ b/src/vppinfra/dlmalloc.c @@ -4118,7 +4118,7 @@ void mspace_get_address_and_size (mspace msp, char **addrp, size_t *sizep) *sizep = this_seg->size; } -CLIB_NOSANITIZE_ADDR +CLIB_NOSANITIZE_ADDR __clib_export int mspace_is_heap_object (mspace msp, void *p) { msegment *this_seg; @@ -4185,7 +4185,7 @@ int mspace_is_traced (mspace msp) return 0; } -CLIB_NOSANITIZE_ADDR +CLIB_NOSANITIZE_ADDR __clib_export void* mspace_get_aligned (mspace msp, unsigned long n_user_data_bytes, unsigned long align, @@ -4286,7 +4286,7 @@ void* mspace_get_aligned (mspace msp, return (void *) searchp; } -CLIB_NOSANITIZE_ADDR +CLIB_NOSANITIZE_ADDR __clib_export void mspace_put (mspace msp, void *p_arg) { char *object_header; @@ -4336,7 +4336,7 @@ void mspace_put_no_offset (mspace msp, void *p_arg) mspace_free (msp, p_arg); } -CLIB_NOSANITIZE_ADDR +CLIB_NOSANITIZE_ADDR __clib_export size_t mspace_usable_size_with_delta (const void *p) { size_t usable_size; diff --git a/src/vppinfra/elf.c b/src/vppinfra/elf.c index 0b8aaa5d003..e32d989a602 100644 --- a/src/vppinfra/elf.c +++ b/src/vppinfra/elf.c @@ -43,7 +43,7 @@ elf_swap_verneed_aux (elf_dynamic_version_need_aux_t * n) #undef _ } -clib_error_t * +__clib_export clib_error_t * elf_get_section_by_name (elf_main_t * em, char *section_name, elf_section_t ** result) { @@ -1325,7 +1325,7 @@ elf_parse_dynamic (elf_main_t * em) #include <sys/stat.h> #include <fcntl.h> -clib_error_t * +__clib_export clib_error_t * elf_read_file (elf_main_t * em, char *file_name) { int fd; diff --git a/src/vppinfra/elf_clib.c b/src/vppinfra/elf_clib.c index ea63a160973..b76c264e239 100644 --- a/src/vppinfra/elf_clib.c +++ b/src/vppinfra/elf_clib.c @@ -259,7 +259,7 @@ add_section (struct dl_phdr_info *info, size_t size, void *opaque) static clib_elf_main_t clib_elf_main; -void +__clib_export void clib_elf_main_init (char *exec_path) { clib_elf_main_t *cem = &clib_elf_main; @@ -351,7 +351,7 @@ format_clib_elf_symbol (u8 * s, va_list * args) } } -u8 * +__clib_export u8 * format_clib_elf_symbol_with_address (u8 * s, va_list * args) { uword address = va_arg (*args, uword); diff --git a/src/vppinfra/elog.c b/src/vppinfra/elog.c index b3b2fa9a25d..ceade6803ca 100644 --- a/src/vppinfra/elog.c +++ b/src/vppinfra/elog.c @@ -61,7 +61,7 @@ elog_unlock (elog_main_t * em) } /* Non-inline version. */ -void * +__clib_export void * elog_event_data (elog_main_t * em, elog_event_type_t * type, elog_track_t * track, u64 cpu_time) { @@ -194,7 +194,7 @@ elog_event_type_register (elog_main_t * em, elog_event_type_t * t) return l; } -word +__clib_export word elog_track_register (elog_main_t * em, elog_track_t * t) { word l; @@ -292,7 +292,7 @@ done: return s; } -u8 * +__clib_export u8 * format_elog_event (u8 * s, va_list * va) { elog_main_t *em = va_arg (*va, elog_main_t *); @@ -404,7 +404,7 @@ format_elog_track_name (u8 * s, va_list * va) return format (s, "%s", t->name); } -u8 * +__clib_export u8 * format_elog_track (u8 * s, va_list * args) { elog_main_t *em = va_arg (*args, elog_main_t *); @@ -484,7 +484,7 @@ elog_nsec_per_clock (elog_main_t * em) &em->init_time)); } -void +__clib_export void elog_alloc (elog_main_t * em, u32 n_events) { if (em->event_ring) @@ -498,7 +498,7 @@ elog_alloc (elog_main_t * em, u32 n_events) vec_resize_aligned (em->event_ring, n_events, CLIB_CACHE_LINE_BYTES); } -void +__clib_export void elog_init (elog_main_t * em, u32 n_events) { clib_memset (em, 0, sizeof (em[0])); @@ -542,7 +542,7 @@ elog_event_range (elog_main_t * em, uword * lo) } } -elog_event_t * +__clib_export elog_event_t * elog_peek_events (elog_main_t * em) { elog_event_t *e, *f, *es = 0; @@ -567,7 +567,7 @@ elog_peek_events (elog_main_t * em) } /* Add a formatted string to the string table. */ -u32 +__clib_export u32 elog_string (elog_main_t * em, char *fmt, ...) { u32 offset; @@ -1098,7 +1098,7 @@ unserialize_elog_time_stamp (serialize_main_t * m, va_list * va) static char *elog_serialize_magic = "elog v0"; -void +__clib_export void serialize_elog_main (serialize_main_t * m, va_list * va) { elog_main_t *em = va_arg (*va, elog_main_t *); diff --git a/src/vppinfra/error.c b/src/vppinfra/error.c index 2722fb7be7e..a00e8dbd21a 100644 --- a/src/vppinfra/error.c +++ b/src/vppinfra/error.c @@ -71,7 +71,7 @@ typedef struct static clib_error_handler_t *handlers = 0; -void +__clib_export void clib_error_register_handler (clib_error_handler_func_t func, void *arg) { clib_error_handler_t h = {.func = func,.arg = arg, }; @@ -108,7 +108,7 @@ dispatch_message (u8 * msg) return msg; } -void +__clib_export void _clib_error (int how_to_die, char *function_name, uword line_number, char *fmt, ...) { @@ -145,7 +145,7 @@ _clib_error (int how_to_die, error_exit (1); } -clib_error_t * +__clib_export clib_error_t * _clib_error_return (clib_error_t * errors, any code, uword flags, char *where, char *fmt, ...) { @@ -178,7 +178,7 @@ _clib_error_return (clib_error_t * errors, return errors; } -void * +__clib_export void * clib_error_free_vector (clib_error_t * errors) { clib_error_t *e; @@ -187,7 +187,7 @@ clib_error_free_vector (clib_error_t * errors) return 0; } -u8 * +__clib_export u8 * format_clib_error (u8 * s, va_list * va) { clib_error_t *errors = va_arg (*va, clib_error_t *); @@ -216,7 +216,7 @@ format_clib_error (u8 * s, va_list * va) return s; } -clib_error_t * +__clib_export clib_error_t * _clib_error_report (clib_error_t * errors) { if (errors) diff --git a/src/vppinfra/fifo.c b/src/vppinfra/fifo.c index e97b2c3ee00..52d65ae1f37 100644 --- a/src/vppinfra/fifo.c +++ b/src/vppinfra/fifo.c @@ -76,7 +76,7 @@ fifo_free (f) frees fifo. */ -void * +__clib_export void * _clib_fifo_resize (void *v_old, uword n_new_elts, uword elt_bytes) { void *v_new, *end, *head; diff --git a/src/vppinfra/format.c b/src/vppinfra/format.c index cb6cb455eaa..b67553c6f2d 100644 --- a/src/vppinfra/format.c +++ b/src/vppinfra/format.c @@ -383,7 +383,7 @@ done: return f; } -u8 * +__clib_export u8 * va_format (u8 * s, const char *fmt, va_list * va) { const u8 *f = (u8 *) fmt, *g; @@ -420,7 +420,7 @@ va_format (u8 * s, const char *fmt, va_list * va) return s; } -u8 * +__clib_export u8 * format (u8 * s, const char *fmt, ...) { va_list va; @@ -434,7 +434,7 @@ format (u8 * s, const char *fmt, ...) return s; } -word +__clib_export word va_fformat (FILE * f, char *fmt, va_list * va) { word ret; @@ -458,7 +458,7 @@ va_fformat (FILE * f, char *fmt, va_list * va) return ret; } -word +__clib_export word fformat (FILE * f, char *fmt, ...) { va_list va; @@ -472,7 +472,7 @@ fformat (FILE * f, char *fmt, ...) } #ifdef CLIB_UNIX -void +__clib_export void fformat_append_cr (FILE * ofp, const char *fmt, ...) { va_list va; @@ -483,7 +483,7 @@ fformat_append_cr (FILE * ofp, const char *fmt, ...) fformat (ofp, "\n"); } -word +__clib_export word fdformat (int fd, char *fmt, ...) { word ret; diff --git a/src/vppinfra/format.h b/src/vppinfra/format.h index 470070d8861..6e958e2cce8 100644 --- a/src/vppinfra/format.h +++ b/src/vppinfra/format.h @@ -87,7 +87,7 @@ format_get_indent (u8 * s) return indent; } -#define _(f) u8 * f (u8 * s, va_list * va) +#define _(f) __clib_export u8 * f (u8 * s, va_list * va) /* Standard user-defined formats. */ _(format_vec32); diff --git a/src/vppinfra/hash.c b/src/vppinfra/hash.c index 6115b0cffd6..220c16989de 100644 --- a/src/vppinfra/hash.c +++ b/src/vppinfra/hash.c @@ -271,7 +271,7 @@ hash_memory32 (void *p, word n_bytes, u32 state) } #endif -uword +__clib_export uword hash_memory (void *p, word n_bytes, uword state) { uword *q = p; @@ -628,7 +628,7 @@ lookup (void *v, uword key, enum lookup_opcode op, } /* Fetch value of key. */ -uword * +__clib_export uword * _hash_get (void *v, uword key) { hash_t *h = hash_header (v); @@ -647,7 +647,7 @@ _hash_get (void *v, uword key) return &p->value[0]; } -hash_pair_t * +__clib_export hash_pair_t * _hash_get_pair (void *v, uword key) { return lookup (v, key, GET, 0, 0); @@ -707,7 +707,7 @@ hash_next (void *v, hash_next_t * hn) } /* Remove key from table. */ -void * +__clib_export void * _hash_unset (void *v, uword key, void *old_value) { hash_t *h; @@ -728,7 +728,7 @@ _hash_unset (void *v, uword key, void *old_value) return v; } -void * +__clib_export void * _hash_create (uword elts, hash_t * h_user) { hash_t *h; @@ -774,7 +774,7 @@ _hash_create (uword elts, hash_t * h_user) return v; } -void * +__clib_export void * _hash_free (void *v) { hash_t *h = hash_header (v); @@ -830,13 +830,13 @@ hash_resize (void *old, uword new_size) return hash_resize_internal (old, new_size, 1); } -void * +__clib_export void * hash_dup (void *old) { return hash_resize_internal (old, vec_len (old), 0); } -void * +__clib_export void * _hash_set3 (void *v, uword key, void *value, void *old_value) { hash_t *h; @@ -857,14 +857,14 @@ _hash_set3 (void *v, uword key, void *value, void *old_value) return v; } -uword +__clib_export uword vec_key_sum (hash_t * h, uword key) { void *v = uword_to_pointer (key, void *); return hash_memory (v, vec_len (v) * h->user, 0); } -uword +__clib_export uword vec_key_equal (hash_t * h, uword key1, uword key2) { void *v1 = uword_to_pointer (key1, void *); @@ -874,7 +874,7 @@ vec_key_equal (hash_t * h, uword key1, uword key2) return l1 == l2 && 0 == memcmp (v1, v2, l1 * h->user); } -u8 * +__clib_export u8 * vec_key_format_pair (u8 * s, va_list * args) { void *CLIB_UNUSED (user_arg) = va_arg (*args, void *); @@ -925,14 +925,14 @@ vec_key_format_pair (u8 * s, va_list * args) return s; } -uword +__clib_export uword mem_key_sum (hash_t * h, uword key) { uword *v = uword_to_pointer (key, void *); return hash_memory (v, h->user, 0); } -uword +__clib_export uword mem_key_equal (hash_t * h, uword key1, uword key2) { void *v1 = uword_to_pointer (key1, void *); @@ -990,7 +990,7 @@ hash_format_pair_default (u8 * s, va_list * args) return s; } -uword +__clib_export uword hash_bytes (void *v) { uword i, bytes; @@ -1098,13 +1098,13 @@ unformat_hash_string_internal (unformat_input_t * input, return p ? 1 : 0; } -uword +__clib_export uword unformat_hash_vec_string (unformat_input_t * input, va_list * va) { return unformat_hash_string_internal (input, va, /* is_vec */ 1); } -uword +__clib_export uword unformat_hash_string (unformat_input_t * input, va_list * va) { return unformat_hash_string_internal (input, va, /* is_vec */ 0); diff --git a/src/vppinfra/heap.c b/src/vppinfra/heap.c index e91dc64f568..b81e1e1339e 100644 --- a/src/vppinfra/heap.c +++ b/src/vppinfra/heap.c @@ -382,7 +382,7 @@ dealloc_elt (void *v, heap_elt_t * e) combine_free_blocks (v, p, n); } -void * +__clib_export void * _heap_alloc (void *v, uword size, uword align, @@ -496,7 +496,7 @@ error: return v; } -void +__clib_export void heap_dealloc (void *v, uword handle) { heap_header_t *h = heap_header (v); @@ -607,7 +607,7 @@ heap_len (void *v, word handle) return heap_elt_size (v, elt_at (h, handle)); } -void * +__clib_export void * _heap_free (void *v) { heap_header_t *h = heap_header (v); diff --git a/src/vppinfra/linux/mem.c b/src/vppinfra/linux/mem.c index f31b456308d..b46988f2172 100644 --- a/src/vppinfra/linux/mem.c +++ b/src/vppinfra/linux/mem.c @@ -62,7 +62,7 @@ #define MAP_FIXED_NOREPLACE 0x100000 #endif -uword +__clib_export uword clib_mem_get_default_hugepage_size (void) { unformat_input_t input; @@ -163,7 +163,7 @@ done: munmap (va, page_size); } -u64 +__clib_export u64 clib_mem_get_fd_page_size (int fd) { struct stat st = { 0 }; @@ -172,14 +172,14 @@ clib_mem_get_fd_page_size (int fd) return st.st_blksize; } -clib_mem_page_sz_t +__clib_export clib_mem_page_sz_t clib_mem_get_fd_log2_page_size (int fd) { uword page_size = clib_mem_get_fd_page_size (fd); return page_size ? min_log2 (page_size) : CLIB_MEM_PAGE_SZ_UNKNOWN; } -void +__clib_export void clib_mem_vm_randomize_va (uword * requested_va, clib_mem_page_sz_t log2_page_size) { @@ -246,7 +246,7 @@ legacy_memfd_create (u8 * name) return fd; } -int +__clib_export int clib_mem_vm_create_fd (clib_mem_page_sz_t log2_page_size, char *fmt, ...) { clib_mem_main_t *mm = &clib_mem_main; @@ -370,7 +370,7 @@ clib_mem_vm_reserve (uword start, uword size, clib_mem_page_sz_t log2_page_sz) return (uword) base + sys_page_sz; } -clib_mem_vm_map_hdr_t * +__clib_export clib_mem_vm_map_hdr_t * clib_mem_vm_get_next_map_hdr (clib_mem_vm_map_hdr_t * hdr) { clib_mem_main_t *mm = &clib_mem_main; @@ -488,7 +488,7 @@ clib_mem_vm_map_internal (void *base, clib_mem_page_sz_t log2_page_sz, return base; } -int +__clib_export int clib_mem_vm_unmap (void *base) { clib_mem_main_t *mm = &clib_mem_main; @@ -526,7 +526,7 @@ clib_mem_vm_unmap (void *base) return 0; } -void +__clib_export void clib_mem_get_page_stats (void *start, clib_mem_page_sz_t log2_page_size, uword n_pages, clib_mem_page_stats_t * stats) { @@ -566,7 +566,7 @@ clib_mem_get_page_stats (void *start, clib_mem_page_sz_t log2_page_size, } -u64 * +__clib_export u64 * clib_mem_vm_get_paddr (void *mem, clib_mem_page_sz_t log2_page_size, int n_pages) { @@ -608,7 +608,7 @@ done: return r; } -int +__clib_export int clib_mem_set_numa_affinity (u8 numa_node, int force) { clib_mem_main_t *mm = &clib_mem_main; @@ -643,7 +643,7 @@ error: return CLIB_MEM_ERROR; } -int +__clib_export int clib_mem_set_default_numa_affinity () { clib_mem_main_t *mm = &clib_mem_main; diff --git a/src/vppinfra/linux/sysfs.c b/src/vppinfra/linux/sysfs.c index c45897fc83b..1157e4fe655 100644 --- a/src/vppinfra/linux/sysfs.c +++ b/src/vppinfra/linux/sysfs.c @@ -22,7 +22,7 @@ #include <fcntl.h> #include <dirent.h> -clib_error_t * +__clib_export clib_error_t * clib_sysfs_write (char *file_name, char *fmt, ...) { u8 *s; @@ -46,7 +46,7 @@ clib_sysfs_write (char *file_name, char *fmt, ...) return error; } -clib_error_t * +__clib_export clib_error_t * clib_sysfs_read (char *file_name, char *fmt, ...) { unformat_input_t input; @@ -86,7 +86,7 @@ clib_sysfs_read (char *file_name, char *fmt, ...) return 0; } -u8 * +__clib_export u8 * clib_sysfs_link_to_name (char *link) { char *p, buffer[64]; diff --git a/src/vppinfra/macros.c b/src/vppinfra/macros.c index 240cef02e0e..f34b7afc173 100644 --- a/src/vppinfra/macros.c +++ b/src/vppinfra/macros.c @@ -40,7 +40,7 @@ builtin_eval (clib_macro_main_t * mm, i8 * varname, i32 complain) return (*fp) (mm, complain); } -int +__clib_export int clib_macro_unset (clib_macro_main_t * mm, char *name) { hash_pair_t *p; @@ -60,7 +60,7 @@ clib_macro_unset (clib_macro_main_t * mm, char *name) return 0; } -int +__clib_export int clib_macro_set_value (clib_macro_main_t * mm, char *name, char *value) { u8 *key_copy, *value_copy; @@ -91,7 +91,7 @@ clib_macro_get_value (clib_macro_main_t * mm, char *name) * eval: takes a string, returns a vector. * looks up $foobar in the variable table. */ -i8 * +__clib_export i8 * clib_macro_eval (clib_macro_main_t * mm, i8 * s, i32 complain, u16 level, u16 max_level) { @@ -209,7 +209,7 @@ clib_macro_eval_dollar (clib_macro_main_t * mm, i8 * s, i32 complain) return (rv); } -void +__clib_export void clib_macro_add_builtin (clib_macro_main_t * mm, char *name, void *eval_fn) { hash_set_mem (mm->the_builtin_eval_hash, name, (uword) eval_fn); @@ -226,7 +226,7 @@ eval_hostname (clib_macro_main_t * mm, i32 complain) } #endif -void +__clib_export void clib_macro_init (clib_macro_main_t * mm) { if (mm->the_builtin_eval_hash != 0) @@ -243,7 +243,7 @@ clib_macro_init (clib_macro_main_t * mm) #endif } -void +__clib_export void clib_macro_free (clib_macro_main_t * mm) { hash_pair_t *p; @@ -282,7 +282,7 @@ name_compare (void *a1, void *a2) } -u8 * +__clib_export u8 * format_clib_macro_main (u8 * s, va_list * args) { clib_macro_main_t *mm = va_arg (*args, clib_macro_main_t *); diff --git a/src/vppinfra/mem.c b/src/vppinfra/mem.c index 1f8b6bfe618..99e4c1d74a0 100644 --- a/src/vppinfra/mem.c +++ b/src/vppinfra/mem.c @@ -19,9 +19,9 @@ #include <vppinfra/format.h> #include <vppinfra/clib_error.h> -clib_mem_main_t clib_mem_main; +__clib_export clib_mem_main_t clib_mem_main; -void * +__clib_export void * clib_mem_vm_map (void *base, uword size, clib_mem_page_sz_t log2_page_sz, char *fmt, ...) { @@ -38,7 +38,7 @@ clib_mem_vm_map (void *base, uword size, clib_mem_page_sz_t log2_page_sz, return rv; } -void * +__clib_export void * clib_mem_vm_map_stack (uword size, clib_mem_page_sz_t log2_page_sz, char *fmt, ...) { @@ -55,7 +55,7 @@ clib_mem_vm_map_stack (uword size, clib_mem_page_sz_t log2_page_sz, return rv; } -void * +__clib_export void * clib_mem_vm_map_shared (void *base, uword size, int fd, uword offset, char *fmt, ...) { diff --git a/src/vppinfra/mem_dlmalloc.c b/src/vppinfra/mem_dlmalloc.c index a0bd1d09da2..df1489fd8d8 100644 --- a/src/vppinfra/mem_dlmalloc.c +++ b/src/vppinfra/mem_dlmalloc.c @@ -260,28 +260,28 @@ clib_mem_init_internal (void *base, uword size, return h; } -void * +__clib_export void * clib_mem_init (void *memory, uword memory_size) { return clib_mem_init_internal (memory, memory_size, CLIB_MEM_PAGE_SZ_DEFAULT); } -void * +__clib_export void * clib_mem_init_with_page_size (uword memory_size, clib_mem_page_sz_t log2_page_sz) { return clib_mem_init_internal (0, memory_size, log2_page_sz); } -void * +__clib_export void * clib_mem_init_thread_safe (void *memory, uword memory_size) { return clib_mem_init_internal (memory, memory_size, CLIB_MEM_PAGE_SZ_DEFAULT); } -void +__clib_export void clib_mem_destroy (void) { mheap_trace_main_t *tm = &mheap_trace_main; @@ -416,7 +416,7 @@ format_mheap_trace (u8 * s, va_list * va) return s; } -u8 * +__clib_export u8 * format_clib_mem_heap (u8 * s, va_list * va) { clib_mem_heap_t *heap = va_arg (*va, clib_mem_heap_t *); @@ -467,7 +467,7 @@ format_clib_mem_heap (u8 * s, va_list * va) return s; } -void +__clib_export void clib_mem_get_heap_usage (clib_mem_heap_t * heap, clib_mem_usage_t * usage) { struct dlmallinfo mi = mspace_mallinfo (heap->mspace); @@ -485,7 +485,7 @@ clib_mem_get_heap_usage (clib_mem_heap_t * heap, clib_mem_usage_t * usage) /* Call serial number for debugger breakpoints. */ uword clib_mem_validate_serial = 0; -void +__clib_export void mheap_trace (clib_mem_heap_t * h, int enable) { (void) mspace_enable_disable_trace (h->mspace, enable); @@ -494,7 +494,7 @@ mheap_trace (clib_mem_heap_t * h, int enable) mheap_trace_main_free (&mheap_trace_main); } -void +__clib_export void clib_mem_trace (int enable) { mheap_trace_main_t *tm = &mheap_trace_main; @@ -516,7 +516,7 @@ clib_mem_is_traced (void) return mspace_is_traced (h->mspace); } -uword +__clib_export uword clib_mem_trace_enable_disable (uword enable) { uword rv; @@ -527,7 +527,7 @@ clib_mem_trace_enable_disable (uword enable) return rv; } -clib_mem_heap_t * +__clib_export clib_mem_heap_t * clib_mem_create_heap (void *base, uword size, int is_locked, char *fmt, ...) { clib_mem_page_sz_t log2_page_sz = clib_mem_get_log2_page_size (); @@ -557,7 +557,7 @@ clib_mem_create_heap (void *base, uword size, int is_locked, char *fmt, ...) return h; } -void +__clib_export void clib_mem_destroy_heap (clib_mem_heap_t * h) { mheap_trace_main_t *tm = &mheap_trace_main; @@ -570,20 +570,20 @@ clib_mem_destroy_heap (clib_mem_heap_t * h) clib_mem_vm_unmap (h->base); } -uword +__clib_export uword clib_mem_get_heap_free_space (clib_mem_heap_t * h) { struct dlmallinfo dlminfo = mspace_mallinfo (h->mspace); return dlminfo.fordblks; } -void * +__clib_export void * clib_mem_get_heap_base (clib_mem_heap_t * h) { return h->base; } -uword +__clib_export uword clib_mem_get_heap_size (clib_mem_heap_t * heap) { return heap->size; diff --git a/src/vppinfra/mhash.c b/src/vppinfra/mhash.c index 791aa36024b..c556312e64f 100644 --- a/src/vppinfra/mhash.c +++ b/src/vppinfra/mhash.c @@ -164,7 +164,7 @@ mhash_sanitize_hash_user (mhash_t * mh) h->user = pointer_to_uword (mh); } -void +__clib_export void mhash_init (mhash_t * h, uword n_value_bytes, uword n_key_bytes) { static struct @@ -243,7 +243,7 @@ mhash_set_tmp_key (mhash_t * h, const void *key) return ~0; } -hash_pair_t * +__clib_export hash_pair_t * mhash_get_pair (mhash_t * h, const void *key) { uword ikey; @@ -260,7 +260,7 @@ typedef struct vec_header_t vec; } mhash_string_key_t; -uword +__clib_export uword mhash_set_mem (mhash_t * h, void *key, uword * new_value, uword * old_value) { u8 *k; @@ -342,7 +342,7 @@ mhash_set_mem (mhash_t * h, void *key, uword * new_value, uword * old_value) return ikey; } -uword +__clib_export uword mhash_unset (mhash_t * h, void *key, uword * old_value) { hash_pair_t *p; diff --git a/src/vppinfra/mpcap.c b/src/vppinfra/mpcap.c index 3ad67a9ac56..8389a7fd2d7 100644 --- a/src/vppinfra/mpcap.c +++ b/src/vppinfra/mpcap.c @@ -52,7 +52,7 @@ * @return rc - clib_error_t * */ -clib_error_t * +__clib_export clib_error_t * mpcap_close (mpcap_main_t * pm) { u64 actual_size = pm->current_va - pm->file_baseva; @@ -81,7 +81,7 @@ mpcap_close (mpcap_main_t * pm) * @return rc - clib_error_t * */ -clib_error_t * +__clib_export clib_error_t * mpcap_init (mpcap_main_t * pm) { mpcap_file_header_t *fh; diff --git a/src/vppinfra/pcap.c b/src/vppinfra/pcap.c index 0ca923e81cf..4f8b6bb429c 100644 --- a/src/vppinfra/pcap.c +++ b/src/vppinfra/pcap.c @@ -70,7 +70,7 @@ * @return rc - clib_error_t * */ -clib_error_t * +__clib_export clib_error_t * pcap_close (pcap_main_t * pm) { close (pm->file_descriptor); @@ -85,7 +85,7 @@ pcap_close (pcap_main_t * pm) * @return rc - clib_error_t * */ -clib_error_t * +__clib_export clib_error_t * pcap_write (pcap_main_t * pm) { clib_error_t *error = 0; @@ -172,7 +172,7 @@ done: * @return rc - clib_error_t * */ -clib_error_t * +__clib_export clib_error_t * pcap_read (pcap_main_t * pm) { clib_error_t *error = 0; diff --git a/src/vppinfra/pmalloc.c b/src/vppinfra/pmalloc.c index cb6c7e3ba3b..b92dbf35d92 100644 --- a/src/vppinfra/pmalloc.c +++ b/src/vppinfra/pmalloc.c @@ -60,7 +60,7 @@ pmalloc_validate_numa_node (u32 * numa_node) return 0; } -int +__clib_export int clib_pmalloc_init (clib_pmalloc_main_t * pm, uword base_addr, uword size) { uword base, pagesize; @@ -382,7 +382,7 @@ error: return 0; } -void * +__clib_export void * clib_pmalloc_create_shared_arena (clib_pmalloc_main_t * pm, char *name, uword size, u32 log2_page_sz, u32 numa_node) { @@ -484,7 +484,7 @@ clib_pmalloc_alloc_inline (clib_pmalloc_main_t * pm, clib_pmalloc_arena_t * a, return 0; } -void * +__clib_export void * clib_pmalloc_alloc_aligned_on_numa (clib_pmalloc_main_t * pm, uword size, uword align, u32 numa_node) { @@ -528,7 +528,7 @@ pmalloc_chunks_mergeable (clib_pmalloc_arena_t * a, clib_pmalloc_page_t * pp, return 1; } -void +__clib_export void clib_pmalloc_free (clib_pmalloc_main_t * pm, void *va) { clib_pmalloc_page_t *pp; @@ -617,7 +617,7 @@ format_pmalloc_page (u8 * s, va_list * va) return s; } -u8 * +__clib_export u8 * format_pmalloc (u8 * s, va_list * va) { clib_pmalloc_main_t *pm = va_arg (*va, clib_pmalloc_main_t *); @@ -665,7 +665,7 @@ format_pmalloc (u8 * s, va_list * va) return s; } -u8 * +__clib_export u8 * format_pmalloc_map (u8 * s, va_list * va) { clib_pmalloc_main_t *pm = va_arg (*va, clib_pmalloc_main_t *); diff --git a/src/vppinfra/pool.c b/src/vppinfra/pool.c index 30848d55848..78361b5457e 100644 --- a/src/vppinfra/pool.c +++ b/src/vppinfra/pool.c @@ -37,7 +37,7 @@ #include <vppinfra/pool.h> -void +__clib_export void _pool_init_fixed (void **pool_ptr, u32 elt_size, u32 max_elts) { u8 *mmap_base; diff --git a/src/vppinfra/ptclosure.c b/src/vppinfra/ptclosure.c index cda873ef442..2635e59adc7 100644 --- a/src/vppinfra/ptclosure.c +++ b/src/vppinfra/ptclosure.c @@ -15,7 +15,7 @@ #include <vppinfra/ptclosure.h> -u8 ** +__clib_export u8 ** clib_ptclosure_alloc (int n) { u8 **rv = 0; @@ -35,7 +35,7 @@ clib_ptclosure_alloc (int n) return rv; } -void +__clib_export void clib_ptclosure_free (u8 ** ptc) { u8 *row; @@ -86,7 +86,7 @@ clib_ptclosure_copy (u8 ** dst, u8 ** src) * */ -u8 ** +__clib_export u8 ** clib_ptclosure (u8 ** orig) { int i, j, k; diff --git a/src/vppinfra/random_buffer.c b/src/vppinfra/random_buffer.c index 52de5d34dd0..4fa965b80c5 100644 --- a/src/vppinfra/random_buffer.c +++ b/src/vppinfra/random_buffer.c @@ -38,7 +38,7 @@ #include <vppinfra/random_buffer.h> /* Fill random buffer. */ -void +__clib_export void clib_random_buffer_fill (clib_random_buffer_t * b, uword n_words) { uword *w, n = n_words; @@ -58,7 +58,7 @@ clib_random_buffer_fill (clib_random_buffer_t * b, uword n_words) while (n > 0); } -void +__clib_export void clib_random_buffer_init (clib_random_buffer_t * b, uword seed) { uword i, j; diff --git a/src/vppinfra/rbtree.c b/src/vppinfra/rbtree.c index f7383cb1d1b..b8ee6f6c43d 100644 --- a/src/vppinfra/rbtree.c +++ b/src/vppinfra/rbtree.c @@ -166,7 +166,7 @@ rb_tree_insert (rb_tree_t * rt, rb_node_t * z) rb_tree_fixup_inline (rt, y, z); } -rb_node_index_t +__clib_export rb_node_index_t rb_tree_add (rb_tree_t * rt, u32 key) { rb_node_t *n; @@ -178,7 +178,7 @@ rb_tree_add (rb_tree_t * rt, u32 key) return rb_node_index (rt, n); } -rb_node_index_t +__clib_export rb_node_index_t rb_tree_add2 (rb_tree_t * rt, u32 key, uword opaque) { rb_node_t *n; @@ -191,7 +191,7 @@ rb_tree_add2 (rb_tree_t * rt, u32 key, uword opaque) return rb_node_index (rt, n); } -rb_node_index_t +__clib_export rb_node_index_t rb_tree_add_custom (rb_tree_t * rt, u32 key, uword opaque, rb_tree_lt_fn ltfn) { rb_node_index_t yi = 0, xi = rt->root; @@ -227,7 +227,7 @@ rb_tree_add_custom (rb_tree_t * rt, u32 key, uword opaque, rb_tree_lt_fn ltfn) return rb_node_index (rt, z); } -rb_node_t * +__clib_export rb_node_t * rb_tree_search_subtree (rb_tree_t * rt, rb_node_t * x, u32 key) { while (rb_node_index (rt, x) != RBTREE_TNIL_INDEX && key != x->key) @@ -238,7 +238,7 @@ rb_tree_search_subtree (rb_tree_t * rt, rb_node_t * x, u32 key) return x; } -rb_node_t * +__clib_export rb_node_t * rb_tree_search_subtree_custom (rb_tree_t * rt, rb_node_t * x, u32 key, rb_tree_lt_fn ltfn) { @@ -250,7 +250,7 @@ rb_tree_search_subtree_custom (rb_tree_t * rt, rb_node_t * x, u32 key, return x; } -rb_node_t * +__clib_export rb_node_t * rb_tree_min_subtree (rb_tree_t * rt, rb_node_t * x) { while (x->left != RBTREE_TNIL_INDEX) @@ -258,7 +258,7 @@ rb_tree_min_subtree (rb_tree_t * rt, rb_node_t * x) return x; } -rb_node_t * +__clib_export rb_node_t * rb_tree_max_subtree (rb_tree_t * rt, rb_node_t * x) { while (x->right != RBTREE_TNIL_INDEX) @@ -266,7 +266,7 @@ rb_tree_max_subtree (rb_tree_t * rt, rb_node_t * x) return x; } -rb_node_t * +__clib_export rb_node_t * rb_tree_successor (rb_tree_t * rt, rb_node_t * x) { rb_node_t *y; @@ -283,7 +283,7 @@ rb_tree_successor (rb_tree_t * rt, rb_node_t * x) return y; } -rb_node_t * +__clib_export rb_node_t * rb_tree_predecessor (rb_tree_t * rt, rb_node_t * x) { rb_node_t *y; @@ -441,14 +441,14 @@ rb_tree_del_node_internal (rb_tree_t * rt, rb_node_t * z) x->color = RBTREE_BLACK; } -void +__clib_export void rb_tree_del_node (rb_tree_t * rt, rb_node_t * z) { rb_tree_del_node_internal (rt, z); pool_put (rt->nodes, z); } -void +__clib_export void rb_tree_del (rb_tree_t * rt, u32 key) { rb_node_t *n; @@ -457,7 +457,7 @@ rb_tree_del (rb_tree_t * rt, u32 key) rb_tree_del_node (rt, n); } -void +__clib_export void rb_tree_del_custom (rb_tree_t * rt, u32 key, rb_tree_lt_fn ltfn) { rb_node_t *n; @@ -466,20 +466,20 @@ rb_tree_del_custom (rb_tree_t * rt, u32 key, rb_tree_lt_fn ltfn) rb_tree_del_node (rt, n); } -u32 +__clib_export u32 rb_tree_n_nodes (rb_tree_t * rt) { return pool_elts (rt->nodes); } -void +__clib_export void rb_tree_free_nodes (rb_tree_t * rt) { pool_free (rt->nodes); rt->root = RBTREE_TNIL_INDEX; } -void +__clib_export void rb_tree_init (rb_tree_t * rt) { rb_node_t *tnil; @@ -492,7 +492,7 @@ rb_tree_init (rb_tree_t * rt) tnil->color = RBTREE_BLACK; } -int +__clib_export int rb_tree_is_init (rb_tree_t * rt) { if (pool_elts (rt->nodes) == 0) diff --git a/src/vppinfra/serialize.c b/src/vppinfra/serialize.c index 93e44f94e07..89a0e36dcf1 100644 --- a/src/vppinfra/serialize.c +++ b/src/vppinfra/serialize.c @@ -160,7 +160,7 @@ unserialize_f32 (serialize_main_t * m, va_list * va) *x = y.f; } -void +__clib_export void serialize_cstring (serialize_main_t * m, char *s) { u32 len = s ? strlen (s) : 0; @@ -174,7 +174,7 @@ serialize_cstring (serialize_main_t * m, char *s) } } -void +__clib_export void unserialize_cstring (serialize_main_t * m, char **s) { char *p, *r = 0; @@ -279,7 +279,7 @@ _(64); #define SERIALIZE_VECTOR_CHUNK_SIZE 64 -void +__clib_export void serialize_vector (serialize_main_t * m, va_list * va) { void *vec = va_arg (*va, void *); @@ -341,7 +341,7 @@ unserialize_aligned_vector (serialize_main_t * m, va_list * va) f); } -void +__clib_export void unserialize_vector (serialize_main_t * m, va_list * va) { void **vec = va_arg (*va, void **); @@ -647,7 +647,7 @@ unserialize_check_magic (serialize_main_t * m, void *magic, u32 magic_bytes) goto bad; } -clib_error_t * +__clib_export clib_error_t * va_serialize (serialize_main_t * sm, va_list * va) { serialize_main_header_t *m = &sm->header; @@ -668,7 +668,7 @@ va_serialize (serialize_main_t * sm, va_list * va) return error; } -clib_error_t * +__clib_export clib_error_t * serialize (serialize_main_t * m, ...) { clib_error_t *error; @@ -680,7 +680,7 @@ serialize (serialize_main_t * m, ...) return error; } -clib_error_t * +__clib_export clib_error_t * unserialize (serialize_main_t * m, ...) { clib_error_t *error; @@ -838,7 +838,7 @@ serialize_read_not_inline (serialize_main_header_t * m, return vec_elt_at_index (s->overflow_buffer, cur_oi); } -void * +__clib_export void * serialize_read_write_not_inline (serialize_main_header_t * m, serialize_stream_t * s, uword n_bytes, uword flags) @@ -866,20 +866,20 @@ serialize_read_write_close (serialize_main_header_t * m, vec_free (s->overflow_buffer); } -void +__clib_export void serialize_close (serialize_main_t * m) { serialize_read_write_close (&m->header, &m->stream, SERIALIZE_FLAG_IS_WRITE); } -void +__clib_export void unserialize_close (serialize_main_t * m) { serialize_read_write_close (&m->header, &m->stream, SERIALIZE_FLAG_IS_READ); } -void +__clib_export void serialize_open_data (serialize_main_t * m, u8 * data, uword n_data_bytes) { clib_memset (m, 0, sizeof (m[0])); @@ -887,7 +887,7 @@ serialize_open_data (serialize_main_t * m, u8 * data, uword n_data_bytes) m->stream.n_buffer_bytes = n_data_bytes; } -void +__clib_export void unserialize_open_data (serialize_main_t * m, u8 * data, uword n_data_bytes) { serialize_open_data (m, data, n_data_bytes); @@ -905,7 +905,7 @@ serialize_vector_write (serialize_main_header_t * m, serialize_stream_t * s) } } -void +__clib_export void serialize_open_vector (serialize_main_t * m, u8 * vector) { clib_memset (m, 0, sizeof (m[0])); @@ -915,7 +915,7 @@ serialize_open_vector (serialize_main_t * m, u8 * vector) m->stream.n_buffer_bytes = vec_len (vector); } -void * +__clib_export void * serialize_close_vector (serialize_main_t * m) { serialize_stream_t *s = &m->stream; @@ -1205,13 +1205,13 @@ serialize_open_clib_file_descriptor_helper (serialize_main_t * m, int fd, m->stream.data_function_opaque = fd; } -void +__clib_export void serialize_open_clib_file_descriptor (serialize_main_t * m, int fd) { serialize_open_clib_file_descriptor_helper (m, fd, /* is_read */ 0); } -void +__clib_export void unserialize_open_clib_file_descriptor (serialize_main_t * m, int fd) { serialize_open_clib_file_descriptor_helper (m, fd, /* is_read */ 1); @@ -1232,13 +1232,13 @@ serialize_open_clib_file_helper (serialize_main_t * m, char *file, return 0; } -clib_error_t * +__clib_export clib_error_t * serialize_open_clib_file (serialize_main_t * m, char *file) { return serialize_open_clib_file_helper (m, file, /* is_read */ 0); } -clib_error_t * +__clib_export clib_error_t * unserialize_open_clib_file (serialize_main_t * m, char *file) { return serialize_open_clib_file_helper (m, file, /* is_read */ 1); diff --git a/src/vppinfra/socket.c b/src/vppinfra/socket.c index 4522514bba9..32260614942 100644 --- a/src/vppinfra/socket.c +++ b/src/vppinfra/socket.c @@ -54,7 +54,7 @@ #include <vppinfra/format.h> #include <vppinfra/error.h> -void +__clib_export void clib_socket_tx_add_formatted (clib_socket_t * s, char *fmt, ...) { va_list va; @@ -380,7 +380,7 @@ socket_init_funcs (clib_socket_t * s) s->recvmsg_func = default_socket_recvmsg; } -clib_error_t * +__clib_export clib_error_t * clib_socket_init (clib_socket_t * s) { union @@ -522,7 +522,7 @@ done: return error; } -clib_error_t * +__clib_export clib_error_t * clib_socket_accept (clib_socket_t * server, clib_socket_t * client) { clib_error_t *err = 0; diff --git a/src/vppinfra/std-formats.c b/src/vppinfra/std-formats.c index f4892d6d6f4..1667c93fd88 100644 --- a/src/vppinfra/std-formats.c +++ b/src/vppinfra/std-formats.c @@ -205,7 +205,7 @@ format_time_interval (u8 * s, va_list * args) } /* Unparse memory size e.g. 100, 100k, 100m, 100g. */ -u8 * +__clib_export u8 * format_memory_size (u8 * s, va_list * va) { uword size = va_arg (*va, uword); @@ -234,7 +234,7 @@ format_memory_size (u8 * s, va_list * va) } /* Parse memory size e.g. 100, 100k, 100m, 100g. */ -uword +__clib_export uword unformat_memory_size (unformat_input_t * input, va_list * va) { uword amount, shift, c; @@ -269,7 +269,7 @@ unformat_memory_size (unformat_input_t * input, va_list * va) } /* Unparse memory page size e.g. 4K, 2M */ -u8 * +__clib_export u8 * format_log2_page_size (u8 * s, va_list * va) { clib_mem_page_sz_t log2_page_sz = va_arg (*va, clib_mem_page_sz_t); @@ -296,7 +296,7 @@ format_log2_page_size (u8 * s, va_list * va) } /* Parse memory page size e.g. 4K, 2M */ -uword +__clib_export uword unformat_log2_page_size (unformat_input_t * input, va_list * va) { uword amount, shift, c; @@ -338,7 +338,7 @@ unformat_log2_page_size (unformat_input_t * input, va_list * va) /* Format c identifier: e.g. a_name -> "a name". Works for both vector names and null terminated c strings. */ -u8 * +__clib_export u8 * format_c_identifier (u8 * s, va_list * va) { u8 *id = va_arg (*va, u8 *); @@ -361,7 +361,7 @@ format_c_identifier (u8 * s, va_list * va) return s; } -u8 * +__clib_export u8 * format_hexdump (u8 * s, va_list * args) { u8 *data = va_arg (*args, u8 *); diff --git a/src/vppinfra/string.c b/src/vppinfra/string.c index bf6b24894e2..ea9480875a5 100644 --- a/src/vppinfra/string.c +++ b/src/vppinfra/string.c @@ -91,7 +91,7 @@ clib_memswap (void *_a, void *_b, uword bytes) } } -void +__clib_export void clib_c11_violation (const char *s) { _clib_error (CLIB_ERROR_WARNING, (char *) __FUNCTION__, 0, (char *) s); @@ -116,7 +116,7 @@ clib_c11_violation (const char *s) * EINVAL runtime constraint error * */ -errno_t +__clib_export errno_t memcpy_s (void *__restrict__ dest, rsize_t dmax, const void *__restrict__ src, rsize_t n) { @@ -141,7 +141,7 @@ memcpy_s (void *__restrict__ dest, rsize_t dmax, * EINVAL runtime constraint error * */ -errno_t +__clib_export errno_t memset_s (void *s, rsize_t smax, int c, rsize_t n) { return memset_s_inline (s, smax, c, n); @@ -174,7 +174,7 @@ memset_s (void *s, rsize_t smax, int c, rsize_t n) * EINVAL runtime constraint error * */ -errno_t +__clib_export errno_t memcmp_s (const void *s1, rsize_t s1max, const void *s2, rsize_t s2max, int *diff) { @@ -209,7 +209,7 @@ memcmp_s (const void *s1, rsize_t s1max, const void *s2, rsize_t s2max, * EINVAL runtime constraint error * */ -errno_t +__clib_export errno_t strcmp_s (const char *s1, rsize_t s1max, const char *s2, int *indicator) { return strcmp_s_inline (s1, s1max, s2, indicator); @@ -242,7 +242,7 @@ strcmp_s (const char *s1, rsize_t s1max, const char *s2, int *indicator) * EINVAL runtime constraint error * */ -errno_t +__clib_export errno_t strncmp_s (const char *s1, rsize_t s1max, const char *s2, rsize_t n, int *indicator) { @@ -268,7 +268,7 @@ strncmp_s (const char *s1, rsize_t s1max, const char *s2, rsize_t n, * EINVAL runtime constraint error * */ -errno_t +__clib_export errno_t strcpy_s (char *__restrict__ dest, rsize_t dmax, const char *__restrict__ src) { return strcpy_s_inline (dest, dmax, src); @@ -295,7 +295,7 @@ strcpy_s (char *__restrict__ dest, rsize_t dmax, const char *__restrict__ src) * dest is null terminated. * */ -errno_t +__clib_export errno_t strncpy_s (char *__restrict__ dest, rsize_t dmax, const char *__restrict__ src, rsize_t n) { @@ -324,7 +324,7 @@ strncpy_s (char *__restrict__ dest, rsize_t dmax, * EINVAL runtime constraint error * */ -errno_t +__clib_export errno_t strcat_s (char *__restrict__ dest, rsize_t dmax, const char *__restrict__ src) { return strcat_s_inline (dest, dmax, src); @@ -354,7 +354,7 @@ strcat_s (char *__restrict__ dest, rsize_t dmax, const char *__restrict__ src) * dest is null terminated. * */ -errno_t +__clib_export errno_t strncat_s (char *__restrict__ dest, rsize_t dmax, const char *__restrict__ src, rsize_t n) { @@ -406,7 +406,7 @@ strncat_s (char *__restrict__ dest, rsize_t dmax, * tok1 = "brevity", tok2 = "is", tok3 = "the", tok4 = "soul", tok5 = "of", * tok6 = "wit", tok7 = null */ -char * +__clib_export char * strtok_s (char *__restrict__ s1, rsize_t * __restrict__ s1max, const char *__restrict__ s2, char **__restrict__ ptr) { @@ -429,7 +429,7 @@ strtok_s (char *__restrict__ s1, rsize_t * __restrict__ s1max, * more than maxsize or 0 if there is a constraint error * */ -size_t +__clib_export size_t strnlen_s (const char *s, size_t maxsize) { return strnlen_s_inline (s, maxsize); @@ -466,7 +466,7 @@ strnlen_s (const char *s, size_t maxsize) * After the above call, * sub = "failure is not fatal." */ -errno_t +__clib_export errno_t strstr_s (char *s1, rsize_t s1max, const char *s2, rsize_t s2max, char **substring) { diff --git a/src/vppinfra/time.c b/src/vppinfra/time.c index 0b00a11421d..3377828bbc5 100644 --- a/src/vppinfra/time.c +++ b/src/vppinfra/time.c @@ -135,7 +135,7 @@ done: return cpu_freq; } -f64 +__clib_export f64 os_cpu_clock_frequency (void) { #if defined (__aarch64__) @@ -203,7 +203,7 @@ os_cpu_clock_frequency (void) #endif /* CLIB_UNIX */ /* Initialize time. */ -void +__clib_export void clib_time_init (clib_time_t * c) { clib_memset (c, 0, sizeof (c[0])); @@ -247,7 +247,7 @@ clib_time_init (clib_time_t * c) c->damping_constant = exp (-1.0 / 3.75); } -void +__clib_export void clib_time_verify_frequency (clib_time_t * c) { f64 now_reference, delta_reference, delta_reference_max; @@ -328,7 +328,7 @@ clib_time_verify_frequency (clib_time_t * c) } -u8 * +__clib_export u8 * format_clib_time (u8 * s, va_list * args) { clib_time_t *c = va_arg (*args, clib_time_t *); diff --git a/src/vppinfra/time_range.c b/src/vppinfra/time_range.c index 20048f834d1..4b5e1303763 100644 --- a/src/vppinfra/time_range.c +++ b/src/vppinfra/time_range.c @@ -15,7 +15,7 @@ #include <vppinfra/time_range.h> -void +__clib_export void clib_timebase_init (clib_timebase_t * tb, i32 timezone_offset_in_hours, clib_timebase_daylight_time_t daylight_type, clib_time_t * clib_time) @@ -100,7 +100,7 @@ const static char *day_names_calendar_order[] = { }; -void +__clib_export void clib_timebase_time_to_components (f64 now, clib_timebase_component_t * cp) { u32 year, month, hours, minutes, seconds, nanoseconds; @@ -181,7 +181,7 @@ clib_timebase_time_to_components (f64 now, clib_timebase_component_t * cp) cp->fractional_seconds = now; } -f64 +__clib_export f64 clib_timebase_components_to_time (clib_timebase_component_t * cp) { f64 now = 0; @@ -217,7 +217,7 @@ clib_timebase_components_to_time (clib_timebase_component_t * cp) return (now); } -f64 +__clib_export f64 clib_timebase_find_sunday_midnight (f64 start_time) { clib_timebase_component_t _c, *cp = &_c; @@ -256,7 +256,7 @@ clib_timebase_offset_from_sunday (u8 * day) } -u8 * +__clib_export u8 * format_clib_timebase_time (u8 * s, va_list * args) { f64 now = va_arg (*args, f64); @@ -312,7 +312,7 @@ unformat_clib_timebase_range_hms (unformat_input_t * input, va_list * args) return 1; } -uword +__clib_export uword unformat_clib_timebase_range_vector (unformat_input_t * input, va_list * args) { clib_timebase_range_t **rpp = va_arg (*args, clib_timebase_range_t **); @@ -387,7 +387,7 @@ unformat_clib_timebase_range_vector (unformat_input_t * input, va_list * args) } } -f64 +__clib_export f64 clib_timebase_summer_offset (clib_timebase_t * tb, f64 now) { clib_timebase_component_t _c, *cp = &_c; diff --git a/src/vppinfra/tw_timer_template.c b/src/vppinfra/tw_timer_template.c index 174ffaceb47..97c70b223ce 100644 --- a/src/vppinfra/tw_timer_template.c +++ b/src/vppinfra/tw_timer_template.c @@ -292,7 +292,7 @@ timer_add (TWT (tw_timer_wheel) * tw, TWT (tw_timer) * t, u64 interval) * @param u64 interval timer interval in ticks * @returns handle needed to cancel the timer */ -u32 +__clib_export u32 TW (tw_timer_start) (TWT (tw_timer_wheel) * tw, u32 user_id, u32 timer_id, u64 interval) { @@ -349,7 +349,7 @@ int TW (scan_for_handle) (TWT (tw_timer_wheel) * tw, u32 handle) * @param tw_timer_wheel_t * tw timer wheel object pointer * @param u32 handle timer cancellation returned by tw_timer_start */ -void TW (tw_timer_stop) (TWT (tw_timer_wheel) * tw, u32 handle) +__clib_export void TW (tw_timer_stop) (TWT (tw_timer_wheel) * tw, u32 handle) { TWT (tw_timer) * t; @@ -376,7 +376,8 @@ void TW (tw_timer_stop) (TWT (tw_timer_wheel) * tw, u32 handle) pool_put_index (tw->timers, handle); } -int TW (tw_timer_handle_is_free) (TWT (tw_timer_wheel) * tw, u32 handle) +__clib_export int +TW (tw_timer_handle_is_free) (TWT (tw_timer_wheel) * tw, u32 handle) { return pool_is_free_index (tw->timers, handle); } @@ -387,8 +388,8 @@ int TW (tw_timer_handle_is_free) (TWT (tw_timer_wheel) * tw, u32 handle) * @param u32 handle timer returned by tw_timer_start * @param u32 interval timer interval in ticks */ -void TW (tw_timer_update) (TWT (tw_timer_wheel) * tw, u32 handle, - u64 interval) +__clib_export void +TW (tw_timer_update) (TWT (tw_timer_wheel) * tw, u32 handle, u64 interval) { TWT (tw_timer) * t; t = pool_elt_at_index (tw->timers, handle); @@ -403,7 +404,7 @@ void TW (tw_timer_update) (TWT (tw_timer_wheel) * tw, u32 handle, * expired timer handles. The callback is optional. * @param f64 timer_interval_in_seconds */ -void +__clib_export void TW (tw_timer_wheel_init) (TWT (tw_timer_wheel) * tw, void *expired_timer_callback, f64 timer_interval_in_seconds, u32 max_expirations) @@ -450,7 +451,7 @@ TW (tw_timer_wheel_init) (TWT (tw_timer_wheel) * tw, * @brief Free a tw timer wheel template instance * @param tw_timer_wheel_t * tw timer wheel object pointer */ -void TW (tw_timer_wheel_free) (TWT (tw_timer_wheel) * tw) +__clib_export void TW (tw_timer_wheel_free) (TWT (tw_timer_wheel) * tw) { int i, j; tw_timer_wheel_slot_t *ts; @@ -810,13 +811,14 @@ static inline return callback_vector; } -u32 *TW (tw_timer_expire_timers) (TWT (tw_timer_wheel) * tw, f64 now) +__clib_export u32 *TW (tw_timer_expire_timers) (TWT (tw_timer_wheel) * tw, + f64 now) { return TW (tw_timer_expire_timers_internal) (tw, now, 0 /* no vector */ ); } -u32 *TW (tw_timer_expire_timers_vec) (TWT (tw_timer_wheel) * tw, f64 now, - u32 * vec) +__clib_export u32 *TW (tw_timer_expire_timers_vec) (TWT (tw_timer_wheel) * tw, + f64 now, u32 * vec) { return TW (tw_timer_expire_timers_internal) (tw, now, vec); } @@ -829,7 +831,8 @@ u32 *TW (tw_timer_expire_timers_vec) (TWT (tw_timer_wheel) * tw, f64 now, * when timers are removed from fast wheel slots. */ -u32 TW (tw_timer_first_expires_in_ticks) (TWT (tw_timer_wheel) * tw) +__clib_export u32 +TW (tw_timer_first_expires_in_ticks) (TWT (tw_timer_wheel) * tw) { u32 first_expiring_index, fast_ring_index; i32 delta; diff --git a/src/vppinfra/unformat.c b/src/vppinfra/unformat.c index 3c671137941..4d9679b4052 100644 --- a/src/vppinfra/unformat.c +++ b/src/vppinfra/unformat.c @@ -38,7 +38,7 @@ #include <vppinfra/format.h> /* Call user's function to fill input buffer. */ -uword +__clib_export uword _unformat_fill_input (unformat_input_t * i) { uword l, first_mark; @@ -87,7 +87,7 @@ is_white_space (uword c) } /* Format function for dumping input stream. */ -u8 * +__clib_export u8 * format_unformat_error (u8 * s, va_list * va) { unformat_input_t *i = va_arg (*va, unformat_input_t *); @@ -139,7 +139,7 @@ format_unformat_error (u8 * s, va_list * va) } /* Print everything: not just error context. */ -u8 * +__clib_export u8 * format_unformat_input (u8 * s, va_list * va) { unformat_input_t *i = va_arg (*va, unformat_input_t *); @@ -268,7 +268,7 @@ done: return 1; } -uword +__clib_export uword unformat_hex_string (unformat_input_t * input, va_list * va) { u8 **hexstring_return = va_arg (*va, u8 **); @@ -317,14 +317,14 @@ unformat_hex_string (unformat_input_t * input, va_list * va) } /* unformat (input "foo%U", unformat_eof) matches terminal foo only */ -uword +__clib_export uword unformat_eof (unformat_input_t * input, va_list * va) { return unformat_check_input (input) == UNFORMAT_END_OF_INPUT; } /* Parse a token containing given set of characters. */ -uword +__clib_export uword unformat_token (unformat_input_t * input, va_list * va) { u8 *token_chars = va_arg (*va, u8 *); @@ -379,7 +379,7 @@ unformat_token (unformat_input_t * input, va_list * va) /* Unformat (parse) function which reads a %s string and converts it to and unformat_input_t. */ -uword +__clib_export uword unformat_input (unformat_input_t * i, va_list * args) { unformat_input_t *sub_input = va_arg (*args, unformat_input_t *); @@ -395,7 +395,7 @@ unformat_input (unformat_input_t * i, va_list * args) } /* Parse a line ending with \n and return it. */ -uword +__clib_export uword unformat_line (unformat_input_t * i, va_list * va) { u8 *line = 0, **result = va_arg (*va, u8 **); @@ -411,7 +411,7 @@ unformat_line (unformat_input_t * i, va_list * va) } /* Parse a line ending with \n and return it as an unformat_input_t. */ -uword +__clib_export uword unformat_line_input (unformat_input_t * i, va_list * va) { unformat_input_t *result = va_arg (*va, unformat_input_t *); @@ -817,7 +817,7 @@ do_percent (unformat_input_t * input, va_list * va, const char *f) return n ? f : 0; } -uword +__clib_export uword unformat_skip_white_space (unformat_input_t * input) { uword n = 0; @@ -974,7 +974,7 @@ parse_fail: return input_matches_format; } -uword +__clib_export uword unformat (unformat_input_t * input, const char *fmt, ...) { va_list va; @@ -985,7 +985,7 @@ unformat (unformat_input_t * input, const char *fmt, ...) return result; } -uword +__clib_export uword unformat_user (unformat_input_t * input, unformat_function_t * func, ...) { va_list va; @@ -1009,7 +1009,7 @@ unformat_user (unformat_input_t * input, unformat_function_t * func, ...) } /* Setup for unformat of Unix style command line. */ -void +__clib_export void unformat_init_command_line (unformat_input_t * input, char *argv[]) { uword i; @@ -1025,7 +1025,7 @@ unformat_init_command_line (unformat_input_t * input, char *argv[]) } } -void +__clib_export void unformat_init_string (unformat_input_t * input, char *string, int string_len) { unformat_init (input, 0, 0); @@ -1033,7 +1033,7 @@ unformat_init_string (unformat_input_t * input, char *string, int string_len) vec_add (input->buffer, string, string_len); } -void +__clib_export void unformat_init_vector (unformat_input_t * input, u8 * vector_string) { unformat_init (input, 0, 0); @@ -1060,7 +1060,7 @@ clib_file_fill_buffer (unformat_input_t * input) return input->index; } -void +__clib_export void unformat_init_clib_file (unformat_input_t * input, int file_descriptor) { unformat_init (input, clib_file_fill_buffer, @@ -1077,7 +1077,7 @@ unformat_init_unix_env (unformat_input_t * input, char *var) return val != 0; } -uword +__clib_export uword unformat_data_size (unformat_input_t * input, va_list * args) { u64 _a; diff --git a/src/vppinfra/unix-formats.c b/src/vppinfra/unix-formats.c index 4e29bb86ddb..fd0539c7d2b 100644 --- a/src/vppinfra/unix-formats.c +++ b/src/vppinfra/unix-formats.c @@ -939,7 +939,7 @@ u8 * format_ucontext_pc (u8 * s, va_list * args) return format (s, "%p", regs[reg_no]); } -uword +__clib_export uword unformat_unix_gid (unformat_input_t * input, va_list * args) { gid_t *gid = va_arg (*args, gid_t *); diff --git a/src/vppinfra/unix-misc.c b/src/vppinfra/unix-misc.c index 54016ed74f4..7c276b0ceeb 100644 --- a/src/vppinfra/unix-misc.c +++ b/src/vppinfra/unix-misc.c @@ -45,8 +45,8 @@ #include <fcntl.h> #include <stdio.h> /* for sprintf */ -__thread uword __os_thread_index = 0; -__thread uword __os_numa_index = 0; +__clib_export __thread uword __os_thread_index = 0; +__clib_export __thread uword __os_numa_index = 0; clib_error_t * clib_file_n_bytes (char *file, uword * result) @@ -108,7 +108,7 @@ done: return error; } -clib_error_t * +__clib_export clib_error_t * clib_file_contents (char *file, u8 ** result) { uword n_bytes; @@ -215,15 +215,13 @@ os_puts (u8 * string, uword string_length, uword is_error) ; } -void os_out_of_memory (void) __attribute__ ((weak)); -void +__clib_export __clib_weak void os_out_of_memory (void) { os_panic (); } -uword os_get_nthreads (void) __attribute__ ((weak)); -uword +__clib_export __clib_weak uword os_get_nthreads (void) { return 1; diff --git a/src/vppinfra/valloc.c b/src/vppinfra/valloc.c index 927802bfeb1..5e17a594428 100644 --- a/src/vppinfra/valloc.c +++ b/src/vppinfra/valloc.c @@ -125,7 +125,7 @@ clib_valloc_add_chunk (clib_valloc_main_t * vam, @param template - clib_valloc_chunk_t * pointer to a template chunk which describes the initial virtual address range */ -void +__clib_export void clib_valloc_init (clib_valloc_main_t * vam, clib_valloc_chunk_t * template, int need_lock) { @@ -147,7 +147,7 @@ clib_valloc_init (clib_valloc_main_t * vam, clib_valloc_chunk_t * template, @os_out_of_memory_on_failure - 1=> panic on allocation failure @return uword allocated space, 0=> failure */ -uword +__clib_export uword clib_valloc_alloc (clib_valloc_main_t * vam, uword size, int os_out_of_memory_on_failure) { @@ -224,7 +224,7 @@ clib_valloc_alloc (clib_valloc_main_t * vam, uword size, @note the size is returned since we know it / in case the caller doesn't memorize chunk sizes */ -uword +__clib_export uword clib_valloc_free (clib_valloc_main_t * vam, uword baseva) { clib_valloc_chunk_t *ch, *prev_ch, *next_ch, *n2_ch; diff --git a/src/vppinfra/vec.c b/src/vppinfra/vec.c index 441e1acc576..f3cdb14b6fc 100644 --- a/src/vppinfra/vec.c +++ b/src/vppinfra/vec.c @@ -40,7 +40,7 @@ /* Vector resize operator. Called as needed by various macros such as vec_add1() when we need to allocate memory. */ -void * +__clib_export void * vec_resize_allocate_memory (void *v, word length_increment, uword data_bytes, |