CUBRID Engine  latest
databases_file.c File Reference
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <assert.h>
#include "porting.h"
#include "chartype.h"
#include "error_manager.h"
#include "databases_file.h"
#include "boot.h"
#include "connection_defs.h"
#include "memory_alloc.h"
#include "environment_variable.h"
#include "system_parameter.h"
Include dependency graph for databases_file.c:

Go to the source code of this file.

Macros

#define CFG_MAX_LINE   4096
 

Functions

static char * cfg_next_char (char *str_p)
 
static char * cfg_next_line (char *str_p)
 
static char * cfg_pop_token (char *str_p, char **token_p)
 
static char * cfg_pop_linetoken (char *str_p, char **token_p)
 
static void cfg_get_directory_filename (char *buffer, int *local)
 
static int cfg_ensure_directory_write (void)
 
static FILE * cfg_open_directory_file (bool write_flag)
 
static char ** cfg_copy_hosts (const char **host_array, int *num_hosts)
 
static const char * cfg_pop_host (const char *host_list, char *buffer, int *length)
 
static bool cfg_host_exists (char *host_list, char *hostname, int num_items)
 
char * cfg_os_working_directory (void)
 
char * cfg_maycreate_get_directory_filename (char *buffer)
 
int cfg_read_directory (DB_INFO **info_p, bool write_flag)
 
int cfg_read_directory_ex (int vdes, DB_INFO **info_p, bool write_flag)
 
void cfg_write_directory (const DB_INFO *databases)
 
void cfg_write_directory_ex (int vdes, const DB_INFO *databases)
 
void cfg_free_directory (DB_INFO *databases)
 
void cfg_update_db (DB_INFO *db_info_p, const char *path, const char *logpath, const char *lobpath, const char *host)
 
DB_INFOcfg_new_db (const char *name, const char *path, const char *logpath, const char *lobpath, const char **hosts)
 
DB_INFOcfg_find_db_list (DB_INFO *db_info_list_p, const char *name)
 
DB_INFOcfg_add_db (DB_INFO **dir, const char *name, const char *path, const char *logpath, const char *lobpath, const char *host)
 
DB_INFOcfg_find_db (const char *db_name)
 
bool cfg_delete_db (DB_INFO **dir_info_p, const char *name)
 
char ** cfg_get_hosts (const char *prim_host, int *count, bool include_local_host)
 
void cfg_free_hosts (char **host_array)
 
char * cfg_create_host_list (const char *primary_host_name, bool include_local_host, int *count)
 

Variables

static char CFG_HOST_SEPARATOR = ':'
 

Macro Definition Documentation

#define CFG_MAX_LINE   4096

Definition at line 61 of file databases_file.c.

Referenced by cfg_read_directory().

Function Documentation

DB_INFO* cfg_add_db ( DB_INFO **  dir,
const char *  name,
const char *  path,
const char *  logpath,
const char *  lobpath,
const char *  host 
)

Definition at line 1035 of file databases_file.c.

References cfg_new_db(), host, database_info::next, and NULL.

Referenced by installdb(), xboot_copy(), xboot_initialize_server(), and xboot_soft_rename().

Here is the caller graph for this function:

static char ** cfg_copy_hosts ( const char **  host_array,
int *  num_hosts 
)
static

Definition at line 1356 of file databases_file.c.

References ARG_FILE_LINE, assert, ER_ERROR_SEVERITY, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), free_and_init, host, NULL, and strlen.

Referenced by cfg_new_db().

Here is the caller graph for this function:

char* cfg_create_host_list ( const char *  primary_host_name,
bool  include_local_host,
int *  count 
)

Definition at line 1425 of file databases_file.c.

References assert, cfg_host_exists(), CFG_HOST_SEPARATOR, cfg_pop_host(), CUB_MAXHOSTNAMELEN, free_and_init, GETHOSTNAME, NULL, prm_get_string_value(), PRM_ID_CFG_DB_HOSTS, and strlen.

Referenced by cfg_get_hosts().

Here is the caller graph for this function:

bool cfg_delete_db ( DB_INFO **  dir_info_p,
const char *  name 
)

Definition at line 1128 of file databases_file.c.

References cfg_free_directory(), database_info::name, database_info::next, NULL, and success().

Referenced by installdb(), xboot_delete(), and xboot_soft_rename().

Here is the caller graph for this function:

static int cfg_ensure_directory_write ( void  )
static

Definition at line 303 of file databases_file.c.

References ARG_FILE_LINE, cfg_get_directory_filename(), ER_CFG_NO_WRITE_ACCESS, ER_ERROR_SEVERITY, er_set_with_oserror(), and NULL.

Referenced by cfg_read_directory().

Here is the caller graph for this function:

DB_INFO* cfg_find_db_list ( DB_INFO db_info_list_p,
const char *  name 
)
void cfg_free_hosts ( char **  host_array)

Definition at line 1222 of file databases_file.c.

References free_and_init, and NULL.

Referenced by alterdbhost(), boot_restart_client(), cfg_free_directory(), and cfg_update_db().

Here is the caller graph for this function:

static void cfg_get_directory_filename ( char *  buffer,
int *  local 
)
static

Definition at line 220 of file databases_file.c.

References DATABASES_ENVNAME, DATABASES_FILENAME, envvar_get(), envvar_vardir_file(), NULL, and strlen.

Referenced by cfg_ensure_directory_write(), cfg_maycreate_get_directory_filename(), and cfg_open_directory_file().

Here is the caller graph for this function:

char** cfg_get_hosts ( const char *  prim_host,
int *  count,
bool  include_local_host 
)
static bool cfg_host_exists ( char *  host_list,
char *  hostname,
int  num_items 
)
static

Definition at line 1311 of file databases_file.c.

References CAST_STRLEN, CFG_HOST_SEPARATOR, i, NULL, and strlen.

Referenced by cfg_create_host_list().

Here is the caller graph for this function:

char* cfg_maycreate_get_directory_filename ( char *  buffer)
DB_INFO* cfg_new_db ( const char *  name,
const char *  path,
const char *  logpath,
const char *  lobpath,
const char **  hosts 
)
static char * cfg_next_char ( char *  str_p)
static

Definition at line 86 of file databases_file.c.

References char_isspace(), and p.

Referenced by cfg_read_directory(), and cfg_read_directory_ex().

Here is the caller graph for this function:

static char * cfg_next_line ( char *  str_p)
static

Definition at line 105 of file databases_file.c.

References char_iseol(), and p.

Referenced by cfg_read_directory_ex().

Here is the caller graph for this function:

static FILE * cfg_open_directory_file ( bool  write_flag)
static

Definition at line 332 of file databases_file.c.

References ARG_FILE_LINE, cfg_get_directory_filename(), ER_CFG_NO_WRITE_ACCESS, ER_ERROR_SEVERITY, er_set_with_oserror(), and NULL.

Referenced by cfg_read_directory(), and cfg_write_directory().

Here is the caller graph for this function:

char* cfg_os_working_directory ( void  )

Definition at line 257 of file databases_file.c.

References NULL.

Referenced by cfg_new_db().

Here is the caller graph for this function:

static const char * cfg_pop_host ( const char *  host_list,
char *  buffer,
int *  length 
)
static

Definition at line 1247 of file databases_file.c.

References CFG_HOST_SEPARATOR, char_isspace(), CUB_MAXHOSTNAMELEN, host, and NULL.

Referenced by cfg_create_host_list().

Here is the caller graph for this function:

static char * cfg_pop_linetoken ( char *  str_p,
char **  token_p 
)
static

Definition at line 174 of file databases_file.c.

References char_iseol(), char_isspace(), NULL, and p.

Referenced by cfg_read_directory_ex().

Here is the caller graph for this function:

static char * cfg_pop_token ( char *  str_p,
char **  token_p 
)
static

Definition at line 135 of file databases_file.c.

References char_isspace(), NULL, and p.

Referenced by cfg_read_directory().

Here is the caller graph for this function:

void cfg_update_db ( DB_INFO db_info_p,
const char *  path,
const char *  logpath,
const char *  lobpath,
const char *  host 
)
void cfg_write_directory_ex ( int  vdes,
const DB_INFO databases 
)

Variable Documentation

char CFG_HOST_SEPARATOR = ':'
static