From: Kern S. <ke...@us...> - 2005-05-26 18:58:55
|
Update of /cvsroot/bacula/bacula/src/dird In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29022/src/dird Modified Files: dird.c job.c jobq.c pythondir.c ua_cmds.c ua_status.c Log Message: - Make JCR a class and implement inc_use_count() and dec_use_count() methods that ensure that the jcr is locked when inc/dec the use count. - Remove the global jcr lock when traversing the jcr chain. - Use dlist to implement the jcr chain rather than hand crafted next and prev links. - Lock the jcr chain inside each function that modifies the chain. Index: dird.c =================================================================== RCS file: /cvsroot/bacula/bacula/src/dird/dird.c,v retrieving revision 1.89 retrieving revision 1.90 diff -u -d -r1.89 -r1.90 --- dird.c 16 May 2005 07:25:05 -0000 1.89 +++ dird.c 26 May 2005 18:58:13 -0000 1.90 @@ -392,8 +392,6 @@ sigaddset(&set, SIGHUP); sigprocmask(SIG_BLOCK, &set, NULL); -// Jmsg(NULL, M_INFO, 0, "Entering experimental reload config code. Bug reports will not be accepted.\n"); - lock_jcr_chain(); LockRes(); @@ -437,7 +435,7 @@ job_end_push(jcr, reload_job_end_cb, (void *)((long int)table)); njobs++; } - free_locked_jcr(jcr); + free_jcr(jcr); } } @@ -447,8 +445,6 @@ SDConnectTimeout = director->SDConnectTimeout; Dmsg0(0, "Director's configuration file reread.\n"); -// init_device_resources(); /* Update Device resources */ - /* Now release saved resources, if no jobs using the resources */ if (njobs == 0) { free_saved_resources(table); Index: job.c =================================================================== RCS file: /cvsroot/bacula/bacula/src/dird/job.c,v retrieving revision 1.110 retrieving revision 1.111 diff -u -d -r1.110 -r1.111 --- job.c 6 May 2005 15:54:58 -0000 1.110 +++ job.c 26 May 2005 18:58:13 -0000 1.111 @@ -10,19 +10,14 @@ Copyright (C) 2000-2005 Kern Sibbald This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. + modify it under the terms of the GNU General Public License + version 2 as ammended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. */ @@ -445,8 +440,6 @@ Dmsg1(800, "job_monitor_watchdog %p called\n", self); - lock_jcr_chain(); - foreach_jcr(jcr) { bool cancel; @@ -454,7 +447,7 @@ Dmsg2(800, "Skipping JCR %p (%s) with JobId 0\n", jcr, jcr->Job); /* Keep reference counts correct */ - free_locked_jcr(jcr); + free_jcr(jcr); continue; } @@ -477,9 +470,8 @@ } /* Keep reference counts correct */ - free_locked_jcr(jcr); + free_jcr(jcr); } - unlock_jcr_chain(); } /* Index: pythondir.c =================================================================== RCS file: /cvsroot/bacula/bacula/src/dird/pythondir.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- pythondir.c 10 May 2005 12:56:23 -0000 1.4 +++ pythondir.c 26 May 2005 18:58:14 -0000 1.5 @@ -7,24 +7,18 @@ * Version $Id$ * */ - /* Copyright (C) 2004-2005 Kern Sibbald This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. + modify it under the terms of the GNU General Public License + version 2 as ammended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. */ @@ -296,23 +290,20 @@ Dmsg0(000, "Parse tuple error in job_write\n"); return NULL; } - lock_jcr_chain(); foreach_jcr(jcr) { if (jcr->JobId == 0) { - free_locked_jcr(jcr); /* OK to free now cuz chain is locked */ + free_jcr(jcr); continue; } if (jcr->JobId == JobId) { found = true; - break; + break; } } if (!found) { - unlock_jcr_chain(); /* ***FIXME*** raise exception */ return NULL; } - unlock_jcr_chain(); PyEval_ReleaseLock(); UAContext *ua = new_ua_context(jcr); ua->batch = true; @@ -321,7 +312,7 @@ return NULL; } free_ua_context(ua); - free_locked_jcr(jcr); + free_jcr(jcr); PyEval_AcquireLock(); Py_INCREF(Py_None); return Py_None; Index: ua_cmds.c =================================================================== RCS file: /cvsroot/bacula/bacula/src/dird/ua_cmds.c,v retrieving revision 1.142 retrieving revision 1.143 diff -u -d -r1.142 -r1.143 --- ua_cmds.c 16 May 2005 09:35:28 -0000 1.142 +++ ua_cmds.c 26 May 2005 18:58:14 -0000 1.143 @@ -6,24 +6,18 @@ * * Version $Id$ */ - /* Copyright (C) 2000-2005 Kern Sibbald This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. + modify it under the terms of the GNU General Public License + version 2 as ammended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. */ @@ -399,33 +393,29 @@ if (!jcr) { char buf[1000]; /* Count Jobs running */ - lock_jcr_chain(); foreach_jcr(jcr) { if (jcr->JobId == 0) { /* this is us */ - free_locked_jcr(jcr); + free_jcr(jcr); continue; } - free_locked_jcr(jcr); + free_jcr(jcr); njobs++; } - unlock_jcr_chain(); if (njobs == 0) { bsendmsg(ua, _("No Jobs running.\n")); return 1; } start_prompt(ua, _("Select Job:\n")); - lock_jcr_chain(); foreach_jcr(jcr) { if (jcr->JobId == 0) { /* this is us */ - free_locked_jcr(jcr); + free_jcr(jcr); continue; } bsnprintf(buf, sizeof(buf), "JobId=%d Job=%s", jcr->JobId, jcr->Job); add_prompt(ua, buf); - free_locked_jcr(jcr); + free_jcr(jcr); } - unlock_jcr_chain(); if (do_prompt(ua, _("Job"), _("Choose Job to cancel"), buf, sizeof(buf)) < 0) { return 1; @@ -1355,16 +1345,14 @@ bmicrosleep(0, 200000); /* let job actually start */ for (bool running=true; running; ) { running = false; - lock_jcr_chain(); foreach_jcr(jcr) { if (jcr->JobId != 0) { running = true; - free_locked_jcr(jcr); + free_jcr(jcr); break; } - free_locked_jcr(jcr); + free_jcr(jcr); } - unlock_jcr_chain(); if (running) { bmicrosleep(1, 0); } Index: jobq.c =================================================================== RCS file: /cvsroot/bacula/bacula/src/dird/jobq.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- jobq.c 1 Apr 2005 15:21:40 -0000 1.34 +++ jobq.c 26 May 2005 18:58:14 -0000 1.35 @@ -229,7 +229,6 @@ sched_pkt = (wait_pkt *)malloc(sizeof(wait_pkt)); sched_pkt->jcr = jcr; sched_pkt->jq = jq; -// jcr->use_count--; /* release our use of jcr */ stat = pthread_create(&id, &jq->attr, sched_wait, (void *)sched_pkt); if (stat != 0) { /* thread not created */ berrno be; Index: ua_status.c =================================================================== RCS file: /cvsroot/bacula/bacula/src/dird/ua_status.c,v retrieving revision 1.66 retrieving revision 1.67 diff -u -d -r1.66 -r1.67 --- ua_status.c 1 Apr 2005 15:21:41 -0000 1.66 +++ ua_status.c 26 May 2005 18:58:14 -0000 1.67 @@ -6,27 +6,22 @@ * * Version $Id$ */ - /* - Copyright (C) 2000-2005 Kern Sibbald + Copyright (C) 2001-2005 Kern Sibbald This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. + modify it under the terms of the GNU General Public License + version 2 as ammended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. */ + #include "bacula.h" #include "dird.h" @@ -65,20 +60,18 @@ if (strcasecmp(ua->argk[2], "current") == 0) { bsendmsg(ua, OKqstatus, ua->argk[2]); - lock_jcr_chain(); foreach_jcr(njcr) { - if (njcr->JobId != 0) { - bsendmsg(ua, DotStatusJob, njcr->JobId, njcr->JobStatus, njcr->JobErrors); - } - free_locked_jcr(njcr); + if (njcr->JobId != 0) { + bsendmsg(ua, DotStatusJob, njcr->JobId, njcr->JobStatus, njcr->JobErrors); + } + free_jcr(njcr); } - unlock_jcr_chain(); } else if (strcasecmp(ua->argk[2], "last") == 0) { bsendmsg(ua, OKqstatus, ua->argk[2]); if ((last_jobs) && (last_jobs->size() > 0)) { - job = (s_last_job*)last_jobs->last(); - bsendmsg(ua, DotStatusJob, job->JobId, job->JobStatus, job->Errors); + job = (s_last_job*)last_jobs->last(); + bsendmsg(ua, DotStatusJob, job->JobId, job->JobStatus, job->Errors); } } else { @@ -105,24 +98,24 @@ for (i=1; i<ua->argc; i++) { if (strcasecmp(ua->argk[i], _("all")) == 0) { - do_all_status(ua); - return 1; + do_all_status(ua); + return 1; } else if (strcasecmp(ua->argk[i], _("dir")) == 0 || strcasecmp(ua->argk[i], _("director")) == 0) { - do_director_status(ua); - return 1; + do_director_status(ua); + return 1; } else if (strcasecmp(ua->argk[i], _("client")) == 0) { - client = get_client_resource(ua); - if (client) { - do_client_status(ua, client); - } - return 1; + client = get_client_resource(ua); + if (client) { + do_client_status(ua, client); + } + return 1; } else { - store = get_storage_resource(ua, 0); - if (store) { - do_storage_status(ua, store); - } - return 1; + store = get_storage_resource(ua, 0); + if (store) { + do_storage_status(ua, store); + } + return 1; } } /* If no args, ask for status type */ @@ -136,30 +129,30 @@ add_prompt(ua, _("All")); Dmsg0(20, "do_prompt: select daemon\n"); if ((item=do_prompt(ua, "", _("Select daemon type for status"), prmt, sizeof(prmt))) < 0) { - return 1; + return 1; } Dmsg1(20, "item=%d\n", item); switch (item) { - case 0: /* Director */ - do_director_status(ua); - break; + case 0: /* Director */ + do_director_status(ua); + break; case 1: - store = select_storage_resource(ua); - if (store) { - do_storage_status(ua, store); - } - break; + store = select_storage_resource(ua); + if (store) { + do_storage_status(ua, store); + } + break; case 2: - client = select_client_resource(ua); - if (client) { - do_client_status(ua, client); - } - break; + client = select_client_resource(ua); + if (client) { + do_client_status(ua, client); + } + break; case 3: - do_all_status(ua); - break; + do_all_status(ua); + break; default: - break; + break; } } return 1; @@ -186,17 +179,17 @@ foreach_res(store, R_STORAGE) { found = false; if (!acl_access_ok(ua, Storage_ACL, store->hdr.name)) { - continue; + continue; } for (j=0; j<i; j++) { - if (strcmp(unique_store[j]->address, store->address) == 0 && - unique_store[j]->SDport == store->SDport) { - found = true; - break; - } + if (strcmp(unique_store[j]->address, store->address) == 0 && + unique_store[j]->SDport == store->SDport) { + found = true; + break; + } } if (!found) { - unique_store[i++] = store; + unique_store[i++] = store; Dmsg2(40, "Stuffing: %s:%d\n", store->address, store->SDport); } } @@ -220,17 +213,17 @@ foreach_res(client, R_CLIENT) { found = false; if (!acl_access_ok(ua, Client_ACL, client->hdr.name)) { - continue; + continue; } for (j=0; j<i; j++) { - if (strcmp(unique_client[j]->address, client->address) == 0 && - unique_client[j]->FDport == client->FDport) { - found = true; - break; - } + if (strcmp(unique_client[j]->address, client->address) == 0 && + unique_client[j]->FDport == client->FDport) { + found = true; + break; + } } if (!found) { - unique_client[i++] = client; + unique_client[i++] = client; Dmsg2(40, "Stuffing: %s:%d\n", client->address, client->FDport); } } @@ -249,17 +242,17 @@ char dt[MAX_TIME_LENGTH]; bsendmsg(ua, "%s Version: " VERSION " (" BDATE ") %s %s %s\n", my_name, - HOST_OS, DISTNAME, DISTVER); + HOST_OS, DISTNAME, DISTVER); bstrftime_nc(dt, sizeof(dt), daemon_start_time); bsendmsg(ua, _("Daemon started %s, %d Job%s run since started.\n"), dt, num_jobs_run, num_jobs_run == 1 ? "" : "s"); if (debug_level > 0) { char b1[35], b2[35], b3[35], b4[35]; bsendmsg(ua, _(" Heap: bytes=%s max_bytes=%s bufs=%s max_bufs=%s\n"), - edit_uint64_with_commas(sm_bytes, b1), - edit_uint64_with_commas(sm_max_bytes, b2), - edit_uint64_with_commas(sm_buffers, b3), - edit_uint64_with_commas(sm_max_buffers, b4)); + edit_uint64_with_commas(sm_bytes, b1), + edit_uint64_with_commas(sm_max_bytes, b2), + edit_uint64_with_commas(sm_buffers, b3), + edit_uint64_with_commas(sm_max_buffers, b4)); } /* * List scheduled Jobs @@ -288,10 +281,10 @@ store->hdr.name, store->address, store->SDport); if (!connect_to_storage_daemon(ua->jcr, 1, 15, 0)) { bsendmsg(ua, _("\nFailed to connect to Storage daemon %s.\n====\n"), - store->hdr.name); + store->hdr.name); if (ua->jcr->store_bsock) { - bnet_close(ua->jcr->store_bsock); - ua->jcr->store_bsock = NULL; + bnet_close(ua->jcr->store_bsock); + ua->jcr->store_bsock = NULL; } return; } @@ -326,10 +319,10 @@ client->hdr.name, client->address, client->FDport); if (!connect_to_file_daemon(ua->jcr, 1, 15, 0)) { bsendmsg(ua, _("Failed to connect to Client %s.\n====\n"), - client->hdr.name); + client->hdr.name); if (ua->jcr->file_bsock) { - bnet_close(ua->jcr->file_bsock); - ua->jcr->file_bsock = NULL; + bnet_close(ua->jcr->file_bsock); + ua->jcr->file_bsock = NULL; } return; } @@ -355,7 +348,7 @@ /* Scheduling packet */ struct sched_pkt { - dlink link; /* keep this as first item!!! */ + dlink link; /* keep this as first item!!! */ JOB *job; int level; int priority; @@ -377,11 +370,11 @@ jcr->db = NULL; ok = complete_jcr_for_job(jcr, sp->job, sp->pool); if (jcr->db) { - close_db = true; /* new db opened, remember to close it */ + close_db = true; /* new db opened, remember to close it */ } if (ok) { mr.PoolId = jcr->PoolId; - ok = find_next_volume_for_append(jcr, &mr, 0); + ok = find_next_volume_for_append(jcr, &mr, 0); } if (!ok) { bstrncpy(mr.VolumeName, "*unknown*", sizeof(mr.VolumeName)); @@ -403,7 +396,7 @@ if (close_db) { db_close_database(jcr, jcr->db); } - jcr->db = ua->db; /* restore ua db to jcr */ + jcr->db = ua->db; /* restore ua db to jcr */ } @@ -448,29 +441,29 @@ LockRes(); foreach_res(job, R_JOB) { if (!acl_access_ok(ua, Job_ACL, job->hdr.name)) { - continue; + continue; } for (run=NULL; (run = find_next_run(run, job, runtime)); ) { - level = job->JobLevel; - if (run->level) { - level = run->level; - } - priority = job->Priority; - if (run->Priority) { - priority = run->Priority; - } - if (!hdr_printed) { - prt_runhdr(ua); - hdr_printed = true; - } - sp = (sched_pkt *)malloc(sizeof(sched_pkt)); - sp->job = job; - sp->level = level; - sp->priority = priority; - sp->runtime = runtime; - sp->pool = run->pool; - sched.binary_insert(sp, my_compare); - num_jobs++; + level = job->JobLevel; + if (run->level) { + level = run->level; + } + priority = job->Priority; + if (run->Priority) { + priority = run->Priority; + } + if (!hdr_printed) { + prt_runhdr(ua); + hdr_printed = true; + } + sp = (sched_pkt *)malloc(sizeof(sched_pkt)); + sp->job = job; + sp->level = level; + sp->priority = priority; + sp->runtime = runtime; + sp->pool = run->pool; + sched.binary_insert(sp, my_compare); + num_jobs++; } } /* end for loop over resources */ UnlockRes(); @@ -489,30 +482,28 @@ JCR *jcr; int njobs = 0; const char *msg; - char *emsg; /* edited message */ + char *emsg; /* edited message */ char dt[MAX_TIME_LENGTH]; char level[10]; bool pool_mem = false; Dmsg0(200, "enter list_run_jobs()\n"); bsendmsg(ua, _("\nRunning Jobs:\n")); - lock_jcr_chain(); foreach_jcr(jcr) { njobs++; - if (jcr->JobId == 0) { /* this is us */ - /* this is a console or other control job. We only show console - * jobs in the status output. - */ - if (jcr->JobType == JT_CONSOLE) { - bstrftime_nc(dt, sizeof(dt), jcr->start_time); + if (jcr->JobId == 0) { /* this is us */ + /* this is a console or other control job. We only show console + * jobs in the status output. + */ + if (jcr->JobType == JT_CONSOLE) { + bstrftime_nc(dt, sizeof(dt), jcr->start_time); bsendmsg(ua, _("Console connected at %s\n"), dt); - } - njobs--; + } + njobs--; } - free_locked_jcr(jcr); + free_jcr(jcr); } if (njobs == 0) { - unlock_jcr_chain(); /* Note the following message is used in regress -- don't change */ bsendmsg(ua, _("No Jobs running.\n====\n")); Dmsg0(200, "leave list_run_jobs()\n"); @@ -523,128 +514,127 @@ bsendmsg(ua, _("======================================================================\n")); foreach_jcr(jcr) { if (jcr->JobId == 0 || !acl_access_ok(ua, Job_ACL, jcr->job->hdr.name)) { - free_locked_jcr(jcr); - continue; + free_jcr(jcr); + continue; } njobs++; switch (jcr->JobStatus) { case JS_Created: msg = _("is waiting execution"); - break; + break; case JS_Running: msg = _("is running"); - break; + break; case JS_Blocked: msg = _("is blocked"); - break; + break; case JS_Terminated: msg = _("has terminated"); - break; + break; case JS_ErrorTerminated: msg = _("has erred"); - break; + break; case JS_Error: msg = _("has errors"); - break; + break; case JS_FatalError: msg = _("has a fatal error"); - break; + break; case JS_Differences: msg = _("has verify differences"); - break; + break; case JS_Canceled: msg = _("has been canceled"); - break; + break; case JS_WaitFD: - emsg = (char *) get_pool_memory(PM_FNAME); + emsg = (char *) get_pool_memory(PM_FNAME); Mmsg(emsg, _("is waiting on Client %s"), jcr->client->hdr.name); - pool_mem = true; - msg = emsg; - break; + pool_mem = true; + msg = emsg; + break; case JS_WaitSD: - emsg = (char *) get_pool_memory(PM_FNAME); + emsg = (char *) get_pool_memory(PM_FNAME); Mmsg(emsg, _("is waiting on Storage %s"), jcr->store->hdr.name); - pool_mem = true; - msg = emsg; - break; + pool_mem = true; + msg = emsg; + break; case JS_WaitStoreRes: msg = _("is waiting on max Storage jobs"); - break; + break; case JS_WaitClientRes: msg = _("is waiting on max Client jobs"); - break; + break; case JS_WaitJobRes: msg = _("is waiting on max Job jobs"); - break; + break; case JS_WaitMaxJobs: msg = _("is waiting on max total jobs"); - break; + break; case JS_WaitStartTime: msg = _("is waiting for its start time"); - break; + break; case JS_WaitPriority: msg = _("is waiting for higher priority jobs to finish"); - break; + break; default: - emsg = (char *) get_pool_memory(PM_FNAME); + emsg = (char *) get_pool_memory(PM_FNAME); Mmsg(emsg, _("is in unknown state %c"), jcr->JobStatus); - pool_mem = true; - msg = emsg; - break; + pool_mem = true; + msg = emsg; + break; } /* * Now report Storage daemon status code */ switch (jcr->SDJobStatus) { case JS_WaitMount: - if (pool_mem) { - free_pool_memory(emsg); - pool_mem = false; - } + if (pool_mem) { + free_pool_memory(emsg); + pool_mem = false; + } msg = _("is waiting for a mount request"); - break; + break; case JS_WaitMedia: - if (pool_mem) { - free_pool_memory(emsg); - pool_mem = false; - } + if (pool_mem) { + free_pool_memory(emsg); + pool_mem = false; + } msg = _("is waiting for an appendable Volume"); - break; + break; case JS_WaitFD: - if (!pool_mem) { - emsg = (char *) get_pool_memory(PM_FNAME); - pool_mem = true; - } + if (!pool_mem) { + emsg = (char *) get_pool_memory(PM_FNAME); + pool_mem = true; + } Mmsg(emsg, _("is waiting for Client %s to connect to Storage %s"), - jcr->client->hdr.name, jcr->store->hdr.name); - msg = emsg; - break; + jcr->client->hdr.name, jcr->store->hdr.name); + msg = emsg; + break; } switch (jcr->JobType) { case JT_ADMIN: case JT_RESTORE: bstrncpy(level, " ", sizeof(level)); - break; + break; default: - bstrncpy(level, level_to_str(jcr->JobLevel), sizeof(level)); - level[7] = 0; - break; + bstrncpy(level, level_to_str(jcr->JobLevel), sizeof(level)); + level[7] = 0; + break; } bsendmsg(ua, _("%6d %-6s %-20s %s\n"), - jcr->JobId, - level, - jcr->Job, - msg); + jcr->JobId, + level, + jcr->Job, + msg); if (pool_mem) { - free_pool_memory(emsg); - pool_mem = false; + free_pool_memory(emsg); + pool_mem = false; } - free_locked_jcr(jcr); + free_jcr(jcr); } - unlock_jcr_chain(); bsendmsg(ua, "====\n"); Dmsg0(200, "leave list_run_jobs()\n"); } @@ -672,12 +662,12 @@ char *p; for (int i=0; i<3; i++) { if ((p=strrchr(JobName, '.')) != NULL) { - *p = 0; - } + *p = 0; + } } if (!acl_access_ok(ua, Job_ACL, JobName)) { - continue; + continue; } bstrftime_nc(dt, sizeof(dt), je->end_time); @@ -685,40 +675,40 @@ case JT_ADMIN: case JT_RESTORE: bstrncpy(level, " ", sizeof(level)); - break; + break; default: - bstrncpy(level, level_to_str(je->JobLevel), sizeof(level)); - level[4] = 0; - break; + bstrncpy(level, level_to_str(je->JobLevel), sizeof(level)); + level[4] = 0; + break; } switch (je->JobStatus) { case JS_Created: termstat = "Created"; - break; + break; case JS_FatalError: case JS_ErrorTerminated: termstat = "Error"; - break; + break; case JS_Differences: termstat = "Diffs"; - break; + break; case JS_Canceled: termstat = "Cancel"; - break; + break; case JS_Terminated: termstat = "OK"; - break; + break; default: termstat = "Other"; - break; + break; } bsendmsg(ua, _("%6d %-6s %8s %14s %-7s %-8s %s\n"), - je->JobId, - level, - edit_uint64_with_commas(je->JobFiles, b1), - edit_uint64_with_commas(je->JobBytes, b2), - termstat, - dt, JobName); + je->JobId, + level, + edit_uint64_with_commas(je->JobFiles, b1), + edit_uint64_with_commas(je->JobBytes, b2), + termstat, + dt, JobName); } bsendmsg(ua, "\n"); unlock_last_jobs_list(); |