MXS-2196: Rename struct dcb to struct DCB

Renamed the DCB struct and removed the typedef.
This commit is contained in:
Markus Mäkelä 2018-11-30 14:52:07 +02:00
parent ad12ff6d06
commit e365b97c6e
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
8 changed files with 51 additions and 51 deletions

View File

@ -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 */

View File

@ -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);

View File

@ -24,7 +24,7 @@
#include <maxscale/ssl.h>
#include <maxscale/service.hh>
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<bool> m_active; /**< True if the port has not been deleted */

View File

@ -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;
/**

View File

@ -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 */

View File

@ -23,7 +23,7 @@
#include <maxscale/log.h>
#include <maxscale/utils.hh>
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)
{

View File

@ -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);

View File

@ -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;