#include "bacula.h"
#include "dird.h"
-#define PHIL
+/* #define PHIL */
/* Local variables */
bstrftime_nc(dt, sizeof(dt), runtime);
bstrftime_nc(dt1, sizeof(dt1), run->last_run);
bstrftime_nc(dt2, sizeof(dt2), now);
- Dmsg4(000, "Drop: Job=%s run=%s. last_run=%s. now=%s\n", job->hdr.name,
+ Dmsg4(000, "Drop: Job=\"%s\" run=%s. last_run=%s. now=%s\n", job->hdr.name,
dt, dt1, dt2);
+ fflush(stdout);
#endif
return;
}
jobs_to_run->append(je);
dump_job(je, "Appended job");
}
+ foreach_dlist(ji, jobs_to_run) {
+ dump_job(ji, "Run queue");
+ }
+ Dmsg0(000, "End run queue\n");
}
static void dump_job(job_item *ji, char *msg)
bstrftime_nc(dt, sizeof(dt), ji->runtime);
Dmsg4(200, "%s: Job=%s priority=%d run %s\n", msg, ji->job->hdr.name,
ji->Priority, dt);
+ fflush(stdout);
debug_level = save_debug;
#endif
}
/*
- * Bacula doubly linked list routines.
+ * Bacula doubly linked list routines.
*
* dlist is a doubly linked list with the links being in the
- * list data item.
- *
+ * list data item.
+ *
* Kern Sibbald, July MMIII
*
* Version $Id$
*/
void dlist::append(void *item)
{
- ((dlink *)((char *)item+loffset))->next = NULL;
- ((dlink *)((char *)item+loffset))->prev = tail;
+ ((dlink *)(((char *)item)+loffset))->next = NULL;
+ ((dlink *)(((char *)item)+loffset))->prev = tail;
if (tail) {
- ((dlink *)((char *)tail+loffset))->next = item;
+ ((dlink *)(((char *)tail)+loffset))->next = item;
}
tail = item;
- if (head == NULL) { /* if empty list, */
- head = item; /* item is head as well */
+ if (head == NULL) { /* if empty list, */
+ head = item; /* item is head as well */
}
num_items++;
}
*/
void dlist::prepend(void *item)
{
- ((dlink *)((char *)item+loffset))->next = head;
- ((dlink *)((char *)item+loffset))->prev = NULL;
+ ((dlink *)(((char *)item)+loffset))->next = head;
+ ((dlink *)(((char *)item)+loffset))->prev = NULL;
if (head) {
- ((dlink *)((char *)head+loffset))->prev = item;
+ ((dlink *)(((char *)head)+loffset))->prev = item;
}
head = item;
- if (tail == NULL) { /* if empty list, */
- tail = item; /* item is tail too */
+ if (tail == NULL) { /* if empty list, */
+ tail = item; /* item is tail too */
}
num_items++;
}
-void dlist::insert_before(void *item, void *where)
+void dlist::insert_before(void *item, void *where)
{
dlink *where_link = (dlink *)((char *)where+loffset);
- ((dlink *)((char *)item+loffset))->next = where;
- ((dlink *)((char *)item+loffset))->prev = where_link->prev;
+ ((dlink *)(((char *)item)+loffset))->next = where;
+ ((dlink *)(((char *)item)+loffset))->prev = where_link->prev;
if (where_link->prev) {
- ((dlink *)((char *)(where_link->prev)+loffset))->next = item;
- where_link->prev = item;
+ ((dlink *)(((char *)(where_link->prev))+loffset))->next = item;
}
+ where_link->prev = item;
if (head == where) {
head = item;
}
num_items++;
}
-void dlist::insert_after(void *item, void *where)
+void dlist::insert_after(void *item, void *where)
{
dlink *where_link = (dlink *)((char *)where+loffset);
- ((dlink *)((char *)item+loffset))->next = where_link->next;
- ((dlink *)((char *)item+loffset))->prev = where;
+ ((dlink *)(((char *)item)+loffset))->next = where_link->next;
+ ((dlink *)(((char *)item)+loffset))->prev = where;
if (where_link->next) {
- ((dlink *)((char *)(where_link->next)+loffset))->prev = item;
- where_link->next = item;
+ ((dlink *)(((char *)(where_link->next))+loffset))->prev = item;
}
+ where_link->next = item;
if (tail == where) {
tail = item;
}
void dlist::remove(void *item)
{
void *xitem;
- dlink *ilink = (dlink *)((char *)item+loffset); /* item's link */
+ dlink *ilink = (dlink *)(((char *)item)+loffset); /* item's link */
if (item == head) {
head = ilink->next;
if (head) {
- ((dlink *)((char *)head+loffset))->prev = NULL;
+ ((dlink *)(((char *)head)+loffset))->prev = NULL;
}
if (item == tail) {
- tail = ilink->prev;
+ tail = ilink->prev;
}
} else if (item == tail) {
tail = ilink->prev;
if (tail) {
- ((dlink *)((char *)tail+loffset))->next = NULL;
+ ((dlink *)(((char *)tail)+loffset))->next = NULL;
}
} else {
xitem = ilink->next;
- ((dlink *)((char *)xitem+loffset))->prev = ilink->prev;
+ ((dlink *)(((char *)xitem)+loffset))->prev = ilink->prev;
xitem = ilink->prev;
- ((dlink *)((char *)xitem+loffset))->next = ilink->next;
+ ((dlink *)(((char *)xitem)+loffset))->next = ilink->next;
}
num_items--;
}
if (item == NULL) {
return head;
}
- return ((dlink *)((char *)item+loffset))->next;
+ return ((dlink *)(((char *)item)+loffset))->next;
}
void * dlist::prev(void *item)
if (item == NULL) {
return tail;
}
- return ((dlink *)((char *)item+loffset))->prev;
+ return ((dlink *)(((char *)item)+loffset))->prev;
}
void dlist::destroy()
{
for (void *n=head; n; ) {
- void *ni = ((dlink *)((char *)n+loffset))->next;
+ void *ni = ((dlink *)(((char *)n)+loffset))->next;
free(n);
n = ni;
}
jcr->buf = bstrdup(buf);
jcr_chain->prepend(jcr);
if (i == 10) {
- save_jcr = jcr;
+ save_jcr = jcr;
}
}
jcr->buf = bstrdup(buf);
jcr_chain->append(jcr);
if (i == 10) {
- save_jcr = jcr;
+ save_jcr = jcr;
}
}