Skip to content

Commit

Permalink
Merge pull request #326 from bareos/dev/franku/master/reduce-warnings
Browse files Browse the repository at this point in the history
dev/franku/master/reduce warnings
  • Loading branch information
franku committed Nov 8, 2019
2 parents ce6a9e0 + aa92714 commit 3f2b5fb
Show file tree
Hide file tree
Showing 119 changed files with 4,077 additions and 3,342 deletions.
17 changes: 9 additions & 8 deletions core/src/dird/admin.cc
Expand Up @@ -32,6 +32,7 @@
#include "include/bareos.h"
#include "dird.h"
#include "dird/admin.h"
#include "dird/jcr_private.h"
#include "dird/job.h"
#include "dird/storage.h"

Expand All @@ -53,9 +54,9 @@ bool DoAdminInit(JobControlRecord* jcr)
*/
bool do_admin(JobControlRecord* jcr)
{
jcr->jr.JobId = jcr->JobId;
jcr->impl->jr.JobId = jcr->JobId;

jcr->fname = (char*)GetPoolMemory(PM_FNAME);
jcr->impl->fname = (char*)GetPoolMemory(PM_FNAME);

/*
* Print Job Start message
Expand Down Expand Up @@ -83,7 +84,7 @@ void AdminCleanup(JobControlRecord* jcr, int TermCode)

UpdateJobEnd(jcr, TermCode);

if (!jcr->db->GetJobRecord(jcr, &jcr->jr)) {
if (!jcr->db->GetJobRecord(jcr, &jcr->impl->jr)) {
Jmsg(jcr, M_WARNING, 0,
_("Error getting Job record for Job report: ERR=%s"),
jcr->db->strerror());
Expand All @@ -108,9 +109,9 @@ void AdminCleanup(JobControlRecord* jcr, int TermCode)
sprintf(term_code, _("Inappropriate term code: %c\n"), jcr->JobStatus);
break;
}
bstrftimes(schedt, sizeof(schedt), jcr->jr.SchedTime);
bstrftimes(sdt, sizeof(sdt), jcr->jr.StartTime);
bstrftimes(edt, sizeof(edt), jcr->jr.EndTime);
bstrftimes(schedt, sizeof(schedt), jcr->impl->jr.SchedTime);
bstrftimes(sdt, sizeof(sdt), jcr->impl->jr.StartTime);
bstrftimes(edt, sizeof(edt), jcr->impl->jr.EndTime);

Jmsg(jcr, msg_type, 0,
_("BAREOS " VERSION " (" LSMDATE "): %s\n"
Expand All @@ -121,8 +122,8 @@ void AdminCleanup(JobControlRecord* jcr, int TermCode)
" End time: %s\n"
" Bareos binary info: %s\n"
" Termination: %s\n\n"),
edt, jcr->jr.JobId, jcr->jr.Job, schedt, sdt, edt, BAREOS_JOBLOG_MESSAGE,
TermMsg);
edt, jcr->impl->jr.JobId, jcr->impl->jr.Job, schedt, sdt, edt,
BAREOS_JOBLOG_MESSAGE, TermMsg);

Dmsg0(debuglevel, "Leave AdminCleanup()\n");
}
Expand Down
17 changes: 9 additions & 8 deletions core/src/dird/archive.cc
Expand Up @@ -32,6 +32,7 @@
#include "dird.h"
#include "dird/archive.h"
#include "dird/job.h"
#include "dird/jcr_private.h"
#include "dird/storage.h"

namespace directordaemon {
Expand All @@ -52,9 +53,9 @@ bool DoArchiveInit(JobControlRecord* jcr)
*/
bool DoArchive(JobControlRecord* jcr)
{
jcr->jr.JobId = jcr->JobId;
jcr->impl->jr.JobId = jcr->JobId;

jcr->fname = (char*)GetPoolMemory(PM_FNAME);
jcr->impl->fname = (char*)GetPoolMemory(PM_FNAME);

/*
* Print Job Start message
Expand Down Expand Up @@ -82,7 +83,7 @@ void ArchiveCleanup(JobControlRecord* jcr, int TermCode)

UpdateJobEnd(jcr, TermCode);

if (!jcr->db->GetJobRecord(jcr, &jcr->jr)) {
if (!jcr->db->GetJobRecord(jcr, &jcr->impl->jr)) {
Jmsg(jcr, M_WARNING, 0,
_("Error getting Job record for Job report: ERR=%s"),
jcr->db->strerror());
Expand All @@ -108,9 +109,9 @@ void ArchiveCleanup(JobControlRecord* jcr, int TermCode)
break;
}

bstrftimes(schedt, sizeof(schedt), jcr->jr.SchedTime);
bstrftimes(sdt, sizeof(sdt), jcr->jr.StartTime);
bstrftimes(edt, sizeof(edt), jcr->jr.EndTime);
bstrftimes(schedt, sizeof(schedt), jcr->impl->jr.SchedTime);
bstrftimes(sdt, sizeof(sdt), jcr->impl->jr.StartTime);
bstrftimes(edt, sizeof(edt), jcr->impl->jr.EndTime);

Jmsg(jcr, msg_type, 0,
_("BAREOS " VERSION " (" LSMDATE "): %s\n"
Expand All @@ -121,8 +122,8 @@ void ArchiveCleanup(JobControlRecord* jcr, int TermCode)
" End time: %s\n"
" Bareos binary info: %s\n"
" Termination: %s\n\n"),
edt, jcr->jr.JobId, jcr->jr.Job, schedt, sdt, edt, BAREOS_JOBLOG_MESSAGE,
TermMsg);
edt, jcr->impl->jr.JobId, jcr->impl->jr.Job, schedt, sdt, edt,
BAREOS_JOBLOG_MESSAGE, TermMsg);

Dmsg0(debuglevel, "Leave ArchiveCleanup()\n");
}
Expand Down
15 changes: 7 additions & 8 deletions core/src/dird/authenticate.cc
Expand Up @@ -39,6 +39,7 @@
#include "dird/fd_cmds.h"
#include "dird/client_connection_handshake_mode.h"
#include "dird/dird_globals.h"
#include "dird/jcr_private.h"
#include "lib/bnet.h"
#include "lib/qualified_resource_name_type_converter.h"
#include "lib/bstringlist.h"
Expand Down Expand Up @@ -72,8 +73,7 @@ bool AuthenticateWithStorageDaemon(BareosSocket* sd,
bstrncpy(dirname, me->resource_name_, sizeof(dirname));
BashSpaces(dirname);

sd->InitBnetDump(
my_config->CreateOwnQualifiedNameForNetworkDump());
sd->InitBnetDump(my_config->CreateOwnQualifiedNameForNetworkDump());
if (!sd->fsend(hello, dirname)) {
Dmsg1(debuglevel, _("Error sending Hello to Storage daemon. ERR=%s\n"),
BnetStrerror(sd));
Expand Down Expand Up @@ -126,9 +126,9 @@ bool AuthenticateWithFileDaemon(JobControlRecord* jcr)
if (jcr->authenticated) { return true; }

BareosSocket* fd = jcr->file_bsock;
ClientResource* client = jcr->res.client;
ClientResource* client = jcr->impl->res.client;

if (jcr->connection_handshake_try_ ==
if (jcr->impl->connection_handshake_try_ ==
ClientConnectionHandshakeMode::kTlsFirst) {
std::string qualified_resource_name;
if (!my_config->GetQualifiedResourceNameTypeConverter()->ResourceToString(
Expand All @@ -151,8 +151,7 @@ bool AuthenticateWithFileDaemon(JobControlRecord* jcr)
bstrncpy(dirname, me->resource_name_, sizeof(dirname));
BashSpaces(dirname);

fd->InitBnetDump(
my_config->CreateOwnQualifiedNameForNetworkDump());
fd->InitBnetDump(my_config->CreateOwnQualifiedNameForNetworkDump());
if (!fd->fsend(hello, dirname)) {
Jmsg(jcr, M_FATAL, 0,
_("Error sending Hello to File daemon at \"%s:%d\". ERR=%s\n"),
Expand Down Expand Up @@ -193,9 +192,9 @@ bool AuthenticateWithFileDaemon(JobControlRecord* jcr)
}

Dmsg1(110, "<filed: %s", fd->msg);
jcr->FDVersion = 0;
jcr->impl->FDVersion = 0;
if (!bstrncmp(fd->msg, FDOKhello, sizeof(FDOKhello)) &&
sscanf(fd->msg, FDOKnewHello, &jcr->FDVersion) != 1) {
sscanf(fd->msg, FDOKnewHello, &jcr->impl->FDVersion) != 1) {
Dmsg0(debuglevel, _("File daemon rejected Hello command\n"));
Jmsg(jcr, M_FATAL, 0,
_("File daemon at \"%s:%d\" rejected Hello command\n"), fd->host(),
Expand Down
13 changes: 7 additions & 6 deletions core/src/dird/autoprune.cc
Expand Up @@ -30,6 +30,7 @@

#include "include/bareos.h"
#include "dird.h"
#include "dird/jcr_private.h"
#include "dird/next_vol.h"
#include "dird/ua_server.h"
#include "dird/ua_prune.h"
Expand All @@ -50,14 +51,14 @@ void DoAutoprune(JobControlRecord* jcr)
PoolResource* pool;
bool pruned;

if (!jcr->res.client) { /* temp -- remove me */
if (!jcr->impl->res.client) { /* temp -- remove me */
return;
}

ua = new_ua_context(jcr);
job = jcr->res.job;
client = jcr->res.client;
pool = jcr->res.pool;
job = jcr->impl->res.job;
client = jcr->impl->res.client;
pool = jcr->impl->res.pool;

if (job->PruneJobs || client->AutoPrune) {
PruneJobs(ua, client, pool, jcr->getJobType());
Expand Down Expand Up @@ -93,8 +94,8 @@ void PruneVolumes(JobControlRecord* jcr,
PoolMem query(PM_MESSAGE);
char ed1[50], ed2[100], ed3[50];

Dmsg1(100, "Prune volumes PoolId=%d\n", jcr->jr.PoolId);
if (!jcr->res.job->PruneVolumes && !jcr->res.pool->AutoPrune) {
Dmsg1(100, "Prune volumes PoolId=%d\n", jcr->impl->jr.PoolId);
if (!jcr->impl->res.job->PruneVolumes && !jcr->impl->res.pool->AutoPrune) {
Dmsg0(100, "AutoPrune not set in Pool.\n");
return;
}
Expand Down

0 comments on commit 3f2b5fb

Please sign in to comment.