]> git.sur5r.net Git - bacula/bacula/commitdiff
Use dcr more in SD + int to bool conversions
authorKern Sibbald <kern@sibbald.com>
Wed, 7 Jul 2004 09:10:27 +0000 (09:10 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 7 Jul 2004 09:10:27 +0000 (09:10 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1457 91ce42f0-d328-0410-95d8-f526ca767f89

32 files changed:
bacula/kernstodo
bacula/src/filed/backup.c
bacula/src/filed/estimate.c
bacula/src/filed/heartbeat.c
bacula/src/filed/restore.c
bacula/src/filed/status.c
bacula/src/filed/verify.c
bacula/src/filed/verify_vol.c
bacula/src/stored/acquire.c
bacula/src/stored/append.c
bacula/src/stored/askdir.c
bacula/src/stored/autochanger.c
bacula/src/stored/bcopy.c
bacula/src/stored/bextract.c
bacula/src/stored/block.c
bacula/src/stored/block.h
bacula/src/stored/bls.c
bacula/src/stored/bscan.c
bacula/src/stored/bsr.h
bacula/src/stored/btape.c
bacula/src/stored/dev.h
bacula/src/stored/device.c
bacula/src/stored/fd_cmds.c
bacula/src/stored/job.c
bacula/src/stored/label.c
bacula/src/stored/match_bsr.c
bacula/src/stored/mount.c
bacula/src/stored/protos.h
bacula/src/stored/read.c
bacula/src/stored/read_record.c
bacula/src/stored/record.c
bacula/src/stored/stored.h

index d03a4b4ca0bbb5f6f5af292eae82000d66a1e077..fb689e9cce221c055da8604f3763ba86ff6c7b5b 100644 (file)
@@ -1,7 +1,8 @@
                  Kern's ToDo List
-                   04 July 2004
+                   06 July 2004
 
 1.35 Items to do:
+- Require resource names to be unique.
 - Make btape release the drive during the "test" append.
 - Do tape alerts -- see tapealert.txt
 - Revisit and revise Disaster Recovery (fix SCSI and RAID 
index 556bf25e5f8bd2c60aad1561bf0b43fe4a194295..6adc77ecc356127f09cc682f075684be14eaa0de 100644 (file)
@@ -8,7 +8,7 @@
  *
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index d53accddf5b3811d7970766140d31f929d6a08e1..bee59417eadb08a03ce44ec0e9109cc443bae540 100644 (file)
@@ -8,7 +8,7 @@
  *
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index 3a1ae9406cdf1e609064b71410b4c6a626b76c9a..83f090adb97cfb66f790bc423b83e508cb04c8c8 100644 (file)
@@ -9,7 +9,7 @@
  *
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index f2354234be72148b1e6e1328d933741f1ea5eff6..e2da0c849a2edb9c978491e36765fe5c6ab4b584 100644 (file)
@@ -7,7 +7,7 @@
  *
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index d18b054e34fdf9716471f539c6e52ec2de9d183d..bcb896db6aea26c40b4307a390a5f20b818b14e2 100755 (executable)
@@ -7,7 +7,7 @@
  *
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index aa75e463fe7f573e4416b57aafff11f1131fb079..5ae74dd90bfae9f8fb6c69c6229cff4a45a19006 100644 (file)
@@ -7,7 +7,7 @@
  *
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index 49e2e6b65eea9695e3e62e7c7d237529a88627b0..57bcfaf5536b1c1bd8be235d6c041516f0e79870 100644 (file)
@@ -8,7 +8,7 @@
  *
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index d9f2a805323704bfc9fa8873ead371dd79ccbb9c..09d2d6a1664cf4e3727d276b81804c28c6ea2cd5 100644 (file)
@@ -187,7 +187,7 @@ default_path:
         }
         /* Mount a specific volume and no other */
          Dmsg0(200, "calling dir_ask_sysop\n");
-        if (!dir_ask_sysop_to_mount_volume(jcr, dev)) {
+        if (!dir_ask_sysop_to_mount_volume(jcr)) {
            goto get_out;             /* error return */
         }
         try_autochanger = true;      /* permit using autochanger again */
@@ -358,7 +358,7 @@ ok_out:
  *  the device remains open.
  *
  */
-int release_device(JCR *jcr)
+bool release_device(JCR *jcr)
 {
    DEVICE *dev = jcr->dcr->dev;   
    lock_device(dev);
@@ -388,7 +388,7 @@ int release_device(JCR *jcr)
         dev->VolCatInfo.VolCatJobs++;              /* increment number of jobs */
         /* Note! do volume update before close, which zaps VolCatInfo */
          Dmsg0(100, "dir_update_vol_info. Release0\n");
-        dir_update_volume_info(jcr, dev, 0); /* send Volume info to Director */
+        dir_update_volume_info(jcr, false); /* send Volume info to Director */
       }
 
       if (!dev->num_writers && (!dev_is_tape(dev) || !dev_cap(dev, CAP_ALWAYSOPEN))) {
@@ -411,5 +411,5 @@ int release_device(JCR *jcr)
    }
    free_dcr(jcr->dcr);
    jcr->dcr = NULL;
-   return 1;
+   return true;
 }
index 407073143698951f5bda6715939fe8d488a64ddf..f311dd97652dd8554a5b5bd059fd41afc84a3111 100644 (file)
@@ -5,7 +5,7 @@
  *  Version $Id$
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -246,7 +246,7 @@ int do_append_data(JCR *jcr)
       }
       Dmsg0(90, "back from write_end_session_label()\n");
       /* Flush out final partial block of this session */
-      if (!write_block_to_device(jcr->dcr, block)) {
+      if (!write_block_to_device(dcr, block)) {
          Dmsg0(100, _("Set ok=FALSE after write_block_to_device.\n"));
         set_jcr_job_status(jcr, JS_ErrorTerminated);
         ok = false;
@@ -276,5 +276,5 @@ int do_append_data(JCR *jcr)
    dir_send_job_status(jcr);         /* update director */
 
    Dmsg1(100, "return from do_append_data() stat=%d\n", ok);
-   return ok ? 1 : 0;
+   return ok;
 }
index d7698b9a757826ce5dc7954bfb8c28d063a6a579..116a650f4d90413ed93b9fe59c5f49db66e0b736 100644 (file)
@@ -59,7 +59,7 @@ static int wait_for_sysop(JCR *jcr, DEVICE *dev);
 /*
  * Send current JobStatus to Director
  */
-int dir_send_job_status(JCR *jcr)
+bool dir_send_job_status(JCR *jcr)
 {
    return bnet_fsend(jcr->dir_bsock, Job_status, jcr->Job, jcr->JobStatus);
 }
@@ -70,10 +70,10 @@ int dir_send_job_status(JCR *jcr)
  * and
  *   dir_find_next_appendable_volume()
  * 
- *  Returns: 1 on success and vol info in jcr->VolCatInfo
- *          0 on failure
+ *  Returns: true  on success and vol info in jcr->VolCatInfo
+ *          false on failure
  */
-static int do_get_volume_info(JCR *jcr)
+static bool do_get_volume_info(JCR *jcr)
 {
     BSOCK *dir = jcr->dir_bsock;
     DCR *dcr = jcr->dcr;
@@ -86,7 +86,7 @@ static int do_get_volume_info(JCR *jcr)
     if (bnet_recv(dir) <= 0) {
        Dmsg0(200, "getvolname error bnet_recv\n");
        Mmsg(&jcr->errmsg, _("Network error on bnet_recv in req_vol_info.\n"));
-       return 0;
+       return false;
     }
     memset(&vol, 0, sizeof(vol));
     Dmsg1(200, "Get vol info=%s\n", dir->msg);
@@ -101,7 +101,7 @@ static int do_get_volume_info(JCR *jcr)
     if (n != 17) {
        Dmsg2(100, "Bad response from Dir fields=%d: %s\n", n, dir->msg);
        Mmsg(&jcr->errmsg, _("Error getting Volume info: %s\n"), dir->msg);
-       return 0;
+       return false;
     }
     vol.InChanger = InChanger;       /* bool in structure */
     unbash_spaces(vol.VolCatName);
@@ -112,21 +112,21 @@ static int do_get_volume_info(JCR *jcr)
     
     Dmsg2(200, "do_reqest_vol_info got slot=%d Volume=%s\n", 
          vol.Slot, vol.VolCatName);
-    return 1;
+    return true;
 }
 
 
 /*
  * Get Volume info for a specific volume from the Director's Database
  *
- * Returns: 1 on success   (not Director guarantees that Pool and MediaType
- *                         are correct and VolStatus==Append or
- *                         VolStatus==Recycle)
- *         0 on failure
+ * Returns: true  on success   (not Director guarantees that Pool and MediaType
+ *                            are correct and VolStatus==Append or
+ *                            VolStatus==Recycle)
+ *         false on failure
  *
  *         Volume information returned in jcr
  */
-int dir_get_volume_info(JCR *jcr, enum get_vol_info_rw writing)
+bool dir_get_volume_info(JCR *jcr, enum get_vol_info_rw writing)
 {
     BSOCK *dir = jcr->dir_bsock;
 
@@ -142,13 +142,13 @@ int dir_get_volume_info(JCR *jcr, enum get_vol_info_rw writing)
 
 /*
  * Get info on the next appendable volume in the Director's database
- * Returns: 1 on success
- *         0 on failure
+ * Returns: true  on success
+ *         false on failure
  *
  *         Volume information returned in jcr
  *
  */
-int dir_find_next_appendable_volume(JCR *jcr)
+bool dir_find_next_appendable_volume(JCR *jcr)
 {
     BSOCK *dir = jcr->dir_bsock;
     JCR *njcr;
@@ -200,9 +200,10 @@ int dir_find_next_appendable_volume(JCR *jcr)
  * back to the director. The information comes from the
  * dev record.    
  */
-int dir_update_volume_info(JCR *jcr, DEVICE *dev, int label)
+bool dir_update_volume_info(JCR *jcr, bool label)
 {
    BSOCK *dir = jcr->dir_bsock;
+   DEVICE *dev = jcr->dcr->dev;
    time_t LastWritten = time(NULL);
    char ed1[50], ed2[50], ed3[50], ed4[50];
    VOLUME_CAT_INFO *vol = &dev->VolCatInfo;
@@ -210,11 +211,11 @@ int dir_update_volume_info(JCR *jcr, DEVICE *dev, int label)
 
    if (vol->VolCatName[0] == 0) {
       Jmsg0(jcr, M_ERROR, 0, _("NULL Volume name. This shouldn't happen!!!\n"));
-      return 0;
+      return false;
    }
    if (dev_state(dev, ST_READ)) {
       Jmsg0(jcr, M_ERROR, 0, _("Attempt to update_volume_info in read mode!!!\n"));
-      return 0;
+      return false;
    }
 
    Dmsg1(100, "Update cat VolFiles=%d\n", dev->file);
@@ -240,24 +241,24 @@ int dir_update_volume_info(JCR *jcr, DEVICE *dev, int label)
 
    if (!do_get_volume_info(jcr)) {
       Jmsg(jcr, M_ERROR, 0, "%s", jcr->errmsg);
-      return 0;
+      return false;
    }
    Dmsg1(120, "get_volume_info(): %s", dir->msg);
    /* Update dev Volume info in case something changed (e.g. expired) */
    memcpy(&dev->VolCatInfo, &jcr->VolCatInfo, sizeof(dev->VolCatInfo));
-   return 1;
+   return true;
 }
 
 /*
  * After writing a Volume, create the JobMedia record.
  */
-int dir_create_jobmedia_record(JCR *jcr)
+bool dir_create_jobmedia_record(JCR *jcr)
 {
    BSOCK *dir = jcr->dir_bsock;
    DCR *dcr = jcr->dcr;
 
    if (!dcr->WroteVol) {
-      return 1;                      /* nothing written to tape */
+      return true;                   /* nothing written to tape */
    }
 
    dcr->WroteVol = false;
@@ -270,22 +271,22 @@ int dir_create_jobmedia_record(JCR *jcr)
       Dmsg0(190, "create_jobmedia error bnet_recv\n");
       Jmsg(jcr, M_ERROR, 0, _("Error creating JobMedia record: ERR=%s\n"), 
           bnet_strerror(dir));
-      return 0;
+      return false;
    }
    Dmsg1(120, "Create_jobmedia: %s", dir->msg);
    if (strcmp(dir->msg, OK_create) != 0) {
       Dmsg1(130, "Bad response from Dir: %s\n", dir->msg);
       Jmsg(jcr, M_ERROR, 0, _("Error creating JobMedia record: %s\n"), dir->msg);
-      return 0;
+      return false;
    }
-   return 1;
+   return true;
 }
 
 
 /* 
  * Update File Attribute data
  */
-int dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec)
+bool dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec)
 {
    BSOCK *dir = jcr->dir_bsock;
    ser_declare;
@@ -311,8 +312,8 @@ int dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec)
  *   Entered with device blocked.
  *   Leaves with device blocked.
  *
- *   Returns: 1 on success (operator issues a mount command)
- *           0 on failure
+ *   Returns: true  on success (operator issues a mount command)
+ *           false on failure
  *             Note, must create dev->errmsg on error return.
  *
  *    On success, jcr->VolumeName and jcr->VolCatInfo contain
@@ -323,11 +324,12 @@ int dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec)
  *     actually be mounted. The calling routine must read it and
  *     verify the label.
  */
-int dir_ask_sysop_to_create_appendable_volume(JCR *jcr, DEVICE *dev)
+bool dir_ask_sysop_to_create_appendable_volume(JCR *jcr)
 {
    int stat = 0, jstat;
    bool unmounted;
    bool first = true;
+   DEVICE *dev = jcr->dcr->dev;
 
    Dmsg0(130, "enter dir_ask_sysop_to_create_appendable_volume\n");
    ASSERT(dev->dev_blocked);
@@ -337,7 +339,7 @@ int dir_ask_sysop_to_create_appendable_volume(JCR *jcr, DEVICE *dev)
               _("Job %s canceled while waiting for mount on Storage Device \"%s\".\n"), 
              jcr->Job, jcr->dev_name);
          Jmsg(jcr, M_INFO, 0, "%s", dev->errmsg);
-        return 0;
+        return false;
       }
       /* First pass, we *know* there are no appendable volumes, so no need to call */
       if (!first && dir_find_next_appendable_volume(jcr)) { /* get suggested volume */
@@ -353,7 +355,7 @@ int dir_ask_sysop_to_create_appendable_volume(JCR *jcr, DEVICE *dev)
                dev_cap(dev, CAP_LABEL)) ||
                 (jcr->VolumeName[0] && jcr->VolCatInfo.Slot))) {
             Dmsg0(100, "Return 1 from mount without wait.\n");
-           return 1;
+           return true;
         }
         jstat = JS_WaitMount;
         if (!dev->poll) {
@@ -396,7 +398,7 @@ Please use the \"label\"  command to create a new Volume for:\n\
               dev_name(dev), jcr->Job);
             Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
             Dmsg1(190, "Gave up waiting on device %s\n", dev_name(dev));
-           return 0;                 /* exceeded maximum waits */
+           return false;             /* exceeded maximum waits */
         }
         continue;
       }
@@ -404,7 +406,7 @@ Please use the \"label\"  command to create a new Volume for:\n\
          Mmsg2(&dev->errmsg, _("pthread error in mount_next_volume stat=%d ERR=%s\n"),
               stat, strerror(stat));
          Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
-        return 0;
+        return false;
       }
       if (stat != 0) {
          Jmsg(jcr, M_WARNING, 0, _("pthread error in mount_next_volume stat=%d ERR=%s\n"), stat,
@@ -436,7 +438,7 @@ volumes for Job=%s.\n"), jcr->Job);
    set_jcr_job_status(jcr, JS_Running);
    dir_send_job_status(jcr);
    Dmsg0(130, "leave dir_ask_sysop_to_mount_create_appendable_volume\n");
-   return 1;
+   return true;
 }
 
 /*
@@ -451,10 +453,11 @@ volumes for Job=%s.\n"), jcr->Job);
  *             Note, must create dev->errmsg on error return.
  *
  */
-int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
+bool dir_ask_sysop_to_mount_volume(JCR *jcr)
 {
    int stat = 0;
    const char *msg;
+   DEVICE *dev = jcr->dcr->dev;
 
    Dmsg0(130, "enter dir_ask_sysop_to_mount_volume\n");
    if (!jcr->VolumeName[0]) {
@@ -466,21 +469,8 @@ int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
       if (job_canceled(jcr)) {
          Mmsg(&dev->errmsg, _("Job %s canceled while waiting for mount on Storage Device \"%s\".\n"), 
              jcr->Job, jcr->dev_name);
-        return 0;
-      }
-
-#ifdef needed
-      /*
-       * If we have a valid volume name and we are not
-       *   removable media, return now, or if we have a
-       *   Slot for an autochanger, otherwise wait
-       *   for the operator to mount the media.
-       */
-      if ((!dev_cap(dev, CAP_REM) && dev_cap(dev, CAP_LABEL)) || jcr->VolCatInfo.Slot) {
-         Dmsg0(100, "Return 1 from mount without wait.\n");
-        return 1;
+        return false;
       }
-#endif
 
       if (!dev->poll) {
          msg = _("Please mount");
@@ -497,7 +487,7 @@ int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
       if (dev->poll) {
          Dmsg1(200, "Poll timeout in mount vol on device %s\n", dev_name(dev));
          Dmsg1(200, "Blocked=%d\n", dev->dev_blocked);
-        return 1;
+        return true;
       }
 
       if (stat == ETIMEDOUT) {
@@ -506,7 +496,7 @@ int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
               dev_name(dev), jcr->Job);
             Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
             Dmsg1(190, "Gave up waiting on device %s\n", dev_name(dev));
-           return 0;                 /* exceeded maximum waits */
+           return false;             /* exceeded maximum waits */
         }
         continue;
       }
@@ -514,7 +504,7 @@ int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
          Mmsg2(&dev->errmsg, _("pthread error in mount_volume stat=%d ERR=%s\n"),
               stat, strerror(stat));
          Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
-        return 0;
+        return false;
       }
       if (stat != 0) {
          Jmsg(jcr, M_ERROR, 0, _("pthread error in mount_next_volume stat=%d ERR=%s\n"), stat,
@@ -526,7 +516,7 @@ int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
    set_jcr_job_status(jcr, JS_Running);
    dir_send_job_status(jcr);
    Dmsg0(130, "leave dir_ask_sysop_to_mount_volume\n");
-   return 1;
+   return true;
 }
 
 /*
index d459689e32d639e135da001e651799d22a05dc10..447fa8bb2849d2834ab24058cf22e84ef97178e9 100644 (file)
@@ -7,7 +7,7 @@
  *   Version $Id$
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -176,7 +176,7 @@ void invalid_slot_in_catalog(JCR *jcr, DEVICE *dev)
    jcr->VolCatInfo.InChanger = false;
    dev->VolCatInfo.InChanger = false;
    Dmsg0(100, "update vol info in mount\n");
-   dir_update_volume_info(jcr, dev, 1);  /* set new status */
+   dir_update_volume_info(jcr, true);  /* set new status */
 }
 
 /*
index 758fe253fe47e35611fe79fe1862a07f53e1ecef..01bc5db056b82f2a6f24dc3bacbf39ac368488ca 100644 (file)
@@ -259,19 +259,20 @@ static bool record_cb(JCR *in_jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *re
 
 
 /* Dummies to replace askdir.c */
-int    dir_get_volume_info(JCR *jcr, enum get_vol_info_rw  writing) { return 1;}
-int    dir_find_next_appendable_volume(JCR *jcr) { return 1;}
-int    dir_update_volume_info(JCR *jcr, DEVICE *dev, int relabel) { return 1; }
-int    dir_create_jobmedia_record(JCR *jcr) { return 1; }
-int    dir_ask_sysop_to_create_appendable_volume(JCR *jcr, DEVICE *dev) { return 1; }
-int    dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec) { return 1;}
-int    dir_send_job_status(JCR *jcr) {return 1;}
+bool   dir_get_volume_info(JCR *jcr, enum get_vol_info_rw  writing) { return 1;}
+bool   dir_find_next_appendable_volume(JCR *jcr) { return 1;}
+bool   dir_update_volume_info(JCR *jcr, bool relabel) { return 1; }
+bool   dir_create_jobmedia_record(JCR *jcr) { return 1; }
+bool   dir_ask_sysop_to_create_appendable_volume(JCR *jcr) { return 1; }
+bool   dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec) { return 1;}
+bool   dir_send_job_status(JCR *jcr) {return 1;}
 
 
-int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
+bool dir_ask_sysop_to_mount_volume(JCR *jcr)
 {
-   fprintf(stderr, "Mount Volume \"%s\" on device \"%s\" and press return when ready: ",
-      in_jcr->VolumeName, dev_name(dev));
+   DEVICE *dev = jcr->dcr->dev;
+   fprintf(stderr, "Mount Volume \"%s\" on device %s and press return when ready: ",
+      jcr->VolumeName, dev_name(dev));
    getchar();  
-   return 1;
+   return true;
 }
index 5f64cf9ed27aefa4f3b73a3b892ee33bc1366359..14252447f8f032bc3e350502a8955a34c181f229 100644 (file)
@@ -433,23 +433,21 @@ static bool record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
    return true;
 }
 
-
-
-
 /* Dummies to replace askdir.c */
-int    dir_get_volume_info(JCR *jcr, enum get_vol_info_rw  writing) { return 1;}
-int    dir_find_next_appendable_volume(JCR *jcr) { return 1;}
-int    dir_update_volume_info(JCR *jcr, DEVICE *dev, int relabel) { return 1; }
-int    dir_create_jobmedia_record(JCR *jcr) { return 1; }
-int    dir_ask_sysop_to_create_appendable_volume(JCR *jcr, DEVICE *dev) { return 1; }
-int    dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec) { return 1;}
-int    dir_send_job_status(JCR *jcr) {return 1;}
+bool   dir_get_volume_info(JCR *jcr, enum get_vol_info_rw  writing) { return 1;}
+bool   dir_find_next_appendable_volume(JCR *jcr) { return 1;}
+bool   dir_update_volume_info(JCR *jcr, bool relabel) { return 1; }
+bool   dir_create_jobmedia_record(JCR *jcr) { return 1; }
+bool   dir_ask_sysop_to_create_appendable_volume(JCR *jcr) { return 1; }
+bool   dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec) { return 1;}
+bool   dir_send_job_status(JCR *jcr) {return 1;}
 
 
-int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
+bool dir_ask_sysop_to_mount_volume(JCR *jcr)
 {
-   fprintf(stderr, "Mount Volume %s on device %s and press return when ready: ",
+   DEVICE *dev = jcr->dcr->dev;
+   fprintf(stderr, "Mount Volume \"%s\" on device %s and press return when ready: ",
       jcr->VolumeName, dev_name(dev));
    getchar();  
-   return 1;
+   return true;
 }
index a383179c7590fde77dc592beae8839290064052e..2c4512423d4a86cbe92782512c1d2ebb20cc75a1 100644 (file)
@@ -206,10 +206,10 @@ void ser_block_header(DEV_BLOCK *block)
  * Unserialize the block header for reading block.
  *  This includes setting all the buffer pointers correctly.
  *
- *  Returns: 0 on failure (not a block)
- *          1 on success
+ *  Returns: false on failure (not a block)
+ *          true  on success
  */
-static int unser_block_header(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
+static bool unser_block_header(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
 {
    ser_declare;
    char Id[BLKHDR_ID_LENGTH+1];
@@ -233,14 +233,14 @@ static int unser_block_header(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
       block->bufp = block->buf + bhl;
       if (strncmp(Id, BLKHDR1_ID, BLKHDR_ID_LENGTH) != 0) {
         dev->dev_errno = EIO;
-         Mmsg2(&dev->errmsg, _("Volume data error! Wanted ID: %s, got %s. Buffer discarded.\n"),
-           BLKHDR1_ID, Id);
+         Mmsg4(&dev->errmsg, _("Volume data error at %u:%u! Wanted ID: %s, got %s. Buffer discarded.\n"),
+           dev->file, dev->block_num, BLKHDR1_ID, Id);
         if (block->read_errors == 0 || verbose >= 2) {
             Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
         }
         block->read_errors++;
         if (!forge_on) {
-           return 0;
+           return false;
         }
       }
    } else if (Id[3] == '2') {
@@ -251,25 +251,26 @@ static int unser_block_header(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
       block->bufp = block->buf + bhl;
       if (strncmp(Id, BLKHDR2_ID, BLKHDR_ID_LENGTH) != 0) {
         dev->dev_errno = EIO;
-         Mmsg2(&dev->errmsg, _("Volume data error! Wanted ID: %s, got %s. Buffer discarded.\n"),
-           BLKHDR2_ID, Id);
+         Mmsg4(&dev->errmsg, _("Volume data error at %u:%u! Wanted ID: %s, got %s. Buffer discarded.\n"),
+           dev->file, dev->block_num, BLKHDR2_ID, Id);
         if (block->read_errors == 0 || verbose >= 2) {
             Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
         }
         block->read_errors++;
         if (!forge_on) {
-           return 0;
+           return false;
         }
       }
    } else {
       dev->dev_errno = EIO;
-      Mmsg1(&dev->errmsg, _("Volume data error! Wanted block-id BB02, got %s. Buffer discarded.\n"), Id);
+      Mmsg4(&dev->errmsg, _("Volume data error at %u:%u! Wanted ID: %s, got %s. Buffer discarded.\n"),
+         dev->file, dev->block_num, BLKHDR2_ID, Id);
       if (block->read_errors == 0 || verbose >= 2) {
          Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
       }
       block->read_errors++;
       if (!forge_on) {
-        return 0;
+        return false;
       }
       unser_uint32(block->VolSessionId);
       unser_uint32(block->VolSessionTime);
@@ -281,14 +282,14 @@ static int unser_block_header(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
    /* Sanity check */
    if (block_len > MAX_BLOCK_LENGTH) {
       dev->dev_errno = EIO;
-      Mmsg1(&dev->errmsg,  _("Volume data error! Block length %u is insane (too large), probably due to a bad archive.\n"),
-        block_len);
+      Mmsg3(&dev->errmsg,  _("Volume data error at %u:%u! Block length %u is insane (too large), probably due to a bad archive.\n"),
+        dev->file, dev->block_num, block_len);
       if (block->read_errors == 0 || verbose >= 2) {
          Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
       }
       block->read_errors++;
       if (!forge_on) {
-        return 0;
+        return false;
       }
    }
 
@@ -309,30 +310,30 @@ static int unser_block_header(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
                         block_len-BLKHDR_CS_LENGTH);
       if (BlockCheckSum != CheckSum) {
         dev->dev_errno = EIO;
-         Mmsg3(&dev->errmsg, _("Volume data error! Block checksum mismatch in block %u: calc=%x blk=%x\n"), 
-           (unsigned)BlockNumber, BlockCheckSum, CheckSum);
+         Mmsg5(&dev->errmsg, _("Volume data error at %u:%u! Block checksum mismatch in block %u: calc=%x blk=%x\n"), 
+           dev->file, dev->block_num, (unsigned)BlockNumber, BlockCheckSum, CheckSum);
         if (block->read_errors == 0 || verbose >= 2) {
             Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
         }
         block->read_errors++;
         if (!forge_on) {
-           return 0;
+           return false;
         }
       }
    }
-   return 1;
+   return true;
 }
 
 /*  
  * Write a block to the device, with locking and unlocking
  *
- * Returns: 1 on success
- *       : 0 on failure
+ * Returns: true  on success
+ *       : false on failure
  *
  */
-int write_block_to_device(DCR *dcr, DEV_BLOCK *block)
+bool write_block_to_device(DCR *dcr, DEV_BLOCK *block)
 {
-   int stat = 1;
+   bool stat = true;
    DEVICE *dev = dcr->dev;
    JCR *jcr = dcr->jcr;
 
@@ -359,7 +360,7 @@ int write_block_to_device(DCR *dcr, DEV_BLOCK *block)
          Jmsg(jcr, M_ERROR, 0, _("Could not create JobMedia record for Volume=\"%s\" Job=%s\n"),
            jcr->VolCatInfo.VolCatName, jcr->Job);
         set_new_volume_parameters(jcr, dev);
-        stat = 0;
+        stat = false;
         goto bail_out;
       }
       if (dcr->NewVol) {
@@ -469,7 +470,7 @@ bool write_block_to_dev(DCR *dcr, DEV_BLOCK *block)
       /* Don't do update after second EOF or file count will be wrong */
       Dmsg0(100, "dir_update_volume_info\n");
       dev->VolCatInfo.VolCatFiles = dev->file;
-      dir_update_volume_info(jcr, dev, 0);
+      dir_update_volume_info(jcr, false);
       if (dev_cap(dev, CAP_TWOEOF) && weof_dev(dev, 1) != 0) { /* write eof */
          Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
         dev->VolCatInfo.VolCatErrors++;
@@ -491,7 +492,7 @@ bool write_block_to_dev(DCR *dcr, DEV_BLOCK *block)
         dev->state |= (ST_EOF | ST_EOT | ST_WEOT);
          Dmsg0(100, "dir_update_volume_info\n");
         dev->VolCatInfo.VolCatFiles = dev->file;
-        dir_update_volume_info(jcr, dev, 0);
+        dir_update_volume_info(jcr, false);
         dev->dev_errno = ENOSPC;
         return false;
       }
@@ -499,7 +500,7 @@ bool write_block_to_dev(DCR *dcr, DEV_BLOCK *block)
       /* Create a JobMedia record so restore can seek */
       Dmsg0(100, "dir_update_volume_info\n");
       dev->VolCatInfo.VolCatFiles = dev->file;
-      dir_update_volume_info(jcr, dev, 0);
+      dir_update_volume_info(jcr, false);
       if (!dir_create_jobmedia_record(jcr)) {
         dev->dev_errno = EIO;
           Jmsg(jcr, M_ERROR, 0, _("Could not create JobMedia record for Volume=\"%s\" Job=%s\n"),
@@ -563,7 +564,7 @@ bool write_block_to_dev(DCR *dcr, DEV_BLOCK *block)
       }
       Dmsg0(100, "dir_update_volume_info\n");
       dev->VolCatInfo.VolCatFiles = dev->file;
-      dir_update_volume_info(jcr, dev, 0);
+      dir_update_volume_info(jcr, false);
       if (dev_cap(dev, CAP_TWOEOF) && weof_dev(dev, 1) != 0) { /* end the tape */
         dev->VolCatInfo.VolCatErrors++;
          Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
@@ -799,8 +800,8 @@ reread:
 
    if (block->block_len > block->read_len) {
       dev->dev_errno = EIO;
-      Mmsg3(&dev->errmsg, _("Volume data error! Short block at %u of %d bytes on device %s discarded.\n"), 
-        dev->block_num, block->read_len, dev->dev_name);
+      Mmsg4(&dev->errmsg, _("Volume data error at %u:%u! Short block of %d bytes on device %s discarded.\n"), 
+        dev->file, dev->block_num, block->read_len, dev->dev_name);
       Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
       dev->state |= ST_SHORT;  /* set short block */
       block->read_len = block->binbuf = 0;
index 1c3c304bb0f140aa0622aeb3d65c4e6812d52ec6..6a35c81fd2120ebbaaa21ceefafe62a4122cb989 100644 (file)
@@ -7,7 +7,7 @@
  *
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index 1204cd52f8ca8b21a6900cb37a73338f9257c5ca..09c4cfaaa78e9fdca4213f84a1e77acea228487a 100644 (file)
@@ -42,9 +42,9 @@ static void get_session_record(DEVICE *dev, DEV_RECORD *rec, SESSION_LABEL *sess
 static bool record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec);
 
 static DEVICE *dev;
-static int dump_label = FALSE;
-static int list_blocks = FALSE;
-static int list_jobs = FALSE;
+static bool dump_label = false;
+static bool list_blocks = false;
+static bool list_jobs = false;
 static DEV_RECORD *rec;
 static DEV_BLOCK *block;
 static JCR *jcr;
@@ -147,15 +147,15 @@ int main (int argc, char *argv[])
         break;
 
       case 'j':
-        list_jobs = TRUE;
+        list_jobs = true;
         break;
 
       case 'k':
-        list_blocks = TRUE;
+        list_blocks = true;
         break;
 
       case 'L':
-        dump_label = TRUE;
+        dump_label = true;
         break;
 
       case 'p':
@@ -361,6 +361,8 @@ static bool record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
         if (!forge_on) {
             Emsg0(M_ERROR_TERM, 0, _("Cannot continue.\n"));
         }
+        num_files++;
+        return true;
       }
 
       if (attr->file_index != rec->FileIndex) {
@@ -393,11 +395,11 @@ static void get_session_record(DEVICE *dev, DEV_RECORD *rec, SESSION_LABEL *sess
       unser_volume_label(dev, rec);
       break;
    case SOS_LABEL:
-      rtype = "Begin Session";
+      rtype = "Begin Job Session";
       unser_session_label(sessrec, rec);
       break;
    case EOS_LABEL:
-      rtype = "End Session";
+      rtype = "End Job Session";
       break;
    case EOM_LABEL:
       rtype = "End of Medium";
@@ -416,19 +418,20 @@ static void get_session_record(DEVICE *dev, DEV_RECORD *rec, SESSION_LABEL *sess
 
 
 /* Dummies to replace askdir.c */
-int    dir_get_volume_info(JCR *jcr, enum get_vol_info_rw  writing) { return 1;}
-int    dir_find_next_appendable_volume(JCR *jcr) { return 1;}
-int    dir_update_volume_info(JCR *jcr, DEVICE *dev, int relabel) { return 1; }
-int    dir_create_jobmedia_record(JCR *jcr) { return 1; }
-int    dir_ask_sysop_to_create_appendable_volume(JCR *jcr, DEVICE *dev) { return 1; }
-int    dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec) { return 1;}
-int    dir_send_job_status(JCR *jcr) {return 1;}
+bool   dir_get_volume_info(JCR *jcr, enum get_vol_info_rw  writing) { return 1;}
+bool   dir_find_next_appendable_volume(JCR *jcr) { return 1;}
+bool   dir_update_volume_info(JCR *jcr, bool relabel) { return 1; }
+bool   dir_create_jobmedia_record(JCR *jcr) { return 1; }
+bool   dir_ask_sysop_to_create_appendable_volume(JCR *jcr) { return 1; }
+bool   dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec) { return 1;}
+bool   dir_send_job_status(JCR *jcr) {return 1;}
 
 
-int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
+bool dir_ask_sysop_to_mount_volume(JCR *jcr)
 {
+   DEVICE *dev = jcr->dcr->dev;
    fprintf(stderr, "Mount Volume \"%s\" on device %s and press return when ready: ",
       jcr->VolumeName, dev_name(dev));
    getchar();  
-   return 1;
+   return true;
 }
index 72ad0cf35de499d309b37565fe2058b29640df3d..817b0842f95b03466d33f7de6e68c2acf2bf917a 100644 (file)
@@ -41,7 +41,7 @@ static int  create_file_attributes_record(B_DB *db, JCR *mjcr,
                               char *fname, char *lname, int type,
                               char *ap, DEV_RECORD *rec);
 static int  create_media_record(B_DB *db, MEDIA_DBR *mr, VOLUME_LABEL *vl);
-static int  update_media_record(B_DB *db, MEDIA_DBR *mr);
+static bool update_media_record(B_DB *db, MEDIA_DBR *mr);
 static int  create_pool_record(B_DB *db, POOL_DBR *pr);
 static JCR *create_job_record(B_DB *db, JOB_DBR *mr, SESSION_LABEL *label, DEV_RECORD *rec);
 static int  update_job_record(B_DB *db, JOB_DBR *mr, SESSION_LABEL *elabel, 
@@ -85,9 +85,9 @@ static const char *db_user = "bacula";
 static const char *db_password = "";
 static const char *db_host = NULL;
 static const char *wd = NULL;
-static int update_db = 0;
-static int update_vol_info = 0;
-static int list_records = 0;
+static bool update_db = false;
+static bool update_vol_info = false;
+static bool list_records = false;
 static int ignored_msgs = 0;
 
 static int num_jobs = 0;
@@ -157,7 +157,7 @@ int main (int argc, char *argv[])
         break;
 
       case 'm':
-        update_vol_info = 1;
+        update_vol_info = true;
         break;
 
       case 'n':
@@ -177,11 +177,11 @@ int main (int argc, char *argv[])
         break;
 
       case 'r':
-        list_records = 1;
+        list_records = true;
         break;
 
       case 's':
-        update_db = 1;
+        update_db = true;
         break;
 
       case 'v':
@@ -261,7 +261,8 @@ int main (int argc, char *argv[])
    }
 
    do_scan();
-   printf("Records added to catalog:\n%7d Media\n%7d Pool\n%7d Job\n%7d File\n",
+   printf("Records %sadded to catalog:\n%7d Media\n%7d Pool\n%7d Job\n%7d File\n",
+      update_db?"":"would have been ",
       num_media, num_pools, num_jobs, num_files);
 
    free_jcr(bjcr);
@@ -347,7 +348,7 @@ static bool record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
     *
     */
    if (rec->FileIndex < 0) {
-      int save_update_db = update_db;
+      bool save_update_db = update_db;
 
       if (verbose > 1) {
         dump_label_record(dev, rec, 1);
@@ -434,7 +435,7 @@ static bool record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
         jr.JobId = label.JobId;
         if (db_get_job_record(bjcr, db, &jr)) {
            /* Job record already exists in DB */
-            update_db = 0;  /* don't change db in create_job_record */
+            update_db = false;  /* don't change db in create_job_record */
            if (verbose) {
                Pmsg1(000, _("SOS_LABEL: Found Job record for JobId: %d\n"), jr.JobId);
            }
@@ -608,6 +609,14 @@ static bool record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
       fr.JobId = mjcr->JobId;
       fr.FileId = 0;
       num_files++;
+      if (verbose && (num_files & 0x7FFF) == 0) {
+        char ed1[30], ed2[30], ed3[30], ed4[30];
+         Pmsg4(000, _("%s file records. At file:blk=%s:%s bytes=%s\n"),
+                    edit_uint64_with_commas(num_files, ed1),
+                    edit_uint64_with_commas(rec->File, ed2),
+                    edit_uint64_with_commas(rec->Block, ed3),
+                    edit_uint64_with_commas(mr.VolBytes, ed4));
+      } 
       if (db_get_file_attributes_record(bjcr, db, attr->fname, NULL, &fr)) {
         if (verbose > 1) {
             Pmsg1(000, _("File record already exists for: %s\n"), attr->fname);
@@ -798,21 +807,21 @@ static int create_media_record(B_DB *db, MEDIA_DBR *mr, VOLUME_LABEL *vl)
 /*
  * Called at end of media to update it
  */
-static int update_media_record(B_DB *db, MEDIA_DBR *mr)
+static bool update_media_record(B_DB *db, MEDIA_DBR *mr)
 {
    if (!update_db && !update_vol_info) {
-      return 1;
+      return true;
    }
 
    mr->LastWritten = lasttime;
    if (!db_update_media_record(bjcr, db, mr)) {
       Pmsg1(0, _("Could not update media record. ERR=%s\n"), db_strerror(db));
-      return 0;
+      return false;;
    }
    if (verbose) {
       Pmsg1(000, _("Updated Media record at end of Volume: %s\n"), mr->VolumeName);
    }
-   return 1;
+   return true;
 
 }
 
@@ -1149,17 +1158,18 @@ static JCR *create_jcr(JOB_DBR *jr, DEV_RECORD *rec, uint32_t JobId)
 }
 
 /* Dummies to replace askdir.c */
-int    dir_get_volume_info(JCR *jcr, enum get_vol_info_rw  writing) { return 1;}
-int    dir_find_next_appendable_volume(JCR *jcr) { return 1;}
-int    dir_update_volume_info(JCR *jcr, DEVICE *dev, int relabel) { return 1; }
-int    dir_create_jobmedia_record(JCR *jcr) { return 1; }
-int    dir_ask_sysop_to_create_appendable_volume(JCR *jcr, DEVICE *dev) { return 1; }
-int    dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec) { return 1;}
-int    dir_send_job_status(JCR *jcr) {return 1;}
+bool   dir_get_volume_info(JCR *jcr, enum get_vol_info_rw  writing) { return 1;}
+bool   dir_find_next_appendable_volume(JCR *jcr) { return 1;}
+bool   dir_update_volume_info(JCR *jcr, bool relabel) { return 1; }
+bool   dir_create_jobmedia_record(JCR *jcr) { return 1; }
+bool   dir_ask_sysop_to_create_appendable_volume(JCR *jcr) { return 1; }
+bool   dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec) { return 1;}
+bool   dir_send_job_status(JCR *jcr) {return 1;}
 
 
-int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
+bool dir_ask_sysop_to_mount_volume(JCR *jcr)
 {
+   DEVICE *dev = jcr->dcr->dev;
    fprintf(stderr, _("Mount Volume \"%s\" on device \"%s\" and press return when ready: "),
       jcr->VolumeName, dev_name(dev));
    getchar();  
index a75016ccbd616d301d38b282dd31f0cfb55eb36d..c44643baf1d0b2083158452e40428d4047b59fcc 100644 (file)
@@ -7,7 +7,7 @@
  *
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index 2cf32f8fd5a0d43847241335212b47da4d96c147..04b2f66066ad3a79683fa570104b4e9d57b5db03 100644 (file)
@@ -2507,40 +2507,41 @@ get_cmd(const char *prompt)
 }
 
 /* Dummies to replace askdir.c */
-int    dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec) { return 1;}
-int    dir_send_job_status(JCR *jcr) {return 1;}
+bool   dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec) { return 1;}
+bool   dir_send_job_status(JCR *jcr) {return 1;}
 
-int dir_update_volume_info(JCR *jcr, DEVICE *dev, int relabel) 
+bool dir_update_volume_info(JCR *jcr, bool relabel) 
 { 
    return 1;
 }
 
 
-int dir_get_volume_info(JCR *jcr, enum get_vol_info_rw writing)             
+bool dir_get_volume_info(JCR *jcr, enum get_vol_info_rw  writing)            
 {
    Dmsg0(20, "Enter dir_get_volume_info\n");
    bstrncpy(jcr->VolCatInfo.VolCatName, jcr->VolumeName, sizeof(jcr->VolCatInfo.VolCatName));
    return 1;
 }
 
-int dir_create_jobmedia_record(JCR *jcr)
+bool dir_create_jobmedia_record(JCR *jcr)
 {
    jcr->dcr->WroteVol = false;
    return 1;
 }
 
 
-int dir_find_next_appendable_volume(JCR *jcr) 
+bool dir_find_next_appendable_volume(JCR *jcr) 
 { 
    Dmsg1(20, "Enter dir_find_next_appendable_volume. stop=%d\n", stop);
    return jcr->VolumeName[0] != 0;
 }
 
-int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
+bool dir_ask_sysop_to_mount_volume(JCR *jcr)
 {
+   DEVICE *dev = jcr->dcr->dev;
    Dmsg0(20, "Enter dir_ask_sysop_to_mount_volume\n");
    if (jcr->VolumeName[0] == 0) {
-      return dir_ask_sysop_to_create_appendable_volume(jcr, dev);
+      return dir_ask_sysop_to_create_appendable_volume(jcr);
    }
    /* Close device so user can use autochanger if desired */
    if (dev_cap(dev, CAP_OFFLINEUNMOUNT)) {
@@ -2556,12 +2557,13 @@ int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
         jcr->VolumeName, dev_name(dev));
    }
    getchar();  
-   return 1;
+   return true;
 }
 
-int dir_ask_sysop_to_create_appendable_volume(JCR *jcr, DEVICE *dev)
+bool dir_ask_sysop_to_create_appendable_volume(JCR *jcr)
 {
    bool autochanger;
+   DEVICE *dev = jcr->dcr->dev;
    Dmsg0(20, "Enter dir_ask_sysop_to_create_appendable_volume\n");
    if (stop == 0) {
       set_volume_name("TestVolume1", 1);
@@ -2583,7 +2585,7 @@ int dir_ask_sysop_to_create_appendable_volume(JCR *jcr, DEVICE *dev)
    labelcmd();
    VolumeName = NULL;
    BlockNumber = 0;
-   return 1;
+   return true;
 }
 
 static bool my_mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
index b8ad504cbb643ebbef558285bcbc420bc280f67c..1500592bc78b88660935bfb34fb8565189fbd652 100644 (file)
 #ifndef __DEV_H
 #define __DEV_H 1
 
-#undef DCR                           /* used by Bacula */
+#undef DCR                            /* used by Bacula */
 
 /* #define NEW_LOCK 1 */
 
-#define new_lock_device(dev)            _new_lock_device(__FILE__, __LINE__, (dev)) 
+#define new_lock_device(dev)             _new_lock_device(__FILE__, __LINE__, (dev)) 
 #define new_lock_device_state(dev,state) _new_lock_device(__FILE__, __LINE__, (dev), (state))
-#define new_unlock_device(dev)          _new_unlock_device(__FILE__, __LINE__, (dev))
+#define new_unlock_device(dev)           _new_unlock_device(__FILE__, __LINE__, (dev))
 
 #define lock_device(d) _lock_device(__FILE__, __LINE__, (d))
 #define unlock_device(d) _unlock_device(__FILE__, __LINE__, (d))
@@ -52,105 +52,105 @@ enum {
 };
 
 /* Generic status bits returned from status_dev() */
-#define BMT_TAPE          (1<<0)     /* is tape device */
-#define BMT_EOF           (1<<1)     /* just read EOF */
-#define BMT_BOT           (1<<2)     /* at beginning of tape */
-#define BMT_EOT           (1<<3)     /* end of tape reached */
-#define BMT_SM            (1<<4)     /* DDS setmark */
-#define BMT_EOD           (1<<5)     /* DDS at end of data */
-#define BMT_WR_PROT       (1<<6)     /* tape write protected */
-#define BMT_ONLINE        (1<<7)     /* tape online */
-#define BMT_DR_OPEN       (1<<8)     /* tape door open */
-#define BMT_IM_REP_EN     (1<<9)     /* immediate report enabled */
+#define BMT_TAPE           (1<<0)     /* is tape device */
+#define BMT_EOF            (1<<1)     /* just read EOF */
+#define BMT_BOT            (1<<2)     /* at beginning of tape */
+#define BMT_EOT            (1<<3)     /* end of tape reached */
+#define BMT_SM             (1<<4)     /* DDS setmark */
+#define BMT_EOD            (1<<5)     /* DDS at end of data */
+#define BMT_WR_PROT        (1<<6)     /* tape write protected */
+#define BMT_ONLINE         (1<<7)     /* tape online */
+#define BMT_DR_OPEN        (1<<8)     /* tape door open */
+#define BMT_IM_REP_EN      (1<<9)     /* immediate report enabled */
 
 
 /* Test capabilities */
 #define dev_cap(dev, cap) ((dev)->capabilities & (cap))
 
 /* Bits for device capabilities */
-#define CAP_EOF           (1<<0)     /* has MTWEOF */
-#define CAP_BSR           (1<<1)     /* has MTBSR */
-#define CAP_BSF           (1<<2)     /* has MTBSF */
-#define CAP_FSR           (1<<3)     /* has MTFSR */
-#define CAP_FSF           (1<<4)     /* has MTFSF */
-#define CAP_EOM           (1<<5)     /* has MTEOM */
-#define CAP_REM           (1<<6)     /* is removable media */
-#define CAP_RACCESS       (1<<7)     /* is random access device */
-#define CAP_AUTOMOUNT     (1<<8)     /* Read device at start to see what is there */
-#define CAP_LABEL         (1<<9)     /* Label blank tapes */
-#define CAP_ANONVOLS      (1<<10)    /* Mount without knowing volume name */
-#define CAP_ALWAYSOPEN    (1<<11)    /* always keep device open */
+#define CAP_EOF            (1<<0)     /* has MTWEOF */
+#define CAP_BSR            (1<<1)     /* has MTBSR */
+#define CAP_BSF            (1<<2)     /* has MTBSF */
+#define CAP_FSR            (1<<3)     /* has MTFSR */
+#define CAP_FSF            (1<<4)     /* has MTFSF */
+#define CAP_EOM            (1<<5)     /* has MTEOM */
+#define CAP_REM            (1<<6)     /* is removable media */
+#define CAP_RACCESS        (1<<7)     /* is random access device */
+#define CAP_AUTOMOUNT      (1<<8)     /* Read device at start to see what is there */
+#define CAP_LABEL          (1<<9)     /* Label blank tapes */
+#define CAP_ANONVOLS       (1<<10)    /* Mount without knowing volume name */
+#define CAP_ALWAYSOPEN     (1<<11)    /* always keep device open */
 #define CAP_AUTOCHANGER    (1<<12)    /* AutoChanger */
 #define CAP_OFFLINEUNMOUNT (1<<13)    /* Offline before unmount */
-#define CAP_STREAM        (1<<14)    /* Stream device */
-#define CAP_BSFATEOM      (1<<15)    /* Backspace file at EOM */
-#define CAP_FASTFSF       (1<<16)    /* Fast forward space file */
-#define CAP_TWOEOF        (1<<17)    /* Write two eofs for EOM */
+#define CAP_STREAM         (1<<14)    /* Stream device */
+#define CAP_BSFATEOM       (1<<15)    /* Backspace file at EOM */
+#define CAP_FASTFSF        (1<<16)    /* Fast forward space file */
+#define CAP_TWOEOF         (1<<17)    /* Write two eofs for EOM */
 #define CAP_CLOSEONPOLL    (1<<18)    /* Close device on polling */
 
 /* Test state */
 #define dev_state(dev, st_state) ((dev)->state & (st_state))
 
 /* Device state bits */
-#define ST_OPENED         (1<<0)     /* set when device opened */
-#define ST_TAPE           (1<<1)     /* is a tape device */  
-#define ST_FILE           (1<<2)     /* is a file device */
-#define ST_FIFO           (1<<3)     /* is a fifo device */
-#define ST_PROG           (1<<4)     /* is a program device */
-#define ST_LABEL          (1<<5)     /* label found */
+#define ST_OPENED          (1<<0)     /* set when device opened */
+#define ST_TAPE            (1<<1)     /* is a tape device */  
+#define ST_FILE            (1<<2)     /* is a file device */
+#define ST_FIFO            (1<<3)     /* is a fifo device */
+#define ST_PROG            (1<<4)     /* is a program device */
+#define ST_LABEL           (1<<5)     /* label found */
 #define ST_MALLOC          (1<<6)     /* dev packet malloc'ed in init_dev() */
-#define ST_APPEND         (1<<7)     /* ready for Bacula append */
-#define ST_READ           (1<<8)     /* ready for Bacula read */
-#define ST_EOT            (1<<9)     /* at end of tape */
-#define ST_WEOT           (1<<10)    /* Got EOT on write */
-#define ST_EOF            (1<<11)    /* Read EOF i.e. zero bytes */
-#define ST_NEXTVOL        (1<<12)    /* Start writing on next volume */
-#define ST_SHORT          (1<<13)    /* Short block read */
+#define ST_APPEND          (1<<7)     /* ready for Bacula append */
+#define ST_READ            (1<<8)     /* ready for Bacula read */
+#define ST_EOT             (1<<9)     /* at end of tape */
+#define ST_WEOT            (1<<10)    /* Got EOT on write */
+#define ST_EOF             (1<<11)    /* Read EOF i.e. zero bytes */
+#define ST_NEXTVOL         (1<<12)    /* Start writing on next volume */
+#define ST_SHORT           (1<<13)    /* Short block read */
 
 /* dev_blocked states (mutually exclusive) */
 enum {
-   BST_NOT_BLOCKED = 0,              /* not blocked */
-   BST_UNMOUNTED,                    /* User unmounted device */
-   BST_WAITING_FOR_SYSOP,            /* Waiting for operator to mount tape */
-   BST_DOING_ACQUIRE,                /* Opening/validating/moving tape */
-   BST_WRITING_LABEL,                 /* Labeling a tape */  
+   BST_NOT_BLOCKED = 0,               /* not blocked */
+   BST_UNMOUNTED,                     /* User unmounted device */
+   BST_WAITING_FOR_SYSOP,             /* Waiting for operator to mount tape */
+   BST_DOING_ACQUIRE,                 /* Opening/validating/moving tape */
+   BST_WRITING_LABEL,                  /* Labeling a tape */  
    BST_UNMOUNTED_WAITING_FOR_SYSOP,    /* Closed by user during mount request */
-   BST_MOUNT                          /* Mount request */
+   BST_MOUNT                           /* Mount request */
 };
 
 /* Volume Catalog Information structure definition */
 struct VOLUME_CAT_INFO {
    /* Media info for the current Volume */
-   uint32_t VolCatJobs;              /* number of jobs on this Volume */
-   uint32_t VolCatFiles;             /* Number of files */
-   uint32_t VolCatBlocks;            /* Number of blocks */
-   uint64_t VolCatBytes;             /* Number of bytes written */
-   uint32_t VolCatMounts;            /* Number of mounts this volume */
-   uint32_t VolCatErrors;            /* Number of errors this volume */
-   uint32_t VolCatWrites;            /* Number of writes this volume */
-   uint32_t VolCatReads;             /* Number of reads this volume */
-   uint64_t VolCatRBytes;            /* Number of bytes read */
-   uint32_t VolCatRecycles;          /* Number of recycles this volume */
-   int32_t  Slot;                    /* Slot in changer */
-   bool     InChanger;               /* Set if vol in current magazine */
-   uint32_t VolCatMaxJobs;           /* Maximum Jobs to write to volume */
-   uint32_t VolCatMaxFiles;          /* Maximum files to write to volume */
-   uint64_t VolCatMaxBytes;          /* Max bytes to write to volume */
+   uint32_t VolCatJobs;               /* number of jobs on this Volume */
+   uint32_t VolCatFiles;              /* Number of files */
+   uint32_t VolCatBlocks;             /* Number of blocks */
+   uint64_t VolCatBytes;              /* Number of bytes written */
+   uint32_t VolCatMounts;             /* Number of mounts this volume */
+   uint32_t VolCatErrors;             /* Number of errors this volume */
+   uint32_t VolCatWrites;             /* Number of writes this volume */
+   uint32_t VolCatReads;              /* Number of reads this volume */
+   uint64_t VolCatRBytes;             /* Number of bytes read */
+   uint32_t VolCatRecycles;           /* Number of recycles this volume */
+   int32_t  Slot;                     /* Slot in changer */
+   bool     InChanger;                /* Set if vol in current magazine */
+   uint32_t VolCatMaxJobs;            /* Maximum Jobs to write to volume */
+   uint32_t VolCatMaxFiles;           /* Maximum files to write to volume */
+   uint64_t VolCatMaxBytes;           /* Max bytes to write to volume */
    uint64_t VolCatCapacityBytes;      /* capacity estimate */
-   uint64_t VolReadTime;             /* time spent reading */
-   uint64_t VolWriteTime;            /* time spent writing this Volume */
-   char VolCatStatus[20];            /* Volume status */
+   uint64_t VolReadTime;              /* time spent reading */
+   uint64_t VolWriteTime;             /* time spent writing this Volume */
+   char VolCatStatus[20];             /* Volume status */
    char VolCatName[MAX_NAME_LENGTH];  /* Desired volume to mount */
-};               
+};                
 
 
 typedef struct s_steal_lock {
-   pthread_t  no_wait_id;            /* id of no wait thread */
-   int       dev_blocked;            /* state */
-   int       dev_prev_blocked;       /* previous blocked state */
+   pthread_t  no_wait_id;             /* id of no wait thread */
+   int        dev_blocked;            /* state */
+   int        dev_prev_blocked;       /* previous blocked state */
 } bsteal_lock_t;
 
-struct DEVRES;                       /* Device resource defined in stored_conf.h */
+struct DEVRES;                        /* Device resource defined in stored_conf.h */
 
 /*
  * Device structure definition. There is one of these for
@@ -159,54 +159,54 @@ struct DEVRES;                          /* Device resource defined in stored_conf.h */
  */
 struct DEVICE {
 public:
-   DEVICE *next;                     /* pointer to next open device */
-   DEVICE *prev;                     /* pointer to prev open device */
-   JCR *attached_jcrs;               /* attached JCR list */
-   dlist *attached_dcrs;             /* attached DCR list */
-   pthread_mutex_t mutex;            /* access control */
+   DEVICE *next;                      /* pointer to next open device */
+   DEVICE *prev;                      /* pointer to prev open device */
+   JCR *attached_jcrs;                /* attached JCR list */
+   dlist *attached_dcrs;              /* attached DCR list */
+   pthread_mutex_t mutex;             /* access control */
    pthread_mutex_t spool_mutex;       /* mutex for updating spool_size */
-   pthread_cond_t wait;              /* thread wait variable */
+   pthread_cond_t wait;               /* thread wait variable */
    pthread_cond_t wait_next_vol;      /* wait for tape to be mounted */
-   pthread_t no_wait_id;             /* this thread must not wait */
-   int dev_blocked;                  /* set if we must wait (i.e. change tape) */
-   int dev_prev_blocked;             /* previous blocked state */
-   int num_waiting;                  /* number of threads waiting */
-   int num_writers;                  /* number of writing threads */
-   int use_count;                    /* usage count on this device */
-   int fd;                           /* file descriptor */
-   int capabilities;                 /* capabilities mask */
-   int state;                        /* state mask */
-   int dev_errno;                    /* Our own errno */
-   int mode;                         /* read/write modes */
-   uint32_t drive_index;             /* Autochanger drive index */
-   POOLMEM *dev_name;                /* device name */
-   char *errmsg;                     /* nicely edited error message */
-   uint32_t block_num;               /* current block number base 0 */
-   uint32_t file;                    /* current file number base 0 */
-   uint64_t file_addr;               /* Current file read/write address */
-   uint64_t file_size;               /* Current file size */
-   uint32_t EndBlock;                /* last block written */
-   uint32_t EndFile;                 /* last file written */
-   uint32_t min_block_size;          /* min block size */
-   uint32_t max_block_size;          /* max block size */
-   uint64_t max_volume_size;         /* max bytes to put on one volume */
-   uint64_t max_file_size;           /* max file size to put in one file on volume */
-   uint64_t volume_capacity;         /* advisory capacity */
-   uint64_t max_spool_size;          /* maximum spool file size */
-   uint64_t spool_size;              /* curren spool size */
-   uint32_t max_rewind_wait;         /* max secs to allow for rewind */
-   uint32_t max_open_wait;           /* max secs to allow for open */
-   uint32_t max_open_vols;           /* max simultaneous open volumes */
-   utime_t  vol_poll_interval;       /* interval between polling Vol mount */
-   DEVRES *device;                   /* pointer to Device Resource */
-   btimer_t *tid;                    /* timer id */
+   pthread_t no_wait_id;              /* this thread must not wait */
+   int dev_blocked;                   /* set if we must wait (i.e. change tape) */
+   int dev_prev_blocked;              /* previous blocked state */
+   int num_waiting;                   /* number of threads waiting */
+   int num_writers;                   /* number of writing threads */
+   int use_count;                     /* usage count on this device */
+   int fd;                            /* file descriptor */
+   int capabilities;                  /* capabilities mask */
+   int state;                         /* state mask */
+   int dev_errno;                     /* Our own errno */
+   int mode;                          /* read/write modes */
+   uint32_t drive_index;              /* Autochanger drive index */
+   POOLMEM *dev_name;                 /* device name */
+   char *errmsg;                      /* nicely edited error message */
+   uint32_t block_num;                /* current block number base 0 */
+   uint32_t file;                     /* current file number base 0 */
+   uint64_t file_addr;                /* Current file read/write address */
+   uint64_t file_size;                /* Current file size */
+   uint32_t EndBlock;                 /* last block written */
+   uint32_t EndFile;                  /* last file written */
+   uint32_t min_block_size;           /* min block size */
+   uint32_t max_block_size;           /* max block size */
+   uint64_t max_volume_size;          /* max bytes to put on one volume */
+   uint64_t max_file_size;            /* max file size to put in one file on volume */
+   uint64_t volume_capacity;          /* advisory capacity */
+   uint64_t max_spool_size;           /* maximum spool file size */
+   uint64_t spool_size;               /* curren spool size */
+   uint32_t max_rewind_wait;          /* max secs to allow for rewind */
+   uint32_t max_open_wait;            /* max secs to allow for open */
+   uint32_t max_open_vols;            /* max simultaneous open volumes */
+   utime_t  vol_poll_interval;        /* interval between polling Vol mount */
+   DEVRES *device;                    /* pointer to Device Resource */
+   btimer_t *tid;                     /* timer id */
 
-   VOLUME_CAT_INFO VolCatInfo;       /* Volume Catalog Information */
-   VOLUME_LABEL VolHdr;              /* Actual volume label */
+   VOLUME_CAT_INFO VolCatInfo;        /* Volume Catalog Information */
+   VOLUME_LABEL VolHdr;               /* Actual volume label */
    
    /* Device wait times ***FIXME*** look at durations */
    char BadVolName[MAX_NAME_LENGTH];  /* Last wrong Volume mounted */
-   bool poll;                        /* set to poll Volume */
+   bool poll;                         /* set to poll Volume */
    int min_wait;
    int max_wait;
    int max_num_wait;
@@ -216,35 +216,35 @@ public:
 };
 
 /*
- * Device Context (or Control) Record. 
- *  There is one of these records for each Job that is using   
+ * Device Context (or Control) Record.  
+ *  There is one of these records for each Job that is using    
  *  the device. Items in this record are "local" to the Job and
  *  do not affect other Jobs.
  */
 struct DCR {
-   dlink dev_link;                   /* link to attach to dev */
-   JCR *jcr;                         /* pointer to JCR */
-   DEVICE *dev;                      /* pointer to device */
-   DEV_BLOCK *block;                 /* pointer to block */
-   DEV_RECORD *rec;                  /* pointer to record */
-   bool spool_data;                  /* set to spool data */
-   bool spooling;                    /* set when actually spooling */
-   bool dev_locked;                  /* set if dev already locked */
-   int spool_fd;                     /* fd if spooling */
-   bool NewVol;                      /* set if new Volume mounted */
-   bool WroteVol;                    /* set if Volume written */
-   bool NewFile;                     /* set when EOF written */
-   uint32_t VolFirstIndex;           /* First file index this Volume */
-   uint32_t VolLastIndex;            /* Last file index this Volume */
-   uint32_t FileIndex;               /* Current File Index */
-   uint32_t EndFile;                 /* End file written */
-   uint32_t StartFile;               /* Start write file */
-   uint32_t StartBlock;              /* Start write block */
-   uint32_t EndBlock;                /* Ending block written */
-   int64_t spool_size;               /* Current spool size */
-   int64_t max_spool_size;           /* Max job spool size */
+   dlink dev_link;                    /* link to attach to dev */
+   JCR *jcr;                          /* pointer to JCR */
+   DEVICE *dev;                       /* pointer to device */
+   DEV_BLOCK *block;                  /* pointer to block */
+   DEV_RECORD *rec;                   /* pointer to record */
+   int spool_fd;                      /* fd if spooling */
+   bool spool_data;                   /* set to spool data */
+   bool spooling;                     /* set when actually spooling */
+   bool dev_locked;                   /* set if dev already locked */
+   bool NewVol;                       /* set if new Volume mounted */
+   bool WroteVol;                     /* set if Volume written */
+   bool NewFile;                      /* set when EOF written */
+   uint32_t VolFirstIndex;            /* First file index this Volume */
+   uint32_t VolLastIndex;             /* Last file index this Volume */
+   uint32_t FileIndex;                /* Current File Index */
+   uint32_t EndFile;                  /* End file written */
+   uint32_t StartFile;                /* Start write file */
+   uint32_t StartBlock;               /* Start write block */
+   uint32_t EndBlock;                 /* Ending block written */
+   int64_t spool_size;                /* Current spool size */
+   int64_t max_spool_size;            /* Max job spool size */
    char VolumeName[MAX_NAME_LENGTH];  /* Volume name */
-   VOLUME_CAT_INFO VolCatInfo;       /* Catalog info for desired volume */
+   VOLUME_CAT_INFO VolCatInfo;        /* Catalog info for desired volume */
 };
 
 
@@ -253,7 +253,7 @@ struct DCR {
  *  dependent. Arrgggg!
  */
 #ifndef MTEOM
-#ifdef MTSEOD
+#ifdef  MTSEOD
 #define MTEOM MTSEOD
 #endif
 #ifdef MTEOD
index fefda7ab2f1b114f09a5b15676f443a96e4e4cc8..555118c89fca8d1d2609414f98042fefe42f9698 100644 (file)
@@ -113,7 +113,7 @@ bool fixup_device_block_write_error(DCR *dcr, DEV_BLOCK *block)
       dev->VolCatInfo.VolCatStatus, dev->VolCatInfo.VolCatName);
    dev->VolCatInfo.VolCatFiles = dev->file;   /* set number of files */
    dev->VolCatInfo.VolCatJobs++;             /* increment number of jobs */
-   if (!dir_update_volume_info(jcr, dev, 0)) {   /* send Volume info to Director */
+   if (!dir_update_volume_info(jcr, false)) {   /* send Volume info to Director */
       P(dev->mutex);
       unblock_device(dev);
       return false;               /* device locked */
index 40b23cc0ffe6d75a79648c0076bf2a254d40e26d..17e94d8bf5e109c82d8d1301ff55f820761c4fdf 100644 (file)
@@ -11,7 +11,7 @@
  * 
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index fc8c882b2b2b73d6dce798dddfcf6b1f834f111b..5f87dbd429e2586a7ebaacedf04433cbe89b671d 100644 (file)
@@ -5,7 +5,7 @@
  *
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index 7bf6c8f02ec362c67a8cf770bca400132dc5fd52..354fb6fa5229a9c202a53d0d1b1bc05a63c57e82 100644 (file)
@@ -8,7 +8,7 @@
  *   Version $Id$
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -751,73 +751,82 @@ void dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose)
    dbl = debug_level;
    debug_level = 1;
    switch (rec->FileIndex) {
+   case PRE_LABEL:
+      type = _("Fresh Volume");   
+      break;
+   case VOL_LABEL:
+      type = _("Volume");
+      break;
+   case SOS_LABEL:
+      type = _("Begin Job Session");
+      break;
+   case EOS_LABEL:
+      type = _("End Job Session");
+      break;
+   case EOM_LABEL:
+      type = _("End of Media");
+      break;
+   case EOT_LABEL:
+      type = ("End of Tape");
+      break;
+   default:
+      type = _("Unknown");
+      break;
+   }
+   if (verbose) {
+      switch (rec->FileIndex) {
       case PRE_LABEL:
-         type = _("Fresh Volume");   
-        break;
       case VOL_LABEL:
-         type = _("Volume");
+        unser_volume_label(dev, rec);
+        dump_volume_label(dev);
         break;
       case SOS_LABEL:
-         type = _("Begin Session");
+        dump_session_label(rec, type);
         break;
       case EOS_LABEL:
-         type = _("End Session");
+        dump_session_label(rec, type);
         break;
       case EOM_LABEL:
-         type = _("End of Media");
+         Pmsg5(-1, "%s Record: SessId=%d SessTime=%d JobId=%d DataLen=%d\n",
+           type, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len);
         break;
       case EOT_LABEL:
-         type = ("End of Tape");
+         Pmsg0(-1, _("End of physical tape.\n"));
         break;
       default:
-         type = _("Unknown");
+         Pmsg5(-1, "%s Record: SessId=%d SessTime=%d JobId=%d DataLen=%d\n",
+           type, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len);
         break;
-   }
-   if (verbose) {
-      switch (rec->FileIndex) {
-        case PRE_LABEL:
-        case VOL_LABEL:
-           unser_volume_label(dev, rec);
-           dump_volume_label(dev);
-           break;
-        case SOS_LABEL:
-           dump_session_label(rec, type);
-           break;
-        case EOS_LABEL:
-           dump_session_label(rec, type);
-           break;
-        case EOM_LABEL:
-            Pmsg5(-1, "%s Record: SessId=%d SessTime=%d JobId=%d DataLen=%d\n",
-              type, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len);
-           break;
-        case EOT_LABEL:
-            Pmsg0(-1, _("End of physical tape.\n"));
-           break;
-        default:
-            Pmsg5(-1, "%s Record: SessId=%d SessTime=%d JobId=%d DataLen=%d\n",
-              type, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len);
-           break;
       }
    } else {
+      SESSION_LABEL label;
       switch (rec->FileIndex) {
-        case SOS_LABEL:
-        case EOS_LABEL:
-           SESSION_LABEL label;
-           unser_session_label(&label, rec);
-            Pmsg6(-1, "%s Record: SessId=%d SessTime=%d JobId=%d Level=%c \
-Type=%c\n",
-              type, rec->VolSessionId, rec->VolSessionTime, rec->Stream, 
-              label.JobLevel, label.JobType);
-           break;
-        case EOM_LABEL:
-        case PRE_LABEL:
-        case VOL_LABEL:
-        default:
-            Pmsg5(-1, "%s Record: SessId=%d SessTime=%d JobId=%d DataLen=%d\n",
-        type, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len);
-           break;
-        case EOT_LABEL:
-           break;
+      case SOS_LABEL:
+        unser_session_label(&label, rec);
+         Pmsg6(-1, "%s Record: SessId=%d SessTime=%d JobId=%d Level=%c Type=%c\n",
+           type, rec->VolSessionId, rec->VolSessionTime, rec->Stream, 
+           label.JobLevel, label.JobType);
+        break;
+      case EOS_LABEL:
+        char ed1[30], ed2[30];
+        unser_session_label(&label, rec);
+         Pmsg6(-1, "%s Record: SessId=%d SessTime=%d JobId=%d Level=%c Type=%c\n",
+           type, rec->VolSessionId, rec->VolSessionTime, rec->Stream, 
+           label.JobLevel, label.JobType);
+         Pmsg4(-1, "   Files=%s Bytes=%s Errors=%d Status=%c\n",
+           edit_uint64_with_commas(label.JobFiles, ed1),
+           edit_uint64_with_commas(label.JobBytes, ed2),
+           label.JobErrors, (char)label.JobStatus);
+        break;
+      case EOM_LABEL:
+      case PRE_LABEL:
+      case VOL_LABEL:
+      default:
+         Pmsg5(-1, "%s Record: SessId=%d SessTime=%d JobId=%d DataLen=%d\n",
+      type, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len);
+        break;
+      case EOT_LABEL:
+        break;
       }
    }
    debug_level = dbl;
index 79a5d78bccab3c5264ae65bf016a9f7e136df088..89da956f0b7d76444c2561b380d3c7292b2cfb93 100755 (executable)
@@ -8,7 +8,7 @@
  */
 
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index ccfc68c34062b2781ca5e45e34003c1b749612c9..a8aaad7deea7d37f98bbcf223d09995f7488ce3f 100644 (file)
@@ -65,7 +65,7 @@ mount_next_vol:
    if (!dev->poll && retry++ > 4) {
       /* Last ditch effort before giving up, force operator to respond */
       jcr->VolCatInfo.Slot = 0;
-      if (!dir_ask_sysop_to_mount_volume(jcr, dev)) {
+      if (!dir_ask_sysop_to_mount_volume(jcr)) {
          Jmsg(jcr, M_FATAL, 0, _("Too many errors trying to mount device %s.\n"), 
              dev_name(dev));
         return false;
@@ -89,7 +89,7 @@ mount_next_vol:
    Dmsg0(200, "Before dir_find_next_appendable_volume.\n");
    while (!dir_find_next_appendable_volume(jcr)) {
        Dmsg0(200, "not dir_find_next\n");
-       if (!dir_ask_sysop_to_create_appendable_volume(jcr, dev)) {
+       if (!dir_ask_sysop_to_create_appendable_volume(jcr)) {
         return false;
        }
        Dmsg0(200, "Again dir_find_next_append...\n");
@@ -139,7 +139,7 @@ mount_next_vol:
    Dmsg2(100, "Ask=%d autochanger=%d\n", ask, autochanger);
    release = true;                /* release next time if we "recurse" */
 
-   if (ask && !dir_ask_sysop_to_mount_volume(jcr, dev)) {
+   if (ask && !dir_ask_sysop_to_mount_volume(jcr)) {
       Dmsg0(100, "Error return ask_sysop ...\n");
       return false;         /* error return */
    }
@@ -258,7 +258,7 @@ read_volume:
          Dmsg0(100, "dir_update_vol_info. Set Append\n");
          /* Copy Director's info into the device info */
         memcpy(&dev->VolCatInfo, &jcr->VolCatInfo, sizeof(dev->VolCatInfo));
-        dir_update_volume_info(jcr, dev, 1);  /* indicate tape labeled */
+        dir_update_volume_info(jcr, true);  /* indicate tape labeled */
          Jmsg(jcr, M_INFO, 0, _("Labeled new Volume \"%s\" on device %s.\n"),
            jcr->VolumeName, dev_name(dev));
         goto read_volume;      /* read label we just wrote */
@@ -334,7 +334,7 @@ The number of files mismatch! Volume=%u Catalog=%u\n"),
       }
       dev->VolCatInfo.VolCatMounts++;     /* Update mounts */
       Dmsg1(100, "update volinfo mounts=%d\n", dev->VolCatInfo.VolCatMounts);
-      dir_update_volume_info(jcr, dev, 0);
+      dir_update_volume_info(jcr, false);
       /* Return an empty block */
       empty_block(block);            /* we used it for reading so set for write */
    }
@@ -396,7 +396,7 @@ static bool rewrite_volume_label(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, bool r
    }
    Dmsg0(100, "dir_update_vol_info. Set Append\n");
    bstrncpy(dev->VolCatInfo.VolCatStatus, "Append", sizeof(dev->VolCatInfo.VolCatStatus));
-   dir_update_volume_info(jcr, dev, 1);  /* indicate doing relabel */
+   dir_update_volume_info(jcr, true);  /* indicate doing relabel */
    if (recycle) {
       Jmsg(jcr, M_INFO, 0, _("Recycled volume \"%s\" on device \"%s\", all previous data lost.\n"),
         jcr->VolumeName, dev_name(dev));
@@ -421,7 +421,7 @@ void mark_volume_in_error(JCR *jcr, DEVICE *dev)
        jcr->VolumeName);
    bstrncpy(dev->VolCatInfo.VolCatStatus, "Error", sizeof(dev->VolCatInfo.VolCatStatus));
    Dmsg0(100, "dir_update_vol_info. Set Error.\n");
-   dir_update_volume_info(jcr, dev, 0);
+   dir_update_volume_info(jcr, false);
 }
 
 /* 
index e2fcf89e806b5268e25bfe0c29a85c2dde2ddbbe..fbd933f6de7d9eb21148825db388e892d19c6b28 100644 (file)
 uint32_t new_VolSessionId();
 
 /* From acquire.c */
-DCR    *acquire_device_for_append(JCR *jcr);
-DCR    *acquire_device_for_read(JCR *jcr);
-int     release_device(JCR *jcr);
-DCR    *new_dcr(JCR *jcr, DEVICE *dev);
-void    free_dcr(DCR *dcr);
+DCR     *acquire_device_for_append(JCR *jcr);
+DCR     *acquire_device_for_read(JCR *jcr);
+bool     release_device(JCR *jcr);
+DCR     *new_dcr(JCR *jcr, DEVICE *dev);
+void     free_dcr(DCR *dcr);
 
 /* From askdir.c */
 enum get_vol_info_rw {
    GET_VOL_INFO_FOR_WRITE,
    GET_VOL_INFO_FOR_READ
 };
-int    dir_get_volume_info(JCR *jcr, enum get_vol_info_rw);
-int    dir_find_next_appendable_volume(JCR *jcr);
-int    dir_update_volume_info(JCR *jcr, DEVICE *dev, int label);
-int    dir_ask_sysop_to_create_appendable_volume(JCR *jcr, DEVICE *dev);
-int    dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev);
-int    dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec);
-int    dir_send_job_status(JCR *jcr);
-int    dir_create_jobmedia_record(JCR *jcr);
+bool    dir_get_volume_info(JCR *jcr, enum get_vol_info_rw);
+bool    dir_find_next_appendable_volume(JCR *jcr);
+bool    dir_update_volume_info(JCR *jcr, bool label);
+bool    dir_ask_sysop_to_create_appendable_volume(JCR *jcr);
+bool    dir_ask_sysop_to_mount_volume(JCR *jcr);
+bool    dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec);
+bool    dir_send_job_status(JCR *jcr);
+bool    dir_create_jobmedia_record(JCR *jcr);
 
 /* authenticate.c */
-int    authenticate_director(JCR *jcr);
-int    authenticate_filed(JCR *jcr);
+int     authenticate_director(JCR *jcr);
+int     authenticate_filed(JCR *jcr);
 
 /* From block.c */
-void   dump_block(DEV_BLOCK *b, const char *msg);
+void    dump_block(DEV_BLOCK *b, const char *msg);
 DEV_BLOCK *new_block(DEVICE *dev);
 DEV_BLOCK *dup_block(DEV_BLOCK *eblock);
-void   init_block_write(DEV_BLOCK *block);
-void   empty_block(DEV_BLOCK *block);
-void   free_block(DEV_BLOCK *block);
-int    write_block_to_device(DCR *dcr, DEV_BLOCK *block);
-bool   write_block_to_dev(DCR *dcr, DEV_BLOCK *block);
-void   print_block_read_errors(JCR *jcr, DEV_BLOCK *block);
-void   ser_block_header(DEV_BLOCK *block);
+void    init_block_write(DEV_BLOCK *block);
+void    empty_block(DEV_BLOCK *block);
+void    free_block(DEV_BLOCK *block);
+bool    write_block_to_device(DCR *dcr, DEV_BLOCK *block);
+bool    write_block_to_dev(DCR *dcr, DEV_BLOCK *block);
+void    print_block_read_errors(JCR *jcr, DEV_BLOCK *block);
+void    ser_block_header(DEV_BLOCK *block);
 
 #define CHECK_BLOCK_NUMBERS    true
 #define NO_BLOCK_NUMBER_CHECK  false
-int    read_block_from_device(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, bool check_block_numbers);
-int    read_block_from_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, bool check_block_numbers);
+int     read_block_from_device(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, bool check_block_numbers);
+int     read_block_from_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, bool check_block_numbers);
 
 /* From butil.c -- utilities for SD tool programs */
-void   print_ls_output(const char *fname, const char *link, int type, struct stat *statp);
+void    print_ls_output(const char *fname, const char *link, int type, struct stat *statp);
 JCR    *setup_jcr(const char *name, const char * device, BSR *bsr, const char *VolumeName);
 DEVICE *setup_to_access_device(JCR *jcr, int read_access);
-void   display_tape_error_status(JCR *jcr, DEVICE *dev);
+void    display_tape_error_status(JCR *jcr, DEVICE *dev);
 DEVRES *find_device_res(char *device_name, int read_access);
 
 
 /* From dev.c */
-DEVICE *init_dev(DEVICE *dev, DEVRES *device);
-int     open_dev(DEVICE *dev, char *VolName, int mode);
-void    close_dev(DEVICE *dev);
-void    force_close_dev(DEVICE *dev);
-int     truncate_dev(DEVICE *dev);
-void    term_dev(DEVICE *dev);
-char *  strerror_dev(DEVICE *dev);
-void    clrerror_dev(DEVICE *dev, int func);
-int     update_pos_dev(DEVICE *dev);
-int     rewind_dev(DEVICE *dev);
-int     load_dev(DEVICE *dev);
-int     offline_dev(DEVICE *dev);
-int     flush_dev(DEVICE *dev);
-int     weof_dev(DEVICE *dev, int num);
-int     write_block(DEVICE *dev);
-int     write_dev(DEVICE *dev, char *buf, size_t len);
-int     read_dev(DEVICE *dev, char *buf, size_t len);
+DEVICE  *init_dev(DEVICE *dev, DEVRES *device);
+int      open_dev(DEVICE *dev, char *VolName, int mode);
+void     close_dev(DEVICE *dev);
+void     force_close_dev(DEVICE *dev);
+int      truncate_dev(DEVICE *dev);
+void     term_dev(DEVICE *dev);
+char *   strerror_dev(DEVICE *dev);
+void     clrerror_dev(DEVICE *dev, int func);
+int      update_pos_dev(DEVICE *dev);
+int      rewind_dev(DEVICE *dev);
+int      load_dev(DEVICE *dev);
+int      offline_dev(DEVICE *dev);
+int      flush_dev(DEVICE *dev);
+int      weof_dev(DEVICE *dev, int num);
+int      write_block(DEVICE *dev);
+int      write_dev(DEVICE *dev, char *buf, size_t len);
+int      read_dev(DEVICE *dev, char *buf, size_t len);
 uint32_t status_dev(DEVICE *dev);
-int     eod_dev(DEVICE *dev);
-int     fsf_dev(DEVICE *dev, int num);
-int     fsr_dev(DEVICE *dev, int num);
-int     bsf_dev(DEVICE *dev, int num);
-int     bsr_dev(DEVICE *dev, int num);
-void    attach_jcr_to_device(DEVICE *dev, JCR *jcr);
-void    detach_jcr_from_device(DEVICE *dev, JCR *jcr);
-JCR    *next_attached_jcr(DEVICE *dev, JCR *jcr);
-int     dev_can_write(DEVICE *dev);
-int     offline_or_rewind_dev(DEVICE *dev);
-int     reposition_dev(DEVICE *dev, uint32_t file, uint32_t block);
-void    init_dev_wait_timers(DEVICE *dev);
-bool    double_dev_wait_time(DEVICE *dev);
+int      eod_dev(DEVICE *dev);
+int      fsf_dev(DEVICE *dev, int num);
+int      fsr_dev(DEVICE *dev, int num);
+int      bsf_dev(DEVICE *dev, int num);
+int      bsr_dev(DEVICE *dev, int num);
+void     attach_jcr_to_device(DEVICE *dev, JCR *jcr);
+void     detach_jcr_from_device(DEVICE *dev, JCR *jcr);
+JCR     *next_attached_jcr(DEVICE *dev, JCR *jcr);
+int      dev_can_write(DEVICE *dev);
+int      offline_or_rewind_dev(DEVICE *dev);
+int      reposition_dev(DEVICE *dev, uint32_t file, uint32_t block);
+void     init_dev_wait_timers(DEVICE *dev);
+bool     double_dev_wait_time(DEVICE *dev);
 
 
 /* Get info about device */
-char *  dev_name(DEVICE *dev);
-char *  dev_vol_name(DEVICE *dev);
+char *   dev_name(DEVICE *dev);
+char *   dev_vol_name(DEVICE *dev);
 uint32_t dev_block(DEVICE *dev);
 uint32_t dev_file(DEVICE *dev);
-int     dev_is_tape(DEVICE *dev);
+int      dev_is_tape(DEVICE *dev);
 
 /* From device.c */
-int     open_device(JCR *jcr, DEVICE *dev);
-int     first_open_device(DEVICE *dev);
-bool    fixup_device_block_write_error(DCR *dcr, DEV_BLOCK *block);
-void    _lock_device(const char *file, int line, DEVICE *dev);
-void    _unlock_device(const char *file, int line, DEVICE *dev);
-void    _block_device(const char *file, int line, DEVICE *dev, int state);
-void    _unblock_device(const char *file, int line, DEVICE *dev);
-void    _steal_device_lock(const char *file, int line, DEVICE *dev, bsteal_lock_t *hold, int state);
-void    _give_back_device_lock(const char *file, int line, DEVICE *dev, bsteal_lock_t *hold);
-void    set_new_volume_parameters(JCR *jcr, DEVICE *dev);
-void    set_new_file_parameters(JCR *jcr, DEVICE *dev); 
-int     device_is_unmounted(DEVICE *dev);
+int      open_device(JCR *jcr, DEVICE *dev);
+int      first_open_device(DEVICE *dev);
+bool     fixup_device_block_write_error(DCR *dcr, DEV_BLOCK *block);
+void     _lock_device(const char *file, int line, DEVICE *dev);
+void     _unlock_device(const char *file, int line, DEVICE *dev);
+void     _block_device(const char *file, int line, DEVICE *dev, int state);
+void     _unblock_device(const char *file, int line, DEVICE *dev);
+void     _steal_device_lock(const char *file, int line, DEVICE *dev, bsteal_lock_t *hold, int state);
+void     _give_back_device_lock(const char *file, int line, DEVICE *dev, bsteal_lock_t *hold);
+void     set_new_volume_parameters(JCR *jcr, DEVICE *dev);
+void     set_new_file_parameters(JCR *jcr, DEVICE *dev); 
+int      device_is_unmounted(DEVICE *dev);
 
 /* From dircmd.c */
-void    *handle_connection_request(void *arg); 
+void     *handle_connection_request(void *arg); 
 
 
 /* From fd_cmds.c */
-void    run_job(JCR *jcr);
+void     run_job(JCR *jcr);
 
 /* From job.c */
-void    stored_free_jcr(JCR *jcr);
-void    connection_from_filed(void *arg);     
-void    handle_filed_connection(BSOCK *fd, char *job_name);
+void     stored_free_jcr(JCR *jcr);
+void     connection_from_filed(void *arg);     
+void     handle_filed_connection(BSOCK *fd, char *job_name);
 
 /* From label.c */
-int     read_dev_volume_label(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
-void    create_session_label(JCR *jcr, DEV_RECORD *rec, int label);
-void    create_volume_label(DEVICE *dev, const char *VolName, const char *PoolName);
-bool    write_new_volume_label_to_dev(JCR *jcr, DEVICE *dev, const char *VolName, const char *PoolName);
-bool    write_session_label(JCR *jcr, DEV_BLOCK *block, int label);
-bool    write_volume_label_to_block(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
-void    dump_volume_label(DEVICE *dev);
-void    dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose);
-int     unser_volume_label(DEVICE *dev, DEV_RECORD *rec);
-int     unser_session_label(SESSION_LABEL *label, DEV_RECORD *rec);
+int      read_dev_volume_label(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
+void     create_session_label(JCR *jcr, DEV_RECORD *rec, int label);
+void     create_volume_label(DEVICE *dev, const char *VolName, const char *PoolName);
+bool     write_new_volume_label_to_dev(JCR *jcr, DEVICE *dev, const char *VolName, const char *PoolName);
+bool     write_session_label(JCR *jcr, DEV_BLOCK *block, int label);
+bool     write_volume_label_to_block(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
+void     dump_volume_label(DEVICE *dev);
+void     dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose);
+int      unser_volume_label(DEVICE *dev, DEV_RECORD *rec);
+int      unser_session_label(SESSION_LABEL *label, DEV_RECORD *rec);
 
 /* From match_bsr.c */
-int     match_bsr(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, 
-             SESSION_LABEL *sesrec);
-int     match_bsr_block(BSR *bsr, DEV_BLOCK *block);
-void    position_bsr_block(BSR *bsr, DEV_BLOCK *block);
-BSR    *find_next_bsr(BSR *root_bsr, DEVICE *dev);
-bool    match_set_eof(BSR *bsr, DEV_RECORD *rec);
+int      match_bsr(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, 
+              SESSION_LABEL *sesrec);
+int      match_bsr_block(BSR *bsr, DEV_BLOCK *block);
+void     position_bsr_block(BSR *bsr, DEV_BLOCK *block);
+BSR     *find_next_bsr(BSR *root_bsr, DEVICE *dev);
+bool     match_set_eof(BSR *bsr, DEV_RECORD *rec);
 
 /* From mount.c */
-bool    mount_next_write_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, bool release);
-bool    mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
-void    release_volume(JCR *jcr, DEVICE *dev);
-void    mark_volume_in_error(JCR *jcr, DEVICE *dev);
+bool     mount_next_write_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, bool release);
+bool     mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
+void     release_volume(JCR *jcr, DEVICE *dev);
+void     mark_volume_in_error(JCR *jcr, DEVICE *dev);
 
 /* From autochanger.c */
-int     autoload_device(JCR *jcr, DEVICE *dev, int writing, BSOCK *dir);
-int     autochanger_list(JCR *jcr, DEVICE *dev, BSOCK *dir);
-void    invalidate_slot_in_catalog(JCR *jcr, DEVICE *dev);
+int      autoload_device(JCR *jcr, DEVICE *dev, int writing, BSOCK *dir);
+int      autochanger_list(JCR *jcr, DEVICE *dev, BSOCK *dir);
+void     invalidate_slot_in_catalog(JCR *jcr, DEVICE *dev);
 
 
 /* From parse_bsr.c */
-BSR    *parse_bsr(JCR *jcr, char *lf);
-void    dump_bsr(BSR *bsr, bool recurse);
-void    free_bsr(BSR *bsr);
+BSR     *parse_bsr(JCR *jcr, char *lf);
+void     dump_bsr(BSR *bsr, bool recurse);
+void     free_bsr(BSR *bsr);
 VOL_LIST *new_vol();
-int     add_vol(JCR *jcr, VOL_LIST *vol);
-void    free_vol_list(JCR *jcr);
-void    create_vol_list(JCR *jcr);
+int      add_vol(JCR *jcr, VOL_LIST *vol);
+void     free_vol_list(JCR *jcr);
+void     create_vol_list(JCR *jcr);
 
 /* From record.c */
 const char *FI_to_ascii(int fi);
 const char *stream_to_ascii(int stream, int fi);
-int     write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec);
-int     can_write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec);
-int     read_record_from_block(DEV_BLOCK *block, DEV_RECORD *rec); 
+int      write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec);
+int      can_write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec);
+int      read_record_from_block(DEV_BLOCK *block, DEV_RECORD *rec); 
 DEV_RECORD *new_record();
-void    free_record(DEV_RECORD *rec);
+void     free_record(DEV_RECORD *rec);
 
 /* From read_record.c */
 bool read_records(JCR *jcr,  DEVICE *dev, 
@@ -200,12 +200,12 @@ bool read_records(JCR *jcr,  DEVICE *dev,
        bool mount_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block));
 
 /* From spool.c */
-bool   begin_data_spool          (JCR *jcr);
-bool   discard_data_spool        (JCR *jcr);
-bool   commit_data_spool         (JCR *jcr);
-bool   are_attributes_spooled    (JCR *jcr);
-bool   begin_attribute_spool     (JCR *jcr);
-bool   discard_attribute_spool   (JCR *jcr);
-bool   commit_attribute_spool    (JCR *jcr);
-bool   write_block_to_spool_file (DCR *dcr, DEV_BLOCK *block);
-void   list_spool_stats          (BSOCK *bs);
+bool    begin_data_spool          (JCR *jcr);
+bool    discard_data_spool        (JCR *jcr);
+bool    commit_data_spool         (JCR *jcr);
+bool    are_attributes_spooled    (JCR *jcr);
+bool    begin_attribute_spool     (JCR *jcr);
+bool    discard_attribute_spool   (JCR *jcr);
+bool    commit_attribute_spool    (JCR *jcr);
+bool    write_block_to_spool_file (DCR *dcr, DEV_BLOCK *block);
+void    list_spool_stats          (BSOCK *bs);
index b7823060df82ba23a654a4df9964eb2f77cb56ea..a7335e60c73d10d0a89cce4831524bc7f83553c1 100644 (file)
@@ -6,7 +6,7 @@
  *   Version $Id$
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index 0bd988bcc0b5f9f6d722a1c26ece2398910bf53e..430d57428db8ca0d9f64eeea929962712d225efd 100644 (file)
@@ -11,7 +11,7 @@
  *   Version $Id$
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index 060311ed565dc8dc8585565395f7aa8fabb6a5d8..c0c564c0be5f1375b430d74005803308b49fc8cb 100644 (file)
@@ -9,7 +9,7 @@
  *
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index 21fbc6bee8977073987618d7d4e270a5edca61a5..547183fbde3f1585822db6f94aeb4dec39b2b369 100644 (file)
@@ -4,7 +4,7 @@
  *  Version $Id$
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
 #include "jcr.h"
 #include "protos.h"
 #ifdef HAVE_LIBZ
-#include <zlib.h>                    /* compression headers */
+#include <zlib.h>                     /* compression headers */
 #else
 #define uLongf uint32_t
 #endif
 
 extern STORES *me;                    /* "Global" daemon resource */
-extern bool forge_on;                /* proceed inspite of I/O errors */
+extern bool forge_on;                 /* proceed inspite of I/O errors */
 
 #ifdef debug_tracing
 extern int _rewind_dev(char *file, int line, DEVICE *dev);