-diff -Naur new/bacula-1.39.30/src/baconfig.h bacula-1.39.30/src/baconfig.h
---- new/bacula-1.39.30/src/baconfig.h  2006-12-08 15:27:09.000000000 +0100
-+++ bacula-1.39.30/src/baconfig.h      2006-12-19 22:27:27.000000000 +0100
-@@ -107,8 +107,8 @@
+diff -Naur org/bacula-2.0.0/src/baconfig.h bacula-2.0.0/src/baconfig.h
+--- org/bacula-2.0.0/src/baconfig.h    2006-12-17 14:36:35.000000000 +0100
++++ bacula-2.0.0/src/baconfig.h        2007-01-09 16:10:02.000000000 +0100
+@@ -106,8 +106,8 @@
  #define  OSDependentInit()
  #define  tape_open            open
  #define  tape_ioctl           ioctl
  #define  tape_close           ::close
  
  #endif
-diff -Naur new/bacula-1.39.30/src/cats/sql_find.c bacula-1.39.30/src/cats/sql_find.c
---- new/bacula-1.39.30/src/cats/sql_find.c     2006-11-27 11:02:59.000000000 +0100
-+++ bacula-1.39.30/src/cats/sql_find.c 2006-12-19 22:27:27.000000000 +0100
+diff -Naur org/bacula-2.0.0/src/cats/sql_find.c bacula-2.0.0/src/cats/sql_find.c
+--- org/bacula-2.0.0/src/cats/sql_find.c       2006-11-27 11:02:59.000000000 +0100
++++ bacula-2.0.0/src/cats/sql_find.c   2007-01-09 16:10:02.000000000 +0100
 @@ -283,7 +283,7 @@
            "VolBytes,VolMounts,VolErrors,VolWrites,MaxVolBytes,VolCapacityBytes,"
            "VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,Recycle,Slot,"
     mr->Enabled = 1;   /* ensured via query */
     sql_free_result(mdb);
  
-diff -Naur new/bacula-1.39.30/src/cats/sql_get.c bacula-1.39.30/src/cats/sql_get.c
---- new/bacula-1.39.30/src/cats/sql_get.c      2006-11-27 11:02:59.000000000 +0100
-+++ bacula-1.39.30/src/cats/sql_get.c  2006-12-19 22:27:27.000000000 +0100
+diff -Naur org/bacula-2.0.0/src/cats/sql_get.c bacula-2.0.0/src/cats/sql_get.c
+--- org/bacula-2.0.0/src/cats/sql_get.c        2006-11-27 11:02:59.000000000 +0100
++++ bacula-2.0.0/src/cats/sql_get.c    2007-01-09 16:10:02.000000000 +0100
 @@ -872,7 +872,7 @@
           "MaxVolFiles,Recycle,Slot,FirstWritten,LastWritten,InChanger,"
           "EndFile,EndBlock,VolParts,LabelType,LabelDate,StorageId,"
              
              ok = true;
           }
-diff -Naur new/bacula-1.39.30/src/dird/catreq.c bacula-1.39.30/src/dird/catreq.c
---- new/bacula-1.39.30/src/dird/catreq.c       2006-11-21 14:20:08.000000000 +0100
-+++ bacula-1.39.30/src/dird/catreq.c   2006-12-19 22:27:27.000000000 +0100
-@@ -277,7 +277,7 @@
+diff -Naur org/bacula-2.0.0/src/dird/catreq.c bacula-2.0.0/src/dird/catreq.c
+--- org/bacula-2.0.0/src/dird/catreq.c 2006-12-23 17:33:52.000000000 +0100
++++ bacula-2.0.0/src/dird/catreq.c     2007-01-09 16:10:02.000000000 +0100
+@@ -280,7 +280,7 @@
        mr.VolWriteTime = sdmr.VolWriteTime;
        mr.VolParts     = sdmr.VolParts;
        bstrncpy(mr.VolStatus, sdmr.VolStatus, sizeof(mr.VolStatus));
           mr.StorageId = jcr->wstore->StorageId;
        }
  
-diff -Naur new/bacula-1.39.30/src/dird/dird.c bacula-1.39.30/src/dird/dird.c
---- new/bacula-1.39.30/src/dird/dird.c 2006-11-27 11:02:59.000000000 +0100
-+++ bacula-1.39.30/src/dird/dird.c     2006-12-19 22:27:27.000000000 +0100
+diff -Naur org/bacula-2.0.0/src/dird/dird.c bacula-2.0.0/src/dird/dird.c
+--- org/bacula-2.0.0/src/dird/dird.c   2006-12-22 16:01:05.000000000 +0100
++++ bacula-2.0.0/src/dird/dird.c       2007-01-09 16:10:02.000000000 +0100
 @@ -269,6 +269,8 @@
  
     init_job_server(director->MaxConcurrentJobs);
     Dmsg0(200, "wait for next job\n");
     /* Main loop -- call scheduler to get next job to run */
     while ( (jcr = wait_for_next_job(runjob)) ) {
-diff -Naur new/bacula-1.39.30/src/dird/getmsg.c bacula-1.39.30/src/dird/getmsg.c
---- new/bacula-1.39.30/src/dird/getmsg.c       2006-11-21 14:20:09.000000000 +0100
-+++ bacula-1.39.30/src/dird/getmsg.c   2006-12-19 22:27:27.000000000 +0100
+diff -Naur org/bacula-2.0.0/src/dird/getmsg.c bacula-2.0.0/src/dird/getmsg.c
+--- org/bacula-2.0.0/src/dird/getmsg.c 2006-11-21 14:20:09.000000000 +0100
++++ bacula-2.0.0/src/dird/getmsg.c     2007-01-09 16:10:02.000000000 +0100
 @@ -62,7 +62,9 @@
     "open=%d labeled=%d offline=%d "
     "reserved=%d max_writers=%d "
           }
           continue;
        }
-diff -Naur new/bacula-1.39.30/src/stored/acquire.c bacula-1.39.30/src/stored/acquire.c
---- new/bacula-1.39.30/src/stored/acquire.c    2006-11-27 11:03:01.000000000 +0100
-+++ bacula-1.39.30/src/stored/acquire.c        2006-12-19 22:27:27.000000000 +0100
+diff -Naur org/bacula-2.0.0/src/stored/acquire.c bacula-2.0.0/src/stored/acquire.c
+--- org/bacula-2.0.0/src/stored/acquire.c      2006-12-16 16:30:22.000000000 +0100
++++ bacula-2.0.0/src/stored/acquire.c  2007-01-09 16:10:02.000000000 +0100
 @@ -461,8 +461,8 @@
  
     if (dev->can_read()) {
  
     } else if (dev->num_writers > 0) {
        /* 
-diff -Naur new/bacula-1.39.30/src/stored/ansi_label.c bacula-1.39.30/src/stored/ansi_label.c
---- new/bacula-1.39.30/src/stored/ansi_label.c 2006-11-21 18:03:45.000000000 +0100
-+++ bacula-1.39.30/src/stored/ansi_label.c     2006-12-19 22:27:27.000000000 +0100
+diff -Naur org/bacula-2.0.0/src/stored/ansi_label.c bacula-2.0.0/src/stored/ansi_label.c
+--- org/bacula-2.0.0/src/stored/ansi_label.c   2006-11-21 18:03:45.000000000 +0100
++++ bacula-2.0.0/src/stored/ansi_label.c       2007-01-09 16:10:02.000000000 +0100
 @@ -87,7 +87,7 @@
     /* Read a maximum of 5 records VOL1, HDR1, ... HDR4 */
     for (i=0; i < 6; i++) {
        if (stat != sizeof(label)) {
           berrno be;
           if (stat == -1) {
-diff -Naur new/bacula-1.39.30/src/stored/askdir.c bacula-1.39.30/src/stored/askdir.c
---- new/bacula-1.39.30/src/stored/askdir.c     2006-12-08 15:27:10.000000000 +0100
-+++ bacula-1.39.30/src/stored/askdir.c 2006-12-19 22:27:27.000000000 +0100
+diff -Naur org/bacula-2.0.0/src/stored/askdir.c bacula-2.0.0/src/stored/askdir.c
+--- org/bacula-2.0.0/src/stored/askdir.c       2006-12-08 15:27:10.000000000 +0100
++++ bacula-2.0.0/src/stored/askdir.c   2007-01-09 16:10:02.000000000 +0100
 @@ -308,11 +308,6 @@
        Pmsg0(000, _("NULL Volume name. This shouldn't happen!!!\n"));
        return false;
  
     Dmsg1(100, "Update cat VolFiles=%d\n", dev->file);
     /* Just labeled or relabeled the tape */
-diff -Naur new/bacula-1.39.30/src/stored/block.c bacula-1.39.30/src/stored/block.c
---- new/bacula-1.39.30/src/stored/block.c      2006-12-08 15:27:10.000000000 +0100
-+++ bacula-1.39.30/src/stored/block.c  2006-12-19 22:27:27.000000000 +0100
+diff -Naur org/bacula-2.0.0/src/stored/block.c bacula-2.0.0/src/stored/block.c
+--- org/bacula-2.0.0/src/stored/block.c        2006-12-16 12:10:17.000000000 +0100
++++ bacula-2.0.0/src/stored/block.c    2007-01-09 16:10:02.000000000 +0100
 @@ -537,11 +537,8 @@
           bmicrosleep(5, 0);    /* pause a bit if busy or lots of errors */
           dev->clrerror(-1);
     } while (stat == -1 && (errno == EBUSY || errno == EINTR || errno == EIO) && retry++ < 3);
     if (stat < 0) {
        berrno be;
-diff -Naur new/bacula-1.39.30/src/stored/dev.c bacula-1.39.30/src/stored/dev.c
---- new/bacula-1.39.30/src/stored/dev.c        2006-11-22 15:48:29.000000000 +0100
-+++ bacula-1.39.30/src/stored/dev.c    2006-12-19 22:27:27.000000000 +0100
-@@ -1326,7 +1326,7 @@
+diff -Naur org/bacula-2.0.0/src/stored/dev.c bacula-2.0.0/src/stored/dev.c
+--- org/bacula-2.0.0/src/stored/dev.c  2006-12-22 16:01:05.000000000 +0100
++++ bacula-2.0.0/src/stored/dev.c      2007-01-09 16:10:02.000000000 +0100
+@@ -1325,7 +1325,7 @@
        mt_com.mt_count = 1;
        while (num-- && !at_eot()) {
           Dmsg0(100, "Doing read before fsf\n");
              if (errno == ENOMEM) {     /* tape record exceeds buf len */
                 stat = rbuf_len;        /* This is OK */
              /*
-@@ -2193,6 +2193,68 @@
+@@ -2192,6 +2192,68 @@
     }
  }
  
  
  /* Return the resource name for the device */
  const char *DEVICE::name() const
-diff -Naur new/bacula-1.39.30/src/stored/dev.h bacula-1.39.30/src/stored/dev.h
---- new/bacula-1.39.30/src/stored/dev.h        2006-11-21 18:03:46.000000000 +0100
-+++ bacula-1.39.30/src/stored/dev.h    2006-12-19 22:27:27.000000000 +0100
-@@ -283,7 +283,17 @@
+diff -Naur org/bacula-2.0.0/src/stored/dev.h bacula-2.0.0/src/stored/dev.h
+--- org/bacula-2.0.0/src/stored/dev.h  2006-12-14 12:41:01.000000000 +0100
++++ bacula-2.0.0/src/stored/dev.h      2007-01-09 16:10:02.000000000 +0100
+@@ -280,7 +280,17 @@
     int rem_wait_sec;
     int num_wait;
  
 +   int get_timer_count();           /* return the last timer interval (ms) */
 +
     int has_cap(int cap) const { return capabilities & cap; }
-    int is_autochanger() const { return capabilities & CAP_AUTOCHANGER; }
-    int requires_mount() const { return capabilities & CAP_REQMOUNT; }
-@@ -364,6 +374,8 @@
+    void clear_cap(int cap) { capabilities &= ~cap; }
+    void set_cap(int cap) { capabilities |= cap; }
+@@ -363,6 +373,8 @@
     bool truncate(DCR *dcr);      /* in dev.c */
     int open(DCR *dcr, int mode); /* in dev.c */
     void term(void);              /* in dev.c */
 
-diff -Naur cvs/src/dird/next_vol.c my/src/dird/next_vol.c
---- cvs/src/dird/next_vol.c    2006-11-15 22:16:02.000000000 +0100
-+++ my/src/dird/next_vol.c     2006-11-15 23:47:43.000000000 +0100
-@@ -313,6 +313,7 @@
-    MEDIA_DBR smr;
-    POOL_DBR spr, pr;
-    bool ok = false;
-+   bool found = false;
-    char ed1[50], ed2[50];
- 
-    /* Only one thread at a time can pull from the scratch pool */
-@@ -328,9 +329,20 @@
-       if (InChanger) {       
-          smr.StorageId = mr->StorageId;  /* want only Scratch Volumes in changer */
-       }
--      bstrncpy(smr.VolStatus, "Append", sizeof(smr.VolStatus));  /* want only appendable volumes */
-       bstrncpy(smr.MediaType, mr->MediaType, sizeof(smr.MediaType));
-+      
-+      /* first, try to get Append volume */
-+      bstrncpy(smr.VolStatus, "Append", sizeof(smr.VolStatus));
-       if (db_find_next_volume(jcr, jcr->db, 1, InChanger, &smr)) {
-+          found = true;
-+      /* next, we can try to find an Recycled volume */
-+      } else if (find_recycled_volume(jcr, InChanger, &smr)) {
-+          found = true;
-+      /* finaly, we take a Purged volume */
-+      } else if (recycle_oldest_purged_volume(jcr, InChanger, &smr)) {
-+          found = true;
-+      }
-+      if (found) {
-          POOL_MEM query(PM_MESSAGE);
- 
-          /*   
-@@ -369,6 +381,9 @@
-          memcpy(mr, &smr, sizeof(MEDIA_DBR));
-          /* Set default parameters from current pool */
-          set_pool_dbr_defaults_in_media_dbr(mr, &pr);
-+         /* set_pool_dbr_defaults_in_media_dbr set VolStatus to Append,
-+          * we could have Recycled media */
-+         bstrncpy(mr->VolStatus, smr.VolStatus, sizeof(smr.VolStatus));
-          if (!db_update_media_record(jcr, jcr->db, mr)) {
-             Jmsg(jcr, M_WARNING, 0, _("Unable to update Volume record: ERR=%s"), 
-                  db_strerror(jcr->db));
-diff -Naur cvs/src/dird/protos.h my/src/dird/protos.h
---- cvs/src/dird/protos.h      2006-11-15 22:16:02.000000000 +0100
-+++ my/src/dird/protos.h       2006-11-15 23:26:50.000000000 +0100
-@@ -178,6 +178,9 @@
+diff -Naur org/bacula-2.0.0/src/dird/protos.h bacula-2.0.0/src/dird/protos.h
+--- org/bacula-2.0.0/src/dird/protos.h 2006-12-23 17:33:52.000000000 +0100
++++ bacula-2.0.0/src/dird/protos.h     2007-01-09 16:12:18.000000000 +0100
+@@ -195,6 +195,9 @@
  int get_num_drives_from_SD(UAContext *ua);
  void update_slots(UAContext *ua);
  
  /* ua_output.c */
  void prtit(void *ctx, const char *msg);
  int complete_jcr_for_job(JCR *jcr, JOB *job, POOL *pool);
-diff -Naur cvs/src/dird/ua_purge.c my/src/dird/ua_purge.c
---- cvs/src/dird/ua_purge.c    2006-11-15 22:16:03.000000000 +0100
-+++ my/src/dird/ua_purge.c     2006-11-15 23:55:14.000000000 +0100
-@@ -569,6 +569,18 @@
+diff -Naur org/bacula-2.0.0/src/dird/ua_purge.c bacula-2.0.0/src/dird/ua_purge.c
+--- org/bacula-2.0.0/src/dird/ua_purge.c       2006-12-22 16:01:05.000000000 +0100
++++ bacula-2.0.0/src/dird/ua_purge.c   2007-01-09 16:12:18.000000000 +0100
+@@ -605,6 +605,18 @@
        }
        pm_strcpy(jcr->VolumeName, mr->VolumeName);
        generate_job_event(jcr, "VolumePurged");
        /* Send message to Job report, if it is a *real* job */           
        if (jcr && jcr->JobId > 0) {
           Jmsg1(jcr, M_INFO, 0, _("All records pruned from Volume \"%s\"; marking it \"Purged\"\n"),
-diff -Naur cvs/src/dird/ua_update.c my/src/dird/ua_update.c
---- cvs/src/dird/ua_update.c   2006-11-15 23:30:10.000000000 +0100
-+++ my/src/dird/ua_update.c    2006-11-15 23:56:30.000000000 +0100
-@@ -276,7 +276,7 @@
+diff -Naur org/bacula-2.0.0/src/dird/ua_update.c bacula-2.0.0/src/dird/ua_update.c
+--- org/bacula-2.0.0/src/dird/ua_update.c      2006-12-23 17:33:52.000000000 +0100
++++ bacula-2.0.0/src/dird/ua_update.c  2007-01-09 16:12:18.000000000 +0100
+@@ -290,7 +290,7 @@
  }
  
  /* Modify the Pool in which this Volume is located */