Skip to content

Commit

Permalink
storage: moved two global variables into stored_global.cc/.h
Browse files Browse the repository at this point in the history
- extern StorageResource *me
- extern char *configfile
  • Loading branch information
franku committed Sep 17, 2018
1 parent b853f3a commit 847f456
Show file tree
Hide file tree
Showing 27 changed files with 39 additions and 13 deletions.
10 changes: 5 additions & 5 deletions core/src/stored/CMakeLists.txt
Expand Up @@ -77,14 +77,14 @@ ENDIF()

set (LIBBAREOSSD_SRCS acquire.cc ansi_label.cc askdir.cc autochanger.cc
block.cc bsr.cc
butil.cc crc32.cc dev.cc device.cc ebcdic.cc label.cc lock.cc
mount.cc read_record.cc record.cc reserve.cc scan.cc
sd_backends.cc sd_plugins.cc sd_stats.cc spool.cc
stored_conf.cc vol_mgr.cc wait.cc
butil.cc crc32.cc dev.cc device.cc ebcdic.cc label.cc lock.cc
mount.cc read_record.cc record.cc reserve.cc scan.cc
sd_backends.cc sd_plugins.cc sd_stats.cc spool.cc
stored_globals.cc stored_conf.cc vol_mgr.cc wait.cc
${AVAILABLE_DEVICE_API_SRCS}
)

set(SDSRCS stored_globals.cc append.cc askdir.cc authenticate.cc dir_cmd.cc fd_cmds.cc
set(SDSRCS append.cc askdir.cc authenticate.cc dir_cmd.cc fd_cmds.cc
job.cc mac.cc ndmp_tape.cc read.cc sd_cmds.cc sd_stats.cc
socket_server.cc status.cc )

Expand Down
1 change: 1 addition & 0 deletions core/src/stored/ansi_label.cc
Expand Up @@ -30,6 +30,7 @@

#include "include/bareos.h" /* pull in global headers */
#include "stored/stored.h" /* pull in Storage Daemon headers */
#include "stored/stored_globals.h"
#include "stored/label.h"
#include "stored/ebcdic.h"
#include "include/jcr.h"
Expand Down
5 changes: 3 additions & 2 deletions core/src/stored/askdir.cc
Expand Up @@ -29,8 +29,9 @@
* Reqests/commands from the Director are handled in dircmd.c
*/

#include "include/bareos.h" /* pull in global headers */
#include "stored/stored.h" /* pull in Storage Daemon headers */
#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"

#include "include/jcr.h"
#include "lib/crypto_cache.h"
Expand Down
1 change: 1 addition & 0 deletions core/src/stored/authenticate.cc
Expand Up @@ -29,6 +29,7 @@

#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "include/jcr.h"

namespace storagedaemon {
Expand Down
2 changes: 2 additions & 0 deletions core/src/stored/backends/chunked_device.cc
Expand Up @@ -37,6 +37,8 @@
#endif
#endif

#include "stored/stored_globals.h"

namespace storagedaemon {

static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
Expand Down
1 change: 1 addition & 0 deletions core/src/stored/backends/unix_file_device.cc
Expand Up @@ -31,6 +31,7 @@

#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "unix_file_device.h"
#include "lib/util.h"

Expand Down
1 change: 1 addition & 0 deletions core/src/stored/bcopy.cc
Expand Up @@ -30,6 +30,7 @@

#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "lib/crypto_cache.h"
#include "stored/acquire.h"
#include "stored/butil.h"
Expand Down
1 change: 1 addition & 0 deletions core/src/stored/bextract.cc
Expand Up @@ -30,6 +30,7 @@

#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "lib/crypto_cache.h"
#include "stored/acquire.h"
#include "stored/butil.h"
Expand Down
1 change: 1 addition & 0 deletions core/src/stored/bls.cc
Expand Up @@ -30,6 +30,7 @@

#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "lib/crypto_cache.h"
#include "findlib/find.h"
#include "stored/acquire.h"
Expand Down
1 change: 1 addition & 0 deletions core/src/stored/bscan.cc
Expand Up @@ -32,6 +32,7 @@

#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "lib/crypto_cache.h"
#include "findlib/find.h"
#include "cats/cats.h"
Expand Down
1 change: 1 addition & 0 deletions core/src/stored/btape.cc
Expand Up @@ -36,6 +36,7 @@

#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "lib/crypto_cache.h"
#include "stored/acquire.h"
#include "stored/autochanger.h"
Expand Down
5 changes: 1 addition & 4 deletions core/src/stored/butil.cc
Expand Up @@ -35,6 +35,7 @@

#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "stored/acquire.h"
#include "stored/autochanger.h"
#include "stored/device.h"
Expand All @@ -52,10 +53,6 @@ static bool setup_to_access_device(DeviceControlRecord *dcr, JobControlRecord *j
static DeviceResource *find_device_res(char *device_name, bool readonly);
static void MyFreeJcr(JobControlRecord *jcr);

/* Global variables */
char SD_IMP_EXP *configfile;
StorageResource SD_IMP_EXP *me = NULL; /* Our Global resource */

/**
* Setup a "daemon" JobControlRecord for the various standalone tools (e.g. bls, bextract, bscan, ...)
*/
Expand Down
1 change: 1 addition & 0 deletions core/src/stored/label.cc
Expand Up @@ -30,6 +30,7 @@

#include "include/bareos.h" /* pull in global headers */
#include "stored/stored.h" /* pull in Storage Daemon headers */
#include "stored/stored_globals.h"
#include "stored/dev.h"
#include "stored/device.h"
#include "stored/label.h"
Expand Down
1 change: 1 addition & 0 deletions core/src/stored/mac.cc
Expand Up @@ -31,6 +31,7 @@

#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "stored/acquire.h"
#include "stored/bsr.h"
#include "stored/append.h"
Expand Down
1 change: 1 addition & 0 deletions core/src/stored/ndmp_tape.cc
Expand Up @@ -40,6 +40,7 @@
#if HAVE_NDMP

#include "stored/stored.h"
#include "stored/stored_globals.h"

#include "ndmp/ndmagents.h"
#include "stored/acquire.h"
Expand Down
1 change: 1 addition & 0 deletions core/src/stored/reserve.cc
Expand Up @@ -30,6 +30,7 @@

#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "stored/acquire.h"
#include "stored/autochanger.h"
#include "stored/wait.h"
Expand Down
1 change: 1 addition & 0 deletions core/src/stored/sd_cmds.cc
Expand Up @@ -35,6 +35,7 @@

#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "stored/append.h"
#include "stored/authenticate.h"
#include "stored/sd_stats.h"
Expand Down
1 change: 1 addition & 0 deletions core/src/stored/sd_plugins.cc
Expand Up @@ -30,6 +30,7 @@
*/
#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "sd_plugins.h"
#include "lib/crypto_cache.h"
#include "stored/sd_stats.h"
Expand Down
1 change: 1 addition & 0 deletions core/src/stored/sd_stats.cc
Expand Up @@ -27,6 +27,7 @@

#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "lib/util.h"
#include "include/jcr.h"

Expand Down
1 change: 1 addition & 0 deletions core/src/stored/socket_server.cc
Expand Up @@ -31,6 +31,7 @@
#include "include/bareos.h"
#include "stored/autochanger.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "stored/dir_cmd.h"
#include "stored/fd_cmds.h"
#include "stored/sd_cmds.h"
Expand Down
1 change: 1 addition & 0 deletions core/src/stored/spool.cc
Expand Up @@ -29,6 +29,7 @@

#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "stored/acquire.h"
#include "stored/device.h"
#include "lib/edit.h"
Expand Down
2 changes: 0 additions & 2 deletions core/src/stored/stored.h
Expand Up @@ -82,9 +82,7 @@ extern ConfigurationParser SD_IMP_EXP *my_config; /* Our Global config */

namespace storagedaemon {

extern char SD_IMP_EXP *configfile;
extern bool SD_IMP_EXP forge_on; /* Proceed inspite of I/O errors */
extern StorageResource SD_IMP_EXP *me; /* "Global" daemon resource */
uint32_t new_VolSessionId();

} /* namespace storagedaemon */
Expand Down
1 change: 1 addition & 0 deletions core/src/stored/stored_conf.cc
Expand Up @@ -31,6 +31,7 @@
#define NEED_JANSSON_NAMESPACE 1
#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "stored/sd_backends.h"

namespace storagedaemon {
Expand Down
3 changes: 3 additions & 0 deletions core/src/stored/stored_globals.cc
Expand Up @@ -25,6 +25,9 @@

namespace storagedaemon {

StorageResource *me;
char *configfile;

void *start_heap = nullptr;
bool init_done = false;
uint32_t vol_session_time;
Expand Down
5 changes: 5 additions & 0 deletions core/src/stored/stored_globals.h
Expand Up @@ -28,6 +28,11 @@

namespace storagedaemon {

class StorageResource;
extern StorageResource *me;

extern char *configfile;

extern void *start_heap;
extern bool init_done;
extern uint32_t vol_session_time;
Expand Down
1 change: 1 addition & 0 deletions core/src/stored/vol_mgr.cc
Expand Up @@ -30,6 +30,7 @@

#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "stored/autochanger.h"
#include "include/jcr.h"

Expand Down
1 change: 1 addition & 0 deletions core/src/stored/wait.cc
Expand Up @@ -32,6 +32,7 @@

#include "include/bareos.h" /* pull in global headers */
#include "stored/stored.h" /* pull in Storage Daemon headers */
#include "stored/stored_globals.h"
#include "lib/edit.h"
#include "include/jcr.h"

Expand Down

0 comments on commit 847f456

Please sign in to comment.