]> git.sur5r.net Git - bacula/bacula/commitdiff
- In block.c call dvd_write_part() to write last part rather
authorKern Sibbald <kern@sibbald.com>
Wed, 12 Oct 2005 10:02:04 +0000 (10:02 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 12 Oct 2005 10:02:04 +0000 (10:02 +0000)
  than dvd_open_next_part().
- Prefix some DVD subroutines with dvd_

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2433 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kes-1.37
bacula/src/stored/block.c
bacula/src/stored/dvd.c
bacula/src/stored/protos.h
bacula/src/version.h

index f3ec1cbc2b3e6964874f318c98dd30d57b0dbc32..95efd7abf384c778f08b080b58ce1c8097c1555d 100644 (file)
@@ -4,6 +4,10 @@
 General:
 
 Changes to 1.37.41:
+12Oct05
+- In block.c call dvd_write_part() to write last part rather
+  than dvd_open_next_part().
+- Prefix some DVD subroutines with dvd_
 11Oct05
 - Add extra debug to Update media error for VolFiles decrease
   error.
index 1461f777144db3c830f4af549635e10b4b4cff23..566fcd8a899f369e7eb2f1d7274f44889f4a78ce 100644 (file)
@@ -693,8 +693,8 @@ static bool terminate_writing_volume(DCR *dcr)
    dev->VolCatInfo.VolCatFiles = dev->file;   /* set number of files */
    dev->VolCatInfo.VolCatJobs++;              /* increment number of jobs */
    
-   if (dev->is_dvd()) { /* Write the current (and last) part. */
-      open_next_part(dcr);
+   if (dev->is_dvd()) {
+      dvd_write_part(dcr);                 /* write last part */
    }
    
    if (!dir_update_volume_info(dcr, false)) {
@@ -794,7 +794,7 @@ static bool do_dvd_size_checks(DCR *dcr)
          return false;
       }
       
-      if (open_next_part(dcr) < 0) {
+      if (dvd_open_next_part(dcr) < 0) {
          Jmsg2(dcr->jcr, M_FATAL, 0, _("Unable to open device next part %s: ERR=%s\n"),
                 dev->print_name(), strerror_dev(dev));
          dev->dev_errno = EIO;
@@ -904,7 +904,7 @@ reread:
    if ((dev->num_parts > 0) &&
         ((dev->file_addr-dev->part_start) == dev->part_size) && 
         (dev->part < dev->num_parts)) {
-      if (open_next_part(dcr) < 0) {
+      if (dvd_open_next_part(dcr) < 0) {
          Jmsg2(dcr->jcr, M_FATAL, 0, _("Unable to open device next part %s: ERR=%s\n"),
                dev->print_name(), strerror_dev(dev));
          dev->dev_errno = EIO;
index 70c25c2940977eae1ab603f1c81d0119b1f72191..000068524e8592ac1dfa7664a0531bfb45292bbc 100644 (file)
@@ -286,11 +286,12 @@ void update_free_space_dev(DEVICE* dev)
 
 /*
  * Write a part (Vol, Vol.1, ...) from the spool to the DVD   
- * This MUST only be called from open_next_part. Otherwise the part number
- * is not updated.
- * It is also called from truncate_dvd_dev to "blank" the medium.
+ * This routine does not update the part number, so normally, you
+ *  should call open_next_part()
+ * It is also called from truncate_dvd_dev to "blank" the medium, as
+ *  well as from block.c when the DVD is full to write the last part.
  */
-static bool dvd_write_part(DCR *dcr) 
+bool dvd_write_part(DCR *dcr) 
 {
    DEVICE *dev = dcr->dev;
    POOL_MEM ocmd(PM_FNAME);
@@ -338,7 +339,7 @@ static bool dvd_write_part(DCR *dcr)
       sm_check(__FILE__, __LINE__, false);
    }
    
-   /* growisofs umount the device, so remount it (it will update the free space) */
+   /* growisofs umounted the device, so remount it (it will update the free space) */
    dev->clear_mounted();
    mount_dev(dev, 1);
    Jmsg(dcr->jcr, M_INFO, 0, _("Remaining free space %s on %s\n"), 
@@ -352,7 +353,7 @@ static bool dvd_write_part(DCR *dcr)
  *  - Increment part number 
  *  - Reopen the device
  */
-int open_next_part(DCR *dcr)
+int dvd_open_next_part(DCR *dcr)
 {
    DEVICE *dev = dcr->dev;
 
@@ -459,7 +460,7 @@ int open_next_part(DCR *dcr)
  *  - Close the fd
  *  - Reopen the device
  */
-int open_first_part(DCR *dcr, int mode)
+int dvd_open_first_part(DCR *dcr, int mode)
 {
    DEVICE *dev = dcr->dev;
 
@@ -513,7 +514,7 @@ off_t lseek_dev(DEVICE *dev, off_t offset, int whence)
             }
          } else {
             /* Load next part, and start again */
-            if (open_next_part(dcr) < 0) {
+            if (dvd_open_next_part(dcr) < 0) {
                Dmsg0(100, "lseek_dev failed while trying to open the next part\n");
                return -1;
             }
@@ -526,7 +527,7 @@ off_t lseek_dev(DEVICE *dev, off_t offset, int whence)
           * so just load the first one, and seek again
           * until the right one is loaded
           */
-         if (open_first_part(dcr, dev->openmode) < 0) {
+         if (dvd_open_first_part(dcr, dev->openmode) < 0) {
             Dmsg0(100, "lseek_dev failed while trying to open the first part\n");
             return -1;
          }
@@ -580,19 +581,19 @@ off_t lseek_dev(DEVICE *dev, off_t offset, int whence)
           */
          int modesave = dev->openmode;
          /* Works because num_parts > 0. */
-         if (open_first_part(dcr, OPEN_READ_ONLY) < 0) {
+         if (dvd_open_first_part(dcr, OPEN_READ_ONLY) < 0) {
             Dmsg0(100, "lseek_dev failed while trying to open the first part\n");
             return -1;
          }
          if (dev->num_parts > 0) {
             while (dev->part < (dev->num_parts-1)) {
-               if (open_next_part(dcr) < 0) {
+               if (dvd_open_next_part(dcr) < 0) {
                   Dmsg0(100, "lseek_dev failed while trying to open the next part\n");
                   return -1;
                }
             }
             dev->openmode = modesave;
-            if (open_next_part(dcr) < 0) {
+            if (dvd_open_next_part(dcr) < 0) {
                Dmsg0(100, "lseek_dev failed while trying to open the next part\n");
                return -1;
             }
@@ -630,7 +631,7 @@ bool dvd_close_job(DCR *dcr)
          NB: No! If you call dvd_write_part, the part number is not updated.
          You must open the next part, it will automatically write the part and
          update the part number. */
-      if (ok && (open_next_part(dcr) < 0)) {
+      if (ok && (dvd_open_next_part(dcr) < 0)) {
          Jmsg2(jcr, M_FATAL, 0, _("Unable to write part %s: ERR=%s\n"),
                dev->print_name(), strerror_dev(dev));
          dev->dev_errno = EIO;
@@ -653,7 +654,7 @@ bool truncate_dvd_dev(DCR *dcr) {
    Dmsg0(100, "truncate_dvd_dev: Opening first part (1)...\n");
    
    dev->truncating = true;
-   if (open_first_part(dcr, OPEN_READ_WRITE) < 0) {
+   if (dvd_open_first_part(dcr, OPEN_READ_WRITE) < 0) {
       Dmsg0(100, "truncate_dvd_dev: Error while opening first part (1).\n");
       dev->truncating = false;
       return false;
@@ -681,7 +682,7 @@ bool truncate_dvd_dev(DCR *dcr) {
       return false;
    }
    
-   if (open_first_part(dcr, OPEN_READ_WRITE) < 0) {
+   if (dvd_open_first_part(dcr, OPEN_READ_WRITE) < 0) {
       Dmsg0(100, "truncate_dvd_dev: Error while opening first part (2).\n");
       return false;
    }
index 85443ad3be8f20d9a22f45e7ddf9d33692b23ae0..1d0ff05c81d5418f9da1f61f0fe3cd95d18df192 100644 (file)
@@ -82,8 +82,6 @@ void    display_tape_error_status(JCR *jcr, DEVICE *dev);
 /* From dev.c */
 DEVICE  *init_dev(JCR *jcr, DEVRES *device);
 off_t    lseek_dev(DEVICE *dev, off_t offset, int whence);
-int      open_first_part(DCR *dcr, int mode);
-int      open_next_part(DCR *dcr);
 bool     can_open_mounted_dev(DEVICE *dev);
 bool     truncate_dev(DCR *dcr);
 void     term_dev(DEVICE *dev);
@@ -116,6 +114,8 @@ uint32_t dev_block(DEVICE *dev);
 uint32_t dev_file(DEVICE *dev);
 
 /* From dvd.c */
+int  dvd_open_next_part(DCR *dcr);
+bool dvd_write_part(DCR *dcr); 
 bool dvd_close_job(DCR *dcr);
 bool mount_dev(DEVICE* dev, int timeout);
 bool unmount_dev(DEVICE* dev, int timeout);
index ab50b34c8b6c51dd5680d97505b8df8d993eb94d..16719df25f994a326b41e3fcf886c93940a65e2c 100644 (file)
@@ -4,8 +4,8 @@
 
 #undef  VERSION
 #define VERSION "1.37.41"
-#define BDATE   "11 October 2005"
-#define LSMDATE "11Oct05"
+#define BDATE   "12 October 2005"
+#define LSMDATE "12Oct05"
 
 /* Debug flags */
 #undef  DEBUG