reindented source files

pull/8/head
Joseph Mocker 2012-07-26 07:45:39 -07:00
parent eb3e38116c
commit 60f1b8e6d7
2 changed files with 1253 additions and 1253 deletions

View File

@ -29,8 +29,8 @@
* Will write into buff the date prefix for txt formatter. Return the number of bytes written * Will write into buff the date prefix for txt formatter. Return the number of bytes written
* (not including null terminate). * (not including null terminate).
*/ */
static int log_date_prefix(char * buff, size_t buff_size) static int log_date_prefix(char * buff, size_t buff_size)
{ {
struct tm tm_tmp; struct tm tm_tmp;
time_t result= time(NULL); time_t result= time(NULL);
localtime_r(&result, &tm_tmp); localtime_r(&result, &tm_tmp);
@ -42,10 +42,10 @@ static int log_date_prefix(char * buff, size_t buff_size)
tm_tmp.tm_hour, tm_tmp.tm_hour,
tm_tmp.tm_min, tm_tmp.tm_min,
tm_tmp.tm_sec); tm_tmp.tm_sec);
} }
//utility macro to log also with a date as a prefix //utility macro to log also with a date as a prefix
#define log_with_date(f, ...) do{\ #define log_with_date(f, ...) do{\
struct tm tm_tmp;\ struct tm tm_tmp;\
time_t result= time(NULL);\ time_t result= time(NULL);\
@ -58,29 +58,29 @@ static int log_date_prefix(char * buff, size_t buff_size)
tm_tmp.tm_min,\ tm_tmp.tm_min,\
tm_tmp.tm_sec);\ tm_tmp.tm_sec);\
fprintf(f, __VA_ARGS__);\ fprintf(f, __VA_ARGS__);\
}while(0) }while(0)
//initialize static stuff //initialize static stuff
ThdOffsets Audit_formatter::thd_offsets = { 0 }; ThdOffsets Audit_formatter::thd_offsets = { 0 };
Audit_handler * Audit_handler::m_audit_handler_list[Audit_handler::MAX_AUDIT_HANDLERS_NUM]; Audit_handler * Audit_handler::m_audit_handler_list[Audit_handler::MAX_AUDIT_HANDLERS_NUM];
const char * Audit_json_formatter::DEF_MSG_DELIMITER = "\\n"; const char * Audit_json_formatter::DEF_MSG_DELIMITER = "\\n";
#define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1)) #define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1))
const char * Audit_formatter::retrive_object_type (TABLE_LIST *pObj) const char * Audit_formatter::retrive_object_type (TABLE_LIST *pObj)
{ {
if (pObj->view) if (pObj->view)
{ {
return "VIEW"; return "VIEW";
} }
return "TABLE"; return "TABLE";
} }
void Audit_handler::stop_all() void Audit_handler::stop_all()
{ {
for (int i = 0; i < MAX_AUDIT_HANDLERS_NUM; ++i) for (int i = 0; i < MAX_AUDIT_HANDLERS_NUM; ++i)
{ {
if (m_audit_handler_list[i] != NULL) if (m_audit_handler_list[i] != NULL)
@ -88,10 +88,10 @@ void Audit_handler::stop_all()
m_audit_handler_list[i]->set_enable(false); m_audit_handler_list[i]->set_enable(false);
} }
} }
} }
void Audit_handler::log_audit_all(ThdSesData *pThdData) void Audit_handler::log_audit_all(ThdSesData *pThdData)
{ {
for (int i = 0; i < MAX_AUDIT_HANDLERS_NUM; ++i) for (int i = 0; i < MAX_AUDIT_HANDLERS_NUM; ++i)
{ {
if (m_audit_handler_list[i] != NULL) if (m_audit_handler_list[i] != NULL)
@ -99,10 +99,10 @@ void Audit_handler::log_audit_all(ThdSesData *pThdData)
m_audit_handler_list[i]->log_audit(pThdData); m_audit_handler_list[i]->log_audit(pThdData);
} }
} }
} }
void Audit_handler::set_enable(bool val) void Audit_handler::set_enable(bool val)
{ {
lock_exclusive(); lock_exclusive();
if (m_enabled == val) //we are already enabled simply return if (m_enabled == val) //we are already enabled simply return
{ {
@ -121,10 +121,10 @@ void Audit_handler::set_enable(bool val)
handler_stop(); handler_stop();
} }
unlock(); unlock();
} }
void Audit_handler::log_audit(ThdSesData *pThdData) void Audit_handler::log_audit(ThdSesData *pThdData)
{ {
lock_shared(); lock_shared();
if (!m_enabled) if (!m_enabled)
{ {

View File

@ -26,7 +26,7 @@
#if !defined(__attribute__) && !defined(__GNUC__) #if !defined(__attribute__) && !defined(__GNUC__)
#define __attribute__(A) #define __attribute__(A)
#endif #endif
*/ */
@ -34,7 +34,7 @@
#ifdef __x86_64__ #ifdef __x86_64__
//64 bit offsets //64 bit offsets
static const ThdOffsets thd_offsets_arr[] = static const ThdOffsets thd_offsets_arr[] =
{ {
//DISTRIBUTION: rpm //DISTRIBUTION: rpm
//offsets for: mysqlrpm/5.1.30/usr/sbin/mysqld (5.1.30-community) //offsets for: mysqlrpm/5.1.30/usr/sbin/mysqld (5.1.30-community)
{"5.1.30-community","8e43bda3644a883d46a1d064304b4f1d", 6184, 6248, 3656, 3928, 88, 2048}, {"5.1.30-community","8e43bda3644a883d46a1d064304b4f1d", 6184, 6248, 3656, 3928, 88, 2048},
@ -233,12 +233,12 @@ static const ThdOffsets thd_offsets_arr[] =
//offsets for: mysql/5.5.21/bin/mysqld (5.5.21) //offsets for: mysql/5.5.21/bin/mysqld (5.5.21)
{"5.5.21","66d23cb577e2bcfe29da08833f5e7d8b", 6048, 6096, 3800, 4224, 88, 2560} {"5.5.21","66d23cb577e2bcfe29da08833f5e7d8b", 6048, 6096, 3800, 4224, 88, 2560}
}; };
#else #else
//32 bit offsets //32 bit offsets
static const ThdOffsets thd_offsets_arr[] = static const ThdOffsets thd_offsets_arr[] =
{ {
//DISTRIBUTION: rpm //DISTRIBUTION: rpm
//offsets for: mysqlrpm/5.1.30/usr/sbin/mysqld (5.1.30-community) //offsets for: mysqlrpm/5.1.30/usr/sbin/mysqld (5.1.30-community)
{"5.1.30-community","fdfe108d05c262c185a7c28b2e493c10", 4024, 4064, 2224, 2404, 44, 1180}, {"5.1.30-community","fdfe108d05c262c185a7c28b2e493c10", 4024, 4064, 2224, 2404, 44, 1180},
@ -433,7 +433,7 @@ static const ThdOffsets thd_offsets_arr[] =
{"5.5.20","cb9b6887ea525fe9965121d357163fe4", 3808, 3836, 2360, 2692, 44, 1640}, {"5.5.20","cb9b6887ea525fe9965121d357163fe4", 3808, 3836, 2360, 2692, 44, 1640},
//offsets for: mysql/5.5.21/bin/mysqld (5.5.21) //offsets for: mysql/5.5.21/bin/mysqld (5.5.21)
{"5.5.21","a0762cee3ad5d4e77480956144900213", 3808, 3836, 2360, 2692, 44, 1640} {"5.5.21","a0762cee3ad5d4e77480956144900213", 3808, 3836, 2360, 2692, 44, 1640}
}; };
#endif #endif
@ -470,7 +470,7 @@ static unsigned int trampoline_mysql_execute_size =0;
static void trampoline_log_slow_statement(THD *thd) static void trampoline_log_slow_statement(THD *thd)
{ {
TRAMPOLINE_NOP_DEF TRAMPOLINE_NOP_DEF
} }
static unsigned int trampoline_log_slow_statement_size =0; static unsigned int trampoline_log_slow_statement_size =0;
static int trampoline_check_user(THD *thd, enum enum_server_command command, const char *passwd, uint passwd_len, const char *db, bool check_count) static int trampoline_check_user(THD *thd, enum enum_server_command command, const char *passwd, uint passwd_len, const char *db, bool check_count)
@ -488,13 +488,13 @@ static unsigned int trampoline_acl_authenticate_size =0;
static MYSQL_THDVAR_ULONG(is_thd_printed_list, static MYSQL_THDVAR_ULONG(is_thd_printed_list,
PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_NOCMDOPT, "avoid duplicate printing", PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_NOCMDOPT, "avoid duplicate printing",
NULL, NULL,0,0, NULL, NULL,0,0,
#ifdef __x86_64__ #ifdef __x86_64__
0xffffffffffffff, 0xffffffffffffff,
#else #else
0xffffffff, 0xffffffff,
#endif #endif
1); 1);
THDPRINTED * GetThdPrintedList (THD *thd) THDPRINTED * GetThdPrintedList (THD *thd)
{ {
THDPRINTED * pThdPrintedList= (THDPRINTED*)THDVAR(thd,is_thd_printed_list); THDPRINTED * pThdPrintedList= (THDPRINTED*)THDVAR(thd,is_thd_printed_list);
@ -504,7 +504,7 @@ THDPRINTED * GetThdPrintedList (THD *thd)
} }
THDVAR(thd,is_thd_printed_list) =0; THDVAR(thd,is_thd_printed_list) =0;
return NULL; return NULL;
} }
static void audit(ThdSesData *pThdData) static void audit(ThdSesData *pThdData)
{ {
@ -573,17 +573,17 @@ static int trampoline_open_tables(THD *thd, TABLE_LIST **start, uint *counter, u
static MYSQL_THDVAR_ULONG(query_cache_table_list, static MYSQL_THDVAR_ULONG(query_cache_table_list,
PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_NOCMDOPT, "Pointer to query cache table list.", PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_NOCMDOPT, "Pointer to query cache table list.",
NULL, NULL,0,0, NULL, NULL,0,0,
#ifdef __x86_64__ #ifdef __x86_64__
0xffffffffffffff, 0xffffffffffffff,
#else #else
0xffffffff, 0xffffffff,
#endif #endif
1); 1);
QueryTableInf * Audit_formatter::getQueryCacheTableList1 (THD *thd) QueryTableInf * Audit_formatter::getQueryCacheTableList1 (THD *thd)
{ {
return (QueryTableInf*) THDVAR(thd, query_cache_table_list); return (QueryTableInf*) THDVAR(thd, query_cache_table_list);
@ -683,14 +683,14 @@ static void audit_notify(THD *thd , const struct mysql_event * event)
/* /*
Plugin descriptor Plugin descriptor
*/ */
//in 5.5 we use the AUDIT plugin interface. In 5.1 we just use the general DAEMON plugin //in 5.5 we use the AUDIT plugin interface. In 5.1 we just use the general DAEMON plugin
static int plugin_type = MYSQL_DAEMON_PLUGIN; static int plugin_type = MYSQL_DAEMON_PLUGIN;
static struct st_mysql_daemon audit_plugin = static struct st_mysql_daemon audit_plugin =
{ MYSQL_DAEMON_INTERFACE_VERSION }; { MYSQL_DAEMON_INTERFACE_VERSION };
@ -753,7 +753,7 @@ void remove_hot_functions ()
} }
int is_remove_patches (ThdSesData *pThdData) int is_remove_patches (ThdSesData *pThdData)
{ {
const char *cmd = pThdData->getCmdName(); const char *cmd = pThdData->getCmdName();
@ -1118,7 +1118,7 @@ const char * retrieve_command (THD * thd)
cmd = "Failed Login"; cmd = "Failed Login";
} }
return cmd; return cmd;
} }
static int set_com_status_vars_array () static int set_com_status_vars_array ()
{ {
@ -1170,7 +1170,7 @@ static int set_com_status_vars_array ()
RETURN VALUE RETURN VALUE
0 success 0 success
1 failure 1 failure
*/ */
static int audit_plugin_init(void *p) static int audit_plugin_init(void *p)
{ {
@ -1366,7 +1366,7 @@ static int audit_plugin_init(void *p)
0 success 0 success
1 failure (cannot happen) 1 failure (cannot happen)
*/ */
static int audit_plugin_deinit(void *p) static int audit_plugin_deinit(void *p)
{ {
@ -1378,17 +1378,17 @@ static int audit_plugin_deinit(void *p)
/* /*
Plugin status variables for SHOW STATUS Plugin status variables for SHOW STATUS
*/ */
static struct st_mysql_show_var audit_status[] = static struct st_mysql_show_var audit_status[] =
{ {
{ "AUDIT_version", { "AUDIT_version",
(char *) MYSQL_AUDIT_PLUGIN_VERSION "-" MYSQL_AUDIT_PLUGIN_REVISION, (char *) MYSQL_AUDIT_PLUGIN_VERSION "-" MYSQL_AUDIT_PLUGIN_REVISION,
SHOW_CHAR }, SHOW_CHAR },
{ "AUDIT_protocol_version", { "AUDIT_protocol_version",
(char *) "1.0", (char *) "1.0",
SHOW_CHAR }, SHOW_CHAR },
//{"called", (char *)&number_of_calls, SHOW_LONG}, //{"called", (char *)&number_of_calls, SHOW_LONG},
{ 0, 0, (enum_mysql_show_type) 0 } }; { 0, 0, (enum_mysql_show_type) 0 } };
@ -1521,7 +1521,7 @@ static MYSQL_SYSVAR_STR(delay_cmds, delay_cmds_string,
* Plugin system vars * Plugin system vars
*/ */
static struct st_mysql_sys_var* audit_system_variables[] = static struct st_mysql_sys_var* audit_system_variables[] =
{ {
MYSQL_SYSVAR(json_log_file), MYSQL_SYSVAR(json_log_file),
MYSQL_SYSVAR(json_file_sync), MYSQL_SYSVAR(json_file_sync),
MYSQL_SYSVAR(json_file), MYSQL_SYSVAR(json_file),
@ -1551,7 +1551,7 @@ mysql_declare_plugin(audit_plugin)
audit_status, /* status variables */ audit_status, /* status variables */
audit_system_variables, /* system variables */ audit_system_variables, /* system variables */
NULL /* config options */ NULL /* config options */
} }
mysql_declare_plugin_end; mysql_declare_plugin_end;
#if MYSQL_VERSION_ID < 50505 #if MYSQL_VERSION_ID < 50505