Function declarations changed to common Maxscale style.
This commit is contained in:
@ -258,8 +258,7 @@ typedef struct strpart
|
|||||||
|
|
||||||
/** Static function declarations */
|
/** Static function declarations */
|
||||||
static bool logfiles_init(logmanager_t* lmgr);
|
static bool logfiles_init(logmanager_t* lmgr);
|
||||||
static bool logfile_init(
|
static bool logfile_init(logfile_t* logfile,
|
||||||
logfile_t* logfile,
|
|
||||||
logfile_id_t logfile_id,
|
logfile_id_t logfile_id,
|
||||||
logmanager_t* logmanager,
|
logmanager_t* logmanager,
|
||||||
bool store_shmem,
|
bool store_shmem,
|
||||||
@ -272,8 +271,7 @@ static bool logfile_create(logfile_t* lf);
|
|||||||
static bool logfile_open_file(filewriter_t* fw, logfile_t* lf);
|
static bool logfile_open_file(filewriter_t* fw, logfile_t* lf);
|
||||||
static char* form_full_file_name(strpart_t* parts, logfile_t* lf, int seqnoidx);
|
static char* form_full_file_name(strpart_t* parts, logfile_t* lf, int seqnoidx);
|
||||||
|
|
||||||
static bool filewriter_init(
|
static bool filewriter_init(logmanager_t* logmanager,
|
||||||
logmanager_t* logmanager,
|
|
||||||
filewriter_t* fw,
|
filewriter_t* fw,
|
||||||
skygw_message_t* clientmes,
|
skygw_message_t* clientmes,
|
||||||
skygw_message_t* logmes);
|
skygw_message_t* logmes);
|
||||||
@ -290,8 +288,7 @@ static void logmanager_unregister(void);
|
|||||||
static bool logmanager_init_nomutex(int argc, char* argv[]);
|
static bool logmanager_init_nomutex(int argc, char* argv[]);
|
||||||
static void logmanager_done_nomutex(void);
|
static void logmanager_done_nomutex(void);
|
||||||
|
|
||||||
static int logmanager_write_log(
|
static int logmanager_write_log(logfile_id_t id,
|
||||||
logfile_id_t id,
|
|
||||||
bool flush,
|
bool flush,
|
||||||
bool use_valist,
|
bool use_valist,
|
||||||
bool spread_down,
|
bool spread_down,
|
||||||
@ -302,8 +299,7 @@ static int logmanager_write_log(
|
|||||||
|
|
||||||
static blockbuf_t* blockbuf_init(logfile_id_t id);
|
static blockbuf_t* blockbuf_init(logfile_id_t id);
|
||||||
static void blockbuf_node_done(void* bb_data);
|
static void blockbuf_node_done(void* bb_data);
|
||||||
static char* blockbuf_get_writepos(
|
static char* blockbuf_get_writepos(blockbuf_t** p_bb,
|
||||||
blockbuf_t** p_bb,
|
|
||||||
logfile_id_t id,
|
logfile_id_t id,
|
||||||
size_t str_len,
|
size_t str_len,
|
||||||
bool flush);
|
bool flush);
|
||||||
@ -313,8 +309,7 @@ static void blockbuf_unregister(blockbuf_t* bb);
|
|||||||
static bool logfile_set_enabled(logfile_id_t id, bool val);
|
static bool logfile_set_enabled(logfile_id_t id, bool val);
|
||||||
static char* add_slash(char* str);
|
static char* add_slash(char* str);
|
||||||
|
|
||||||
static bool check_file_and_path(
|
static bool check_file_and_path(char* filename,
|
||||||
char* filename,
|
|
||||||
bool* writable,
|
bool* writable,
|
||||||
bool do_log);
|
bool do_log);
|
||||||
|
|
||||||
@ -374,9 +369,7 @@ const char* get_logpath_default(void)
|
|||||||
return "/var/log/maxscale";
|
return "/var/log/maxscale";
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool logmanager_init_nomutex(
|
static bool logmanager_init_nomutex(int argc, char* argv[])
|
||||||
int argc,
|
|
||||||
char* argv[])
|
|
||||||
{
|
{
|
||||||
fnames_conf_t* fn;
|
fnames_conf_t* fn;
|
||||||
filewriter_t* fw;
|
filewriter_t* fw;
|
||||||
@ -498,9 +491,7 @@ return_succp:
|
|||||||
* @return true if succeed, otherwise false
|
* @return true if succeed, otherwise false
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool skygw_logmanager_init(
|
bool skygw_logmanager_init(int argc, char* argv[])
|
||||||
int argc,
|
|
||||||
char* argv[])
|
|
||||||
{
|
{
|
||||||
bool succp = false;
|
bool succp = false;
|
||||||
|
|
||||||
@ -658,8 +649,7 @@ static logfile_t* logmanager_get_logfile(
|
|||||||
* @return 0 if succeed, -1 otherwise
|
* @return 0 if succeed, -1 otherwise
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int logmanager_write_log(
|
static int logmanager_write_log(logfile_id_t id,
|
||||||
logfile_id_t id,
|
|
||||||
bool flush,
|
bool flush,
|
||||||
bool use_valist,
|
bool use_valist,
|
||||||
bool spread_down,
|
bool spread_down,
|
||||||
@ -955,8 +945,7 @@ return_err:
|
|||||||
*
|
*
|
||||||
* @param bb block buffer
|
* @param bb block buffer
|
||||||
*/
|
*/
|
||||||
static void blockbuf_register(
|
static void blockbuf_register(blockbuf_t* bb)
|
||||||
blockbuf_t* bb)
|
|
||||||
{
|
{
|
||||||
CHK_BLOCKBUF(bb);
|
CHK_BLOCKBUF(bb);
|
||||||
ss_dassert(bb->bb_refcount >= 0);
|
ss_dassert(bb->bb_refcount >= 0);
|
||||||
@ -969,8 +958,7 @@ static void blockbuf_register(
|
|||||||
*
|
*
|
||||||
* @param bb block buffer
|
* @param bb block buffer
|
||||||
*/
|
*/
|
||||||
static void blockbuf_unregister(
|
static void blockbuf_unregister(blockbuf_t* bb)
|
||||||
blockbuf_t* bb)
|
|
||||||
{
|
{
|
||||||
logfile_t* lf;
|
logfile_t* lf;
|
||||||
|
|
||||||
@ -1008,8 +996,7 @@ static void blockbuf_unregister(
|
|||||||
* mutex.
|
* mutex.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static char* blockbuf_get_writepos(
|
static char* blockbuf_get_writepos(blockbuf_t** p_bb,
|
||||||
blockbuf_t** p_bb,
|
|
||||||
logfile_id_t id,
|
logfile_id_t id,
|
||||||
size_t str_len,
|
size_t str_len,
|
||||||
bool flush)
|
bool flush)
|
||||||
@ -1265,16 +1252,14 @@ static char* blockbuf_get_writepos(
|
|||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void blockbuf_node_done(
|
static void blockbuf_node_done(void* bb_data)
|
||||||
void* bb_data)
|
|
||||||
{
|
{
|
||||||
blockbuf_t* bb = (blockbuf_t *)bb_data;
|
blockbuf_t* bb = (blockbuf_t *)bb_data;
|
||||||
simple_mutex_done(&bb->bb_mutex);
|
simple_mutex_done(&bb->bb_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static blockbuf_t* blockbuf_init(
|
static blockbuf_t* blockbuf_init(logfile_id_t id)
|
||||||
logfile_id_t id)
|
|
||||||
{
|
{
|
||||||
blockbuf_t* bb;
|
blockbuf_t* bb;
|
||||||
|
|
||||||
@ -1303,8 +1288,7 @@ static blockbuf_t* blockbuf_init(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int skygw_log_enable(
|
int skygw_log_enable(logfile_id_t id)
|
||||||
logfile_id_t id)
|
|
||||||
{
|
{
|
||||||
bool err = 0;
|
bool err = 0;
|
||||||
|
|
||||||
@ -1329,8 +1313,7 @@ return_err:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int skygw_log_disable(
|
int skygw_log_disable(logfile_id_t id) /*< no locking */
|
||||||
logfile_id_t id) /*< no locking */
|
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@ -1562,8 +1545,7 @@ static int log_write(logfile_id_t id,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
int skygw_log_write_context_flush(
|
int skygw_log_write_context_flush(logfile_id_t id,
|
||||||
logfile_id_t id,
|
|
||||||
const char* file,
|
const char* file,
|
||||||
int line,
|
int line,
|
||||||
const char* function,
|
const char* function,
|
||||||
@ -1604,8 +1586,7 @@ int skygw_log_write_context_flush(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int skygw_log_write_context(
|
int skygw_log_write_context(logfile_id_t id,
|
||||||
logfile_id_t id,
|
|
||||||
const char* file,
|
const char* file,
|
||||||
int line,
|
int line,
|
||||||
const char* function,
|
const char* function,
|
||||||
@ -1645,8 +1626,7 @@ int skygw_log_write_context(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int skygw_log_flush(
|
int skygw_log_flush(logfile_id_t id)
|
||||||
logfile_id_t id)
|
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
va_list valist; /**< Dummy, must be present but it is not processed */
|
va_list valist; /**< Dummy, must be present but it is not processed */
|
||||||
@ -1676,8 +1656,7 @@ return_err:
|
|||||||
* Replace current logfile with new file with increased sequence number on
|
* Replace current logfile with new file with increased sequence number on
|
||||||
* its name.
|
* its name.
|
||||||
*/
|
*/
|
||||||
int skygw_log_rotate(
|
int skygw_log_rotate(logfile_id_t id)
|
||||||
logfile_id_t id)
|
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
logfile_t* lf;
|
logfile_t* lf;
|
||||||
@ -1739,8 +1718,7 @@ return_err:
|
|||||||
* @details Link count modify is protected by mutex.
|
* @details Link count modify is protected by mutex.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static bool logmanager_register(
|
static bool logmanager_register(bool writep)
|
||||||
bool writep)
|
|
||||||
{
|
{
|
||||||
bool succp = true;
|
bool succp = true;
|
||||||
|
|
||||||
@ -1839,8 +1817,7 @@ static void logmanager_unregister(void)
|
|||||||
* @details Note that input parameter lenghts are checked here.
|
* @details Note that input parameter lenghts are checked here.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static bool fnames_conf_init(
|
static bool fnames_conf_init(fnames_conf_t* fn,
|
||||||
fnames_conf_t* fn,
|
|
||||||
int argc,
|
int argc,
|
||||||
char* argv[])
|
char* argv[])
|
||||||
{
|
{
|
||||||
@ -2013,8 +1990,7 @@ return_conf_init:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static char* fname_conf_get_prefix(
|
static char* fname_conf_get_prefix(fnames_conf_t* fn,
|
||||||
fnames_conf_t* fn,
|
|
||||||
logfile_id_t id)
|
logfile_id_t id)
|
||||||
{
|
{
|
||||||
CHK_FNAMES_CONF(fn);
|
CHK_FNAMES_CONF(fn);
|
||||||
@ -2043,8 +2019,7 @@ static char* fname_conf_get_prefix(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* fname_conf_get_suffix(
|
static char* fname_conf_get_suffix(fnames_conf_t* fn,
|
||||||
fnames_conf_t* fn,
|
|
||||||
logfile_id_t id)
|
logfile_id_t id)
|
||||||
{
|
{
|
||||||
CHK_FNAMES_CONF(fn);
|
CHK_FNAMES_CONF(fn);
|
||||||
@ -2157,8 +2132,7 @@ static bool logfiles_init(
|
|||||||
return succp;
|
return succp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void logfile_flush(
|
static void logfile_flush(logfile_t* lf)
|
||||||
logfile_t* lf)
|
|
||||||
{
|
{
|
||||||
CHK_LOGFILE(lf);
|
CHK_LOGFILE(lf);
|
||||||
acquire_lock(&lf->lf_spinlock);
|
acquire_lock(&lf->lf_spinlock);
|
||||||
@ -2173,8 +2147,7 @@ static void logfile_flush(
|
|||||||
*
|
*
|
||||||
* @param lf logfile pointer
|
* @param lf logfile pointer
|
||||||
*/
|
*/
|
||||||
static void logfile_rotate(
|
static void logfile_rotate(logfile_t* lf)
|
||||||
logfile_t* lf)
|
|
||||||
{
|
{
|
||||||
CHK_LOGFILE(lf);
|
CHK_LOGFILE(lf);
|
||||||
acquire_lock(&lf->lf_spinlock);
|
acquire_lock(&lf->lf_spinlock);
|
||||||
@ -2196,8 +2169,7 @@ static void logfile_rotate(
|
|||||||
* using log manager in parallel with multiple processes and by configuring
|
* using log manager in parallel with multiple processes and by configuring
|
||||||
* log manager to use same directories among those processes.
|
* log manager to use same directories among those processes.
|
||||||
*/
|
*/
|
||||||
static bool logfile_create(
|
static bool logfile_create(logfile_t* lf)
|
||||||
logfile_t* lf)
|
|
||||||
{
|
{
|
||||||
bool namecreatefail;
|
bool namecreatefail;
|
||||||
bool nameconflicts;
|
bool nameconflicts;
|
||||||
@ -2337,8 +2309,7 @@ return_succp:
|
|||||||
* false if failed.
|
* false if failed.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static bool logfile_open_file(
|
static bool logfile_open_file(filewriter_t* fw,
|
||||||
filewriter_t* fw,
|
|
||||||
logfile_t* lf)
|
logfile_t* lf)
|
||||||
{
|
{
|
||||||
bool succp;
|
bool succp;
|
||||||
@ -2428,8 +2399,7 @@ return_succp:
|
|||||||
* @return Pointer to filename, of NULL if failed.
|
* @return Pointer to filename, of NULL if failed.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static char* form_full_file_name(
|
static char* form_full_file_name(strpart_t* parts,
|
||||||
strpart_t* parts,
|
|
||||||
logfile_t* lf,
|
logfile_t* lf,
|
||||||
int seqnoidx)
|
int seqnoidx)
|
||||||
{
|
{
|
||||||
@ -2545,8 +2515,7 @@ return_filename:
|
|||||||
* @details (write detailed description here)
|
* @details (write detailed description here)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static char* add_slash(
|
static char* add_slash(char* str)
|
||||||
char* str)
|
|
||||||
{
|
{
|
||||||
char* p = str;
|
char* p = str;
|
||||||
size_t plen = strlen(p);
|
size_t plen = strlen(p);
|
||||||
@ -2581,8 +2550,7 @@ static char* add_slash(
|
|||||||
* TODO: recall what was the reason for not succeeding with simply
|
* TODO: recall what was the reason for not succeeding with simply
|
||||||
* calling access, and fstat. vraa 26.11.13
|
* calling access, and fstat. vraa 26.11.13
|
||||||
*/
|
*/
|
||||||
static bool check_file_and_path(
|
static bool check_file_and_path(char* filename,
|
||||||
char* filename,
|
|
||||||
bool* writable,
|
bool* writable,
|
||||||
bool do_log)
|
bool do_log)
|
||||||
{
|
{
|
||||||
@ -2655,8 +2623,7 @@ static bool check_file_and_path(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static bool file_is_symlink(
|
static bool file_is_symlink(char* filename)
|
||||||
char* filename)
|
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
bool succp = false;
|
bool succp = false;
|
||||||
@ -2689,8 +2656,7 @@ static bool file_is_symlink(
|
|||||||
*
|
*
|
||||||
* @return true if succeed, false otherwise
|
* @return true if succeed, false otherwise
|
||||||
*/
|
*/
|
||||||
static bool logfile_init(
|
static bool logfile_init(logfile_t* logfile,
|
||||||
logfile_t* logfile,
|
|
||||||
logfile_id_t logfile_id,
|
logfile_id_t logfile_id,
|
||||||
logmanager_t* logmanager,
|
logmanager_t* logmanager,
|
||||||
bool store_shmem,
|
bool store_shmem,
|
||||||
@ -2823,8 +2789,7 @@ return_with_succp:
|
|||||||
* flag read/write. Lock would be held during log write operation by clients.
|
* flag read/write. Lock would be held during log write operation by clients.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void logfile_done(
|
static void logfile_done(logfile_t* lf)
|
||||||
logfile_t* lf)
|
|
||||||
{
|
{
|
||||||
switch(lf->lf_state)
|
switch(lf->lf_state)
|
||||||
{
|
{
|
||||||
@ -2870,8 +2835,7 @@ static void logfile_free_memory(
|
|||||||
* @return true if succeed, false if failed
|
* @return true if succeed, false if failed
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static bool filewriter_init(
|
static bool filewriter_init(logmanager_t* logmanager,
|
||||||
logmanager_t* logmanager,
|
|
||||||
filewriter_t* fw,
|
filewriter_t* fw,
|
||||||
skygw_message_t* clientmes,
|
skygw_message_t* clientmes,
|
||||||
skygw_message_t* logmes)
|
skygw_message_t* logmes)
|
||||||
@ -2926,8 +2890,7 @@ return_succp:
|
|||||||
return succp;
|
return succp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void filewriter_done(
|
static void filewriter_done(filewriter_t* fw)
|
||||||
filewriter_t* fw)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
logfile_id_t id;
|
logfile_id_t id;
|
||||||
@ -3003,8 +2966,7 @@ static void filewriter_done(
|
|||||||
* version is even and read is consistent only if version hasn't changed
|
* version is even and read is consistent only if version hasn't changed
|
||||||
* during the read.
|
* during the read.
|
||||||
*/
|
*/
|
||||||
static void* thr_filewriter_fun(
|
static void* thr_filewriter_fun(void* data)
|
||||||
void* data)
|
|
||||||
{
|
{
|
||||||
skygw_thread_t* thr;
|
skygw_thread_t* thr;
|
||||||
filewriter_t* fwr;
|
filewriter_t* fwr;
|
||||||
@ -3237,8 +3199,7 @@ static void* thr_filewriter_fun(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void fnames_conf_done(
|
static void fnames_conf_done(fnames_conf_t* fn)
|
||||||
fnames_conf_t* fn)
|
|
||||||
{
|
{
|
||||||
switch (fn->fn_state)
|
switch (fn->fn_state)
|
||||||
{
|
{
|
||||||
@ -3255,8 +3216,7 @@ static void fnames_conf_done(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void fnames_conf_free_memory(
|
static void fnames_conf_free_memory(fnames_conf_t* fn)
|
||||||
fnames_conf_t* fn)
|
|
||||||
{
|
{
|
||||||
if (fn->fn_debug_prefix != NULL) free(fn->fn_debug_prefix);
|
if (fn->fn_debug_prefix != NULL) free(fn->fn_debug_prefix);
|
||||||
if (fn->fn_debug_suffix!= NULL) free(fn->fn_debug_suffix);
|
if (fn->fn_debug_suffix!= NULL) free(fn->fn_debug_suffix);
|
||||||
@ -3278,8 +3238,7 @@ static void fnames_conf_free_memory(
|
|||||||
*
|
*
|
||||||
* @return the biggest sequence number used
|
* @return the biggest sequence number used
|
||||||
*/
|
*/
|
||||||
static int find_last_seqno(
|
static int find_last_seqno(strpart_t* parts,
|
||||||
strpart_t* parts,
|
|
||||||
int seqno,
|
int seqno,
|
||||||
int seqnoidx)
|
int seqnoidx)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user