Commit bbe020b1 authored by Philip Carns's avatar Philip Carns
Browse files

apply clang format to codebase

parent 4069e4d8
/*
* (C) 2016 The University of Chicago
*
*
* See COPYRIGHT in top-level directory.
*/
......@@ -15,10 +15,10 @@
extern "C" {
#endif
#define BAKE_CLIENT_NULL ((bake_client_t)NULL)
#define BAKE_CLIENT_NULL ((bake_client_t)NULL)
#define BAKE_PROVIDER_HANDLE_NULL ((bake_provider_handle_t)NULL)
typedef struct bake_client* bake_client_t;
typedef struct bake_client* bake_client_t;
typedef struct bake_provider_handle* bake_provider_handle_t;
/**
......@@ -56,11 +56,10 @@ int bake_client_finalize(bake_client_t client);
*
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_provider_handle_create(
bake_client_t client,
hg_addr_t addr,
uint16_t provider_id,
bake_provider_handle_t* handle);
int bake_provider_handle_create(bake_client_t client,
hg_addr_t addr,
uint16_t provider_id,
bake_provider_handle_t* handle);
/**
* Increment the reference counter of the provider handle
......@@ -81,23 +80,24 @@ int bake_provider_handle_ref_incr(bake_provider_handle_t handle);
* @param addr Returned address (ignored if NULL)
* @param provider_id Returned provider id (ignored if NULL)
*
* @return BAKE_SUCCESS or corresponding error code.
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_provider_handle_get_info(bake_provider_handle_t handle,
bake_client_t *client,
hg_addr_t *addr,
uint16_t *provider_id);
bake_client_t* client,
hg_addr_t* addr,
uint16_t* provider_id);
/**
* Get the limit (in bytes) bellow which this provider handle will use
* eager mode (i.e. packing data into the RPC instead of using RDMA).
* eager mode (i.e. packing data into the RPC instead of using RDMA).
*
* @param[in] handle provider handle
* @param[out] limit limit
*
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_provider_handle_get_eager_limit(bake_provider_handle_t handle, uint64_t* limit);
int bake_provider_handle_get_eager_limit(bake_provider_handle_t handle,
uint64_t* limit);
/**
* Set the limit (in bytes) bellow which this provider handle will use
......@@ -108,7 +108,8 @@ int bake_provider_handle_get_eager_limit(bake_provider_handle_t handle, uint64_t
*
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_provider_handle_set_eager_limit(bake_provider_handle_t handle, uint64_t limit);
int bake_provider_handle_set_eager_limit(bake_provider_handle_t handle,
uint64_t limit);
/**
* Decrement the reference counter of the provider handle,
......@@ -128,16 +129,16 @@ int bake_provider_handle_release(bake_provider_handle_t handle);
*
* @param [in] provider provider handle
* @param [in] max_targets maximum number of targets to retrieve
* @param [out] bti array of BAKE target identifiers with enough space for max_targets
* @param [out] bti array of BAKE target identifiers with enough space for
* max_targets
* @param [out] num_targets number of targets returned (at most max_targets)
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_probe(
bake_provider_handle_t provider,
uint64_t max_targets,
bake_target_id_t* bti,
uint64_t* num_targets);
int bake_probe(bake_provider_handle_t provider,
uint64_t max_targets,
bake_target_id_t* bti,
uint64_t* num_targets);
/**
* Creates a bounded-size BAKE data region. The resulting region can be
* written using BAKE write operations, and can be persisted (once writes
......@@ -150,12 +151,11 @@ int bake_probe(
* @param [out] rid identifier for new region
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_create(
bake_provider_handle_t provider,
bake_target_id_t bti,
uint64_t region_size,
bake_region_id_t *rid);
int bake_create(bake_provider_handle_t provider,
bake_target_id_t bti,
uint64_t region_size,
bake_region_id_t* rid);
/**
* Writes into a BAKE region that was previously created with bake_create().
* Result is not guaranteed to be persistent until explicit
......@@ -171,13 +171,12 @@ int bake_create(
* @param [in] buf_size size of local memory buffer to write
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_write(
bake_provider_handle_t provider,
bake_target_id_t bti,
bake_region_id_t rid,
uint64_t region_offset,
void const *buf,
uint64_t buf_size);
int bake_write(bake_provider_handle_t provider,
bake_target_id_t bti,
bake_region_id_t rid,
uint64_t region_offset,
void const* buf,
uint64_t buf_size);
/**
* Writes data into a previously created BAKE region like bake_write(),
......@@ -197,18 +196,17 @@ int bake_write(
* @param [in] size size to write from remote bulk handle
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_proxy_write(
bake_provider_handle_t provider,
bake_target_id_t bti,
bake_region_id_t rid,
uint64_t region_offset,
hg_bulk_t remote_bulk,
uint64_t remote_offset,
const char* remote_addr,
uint64_t size);
int bake_proxy_write(bake_provider_handle_t provider,
bake_target_id_t bti,
bake_region_id_t rid,
uint64_t region_offset,
hg_bulk_t remote_bulk,
uint64_t remote_offset,
const char* remote_addr,
uint64_t size);
/**
* Persists a BAKE region. The region is considered immutable at this point
* Persists a BAKE region. The region is considered immutable at this point
* and reads may be performed on the region.
*
* @param [in] provider provider handle
......@@ -217,12 +215,11 @@ int bake_proxy_write(
* @param [in] size of the region
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_persist(
bake_provider_handle_t provider,
bake_target_id_t bti,
bake_region_id_t rid,
size_t offset,
size_t size);
int bake_persist(bake_provider_handle_t provider,
bake_target_id_t bti,
bake_region_id_t rid,
size_t offset,
size_t size);
/**
* Creates a bounded-size BAKE region, writes data into it, and persists
......@@ -235,12 +232,11 @@ int bake_persist(
* @param [out] rid identifier for new region
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_create_write_persist(
bake_provider_handle_t provider,
bake_target_id_t bti,
void const *buf,
uint64_t buf_size,
bake_region_id_t *rid);
int bake_create_write_persist(bake_provider_handle_t provider,
bake_target_id_t bti,
void const* buf,
uint64_t buf_size,
bake_region_id_t* rid);
/**
* Issues a bake_create_write_persist on behalf of a remote entity (remote_addr)
......@@ -260,14 +256,13 @@ int bake_create_write_persist(
* @param [out] rid identifier for new region
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_create_write_persist_proxy(
bake_provider_handle_t provider,
bake_target_id_t bti,
hg_bulk_t remote_bulk,
uint64_t remote_offset,
const char* remote_addr,
uint64_t size,
bake_region_id_t *rid);
int bake_create_write_persist_proxy(bake_provider_handle_t provider,
bake_target_id_t bti,
hg_bulk_t remote_bulk,
uint64_t remote_offset,
const char* remote_addr,
uint64_t size,
bake_region_id_t* rid);
/**
* Checks the size of an existing BAKE region.
......@@ -280,11 +275,10 @@ int bake_create_write_persist_proxy(
* @param [out] size size of region
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_get_size(
bake_provider_handle_t provider,
bake_target_id_t bti,
bake_region_id_t rid,
uint64_t *size);
int bake_get_size(bake_provider_handle_t provider,
bake_target_id_t bti,
bake_region_id_t rid,
uint64_t* size);
/**
* Gets the raw pointer of an existing BAKE region.
......@@ -306,11 +300,10 @@ int bake_get_size(
* @param [out] ptr pointer to the address of the data
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_get_data(
bake_provider_handle_t provider,
bake_target_id_t bti,
bake_region_id_t rid,
void** ptr);
int bake_get_data(bake_provider_handle_t provider,
bake_target_id_t bti,
bake_region_id_t rid,
void** ptr);
/**
* Reads from a BAKE region that was previously persisted with bake_persist().
......@@ -326,14 +319,13 @@ int bake_get_data(
* @param [out] bytes_read number of bytes effectively read into the buffer
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_read(
bake_provider_handle_t provider,
bake_target_id_t bti,
bake_region_id_t rid,
uint64_t region_offset,
void *buf,
uint64_t buf_size,
uint64_t* bytes_read);
int bake_read(bake_provider_handle_t provider,
bake_target_id_t bti,
bake_region_id_t rid,
uint64_t region_offset,
void* buf,
uint64_t buf_size,
uint64_t* bytes_read);
/**
* Reads data from a previously persisted BAKE region like bake_read(),
......@@ -354,16 +346,15 @@ int bake_read(
* @param [out] bytes_read number of bytes effectively read
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_proxy_read(
bake_provider_handle_t provider,
bake_target_id_t bti,
bake_region_id_t rid,
uint64_t region_offset,
hg_bulk_t remote_bulk,
uint64_t remote_offset,
const char* remote_addr,
uint64_t size,
uint64_t* bytes_read);
int bake_proxy_read(bake_provider_handle_t provider,
bake_target_id_t bti,
bake_region_id_t rid,
uint64_t region_offset,
hg_bulk_t remote_bulk,
uint64_t remote_offset,
const char* remote_addr,
uint64_t size,
uint64_t* bytes_read);
/**
* @brief Requests the source provider to migrate a particular
......@@ -383,16 +374,15 @@ int bake_proxy_read(
*
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_migrate_region(
bake_provider_handle_t source,
bake_target_id_t source_bti,
bake_region_id_t source_rid,
size_t region_size,
int remove_source,
const char* dest_addr,
uint16_t dest_provider_id,
bake_target_id_t dest_target_id,
bake_region_id_t* dest_rid);
int bake_migrate_region(bake_provider_handle_t source,
bake_target_id_t source_bti,
bake_region_id_t source_rid,
size_t region_size,
int remove_source,
const char* dest_addr,
uint16_t dest_provider_id,
bake_target_id_t dest_target_id,
bake_region_id_t* dest_rid);
/**
* @brief Migrates a full target from a provider to another.
......@@ -405,25 +395,22 @@ int bake_migrate_region(
*
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_migrate_target(
bake_provider_handle_t source,
bake_target_id_t src_target_id,
int remove_source,
const char* dest_addr,
uint16_t dest_provider_id,
const char* dest_root);
int bake_migrate_target(bake_provider_handle_t source,
bake_target_id_t src_target_id,
int remove_source,
const char* dest_addr,
uint16_t dest_provider_id,
const char* dest_root);
/**
* Shuts down a remote BAKE service (given an address).
* This will shutdown all the providers on the target address.
*
*
* @param [in] client BAKE client
* @param [in] addr address of the server
* @param [in] addr address of the server
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_shutdown_service(
bake_client_t client,
hg_addr_t addr);
int bake_shutdown_service(bake_client_t client, hg_addr_t addr);
/**
* Issues a BAKE no-op operation.
......@@ -435,16 +422,15 @@ int bake_noop(bake_provider_handle_t provider);
/**
* Removes a previously persisted BAKE region and frees its associated memory.
*
*
* @param provider Provider in which to remove the region.
* @param rid Region to remove.
*
* @return BAKE_SUCCESS or corresponding error code.
*/
int bake_remove(
bake_provider_handle_t provider,
bake_target_id_t bti,
bake_region_id_t rid);
int bake_remove(bake_provider_handle_t provider,
bake_target_id_t bti,
bake_region_id_t rid);
#ifdef __cplusplus
}
......
/*
* (C) 2016 The University of Chicago
*
*
* See COPYRIGHT in top-level directory.
*/
......@@ -15,15 +15,15 @@
extern "C" {
#endif
#define BAKE_ABT_POOL_DEFAULT ABT_POOL_NULL
#define BAKE_ABT_POOL_DEFAULT ABT_POOL_NULL
#define BAKE_PROVIDER_ID_DEFAULT 0
#define BAKE_PROVIDER_IGNORE NULL
#define BAKE_PROVIDER_IGNORE NULL
typedef struct bake_provider* bake_provider_t;
/**
* Creates a BAKE pool to use for backend PMEM storage.
*
*
* NOTE: This function must be called on a pool before the pool
* can be passed to 'bake_provider_register'.
*
......@@ -32,10 +32,7 @@ typedef struct bake_provider* bake_provider_t;
* @param[in] pool_mode mode of the created pool
* @returns 0 on success, -1 otherwise
*/
int bake_makepool(
const char *pool_name,
size_t pool_size,
mode_t pool_mode);
int bake_makepool(const char* pool_name, size_t pool_size, mode_t pool_mode);
/**
* Initializes a BAKE provider.
......@@ -47,11 +44,10 @@ int bake_makepool(
* @param[out] provider resulting provider
* @returns 0 on success, -1 otherwise
*/
int bake_provider_register(
margo_instance_id mid,
uint16_t provider_id,
ABT_pool pool,
bake_provider_t* provider);
int bake_provider_register(margo_instance_id mid,
uint16_t provider_id,
ABT_pool pool,
bake_provider_t* provider);
/**
* @brief Deregisters and destroys the provider.
......@@ -60,8 +56,7 @@ int bake_provider_register(
*
* @return 0 on success, -1 otherwise.
*/
int bake_provider_destroy(
bake_provider_t provider);
int bake_provider_destroy(bake_provider_t provider);
/**
* Makes the provider start managing a target.
......@@ -75,10 +70,9 @@ int bake_provider_destroy(
*
* @return 0 on success, -1 on failure
*/
int bake_provider_add_storage_target(
bake_provider_t provider,
const char *target_name,
bake_target_id_t* target_id);
int bake_provider_add_storage_target(bake_provider_t provider,
const char* target_name,
bake_target_id_t* target_id);
/**
* Makes the provider stop managing a target.
......@@ -88,9 +82,8 @@ int bake_provider_add_storage_target(
*
* @return 0 on success, -1 on failure
*/
int bake_provider_remove_storage_target(
bake_provider_t provider,
bake_target_id_t target_id);
int bake_provider_remove_storage_target(bake_provider_t provider,
bake_target_id_t target_id);
/**
* Removes all the targets associated with a provider.
......@@ -99,8 +92,7 @@ int bake_provider_remove_storage_target(
*
* @return 0 on success, -1 on failure
*/
int bake_provider_remove_all_storage_targets(
bake_provider_t provider);
int bake_provider_remove_all_storage_targets(bake_provider_t provider);
/**
* Returns the number of targets that this provider manages.
......@@ -110,9 +102,8 @@ int bake_provider_remove_all_storage_targets(
*
* @return 0 on success, -1 on failure
*/
int bake_provider_count_storage_targets(
bake_provider_t provider,
uint64_t* num_targets);
int bake_provider_count_storage_targets(bake_provider_t provider,
uint64_t* num_targets);
/**
* List the target ids of the targets managed by this provider.
......@@ -125,9 +116,8 @@ int bake_provider_count_storage_targets(
*
* @return 0 on success, -1 on failure
*/
int bake_provider_list_storage_targets(
bake_provider_t provider,
bake_target_id_t* targets);
int bake_provider_list_storage_targets(bake_provider_t provider,
bake_target_id_t* targets);
/* TODO: the following configuration management functions would ideally be
* split off into a dedicated component. Treating this as a prototype for
......@@ -143,10 +133,9 @@ int bake_provider_list_storage_targets(
*
* @return 0 on success, -1 on failure
*/
int bake_provider_set_conf(
bake_provider_t provider,
const char *key,
const char *value);
int bake_provider_set_conf(bake_provider_t provider,
const char* key,
const char* value);
/**
* @brief Set configuration parameters for a target.
......@@ -158,11 +147,10 @@ int bake_provider_set_conf(
*
* @return 0 on success, -1 on failure
*/
int bake_target_set_conf(
bake_provider_t provider,
bake_target_id_t tid,
const char* key,
const char* value);
int bake_target_set_conf(bake_provider_t provider,
bake_target_id_t tid,
const char* key,
const char* value);
#ifdef __cplusplus
}
......
/*
* (C) 2016 The University of Chicago
*
*
* See COPYRIGHT in top-level directory.
*/
......@@ -23,25 +23,29 @@ typedef struct {
#define BAKE_REGION_ID_DATA_SIZE 16
typedef struct {
uint32_t type;
char data[BAKE_REGION_ID_DATA_SIZE];
char data[BAKE_REGION_ID_DATA_SIZE];
} bake_region_id_t;
#define BAKE_SUCCESS 0 /* Success */
#define BAKE_ERR_ALLOCATION (-1) /* Error allocating something */
#define BAKE_ERR_INVALID_ARG (-2) /* An argument is invalid */
#define BAKE_ERR_MERCURY (-3) /* An error happened calling a Mercury function */
#define BAKE_ERR_ARGOBOTS (-4) /* An error happened calling an Argobots function */
#define BAKE_ERR_PMEM (-5) /* An error happened calling a pmem function */
#define BAKE_ERR_UNKNOWN_TARGET (-6) /* Target refered to by id is not known to provider */
#define BAKE_ERR_UNKNOWN_PROVIDER (-7) /* Provider id could not be matched with a provider */
#define BAKE_ERR_UNKNOWN_REGION (-8) /* Region id could not be found */
#define BAKE_ERR_OUT_OF_BOUNDS (-9) /* Attempting an out of bound access */
#define BAKE_ERR_REMI (-10) /* Error related to REMI */
#define BAKE_ERR_OP_UNSUPPORTED (-11) /* Operation not supported */
#define BAKE_ERR_FORBIDDEN (-12) /* Forbidden operation */
#define BAKE_ERR_BACKEND_TYPE (-13) /* Unknown backend type */
#define BAKE_ERR_IO (-14) /* Back-end I/O error */
#define BAKE_ERR_END (-15) /* End of valid bake error codes */
#define BAKE_SUCCESS 0 /* Success */
#define BAKE_ERR_ALLOCATION (-1) /* Error allocating something */
#define BAKE_ERR_INVALID_ARG (-2) /* An argument is invalid */
#define BAKE_ERR_MERCURY (-3) /* An error happened calling a Mercury function \
*/
#define BAKE_ERR_ARGOBOTS \
(-4) /* An error happened calling an Argobots function */
#define BAKE_ERR_PMEM (-5) /* An error happened calling a pmem function */
#define BAKE_ERR_UNKNOWN_TARGET \
(-6) /* Target refered to by id is not known to provider */
#define BAKE_ERR_UNKNOWN_PROVIDER \
(-7) /* Provider id could not be matched with a provider */
#define BAKE_ERR_UNKNOWN_REGION (-8) /* Region id could not be found */
#define BAKE_ERR_OUT_OF_BOUNDS (-9) /* Attempting an out of bound access */
#define BAKE_ERR_REMI (-10) /* Error related to REMI */
#define BAKE_ERR_OP_UNSUPPORTED (-11) /* Operation not supported */
#define BAKE_ERR_FORBIDDEN (-12) /* Forbidden operation */
#define BAKE_ERR_BACKEND_TYPE (-13) /* Unknown backend type */
#define BAKE_ERR_IO (-14) /* Back-end I/O error */
#define BAKE_ERR_END (-15) /* End of valid bake error codes */
/**
* Print bake errors in human-friendly form
......@@ -49,7 +53,7 @@ typedef struct {
* @param a string to print out before the error
* @param ret error code from a bake routine
*/
void bake_perror(const char *s, int ret);
void bake_perror(const char* s, int ret);
/**
* @brief Converts a target id into an ASCII readable string.
......@@ -102,7 +106,7 @@ int bake_region_id_from_string(const char* str, bake_region_id_t* rid);
* string is longer than this it will be truncated.
* @param[in] rid region_id
*/
void bake_print_dbg_region_id_t(char *str, size_t size, bake_region_id_t rid)
void bake_print_dbg_region_id_t(char* str, size_t size, bake_region_id_t rid)
__attribute__((deprecated("use bake_region_id_to_string instead")));
#ifdef __cplusplus
......
......@@ -5,97 +5,96 @@
#include "bake.h"
typedef struct bake_provider* bake_provider_t;
typedef void* backend_context_t;
typedef void* backend_context_t;
typedef int (*bake_backend_initialize_fn)(bake_provider_t provider,
const char* path,
bake_target_id_t *target,
backend_context_t *context);
typedef int (*bake_backend_initialize_fn)(bake_provider_t provider,
const char* path,
bake_target_id_t* target,
backend_context_t* context);
typedef int (*bake_backend_finalize_fn)(backend_context_t context);
typedef int (*bake_create_fn)(backend_context_t context,
size_t size,
bake_region_id_t *rid);
size_t size,
bake_region_id_t* rid);
typedef int (*bake_write_raw_fn)(backend_context_t context,
bake_region_id_t rid,
size_t offset,
size_t size,
const void* data);
bake_region_id_t rid,
size_t offset,
size_t size,
const void* data);
typedef int (*bake_write_bulk_fn)(backend_context_t context,
bake_region_id_t rid,
size_t region_offset,
size_t size,
hg_bulk_t bulk,
hg_addr_t source,
size_t bulk_offset);
bake_region_id_t rid,
size_t region_offset,
size_t size,