]> git.sur5r.net Git - bacula/bacula/commitdiff
Misc cleanups
authorKern Sibbald <kern@sibbald.com>
Sun, 4 Jul 2004 13:22:53 +0000 (13:22 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 4 Jul 2004 13:22:53 +0000 (13:22 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1455 91ce42f0-d328-0410-95d8-f526ca767f89

17 files changed:
bacula/kernstodo
bacula/src/cats/mysql.c
bacula/src/dird/query.sql
bacula/src/stored/acquire.c
bacula/src/stored/bcopy.c
bacula/src/stored/bextract.c
bacula/src/stored/bls.c
bacula/src/stored/bscan.c
bacula/src/stored/btape.c
bacula/src/stored/dev.c
bacula/src/stored/dircmd.c
bacula/src/stored/label.c
bacula/src/stored/mount.c
bacula/src/stored/protos.h
bacula/src/stored/read.c
bacula/src/stored/read_record.c
bacula/src/version.h

index f85cdbe43b6436658814f72f1392384db6ce171a..2ddb7c6a02103599643ae2ffedb14c78e31d87c7 100644 (file)
@@ -1,5 +1,5 @@
                  Kern's ToDo List
-                  01 July 2004
+                   04 July 2004
 
 1.35 Items to do:
 - Make btape release the drive during the "test" append.
@@ -9,7 +9,6 @@
 - Document a get out of jail procedure if everything breaks if 
   you lost/broke the Catalog -- do the same for "I know my
   file is there how do I get it back?".
-- When restore started from console, report jobid.
 - Look at Win32 inc problem when new directory added files not saved???
 - Make FD run on Win95 if possible:
    The error I when I installed 1.34.2 clients:
@@ -54,17 +53,18 @@ Testing to do: (painful)
 - Test if rewind at end of tape waits for tape to rewind.
 - Test cancel at EOM.       
 
-For 1.33 Testing/Documentation:
-- Figure out how to use ssh or stunnel to protect Bacula communications.
-  Add Dan's work to manual See ssl.txt
+For 1.37 Testing/Documentation:
 - Add db check test to regression. Test each function like delete,
   purge, ...
 - If you use restore replace=never, the directory attributes for
   non-existent directories will not be restored properly.
 
 Wish list:  
-- Sort Scheduled jobs status listing by start time.
-- Add priority to Scheduled jobs status listing.
+- Compaction of Disk space by "migrating" Volumes that have pruned
+  Jobs (what criteria? size, #jobs, time).
+- Add prune all command
+- Document fact that purge can destroy a part of a restore by purging
+  one volume while others remain valid -- perhaps mark Jobs.
 - Add multiple-media-types.txt
 - look at mxt-changer.html
 - Make ? do a help command (no return needed).
@@ -1076,6 +1076,8 @@ Block Position: 0
   mount it.
 - Implement Fixed storage LabelFormat test.
 - Add reporting in attr despooling.
+- Figure out how to use ssh or stunnel to protect Bacula communications.
+  Add Dan's work to manual See ssl.txt
 
 ==== Done in 1.35.0
 - Implement fast tree insert (doubly linked list?)
@@ -1087,4 +1089,6 @@ Block Position: 0
   (Implement resources on a single pointer)
 - Add regular expressions to FileSets.
 - Test new I/O error despooling code.
+- Sort Scheduled jobs status listing by start time.
+- Add priority to Scheduled jobs status listing.
 
index 8dc2711581a85fc920cc96e0905ba1d793adcb67..a0ba1b83d904821413a7a31079bdf195bcb6ed1e 100644 (file)
@@ -137,7 +137,7 @@ db_open_database(JCR *jcr, B_DB *mdb)
    mysql_init(&(mdb->mysql));
    Dmsg0(50, "mysql_init done\n");
    /* If connection fails, try at 5 sec intervals for 30 seconds. */
-   for (int return=0; retry < 6; retry++) {
+   for (int retry=0; retry < 6; retry++) {
       mdb->db = mysql_real_connect(
           &(mdb->mysql),                /* db */
           mdb->db_address,              /* default = localhost */
index 164ba9d1d3b2e77f7d7724cbb4c23475b86641fa..efdfe25624ed59f64c53e1a5c86b83c55f925075 100644 (file)
@@ -171,14 +171,15 @@ SELECT Job.JobId,Job.Name,Job.StartTime,Job.Type,
   FROM JobMedia,Job
   WHERE JobMedia.JobId=Job.JobId
   AND JobMedia.MediaId=%1 
-  GROUP BY Job.JobId;
+  GROUP BY Job.JobId ORDER by Job.StartTime;
 # 15  
 :List Jobs stored for a given Volume name:
 *Enter Volume name:
-SELECT Job.JobId,Job.Name,Job.StartTime,Job.Type,
- Job.Level,Job.JobFiles,Job.JobBytes,Job.JobStatus
+SELECT Job.JobId as JobId,Job.Name as Name,Job.StartTime as StartTime,
+  Job.Type as Type,Job.Level as Level,Job.JobFiles as Files,
+  Job.JobBytes as Bytes,Job.JobStatus as Status
   FROM Media,JobMedia,Job
   WHERE Media.VolumeName='%1'
   AND Media.MediaId=JobMedia.MediaId              
   AND JobMedia.JobId=Job.JobId
-  GROUP BY Job.JobId;
+  GROUP BY Job.JobId ORDER by Job.StartTime;
index 843490575a387d08ab57dec08ac80948558b6495..7b1b0d0b8fa51049bd0035ddde7dd3471c2903df 100644 (file)
@@ -6,7 +6,7 @@
  *   Version $Id$
  */
 /*
-   Copyright (C) 2002-2003 Kern Sibbald and John Walker
+   Copyright (C) 2002-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
@@ -232,7 +232,7 @@ get_out:
  */
 DCR *acquire_device_for_append(JCR *jcr)
 {
-   int release = 0;
+   bool release = false;
    bool recycle = false;
    bool do_mount = false;
    DCR *dcr;
@@ -280,8 +280,10 @@ DCR *acquire_device_for_append(JCR *jcr)
               P(dev->mutex); 
               unblock_device(dev);
               V(dev->mutex);
+              free_dcr(dcr);         /* release dcr pointing to old dev */
               /* Make new device current device and lock it */
               dev = d;
+              dcr = new_dcr(jcr, dev); /* get new dcr for new device */
               lock_device(dev);
               block_device(dev, BST_DOING_ACQUIRE);
               unlock_device(dev);
@@ -291,7 +293,7 @@ DCR *acquire_device_for_append(JCR *jcr)
            }
         }
         /* Wrong tape mounted, release it, then fall through to get correct one */
-        release = 1;
+        release = true;
         do_mount = true;
       } else {
         /*       
index ff3028a7e53f0bb8c383275f2f35baf889b3315b..758fe253fe47e35611fe79fe1862a07f53e1ecef 100644 (file)
@@ -31,7 +31,7 @@
 #include "stored.h"
 
 /* Forward referenced functions */
-static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec);
+static bool record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec);
 
 
 /* Global variables */
@@ -186,7 +186,7 @@ int main (int argc, char *argv[])
 /*
  * read_records() calls back here for each record it gets
  */
-static int record_cb(JCR *in_jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
+static bool record_cb(JCR *in_jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
 {
    if (list_records) {
       Pmsg5(000, _("Record: SessId=%u SessTim=%u FileIndex=%d Stream=%d len=%u\n"),
@@ -205,10 +205,10 @@ static int record_cb(JCR *in_jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec
       switch (rec->FileIndex) {
       case PRE_LABEL:
          Pmsg0(000, "Volume is prelabeled. This volume cannot be copied.\n");
-        return 1;
+        return false;
       case VOL_LABEL:
          Pmsg0(000, "Volume label not copied.\n");
-        return 1;
+        return true;
       case SOS_LABEL:
         jobs++;
         break;
@@ -232,10 +232,10 @@ static int record_cb(JCR *in_jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec
         break;
       case EOM_LABEL:
          Pmsg0(000, "EOM label not copied.\n");
-        return 1;
+        return true;
       case EOT_LABEL:             /* end of all tapes */
          Pmsg0(000, "EOT label not copied.\n");
-        return 1;
+        return true;
       default:
         break;
       }
@@ -254,7 +254,7 @@ static int record_cb(JCR *in_jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec
         break;
       }
    }
-   return 1;
+   return true;
 }
 
 
index 3bd4adb74b2a16c28e57d42101fc84a5c1d3ed6e..5f64cf9ed27aefa4f3b73a3b892ee33bc1366359 100644 (file)
@@ -38,7 +38,7 @@ int win32_client = 0;
 #endif
 
 static void do_extract(char *fname);
-static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec);
+static bool record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec);
 
 static DEVICE *dev = NULL;
 static BFILE bfd;
@@ -46,7 +46,7 @@ static JCR *jcr;
 static FF_PKT my_ff;
 static FF_PKT *ff = &my_ff;
 static BSR *bsr = NULL;
-static int extract = FALSE;
+static bool extract = false;
 static int non_support_data = 0;
 static long total = 0;
 static ATTR *attr;
@@ -239,12 +239,12 @@ static void do_extract(char *devname)
 /*
  * Called here for each record from read_records()
  */
-static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
+static bool record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
 {
    int stat;
 
    if (rec->FileIndex < 0) {
-      return 1;                       /* we don't want labels */
+      return true;                    /* we don't want labels */
    }
 
    /* File Attributes stream */
@@ -261,7 +261,7 @@ static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
             Emsg0(M_ERROR, 0, _("Logic error output file should be open but is not.\n"));
         }
         set_attributes(jcr, attr, &bfd);
-        extract = FALSE;
+        extract = false;
       }
 
       if (!unpack_attributes_record(jcr, rec->Stream, rec->data, attr)) {
@@ -281,21 +281,21 @@ static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
                Jmsg(jcr, M_ERROR, 0, _("%s stream not supported on this Client.\n"),
                  stream_to_ascii(attr->data_stream));
            }
-           extract = FALSE;
-           return 1;
+           extract = false;
+           return true;
         }
 
 
         build_attr_output_fnames(jcr, attr);
 
-        extract = FALSE;
+        extract = false;
         stat = create_file(jcr, attr, &bfd, REPLACE_ALWAYS);   
         switch (stat) {
         case CF_ERROR:
         case CF_SKIP:
            break;
         case CF_EXTRACT:
-           extract = TRUE;
+           extract = true;
            print_ls_output(jcr, attr);
            num_files++;
            fileAddr = 0;
@@ -366,8 +366,8 @@ static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
               if (blseek(&bfd, (off_t)fileAddr, SEEK_SET) < 0) {
                   Emsg3(M_ERROR, 0, _("Seek to %s error on %s: ERR=%s\n"), 
                     edit_uint64(fileAddr, ec1), attr->ofname, berror(&bfd));
-                 extract = FALSE;
-                 return 1;
+                 extract = false;
+                 return true;
               }
            }
         } else {
@@ -378,8 +378,8 @@ static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
         if ((stat=uncompress((Bytef *)compress_buf, &compress_len, 
               (const Bytef *)wbuf, (uLong)wsize) != Z_OK)) {
             Emsg1(M_ERROR, 0, _("Uncompression error. ERR=%d\n"), stat);
-           extract = FALSE;
-           return 1;
+           extract = false;
+           return true;
         }
 
          Dmsg2(100, "Write uncompressed %d bytes, total before write=%d\n", compress_len, total);
@@ -387,8 +387,8 @@ static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
             Pmsg0(0, "===Write error===\n");
             Emsg2(M_ERROR, 0, _("Write error on %s: %s\n"), 
               attr->ofname, strerror(errno));
-           extract = FALSE;
-           return 1;
+           extract = false;
+           return true;
         }
         total += compress_len;
         fileAddr += compress_len;
@@ -398,8 +398,8 @@ static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
 #else
       if (extract) {
          Emsg0(M_ERROR, 0, "GZIP data stream found, but GZIP not configured!\n");
-        extract = FALSE;
-        return 1;
+        extract = false;
+        return true;
       }
 #endif
       break;
@@ -423,14 +423,14 @@ static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
             Emsg0(M_ERROR, 0, "Logic error output file should be open but is not.\n");
         }
         set_attributes(jcr, attr, &bfd);
-        extract = FALSE;
+        extract = false;
       }
       Jmsg(jcr, M_ERROR, 0, _("Unknown stream=%d ignored. This shouldn't happen!\n"), 
         rec->Stream);
       break;
       
    } /* end switch */
-   return 1;
+   return true;
 }
 
 
index 20c03fc31808e2484982c1b81506b80422e6e3d1..1204cd52f8ca8b21a6900cb37a73338f9257c5ca 100644 (file)
@@ -39,7 +39,7 @@ static void do_jobs(char *infname);
 static void do_ls(char *fname);
 static void do_close(JCR *jcr);
 static void get_session_record(DEVICE *dev, DEV_RECORD *rec, SESSION_LABEL *sessrec);
-static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec);
+static bool record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec);
 
 static DEVICE *dev;
 static int dump_label = FALSE;
@@ -313,13 +313,13 @@ static void do_blocks(char *infname)
 /*
  * We are only looking for labels or in particular Job Session records
  */
-static int jobs_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
+static bool jobs_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
 {
    if (rec->FileIndex < 0) {
       dump_label_record(dev, rec, verbose);
    }
    rec->remainder = 0;
-   return 1;
+   return true;
 }
 
 /* Do list job records */
@@ -342,11 +342,11 @@ static void do_ls(char *infname)
 /*
  * Called here for each record from read_records()
  */
-static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
+static bool record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
 {
    if (rec->FileIndex < 0) {
       get_session_record(dev, rec, &sessrec);
-      return 1;
+      return true;
    }
    /* File Attributes stream */
    if (rec->Stream == STREAM_UNIX_ATTRIBUTES || 
@@ -376,7 +376,7 @@ static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
         num_files++;
       }
    }
-   return 1;
+   return true;
 }
 
 
index 52bd47b2088431aba09cd6123965e14c21419fe3..72ad0cf35de499d309b37565fe2058b29640df3d 100644 (file)
@@ -36,7 +36,7 @@
 
 /* Forward referenced functions */
 static void do_scan(void);
-static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec);
+static bool record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec);
 static int  create_file_attributes_record(B_DB *db, JCR *mjcr, 
                               char *fname, char *lname, int type,
                               char *ap, DEV_RECORD *rec);
@@ -273,7 +273,7 @@ int main (int argc, char *argv[])
  *   the end of writing a tape by wiffling through the attached
  *   jcrs creating jobmedia records.
  */
-static int bscan_mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
+static bool bscan_mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
 {
    Dmsg1(100, "Walk attached jcrs. Volume=%s\n", dev->VolCatInfo.VolCatName);
    for (JCR *mjcr=NULL; (mjcr=next_attached_jcr(dev, mjcr)); ) {
@@ -297,7 +297,7 @@ static int bscan_mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
     * we call mount_next... with bscan's jcr because that is where we
     * have the Volume list, but we get attached.
     */
-   int stat = mount_next_read_volume(jcr, dev, block);
+   bool stat = mount_next_read_volume(jcr, dev, block);
    /* we must once more detach ourselves (attached by mount_next ...) */
    detach_jcr_from_device(dev, jcr); /* detach bscan jcr */
    return stat;
@@ -324,7 +324,11 @@ static void do_scan()
    term_dev(dev);
 }
 
-static int record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
+/*
+ * Returns: true if OK
+ *         false if error
+ */
+static bool record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
 {
    JCR *mjcr;
    DCR *dcr;
@@ -351,7 +355,7 @@ static int record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
       switch (rec->FileIndex) {
       case PRE_LABEL:
          Pmsg0(000, _("Volume is prelabeled. This tape cannot be scanned.\n"));
-        return 1;
+        return false;
         break;
 
       case VOL_LABEL:
@@ -374,7 +378,7 @@ static int record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
         if (strcmp(pr.PoolType, dev->VolHdr.PoolType) != 0) {
             Pmsg2(000, _("VOL_LABEL: PoolType mismatch. DB=%s Vol=%s\n"),
               pr.PoolType, dev->VolHdr.PoolType);
-           return 1;
+           return true;
         } else if (verbose) {
             Pmsg1(000, _("Pool type \"%s\" is OK.\n"), pr.PoolType);
         }
@@ -402,7 +406,7 @@ static int record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
         if (strcmp(mr.MediaType, dev->VolHdr.MediaType) != 0) {
             Pmsg2(000, _("VOL_LABEL: MediaType mismatch. DB=%s Vol=%s\n"),
               mr.MediaType, dev->VolHdr.MediaType);
-           return 1;
+           return true;              /* ignore error */
         } else if (verbose) {
             Pmsg1(000, _("Media type \"%s\" is OK.\n"), mr.MediaType);
         }
@@ -480,19 +484,19 @@ static int record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
             Pmsg3(000, _("SOS_LABEL: VolSessId mismatch for JobId=%u. DB=%d Vol=%d\n"),
               jr.JobId,
               jr.VolSessionId, rec->VolSessionId);
-           return 1;
+           return true;              /* ignore error */
         }
         if (rec->VolSessionTime != jr.VolSessionTime) {
             Pmsg3(000, _("SOS_LABEL: VolSessTime mismatch for JobId=%u. DB=%d Vol=%d\n"),
               jr.JobId,
               jr.VolSessionTime, rec->VolSessionTime);
-           return 1;
+           return true;              /* ignore error */
         }
         if (jr.PoolId != pr.PoolId) {
             Pmsg3(000, _("SOS_LABEL: PoolId mismatch for JobId=%u. DB=%d Vol=%d\n"),
               jr.JobId,
               jr.PoolId, pr.PoolId);
-           return 1;
+           return true;              /* ignore error */
         }
         break;
 
@@ -564,7 +568,7 @@ static int record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
       default:
         break;
       } /* end switch */
-      return 1;
+      return true;
    }
 
    mjcr = get_jcr_by_session(rec->VolSessionId, rec->VolSessionTime);
@@ -575,7 +579,7 @@ static int record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
       } else {
         ignored_msgs++;
       }
-      return 1;
+      return true;
    }
    dcr = mjcr->dcr;
    if (dcr->VolFirstIndex == 0) {
@@ -677,7 +681,7 @@ static int record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
       Pmsg2(0, _("Unknown stream type!!! stream=%d data=%s\n"), rec->Stream, rec->data);
       break;
    }
-   return 1;
+   return true;
 }
 
 /*
index 731860c097c38e3ce89ee18e64288c8ae0c034d8..86cdf93b15013310239bbf7025cfac2b661269fd 100644 (file)
@@ -72,9 +72,9 @@ static void qfillcmd();
 static void statcmd();
 static void unfillcmd();
 static int flush_block(DEV_BLOCK *block, int dump);
-static int quickie_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec);
+static bool quickie_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec);
 static bool compare_blocks(DEV_BLOCK *last_block, DEV_BLOCK *block);
-static int my_mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
+static bool my_mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
 static void scan_blocks();
 static void set_volume_name(const char *VolName, int volnum);
 static void rawfill_cmd();
@@ -335,7 +335,7 @@ static void labelcmd()
       }
    }
    rewind_dev(dev);
-   write_new_volume_label_to_dev(jcr, jcr->device, cmd, "Default");
+   write_new_volume_label_to_dev(jcr, jcr->device->dev, cmd, "Default");
    Pmsg1(-1, "Wrote Volume label for volume \"%s\".\n", cmd);
 }
 
@@ -2090,7 +2090,7 @@ bail_out:
 }
 
 /* Read 1000 records then stop */
-static int quickie_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
+static bool quickie_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
 {
    quickie_count++;
    return quickie_count <= 1000;
@@ -2586,7 +2586,7 @@ int dir_ask_sysop_to_create_appendable_volume(JCR *jcr, DEVICE *dev)
    return 1;
 }
 
-static int my_mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
+static bool my_mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
 {
    char ec1[50];
 
@@ -2608,7 +2608,7 @@ static int my_mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
 
    if (strcmp(jcr->VolumeName, "TestVolume2") == 0) {
       end_of_tape = 1;
-      return 0;
+      return false;
    }
 
    free_vol_list(jcr);
@@ -2619,9 +2619,9 @@ static int my_mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
    dev->state &= ~ST_READ; 
    if (!acquire_device_for_read(jcr)) {
       Pmsg2(0, "Cannot open Dev=%s, Vol=%s\n", dev_name(dev), jcr->VolumeName);
-      return 0;
+      return false;
    }
-   return 1;                      /* next volume mounted */
+   return true;                   /* next volume mounted */
 }
 
 static void set_volume_name(const char *VolName, int volnum) 
index a4773fba7168eee0622d02548dfb77bed6f86316..554a5f4831397222234ad024b513cd6f3bcc80a4 100644 (file)
@@ -97,7 +97,7 @@ DEVICE *
 init_dev(DEVICE *dev, DEVRES *device)
 {
    struct stat statp;
-   int tape, fifo;
+   bool tape, fifo;
    int errstat;
    DCR *dcr = NULL;
 
@@ -110,14 +110,14 @@ init_dev(DEVICE *dev, DEVRES *device)
            strerror(errno));
       return NULL;
    }
-   tape = FALSE;
-   fifo = FALSE;
+   tape = false;
+   fifo = false;
    if (S_ISDIR(statp.st_mode)) {
-      tape = FALSE;
+      tape = false;
    } else if (S_ISCHR(statp.st_mode)) {
-      tape = TRUE;
+      tape = true;
    } else if (S_ISFIFO(statp.st_mode)) {
-      fifo = TRUE;
+      fifo = true;
    } else {
       if (dev) {
         dev->dev_errno = ENODEV;
index 9a7560f4dca8c2243f4d513a2e27ddb5152795a8..c7f5560a8b34241bf926cfab0c0fa83887e1da57 100644 (file)
@@ -403,7 +403,7 @@ static void label_volume_if_ok(JCR *jcr, DEVICE *dev, char *oldname,
       /* Fall through wanted! */
    case VOL_IO_ERROR:
    case VOL_NO_LABEL:
-      if (!write_new_volume_label_to_dev(jcr, jcr->device, newname, poolname)) {
+      if (!write_new_volume_label_to_dev(jcr, jcr->device->dev, newname, poolname)) {
          bnet_fsend(dir, _("3912 Failed to label Volume: ERR=%s\n"), strerror_dev(dev));
         break;
       }
index f4d25b95b6b4c473b83803e80d08085e54a29003..d37ef473f720c2fbade3cf02641ed3f2a9687a00 100644 (file)
@@ -374,9 +374,8 @@ void create_volume_label(DEVICE *dev, const char *VolName, const char *PoolName)
  *
  *  This routine should be used only when labeling a blank tape.
  */
-bool write_new_volume_label_to_dev(JCR *jcr, DEVRES *device, const char *VolName, const char *PoolName)
+bool write_new_volume_label_to_dev(JCR *jcr, DEVICE *dev, const char *VolName, const char *PoolName)
 {
-   DEVICE *dev = device->dev;
    DEV_RECORD rec;   
    DEV_BLOCK *block;
    bool stat = true;
index 4f23f83c5844f5c654d16e549263f5e89b0ca6f6..ccfc68c34062b2781ca5e45e34003c1b749612c9 100644 (file)
@@ -45,7 +45,7 @@ static bool rewrite_volume_label(JCR *jcr, DEVICE *dev, DEV_BLOCK *bloc, bool re
  *  impossible to get the requested Volume.
  *
  */
-int mount_next_write_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, bool release)
+bool mount_next_write_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, bool release)
 {
    int retry = 0;
    bool ask = false, recycle, autochanger;
@@ -68,12 +68,12 @@ mount_next_vol:
       if (!dir_ask_sysop_to_mount_volume(jcr, dev)) {
          Jmsg(jcr, M_FATAL, 0, _("Too many errors trying to mount device %s.\n"), 
              dev_name(dev));
-        return 0;
+        return false;
       }
    }
    if (job_canceled(jcr)) {
       Jmsg(jcr, M_FATAL, 0, _("Job %d canceled.\n"), jcr->JobId);
-      return 0;
+      return false;
    }
    recycle = false;
    if (release) {
@@ -90,12 +90,12 @@ mount_next_vol:
    while (!dir_find_next_appendable_volume(jcr)) {
        Dmsg0(200, "not dir_find_next\n");
        if (!dir_ask_sysop_to_create_appendable_volume(jcr, dev)) {
-        return 0;
+        return false;
        }
        Dmsg0(200, "Again dir_find_next_append...\n");
    }
    if (job_canceled(jcr)) {
-      return 0;
+      return false;
    }
    Dmsg2(100, "After find_next_append. Vol=%s Slot=%d\n",
         jcr->VolCatInfo.VolCatName, jcr->VolCatInfo.Slot);
@@ -141,10 +141,10 @@ mount_next_vol:
 
    if (ask && !dir_ask_sysop_to_mount_volume(jcr, dev)) {
       Dmsg0(100, "Error return ask_sysop ...\n");
-      return 0;             /* error return */
+      return false;         /* error return */
    }
    if (job_canceled(jcr)) {
-      return 0;
+      return false;
    }
    Dmsg1(100, "want vol=%s\n", jcr->VolumeName);
 
@@ -154,7 +154,7 @@ mount_next_vol:
 
    /* Ensure the device is open */
    if (!open_device(jcr, dev)) {
-      return 0;
+      return false;
    }
 
    /*
@@ -250,7 +250,7 @@ read_volume:
                                    "Recycle") == 0))) {
          Dmsg0(100, "Create volume label\n");
         /* Create a new Volume label and write it to the device */
-        if (!write_new_volume_label_to_dev(jcr, (DEVRES *)dev->device, jcr->VolumeName,
+        if (!write_new_volume_label_to_dev(jcr, dev, jcr->VolumeName,
                jcr->pool_name)) {
             Dmsg0(100, "!write_vol_label\n");
            goto mount_next_vol;
@@ -340,7 +340,7 @@ The number of files mismatch! Volume=%u Catalog=%u\n"),
    }
    dev->state |= ST_APPEND;
    Dmsg0(100, "Normal return from read_dev_for_append\n");
-   return 1; 
+   return true;
 }
 
 /*
@@ -428,7 +428,7 @@ void mark_volume_in_error(JCR *jcr, DEVICE *dev)
  * If we are reading, we come here at the end of the tape
  *  and see if there are more volumes to be mounted.
  */
-int mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
+bool mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
 {
    Dmsg2(90, "NumVolumes=%d CurVolume=%d\n", jcr->NumVolumes, jcr->CurVolume);
    /*
@@ -440,12 +440,12 @@ int mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
       if (!acquire_device_for_read(jcr)) {
          Jmsg2(jcr, M_FATAL, 0, "Cannot open Dev=%s, Vol=%s\n", dev_name(dev),
               jcr->VolumeName);
-        return 0;
+        return false;
       }
-      return 1;                      /* next volume mounted */
+      return true;                   /* next volume mounted */
    }
    Dmsg0(90, "End of Device reached.\n");
-   return 0;
+   return false;
 }
 
 /*
index e37159ad78a4b7216dccea09b8561bd30da97d05..ec41aa40e447377baa1e89a8dc491412cdb8ccbf 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);
+int     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);
+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);
 
 /* 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);
-int     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);
+int    write_block_to_device(DCR *dcr, DEV_BLOCK *block);
+int    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);
-int      fixup_device_block_write_error(JCR *jcr, DEVICE *dev, 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);
+int     fixup_device_block_write_error(JCR *jcr, DEVICE *dev, 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, DEVRES *device, const char *VolName, const char *PoolName);
-int      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);
+int     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 */
-int      mount_next_write_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, bool release);
-int      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 */
-int read_records(JCR *jcr,  DEVICE *dev, 
-       int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec),
-       int mount_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block));
+bool read_records(JCR *jcr,  DEVICE *dev, 
+       bool record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec),
+       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 4513e8a0280aacf1fd825f6d47ebe9de0659a539..82e5ebc64f624641babca6b24297411fa73d650a 100644 (file)
@@ -29,7 +29,7 @@
 #include "stored.h"
 
 /* Forward referenced subroutines */
-static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec);
+static bool record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec);
 
 
 /* Responses sent to the File daemon */
@@ -42,10 +42,10 @@ static char rec_header[] = "rechdr %ld %ld %ld %ld %ld";
  *   Returns: 0 on failure
  *           1 on success
  */
-int do_read_data(JCR *jcr) 
+bool do_read_data(JCR *jcr) 
 {
    BSOCK *fd = jcr->file_bsock;
-   int ok = TRUE;
+   bool ok = true;
    DEVICE *dev;
    
    Dmsg0(20, "Start read data.\n");
@@ -55,7 +55,7 @@ int do_read_data(JCR *jcr)
    Dmsg1(10, "bstored>filed: %s\n", fd->msg);
 
    if (!bnet_set_buffer_size(fd, jcr->device->max_network_buffer_size, BNET_SETBUF_WRITE)) {
-      return 0;
+      return false;
    }
 
 
@@ -66,7 +66,7 @@ int do_read_data(JCR *jcr)
       Jmsg(jcr, M_FATAL, 0, _("No Volume names found for restore.\n"));
       free_vol_list(jcr);
       bnet_fsend(fd, FD_error);
-      return 0;
+      return false;
    }
 
    Dmsg2(200, "Found %d volumes names to restore. First=%s\n", jcr->NumVolumes, 
@@ -79,7 +79,7 @@ int do_read_data(JCR *jcr)
     */
    if (!acquire_device_for_read(jcr)) {
       free_vol_list(jcr);
-      return 0;
+      return false;
    }
 
    /* Tell File daemon we will send data */
@@ -90,25 +90,27 @@ int do_read_data(JCR *jcr)
    bnet_sig(fd, BNET_EOD);
 
    if (!release_device(jcr)) {
-      ok = FALSE;
+      ok = false;
    }
    
    free_vol_list(jcr);
    Dmsg0(30, "Done reading.\n");
-   return ok ? 1 : 0;
+   return ok;
 }
 
 /*
  * Called here for each record from read_records()
+ *  Returns: true if OK
+ *          false if error
  */
-static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
+static bool record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
 {
    BSOCK *fd = jcr->file_bsock;
-   int ok = TRUE;
+   bool ok = true;
    POOLMEM *save_msg;
 
    if (rec->FileIndex < 0) {
-      return 1;
+      return true;
    }
    Dmsg5(100, "Send to FD: SessId=%u SessTim=%u FI=%d Strm=%d, len=%d\n",
       rec->VolSessionId, rec->VolSessionTime, rec->FileIndex, rec->Stream,
@@ -120,7 +122,7 @@ static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
       Dmsg1(30, ">filed: Error Hdr=%s\n", fd->msg);
       Jmsg1(jcr, M_FATAL, 0, _("Error sending to File daemon. ERR=%s\n"),
         bnet_strerror(fd));
-      return FALSE;
+      return false;
    } else {
       Dmsg1(30, ">filed: Hdr=%s\n", fd->msg);
    }
@@ -136,7 +138,7 @@ static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
       Jmsg1(jcr, M_FATAL, 0, _("Error sending to File daemon. ERR=%s\n"),
         bnet_strerror(fd));
 
-      ok = FALSE;
+      ok = false;
    }
    fd->msg = save_msg;               /* restore fd message pointer */
    return ok;
index 1feae772c9e52e9f0e03b4fdbf9a5a09f16b335e..0bd988bcc0b5f9f6d722a1c26ece2398910bf53e 100644 (file)
@@ -41,14 +41,14 @@ static int try_repositioning(JCR *jcr, DEV_RECORD *rec, DEVICE *dev);
 static char *rec_state_to_str(DEV_RECORD *rec);
 #endif
 
-int read_records(JCR *jcr,  DEVICE *dev, 
-       int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec),
-       int mount_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block))
+bool read_records(JCR *jcr,  DEVICE *dev, 
+       bool record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec),
+       bool mount_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block))
 {
    DEV_BLOCK *block;
    DEV_RECORD *rec = NULL;
    uint32_t record;
-   int ok = TRUE;
+   bool ok = true;
    bool done = false;
    SESSION_LABEL sessrec;
    dlist *recs;                        /* linked list of rec packets open */
@@ -59,7 +59,7 @@ int read_records(JCR *jcr,  DEVICE *dev,
 
    for ( ; ok && !done; ) {
       if (job_canceled(jcr)) {
-        ok = FALSE;
+        ok = false;
         break;
       }
       if (!read_block_from_device(jcr, dev, block, CHECK_BLOCK_NUMBERS)) {
@@ -70,7 +70,7 @@ int read_records(JCR *jcr,  DEVICE *dev,
                 dev->file, dev_name(dev), jcr->VolumeName);
            if (!mount_cb(jcr, dev, block)) {
                Jmsg(jcr, M_INFO, 0, "End of all volumes.\n");
-              ok = FALSE;
+              ok = false;
               /*
                * Create EOT Label so that Media record may
                *  be properly updated because this is the last
@@ -115,7 +115,7 @@ int read_records(JCR *jcr,  DEVICE *dev,
                Dmsg0(000, "Did fsr\n");
               continue;              /* try to continue */
            }
-           ok = FALSE;
+           ok = false;
            break;
         }
       }
index f8028ba913a9837c43eb8b317310f83bb472324f..a8e4d619e362eb405c37ae1f1676f3db899488f9 100644 (file)
@@ -2,8 +2,8 @@
 #undef  VERSION
 #define VERSION "1.35.0"
 #define VSTRING "1"
-#define BDATE   "01 July 2004"
-#define LSMDATE "01Jul04"
+#define BDATE   "04 July 2004"
+#define LSMDATE "04Jul04"
 
 /* Debug flags */
 #undef  DEBUG