]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix btape for files + more doc
authorKern Sibbald <kern@sibbald.com>
Tue, 29 Oct 2002 11:26:22 +0000 (11:26 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 29 Oct 2002 11:26:22 +0000 (11:26 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@176 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kernstodo
bacula/src/stored/btape.c
bacula/src/stored/butil.c
bacula/src/stored/parse_bsr.c

index bc16bde150bda00cbf4d5680d21f165d973aaa67..ad94b20945746ca6e41ac2a421a0471268d0289d 100644 (file)
@@ -1,5 +1,5 @@
                  Kern's ToDo List
-                 25 October 2002
+                 29 October 2002
 
 To do:    
 - Document that two Verifys at same time on same client do not work.
@@ -26,6 +26,7 @@ For 1.27 release:
   ANYTHING to and from a Bacula Volume, including horrible
   stuff like Windows ACLs).
 
+- Write bcopy program.
 - Preprocessing command per file.
 - Postprocessing command per file (when restoring).
 - File system type from File daemon
@@ -38,16 +39,13 @@ For 1.27 release:
 - Send Volumes needed during restore to Console (just after
   create_volume_list) -- also in restore command?
 - Document buffer size considerations with Sparse files --
-- Document all daemon tools MUST have a config file.
 - Move block size code from block.c to init_dev().
 - Add code to fast seek to proper place on tape/file
   when doing Restore. If it doesn't work, try linear
   search as before.
 - Add code to reject whole blocks if not wanted on restore.
-- Why does btape error when pointed to a file?
 - Possibly add email to Watchdog if drive is unmounted too
   long and a job is waiting on the drive.
-- Disallow compile if long long not 64 bits.
 - What to do with btime and JobTDate?
 - Add FileSet MD5 to bscan.
 - Finish implementation of restore "replace" options, and document.
@@ -560,3 +558,6 @@ Done: (see kernsdone for more)
 - Label (asks for slot, return and it stops).
 - Make SD reject writing on tape where Catalog and tape # files
   don't agree (possibly OK if tape > catalog).
+- Document all daemon tools MUST have a config file.
+- Why does btape error when pointed to a file?
+- Disallow compile if long long not 64 bits.
index c079ae7ae009d1fa3b78edacc1890e763693ea23..3238f3852ebf9239d94b75c5ebb8e175d8383a74 100644 (file)
@@ -391,10 +391,10 @@ static void weofcmd()
 static void eomcmd()
 {
    if (!eod_dev(dev)) {
-      Pmsg1(0, "Bad status from eod. ERR=%s\n", strerror_dev(dev));
+      Pmsg1(0, _("Bad status from eod. ERR=%s\n"), strerror_dev(dev));
       return;
    } else {
-      Pmsg0(0, "Moved to end of media\n");
+      Pmsg0(0, _("Moved to end of media\n"));
    }
 }
 
@@ -415,9 +415,9 @@ static void bsfcmd()
    int stat;
 
    if ((stat=bsf_dev(dev, 1)) < 0) {
-      Pmsg1(0, "Bad status from bsf. ERR=%s\n", strerror(errno));
+      Pmsg1(0, _("Bad status from bsf. ERR=%s\n"), strerror(errno));
    } else {
-      Pmsg0(0, "Back spaced one file.\n");
+      Pmsg0(0, _("Back spaced one file.\n"));
    }
 }
 
@@ -429,9 +429,9 @@ static void bsrcmd()
    int stat;
 
    if ((stat=bsr_dev(dev, 1)) < 0) {
-      Pmsg1(0, "Bad status from bsr. ERR=%s\n", strerror(errno));
+      Pmsg1(0, _("Bad status from bsr. ERR=%s\n"), strerror(errno));
    } else {
-      Pmsg0(0, "Back spaced one record.\n");
+      Pmsg0(0, _("Back spaced one record.\n"));
    }
 }
 
@@ -441,7 +441,7 @@ static void bsrcmd()
  */
 static void capcmd()
 {
-   Pmsg0(0, "Device capabilities: ");
+   printf(_("Device capabilities:\n"));
    printf("%sEOF ", dev->capabilities & CAP_EOF ? "" : "!");
    printf("%sBSR ", dev->capabilities & CAP_BSR ? "" : "!");
    printf("%sBSF ", dev->capabilities & CAP_BSF ? "" : "!");
@@ -455,6 +455,21 @@ static void capcmd()
    printf("%sANONVOLS ", dev->capabilities & CAP_ANONVOLS ? "" : "!");
    printf("%sALWAYSOPEN ", dev->capabilities & CAP_ALWAYSOPEN ? "" : "!");
    printf("\n");
+
+   printf(_("Device status:\n"));
+   printf("%sOPENED ", dev->state & ST_OPENED ? "" : "!");
+   printf("%sTAPE ", dev->state & ST_TAPE ? "" : "!");
+   printf("%sLABEL ", dev->state & ST_LABEL ? "" : "!");
+   printf("%sMALLOC ", dev->state & ST_MALLOC ? "" : "!");
+   printf("%sAPPEND ", dev->state & ST_APPEND ? "" : "!");
+   printf("%sREAD ", dev->state & ST_READ ? "" : "!");
+   printf("%sEOT ", dev->state & ST_EOT ? "" : "!");
+   printf("%sWEOT ", dev->state & ST_WEOT ? "" : "!");
+   printf("%sEOF ", dev->state & ST_EOF ? "" : "!");
+   printf("%sNEXTVOL ", dev->state & ST_NEXTVOL ? "" : "!");
+   printf("%sSHORT ", dev->state & ST_SHORT ? "" : "!");
+   printf("\n");
+
 }
 
 /*
@@ -1113,7 +1128,7 @@ do_tape_cmds()
            break;
         }
       if (!found)
-         Pmsg1(0, "%s is an illegal command\n", cmd);
+         Pmsg1(0, _("%s is an illegal command\n"), cmd);
       if (quit)
         break;
    }
@@ -1123,7 +1138,7 @@ static void helpcmd()
 {
    unsigned int i;
    usage();
-   printf("  Command    Description\n  =======    ===========\n");
+   printf(_("  Command    Description\n  =======    ===========\n"));
    for (i=0; i<comsize; i++)
       printf("  %-10s %s\n", commands[i].key, commands[i].help);
    printf("\n");
@@ -1131,7 +1146,7 @@ static void helpcmd()
 
 static void usage()
 {
-   fprintf(stderr,
+   fprintf(stderr, _(
 "\nVersion: " VERSION " (" DATE ")\n\n"
 "Usage: btape [-c config_file] [-d debug_level] [device_name]\n"
 "       -c <file>   set configuration file to file\n"
@@ -1139,7 +1154,7 @@ static void usage()
 "       -s          turn off signals\n"
 "       -t          open the default tape device\n"
 "       -?          print this message.\n"  
-"\n");
+"\n"));
 
 }
 
index 68b2b9365fa4ded13838646d960f7580c6e33a4d..4b372fca6e39669e8fa5a59ee2882a1d4a037b24 100644 (file)
@@ -112,8 +112,22 @@ DEVICE *setup_to_access_device(JCR *jcr, int read_access)
    if (read_access) {
       if (!acquire_device_for_read(jcr, dev, block)) {
         Emsg0(M_ERROR, 0, dev->errmsg);
+        free_block(block);
         return NULL;
       }
+   } else {
+      lock_device(dev);
+      if (!(dev->state & ST_OPENED)) {
+         Dmsg0(129, "Opening device.\n");
+        if (open_dev(dev, jcr->VolumeName, READ_WRITE) < 0) {
+            Emsg1(M_FATAL, 0, _("dev open failed: %s\n"), dev->errmsg);
+           unlock_device(dev);
+           free_block(block);
+           return NULL;
+        }
+      }
+      Dmsg1(129, "open_dev %s OK\n", dev_name(dev));
+      unlock_device(dev);
    }
    free_block(block);
    return dev;
@@ -181,6 +195,9 @@ static void my_free_jcr(JCR *jcr)
       free_pool_memory(jcr->dev_name);
       jcr->dev_name = NULL;
    }
+   if (jcr->VolList) {
+      free_vol_list(jcr);
+   }  
      
    return;
 }
index f0dc3a62e2f6496173cec43d19458430eb0270af..27fc007c8c6258fcf53ec82a64880a4b073a88a9 100755 (executable)
@@ -711,6 +711,7 @@ void free_vol_list(JCR *jcr)
       free(next);
       next = tmp;
    }
+   jcr->VolList = NULL;
 }
 
 void create_vol_list(JCR *jcr)