Skip to content

Commit

Permalink
config: added r_own_ to ConfigurationParser
Browse files Browse the repository at this point in the history
- r_own_ holds the resource type of the application itself this means in detail:
  R_CONSOLE on a console, R_DIRECTOR on a director, aso...
  • Loading branch information
franku committed Sep 4, 2018
1 parent 4fc6889 commit 3e6c088
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 51 deletions.
37 changes: 20 additions & 17 deletions core/src/dird/dird_conf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3814,23 +3814,26 @@ static void ConfigReadyCallback(ConfigurationParser &my_config)

ConfigurationParser *InitDirConfig(const char *configfile, int exit_code)
{
return new ConfigurationParser (
configfile,
nullptr,
nullptr,
InitResourceCb,
ParseConfigCb,
PrintConfigCb,
exit_code,
(void *)&res_all,
res_all_size,
R_FIRST,
R_LAST,
resources,
res_head,
default_config_filename.c_str(),
"bareos-dir.d",
ConfigReadyCallback);
ConfigurationParser *config = new ConfigurationParser (configfile,
nullptr,
nullptr,
InitResourceCb,
ParseConfigCb,
PrintConfigCb,
exit_code,
(void *)&res_all,
res_all_size,
R_FIRST,
R_LAST,
resources,
res_head,
default_config_filename.c_str(),
"bareos-dir.d",
ConfigReadyCallback);
if (config) {
config->r_own_ = R_DIRECTOR;
}
return config;
}

/* **************************************************************************** */
Expand Down
37 changes: 20 additions & 17 deletions core/src/filed/filed_conf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -269,23 +269,26 @@ static void ConfigReadyCallback(ConfigurationParser &my_config)

ConfigurationParser *InitFdConfig(const char *configfile, int exit_code)
{
return new ConfigurationParser (
configfile,
nullptr,
nullptr,
InitResourceCb,
ParseConfigCb,
nullptr,
exit_code,
(void *)&res_all,
res_all_size,
R_FIRST,
R_LAST,
resources,
res_head,
default_config_filename.c_str(),
"bareos-fd.d",
ConfigReadyCallback);
ConfigurationParser *config = new ConfigurationParser (configfile,
nullptr,
nullptr,
InitResourceCb,
ParseConfigCb,
nullptr,
exit_code,
(void *)&res_all,
res_all_size,
R_FIRST,
R_LAST,
resources,
res_head,
default_config_filename.c_str(),
"bareos-fd.d",
ConfigReadyCallback);
if (config) {
config->r_own_ = R_CLIENT;
}
return config;
}

/**
Expand Down
1 change: 1 addition & 0 deletions core/src/lib/parse_conf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ ConfigurationParser::ConfigurationParser()
, omit_defaults_ (false)
, r_first_ (0)
, r_last_ (0)
, r_own_ (0)
, resources_ (0)
, res_head_(nullptr)
, use_config_include_dir_ (false) {
Expand Down
1 change: 1 addition & 0 deletions core/src/lib/parse_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ class DLL_IMP_EXP ConfigurationParser {

int32_t r_first_; /* First daemon resource type */
int32_t r_last_; /* Last daemon resource type */
int32_t r_own_; /* own resource type */
ResourceTable *resources_; /* Pointer to table of permitted resources */
CommonResourceHeader **res_head_; /* Pointer to defined resources */
brwlock_t res_lock_; /* Resource lock */
Expand Down
37 changes: 20 additions & 17 deletions core/src/stored/stored_conf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -514,23 +514,26 @@ static void ConfigReadyCallback(ConfigurationParser &my_config)

ConfigurationParser *InitSdConfig(const char *configfile, int exit_code)
{
return new ConfigurationParser(
configfile,
nullptr,
nullptr,
InitResourceCb,
ParseConfigCb,
nullptr,
exit_code,
(void *)&res_all,
res_all_size,
R_FIRST,
R_LAST,
resources,
res_head,
default_config_filename.c_str(),
"bareos-sd.d",
ConfigReadyCallback);
ConfigurationParser *config = new ConfigurationParser(configfile,
nullptr,
nullptr,
InitResourceCb,
ParseConfigCb,
nullptr,
exit_code,
(void *)&res_all,
res_all_size,
R_FIRST,
R_LAST,
resources,
res_head,
default_config_filename.c_str(),
"bareos-sd.d",
ConfigReadyCallback);
if (config) {
config->r_own_ = R_STORAGE;
}
return config;
}

bool ParseSdConfig(const char *configfile, int exit_code)
Expand Down

0 comments on commit 3e6c088

Please sign in to comment.