From: Kern Sibbald Date: Sat, 5 Dec 2009 16:07:00 +0000 (+0100) Subject: Change old get_Jobxxx to getJobxxx X-Git-Tag: Release-5.0.0~194 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=97cdb10c0d0d700f4750a532c4898ae045008568;p=bacula%2Fbacula Change old get_Jobxxx to getJobxxx --- diff --git a/bacula/src/dird/autoprune.c b/bacula/src/dird/autoprune.c index 5bd14a87d9..73f0d24fd4 100644 --- a/bacula/src/dird/autoprune.c +++ b/bacula/src/dird/autoprune.c @@ -62,7 +62,7 @@ void do_autoprune(JCR *jcr) pool = jcr->pool; if (jcr->job->PruneJobs || jcr->client->AutoPrune) { - prune_jobs(ua, client, pool, jcr->get_JobType()); + prune_jobs(ua, client, pool, jcr->getJobType()); pruned = true; } else { pruned = false; diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index eb8e9f1217..e27e2b9f82 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -65,7 +65,7 @@ static char OldEndJob[] = "2800 End Job TermCode=%d JobFiles=%u " bool do_backup_init(JCR *jcr) { - if (jcr->get_JobLevel() == L_VIRTUAL_FULL) { + if (jcr->getJobLevel() == L_VIRTUAL_FULL) { return do_vbackup_init(jcr); } free_rstorage(jcr); /* we don't read so release */ @@ -192,13 +192,13 @@ static bool is_checksum_needed_by_fileset(JCR *jcr) for (char *k=fopts->opts; *k ; k++) { /* Try to find one request */ switch (*k) { case 'V': /* verify */ - in_block = (jcr->get_JobType() == JT_VERIFY); /* not used now */ + in_block = (jcr->getJobType() == JT_VERIFY); /* not used now */ break; case 'J': /* Basejob keyword */ have_basejob_option = in_block = jcr->HasBase; break; case 'C': /* Accurate keyword */ - in_block = (jcr->get_JobLevel() != L_FULL); + in_block = (jcr->getJobLevel() != L_FULL); break; case ':': /* End of keyword */ in_block = false; @@ -245,11 +245,11 @@ bool send_accurate_current_files(JCR *jcr) return true; } /* In base level, no previous job is used */ - if (jcr->get_JobLevel() == L_BASE) { + if (jcr->getJobLevel() == L_BASE) { return true; } - if (jcr->get_JobLevel() == L_FULL) { + if (jcr->getJobLevel() == L_FULL) { /* On Full mode, if no previous base job, no accurate things */ if (!get_base_jobids(jcr, &jobids)) { goto bail_out; @@ -320,7 +320,7 @@ bool do_backup(JCR *jcr) STORE *store; char ed1[100]; - if (jcr->get_JobLevel() == L_VIRTUAL_FULL) { + if (jcr->getJobLevel() == L_VIRTUAL_FULL) { return do_vbackup(jcr); } @@ -328,7 +328,7 @@ bool do_backup(JCR *jcr) Jmsg(jcr, M_INFO, 0, _("Start Backup JobId %s, Job=%s\n"), edit_uint64(jcr->JobId, ed1), jcr->Job); - set_jcr_job_status(jcr, JS_Running); + jcr->setJobStatus(JS_Running); Dmsg2(100, "JobId=%d JobLevel=%c\n", jcr->jr.JobId, jcr->jr.JobLevel); if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) { Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); @@ -342,7 +342,7 @@ bool do_backup(JCR *jcr) * */ Dmsg0(110, "Open connection with storage daemon\n"); - set_jcr_job_status(jcr, JS_WaitSD); + jcr->setJobStatus(JS_WaitSD); /* * Start conversation with Storage daemon */ @@ -376,12 +376,12 @@ bool do_backup(JCR *jcr) } Dmsg0(150, "Storage daemon connection OK\n"); - set_jcr_job_status(jcr, JS_WaitFD); + jcr->setJobStatus(JS_WaitFD); if (!connect_to_file_daemon(jcr, 10, FDConnectTimeout, 1)) { goto bail_out; } - set_jcr_job_status(jcr, JS_Running); + jcr->setJobStatus(JS_Running); fd = jcr->file_bsock; if (!send_include_list(jcr)) { @@ -470,7 +470,7 @@ bool do_backup(JCR *jcr) /* Come here only after starting SD thread */ bail_out: - set_jcr_job_status(jcr, JS_ErrorTerminated); + jcr->setJobStatus(JS_ErrorTerminated); Dmsg1(400, "wait for sd. use=%d\n", jcr->use_count()); /* Cancel SD */ wait_for_job_termination(jcr, FDConnectTimeout); @@ -498,7 +498,7 @@ int wait_for_job_termination(JCR *jcr, int timeout) int Encrypt = 0; btimer_t *tid=NULL; - set_jcr_job_status(jcr, JS_Running); + jcr->setJobStatus(JS_Running); if (fd) { if (timeout) { @@ -512,7 +512,7 @@ int wait_for_job_termination(JCR *jcr, int timeout) sscanf(fd->msg, OldEndJob, &jcr->FDJobStatus, &JobFiles, &ReadBytes, &JobBytes, &JobErrors) == 5)) { fd_ok = true; - set_jcr_job_status(jcr, jcr->FDJobStatus); + jcr->setJobStatus(jcr->FDJobStatus); Dmsg1(100, "FDStatus=%c\n", (char)jcr->JobStatus); } else { Jmsg(jcr, M_WARNING, 0, _("Unexpected Client Job message: %s\n"), @@ -528,7 +528,7 @@ int wait_for_job_termination(JCR *jcr, int timeout) if (is_bnet_error(fd)) { Jmsg(jcr, M_FATAL, 0, _("Network error with FD during %s: ERR=%s\n"), - job_type_to_str(jcr->get_JobType()), fd->bstrerror()); + job_type_to_str(jcr->getJobType()), fd->bstrerror()); } fd->signal(BNET_TERMINATE); /* tell Client we are terminating */ } @@ -587,7 +587,7 @@ void backup_cleanup(JCR *jcr, int TermCode) utime_t RunTime; POOL_MEM base_info; - if (jcr->get_JobLevel() == L_VIRTUAL_FULL) { + if (jcr->getJobLevel() == L_VIRTUAL_FULL) { vbackup_cleanup(jcr, TermCode); return; } @@ -596,12 +596,19 @@ void backup_cleanup(JCR *jcr, int TermCode) memset(&mr, 0, sizeof(mr)); memset(&cr, 0, sizeof(cr)); +#ifdef xxxx + if (jcr->getJobStatus() == JS_Terminated && + (jcr->JobErrors || jcr->SDErrors || jcr->JobWarnings)) { + TermCode = JS_Warnings; + } +#endif + update_job_end(jcr, TermCode); if (!db_get_job_record(jcr, jcr->db, &jcr->jr)) { Jmsg(jcr, M_WARNING, 0, _("Error getting Job record for Job report: ERR=%s"), db_strerror(jcr->db)); - set_jcr_job_status(jcr, JS_ErrorTerminated); + jcr->setJobStatus(JS_ErrorTerminated); } bstrncpy(cr.Name, jcr->client->name(), sizeof(cr.Name)); @@ -614,7 +621,7 @@ void backup_cleanup(JCR *jcr, int TermCode) if (!db_get_media_record(jcr, jcr->db, &mr)) { Jmsg(jcr, M_WARNING, 0, _("Error getting Media record for Volume \"%s\": ERR=%s"), mr.VolumeName, db_strerror(jcr->db)); - set_jcr_job_status(jcr, JS_ErrorTerminated); + jcr->setJobStatus(JS_ErrorTerminated); } update_bootstrap_file(jcr); @@ -736,7 +743,7 @@ void backup_cleanup(JCR *jcr, int TermCode) HOST_OS, DISTNAME, DISTVER, jcr->jr.JobId, jcr->jr.Job, - level_to_str(jcr->get_JobLevel()), jcr->since, + level_to_str(jcr->getJobLevel()), jcr->since, jcr->client->name(), cr.Uname, jcr->fileset->name(), jcr->FSCreateTime, jcr->pool->name(), jcr->pool_source, @@ -794,7 +801,7 @@ void update_bootstrap_file(JCR *jcr) fd = bpipe ? bpipe->wfd : NULL; } else { /* ***FIXME*** handle BASE */ - fd = fopen(fname, jcr->get_JobLevel()==L_FULL?"w+b":"a+b"); + fd = fopen(fname, jcr->getJobLevel()==L_FULL?"w+b":"a+b"); } if (fd) { VolCount = db_get_job_volume_parameters(jcr, jcr->db, jcr->JobId, @@ -803,14 +810,14 @@ void update_bootstrap_file(JCR *jcr) Jmsg(jcr, M_ERROR, 0, _("Could not get Job Volume Parameters to " "update Bootstrap file. ERR=%s\n"), db_strerror(jcr->db)); if (jcr->SDJobFiles != 0) { - set_jcr_job_status(jcr, JS_ErrorTerminated); + jcr->setJobStatus(JS_ErrorTerminated); } } /* Start output with when and who wrote it */ bstrftimes(edt, sizeof(edt), time(NULL)); fprintf(fd, "# %s - %s - %s%s\n", edt, jcr->jr.Job, - level_to_str(jcr->get_JobLevel()), jcr->since); + level_to_str(jcr->getJobLevel()), jcr->since); for (int i=0; i < VolCount; i++) { /* Write the record */ fprintf(fd, "Volume=\"%s\"\n", VolParams[i].VolumeName); @@ -838,7 +845,7 @@ void update_bootstrap_file(JCR *jcr) berrno be; Jmsg(jcr, M_ERROR, 0, _("Could not open WriteBootstrap file:\n" "%s: ERR=%s\n"), fname, be.bstrerror()); - set_jcr_job_status(jcr, JS_ErrorTerminated); + jcr->setJobStatus(JS_ErrorTerminated); } free_pool_memory(fname); } diff --git a/bacula/src/dird/dir_plugins.c b/bacula/src/dird/dir_plugins.c index f6e904fbe3..af6635e948 100644 --- a/bacula/src/dird/dir_plugins.c +++ b/bacula/src/dird/dir_plugins.c @@ -208,12 +208,12 @@ static bRC baculaGetValue(bpContext *ctx, brVariable var, void *value) Dmsg1(dbglvl, "Bacula: return bVarJob=%s\n", jcr->job->hdr.name); break; case bVarLevel: - *((int *)value) = jcr->get_JobLevel(); - Dmsg1(dbglvl, "Bacula: return bVarLevel=%c\n", jcr->get_JobLevel()); + *((int *)value) = jcr->getJobLevel(); + Dmsg1(dbglvl, "Bacula: return bVarLevel=%c\n", jcr->getJobLevel()); break; case bVarType: - *((int *)value) = jcr->get_JobType(); - Dmsg1(dbglvl, "Bacula: return bVarType=%c\n", jcr->get_JobType()); + *((int *)value) = jcr->getJobType(); + Dmsg1(dbglvl, "Bacula: return bVarType=%c\n", jcr->getJobType()); break; case bVarClient: *((char **)value) = jcr->client->hdr.name; @@ -370,9 +370,9 @@ static bRC baculaSetValue(bpContext *ctx, bwVariable var, void *value) if (jcr->eventType == bEventJobInit) { for (int i=0; ok && joblevels[i].level_name; i++) { if (strcasecmp(strval, joblevels[i].level_name) == 0) { - if (joblevels[i].job_type == jcr->get_JobType()) { + if (joblevels[i].job_type == jcr->getJobType()) { jcr->set_JobLevel(joblevels[i].level); - jcr->jr.JobLevel = jcr->get_JobLevel(); + jcr->jr.JobLevel = jcr->getJobLevel(); ok = false; } } diff --git a/bacula/src/dird/expand.c b/bacula/src/dird/expand.c index 85cee39a8c..12aa2d0163 100644 --- a/bacula/src/dird/expand.c +++ b/bacula/src/dird/expand.c @@ -93,10 +93,10 @@ static int job_item(JCR *jcr, int code, str = my_name; break; case 3: /* level */ - str = job_level_to_str(jcr->get_JobLevel()); + str = job_level_to_str(jcr->getJobLevel()); break; case 4: /* type */ - str = job_type_to_str(jcr->get_JobType()); + str = job_type_to_str(jcr->getJobType()); break; case 5: /* JobId */ bsnprintf(buf, sizeof(buf), "%d", jcr->JobId); diff --git a/bacula/src/dird/fd_cmds.c b/bacula/src/dird/fd_cmds.c index 2ef63d9813..a8f3dce9fa 100644 --- a/bacula/src/dird/fd_cmds.c +++ b/bacula/src/dird/fd_cmds.c @@ -190,7 +190,7 @@ void get_level_since_time(JCR *jcr, char *since, int since_len) * Lookup the last FULL backup job to get the time/date for a * differential or incremental save. */ - switch (jcr->get_JobLevel()) { + switch (jcr->getJobLevel()) { case L_DIFFERENTIAL: case L_INCREMENTAL: POOLMEM *stime = get_pool_memory(PM_MESSAGE); @@ -213,7 +213,7 @@ void get_level_since_time(JCR *jcr, char *since, int since_len) Dmsg4(50, "have_full=%d do_full=%d now=%lld full_time=%lld\n", have_full, do_full, now, last_full_time); /* Make sure the last diff is recent enough */ - if (have_full && jcr->get_JobLevel() == L_INCREMENTAL && jcr->job->MaxDiffInterval > 0) { + if (have_full && jcr->getJobLevel() == L_INCREMENTAL && jcr->job->MaxDiffInterval > 0) { /* Lookup last diff job */ if (db_find_last_job_start_time(jcr, jcr->db, &jcr->jr, &stime, L_DIFFERENTIAL)) { last_diff_time = str_to_utime(stime); @@ -242,13 +242,13 @@ void get_level_since_time(JCR *jcr, char *since, int since_len) Jmsg(jcr, M_INFO, 0, "%s", db_strerror(jcr->db)); Jmsg(jcr, M_INFO, 0, _("No prior or suitable Full backup found in catalog. Doing FULL backup.\n")); bsnprintf(since, since_len, _(" (upgraded from %s)"), - level_to_str(jcr->get_JobLevel())); + level_to_str(jcr->getJobLevel())); jcr->set_JobLevel(jcr->jr.JobLevel = L_FULL); } else if (do_diff) { /* No recent diff job found, so upgrade this one to Diff */ Jmsg(jcr, M_INFO, 0, _("No prior or suitable Differential backup found in catalog. Doing Differential backup.\n")); bsnprintf(since, since_len, _(" (upgraded from %s)"), - level_to_str(jcr->get_JobLevel())); + level_to_str(jcr->getJobLevel())); jcr->set_JobLevel(jcr->jr.JobLevel = L_DIFFERENTIAL); } else { if (jcr->job->rerun_failed_levels) { @@ -256,7 +256,7 @@ void get_level_since_time(JCR *jcr, char *since, int since_len) Jmsg(jcr, M_INFO, 0, _("Prior failed job found in catalog. Upgrading to %s.\n"), level_to_str(JobLevel)); bsnprintf(since, since_len, _(" (upgraded from %s)"), - level_to_str(jcr->get_JobLevel())); + level_to_str(jcr->getJobLevel())); jcr->set_JobLevel(jcr->jr.JobLevel = JobLevel); jcr->jr.JobId = jcr->JobId; break; @@ -268,7 +268,7 @@ void get_level_since_time(JCR *jcr, char *since, int since_len) jcr->jr.JobId = jcr->JobId; break; } - Dmsg2(100, "Level=%c last start time=%s\n", jcr->get_JobLevel(), jcr->stime); + Dmsg2(100, "Level=%c last start time=%s\n", jcr->getJobLevel(), jcr->stime); } static void send_since_time(JCR *jcr) @@ -296,7 +296,7 @@ bool send_level_command(JCR *jcr) /* * Send Level command to File daemon */ - switch (jcr->get_JobLevel()) { + switch (jcr->getJobLevel()) { case L_BASE: fd->fsend(levelcmd, not_accurate, "base", " ", 0); break; @@ -316,7 +316,7 @@ bool send_level_command(JCR *jcr) case L_SINCE: default: Jmsg2(jcr, M_FATAL, 0, _("Unimplemented backup level %d %c\n"), - jcr->get_JobLevel(), jcr->get_JobLevel()); + jcr->getJobLevel(), jcr->getJobLevel()); return 0; } Dmsg1(120, ">filed: %s", fd->msg); @@ -581,7 +581,7 @@ int send_runscripts_commands(JCR *jcr) Dmsg0(120, "bdird: sending runscripts to fd\n"); foreach_alist(cmd, jcr->job->RunScripts) { - if (cmd->can_run_at_level(jcr->get_JobLevel()) && cmd->target) { + if (cmd->can_run_at_level(jcr->getJobLevel()) && cmd->target) { ehost = edit_job_codes(jcr, ehost, cmd->target, ""); Dmsg2(200, "bdird: runscript %s -> %s\n", cmd->target, ehost); diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index 7efd1a3de9..0860e7d69b 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -196,7 +196,7 @@ bool setup_job(JCR *jcr) * this allows us to setup a proper job start record for restarting * in case of later errors. */ - switch (jcr->get_JobType()) { + switch (jcr->getJobType()) { case JT_BACKUP: if (!do_backup_init(jcr)) { backup_cleanup(jcr, JS_ErrorTerminated); @@ -229,8 +229,8 @@ bool setup_job(JCR *jcr) } break; default: - Pmsg1(0, _("Unimplemented job type: %d\n"), jcr->get_JobType()); - set_jcr_job_status(jcr, JS_ErrorTerminated); + Pmsg1(0, _("Unimplemented job type: %d\n"), jcr->getJobType()); + jcr->setJobStatus(JS_ErrorTerminated); goto bail_out; } @@ -246,7 +246,7 @@ bail_out: void update_job_end(JCR *jcr, int TermCode) { dequeue_messages(jcr); /* display any queued messages */ - set_jcr_job_status(jcr, TermCode); + jcr->setJobStatus(TermCode); update_job_end_record(jcr); } @@ -310,7 +310,7 @@ static void *job_thread(void *arg) generate_job_event(jcr, "JobRun"); generate_plugin_event(jcr, bEventJobRun); - switch (jcr->get_JobType()) { + switch (jcr->getJobType()) { case JT_BACKUP: if (!job_canceled(jcr) && do_backup(jcr)) { do_autoprune(jcr); @@ -348,7 +348,7 @@ static void *job_thread(void *arg) } break; default: - Pmsg1(0, _("Unimplemented job type: %d\n"), jcr->get_JobType()); + Pmsg1(0, _("Unimplemented job type: %d\n"), jcr->getJobType()); break; } @@ -380,7 +380,7 @@ bool cancel_job(UAContext *ua, JCR *jcr) char ed1[50]; int32_t old_status = jcr->JobStatus; - set_jcr_job_status(jcr, JS_Canceled); + jcr->setJobStatus(JS_Canceled); switch (old_status) { case JS_Created: @@ -524,17 +524,17 @@ static void job_monitor_watchdog(watchdog_t *self) /* check MaxWaitTime */ if (job_check_maxwaittime(jcr)) { - set_jcr_job_status(jcr, JS_Canceled); + jcr->setJobStatus(JS_Canceled); Qmsg(jcr, M_FATAL, 0, _("Max wait time exceeded. Job canceled.\n")); cancel = true; /* check MaxRunTime */ } else if (job_check_maxruntime(jcr)) { - set_jcr_job_status(jcr, JS_Canceled); + jcr->setJobStatus(JS_Canceled); Qmsg(jcr, M_FATAL, 0, _("Max run time exceeded. Job canceled.\n")); cancel = true; /* check MaxRunSchedTime */ } else if (job_check_maxschedruntime(jcr)) { - set_jcr_job_status(jcr, JS_Canceled); + jcr->setJobStatus(JS_Canceled); Qmsg(jcr, M_FATAL, 0, _("Max sched run time exceeded. Job canceled.\n")); cancel = true; } @@ -603,15 +603,15 @@ static bool job_check_maxruntime(JCR *jcr) watchdog_time, jcr->start_time, run_time, job->MaxRunTime, job->FullMaxRunTime, job->IncMaxRunTime, job->DiffMaxRunTime); - if (jcr->get_JobLevel() == L_FULL && job->FullMaxRunTime != 0 && + if (jcr->getJobLevel() == L_FULL && job->FullMaxRunTime != 0 && run_time >= job->FullMaxRunTime) { Dmsg0(200, "check_maxwaittime: FullMaxcancel\n"); cancel = true; - } else if (jcr->get_JobLevel() == L_DIFFERENTIAL && job->DiffMaxRunTime != 0 && + } else if (jcr->getJobLevel() == L_DIFFERENTIAL && job->DiffMaxRunTime != 0 && run_time >= job->DiffMaxRunTime) { Dmsg0(200, "check_maxwaittime: DiffMaxcancel\n"); cancel = true; - } else if (jcr->get_JobLevel() == L_INCREMENTAL && job->IncMaxRunTime != 0 && + } else if (jcr->getJobLevel() == L_INCREMENTAL && job->IncMaxRunTime != 0 && run_time >= job->IncMaxRunTime) { Dmsg0(200, "check_maxwaittime: IncMaxcancel\n"); cancel = true; @@ -740,7 +740,7 @@ void apply_pool_overrides(JCR *jcr) /* * Apply any level related Pool selections */ - switch (jcr->get_JobLevel()) { + switch (jcr->getJobLevel()) { case L_FULL: if (jcr->full_pool) { jcr->pool = jcr->full_pool; @@ -858,8 +858,8 @@ void init_jcr_job_record(JCR *jcr) jcr->jr.SchedTime = jcr->sched_time; jcr->jr.StartTime = jcr->start_time; jcr->jr.EndTime = 0; /* perhaps rescheduled, clear it */ - jcr->jr.JobType = jcr->get_JobType(); - jcr->jr.JobLevel = jcr->get_JobLevel(); + jcr->jr.JobType = jcr->getJobType(); + jcr->jr.JobLevel = jcr->getJobLevel(); jcr->jr.JobStatus = jcr->JobStatus; jcr->jr.JobId = jcr->JobId; bstrncpy(jcr->jr.Name, jcr->job->name(), sizeof(jcr->jr.Name)); @@ -1094,7 +1094,7 @@ void set_jcr_defaults(JCR *jcr, JOB *job) jcr->set_JobType(job->JobType); jcr->JobStatus = JS_Created; - switch (jcr->get_JobType()) { + switch (jcr->getJobType()) { case JT_ADMIN: jcr->set_JobLevel(L_NONE); break; @@ -1156,8 +1156,8 @@ void set_jcr_defaults(JCR *jcr, JOB *job) /* This can be overridden by Console program */ jcr->verify_job = job->verify_job; /* If no default level given, set one */ - if (jcr->get_JobLevel() == 0) { - switch (jcr->get_JobType()) { + if (jcr->getJobLevel() == 0) { + switch (jcr->getJobType()) { case JT_VERIFY: jcr->set_JobLevel(L_VERIFY_CATALOG); break; diff --git a/bacula/src/dird/jobq.c b/bacula/src/dird/jobq.c index baa81469fc..68d67dc9cf 100644 --- a/bacula/src/dird/jobq.c +++ b/bacula/src/dird/jobq.c @@ -617,7 +617,7 @@ static bool reschedule_job(JCR *jcr, jobq_t *jq, jobq_item_t *je) if (jcr->job->RescheduleOnError && jcr->JobStatus != JS_Terminated && jcr->JobStatus != JS_Canceled && - jcr->get_JobType() == JT_BACKUP && + jcr->getJobType() == JT_BACKUP && (jcr->job->RescheduleTimes == 0 || jcr->reschedule_count < jcr->job->RescheduleTimes)) { char dt[50], dt2[50]; @@ -661,7 +661,7 @@ static bool reschedule_job(JCR *jcr, jobq_t *jq, jobq_item_t *je) set_jcr_defaults(njcr, jcr->job); njcr->reschedule_count = jcr->reschedule_count; njcr->sched_time = jcr->sched_time; - njcr->set_JobLevel(jcr->get_JobLevel()); + njcr->set_JobLevel(jcr->getJobLevel()); njcr->pool = jcr->pool; njcr->run_pool_override = jcr->run_pool_override; njcr->full_pool = jcr->full_pool; diff --git a/bacula/src/dird/migrate.c b/bacula/src/dird/migrate.c index 2ffadb76fc..59dcdc26ad 100644 --- a/bacula/src/dird/migrate.c +++ b/bacula/src/dird/migrate.c @@ -55,7 +55,7 @@ static const int dbglevel = 10; -static int get_job_to_migrate(JCR *jcr); +static int getJob_to_migrate(JCR *jcr); struct idpkt; static bool regex_find_jobids(JCR *jcr, idpkt *ids, const char *query1, const char *query2, const char *type); @@ -134,7 +134,7 @@ bool do_migration_init(JCR *jcr) } /* If we find a job or jobs to migrate it is previous_jr.JobId */ - count = get_job_to_migrate(jcr); + count = getJob_to_migrate(jcr); if (count < 0) { return false; } @@ -143,7 +143,7 @@ bool do_migration_init(JCR *jcr) return true; /* no work */ } - Dmsg1(dbglevel, "Back from get_job_to_migrate JobId=%d\n", (int)jcr->JobId); + Dmsg1(dbglevel, "Back from getJob_to_migrate JobId=%d\n", (int)jcr->JobId); if (jcr->previous_jr.JobId == 0) { Dmsg1(dbglevel, "JobId=%d no previous JobId\n", (int)jcr->JobId); @@ -651,7 +651,7 @@ const char *sql_jobids_of_pool_uncopied_jobs = * 0 if no jobs to migrate * 1 if OK and jcr->previous_jr filled in */ -static int get_job_to_migrate(JCR *jcr) +static int getJob_to_migrate(JCR *jcr) { char ed1[30], ed2[30]; POOL_MEM query(PM_MESSAGE); @@ -855,7 +855,7 @@ static int get_job_to_migrate(JCR *jcr) for (int i=1; i < (int)ids.count; i++) { JobId = 0; stat = get_next_jobid_from_list(&p, &JobId); - Dmsg3(dbglevel, "get_jobid_no=%d stat=%d JobId=%u\n", i, stat, JobId); + Dmsg3(dbglevel, "getJobid_no=%d stat=%d JobId=%u\n", i, stat, JobId); if (stat < 0) { Jmsg(jcr, M_FATAL, 0, _("Invalid JobId found.\n")); goto bail_out; @@ -997,7 +997,7 @@ static bool find_jobids_of_pool_uncopied_jobs(JCR *jcr, idpkt *ids) POOL_MEM query(PM_MESSAGE); /* Only a copy job is allowed */ - if (jcr->get_JobType() != JT_COPY) { + if (jcr->getJobType() != JT_COPY) { Jmsg(jcr, M_FATAL, 0, _("Selection Type 'pooluncopiedjobs' only applies to Copy Jobs")); goto bail_out; @@ -1174,7 +1174,7 @@ void migration_cleanup(JCR *jcr, int TermCode) * - move any Log records to the new JobId * - Purge the File records from the previous job */ - if (jcr->get_JobType() == JT_MIGRATE && jcr->JobStatus == JS_Terminated) { + if (jcr->getJobType() == JT_MIGRATE && jcr->JobStatus == JS_Terminated) { Mmsg(query, "UPDATE Job SET Type='%c' WHERE JobId=%s", (char)JT_MIGRATED_JOB, old_jobid); db_sql_query(mig_jcr->db, query.c_str(), NULL, NULL); @@ -1193,7 +1193,7 @@ void migration_cleanup(JCR *jcr, int TermCode) * - copy any Log records to the new JobId * - set type="Job Copy" for the new job */ - if (jcr->get_JobType() == JT_COPY && jcr->JobStatus == JS_Terminated) { + if (jcr->getJobType() == JT_COPY && jcr->JobStatus == JS_Terminated) { /* Copy JobLog to new JobId */ Mmsg(query, "INSERT INTO Log (JobId, Time, LogText ) " "SELECT %s, Time, LogText FROM Log WHERE JobId=%s", @@ -1273,7 +1273,7 @@ void migration_cleanup(JCR *jcr, int TermCode) break; } } else { - if (jcr->get_JobType() == JT_MIGRATE && jcr->previous_jr.JobId != 0) { + if (jcr->getJobType() == JT_MIGRATE && jcr->previous_jr.JobId != 0) { /* Mark previous job as migrated */ Mmsg(query, "UPDATE Job SET Type='%c' WHERE JobId=%s", (char)JT_MIGRATED_JOB, edit_uint64(jcr->previous_jr.JobId, ec1)); @@ -1330,7 +1330,7 @@ void migration_cleanup(JCR *jcr, int TermCode) mig_jcr ? edit_uint64(mig_jcr->jr.JobId, ec7) : "0", edit_uint64(jcr->jr.JobId, ec8), jcr->jr.Job, - level_to_str(jcr->get_JobLevel()), jcr->since, + level_to_str(jcr->getJobLevel()), jcr->since, jcr->client->name(), jcr->fileset->name(), jcr->FSCreateTime, jcr->rpool->name(), jcr->rpool_source, diff --git a/bacula/src/dird/msgchan.c b/bacula/src/dird/msgchan.c index 69e08ac6ab..4b653d3790 100644 --- a/bacula/src/dird/msgchan.c +++ b/bacula/src/dird/msgchan.c @@ -190,7 +190,7 @@ bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore, bool send_ } sd->fsend(jobcmd, edit_int64(jcr->JobId, ed1), jcr->Job, job_name.c_str(), client_name.c_str(), - jcr->get_JobType(), jcr->get_JobLevel(), + jcr->getJobType(), jcr->getJobLevel(), fileset_name.c_str(), !jcr->pool->catalog_files, jcr->job->SpoolAttributes, jcr->fileset->MD5, jcr->spool_data, jcr->write_part_after_job, jcr->job->PreferMountedVolumes, @@ -231,8 +231,8 @@ bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore, bool send_ /* Do read side of storage daemon */ if (ok && rstore) { /* For the moment, only migrate, copy and vbackup have rpool */ - if (jcr->get_JobType() == JT_MIGRATE || jcr->get_JobType() == JT_COPY || - (jcr->get_JobType() == JT_BACKUP && jcr->get_JobLevel() == L_VIRTUAL_FULL)) { + if (jcr->getJobType() == JT_MIGRATE || jcr->getJobType() == JT_COPY || + (jcr->getJobType() == JT_BACKUP && jcr->getJobLevel() == L_VIRTUAL_FULL)) { pm_strcpy(pool_type, jcr->rpool->pool_type); pm_strcpy(pool_name, jcr->rpool->name()); } else { diff --git a/bacula/src/dird/pythondir.c b/bacula/src/dird/pythondir.c index 8a10348510..c804a3d717 100644 --- a/bacula/src/dird/pythondir.c +++ b/bacula/src/dird/pythondir.c @@ -136,9 +136,9 @@ PyObject *job_getattr(PyObject *self, char *attrname) case 0: /* Job */ return Py_BuildValue((char *)getvars[i].fmt, jcr->job->hdr.name); case 1: /* level */ - return Py_BuildValue((char *)getvars[i].fmt, job_level_to_str(jcr->get_JobLevel())); + return Py_BuildValue((char *)getvars[i].fmt, job_level_to_str(jcr->getJobLevel())); case 2: /* type */ - return Py_BuildValue((char *)getvars[i].fmt, job_type_to_str(jcr->get_JobType())); + return Py_BuildValue((char *)getvars[i].fmt, job_type_to_str(jcr->getJobType())); case 3: /* JobId */ return Py_BuildValue((char *)getvars[i].fmt, jcr->JobId); case 4: /* Client */ @@ -293,9 +293,9 @@ int job_setattr(PyObject *self, char *attrname, PyObject *value) if (strval != NULL) { for (i=0; joblevels[i].level_name; i++) { if (strcmp(strval, joblevels[i].level_name) == 0) { - if (joblevels[i].job_type == jcr->get_JobType()) { + if (joblevels[i].job_type == jcr->getJobType()) { jcr->set_JobLevel(joblevels[i].level); - jcr->jr.JobLevel = jcr->get_JobLevel(); + jcr->jr.JobLevel = jcr->getJobLevel(); return 0; } } diff --git a/bacula/src/dird/ua_run.c b/bacula/src/dird/ua_run.c index 81e0c087eb..f299bd9df9 100644 --- a/bacula/src/dird/ua_run.c +++ b/bacula/src/dird/ua_run.c @@ -210,29 +210,29 @@ int modify_job_parameters(UAContext *ua, JCR *jcr, run_ctx &rc) add_prompt(ua, _("Storage")); /* 1 */ add_prompt(ua, _("Job")); /* 2 */ add_prompt(ua, _("FileSet")); /* 3 */ - if (jcr->get_JobType() == JT_RESTORE) { + if (jcr->getJobType() == JT_RESTORE) { add_prompt(ua, _("Restore Client")); /* 4 */ } else { add_prompt(ua, _("Client")); /* 4 */ } add_prompt(ua, _("When")); /* 5 */ add_prompt(ua, _("Priority")); /* 6 */ - if (jcr->get_JobType() == JT_BACKUP || - jcr->get_JobType() == JT_COPY || - jcr->get_JobType() == JT_MIGRATE || - jcr->get_JobType() == JT_VERIFY) { + if (jcr->getJobType() == JT_BACKUP || + jcr->getJobType() == JT_COPY || + jcr->getJobType() == JT_MIGRATE || + jcr->getJobType() == JT_VERIFY) { add_prompt(ua, _("Pool")); /* 7 */ - if (jcr->get_JobType() == JT_VERIFY) { + if (jcr->getJobType() == JT_VERIFY) { add_prompt(ua, _("Verify Job")); /* 8 */ } - } else if (jcr->get_JobType() == JT_RESTORE) { + } else if (jcr->getJobType() == JT_RESTORE) { add_prompt(ua, _("Bootstrap")); /* 7 */ add_prompt(ua, _("Where")); /* 8 */ add_prompt(ua, _("File Relocation"));/* 9 */ add_prompt(ua, _("Replace")); /* 10 */ add_prompt(ua, _("JobId")); /* 11 */ } - if (jcr->get_JobType() == JT_BACKUP || jcr->get_JobType() == JT_RESTORE) { + if (jcr->getJobType() == JT_BACKUP || jcr->getJobType() == JT_RESTORE) { add_prompt(ua, _("Plugin Options")); /* 12 */ } switch (do_prompt(ua, "", _("Select parameter to modify"), NULL, 0)) { @@ -302,10 +302,10 @@ int modify_job_parameters(UAContext *ua, JCR *jcr, run_ctx &rc) goto try_again; case 7: /* Pool or Bootstrap depending on JobType */ - if (jcr->get_JobType() == JT_BACKUP || - jcr->get_JobType() == JT_COPY || - jcr->get_JobType() == JT_MIGRATE || - jcr->get_JobType() == JT_VERIFY) { /* Pool */ + if (jcr->getJobType() == JT_BACKUP || + jcr->getJobType() == JT_COPY || + jcr->getJobType() == JT_MIGRATE || + jcr->getJobType() == JT_VERIFY) { /* Pool */ rc.pool = select_pool_resource(ua); if (rc.pool) { jcr->pool = rc.pool; @@ -339,7 +339,7 @@ int modify_job_parameters(UAContext *ua, JCR *jcr, run_ctx &rc) goto try_again; case 8: /* Verify Job */ - if (jcr->get_JobType() == JT_VERIFY) { + if (jcr->getJobType() == JT_VERIFY) { rc.verify_job = select_job_resource(ua); if (rc.verify_job) { jcr->verify_job = rc.verify_job; @@ -518,8 +518,8 @@ static bool reset_restore_context(UAContext *ua, JCR *jcr, run_ctx &rc) /* If pool changed, update migration write storage */ - if (jcr->get_JobType() == JT_MIGRATE || jcr->get_JobType() == JT_COPY || - (jcr->get_JobType() == JT_BACKUP && jcr->get_JobLevel() == L_VIRTUAL_FULL)) { + if (jcr->getJobType() == JT_MIGRATE || jcr->getJobType() == JT_COPY || + (jcr->getJobType() == JT_BACKUP && jcr->getJobLevel() == L_VIRTUAL_FULL)) { if (!set_migration_wstorage(jcr, rc.pool)) { return false; } @@ -680,7 +680,7 @@ bail_out_reg: static void select_job_level(UAContext *ua, JCR *jcr) { - if (jcr->get_JobType() == JT_BACKUP) { + if (jcr->getJobType() == JT_BACKUP) { start_prompt(ua, _("Levels:\n")); // add_prompt(ua, _("Base")); add_prompt(ua, _("Full")); @@ -710,7 +710,7 @@ static void select_job_level(UAContext *ua, JCR *jcr) default: break; } - } else if (jcr->get_JobType() == JT_VERIFY) { + } else if (jcr->getJobType() == JT_VERIFY) { start_prompt(ua, _("Levels:\n")); add_prompt(ua, _("Initialize Catalog")); add_prompt(ua, _("Verify Catalog")); @@ -745,8 +745,8 @@ static void select_job_level(UAContext *ua, JCR *jcr) static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char *verify_list, char *jid, const char *replace, char *client_name) { - Dmsg1(800, "JobType=%c\n", jcr->get_JobType()); - switch (jcr->get_JobType()) { + Dmsg1(800, "JobType=%c\n", jcr->getJobType()); + switch (jcr->getJobType()) { char ec1[30]; char dt[MAX_TIME_LENGTH]; case JT_ADMIN: @@ -769,7 +769,7 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char break; case JT_BACKUP: case JT_VERIFY: - if (jcr->get_JobType() == JT_BACKUP) { + if (jcr->getJobType() == JT_BACKUP) { if (ua->api) ua->signal(BNET_RUN_CMD); ua->send_msg(_("Run %s job\n" "JobName: %s\n" @@ -783,7 +783,7 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char "%s%s%s"), _("Backup"), job->name(), - level_to_str(jcr->get_JobLevel()), + level_to_str(jcr->getJobLevel()), jcr->client->name(), jcr->fileset->name(), NPRT(jcr->pool->name()), jcr->pool_source, @@ -820,7 +820,7 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char "Priority: %d\n"), _("Verify"), job->name(), - level_to_str(jcr->get_JobLevel()), + level_to_str(jcr->getJobLevel()), jcr->client->name(), jcr->fileset->name(), NPRT(jcr->pool->name()), jcr->pool_source, @@ -940,7 +940,7 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char case JT_COPY: case JT_MIGRATE: char *prt_type; - if (jcr->get_JobType() == JT_COPY) { + if (jcr->getJobType() == JT_COPY) { prt_type = _("Run Copy job\n"); } else { prt_type = _("Run Migration job\n"); @@ -973,7 +973,7 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char jcr->JobPriority); break; default: - ua->error_msg(_("Unknown Job Type=%d\n"), jcr->get_JobType()); + ua->error_msg(_("Unknown Job Type=%d\n"), jcr->getJobType()); return false; } return true; diff --git a/bacula/src/dird/ua_status.c b/bacula/src/dird/ua_status.c index 889cbb2015..3ff5f30be5 100644 --- a/bacula/src/dird/ua_status.c +++ b/bacula/src/dird/ua_status.c @@ -457,7 +457,7 @@ static void prt_runtime(UAContext *ua, sched_pkt *sp) MEDIA_DBR mr; int orig_jobtype; - orig_jobtype = jcr->get_JobType(); + orig_jobtype = jcr->getJobType(); memset(&mr, 0, sizeof(mr)); if (sp->job->JobType == JT_BACKUP) { jcr->db = NULL; @@ -613,7 +613,7 @@ static void list_running_jobs(UAContext *ua) /* this is a console or other control job. We only show console * jobs in the status output. */ - if (jcr->get_JobType() == JT_CONSOLE && !ua->api) { + if (jcr->getJobType() == JT_CONSOLE && !ua->api) { bstrftime_nc(dt, sizeof(dt), jcr->start_time); ua->send_msg(_("Console connected at %s\n"), dt); } @@ -774,13 +774,13 @@ static void list_running_jobs(UAContext *ua) msg = _("Dir inserting Attributes"); break; } - switch (jcr->get_JobType()) { + switch (jcr->getJobType()) { case JT_ADMIN: case JT_RESTORE: bstrncpy(level, " ", sizeof(level)); break; default: - bstrncpy(level, level_to_str(jcr->get_JobLevel()), sizeof(level)); + bstrncpy(level, level_to_str(jcr->getJobLevel()), sizeof(level)); level[7] = 0; break; } diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 98d0c7afac..84644182f4 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -71,7 +71,7 @@ bool do_verify_init(JCR *jcr) if (!allow_duplicate_job(jcr)) { return false; } - switch (jcr->get_JobLevel()) { + switch (jcr->getJobLevel()) { case L_VERIFY_INIT: case L_VERIFY_CATALOG: case L_VERIFY_DISK_TO_CATALOG: @@ -84,8 +84,8 @@ bool do_verify_init(JCR *jcr) case L_VERIFY_DATA: break; default: - Jmsg2(jcr, M_FATAL, 0, _("Unimplemented Verify level %d(%c)\n"), jcr->get_JobLevel(), - jcr->get_JobLevel()); + Jmsg2(jcr, M_FATAL, 0, _("Unimplemented Verify level %d(%c)\n"), jcr->getJobLevel(), + jcr->getJobLevel()); return false; } return true; @@ -124,20 +124,20 @@ bool do_verify(JCR *jcr) * For VERIFY_VOLUME_TO_CATALOG, we want the JobId of the * last backup Job. */ - if (jcr->get_JobLevel() == L_VERIFY_CATALOG || - jcr->get_JobLevel() == L_VERIFY_VOLUME_TO_CATALOG || - jcr->get_JobLevel() == L_VERIFY_DISK_TO_CATALOG) { + if (jcr->getJobLevel() == L_VERIFY_CATALOG || + jcr->getJobLevel() == L_VERIFY_VOLUME_TO_CATALOG || + jcr->getJobLevel() == L_VERIFY_DISK_TO_CATALOG) { memcpy(&jr, &jcr->jr, sizeof(jr)); if (jcr->verify_job && - (jcr->get_JobLevel() == L_VERIFY_VOLUME_TO_CATALOG || - jcr->get_JobLevel() == L_VERIFY_DISK_TO_CATALOG)) { + (jcr->getJobLevel() == L_VERIFY_VOLUME_TO_CATALOG || + jcr->getJobLevel() == L_VERIFY_DISK_TO_CATALOG)) { Name = jcr->verify_job->name(); } else { Name = NULL; } Dmsg1(100, "find last jobid for: %s\n", NPRT(Name)); if (!db_find_last_jobid(jcr, jcr->db, Name, &jr)) { - if (jcr->get_JobLevel() == L_VERIFY_CATALOG) { + if (jcr->getJobLevel() == L_VERIFY_CATALOG) { Jmsg(jcr, M_FATAL, 0, _( "Unable to find JobId of previous InitCatalog Job.\n" "Please run a Verify with Level=InitCatalog before\n" @@ -155,9 +155,9 @@ bool do_verify(JCR *jcr) * Now get the job record for the previous backup that interests * us. We use the verify_jobid that we found above. */ - if (jcr->get_JobLevel() == L_VERIFY_CATALOG || - jcr->get_JobLevel() == L_VERIFY_VOLUME_TO_CATALOG || - jcr->get_JobLevel() == L_VERIFY_DISK_TO_CATALOG) { + if (jcr->getJobLevel() == L_VERIFY_CATALOG || + jcr->getJobLevel() == L_VERIFY_VOLUME_TO_CATALOG || + jcr->getJobLevel() == L_VERIFY_DISK_TO_CATALOG) { jcr->previous_jr.JobId = verify_jobid; if (!db_get_job_record(jcr, jcr->db, &jcr->previous_jr)) { Jmsg(jcr, M_FATAL, 0, _("Could not get job record for previous Job. ERR=%s"), @@ -180,7 +180,7 @@ bool do_verify(JCR *jcr) * create a dummy authorization key (passed to * File daemon but not used). */ - if (jcr->get_JobLevel() == L_VERIFY_VOLUME_TO_CATALOG) { + if (jcr->getJobLevel() == L_VERIFY_VOLUME_TO_CATALOG) { int stat; /* * Note: negative status is an error, zero status, means @@ -198,10 +198,10 @@ bool do_verify(JCR *jcr) jcr->sd_auth_key = bstrdup("dummy"); /* dummy Storage daemon key */ } - if (jcr->get_JobLevel() == L_VERIFY_DISK_TO_CATALOG && jcr->verify_job) { + if (jcr->getJobLevel() == L_VERIFY_DISK_TO_CATALOG && jcr->verify_job) { jcr->fileset = jcr->verify_job->fileset; } - Dmsg2(100, "ClientId=%u JobLevel=%c\n", jcr->previous_jr.ClientId, jcr->get_JobLevel()); + Dmsg2(100, "ClientId=%u JobLevel=%c\n", jcr->previous_jr.ClientId, jcr->getJobLevel()); if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) { Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); @@ -210,9 +210,9 @@ bool do_verify(JCR *jcr) /* Print Job Start message */ Jmsg(jcr, M_INFO, 0, _("Start Verify JobId=%s Level=%s Job=%s\n"), - edit_uint64(jcr->JobId, ed1), level_to_str(jcr->get_JobLevel()), jcr->Job); + edit_uint64(jcr->JobId, ed1), level_to_str(jcr->getJobLevel()), jcr->Job); - if (jcr->get_JobLevel() == L_VERIFY_VOLUME_TO_CATALOG) { + if (jcr->getJobLevel() == L_VERIFY_VOLUME_TO_CATALOG) { BSOCK *sd; /* * Start conversation with Storage daemon @@ -274,7 +274,7 @@ bool do_verify(JCR *jcr) * Send Level command to File daemon, as well * as the Storage address if appropriate. */ - switch (jcr->get_JobLevel()) { + switch (jcr->getJobLevel()) { case L_VERIFY_INIT: level = "init"; break; @@ -308,8 +308,8 @@ bool do_verify(JCR *jcr) level="disk_to_catalog"; break; default: - Jmsg2(jcr, M_FATAL, 0, _("Unimplemented Verify level %d(%c)\n"), jcr->get_JobLevel(), - jcr->get_JobLevel()); + Jmsg2(jcr, M_FATAL, 0, _("Unimplemented Verify level %d(%c)\n"), jcr->getJobLevel(), + jcr->getJobLevel()); goto bail_out; } @@ -331,7 +331,7 @@ bool do_verify(JCR *jcr) * catalog depending on the run type. */ /* Compare to catalog */ - switch (jcr->get_JobLevel()) { + switch (jcr->getJobLevel()) { case L_VERIFY_CATALOG: Dmsg0(10, "Verify level=catalog\n"); jcr->sd_msg_thread_done = true; /* no SD msg thread, so it is done */ @@ -362,7 +362,7 @@ bool do_verify(JCR *jcr) break; default: - Jmsg1(jcr, M_FATAL, 0, _("Unimplemented verify level %d\n"), jcr->get_JobLevel()); + Jmsg1(jcr, M_FATAL, 0, _("Unimplemented verify level %d\n"), jcr->getJobLevel()); goto bail_out; } @@ -391,9 +391,9 @@ void verify_cleanup(JCR *jcr, int TermCode) // Dmsg1(100, "Enter verify_cleanup() TermCod=%d\n", TermCode); - Dmsg3(900, "JobLevel=%c Expected=%u JobFiles=%u\n", jcr->get_JobLevel(), + Dmsg3(900, "JobLevel=%c Expected=%u JobFiles=%u\n", jcr->getJobLevel(), jcr->ExpectedFiles, jcr->JobFiles); - if (jcr->get_JobLevel() == L_VERIFY_VOLUME_TO_CATALOG && + if (jcr->getJobLevel() == L_VERIFY_VOLUME_TO_CATALOG && jcr->ExpectedFiles != jcr->JobFiles) { TermCode = JS_ErrorTerminated; } @@ -445,7 +445,7 @@ void verify_cleanup(JCR *jcr, int TermCode) } jobstatus_to_ascii(jcr->FDJobStatus, fd_term_msg, sizeof(fd_term_msg)); - if (jcr->get_JobLevel() == L_VERIFY_VOLUME_TO_CATALOG) { + if (jcr->getJobLevel() == L_VERIFY_VOLUME_TO_CATALOG) { jobstatus_to_ascii(jcr->SDJobStatus, sd_term_msg, sizeof(sd_term_msg)); Jmsg(jcr, msg_type, 0, _("%s %s %s (%s): %s\n" " Build OS: %s %s %s\n" @@ -469,7 +469,7 @@ void verify_cleanup(JCR *jcr, int TermCode) jcr->jr.JobId, jcr->jr.Job, jcr->fileset->hdr.name, - level_to_str(jcr->get_JobLevel()), + level_to_str(jcr->getJobLevel()), jcr->client->hdr.name, jcr->previous_jr.JobId, Name, @@ -502,7 +502,7 @@ void verify_cleanup(JCR *jcr, int TermCode) jcr->jr.JobId, jcr->jr.Job, jcr->fileset->hdr.name, - level_to_str(jcr->get_JobLevel()), + level_to_str(jcr->getJobLevel()), jcr->client->name(), jcr->previous_jr.JobId, Name, @@ -788,7 +788,7 @@ static int missing_handler(void *ctx, int num_fields, char **row) } if (!jcr->fn_printed) { Qmsg(jcr, M_WARNING, 0, _("The following files are in the Catalog but not on %s:\n"), - jcr->get_JobLevel() == L_VERIFY_VOLUME_TO_CATALOG ? "the Volume(s)" : "disk"); + jcr->getJobLevel() == L_VERIFY_VOLUME_TO_CATALOG ? "the Volume(s)" : "disk"); jcr->fn_printed = true; } Qmsg(jcr, M_INFO, 0, " %s%s\n", row[0]?row[0]:"", row[1]?row[1]:""); diff --git a/bacula/src/filed/accurate.c b/bacula/src/filed/accurate.c index 83574d323e..9b8d06a059 100644 --- a/bacula/src/filed/accurate.c +++ b/bacula/src/filed/accurate.c @@ -100,7 +100,7 @@ static bool accurate_send_base_file_list(JCR *jcr) FF_PKT *ff_pkt; int stream = STREAM_UNIX_ATTRIBUTES; - if (!jcr->accurate || jcr->get_JobLevel() != L_FULL) { + if (!jcr->accurate || jcr->getJobLevel() != L_FULL) { return true; } @@ -183,14 +183,14 @@ bool accurate_finish(JCR *jcr) { bool ret=true; if (jcr->accurate) { - if (jcr->get_JobLevel() == L_FULL) { + if (jcr->getJobLevel() == L_FULL) { ret = accurate_send_base_file_list(jcr); } else { ret = accurate_send_deleted_list(jcr); } accurate_free(jcr); - if (jcr->get_JobLevel() == L_FULL) { + if (jcr->getJobLevel() == L_FULL) { Jmsg(jcr, M_INFO, 0, _("Space saved with Base jobs: %lld MB\n"), jcr->base_size/(1024*1024)); } @@ -271,7 +271,7 @@ bool accurate_check_file(JCR *jcr, FF_PKT *ff_pkt) decode_stat(elt.lstat, &statc, &LinkFIc); /* decode catalog stat */ - if (jcr->get_JobLevel() == L_FULL) { + if (jcr->getJobLevel() == L_FULL) { opts = ff_pkt->BaseJobOpts; } else { opts = ff_pkt->AccurateOpts; @@ -456,7 +456,7 @@ bool accurate_check_file(JCR *jcr, FF_PKT *ff_pkt) /* In Incr/Diff accurate mode, we mark all files as seen * When in Full+Base mode, we mark only if the file match exactly */ - if (jcr->get_JobLevel() == L_FULL) { + if (jcr->getJobLevel() == L_FULL) { if (!stat) { /* compute space saved with basefile */ jcr->base_size += ff_pkt->statp.st_size; diff --git a/bacula/src/filed/fd_plugins.c b/bacula/src/filed/fd_plugins.c index ef24d0520e..84bc3bf423 100644 --- a/bacula/src/filed/fd_plugins.c +++ b/bacula/src/filed/fd_plugins.c @@ -858,12 +858,12 @@ static bRC baculaGetValue(bpContext *ctx, bVariable var, void *value) Dmsg1(dbglvl, "Bacula: return my_name=%s\n", my_name); break; case bVarLevel: - *((int *)value) = jcr->get_JobLevel(); - Dmsg1(dbglvl, "Bacula: return bVarJobLevel=%d\n", jcr->get_JobLevel()); + *((int *)value) = jcr->getJobLevel(); + Dmsg1(dbglvl, "Bacula: return bVarJobLevel=%d\n", jcr->getJobLevel()); break; case bVarType: - *((int *)value) = jcr->get_JobType(); - Dmsg1(dbglvl, "Bacula: return bVarJobType=%d\n", jcr->get_JobType()); + *((int *)value) = jcr->getJobType(); + Dmsg1(dbglvl, "Bacula: return bVarJobType=%d\n", jcr->getJobType()); break; case bVarClient: *((char **)value) = jcr->client_name; diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index de8bf579bb..3616754f31 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -1298,7 +1298,7 @@ static int level_cmd(JCR *jcr) buf = get_memory(dir->msglen+1); utime_t since_time, adj; btime_t his_time, bt_start, rt=0, bt_adj=0; - if (jcr->get_JobLevel() == L_NONE) { + if (jcr->getJobLevel() == L_NONE) { jcr->set_JobLevel(L_SINCE); /* if no other job level set, do it now */ } if (sscanf(dir->msg, "level = since_utime %s mtime_only=%d", @@ -1361,7 +1361,7 @@ static int level_cmd(JCR *jcr) if (buf) { free_memory(buf); } - generate_plugin_event(jcr, bEventLevel, (void *)jcr->get_JobLevel()); + generate_plugin_event(jcr, bEventLevel, (void *)jcr->getJobLevel()); return dir->fsend(OKlevel); bail_out: @@ -1728,12 +1728,12 @@ static int verify_cmd(JCR *jcr) dir->fsend(OKverify); generate_daemon_event(jcr, "JobStart"); - generate_plugin_event(jcr, bEventLevel, (void *)jcr->get_JobLevel()); + generate_plugin_event(jcr, bEventLevel, (void *)jcr->getJobLevel()); generate_plugin_event(jcr, bEventStartVerifyJob); Dmsg1(110, "filed>dird: %s", dir->msg); - switch (jcr->get_JobLevel()) { + switch (jcr->getJobLevel()) { case L_VERIFY_INIT: case L_VERIFY_CATALOG: do_verify(jcr); diff --git a/bacula/src/filed/status.c b/bacula/src/filed/status.c index 78d447cf71..6d7c935046 100644 --- a/bacula/src/filed/status.c +++ b/bacula/src/filed/status.c @@ -192,7 +192,7 @@ static void list_running_jobs(STATUS_PKT *sp) njcr->JobId, njcr->Job); sendit(msg.c_str(), len, sp); len = Mmsg(msg, _(" %s%s Job started: %s\n"), - vss, job_type_to_str(njcr->get_JobType()), dt); + vss, job_type_to_str(njcr->getJobType()), dt); } sendit(msg.c_str(), len, sp); if (njcr->JobId == 0) { diff --git a/bacula/src/filed/verify.c b/bacula/src/filed/verify.c index d3ef3b6562..89f161504b 100644 --- a/bacula/src/filed/verify.c +++ b/bacula/src/filed/verify.c @@ -369,7 +369,7 @@ static int read_digest(BFILE *bfd, DIGEST *digest, JCR *jcr) crypto_digest_update(digest, (uint8_t *)buf, n); /* Can be used by BaseJobs, update only for Verify jobs */ - if (jcr->get_JobLevel() != L_FULL) { + if (jcr->getJobLevel() != L_FULL) { jcr->JobBytes += n; jcr->ReadBytes += n; } diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index ce54ef5464..4513e800f6 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -183,7 +183,7 @@ public: void unlock() {V(mutex); }; void inc_use_count(void) {lock(); _use_count++; unlock(); }; void dec_use_count(void) {lock(); _use_count--; unlock(); }; - int32_t use_count() { return _use_count; }; + int32_t use_count() const { return _use_count; }; void init_mutex(void) {pthread_mutex_init(&mutex, NULL); }; void destroy_mutex(void) {pthread_mutex_destroy(&mutex); }; bool is_job_canceled() {return job_canceled(this); }; @@ -191,11 +191,10 @@ public: void setJobLevel(int32_t JobLevel) { m_JobLevel = JobLevel; }; void set_JobType(int32_t JobType) { m_JobType = JobType; }; void setJobType(int32_t JobType) { m_JobType = JobType; }; - int32_t get_JobType() { return m_JobType; }; - int32_t getJobType() { return m_JobType; }; - int32_t get_JobLevel() { return m_JobLevel; }; - int32_t getJobLevel() { return m_JobLevel; }; - bool no_client_used() { + int32_t getJobType() const { return m_JobType; }; + int32_t getJobLevel() const { return m_JobLevel; }; + int32_t getJobStatus() const { return JobStatus; }; + bool no_client_used() const { return (m_JobType == JT_MIGRATE || m_JobType == JT_COPY || m_JobLevel == L_VIRTUAL_FULL); }; @@ -474,7 +473,7 @@ struct s_last_job { }; extern struct s_last_job last_job; -extern DLL_IMP_EXP dlist * last_jobs; +extern DLL_IMP_EXP dlist *last_jobs; /* The following routines are found in lib/jcr.c */ diff --git a/bacula/src/lib/jcr.c b/bacula/src/lib/jcr.c index f2240c2389..7bf2ac08e5 100644 --- a/bacula/src/lib/jcr.c +++ b/bacula/src/lib/jcr.c @@ -523,7 +523,7 @@ void free_jcr(JCR *jcr) Dmsg1(dbglvl, "End job=%d\n", jcr->JobId); /* Keep some statistics */ - switch (jcr->get_JobType()) { + switch (jcr->getJobType()) { case JT_BACKUP: case JT_VERIFY: case JT_RESTORE: @@ -537,7 +537,7 @@ void free_jcr(JCR *jcr) je = (struct s_last_job *)malloc(sizeof(struct s_last_job)); memset(je, 0, sizeof(struct s_last_job)); /* zero in case unset fields */ je->Errors = jcr->JobErrors; - je->JobType = jcr->get_JobType(); + je->JobType = jcr->getJobType(); je->JobId = jcr->JobId; je->VolSessionId = jcr->VolSessionId; je->VolSessionTime = jcr->VolSessionTime; @@ -545,7 +545,7 @@ void free_jcr(JCR *jcr) je->JobFiles = jcr->JobFiles; je->JobBytes = jcr->JobBytes; je->JobStatus = jcr->JobStatus; - je->JobLevel = jcr->get_JobLevel(); + je->JobLevel = jcr->getJobLevel(); je->start_time = jcr->start_time; je->end_time = time(NULL); @@ -1126,7 +1126,7 @@ void dbg_print_jcr(FILE *fp) jcr, (int)jcr->JobId, jcr->Job, jcr->JobStatus); fprintf(fp, "\tuse_count=%i\n", jcr->use_count()); fprintf(fp, "\tJobType=%c JobLevel=%c\n", - jcr->get_JobType(), jcr->get_JobLevel()); + jcr->getJobType(), jcr->getJobLevel()); bstrftime(buf1, sizeof(buf1), jcr->sched_time); bstrftime(buf2, sizeof(buf2), jcr->start_time); bstrftime(buf3, sizeof(buf3), jcr->end_time); diff --git a/bacula/src/lib/util.c b/bacula/src/lib/util.c index 430f44b89a..06f685806a 100644 --- a/bacula/src/lib/util.c +++ b/bacula/src/lib/util.c @@ -774,7 +774,7 @@ POOLMEM *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to, job_co break; case 'l': if (jcr) { - str = job_level_to_str(jcr->get_JobLevel()); + str = job_level_to_str(jcr->getJobLevel()); } else { str = _("*none*"); } @@ -805,7 +805,7 @@ POOLMEM *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to, job_co break; case 't': if (jcr) { - str = job_type_to_str(jcr->get_JobType()); + str = job_type_to_str(jcr->getJobType()); } else { str = _("*none*"); } diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index a63fcc0b16..7623702a34 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -667,7 +667,7 @@ static void attach_dcr_to_dev(DCR *dcr) dev = dcr->dev; jcr = dcr->jcr; if (jcr) Dmsg1(500, "JobId=%u enter attach_dcr_to_dev\n", (uint32_t)jcr->JobId); - if (!dcr->attached_to_dev && dev->initiated && jcr && jcr->get_JobType() != JT_SYSTEM) { + if (!dcr->attached_to_dev && dev->initiated && jcr && jcr->getJobType() != JT_SYSTEM) { dev->attached_dcrs->append(dcr); /* attach dcr to device */ dcr->attached_to_dev = true; Dmsg1(500, "JobId=%u attach_dcr_to_dev\n", (uint32_t)jcr->JobId); diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c index b85d78e6eb..6bbc127937 100644 --- a/bacula/src/stored/askdir.c +++ b/bacula/src/stored/askdir.c @@ -330,7 +330,7 @@ bool dir_update_volume_info(DCR *dcr, bool label, bool update_LastWritten) POOL_MEM VolumeName; /* If system job, do not update catalog */ - if (jcr->get_JobType() == JT_SYSTEM) { + if (jcr->getJobType() == JT_SYSTEM) { return true; } @@ -394,7 +394,7 @@ bool dir_create_jobmedia_record(DCR *dcr, bool zero) char ed1[50]; /* If system job, do not update catalog */ - if (jcr->get_JobType() == JT_SYSTEM) { + if (jcr->getJobType() == JT_SYSTEM) { return true; } diff --git a/bacula/src/stored/block.c b/bacula/src/stored/block.c index 7899621399..a36edfeef5 100644 --- a/bacula/src/stored/block.c +++ b/bacula/src/stored/block.c @@ -382,7 +382,7 @@ bool write_block_to_device(DCR *dcr) } if (!write_block_to_dev(dcr)) { - if (job_canceled(jcr) || jcr->get_JobType() == JT_SYSTEM) { + if (job_canceled(jcr) || jcr->getJobType() == JT_SYSTEM) { stat = false; } else { stat = fixup_device_block_write_error(dcr); diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index 55c1fe13f3..9372ab6895 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -1157,7 +1157,7 @@ static int update_job_record(B_DB *db, JOB_DBR *jr, SESSION_LABEL *elabel, } if (verbose) { Pmsg3(000, _("Updated Job termination record for JobId=%u Level=%s TermStat=%c\n"), - jr->JobId, job_level_to_str(mjcr->get_JobLevel()), jr->JobStatus); + jr->JobId, job_level_to_str(mjcr->getJobLevel()), jr->JobStatus); } if (verbose > 1) { const char *term_msg; @@ -1204,7 +1204,7 @@ static int update_job_record(B_DB *db, JOB_DBR *jr, SESSION_LABEL *elabel, mjcr->JobId, mjcr->Job, mjcr->fileset_name, - job_level_to_str(mjcr->get_JobLevel()), + job_level_to_str(mjcr->getJobLevel()), mjcr->client_name, sdt, edt, diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index cfb43128f0..99f285b550 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -671,8 +671,8 @@ void create_session_label(DCR *dcr, DEV_RECORD *rec, int label) /* Added in VerNum 10 */ ser_string(jcr->Job); /* Unique name of this Job */ ser_string(jcr->fileset_name); - ser_uint32(jcr->get_JobType()); - ser_uint32(jcr->get_JobLevel()); + ser_uint32(jcr->getJobType()); + ser_uint32(jcr->getJobLevel()); /* Added in VerNum 11 */ ser_string(jcr->fileset_md5); diff --git a/bacula/src/stored/mac.c b/bacula/src/stored/mac.c index ce2c370797..1c02637945 100644 --- a/bacula/src/stored/mac.c +++ b/bacula/src/stored/mac.c @@ -57,7 +57,7 @@ bool do_mac(JCR *jcr) char ec1[50]; DEVICE *dev; - switch(jcr->get_JobType()) { + switch(jcr->getJobType()) { case JT_MIGRATE: Type = "Migration"; break; @@ -207,7 +207,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec) case EOM_LABEL: return true; /* don't write vol labels */ } -// if (jcr->get_JobType() == JT_BACKUP) { +// if (jcr->getJobType() == JT_BACKUP) { /* * For normal migration jobs, FileIndex values are sequential because * we are dealing with one job. However, for Vbackup (consolidation), diff --git a/bacula/src/stored/status.c b/bacula/src/stored/status.c index 11939fb247..a1fa4ddee9 100644 --- a/bacula/src/stored/status.c +++ b/bacula/src/stored/status.c @@ -400,7 +400,7 @@ static void list_running_jobs(STATUS_PKT *sp) foreach_jcr(jcr) { if (jcr->JobStatus == JS_WaitFD) { len = Mmsg(msg, _("%s Job %s waiting for Client connection.\n"), - job_type_to_str(jcr->get_JobType()), jcr->Job); + job_type_to_str(jcr->getJobType()), jcr->Job); sendit(msg, len, sp); } dcr = jcr->dcr; @@ -417,8 +417,8 @@ static void list_running_jobs(STATUS_PKT *sp) if (rdcr && rdcr->device) { len = Mmsg(msg, _("Reading: %s %s job %s JobId=%d Volume=\"%s\"\n" " pool=\"%s\" device=%s\n"), - job_level_to_str(jcr->get_JobLevel()), - job_type_to_str(jcr->get_JobType()), + job_level_to_str(jcr->getJobLevel()), + job_type_to_str(jcr->getJobType()), JobName, jcr->JobId, rdcr->VolumeName, @@ -430,8 +430,8 @@ static void list_running_jobs(STATUS_PKT *sp) if (dcr && dcr->device) { len = Mmsg(msg, _("Writing: %s %s job %s JobId=%d Volume=\"%s\"\n" " pool=\"%s\" device=%s\n"), - job_level_to_str(jcr->get_JobLevel()), - job_type_to_str(jcr->get_JobType()), + job_level_to_str(jcr->getJobLevel()), + job_type_to_str(jcr->getJobType()), JobName, jcr->JobId, dcr->VolumeName,