]> git.sur5r.net Git - bacula/bacula/commitdiff
06Feb07
authorKern Sibbald <kern@sibbald.com>
Tue, 6 Feb 2007 14:37:57 +0000 (14:37 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 6 Feb 2007 14:37:57 +0000 (14:37 +0000)
kes  Delete src/lib/btree.c from win32 build, then add rblist.c
     plus the entrypoints.
kes  Apply patch supplied that corrects debug print
     in canceling jobs for max run time.  Supplied as
     part of bug #621, which was previously fixed.
05Feb07
kes  Test on job_canceled() and sd_msg_thread_done inside
     loop starting the message thread to avoid a race condition.
     Fixes bug #771.
kes  Remove rl_catch_signal from console.c as it conflicted
     with the header definition. Fixes bug #765.
ebl  Fixes bug #766 about RunsOnClient = Yes
04Feb07
kes  Clarify some stored/acquire messages to indicate if the
     problem is with read or append.
02Feb07
kes  Fix memory leak with storage ids in cats/sql_get.c
kes  Terminate watchdog earlier to avoid reference to released
     memory -- reported by Jason Austin.
kes  Move closing the database from jobq.c to the director daemon
     termination routine. This fixes memory leaks for shadow jobs
     (i.e. migration jobs).
kes  Free up the unique jobid chain items in migrate.c.  This fixes
     a memory leak problem.
kes  Convert some ugly looking for statements to use foreach_alist
     in findlib/find.c.  This will facilitate converting the structures
     to use dlist (for large include/exclude lists).
kes  Fix a bug in the btree.c and btree.h routines, then rename them
     rblist and add them to be built in src/lib.  Include some new
     methods written by Rudolf Cejka that make the code more readable
     (hides some of the ugly casting).

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.0@4116 91ce42f0-d328-0410-95d8-f526ca767f89

21 files changed:
bacula/ChangeLog
bacula/po/LINGUAS
bacula/src/cats/sql_get.c
bacula/src/dird/dird.c
bacula/src/dird/dird_conf.c
bacula/src/dird/dird_conf.h
bacula/src/dird/job.c
bacula/src/dird/jobq.c
bacula/src/dird/migrate.c
bacula/src/dird/protos.h
bacula/src/findlib/find.c
bacula/src/lib/btree.c [deleted file]
bacula/src/lib/btree.h [deleted file]
bacula/src/lib/lib.h
bacula/src/lib/parse_conf.h
bacula/src/stored/acquire.c
bacula/src/version.h
bacula/src/win32/dll/Makefile
bacula/src/win32/dll/bacula.def
bacula/src/win32/libbac/Makefile
bacula/technotes-2.0

index 33fbc808ff45deefb856c25fe4864e87e66bbb5c..15e06fb64edd08f4c8c7c8566c7291709d7609c2 100644 (file)
@@ -2,7 +2,7 @@
 
 General:
 
-Version 2.0.2 released: xx January 2007
+Version 2.0.2 released: 30 January 2007
 28Jan08
 kes  Fix maxruntime bug #621.
 27Jan07
index fc01a1cb3fd7d68e02ae7b141802facbb1bec751..342b8cccccad15b3019f88751cfc66a88617589f 100644 (file)
@@ -2,3 +2,4 @@ fr
 it
 de
 es
+fi
index b2cc9734e52dff82897b9ad6428e250842bd20f7..9176853496d0dc0e44149424e4d9616250746156 100644 (file)
@@ -412,12 +412,10 @@ int db_get_job_volume_parameters(JCR *jcr, B_DB *mdb, JobId_t JobId, VOL_PARAMS
          stat = 0;
       } else {
          stat = mdb->num_rows;
-         DBId_t *SId;
+         DBId_t *SId = NULL;
          if (stat > 0) {
             *VolParams = Vols = (VOL_PARAMS *)malloc(stat * sizeof(VOL_PARAMS));
             SId = (DBId_t *)malloc(stat * sizeof(DBId_t));
-         } else {
-            SId = NULL;
          }
          for (i=0; i < stat; i++) {
             if ((row = sql_fetch_row(mdb)) == NULL) {
@@ -453,6 +451,9 @@ int db_get_job_volume_parameters(JCR *jcr, B_DB *mdb, JobId_t JobId, VOL_PARAMS
                }
             }
          }
+         if (SId) {
+            free(SId);
+         }
       }
       sql_free_result(mdb);
    }
index 6d48a4f236ddbbb706102cf93f61b366e6a6aaaa..5081f08561cab7a5d01e4ec0bba4955d694f098a 100644 (file)
@@ -301,6 +301,7 @@ void terminate_dird(int sig)
       exit(1);
    }
    already_here = true;
+   stop_watchdog();
    generate_daemon_event(NULL, "Exit");
    write_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
    delete_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
@@ -319,7 +320,6 @@ void terminate_dird(int sig)
    free_config_resources();
    term_ua_server();
    term_msg();                        /* terminate message handler */
-   stop_watchdog();
    cleanup_crypto();
    close_memory_pool();               /* release free memory in pool */
    sm_dump(false);
index 5494f0eca37ba93fc34e5eb75b5dda6870dc709f..1046fe09d0ea117dc63b84c8927eaf028720dcd9 100644 (file)
@@ -24,7 +24,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2007 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.
index 020a086ffe1230cdf83c3406cfcbd7dde8d6a874..6cecf73937a0a3fcf2bf827b9cadfdf7b30ecd8e 100644 (file)
@@ -8,7 +8,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2007 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.
index 1ca59f857f0cba186a56162b2400cb951cdf7a2b..83d06fcaed41b4158ebf921ec2cda69a31febd32 100644 (file)
@@ -882,6 +882,10 @@ void dird_free_jcr(JCR *jcr)
       pthread_cond_destroy(&jcr->term_wait);
       jcr->term_wait_inited = false;
    }
+   if (jcr->db) {
+      db_close_database(jcr, jcr->db);
+      jcr->db = NULL;
+   }
    if (jcr->stime) {
       Dmsg0(200, "Free JCR stime\n");
       free_pool_memory(jcr->stime);
index 03230dae1021eb77898a66313319905250b3b2c2..780b2f258fb5d51f1d3921a24e821a538599b489 100755 (executable)
@@ -558,10 +558,6 @@ void *jobq_server(void *arg)
             Dmsg0(2300, "Back from running new job.\n");
          }
          /* Clean up and release old jcr */
-         if (jcr->db) {
-            db_close_database(jcr, jcr->db);
-            jcr->db = NULL;
-         }
          Dmsg2(2300, "====== Termination job=%d use_cnt=%d\n", jcr->JobId, jcr->use_count());
          jcr->SDJobStatus = 0;
          V(jq->mutex);                /* release internal lock */
index 11d497b54665447841e8a86076ce4efbc40ce2dd..6d21bd8a4af09ee4ffb40366ca3f91ab4940cdb0 100644 (file)
@@ -1002,6 +1002,9 @@ static bool regex_find_jobids(JCR *jcr, idpkt *ids, const char *query1,
 
 bail_out:
    Dmsg2(dbglevel, "Count=%d Jobids=%s\n", ids->count, ids->list);
+   foreach_dlist(item, item_chain) {
+      free(item->item);
+   }
    delete item_chain;
    return ok;
 }
index 31761cd19fc9f42660b271f25c58a747d17c206c..fcdaa11d4c8a1b8b52a05433d50c331e31fef497 100644 (file)
@@ -6,7 +6,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2007 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.
index c4bd014adf3eb179544425e16aa988ad3f72cecf..75da814b498518208085657b794cf85816e54b12 100644 (file)
@@ -119,14 +119,14 @@ get_win32_driveletters(FF_PKT *ff, char* szDrives)
     
    findFILESET *fileset = ff->fileset;
    if (fileset) {
-      int i, j;
+      int i;
+      char *fname;
       
       for (i=0; i<fileset->include_list.size(); i++) {
          findINCEXE *incexe = (findINCEXE *)fileset->include_list.get(i);
          
          /* look through all files and check */
-         for (j=0; j<incexe->name_list.size(); j++) {
-            char *fname = (char *)incexe->name_list.get(j);
+         foreach_alist(fname, &incexe->name_list) {
             /* fname should match x:/ */
             if (strlen(fname) >= 2 && B_ISALPHA(fname[0]) 
                && fname[1] == ':') {
@@ -190,9 +190,10 @@ find_files(JCR *jcr, FF_PKT *ff, int callback(FF_PKT *ff_pkt, void *hpkt, bool t
             ff->drivetypes = fo->drivetype;
             bstrncat(ff->VerifyOpts, fo->VerifyOpts, sizeof(ff->VerifyOpts));
          }
-         for (j=0; j<incexe->name_list.size(); j++) {
-            Dmsg1(100, "F %s\n", (char *)incexe->name_list.get(j));
-            ff->top_fname = (char *)incexe->name_list.get(j);
+         char *fname;
+         foreach_alist(fname, &incexe->name_list) {
+            Dmsg1(100, "F %s\n", fname);
+            ff->top_fname = fname;
             if (find_one_file(jcr, ff, our_callback, his_pkt, ff->top_fname, (dev_t)-1, true) == 0) {
                return 0;                  /* error return */
             }
@@ -339,8 +340,9 @@ static bool accept_file(FF_PKT *ff)
       }
       fnm_flags = (incexe->current_opts != NULL && incexe->current_opts->flags & FO_IGNORECASE)
              ? FNM_CASEFOLD : 0;
-      for (j=0; j<incexe->name_list.size(); j++) {
-         if (fnmatch((char *)incexe->name_list.get(j), ff->fname, fnmode|fnm_flags) == 0) {
+      char *fname;
+      foreach_alist(fname, &incexe->name_list) {
+         if (fnmatch(fname, ff->fname, fnmode|fnm_flags) == 0) {
             Dmsg1(100, "Reject wild2: %s\n", ff->fname);
             return false;          /* reject file */
          }
diff --git a/bacula/src/lib/btree.c b/bacula/src/lib/btree.c
deleted file mode 100644 (file)
index c17fe14..0000000
+++ /dev/null
@@ -1,490 +0,0 @@
-/*
- *  Bacula red-black binary tree routines.
- *
- *    btree is a binary tree with the links being in the data item.
- *
- *   Developped in part from ideas obtained from several online University
- *    courses. 
- *
- *   Kern Sibbald, November MMV
- *
- *   Version $Id$
- *
- */
-/*
-   Bacula® - The Network Backup Solution
-
-   Copyright (C) 2005-2006 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.
-   This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
-   License as published by the Free Software Foundation plus additions
-   that are listed in the file LICENSE.
-
-   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., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.
-
-   Bacula® is a registered trademark of John Walker.
-   The licensor of Bacula is the Free Software Foundation Europe
-   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
-   Switzerland, email:ftf@fsfeurope.org.
-*/
-
-#include "bacula.h"
-#include "btree.h"
-
-/* ===================================================================
- *    btree
- */
-
-/*
- *  Insert an item in the tree, but only if it is unique
- *   otherwise, the item is returned non inserted
- *  The big trick is keeping the tree balanced after the 
- *   insert. We use a parent pointer to make it simpler and 
- *   to avoid recursion.
- *
- * Returns: item         if item inserted
- *          other_item   if same value already exists (item not inserted)
- */
-bnode *btree::insert(bnode *item, int compare(bnode *item1, bnode *item2))
-{
-   bnode *x, *y;
-   bnode *last = NULL;        /* last leaf if not found */
-   bnode *found = NULL;
-   int comp = 0;
-
-   /* Search */
-   x = head;
-   while (x && !found) {
-      last = x;
-      comp = compare(item, x);
-      if (comp < 0) {
-         x = x->left;
-      } else if (comp > 0) {
-         x = x->right;
-      } else {
-         found = x;
-      }
-   }
-
-   if (found) {                    /* found? */
-      return found;                /* yes, return item found */
-   }
-   /* Handle empty tree */
-   if (num_items == 0) {
-      head = item;
-      num_items++;
-      return item;
-   }
-   x = last;
-   /* Not found, so insert it on appropriate side of tree */
-   if (comp < 0) {
-      last->left = item;
-   } else {
-      last->right = item;
-   }
-   last->red = true;
-   item->parent = last;
-   num_items++;
-
-   /* Now we must walk up the tree balancing it */
-   x = last;
-   while (x != head && x->parent->red) {
-      if (x->parent == x->parent->parent->left) {
-         /* Look at the right side of our grandparent */
-         y = x->parent->parent->right;
-         if (y && y->red) {
-            /* our parent must be black */
-            x->parent->red = false;
-            y->red = false;
-            x->parent->parent->red = true;
-            x = x->parent->parent;       /* move up to grandpa */
-         } else {
-            if (x == x->parent->right) { /* right side of parent? */
-               x = x->parent;
-               left_rotate(x);
-            }
-            /* make parent black too */
-            x->parent->red = false;
-            x->parent->parent->red = true;
-            right_rotate(x->parent->parent);
-         }
-      } else {
-         /* Look at left side of our grandparent */
-         y = x->parent->parent->left;
-         if (y && y->red) {
-            x->parent->red = false;
-            y->red = false;
-            x->parent->parent->red = true;
-            x = x->parent->parent;       /* move up to grandpa */
-         } else {
-            if (x == x->parent->left) {
-               x = x->parent;
-               right_rotate(x);
-            }
-            /* make parent black too */
-            x->parent->red = false;
-            x->parent->parent->red = true;
-            left_rotate(x->parent->parent);
-         }
-      }
-   }
-   /* Make sure the head is always black */
-   head->red = false;
-   return item;
-}
-
-
-/*
- * Search for item
- */
-bnode *btree::search(bnode *item, int compare(bnode *item1, bnode *item2))
-{
-   bnode *found = NULL;
-   bnode *x;
-   int comp;
-
-   x = head;
-   while (x) {
-      comp = compare(item, x);
-      if (comp < 0) {
-         x = x->left;
-      } else if (comp > 0) {
-         x = x->right;
-      } else {
-         found = x;
-         break;
-      }
-   }
-   return found;
-}
-
-/* 
- * Get first item (i.e. lowest value) 
- */
-bnode *btree::first(void)
-{
-   bnode *x;
-
-   x = head;
-   down = true;
-   while (x) {
-      if (x->left) {
-         x = x->left;
-         continue;
-      }
-      return x;
-   }
-   /* Tree is empty */
-   return NULL;
-}
-
-/*
- * This is a non-recursive btree walk routine that returns
- *  the items one at a time in order. I've never seen a
- *  non-recursive tree walk routine published that returns
- *  one item at a time rather than doing a callback.
- *
- * Return the next item in sorted order.  We assume first()
- *  was called once before calling this routine.
- *  We always go down as far as we can to the left, then up, and
- *  down one to the right, and again down as far as we can to the
- *  left.  etc. 
- *
- * Returns: pointer to next larger item 
- *          NULL when no more items in tree
- */
-bnode *btree::next(bnode *item)
-{
-   bnode *x;
-
-   x = item;
-   if ((down && !x->left && x->right) || (!down && x->right)) {
-      /* Move down to right one */
-      down = true;
-      x = x->right;                       
-      /* Then all the way down left */
-      while (x->left)  {
-         x = x->left;
-      }
-      return x;
-   }
-
-   /* We have gone down all we can, so now go up */
-   for ( ;; ) {
-      /* If at head, we are done */
-      if (!x->parent) {
-         return NULL;
-      }
-      /* Move up in tree */
-      down = false;
-      /* if coming from right, continue up */
-      if (x->parent->right == x) {
-         x = x->parent;
-         continue;
-      }
-      /* Coming from left, go up one -- ie. return parent */
-      return x->parent;
-   }
-}
-
-/*
- * Similer to next(), but visits all right nodes when
- *  coming up the tree.
- */
-bnode *btree::any(bnode *item)
-{
-   bnode *x;
-
-   x = item;
-   if ((down && !x->left && x->right) || (!down && x->right)) {
-      /* Move down to right one */
-      down = true;
-      x = x->right;                       
-      /* Then all the way down left */
-      while (x->left)  {
-         x = x->left;
-      }
-      return x;
-   }
-
-   /* We have gone down all we can, so now go up */
-   for ( ;; ) {
-      /* If at head, we are done */
-      if (!x->parent) {
-         return NULL;
-      }
-      down = false;
-      /* Go up one and return parent */
-      return x->parent;
-   }
-}
-
-
-/* x is item, y is below and to right, then rotated to below left */
-void btree::left_rotate(bnode *item)
-{
-   bnode *y;
-   bnode *x;
-
-   x = item;
-   y = x->right;
-   x->right = y->left;
-   if (y->left) {
-      y->left->parent = x;
-   }
-   y->parent = x->parent;
-   /* if no parent then we have a new head */
-   if (!x->parent) {
-      head = y;
-   } else if (x == x->parent->left) {
-      x->parent->left = y;
-   } else {
-      x->parent->right = y;
-   }
-   y->left = x;
-   x->parent = y;
-}
-
-void btree::right_rotate(bnode *item)
-{
-   bnode *x, *y;
-
-   y = item;
-   x = y->left;
-   y->left = x->right;
-   if (x->right) {
-      x->right->parent = y;
-   }
-   x->parent = y->parent;
-   /* if no parent then we have a new head */
-   if (!y->parent) {
-      head = x;
-   } else if (y == y->parent->left) {
-      y->parent->left = x;
-   } else {
-      y->parent->right = x;
-   }
-   x->right = y;
-   y->parent = x;
-}
-
-
-void btree::remove(bnode *item)
-{
-}
-
-/* Destroy the tree contents.  Not totally working */
-void btree::destroy()
-{
-   bnode *x, *y = NULL;
-
-   x = first();
-// printf("head=%p first=%p left=%p right=%p\n", head, x, x->left, x->right);
-
-   for (  ; (y=any(x)); ) {
-      /* Prune the last item */
-      if (x->parent) {
-         if (x == x->parent->left) {
-            x->parent->left = NULL;
-         } else if (x == x->parent->right) {
-            x->parent->right = NULL;
-         }
-      }
-      if (!x->left && !x->right) {
-         if (head == x) {  
-            head = NULL;
-         }
-//       if (num_items<30) {
-//          printf("free nitems=%d item=%p left=%p right=%p\n", num_items, x, x->left, x->right);
-//       }   
-         free((void *)x);      /* free previous node */
-         num_items--;
-      }
-      x = y;                  /* save last node */
-   }
-   if (x) {
-      if (x == head) {
-         head = NULL;
-      }
-//    printf("free nitems=%d item=%p left=%p right=%p\n", num_items, x, x->left, x->right);
-      free((void *)x);
-      num_items--;
-   }
-   if (head) {
-//    printf("Free head\n");
-      free((void *)head);
-   }
-// printf("free nitems=%d\n", num_items);
-
-   head = NULL;
-}
-
-
-
-#ifdef TEST_PROGRAM
-
-struct MYJCR {
-   bnode link;
-   char *buf;
-};
-
-static int my_compare(bnode *item1, bnode *item2)
-{
-   MYJCR *jcr1, *jcr2;
-   int comp;
-   jcr1 = (MYJCR *)item1;
-   jcr2 = (MYJCR *)item2;
-   comp = strcmp(jcr1->buf, jcr2->buf);
- //Dmsg3(000, "compare=%d: %s to %s\n", comp, jcr1->buf, jcr2->buf);
-   return comp;
-}
-
-int main()
-{
-   char buf[30];
-   btree *jcr_chain;
-   MYJCR *jcr = NULL;
-   MYJCR *jcr1;
-
-
-   /* Now do a binary insert for the tree */
-   jcr_chain = New(btree());
-#define CNT 26
-   printf("append %d items\n", CNT*CNT*CNT);
-   strcpy(buf, "ZZZ");
-   int count = 0;
-   for (int i=0; i<CNT; i++) {
-      for (int j=0; j<CNT; j++) {
-         for (int k=0; k<CNT; k++) {
-            count++;
-            if ((count & 0x3FF) == 0) {
-               Dmsg1(000, "At %d\n", count);
-            }
-            jcr = (MYJCR *)malloc(sizeof(MYJCR));
-            memset(jcr, 0, sizeof(MYJCR));
-            jcr->buf = bstrdup(buf);
-//          printf("buf=%p %s\n", jcr, jcr->buf);
-            jcr1 = (MYJCR *)jcr_chain->insert((bnode *)jcr, my_compare);
-            if (jcr != jcr1) {
-               Dmsg2(000, "Insert of %s vs %s failed.\n", jcr->buf, jcr1->buf);
-            }
-            buf[1]--;
-         }
-         buf[1] = 'Z';
-         buf[2]--;
-      }
-      buf[2] = 'Z';
-      buf[0]--;
-   }
-   printf("%d items appended\n", CNT*CNT*CNT);
-   printf("num_items=%d\n", jcr_chain->size());
-
-   jcr = (MYJCR *)malloc(sizeof(MYJCR));
-   memset(jcr, 0, sizeof(MYJCR));
-
-   jcr->buf = bstrdup("a");
-   if ((jcr1=(MYJCR *)jcr_chain->search((bnode *)jcr, my_compare))) {
-      printf("One less failed!!!! Got: %s\n", jcr1->buf);
-   } else {
-      printf("One less: OK\n");
-   }
-   free(jcr->buf);
-
-   jcr->buf = bstrdup("ZZZZZZZZZZZZZZZZ");
-   if ((jcr1=(MYJCR *)jcr_chain->search((bnode *)jcr, my_compare))) {
-      printf("One greater failed!!!! Got:%s\n", jcr1->buf);
-   } else {
-      printf("One greater: OK\n");
-   }
-   free(jcr->buf);
-
-   jcr->buf = bstrdup("AAA");
-   if ((jcr1=(MYJCR *)jcr_chain->search((bnode *)jcr, my_compare))) {
-      printf("Search for AAA got %s\n", jcr1->buf);
-   } else {
-      printf("Search for AAA not found\n"); 
-   }
-   free(jcr->buf);
-
-   jcr->buf = bstrdup("ZZZ");
-   if ((jcr1 = (MYJCR *)jcr_chain->search((bnode *)jcr, my_compare))) {
-      printf("Search for ZZZ got %s\n", jcr1->buf);
-   } else {
-      printf("Search for ZZZ not found\n"); 
-   }
-   free(jcr->buf);
-   free(jcr);
-
-
-   printf("Find each of %d items in tree.\n", count);
-   for (jcr=(MYJCR *)jcr_chain->first(); jcr; (jcr=(MYJCR *)jcr_chain->next((bnode *)jcr)) ) {
-//    printf("Got: %s\n", jcr->buf);
-      if (!jcr_chain->search((bnode *)jcr, my_compare)) {
-         printf("btree binary_search item not found = %s\n", jcr->buf);
-      }
-   }
-   printf("Free each of %d items in tree.\n", count);
-   for (jcr=(MYJCR *)jcr_chain->first(); jcr; (jcr=(MYJCR *)jcr_chain->next((bnode *)jcr)) ) {
-//    printf("Free: %p %s\n", jcr, jcr->buf);
-      free(jcr->buf);
-      jcr->buf = NULL;
-   }
-   printf("num_items=%d\n", jcr_chain->size());
-   delete jcr_chain;
-
-
-   sm_dump(true);
-
-}
-#endif
diff --git a/bacula/src/lib/btree.h b/bacula/src/lib/btree.h
deleted file mode 100644 (file)
index 23e79a9..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *   Version $Id$
- */
-/*
-   Bacula® - The Network Backup Solution
-
-   Copyright (C) 2005-2006 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.
-   This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
-   License as published by the Free Software Foundation plus additions
-   that are listed in the file LICENSE.
-
-   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., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.
-
-   Bacula® is a registered trademark of John Walker.
-   The licensor of Bacula is the Free Software Foundation Europe
-   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
-   Switzerland, email:ftf@fsfeurope.org.
-*/
-
-
-/* ========================================================================
- *
- *   red-black binary tree routines -- btree.h
- *
- *    Kern Sibbald, MMV
- *
- */
-
-#define M_ABORT 1
-
-/*
- * There is a lot of extra casting here to work around the fact
- * that some compilers (Sun and Visual C++) do not accept
- * (bnode *) as an lvalue on the left side of an equal.
- *
- * Loop var through each member of list
- */
-#define foreach_btree(var, tree) \
-    for(*((bnode **)&(var))=(tree)->first(); (*((bnode **)&(var))=(tree)->next((bnode *)var)); )
-
-#ifdef the_old_way
-#define foreach_btree(var, tree) \
-        for((var)=(tree)->first(); (((bnode *)(var))=(tree)->next((bnode *)var)); )
-#endif
-
-struct bnode;
-struct bnode {
-   bnode *left;
-   bnode *right;
-   bnode *parent;
-   bool red;
-};
-
-class btree : public SMARTALLOC {
-   bnode *head;
-   uint32_t num_items;
-   bool down;
-   void left_rotate(bnode *item);
-   void right_rotate(bnode *item);
-public:
-   btree(void);
-   ~btree() { destroy(); }
-   void init(void);
-   bnode *insert(bnode *item, int compare(bnode *item1, bnode *item2));
-   bnode *search(bnode *item, int compare(bnode *item1, bnode *item2));
-   bnode *first(void);
-   bnode *next(bnode *item);
-   bnode *any(bnode *item);
-   void remove(bnode *item);
-   int  size() const;
-   void destroy();
-};
-
-
-/*
- * This allows us to do explicit initialization,
- *   allowing us to mix C++ classes inside malloc'ed
- *   C structures. Define before called in constructor.
- */
-inline void btree::init()
-{
-   head = NULL;
-   num_items = 0;
-}
-
-
-/* Constructor with link at head of item */
-inline btree::btree(void) : head(0), num_items(0)
-{
-}
-
-inline int btree::size() const
-{
-   return num_items;
-}
index 671e066b419b5517905fb2dafa33c7c8acb65a33..37a8c2b4bc8acb6cac0f1e666af388ed3c820d27 100644 (file)
@@ -10,7 +10,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2007 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.
@@ -38,6 +38,7 @@
 #include "smartall.h"
 #include "alist.h"
 #include "dlist.h"
+#include "rblist.h"
 #include "base64.h"
 #include "bits.h"
 #include "btime.h"
index 75a8dd8d8cba95208f28f48ea8cb99e76087ed86..a5d53c958497fa7d0b06c695ae00262c893ba2ed 100644 (file)
@@ -4,7 +4,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2007 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.
index e673bd7669d046d5f3286b38dbf037e68d0e210e..9fa9f79c9589f70aacc3b34fa6f1ca124a9c35eb 100644 (file)
@@ -66,7 +66,7 @@ bool acquire_device_for_read(DCR *dcr)
    dev->block(BST_DOING_ACQUIRE);
 
    if (dev->num_writers > 0) {
-      Jmsg2(jcr, M_FATAL, 0, _("Num_writers=%d not zero. Job %d canceled.\n"), 
+      Jmsg2(jcr, M_FATAL, 0, _("Acquire read: num_writers=%d not zero. Job %d canceled.\n"), 
          dev->num_writers, jcr->JobId);
       goto get_out;
    }
@@ -75,7 +75,7 @@ bool acquire_device_for_read(DCR *dcr)
    vol = jcr->VolList;
    if (!vol) {
       char ed1[50];
-      Jmsg(jcr, M_FATAL, 0, _("No volumes specified. Job %s canceled.\n"), 
+      Jmsg(jcr, M_FATAL, 0, _("No volumes specified for reading. Job %s canceled.\n"), 
          edit_int64(jcr->JobId, ed1));
       goto get_out;
    }
@@ -84,7 +84,7 @@ bool acquire_device_for_read(DCR *dcr)
       vol = vol->next;
    }
    if (!vol) {
-      Jmsg(jcr, M_FATAL, 0, _("Logic error: no next volume. Numvol=%d Curvol=%d\n"),
+      Jmsg(jcr, M_FATAL, 0, _("Logic error: no next volume to read. Numvol=%d Curvol=%d\n"),
          jcr->NumReadVolumes, jcr->CurReadVolume);
       goto get_out;                   /* should not happen */   
    }
@@ -268,7 +268,7 @@ default_path:
       break;
    } /* end for loop */
    if (!ok) {
-      Jmsg1(jcr, M_FATAL, 0, _("Too many errors trying to mount device %s.\n"),
+      Jmsg1(jcr, M_FATAL, 0, _("Too many errors trying to mount device %s for reading.\n"),
             dev->print_name());
       goto get_out;
    }
@@ -321,8 +321,8 @@ DCR *acquire_device_for_append(DCR *dcr)
     * With the reservation system, this should not happen
     */
    if (dev->can_read()) {
-      Jmsg1(jcr, M_FATAL, 0, _("Device %s is busy reading.\n"), dev->print_name());
-      Dmsg1(200, "Device %s is busy reading.\n", dev->print_name());
+      Jmsg1(jcr, M_FATAL, 0, _("Want to append, but device %s is busy reading.\n"), dev->print_name());
+      Dmsg1(200, "Want to append but device %s is busy reading.\n", dev->print_name());
       goto get_out;
    }
 
@@ -351,9 +351,9 @@ DCR *acquire_device_for_append(DCR *dcr)
             free_unused_volume(dcr);
          }
          if (dev->num_writers != 0) {
-            Jmsg3(jcr, M_FATAL, 0, _("Wanted Volume \"%s\", but device %s is busy writing on \"%s\" .\n"), 
+            Jmsg3(jcr, M_FATAL, 0, _("Wanted to append to Volume \"%s\", but device %s is busy writing on \"%s\" .\n"), 
                  dcr->VolumeName, dev->print_name(), dev->VolHdr.VolumeName);
-            Dmsg3(200, "Wanted Volume \"%s\", but device %s is busy writing on \"%s\" .\n",  
+            Dmsg3(200, "Wanted to append to Volume \"%s\", but device %s is busy writing on \"%s\" .\n",  
                  dcr->VolumeName, dev->print_name(), dev->VolHdr.VolumeName);
             goto get_out;
          }
index 2461938a3fd9f41b96733a7a9a8b4af0087296da..b6db5b3f36b911d3e58d81abd44b3e7882966208 100644 (file)
@@ -3,9 +3,9 @@
  */
 
 #undef  VERSION
-#define VERSION "2.0.2"
-#define BDATE   "28 January 2007"
-#define LSMDATE "28Jan07"
+#define VERSION "2.0.3"
+#define BDATE   "06 February 2007"
+#define LSMDATE "06Feb07"
 
 #define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n"
 #define BYEAR "2007"       /* year for copyright messages in progs */
index b2cf7111255ad07c926cf994111ae9878addbb71..1925463f17f3ccf90f5b9bbb83093f02ada8e25f 100644 (file)
@@ -58,7 +58,6 @@ LIB_OBJS = \
        $(OBJDIR)/bsys.o \
        $(OBJDIR)/btime.o \
        $(OBJDIR)/btimers.o \
-       $(OBJDIR)/btree.o \
        $(OBJDIR)/cram-md5.o \
        $(OBJDIR)/crc32.o \
        $(OBJDIR)/crypto.o \
@@ -78,6 +77,7 @@ LIB_OBJS = \
        $(OBJDIR)/openssl.o \
        $(OBJDIR)/pythonlib.o \
        $(OBJDIR)/queue.o \
+       $(OBJDIR)/rblist.o \
        $(OBJDIR)/runscript.o \
        $(OBJDIR)/rwlock.o \
        $(OBJDIR)/scan.o \
index c06ae297505c31d2460394046eb39f45dec3bef1..4304031129c591b74b0ab69a940a25b7d0184263 100644 (file)
@@ -220,8 +220,6 @@ _Z17start_bsock_timerP5BSOCKj
 _Z17stop_thread_timerP10s_btimer_t
 _Z18start_thread_timerP10pthread_t_j
 
-; btree.c:
-
 ; cram-md5.c:
 _Z16cram_md5_respondP5BSOCKPcPiS2_
 _Z18cram_md5_challengeP5BSOCKPcii
@@ -391,6 +389,14 @@ _Z5qnextP7b_queueS0_
 _Z7qdchainP7b_queue
 _Z7qinsertP7b_queueS0_
 
+; rblist.c:
+_ZN6rblist4nextEPv
+_ZN6rblist5firstEv
+_ZN6rblist6insertEPvPFiS0_S0_E
+_ZN6rblist6removeEPv
+_ZN6rblist6searchEPvPFiS0_S0_E
+_ZN6rblist7destroyEv
+
 ; runscript.c:
 _Z11run_scriptsP3JCRP5alistPKc
 _Z13new_runscriptv
index 28c94f8df5472bd9f0b8809e67e094dfac5dddc8..993c22ad6a463dd9f512ac80241439c16c33ac79 100644 (file)
@@ -41,7 +41,6 @@ LIB_OBJS = \
        $(OBJDIR)/bsys.o \
        $(OBJDIR)/btime.o \
        $(OBJDIR)/btimers.o \
-       $(OBJDIR)/btree.o \
        $(OBJDIR)/cram-md5.o \
        $(OBJDIR)/crc32.o \
        $(OBJDIR)/crypto.o \
@@ -62,6 +61,7 @@ LIB_OBJS = \
        $(OBJDIR)/parse_conf.o \
        $(OBJDIR)/pythonlib.o \
        $(OBJDIR)/queue.o \
+       $(OBJDIR)/rblist.o \
        $(OBJDIR)/res.o \
        $(OBJDIR)/runscript.o \
        $(OBJDIR)/rwlock.o \
index 488dac11dd0f7ddd722a0f83bda2eac87f09b5bb..572a2827adfd99b8845fcbd86b4d00f6ba097d6b 100644 (file)
@@ -1,9 +1,40 @@
               Technical notes on version 2.0
 
 General:
-Version 2.0.2 released: xx January 2007
+06Feb07
+kes  Delete src/lib/btree.c from win32 build, then add rblist.c
+     plus the entrypoints.
+kes  Apply patch supplied that corrects debug print
+     in canceling jobs for max run time.  Supplied as
+     part of bug #621, which was previously fixed.
 05Feb07
-ebl  Fixes bug #766 about RunsOnClient = Yes 
+kes  Test on job_canceled() and sd_msg_thread_done inside
+     loop starting the message thread to avoid a race condition.
+     Fixes bug #771.
+kes  Remove rl_catch_signal from console.c as it conflicted
+     with the header definition. Fixes bug #765.
+ebl  Fixes bug #766 about RunsOnClient = Yes
+04Feb07
+kes  Clarify some stored/acquire messages to indicate if the
+     problem is with read or append.
+02Feb07
+kes  Fix memory leak with storage ids in cats/sql_get.c
+kes  Terminate watchdog earlier to avoid reference to released
+     memory -- reported by Jason Austin.
+kes  Move closing the database from jobq.c to the director daemon
+     termination routine. This fixes memory leaks for shadow jobs
+     (i.e. migration jobs).
+kes  Free up the unique jobid chain items in migrate.c.  This fixes
+     a memory leak problem.
+kes  Convert some ugly looking for statements to use foreach_alist
+     in findlib/find.c.  This will facilitate converting the structures
+     to use dlist (for large include/exclude lists).
+kes  Fix a bug in the btree.c and btree.h routines, then rename them
+     rblist and add them to be built in src/lib.  Include some new
+     methods written by Rudolf Cejka that make the code more readable
+     (hides some of the ugly casting).
+
+Version 2.0.2 released: 30 January 2007
 28Jan08
 kes  Fix maxruntime bug #621.
 27Jan07