]> git.sur5r.net Git - bacula/bacula/commitdiff
- Add more debug code and clarify debug code for DVDs.
authorKern Sibbald <kern@sibbald.com>
Mon, 13 Jun 2005 20:58:11 +0000 (20:58 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 13 Jun 2005 20:58:11 +0000 (20:58 +0000)
- Do not save and restore state in open_first_part()
  since state should be properly set after open_dev().

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

bacula/kes-1.37
bacula/src/stored/acquire.c
bacula/src/stored/dev.c
bacula/src/stored/dev.h
bacula/src/stored/dvd.c
bacula/src/version.h

index 72df675cb8585295c954e22e7574cd2acf424cb6..12aec23491d79c707ae3ea7e1cce767ad7eb323e 100644 (file)
@@ -5,6 +5,9 @@ General:
 
 Changes to 1.37.22:
 13Jun05
+- Add more debug code and clarify debug code for DVDs.
+- Do not save and restore state in open_first_part() 
+  since state should be properly set after open_dev().
 - Make default mandir /usr/share/man
 - Install Bacula man page.
 - Implement passing of FileSet Enable VSS to FD.
index 8529b29f6c48be4e63ef09b6f4ce0cb54711ab01..a9e676dcdc3641671ffc013419b90fdeeb1deb27 100644 (file)
@@ -315,7 +315,8 @@ DCR *acquire_device_for_append(DCR *dcr)
    init_device_wait_timers(dcr);
 
    dev->block(BST_DOING_ACQUIRE);
-   Dmsg1(190, "acquire_append device is %s\n", dev->is_tape()?"tape":"disk");
+   Dmsg1(190, "acquire_append device is %s\n", dev->is_tape()?"tape":
+        (dev->is_dvd()?"DVD":"disk"));
 
    if (dcr->reserved_device) {
       dev->reserved_device--;
index 227d11f7176c831ee3b8e25bc7fa3c2682230ef7..d173a932ea30722a72c17abf90757fd9a03f2efb 100644 (file)
@@ -427,7 +427,8 @@ static void open_file_device(DEVICE *dev, int mode)
       return;
    }
          
-   Dmsg2(29, "open_dev: device is disk %s (mode:%d)\n", archive_name.c_str(), mode);
+   Dmsg3(29, "open_dev: device is %s (mode:%d)\n", dev->is_dvd()?"DVD":"disk",
+         archive_name.c_str(), mode);
    dev->openmode = mode;
    
    /*
@@ -448,6 +449,7 @@ static void open_file_device(DEVICE *dev, int mode)
       Emsg0(M_ABORT, 0, _("Illegal mode given to open_dev.\n"));
    }
    /* If creating file, give 0640 permissions */
+   Dmsg2(29, "open(%s, 0x%x, 0640)\n", archive_name.c_str(), dev->mode);
    if ((dev->fd = open(archive_name.c_str(), dev->mode, 0640)) < 0) {
       berrno be;
       dev->dev_errno = errno;
@@ -469,7 +471,9 @@ static void open_file_device(DEVICE *dev, int mode)
          dev->part_size = filestat.st_size;
       }
    }
-   Dmsg4(29, "open_dev: disk fd=%d opened, part=%d/%d, part_size=%u\n", dev->fd, dev->part, dev->num_parts, dev->part_size);
+   Dmsg5(29, "open_dev: %s fd=%d opened, part=%d/%d, part_size=%u\n", 
+      dev->is_dvd()?"DVD":"disk", dev->fd, dev->part, dev->num_parts, 
+      dev->part_size);
    if (dev->is_dvd() && (dev->mode != OPEN_READ_ONLY) && 
        (dev->free_space_errno == 0 || dev->num_parts == dev->part)) {
       update_free_space_dev(dev);
index 2988caf884fe8657131ab00a534d115fcbc69f22..689f1a40b66cd53b710cfe432ed1c72de86b5922 100644 (file)
@@ -43,7 +43,7 @@
 
 /* Arguments to open_dev() */
 enum {
-   OPEN_READ_WRITE = 0,
+   OPEN_READ_WRITE = 1,
    OPEN_READ_ONLY,
    OPEN_WRITE_ONLY
 };
index e95896d6d7a3d214955528dd596e2f2776a4da01..85848208626059aab442170995f7b011a7576fef 100644 (file)
    Copyright (C) 2005 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of
-   the License, or (at your option) any later version.
+   modify it under the terms of the GNU General Public License
+   version 2 as ammended with additional clauses defined in the
+   file LICENSE in the main source directory.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with this program; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-   MA 02111-1307, USA.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
+   the file LICENSE for additional details.
 
  */
 
@@ -327,6 +322,7 @@ void update_free_space_dev(DEVICE* dev)
    char* icmd;
    int timeout;
    long long int free;
+   char ed1[50];
    
    icmd = dev->device->free_space_command;
    
@@ -347,7 +343,6 @@ void update_free_space_dev(DEVICE* dev)
    timeout = 3;
    
    while (1) {
-      char ed1[50];
       if (run_program_full_output(ocmd.c_str(), dev->max_open_wait/2, results) == 0) {
          Dmsg1(100, "Free space program run : %s\n", results);
          free = str_to_int64(results);
@@ -380,7 +375,8 @@ void update_free_space_dev(DEVICE* dev)
    }
    
    free_pool_memory(results);
-   Dmsg2(29, "update_free_space_dev: free_space=%lld, free_space_errno=%d\n", dev->free_space, dev->free_space_errno);
+   Dmsg2(29, "update_free_space_dev: free_space=%s, free_space_errno=%d\n", 
+      edit_uint64(dev->free_space, ed1), dev->free_space_errno);
    return;
 }
 
@@ -508,25 +504,25 @@ int open_next_part(DEVICE *dev) {
  *  - Close the fd
  *  - Reopen the device
  */
-int open_first_part(DEVICE *dev) {
-   int state;
-      
+int open_first_part(DEVICE *dev) 
+{
    Dmsg3(29, "open_first_part %s %s %d\n", dev->dev_name, dev->VolCatInfo.VolCatName, dev->openmode);
    if (dev->fd >= 0) {
       close(dev->fd);
    }
-   
    dev->fd = -1;
-   state = dev->state;
    dev->state &= ~ST_OPENED;
    
    dev->part_start = 0;
    dev->part = 0;
    
+   Dmsg2(50, "Call open_dev(dev, vol=%s, mode=%d",
+        dev->VolCatInfo.VolCatName, dev->openmode);
    if (open_dev(dev, dev->VolCatInfo.VolCatName, dev->openmode) < 0) {
+      Dmsg0(50, "open_dev() failed\n");
       return -1;
    }
-   dev->state = state;
+   Dmsg1(50, "Leave open_first_part state=%s\n", dev->is_open()?"open":"not open");
    return dev->fd;
 }
 
index 83ca8cb709e337527a4817e1b585a7a1004e6bca..e0493d17cdedb85b1f56fef61246d9d747a3f03d 100644 (file)
@@ -1,8 +1,8 @@
 /* */
 #undef  VERSION
 #define VERSION "1.37.22"
-#define BDATE   "12 June 2005"
-#define LSMDATE "12Jun05"
+#define BDATE   "14 June 2005"
+#define LSMDATE "14Jun05"
 
 /* Debug flags */
 #undef  DEBUG