src: decorate internal APIs with EPOLL_INTERNAL
This commit is contained in:
parent
8a3daba2ce
commit
0ac3c921bd
@ -38,7 +38,7 @@ foreach(HEADER_SOURCE ${SOURCES_INCLUDE})
|
||||
set(ALLINONE_SRC_C "allinone/${HEADER_NAME}-all-in-one.c")
|
||||
add_custom_command(
|
||||
OUTPUT ${ALLINONE_SRC_C}
|
||||
COMMAND node allinone/build.js ${HEADER_SOURCE} ${SOURCES_SRC_C} > ${ALLINONE_SRC_C}
|
||||
COMMAND node allinone/build.js allinone/header.h ${HEADER_SOURCE} ${SOURCES_SRC_C} > ${ALLINONE_SRC_C}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
IMPLICIT_DEPENDS c ${SOURCES_INCLUDE} ${SOURCES_SRC}
|
||||
)
|
||||
|
||||
2
allinone/header.h
Normal file
2
allinone/header.h
Normal file
@ -0,0 +1,2 @@
|
||||
#define EPOLL_INTERNAL static
|
||||
#define EPOLL_INTERNAL_EXTERN static
|
||||
@ -1,6 +1,7 @@
|
||||
#ifndef EPOLL_AFD_H_
|
||||
#define EPOLL_AFD_H_
|
||||
|
||||
#include "internal.h"
|
||||
#include "ntstatus.h"
|
||||
#include "win.h"
|
||||
|
||||
@ -50,7 +51,9 @@ typedef struct _AFD_POLL_INFO {
|
||||
AFD_POLL_HANDLE_INFO Handles[1];
|
||||
} AFD_POLL_INFO, *PAFD_POLL_INFO;
|
||||
|
||||
int afd_poll(SOCKET socket, AFD_POLL_INFO* info, OVERLAPPED* overlapped);
|
||||
EPOLL_INTERNAL int afd_poll(SOCKET socket,
|
||||
AFD_POLL_INFO* info,
|
||||
OVERLAPPED* overlapped);
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
|
||||
#include "epoll.h"
|
||||
#include "handle-tree.h"
|
||||
#include "internal.h"
|
||||
#include "queue.h"
|
||||
#include "tree.h"
|
||||
#include "util.h"
|
||||
@ -26,26 +27,29 @@ typedef struct ep_sock {
|
||||
uint32_t flags;
|
||||
} ep_sock_t;
|
||||
|
||||
ep_sock_t* ep_sock_new(_ep_port_data_t* port_data);
|
||||
int ep_sock_delete(_ep_port_data_t* port_data, ep_sock_t* sock_info);
|
||||
EPOLL_INTERNAL ep_sock_t* ep_sock_new(_ep_port_data_t* port_data);
|
||||
EPOLL_INTERNAL int ep_sock_delete(_ep_port_data_t* port_data,
|
||||
ep_sock_t* sock_info);
|
||||
|
||||
int ep_sock_set_socket(_ep_port_data_t* port_data,
|
||||
ep_sock_t* sock_info,
|
||||
SOCKET socket);
|
||||
int ep_sock_set_event(_ep_port_data_t* port_data,
|
||||
ep_sock_t* sock_info,
|
||||
const struct epoll_event* ev);
|
||||
EPOLL_INTERNAL int ep_sock_set_socket(_ep_port_data_t* port_data,
|
||||
ep_sock_t* sock_info,
|
||||
SOCKET socket);
|
||||
EPOLL_INTERNAL int ep_sock_set_event(_ep_port_data_t* port_data,
|
||||
ep_sock_t* sock_info,
|
||||
const struct epoll_event* ev);
|
||||
|
||||
int ep_sock_update(_ep_port_data_t* port_data, ep_sock_t* sock_info);
|
||||
int ep_sock_feed_event(_ep_port_data_t* port_data,
|
||||
poll_req_t* poll_req,
|
||||
struct epoll_event* ev);
|
||||
EPOLL_INTERNAL int ep_sock_update(_ep_port_data_t* port_data,
|
||||
ep_sock_t* sock_info);
|
||||
EPOLL_INTERNAL int ep_sock_feed_event(_ep_port_data_t* port_data,
|
||||
poll_req_t* poll_req,
|
||||
struct epoll_event* ev);
|
||||
|
||||
void ep_sock_register_poll_req(_ep_port_data_t* port_data,
|
||||
ep_sock_t* sock_info);
|
||||
void ep_sock_unregister_poll_req(_ep_port_data_t* port_data,
|
||||
ep_sock_t* sock_info);
|
||||
EPOLL_INTERNAL void ep_sock_register_poll_req(_ep_port_data_t* port_data,
|
||||
ep_sock_t* sock_info);
|
||||
EPOLL_INTERNAL void ep_sock_unregister_poll_req(_ep_port_data_t* port_data,
|
||||
ep_sock_t* sock_info);
|
||||
|
||||
ep_sock_t* ep_sock_from_tree_entry(handle_tree_entry_t* tree_entry);
|
||||
EPOLL_INTERNAL ep_sock_t* ep_sock_from_tree_entry(
|
||||
handle_tree_entry_t* tree_entry);
|
||||
|
||||
#endif /* EPOLL_SOCK_DATA_H_ */
|
||||
|
||||
@ -3,13 +3,14 @@
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "internal.h"
|
||||
#include "ntstatus.h"
|
||||
|
||||
DWORD we_map_ntstatus_to_win_error(NTSTATUS ntstatus);
|
||||
DWORD we_map_ntstatus_to_ws_error(NTSTATUS ntstatus);
|
||||
errno_t we_map_win_error_to_errno(DWORD error);
|
||||
EPOLL_INTERNAL DWORD we_map_ntstatus_to_win_error(NTSTATUS ntstatus);
|
||||
EPOLL_INTERNAL DWORD we_map_ntstatus_to_ws_error(NTSTATUS ntstatus);
|
||||
EPOLL_INTERNAL errno_t we_map_win_error_to_errno(DWORD error);
|
||||
|
||||
void we_set_win_error(DWORD error);
|
||||
EPOLL_INTERNAL void we_set_win_error(DWORD error);
|
||||
|
||||
#define _return_error_helper(error, value) \
|
||||
do { \
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#ifndef EPOLL_HANDLE_TREE_H_
|
||||
#define EPOLL_HANDLE_TREE_H_
|
||||
|
||||
#include "internal.h"
|
||||
#include "tree.h"
|
||||
|
||||
typedef RB_HEAD(handle_tree, handle_tree_entry) handle_tree_t;
|
||||
@ -10,15 +11,17 @@ typedef struct handle_tree_entry {
|
||||
uintptr_t key;
|
||||
} handle_tree_entry_t;
|
||||
|
||||
void handle_tree_init(handle_tree_t* tree);
|
||||
void handle_tree_entry_init(handle_tree_entry_t* entry);
|
||||
EPOLL_INTERNAL void handle_tree_init(handle_tree_t* tree);
|
||||
EPOLL_INTERNAL void handle_tree_entry_init(handle_tree_entry_t* entry);
|
||||
|
||||
int handle_tree_add(handle_tree_t* tree,
|
||||
handle_tree_entry_t* entry,
|
||||
uintptr_t key);
|
||||
int handle_tree_del(handle_tree_t* tree, handle_tree_entry_t* entry);
|
||||
EPOLL_INTERNAL int handle_tree_add(handle_tree_t* tree,
|
||||
handle_tree_entry_t* entry,
|
||||
uintptr_t key);
|
||||
EPOLL_INTERNAL int handle_tree_del(handle_tree_t* tree,
|
||||
handle_tree_entry_t* entry);
|
||||
|
||||
handle_tree_entry_t* handle_tree_find(handle_tree_t* tree, uintptr_t key);
|
||||
handle_tree_entry_t* handle_tree_root(handle_tree_t* tree);
|
||||
EPOLL_INTERNAL handle_tree_entry_t* handle_tree_find(handle_tree_t* tree,
|
||||
uintptr_t key);
|
||||
EPOLL_INTERNAL handle_tree_entry_t* handle_tree_root(handle_tree_t* tree);
|
||||
|
||||
#endif /* EPOLL_HANDLE_TREE_H_ */
|
||||
|
||||
9
src/internal.h
Normal file
9
src/internal.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef EPOLL_INTERNAL_H_
|
||||
#define EPOLL_INTERNAL_H_
|
||||
|
||||
#ifndef EPOLL_INTERNAL
|
||||
#define EPOLL_INTERNAL
|
||||
#define EPOLL_INTERNAL_EXTERN extern
|
||||
#endif
|
||||
|
||||
#endif /* EPOLL_INTERNAL_H_ */
|
||||
2
src/nt.c
2
src/nt.c
@ -4,7 +4,7 @@
|
||||
#include "win.h"
|
||||
|
||||
#define X(return_type, declarators, name, parameters) \
|
||||
return_type(declarators* name) parameters = NULL;
|
||||
EPOLL_INTERNAL return_type(declarators* name) parameters = NULL;
|
||||
NTDLL_IMPORT_LIST(X)
|
||||
#undef X
|
||||
|
||||
|
||||
5
src/nt.h
5
src/nt.h
@ -1,10 +1,11 @@
|
||||
#ifndef EPOLL_NT_H_
|
||||
#define EPOLL_NT_H_
|
||||
|
||||
#include "internal.h"
|
||||
#include "ntstatus.h"
|
||||
#include "win.h"
|
||||
|
||||
int nt_initialize(void);
|
||||
EPOLL_INTERNAL int nt_initialize(void);
|
||||
|
||||
typedef struct _IO_STATUS_BLOCK {
|
||||
union {
|
||||
@ -35,7 +36,7 @@ typedef VOID(NTAPI* PIO_APC_ROUTINE)(PVOID ApcContext,
|
||||
X(ULONG, WINAPI, RtlNtStatusToDosError, (NTSTATUS Status))
|
||||
|
||||
#define X(return_type, declarators, name, parameters) \
|
||||
extern return_type(declarators* name) parameters;
|
||||
EPOLL_INTERNAL_EXTERN return_type(declarators* name) parameters;
|
||||
NTDLL_IMPORT_LIST(X)
|
||||
#undef X
|
||||
|
||||
|
||||
@ -5,29 +5,31 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "afd.h"
|
||||
#include "internal.h"
|
||||
#include "win.h"
|
||||
|
||||
typedef struct _ep_port_data _ep_port_data_t;
|
||||
typedef struct ep_sock ep_sock_t;
|
||||
typedef struct poll_req poll_req_t;
|
||||
|
||||
poll_req_t* poll_req_new(_ep_port_data_t* port_data, ep_sock_t* sock_info);
|
||||
EPOLL_INTERNAL poll_req_t* poll_req_new(_ep_port_data_t* port_data,
|
||||
ep_sock_t* sock_info);
|
||||
|
||||
void poll_req_delete(_ep_port_data_t* port_data,
|
||||
ep_sock_t* sock_info,
|
||||
poll_req_t* poll_req);
|
||||
EPOLL_INTERNAL void poll_req_delete(_ep_port_data_t* port_data,
|
||||
ep_sock_t* sock_info,
|
||||
poll_req_t* poll_req);
|
||||
|
||||
poll_req_t* overlapped_to_poll_req(OVERLAPPED* overlapped);
|
||||
EPOLL_INTERNAL poll_req_t* overlapped_to_poll_req(OVERLAPPED* overlapped);
|
||||
|
||||
ep_sock_t* poll_req_get_sock_data(const poll_req_t* poll_req);
|
||||
EPOLL_INTERNAL ep_sock_t* poll_req_get_sock_data(const poll_req_t* poll_req);
|
||||
|
||||
int poll_req_submit(poll_req_t* poll_req,
|
||||
uint32_t epoll_events,
|
||||
SOCKET socket,
|
||||
SOCKET driver_socket);
|
||||
EPOLL_INTERNAL int poll_req_submit(poll_req_t* poll_req,
|
||||
uint32_t epoll_events,
|
||||
SOCKET socket,
|
||||
SOCKET driver_socket);
|
||||
|
||||
void poll_req_complete(const poll_req_t* poll_req,
|
||||
uint32_t* epoll_events_out,
|
||||
bool* socket_closed_out);
|
||||
EPOLL_INTERNAL void poll_req_complete(const poll_req_t* poll_req,
|
||||
uint32_t* epoll_events_out,
|
||||
bool* socket_closed_out);
|
||||
|
||||
#endif /* EPOLL_POLL_REQUEST_H_ */
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include "afd.h"
|
||||
#include "epoll-socket.h"
|
||||
#include "handle-tree.h"
|
||||
#include "internal.h"
|
||||
#include "queue.h"
|
||||
#include "tree.h"
|
||||
#include "util.h"
|
||||
@ -22,10 +23,10 @@ typedef struct _ep_port_data {
|
||||
|
||||
SOCKET _ep_get_driver_socket(_ep_port_data_t* port_data, SOCKET socket);
|
||||
|
||||
int _ep_port_add_socket(_ep_port_data_t* port_data,
|
||||
handle_tree_entry_t* tree_entry,
|
||||
SOCKET socket);
|
||||
int _ep_port_del_socket(_ep_port_data_t* port_data,
|
||||
handle_tree_entry_t* tree_entry);
|
||||
EPOLL_INTERNAL int _ep_port_add_socket(_ep_port_data_t* port_data,
|
||||
handle_tree_entry_t* tree_entry,
|
||||
SOCKET socket);
|
||||
EPOLL_INTERNAL int _ep_port_del_socket(_ep_port_data_t* port_data,
|
||||
handle_tree_entry_t* tree_entry);
|
||||
|
||||
#endif /* EPOLL_PORT_DATA_H_ */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user