Commit 636ca4ff authored by Matt Caswell's avatar Matt Caswell
Browse files

Normalise ASYNC naming



Tidied up the naming of functions and structures to be consistent

Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
parent 134b28f8
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -63,15 +63,14 @@

typedef struct async_fibre_st {
    int dummy;
} ASYNC_FIBRE;
} async_fibre;



# define ASYNC_set_ctx(nctx)                    0
# define ASYNC_get_ctx()                        ((ASYNC_CTX *)NULL)
# define ASYNC_FIBRE_swapcontext(o,n,r)         0
# define ASYNC_FIBRE_makecontext(c)
# define ASYNC_FIBRE_free(f)
# define ASYNC_FIBRE_init_dispatcher(f)
# define async_set_ctx(nctx)                    0
# define async_get_ctx()                        ((async_ctx *)NULL)
# define async_fibre_swapcontext(o,n,r)         0
# define async_fibre_makecontext(c)
# define async_fibre_free(f)
# define async_fibre_init_dispatcher(f)

#endif
+4 −4
Original line number Diff line number Diff line
@@ -54,14 +54,14 @@
#include "../async_locl.h"
#include <openssl/async.h>

#ifdef ASYNC_SYSV
#ifdef ASYNC_POSIX
# include <stddef.h>
# include <ucontext.h>
# include <unistd.h>
# include <openssl/crypto.h>
# include <openssl/async.h>

__thread ASYNC_CTX *sysvctx;
__thread async_ctx *sysvctx;

#define STACKSIZE       32768

@@ -69,7 +69,7 @@ __thread size_t pool_max_size = 0;
__thread size_t pool_curr_size = 0;
__thread STACK_OF(ASYNC_JOB) *pool = NULL;

int ASYNC_FIBRE_init(ASYNC_FIBRE *fibre)
int async_fibre_init(async_fibre *fibre)
{
    void *stack = NULL;

@@ -85,7 +85,7 @@ int ASYNC_FIBRE_init(ASYNC_FIBRE *fibre)
    return 1;
}

void ASYNC_FIBRE_free(ASYNC_FIBRE *fibre)
void async_fibre_free(async_fibre *fibre)
{
    if (fibre->fibre.uc_stack.ss_sp)
        OPENSSL_free(fibre->fibre.uc_stack.ss_sp);
+12 −12
Original line number Diff line number Diff line
@@ -58,25 +58,25 @@

# if _POSIX_VERSION >= 200112L

#  define ASYNC_SYSV
#  define ASYNC_POSIX
#  define ASYNC_ARCH

#  include <ucontext.h>
#  include <setjmp.h>
#  include "e_os.h"

extern __thread ASYNC_CTX *sysvctx;
extern __thread async_ctx *sysvctx;

typedef struct async_fibre_st {
    ucontext_t fibre;
    jmp_buf env;
    int env_init;
} ASYNC_FIBRE;
} async_fibre;

#  define ASYNC_set_ctx(nctx)             (sysvctx = (nctx))
#  define ASYNC_get_ctx()                 (sysvctx)
#  define async_set_ctx(nctx)             (sysvctx = (nctx))
#  define async_get_ctx()                 (sysvctx)

static inline int ASYNC_FIBRE_swapcontext(ASYNC_FIBRE *o, ASYNC_FIBRE *n, int r)
static inline int async_fibre_swapcontext(async_fibre *o, async_fibre *n, int r)
{
    o->env_init = 1;

@@ -90,14 +90,14 @@ static inline int ASYNC_FIBRE_swapcontext(ASYNC_FIBRE *o, ASYNC_FIBRE *n, int r)
    return 1;
}

#  define ASYNC_FIBRE_makecontext(c) \
            (ASYNC_FIBRE_init(c) \
#  define async_fibre_makecontext(c) \
            (async_fibre_init(c) \
            && !getcontext(&(c)->fibre) \
            && (makecontext(&(c)->fibre, ASYNC_start_func, 0), 1))
#  define ASYNC_FIBRE_init_dispatcher(d)
            && (makecontext(&(c)->fibre, async_start_func, 0), 1))
#  define async_fibre_init_dispatcher(d)

int ASYNC_FIBRE_init(ASYNC_FIBRE *fibre);
void ASYNC_FIBRE_free(ASYNC_FIBRE *fibre);
int async_fibre_init(async_fibre *fibre);
void async_fibre_free(async_fibre *fibre);

# endif
#endif
+4 −4
Original line number Diff line number Diff line
@@ -64,9 +64,9 @@ struct winpool {
    size_t max_size;
};

void ASYNC_start_func(void);
void async_start_func(void);

int ASYNC_FIBRE_init_dispatcher(ASYNC_FIBRE *fibre)
int async_fibre_init_dispatcher(async_fibre *fibre)
{
    LPVOID dispatcher;

@@ -82,9 +82,9 @@ int ASYNC_FIBRE_init_dispatcher(ASYNC_FIBRE *fibre)
    return 1;
}

VOID CALLBACK ASYNC_start_func_win(PVOID unused)
VOID CALLBACK async_start_func_win(PVOID unused)
{
    ASYNC_start_func();
    async_start_func();
}

int async_pipe(int *pipefds)
+10 −10
Original line number Diff line number Diff line
@@ -66,19 +66,19 @@

typedef struct async_fibre_st {
    LPVOID fibre;
} ASYNC_FIBRE;
} async_fibre;

# define ASYNC_set_ctx(nctx) \
# define async_set_ctx(nctx) \
        (CRYPTO_set_thread_local(CRYPTO_THREAD_LOCAL_ASYNC_CTX, (void *)(nctx)))
# define ASYNC_get_ctx() \
        ((ASYNC_CTX *)CRYPTO_get_thread_local(CRYPTO_THREAD_LOCAL_ASYNC_CTX))
# define ASYNC_FIBRE_swapcontext(o,n,r) \
# define async_get_ctx() \
        ((async_ctx *)CRYPTO_get_thread_local(CRYPTO_THREAD_LOCAL_ASYNC_CTX))
# define async_fibre_swapcontext(o,n,r) \
        (SwitchToFiber((n)->fibre), 1)
# define ASYNC_FIBRE_makecontext(c) \
        ((c)->fibre = CreateFiber(0, ASYNC_start_func_win, 0))
# define ASYNC_FIBRE_free(f)             (DeleteFiber((f)->fibre))
# define async_fibre_makecontext(c) \
        ((c)->fibre = CreateFiber(0, async_start_func_win, 0))
# define async_fibre_free(f)             (DeleteFiber((f)->fibre))

int ASYNC_FIBRE_init_dispatcher(ASYNC_FIBRE *fibre);
VOID CALLBACK ASYNC_start_func_win(PVOID unused);
int async_fibre_init_dispatcher(async_fibre *fibre);
VOID CALLBACK async_start_func_win(PVOID unused);

#endif
Loading