/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2010 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
*
* Kern E. Sibbald, December 2000
*
- * Version $Id$
- *
* These routines are thread safe.
*
* The job list routines were re-written in May 2005 to
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:
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;
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);
}
}
+/*
+ * Return number of Jobs
+ */
+int job_count()
+{
+ JCR *jcr;
+ int count = 0;
+
+ lock_jcr_chain();
+ for (jcr = (JCR *)jcrs->first(); jcr = (JCR *)jcrs->next(jcr); ) {
+ if (jcr->JobId > 0) {
+ count++;
+ }
+ }
+ unlock_jcr_chain();
+ return count;
+}
+
/*
* Setup to call the timeout check routine every 30 seconds
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);