Skip to content

Commit

Permalink
UCX/API: external API is wrapped into -=extern "C"=-
Browse files Browse the repository at this point in the history
- added 'extern "C"' wrapper around public functions definitions
  • Loading branch information
Sergey Oblomov committed Nov 14, 2017
1 parent 2fb0787 commit 748634f
Show file tree
Hide file tree
Showing 38 changed files with 169 additions and 25 deletions.
3 changes: 3 additions & 0 deletions src/ucp/api/ucp.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
#include <ucs/type/thread_mode.h>
#include <ucs/type/cpu_set.h>
#include <ucs/config/types.h>
#include <ucs/sys/compiler_def.h>
#include <stdio.h>

BEGIN_C_DECLS

/**
* @defgroup UCP_API Unified Communication Protocol (UCP) API
Expand Down Expand Up @@ -2446,5 +2448,6 @@ ucs_status_t ucp_worker_flush(ucp_worker_h worker);
* UCP hello world client / server example utility.
*/

END_C_DECLS

#endif
54 changes: 54 additions & 0 deletions src/ucp/api/ucp_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@


#include <ucp/api/ucp_def.h>
#include <ucs/sys/compiler_def.h>

BEGIN_C_DECLS

/**
* @ingroup UCP_COMM
Expand All @@ -33,4 +35,56 @@ void ucp_request_release(void *request);
void ucp_ep_destroy(ucp_ep_h ep);


/**
* @ingroup UCP_ENDPOINT
* @deprecated Replaced by @ref ucp_ep_close_nb.
*/
ucs_status_ptr_t ucp_disconnect_nb(ucp_ep_h ep);


/**
* @ingroup UCP_ENDPOINT
* @deprecated Replaced by @ref ucp_tag_recv_request_test and
* @ref ucp_request_check_status depends on use case.
*
* @note Please use @ref ucp_request_check_status for cases that only need to
* check the completion status of an outstanding request.
* @ref ucp_request_check_status can be used for any type of request.
* @ref ucp_tag_recv_request_test should only be used for requests
* returned by @ref ucp_tag_recv_nb (or request allocated by user for
* @ref ucp_tag_recv_nbr) for which additional information
* (returned via the @a info pointer) is needed.
*/
ucs_status_t ucp_request_test(void *request, ucp_tag_recv_info_t *info);


/**
* @ingroup UCP_ENDPOINT
* @deprecated Replaced by @ref ucp_ep_flush_nb.
*/
ucs_status_t ucp_ep_flush(ucp_ep_h ep);

/**
* @ingroup UCP_WORKER
*
* @brief Flush outstanding AMO and RMA operations on the @ref ucp_worker_h
* "worker"
*
* This routine flushes all outstanding AMO and RMA communications on the
* @ref ucp_worker_h "worker". All the AMO and RMA operations issued on the
* @a worker prior to this call are completed both at the origin and at the
* target when this call returns.
*
* @note For description of the differences between @ref ucp_worker_flush
* "flush" and @ref ucp_worker_fence "fence" operations please see
* @ref ucp_worker_fence "ucp_worker_fence()"
*
* @param [in] worker UCP worker.
*
* @return Error code as defined by @ref ucs_status_t
*/
ucs_status_t ucp_worker_flush(ucp_worker_h worker);

END_C_DECLS

#endif
5 changes: 5 additions & 0 deletions src/ucs/algorithm/crc.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#include <stddef.h>
#include <stdint.h>

#include <ucs/sys/compiler_def.h>

BEGIN_C_DECLS

/**
* Calculate CRC16 of an arbitrary buffer.
*
Expand All @@ -26,5 +30,6 @@ uint16_t ucs_crc16(const void *buffer, size_t size);
*/
uint16_t ucs_crc16_string(const char *s);

END_C_DECLS

#endif
4 changes: 4 additions & 0 deletions src/ucs/algorithm/qsort_r.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@

#include <stddef.h>

#include <ucs/sys/compiler_def.h>

BEGIN_C_DECLS

/**
* Compare callback for @ref qsort_r.
Expand All @@ -59,5 +62,6 @@ typedef int ucs_qsort_r_compare_cb_t(const void *elem1, const void *elem2,
void ucs_qsort_r(void *base, size_t nmemb, size_t size,
ucs_qsort_r_compare_cb_t *compare, void *arg);

END_C_DECLS

#endif
10 changes: 8 additions & 2 deletions src/ucs/arch/aarch64/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "config.h"
#include <time.h>
#include <sys/times.h>
#include <ucs/sys/compiler_def.h>
#include <ucs/arch/generic/cpu.h>
#if __ARM_NEON
#include <arm_neon.h>
Expand All @@ -19,6 +20,8 @@

#define UCS_ARCH_CACHE_LINE_SIZE 64

BEGIN_C_DECLS

/**
* Assume the worst - weak memory ordering.
*/
Expand Down Expand Up @@ -63,8 +66,6 @@ static inline int ucs_arch_get_cpu_flag()
return UCS_CPU_FLAG_UNKNOWN;
}

#endif

static inline void ucs_arch_wait_mem(void *address)
{
unsigned long tmp;
Expand All @@ -73,3 +74,8 @@ static inline void ucs_arch_wait_mem(void *address)
: "=&r"(tmp)
: "r"(address));
}

END_C_DECLS

#endif

4 changes: 4 additions & 0 deletions src/ucs/arch/ppc64/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
#ifdef HAVE_SYS_PLATFORM_PPC_H
# include <sys/platform/ppc.h>
#endif
#include <ucs/sys/compiler_def.h>
#include <ucs/arch/generic/cpu.h>
#include <stdint.h>

BEGIN_C_DECLS

#define UCS_ARCH_CACHE_LINE_SIZE 128

Expand Down Expand Up @@ -53,4 +55,6 @@ double ucs_arch_get_clocks_per_sec();

#define ucs_arch_wait_mem ucs_arch_generic_wait_mem

END_C_DECLS

#endif
3 changes: 3 additions & 0 deletions src/ucs/arch/x86_64/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <ucs/sys/compiler.h>
#include <ucs/arch/generic/cpu.h>
#include <ucs/sys/compiler_def.h>
#include <stdint.h>

#ifdef __SSE4_1__
Expand All @@ -19,6 +20,7 @@
# include <immintrin.h>
#endif

BEGIN_C_DECLS

#define UCS_ARCH_CACHE_LINE_SIZE 64

Expand Down Expand Up @@ -48,6 +50,7 @@ ucs_cpu_flag_t ucs_arch_get_cpu_flag() UCS_F_NOOPTIMIZE;

#define ucs_arch_wait_mem ucs_arch_generic_wait_mem

END_C_DECLS

#endif

4 changes: 4 additions & 0 deletions src/ucs/async/async.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
#include "signal.h"
#include "async_fwd.h"

#include <ucs/sys/compiler_def.h>
#include <ucs/datastruct/mpmc.h>
#include <ucs/time/time.h>
#include <ucs/debug/log.h>

BEGIN_C_DECLS

/**
* Async event context. Manages timer and fd notifications.
Expand Down Expand Up @@ -119,4 +121,6 @@ static inline int ucs_async_check_miss(ucs_async_context_t *async)
} while (0)


END_C_DECLS

#endif
2 changes: 2 additions & 0 deletions src/ucs/async/async_fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <ucs/config/types.h>
#include <ucs/time/time_def.h>

BEGIN_C_DECLS

typedef struct ucs_async_context ucs_async_context_t;

Expand Down Expand Up @@ -121,5 +122,6 @@ void ucs_async_poll(ucs_async_context_t *async);

void __ucs_async_poll_missed(ucs_async_context_t *async);

END_C_DECLS

#endif
4 changes: 4 additions & 0 deletions src/ucs/config/global_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@

#include <ucs/stats/stats_fwd.h>
#include <ucs/type/status.h>
#include <ucs/sys/compiler_def.h>
#include <stddef.h>
#include <stdio.h>

BEGIN_C_DECLS


/**
Expand Down Expand Up @@ -108,4 +110,6 @@ ucs_status_t ucs_global_opts_clone(void *dst);
void ucs_global_opts_release();
void ucs_global_opts_print(FILE *stream, ucs_config_print_flags_t print_flags);

END_C_DECLS

#endif
4 changes: 4 additions & 0 deletions src/ucs/config/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@

#include <ucs/type/status.h>
#include <ucs/sys/math.h>
#include <ucs/sys/compiler_def.h>
#include <stdio.h>


#define UCS_CONFIG_PREFIX "UCX_"
#define UCS_CONFIG_ARRAY_MAX 128

BEGIN_C_DECLS

/*
* Configuration varaibles syntax:
Expand Down Expand Up @@ -326,4 +328,6 @@ size_t ucs_config_memunits_get(size_t config_size, size_t auto_size,
int ucs_config_names_search(ucs_config_names_array_t config_names,
const char *str);

END_C_DECLS

#endif
4 changes: 4 additions & 0 deletions src/ucs/datastruct/callbackq.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include <ucs/async/async_fwd.h>
#include <ucs/datastruct/list_types.h>
#include <stdint.h>
#include <ucs/sys/compiler_def.h>

BEGIN_C_DECLS

/*
*
Expand Down Expand Up @@ -236,6 +239,7 @@ void ucs_callbackq_add_slow_path(ucs_callbackq_t *cbq,
void ucs_callbackq_remove_slow_path(ucs_callbackq_t *cbq,
ucs_callbackq_slow_elem_t* elem);

END_C_DECLS

/**
* Remove all slow path elements with a given callback function from the list.
Expand Down
4 changes: 4 additions & 0 deletions src/ucs/datastruct/mpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include <ucs/debug/log.h>
#include <ucs/debug/memtrack.h>
#include <ucs/type/status.h>
#include <ucs/sys/compiler_def.h>

BEGIN_C_DECLS


typedef struct ucs_mpool_chunk ucs_mpool_chunk_t;
Expand Down Expand Up @@ -235,5 +238,6 @@ void ucs_mpool_chunk_munmap(ucs_mpool_t *mp, void *chunk);
ucs_status_t ucs_mpool_hugetlb_malloc(ucs_mpool_t *mp, size_t *size_p, void **chunk_p);
void ucs_mpool_hugetlb_free(ucs_mpool_t *mp, void *chunk);

END_C_DECLS

#endif /* MPOOL_H_ */
3 changes: 3 additions & 0 deletions src/ucs/debug/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <ucs/config/global_opts.h>
#include <stdint.h>

BEGIN_C_DECLS

#define ucs_log_enabled(_level) \
ucs_unlikely(((_level) <= UCS_MAX_LOG_LEVEL) && ((_level) <= (ucs_global_opts.log_level)))
Expand Down Expand Up @@ -144,5 +145,7 @@ const char *ucs_log_dump_hex(const void* data, size_t length, char *buf, size_t
void ucs_log_push_handler(ucs_log_func_t handler);
void ucs_log_pop_handler();

END_C_DECLS

#endif

4 changes: 4 additions & 0 deletions src/ucs/debug/memtrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
# include "config.h"
#endif

#include <ucs/sys/compiler_def.h>

#include <sys/types.h>
#include <malloc.h>
#include <stdlib.h>
#include <stdio.h>

BEGIN_C_DECLS

enum {
UCS_MEMTRACK_STAT_ALLOCATION_COUNT,
Expand Down Expand Up @@ -158,5 +161,6 @@ char *ucs_strdup(const char *src, const char *name);

#endif /* ENABLE_MEMTRACK */

END_C_DECLS

#endif
6 changes: 6 additions & 0 deletions src/ucs/stats/stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
# include "config.h"
#endif

#include <ucs/sys/compiler_def.h>

BEGIN_C_DECLS

void ucs_stats_init();
void ucs_stats_cleanup();
void ucs_stats_dump();
Expand Down Expand Up @@ -104,4 +108,6 @@ void ucs_stats_node_free(ucs_stats_node_t *node);

#endif

END_C_DECLS

#endif
5 changes: 5 additions & 0 deletions src/ucs/stats/stats_fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

#include <stdint.h>

#include <ucs/sys/compiler_def.h>

BEGIN_C_DECLS

typedef uint64_t ucs_stats_counter_t; /* Stats counter*/
typedef struct ucs_stats_class ucs_stats_class_t; /* Stats class */
Expand All @@ -25,4 +28,6 @@ typedef enum {
extern const char *ucs_stats_formats_names[];
ucs_stats_node_t * ucs_stats_get_root();

END_C_DECLS

#endif /* STATS_FD_H_ */
2 changes: 2 additions & 0 deletions src/ucs/sys/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <stdint.h>
#include <math.h>

BEGIN_C_DECLS

#define UCS_KBYTE (1ull << 10)
#define UCS_MBYTE (1ull << 20)
Expand Down Expand Up @@ -147,5 +148,6 @@ uint32_t ucs_calc_crc32(uint32_t crc, const void *buf, size_t size);
*/
uint64_t ucs_get_prime(unsigned index);

END_C_DECLS

#endif /* MACROS_H_ */
Loading

0 comments on commit 748634f

Please sign in to comment.