From e365b97c6ef24a4092091cfa2875e8bdf0594033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 30 Nov 2018 14:52:07 +0200 Subject: [PATCH] MXS-2196: Rename struct dcb to struct DCB Renamed the DCB struct and removed the typedef. --- include/maxscale/authenticator.h | 14 +++++++------- include/maxscale/dcb.hh | 22 +++++++++++----------- include/maxscale/listener.hh | 4 ++-- include/maxscale/protocol.h | 26 +++++++++++++------------- include/maxscale/protocol/mysql.h | 4 ++-- include/maxscale/session.hh | 14 +++++++------- include/maxscale/ssl.h | 14 +++++++------- server/core/dcb.cc | 4 ++-- 8 files changed, 51 insertions(+), 51 deletions(-) diff --git a/include/maxscale/authenticator.h b/include/maxscale/authenticator.h index 7e1151402..16b2b0dc3 100644 --- a/include/maxscale/authenticator.h +++ b/include/maxscale/authenticator.h @@ -43,7 +43,7 @@ typedef enum authenticator_capability /** Maximum number of authenticator options */ #define AUTHENTICATOR_MAX_OPTIONS 256 -struct dcb; +struct DCB; struct server; struct session; @@ -92,13 +92,13 @@ typedef struct mxs_authenticator { void* (*initialize)(char** options); void* (*create)(void* instance); - bool (* extract)(struct dcb*, GWBUF*); - bool (* connectssl)(struct dcb*); - int (* authenticate)(struct dcb*); - void (* free)(struct dcb*); + bool (* extract)(DCB*, GWBUF*); + bool (* connectssl)(DCB*); + int (* authenticate)(DCB*); + void (* free)(DCB*); void (* destroy)(void*); int (* loadusers)(Listener*); - void (* diagnostic)(struct dcb*, Listener*); + void (* diagnostic)(DCB*, Listener*); /** * @brief Return diagnostic information about the authenticator @@ -116,7 +116,7 @@ typedef struct mxs_authenticator /** This entry point was added to avoid calling authenticator functions * directly when a COM_CHANGE_USER command is executed. */ - int (* reauthenticate)(struct dcb*, + int (* reauthenticate)(DCB*, const char* user, uint8_t* token, size_t token_len, /**< Client auth token */ diff --git a/include/maxscale/dcb.hh b/include/maxscale/dcb.hh index 9ecca0d5c..71d2fd18f 100644 --- a/include/maxscale/dcb.hh +++ b/include/maxscale/dcb.hh @@ -36,7 +36,7 @@ MXS_BEGIN_DECLS struct session; struct server; -struct dcb; +struct DCB; #define DCBFD_CLOSED -1 @@ -141,7 +141,7 @@ typedef enum typedef struct dcb_callback { DCB_REASON reason; /*< The reason for the callback */ - int (* cb)(struct dcb* dcb, DCB_REASON reason, void* userdata); + int (* cb)(DCB* dcb, DCB_REASON reason, void* userdata); void* userdata; /*< User data to be sent in the callback */ struct dcb_callback* next; /*< Next callback for this DCB */ } DCB_CALLBACK; @@ -172,7 +172,7 @@ typedef enum * Note that the first few fields (up to and including "entry_is_ready") must * precisely match the LIST_ENTRY structure defined in the list manager. */ -typedef struct dcb +struct DCB { MXB_POLL_DATA poll; bool dcb_errhandle_called; /*< this can be called only once */ @@ -202,9 +202,9 @@ typedef struct dcb GWBUF* fakeq; /**< Fake event queue for generated events */ uint32_t fake_event; /**< Fake event to be delivered to handler */ - DCBSTATS stats; /**< DCB related statistics */ - struct dcb* nextpersistent; /**< Next DCB in the persistent pool for SERVER */ - time_t persistentstart; /**< 0: Not in the persistent pool. + DCBSTATS stats; /**< DCB related statistics */ + DCB* nextpersistent; /**< Next DCB in the persistent pool for SERVER */ + time_t persistentstart; /**< 0: Not in the persistent pool. * -1: Evicted from the persistent pool and being closed. * non-0: Time when placed in the persistent pool. */ @@ -224,12 +224,12 @@ typedef struct dcb * throttle */ struct { - struct dcb* next; /**< Next DCB in owning thread's list */ - struct dcb* tail; /**< Last DCB in owning thread's list */ + DCB* next; /**< Next DCB in owning thread's list */ + DCB* tail; /**< Last DCB in owning thread's list */ } thread; uint32_t n_close; /** How many times dcb_close has been called. */ char* path; /** If a Unix socket, the path it was bound to. */ -} DCB; +}; /** * The DCB usage filer used for returning DCB's in use for a certain reason @@ -292,8 +292,8 @@ void dListDCBs(DCB*); void dListClients(DCB*); /* List al the client DCBs */ const char* gw_dcb_state2string(dcb_state_t); /* DCB state to string */ void dcb_printf(DCB*, const char*, ...) __attribute__ ((format(printf, 2, 3))); /* DCB version of printf */ -int dcb_add_callback(DCB*, DCB_REASON, int (*)(struct dcb*, DCB_REASON, void*), void*); -int dcb_remove_callback(DCB*, DCB_REASON, int (*)(struct dcb*, DCB_REASON, void*), void*); +int dcb_add_callback(DCB*, DCB_REASON, int (*)(DCB*, DCB_REASON, void*), void*); +int dcb_remove_callback(DCB*, DCB_REASON, int (*)(DCB*, DCB_REASON, void*), void*); int dcb_count_by_usage(DCB_USAGE); /* Return counts of DCBs */ int dcb_persistent_clean_count(DCB*, int, bool); /* Clean persistent and return count */ void dcb_hangup_foreach(struct server* server); diff --git a/include/maxscale/listener.hh b/include/maxscale/listener.hh index 1ffc71920..cf018bfc0 100644 --- a/include/maxscale/listener.hh +++ b/include/maxscale/listener.hh @@ -24,7 +24,7 @@ #include #include -struct dcb; +struct DCB; class SERVICE; class Listener; @@ -196,7 +196,7 @@ private: std::string m_auth_options; /**< Authenticator options */ void* m_auth_instance; /**< Authenticator instance */ SSL_LISTENER* m_ssl; /**< Structure of SSL data or NULL */ - struct dcb* m_listener; /**< The DCB for the listener */ + DCB* m_listener; /**< The DCB for the listener */ struct users* m_users; /**< The user data for this listener */ SERVICE* m_service; /**< The service which used by this listener */ std::atomic m_active; /**< True if the port has not been deleted */ diff --git a/include/maxscale/protocol.h b/include/maxscale/protocol.h index 98f4c98aa..105447462 100644 --- a/include/maxscale/protocol.h +++ b/include/maxscale/protocol.h @@ -24,7 +24,7 @@ MXS_BEGIN_DECLS -struct dcb; +struct DCB; struct server; struct session; @@ -40,7 +40,7 @@ typedef struct mxs_protocol * * @return 1 on success, 0 on error */ - int32_t (* read)(struct dcb* dcb); + int32_t (* read)(DCB* dcb); /** * Write data to a network socket @@ -50,7 +50,7 @@ typedef struct mxs_protocol * * @return 1 on success, 0 on error */ - int32_t (* write)(struct dcb* dcb, GWBUF* buffer); + int32_t (* write)(DCB* dcb, GWBUF* buffer); /** * EPOLLOUT handler, used to write buffered data @@ -61,7 +61,7 @@ typedef struct mxs_protocol * * @note Currently the return value is ignored */ - int32_t (* write_ready)(struct dcb* dcb); + int32_t (* write_ready)(DCB* dcb); /** * EPOLLERR handler @@ -72,7 +72,7 @@ typedef struct mxs_protocol * * @note Currently the return value is ignored */ - int32_t (* error)(struct dcb* dcb); + int32_t (* error)(DCB* dcb); /** * EPOLLHUP and EPOLLRDHUP handler @@ -83,7 +83,7 @@ typedef struct mxs_protocol * * @note Currently the return value is ignored */ - int32_t (* hangup)(struct dcb* dcb); + int32_t (* hangup)(DCB* dcb); /** * Accept a connection, only for client side protocol modules @@ -94,7 +94,7 @@ typedef struct mxs_protocol * * @note Currently the return value is ignored */ - int32_t (* accept)(struct dcb* dcb); + int32_t (* accept)(DCB* dcb); /** * Connect to a server, only for backend side protocol modules @@ -105,7 +105,7 @@ typedef struct mxs_protocol * * @return The opened file descriptor or DCBFD_CLOSED on error */ - int32_t (* connect)(struct dcb* dcb, struct server* server, struct session* session); + int32_t (* connect)(DCB* dcb, struct server* server, struct session* session); /** * Free protocol data allocated in the connect handler @@ -116,7 +116,7 @@ typedef struct mxs_protocol * * @note Currently the return value is ignored */ - int32_t (* close)(struct dcb* dcb); + int32_t (* close)(DCB* dcb); /** * Perform user re-authentication @@ -130,7 +130,7 @@ typedef struct mxs_protocol * * @note Currently the return value is ignored */ - int32_t (* auth)(struct dcb* dcb, struct server* server, struct session* session, GWBUF* buffer); + int32_t (* auth)(DCB* dcb, struct server* server, struct session* session, GWBUF* buffer); /** * Returns the name of the default authenticator module for this protocol @@ -149,7 +149,7 @@ typedef struct mxs_protocol * * @note Currently the return value is ignored */ - int32_t (* connlimit)(struct dcb* dcb, int limit); + int32_t (* connlimit)(DCB* dcb, int limit); /** * Check if the connection has been fully established, used by connection pooling @@ -158,7 +158,7 @@ typedef struct mxs_protocol * * @return True if the connection is fully established and can be pooled */ - bool (* established)(struct dcb*); + bool (* established)(DCB*); /** * Provide JSON formatted diagnostics about a DCB @@ -167,7 +167,7 @@ typedef struct mxs_protocol * * @return JSON representation of the DCB */ - json_t* (*diagnostics_json)(struct dcb* dcb); + json_t* (*diagnostics_json)(DCB * dcb); } MXS_PROTOCOL; /** diff --git a/include/maxscale/protocol/mysql.h b/include/maxscale/protocol/mysql.h index 85b018357..e81c2c8dd 100644 --- a/include/maxscale/protocol/mysql.h +++ b/include/maxscale/protocol/mysql.h @@ -111,7 +111,7 @@ MXS_BEGIN_DECLS #define GW_NOINTR_CALL(A) do {errno = 0; A;} while (errno == EINTR) #define COM_QUIT_PACKET_SIZE (4 + 1) -struct dcb; +struct DCB; typedef enum { @@ -321,7 +321,7 @@ static const char* const MXS_LAST_GTID = "last_gtid"; typedef struct { int fd; /*< The socket descriptor */ - struct dcb* owner_dcb; /*< The DCB of the socket we are running on */ + DCB* owner_dcb; /*< The DCB of the socket we are running on */ mxs_mysql_cmd_t current_command; /*< Current command being executed */ mxs_auth_state_t protocol_auth_state; /*< Authentication status */ mysql_protocol_state_t protocol_state; /*< Protocol struct status */ diff --git a/include/maxscale/session.hh b/include/maxscale/session.hh index abee0a134..29c961748 100644 --- a/include/maxscale/session.hh +++ b/include/maxscale/session.hh @@ -23,7 +23,7 @@ #include #include -struct dcb; +struct DCB; class SERVICE; struct mxs_filter_def; struct mxs_filter; @@ -207,9 +207,9 @@ typedef char* (* session_variable_handler_t)(void* context, */ typedef struct session { - mxs_session_state_t state; /*< Current descriptor state */ - uint64_t ses_id; /*< Unique session identifier */ - struct dcb* client_dcb; /*< The client connection */ + mxs_session_state_t state; /*< Current descriptor state */ + uint64_t ses_id; /*< Unique session identifier */ + DCB* client_dcb; /*< The client connection */ struct mxs_router_session* router_session; /*< The router instance data */ MXS_SESSION_STATS stats; /*< Session statistics */ @@ -290,7 +290,7 @@ bool session_route_reply(MXS_SESSION* session, GWBUF* buffer); * @param client_dcb The client side DCB * @return The newly created session or NULL if an error occurred */ -MXS_SESSION* session_alloc(SERVICE*, struct dcb*); +MXS_SESSION* session_alloc(SERVICE*, DCB*); /** * A version of session_alloc() which takes the session id number as parameter. @@ -301,9 +301,9 @@ MXS_SESSION* session_alloc(SERVICE*, struct dcb*); * @param id Id for the new session. * @return The newly created session or NULL if an error occurred */ -MXS_SESSION* session_alloc_with_id(SERVICE*, struct dcb*, uint64_t); +MXS_SESSION* session_alloc_with_id(SERVICE*, DCB*, uint64_t); -MXS_SESSION* session_set_dummy(struct dcb*); +MXS_SESSION* session_set_dummy(DCB*); static inline bool session_is_dummy(MXS_SESSION* session) { diff --git a/include/maxscale/ssl.h b/include/maxscale/ssl.h index ceb9d73e1..35623446d 100644 --- a/include/maxscale/ssl.h +++ b/include/maxscale/ssl.h @@ -27,7 +27,7 @@ MXS_BEGIN_DECLS -struct dcb; +struct DCB; typedef enum ssl_method_type { @@ -73,11 +73,11 @@ typedef struct ssl_listener * next; /*< Next SSL configuration, currently used to store obsolete configurations */ } SSL_LISTENER; -int ssl_authenticate_client(struct dcb* dcb, bool is_capable); -bool ssl_is_connection_healthy(struct dcb* dcb); -bool ssl_check_data_to_process(struct dcb* dcb); -bool ssl_required_by_dcb(struct dcb* dcb); -bool ssl_required_but_not_negotiated(struct dcb* dcb); +int ssl_authenticate_client(DCB* dcb, bool is_capable); +bool ssl_is_connection_healthy(DCB* dcb); +bool ssl_check_data_to_process(DCB* dcb); +bool ssl_required_by_dcb(DCB* dcb); +bool ssl_required_but_not_negotiated(DCB* dcb); const char* ssl_method_type_to_string(ssl_method_type_t method_type); ssl_method_type_t string_to_ssl_method_type(const char* str); @@ -91,7 +91,7 @@ ssl_method_type_t string_to_ssl_method_type(const char* str); * if ssl authentication is in progress and should be retried, MXS_AUTH_SSL_COMPLETE * if ssl authentication is complete or not required. */ -int ssl_authenticate_check_status(struct dcb* dcb); +int ssl_authenticate_check_status(DCB* dcb); // TODO: Move this to an internal ssl.h header void write_ssl_config(int fd, SSL_LISTENER* ssl); diff --git a/server/core/dcb.cc b/server/core/dcb.cc index 5892ed74a..c0d43fdd0 100644 --- a/server/core/dcb.cc +++ b/server/core/dcb.cc @@ -1910,7 +1910,7 @@ static int gw_write(DCB* dcb, GWBUF* writeq, bool* stop_writing) */ int dcb_add_callback(DCB* dcb, DCB_REASON reason, - int (* callback)(struct dcb*, DCB_REASON, void*), + int (* callback)(DCB*, DCB_REASON, void*), void* userdata) { DCB_CALLBACK* cb, * ptr, * lastcb = NULL; @@ -1963,7 +1963,7 @@ int dcb_add_callback(DCB* dcb, */ int dcb_remove_callback(DCB* dcb, DCB_REASON reason, - int (* callback)(struct dcb*, DCB_REASON, void*), + int (* callback)(DCB*, DCB_REASON, void*), void* userdata) { DCB_CALLBACK* cb, * pcb = NULL;