]> git.sur5r.net Git - bacula/bacula/commitdiff
Debug levels + add bsr to bls
authorKern Sibbald <kern@sibbald.com>
Wed, 21 Aug 2002 16:33:47 +0000 (16:33 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 21 Aug 2002 16:33:47 +0000 (16:33 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@113 91ce42f0-d328-0410-95d8-f526ca767f89

16 files changed:
bacula/src/dird/authenticate.c
bacula/src/dird/backup.c
bacula/src/dird/msgchan.c
bacula/src/dird/ua_cmds.c
bacula/src/filed/backup.c
bacula/src/filed/job.c
bacula/src/lib/bnet.c
bacula/src/stored/Makefile.in
bacula/src/stored/askdir.c
bacula/src/stored/bls.c
bacula/src/stored/device.c
bacula/src/stored/fd_cmds.c
bacula/src/stored/job.c
bacula/src/stored/label.c
bacula/src/stored/protos.h
bacula/src/stored/record.c

index 7f7fd6b7ee8093827eef8d02e235a037b06c1e1a..456004df8b6b509b82d58b3a9de6c5bdff2e1b78 100644 (file)
@@ -68,13 +68,13 @@ int authenticate_storage_daemon(JCR *jcr)
       Jmsg0(jcr, M_FATAL, 0, _("Director and Storage daemon passwords not the same.\n"));
       return 0;
    }
-   Dmsg1(6, ">stored: %s", sd->msg);
+   Dmsg1(116, ">stored: %s", sd->msg);
    if (bnet_recv(sd) <= 0) {
       Emsg1(M_FATAL, 0, _("bdird<stored: bad response to Hello command: ERR=%s\n"),
         bnet_strerror(sd));
       return 0;
    }
-   Dmsg1(10, "<stored: %s", sd->msg);
+   Dmsg1(110, "<stored: %s", sd->msg);
    if (strncmp(sd->msg, OKhello, sizeof(OKhello)) != 0) {
       Emsg0(M_FATAL, 0, _("Storage daemon rejected Hello command\n"));
       return 0;
@@ -101,13 +101,13 @@ int authenticate_file_daemon(JCR *jcr)
       Jmsg(jcr, M_FATAL, 0, _("Director and File daemon passwords not the same.\n"));
       return 0;
    }
-   Dmsg1(6, ">filed: %s", fd->msg);
+   Dmsg1(116, ">filed: %s", fd->msg);
    if (bnet_recv(fd) <= 0) {
       Jmsg(jcr, M_FATAL, 0, _("bdird<filed: bad response to Hello command: ERR=%s\n"),
         bnet_strerror(fd));
       return 0;
    }
-   Dmsg1(10, "<stored: %s", fd->msg);
+   Dmsg1(110, "<stored: %s", fd->msg);
    if (strncmp(fd->msg, FDOKhello, sizeof(FDOKhello)) != 0) {
       Jmsg(jcr, M_FATAL, 0, _("File daemon rejected Hello command\n"));
       return 0;
index 2abd37184d65dd6d5d3304faa718886c4048b2d7..b101b46d116e2eb6a534e38f536ecd015094bae3 100644 (file)
@@ -99,7 +99,7 @@ int do_backup(JCR *jcr)
       goto bail_out;
    }   
    jcr->jr.FileSetId = fsr.FileSetId;
-   Dmsg2(9, "Created FileSet %s record %d\n", jcr->fileset->hdr.name, 
+   Dmsg2(119, "Created FileSet %s record %d\n", jcr->fileset->hdr.name, 
       jcr->jr.FileSetId);
 
    /* Look up the last
@@ -121,7 +121,7 @@ int do_backup(JCR *jcr)
             strcpy(since, ", since=");
            strcat(since, jcr->stime);
         }
-         Dmsg1(15, "Last start time = %s\n", jcr->stime);
+         Dmsg1(115, "Last start time = %s\n", jcr->stime);
         break;
    }
 
@@ -162,7 +162,7 @@ int do_backup(JCR *jcr)
     * will be contacting him for a backup  session.
     *
     */
-   Dmsg0(10, "Open connection with storage daemon\n");
+   Dmsg0(110, "Open connection with storage daemon\n");
    jcr->JobStatus = JS_Blocked;
    /*
     * Start conversation with Storage daemon  
@@ -182,7 +182,7 @@ int do_backup(JCR *jcr)
    if (!start_storage_daemon_message_thread(jcr)) {
       goto bail_out;
    }
-   Dmsg0(50, "Storage daemon connection OK\n");
+   Dmsg0(150, "Storage daemon connection OK\n");
 
    jcr->JobStatus = JS_Blocked;
    if (!connect_to_file_daemon(jcr, 10, FDConnectTimeout, 1)) {
@@ -230,7 +230,7 @@ int do_backup(JCR *jcr)
            jcr->JobLevel, jcr->JobLevel);
         goto bail_out;
    }
-   Dmsg1(20, ">filed: %s", fd->msg);
+   Dmsg1(120, ">filed: %s", fd->msg);
    if (!response(fd, OKlevel, "Level")) {
       goto bail_out;
    }
index 82919650a9d7f566214007a6e2677fdcef2de852..9f813eff60c2374735355402721a01de064c7cdc 100644 (file)
@@ -112,14 +112,14 @@ int start_storage_daemon_job(JCR *jcr)
    unbash_spaces(jcr->client->hdr.name);
    unbash_spaces(jcr->fileset->hdr.name);
    if (bnet_recv(sd) > 0) {
-       Dmsg1(10, "<stored: %s", sd->msg);
+       Dmsg1(110, "<stored: %s", sd->msg);
        if (sscanf(sd->msg, OKjob, &jcr->VolSessionId, 
                  &jcr->VolSessionTime, &auth_key) != 3) {
           Jmsg(jcr, M_FATAL, 0, _("Storage daemon rejected Job command: %s\n"), sd->msg);
          return 0;
        } else {
          jcr->sd_auth_key = bstrdup(auth_key);
-          Dmsg1(50, "sd_auth_key=%s\n", jcr->sd_auth_key);
+          Dmsg1(150, "sd_auth_key=%s\n", jcr->sd_auth_key);
        }
    } else {
       Jmsg(jcr, M_FATAL, 0, _("<stored: bad response to Job command: %s\n"),
@@ -149,7 +149,7 @@ int start_storage_daemon_job(JCR *jcr)
    sd->msg = (char *) check_pool_memory_size(sd->msg, sizeof(device_name) +
       device_name_len + media_type_len + pool_type_len + pool_name_len);
    bnet_fsend(sd, use_device, device_name, media_type, pool_name, pool_type);
-   Dmsg1(10, ">stored: %s", sd->msg);
+   Dmsg1(110, ">stored: %s", sd->msg);
    status = response(sd, OK_device, "Use Device");
 
    free_memory(device_name);
index ea1bde9378a86f1863acf74297287925f72de4b2..4c48d64cfed4a0f2617181a31cc48345ee623dc7 100644 (file)
@@ -113,7 +113,7 @@ int do_a_command(UAContext *ua, char *cmd)
    found = 0;
    stat = 1;
 
-   Dmsg1(20, "Command: %s\n", ua->UA_sock->msg);
+   Dmsg1(120, "Command: %s\n", ua->UA_sock->msg);
    if (ua->argc == 0) {
       return 1;
    }
@@ -162,7 +162,7 @@ static int addcmd(UAContext *ua, char *cmd)
       return 1;
    }
 
-   Dmsg4(20, "id=%d Num=%d Max=%d type=%s\n", pr.PoolId, pr.NumVols,
+   Dmsg4(120, "id=%d Num=%d Max=%d type=%s\n", pr.PoolId, pr.NumVols,
       pr.MaxVols, pr.PoolType);
 
    while (pr.MaxVols > 0 && pr.NumVols >= pr.MaxVols) {
@@ -753,7 +753,7 @@ static void do_storage_setdebug(UAContext *ua, STORE *store, int level)
       bsendmsg(ua, _("Failed to connect to Storage daemon.\n"));
       return;
    }
-   Dmsg0(20, _("Connected to storage daemon\n"));
+   Dmsg0(120, _("Connected to storage daemon\n"));
    sd = ua->jcr->store_bsock;
    bnet_fsend(sd, "setdebug=%d\n", level);
    if (bnet_recv(sd) > 0) {
@@ -779,7 +779,7 @@ static void do_client_setdebug(UAContext *ua, CLIENT *client, int level)
       bsendmsg(ua, _("Failed to connect to Client.\n"));
       return;
    }
-   Dmsg0(20, "Connected to file daemon\n");
+   Dmsg0(120, "Connected to file daemon\n");
    fd = ua->jcr->file_bsock;
    bnet_fsend(fd, "setdebug=%d\n", level);
    if (bnet_recv(fd) > 0) {
@@ -823,7 +823,7 @@ static void do_all_setdebug(UAContext *ua, int level)
       }
       if (!found) {
         unique_store[i++] = store;
-         Dmsg2(40, "Stuffing: %s:%d\n", store->address, store->SDport);
+         Dmsg2(140, "Stuffing: %s:%d\n", store->address, store->SDport);
       }
    }
    UnlockRes();
@@ -855,7 +855,7 @@ static void do_all_setdebug(UAContext *ua, int level)
       }
       if (!found) {
         unique_client[i++] = client;
-         Dmsg2(40, "Stuffing: %s:%d\n", client->address, client->FDport);
+         Dmsg2(140, "Stuffing: %s:%d\n", client->address, client->FDport);
       }
    }
    UnlockRes();
@@ -880,7 +880,7 @@ static int setdebugcmd(UAContext *ua, char *cmd)
    if (!open_db(ua)) {
       return 1;
    }
-   Dmsg1(20, "setdebug:%s:\n", cmd);
+   Dmsg1(120, "setdebug:%s:\n", cmd);
 
    level = -1;
    for (i=1; i<ua->argc; i++) {
@@ -1201,14 +1201,14 @@ static void do_mount_cmd(int mount, UAContext *ua, char *cmd)
    if (!open_db(ua)) {
       return;
    }
-   Dmsg1(20, "mount: %s\n", ua->UA_sock->msg);
+   Dmsg1(120, "mount: %s\n", ua->UA_sock->msg);
 
    store = get_storage_resource(ua, cmd);
    if (!store) {
       return;
    }
 
-   Dmsg2(20, "Found storage, MediaType=%s DevName=%s\n",
+   Dmsg2(120, "Found storage, MediaType=%s DevName=%s\n",
       store->media_type, store->dev_name);
 
    ua->jcr->store = store;
@@ -1327,7 +1327,7 @@ int open_db(UAContext *ua)
       }
    }
 
-   Dmsg0(50, "Open database\n");
+   Dmsg0(150, "Open database\n");
    ua->db = db_init_database(ua->catalog->db_name, ua->catalog->db_user,
                             ua->catalog->db_password);
    if (!db_open_database(ua->db)) {
@@ -1337,7 +1337,7 @@ int open_db(UAContext *ua)
       return 0;
    }
    ua->jcr->db = ua->db;
-   Dmsg1(50, "DB %s opened\n", ua->catalog->db_name);
+   Dmsg1(150, "DB %s opened\n", ua->catalog->db_name);
    return 1;
 }
 
index 90297da5be2ff2985284880070deac046db4fdc0..3e4ddc3946fc239d129f192fa7b48c8c5cf8d2b8 100644 (file)
@@ -46,7 +46,7 @@ int blast_data_to_storage_daemon(JCR *jcr, char *addr)
 
    jcr->JobStatus = JS_Running;
 
-   Dmsg1(10, "bfiled: opened data connection %d to stored\n", sd->fd);
+   Dmsg1(110, "bfiled: opened data connection %d to stored\n", sd->fd);
 
    if (!bnet_set_buffer_size(sd, MAX_NETWORK_BUFFER_SIZE, BNET_SETBUF_WRITE)) {
       return 0;
@@ -63,7 +63,7 @@ int blast_data_to_storage_daemon(JCR *jcr, char *addr)
 
    Dmsg1(100, "set_find_options ff=%p\n", jcr->ff);
    set_find_options(jcr->ff, jcr->incremental, jcr->mtime);
-   Dmsg0(10, "start find files\n");
+   Dmsg0(110, "start find files\n");
 
    /* Subroutine save_file() is called for each file */
    /* ***FIXME**** add FSM code */
index 9bc2fc7ca8fc124597154a77d2aaf8cd8ff4e1e2..937831421d7314b85a2cccb11ba4c89c7b4152b4 100644 (file)
@@ -202,11 +202,11 @@ void *handle_client_request(void *dirp)
  */
 static int hello_cmd(JCR *jcr)
 {
-   Dmsg0(20, "Calling Authenticate\n");
+   Dmsg0(120, "Calling Authenticate\n");
    if (!authenticate_director(jcr)) {
       return 0;
    }
-   Dmsg0(20, "OK Authenticate\n");
+   Dmsg0(120, "OK Authenticate\n");
    jcr->authenticated = TRUE;
    return 1;
 }
@@ -245,7 +245,7 @@ static int setdebug_cmd(JCR *jcr)
    BSOCK *dir = jcr->dir_bsock;
    int level;
 
-   Dmsg1(10, "setdebug_cmd: %s", dir->msg);
+   Dmsg1(110, "setdebug_cmd: %s", dir->msg);
    if (sscanf(dir->msg, "setdebug=%d", &level) != 1 || level < 0) {
       bnet_fsend(dir, "2991 Bad setdebug command: %s\n", dir->msg);
       return 0;   
@@ -281,7 +281,7 @@ static int job_cmd(JCR *jcr)
    }
    jcr->sd_auth_key = bstrdup(sd_auth_key);
    free_pool_memory(sd_auth_key);
-   Dmsg2(20, "JobId=%d Auth=%s\n", jcr->JobId, jcr->sd_auth_key);
+   Dmsg2(120, "JobId=%d Auth=%s\n", jcr->JobId, jcr->sd_auth_key);
    return bnet_fsend(dir, OKjob);
 }
 
@@ -450,7 +450,7 @@ static int storage_cmd(JCR *jcr)
       Jmsg(jcr, M_FATAL, 0, _("Bad storage command: %s"), dir->msg);
       return 0;
    }
-   Dmsg2(10, "Open storage: %s:%d\n", jcr->stored_addr, stored_port);
+   Dmsg2(110, "Open storage: %s:%d\n", jcr->stored_addr, stored_port);
    /* Open command communications with Storage daemon */
    /* Try to connect for 1 hour at 10 second intervals */
    sd = bnet_connect(jcr, 10, 3600, _("Storage daemon"), 
@@ -468,7 +468,7 @@ static int storage_cmd(JCR *jcr)
       Jmsg(jcr, M_FATAL, 0, _("Failed to authenticate Storage daemon.\n"));
       return 0;
    }
-   Dmsg0(10, "Authenticated with SD.\n");
+   Dmsg0(110, "Authenticated with SD.\n");
 
    /* Send OK to Director */
    return bnet_fsend(dir, OKstore);
@@ -512,7 +512,7 @@ static int backup_cmd(JCR *jcr)
         jcr->JobStatus = JS_ErrorTerminated;
         goto cleanup;
       }
-      Dmsg1(10, "Got Ticket=%d\n", jcr->Ticket);
+      Dmsg1(110, "Got Ticket=%d\n", jcr->Ticket);
    } else {
       Jmsg(jcr, M_FATAL, 0, _("Bad response from stored to open command\n"));
       jcr->JobStatus = JS_ErrorTerminated;
@@ -537,7 +537,7 @@ static int backup_cmd(JCR *jcr)
    /*
     * Send Files to Storage daemon
     */
-   Dmsg1(10, "begin blast ff=%p\n", jcr->ff);
+   Dmsg1(110, "begin blast ff=%p\n", jcr->ff);
    if (!blast_data_to_storage_daemon(jcr, NULL)) {
       jcr->JobStatus = JS_ErrorTerminated;
    } else {
index 12ec5730e261933bc4d22065062c4b97892b591d..d68159811de741fc0e8a817598678b0b786ba808 100644 (file)
@@ -349,7 +349,7 @@ static uint32_t *bget_host_ip(char *host)
    } else {
       /******FIXME***** use gethostbyname_r or mutex ****/
       if ((hp = gethostbyname(host)) == NULL) {
-         Dmsg2(0, "gethostbyname() for %s failed: ERR=%s\n", host, strerror(errno));
+         Pmsg2(0, "gethostbyname() for %s failed: ERR=%s\n", host, strerror(errno));
         return NULL;
       }
       if (hp->h_length != sizeof(inaddr.s_addr) || hp->h_addrtype != AF_INET) {
@@ -528,7 +528,7 @@ int bnet_set_buffer_size(BSOCK *bs, uint32_t size, int rw)
          Emsg1(M_ERROR, 0, "sockopt error: %s\n", strerror(errno));
         dbuf_size -= TAPE_BSIZE;
       }
-      Dmsg1(20, "set network buffer size=%d\n", dbuf_size);
+      Dmsg1(200, "set network buffer size=%d\n", dbuf_size);
       if (dbuf_size != MAX_NETWORK_BUFFER_SIZE)
          Emsg1(M_WARNING, 0, "Warning network buffer = %d bytes not max size.\n", dbuf_size);
       if (dbuf_size % TAPE_BSIZE != 0) {
@@ -543,7 +543,7 @@ int bnet_set_buffer_size(BSOCK *bs, uint32_t size, int rw)
          Emsg1(M_ERROR, 0, "sockopt error: %s\n", strerror(errno));
         dbuf_size -= TAPE_BSIZE;
       }
-      Dmsg1(20, "set network buffer size=%d\n", dbuf_size);
+      Dmsg1(200, "set network buffer size=%d\n", dbuf_size);
       if (dbuf_size != MAX_NETWORK_BUFFER_SIZE)
          Emsg1(M_WARNING, 0, "Warning network buffer = %d bytes not max size.\n", dbuf_size);
       if (dbuf_size % TAPE_BSIZE != 0) {
index cdef7ac8bee80e2fe5865bf9ed7d34d20f2e7d40..07a58ba8132fce3a3c7c6801684eb1186d1eac60 100644 (file)
@@ -39,7 +39,8 @@ TAPESRCS = btape.c block.c dev.c device.c askdir.c label.c \
 TAPEOBJS = btape.o block.o dev.o device.o askdir.o label.o \
           record.o stored_conf.o 
 
-BLSOBJS = bls.o block.o device.o dev.o label.o record.o
+BLSOBJS = bls.o block.o device.o dev.o label.o match_bsr.o \
+         parse_bsr.o record.o
 
 BEXTOBJS = bextract.o block.o device.o dev.o label.o record.o \
           match_bsr.o parse_bsr.o
index 9908cb215c586c9b14e3e9a171d15ffb5d9df9db..bd452a7cb74dedc6a6984beace3f8bbf2ef4f159 100644 (file)
@@ -78,7 +78,7 @@ static int do_request_volume_info(JCR *jcr)
 
     jcr->VolumeName[0] = 0;          /* No volume */
     if (bnet_recv(dir) <= 0) {
-       Dmsg0(30, "getvolname error bnet_recv\n");
+       Dmsg0(130, "getvolname error bnet_recv\n");
        return 0;
     }
     if (sscanf(dir->msg, OK_media, vol->VolCatName, 
@@ -88,13 +88,13 @@ static int do_request_volume_info(JCR *jcr)
               &vol->VolCatWrites, &vol->VolCatMaxBytes, 
               &vol->VolCatCapacityBytes, vol->VolCatStatus,
               &vol->Slot) != 12) {
-       Dmsg1(30, "Bad response from Dir: %s\n", dir->msg);
+       Dmsg1(130, "Bad response from Dir: %s\n", dir->msg);
        return 0;
     }
     unbash_spaces(vol->VolCatName);
     strcpy(jcr->VolumeName, vol->VolCatName); /* set desired VolumeName */
     
-    Dmsg2(030, "do_reqest_vol_info got slot=%d Volume=%s\n", 
+    Dmsg2(130, "do_reqest_vol_info got slot=%d Volume=%s\n", 
        vol->Slot, vol->VolCatName);
     return 1;
 }
@@ -160,14 +160,14 @@ int dir_update_volume_info(JCR *jcr, VOLUME_CAT_INFO *vol, int relabel)
       vol->VolCatMounts, vol->VolCatErrors,
       vol->VolCatWrites, vol->VolCatMaxBytes, EndTime, 
       vol->VolCatStatus, vol->Slot, relabel);
-   Dmsg1(20, "update_volume_data(): %s", dir->msg);
+   Dmsg1(120, "update_volume_data(): %s", dir->msg);
    if (bnet_recv(dir) <= 0) {
-      Dmsg0(90, "updateVolCatInfo error bnet_recv\n");
+      Dmsg0(190, "updateVolCatInfo error bnet_recv\n");
       return 0;
    }
-   Dmsg1(20, "Updatevol: %s", dir->msg);
+   Dmsg1(120, "Updatevol: %s", dir->msg);
    if (strcmp(dir->msg, OK_update) != 0) {
-      Dmsg1(30, "Bad response from Dir: %s\n", dir->msg);
+      Dmsg1(130, "Bad response from Dir: %s\n", dir->msg);
       Jmsg(jcr, M_ERROR, 0, _("Error updating Volume Info: %s\n"), dir->msg);
       return 0;
    }
@@ -187,12 +187,12 @@ int dir_create_jobmedia_record(JCR *jcr)
       jcr->start_block, jcr->end_block);
    Dmsg1(100, "create_jobmedia(): %s", dir->msg);
    if (bnet_recv(dir) <= 0) {
-      Dmsg0(90, "create_jobmedia error bnet_recv\n");
+      Dmsg0(190, "create_jobmedia error bnet_recv\n");
       return 0;
    }
-   Dmsg1(020, "Create_jobmedia: %s", dir->msg);
+   Dmsg1(120, "Create_jobmedia: %s", dir->msg);
    if (strcmp(dir->msg, OK_update) != 0) {
-      Dmsg1(030, "Bad response from Dir: %s\n", dir->msg);
+      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;
    }
@@ -256,7 +256,7 @@ int dir_ask_sysop_to_mount_next_volume(JCR *jcr, DEVICE *dev)
    int dev_blocked;
    char *msg;
 
-   Dmsg0(30, "enter dir_ask_sysop_to_mount_next_volume\n");
+   Dmsg0(130, "enter dir_ask_sysop_to_mount_next_volume\n");
    ASSERT(dev->dev_blocked);
    wait_sec = min_wait;
    for ( ;; ) {
@@ -275,7 +275,7 @@ int dir_ask_sysop_to_mount_next_volume(JCR *jcr, DEVICE *dev)
          */
         if (jcr->VolumeName[0] && !(dev->capabilities & CAP_REM) &&      
              dev->capabilities & CAP_LABEL) {
-            Dmsg0(90, "Return 1 from mount without wait.\n");
+            Dmsg0(190, "Return 1 from mount without wait.\n");
            return 1;
         }
         if (dev->capabilities & CAP_ANONVOLS) {
@@ -285,7 +285,7 @@ int dir_ask_sysop_to_mount_next_volume(JCR *jcr, DEVICE *dev)
         }
          Jmsg(jcr, M_MOUNT, 0, _("%s Volume \"%s\" on Storage Device \"%s\" for Job %s\n"),
              msg, jcr->VolumeName, jcr->dev_name, jcr->Job);
-         Dmsg3(90, "Mount %s on %s for Job %s\n",
+         Dmsg3(190, "Mount %s on %s for Job %s\n",
                jcr->VolumeName, jcr->dev_name, jcr->Job);
       } else {
         jstat = JS_WaitMedia;
@@ -310,7 +310,7 @@ Use \"mount\" to resume the job.\n"),
       dir_send_job_status(jcr);
 
       for ( ;!job_cancelled(jcr); ) {
-         Dmsg1(90, "I'm going to sleep on device %s\n", dev->dev_name);
+         Dmsg1(190, "I'm going to sleep on device %s\n", dev->dev_name);
         stat = pthread_cond_timedwait(&dev->wait_next_vol, &dev->mutex, &timeout);
         if (dev->dev_blocked == BST_WAITING_FOR_SYSOP) {
            break;
@@ -337,7 +337,7 @@ Use \"mount\" to resume the job.\n"),
             Mmsg(&dev->errmsg, _("Gave up waiting to mount Storage Device \"%s\" for Job %s\n"), 
                 jcr->dev_name, jcr->Job);
             Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
-            Dmsg1(90, "Gave up waiting on device %s\n", dev->dev_name);
+            Dmsg1(190, "Gave up waiting on device %s\n", dev->dev_name);
            return 0;                 /* exceeded maximum waits */
         }
         continue;
@@ -352,7 +352,7 @@ Use \"mount\" to resume the job.\n"),
          Jmsg(jcr, M_WARNING, 0, _("pthread error in mount_next_volume stat=%d ERR=%s\n"), stat,
            strerror(stat));
       }
-      Dmsg1(90, "Someone woke me for device %s\n", dev->dev_name);
+      Dmsg1(190, "Someone woke me for device %s\n", dev->dev_name);
 
       /* Restart wait counters */
       wait_sec = min_wait;
@@ -369,7 +369,7 @@ volumes for Job=%s.\n"), jcr->Job);
    }
    jcr->JobStatus = JS_Running;
    dir_send_job_status(jcr);
-   Dmsg0(30, "leave dir_ask_sysop_to_mount_next_volume\n");
+   Dmsg0(130, "leave dir_ask_sysop_to_mount_next_volume\n");
    return 1;
 }
 
@@ -399,7 +399,7 @@ int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
    struct timezone tz;
    struct timespec timeout;
 
-   Dmsg0(30, "enter dir_ask_sysop_to_mount_next_volume\n");
+   Dmsg0(130, "enter dir_ask_sysop_to_mount_next_volume\n");
    if (!jcr->VolumeName[0]) {
       Mmsg0(&dev->errmsg, _("Cannot request another volume: no volume name given.\n"));
       return 0;
@@ -415,7 +415,7 @@ int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
       msg = _("Please mount");
       Jmsg(jcr, M_MOUNT, 0, _("%s Volume \"%s\" on Storage Device \"%s\" for Job %s\n"),
           msg, jcr->VolumeName, jcr->dev_name, jcr->Job);
-      Dmsg3(90, "Mount %s on %s for Job %s\n",
+      Dmsg3(190, "Mount %s on %s for Job %s\n",
            jcr->VolumeName, jcr->dev_name, jcr->Job);
 
       /*
@@ -432,7 +432,7 @@ int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
       dir_send_job_status(jcr);
 
       for ( ;!job_cancelled(jcr); ) {
-         Dmsg1(90, "I'm going to sleep on device %s\n", dev->dev_name);
+         Dmsg1(190, "I'm going to sleep on device %s\n", dev->dev_name);
         stat = pthread_cond_timedwait(&dev->wait_next_vol, &dev->mutex, &timeout);
         if (dev->dev_blocked == BST_WAITING_FOR_SYSOP) {
            break;
@@ -459,7 +459,7 @@ int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
             Mmsg(&dev->errmsg, _("Gave up waiting to mount Storage Device \"%s\" for Job %s\n"), 
                 jcr->dev_name, jcr->Job);
             Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
-            Dmsg1(90, "Gave up waiting on device %s\n", dev->dev_name);
+            Dmsg1(190, "Gave up waiting on device %s\n", dev->dev_name);
            return 0;                 /* exceeded maximum waits */
         }
         continue;
@@ -474,7 +474,7 @@ int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
          Jmsg(jcr, M_ERROR, 0, _("pthread error in mount_next_volume stat=%d ERR=%s\n"), stat,
            strerror(stat));
       }
-      Dmsg1(90, "Someone woke me for device %s\n", dev->dev_name);
+      Dmsg1(190, "Someone woke me for device %s\n", dev->dev_name);
 
       /* Restart wait counters */
       wait_sec = min_wait;
@@ -483,6 +483,6 @@ int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
    }
    jcr->JobStatus = JS_Running;
    dir_send_job_status(jcr);
-   Dmsg0(30, "leave dir_ask_sysop_to_mount_next_volume\n");
+   Dmsg0(130, "leave dir_ask_sysop_to_mount_next_volume\n");
    return 1;
 }
index c26634706c0e79ae7491676d8994d07021a1556e..3e405c6fd32090a8a223ac0229d9a8d434d9f175 100644 (file)
@@ -54,14 +54,17 @@ extern char BaculaId[];
 
 static FF_PKT ff;
 
+static BSR *bsr = NULL;
+
 static void usage()
 {
    fprintf(stderr,
 "Usage: bls [-d debug_level] <physical-device-name>\n"
-"       -b              list blocks\n"
+"       -b <file>       specify a bootstrap file\n"
 "       -e <file>       exclude list\n"
 "       -i <file>       include list\n"
 "       -j              list jobs\n"
+"       -k              list blocks\n"
 "       -L              list tape label\n"
 "    (none of above)    list saved files\n"
 "       -t              use default tape device\n"
@@ -83,11 +86,12 @@ int main (int argc, char *argv[])
    memset(&ff, 0, sizeof(ff));
    init_include_exclude_files(&ff);
 
-   while ((ch = getopt(argc, argv, "bd:e:i:jLtv?")) != -1) {
+   while ((ch = getopt(argc, argv, "b:d:e:i:jkLtv?")) != -1) {
       switch (ch) {
          case 'b':
-           list_blocks = TRUE;
+           bsr = parse_bsr(NULL, optarg);
            break;
+
          case 'd':                    /* debug level */
            debug_level = atoi(optarg);
            if (debug_level <= 0)
@@ -126,6 +130,10 @@ int main (int argc, char *argv[])
            list_jobs = TRUE;
            break;
 
+         case 'k':
+           list_blocks = TRUE;
+           break;
+
          case 'L':
            dump_label = TRUE;
            break;
@@ -173,6 +181,9 @@ int main (int argc, char *argv[])
       }
       do_close();
    }
+   if (bsr) {
+      free_bsr(bsr);
+   }
    return 0;
 }
 
@@ -310,10 +321,12 @@ Warning, this Volume is a continuation of Volume %s\n",
                dev->VolHdr.PrevVolName);
    }
  
+   if (verbose) {
+      rec = new_record();
+   }
    for ( ;; ) {
-
       if (!read_block_from_device(dev, block)) {
-         Dmsg0(20, "!read_record()\n");
+         Dmsg0(20, "!read_block()\n");
         if (dev->state & ST_EOT) {
            if (!mount_next_volume(infname)) {
               break;
@@ -333,7 +346,16 @@ Warning, this Volume is a continuation of Volume %s\n",
         break;
       }
 
-      printf("Block: %d size=%d\n", block->BlockNumber, block->block_len);
+      if (verbose) {
+        read_record_from_block(block, rec);
+         Pmsg6(-1, "Block: %d blen=%d First rec FI=%s SessId=%d Strm=%s rlen=%d\n",
+             block->BlockNumber, block->block_len,
+             FI_to_ascii(rec->FileIndex), rec->VolSessionId, 
+             stream_to_ascii(rec->Stream), rec->data_len);
+        rec->remainder = 0;
+      } else {
+         printf("Block: %d size=%d\n", block->BlockNumber, block->block_len);
+      }
 
    }
    return;
@@ -353,8 +375,8 @@ Warning, this Volume is a continuation of Volume %s\n",
    }
  
    for ( ;; ) {
-      if (!read_record(dev, block, rec)) {
-         Dmsg0(20, "!read_record()\n");
+      if (!read_block_from_device(dev, block)) {
+         Dmsg0(20, "!read_block()\n");
         if (dev->state & ST_EOT) {
            if (!mount_next_volume(infname)) {
               break;
@@ -367,36 +389,39 @@ Warning, this Volume is a continuation of Volume %s\n",
            continue;
         }
         if (dev->state & ST_SHORT) {
+            Pmsg0(000, "Got short block.\n");
            Emsg0(M_INFO, 0, dev->errmsg);
            continue;
         }
         display_error_status();
         break;
       }
-
-      if (debug_level >= 30) {
-         Dmsg4(30, "VolSId=%ld FI=%s Strm=%s Size=%ld\n", rec->VolSessionId,
-              FI_to_ascii(rec->FileIndex), stream_to_ascii(rec->Stream), 
-              rec->data_len);
-      }
+      while (read_record_from_block(block, rec)) {
+        if (debug_level >= 30) {
+            Dmsg4(30, "VolSId=%ld FI=%s Strm=%s Size=%ld\n", rec->VolSessionId,
+                 FI_to_ascii(rec->FileIndex), stream_to_ascii(rec->Stream), 
+                 rec->data_len);
+        }
 
 
-      /*  
-       * Check for End of File record (all zeros)
-       *    NOTE: this no longer exists
-       */
-      if (rec->VolSessionId == 0 && rec->VolSessionTime == 0) {
-         Emsg0(M_ERROR_TERM, 0, "Zero VolSessionId and VolSessionTime. This shouldn't happen\n");
-      }
+        /*  
+         * Check for End of File record (all zeros)
+         *    NOTE: this no longer exists
+         */
+        if (rec->VolSessionId == 0 && rec->VolSessionTime == 0) {
+            Emsg0(M_ERROR_TERM, 0, "Zero VolSessionId and VolSessionTime. This shouldn't happen\n");
+        }
 
-      /* 
-       * Check for Start or End of Session Record 
-       *
-       */
-      if (rec->FileIndex < 0) {
-        dump_label_record(dev, rec, verbose);
-        continue;
+        /* 
+         * Check for Start or End of Session Record 
+         *
+         */
+        if (rec->FileIndex < 0) {
+           dump_label_record(dev, rec, verbose);
+           continue;
+        }
       }
+      rec->remainder = 0;
    }
    return;
 }
@@ -424,6 +449,8 @@ Warning, this Volume is a continuation of Volume %s\n",
    }
  
    for ( ;; ) {
+      SESSION_LABEL sessrec;
+
       if (!read_record(dev, block, rec)) {
          Dmsg0(20, "!read_record()\n");
         if (dev->state & ST_EOT) {
@@ -465,7 +492,47 @@ Warning, this Volume is a continuation of Volume %s\n",
        *
        */
       if (rec->FileIndex < 0) {
-        dump_label_record(dev, rec, 0);
+        char *rtype;
+        memset(&sessrec, 0, sizeof(sessrec));
+        switch (rec->FileIndex) {
+           case PRE_LABEL:
+               rtype = "Fresh Volume Label";   
+              break;
+           case VOL_LABEL:
+               rtype = "Volume Label";
+              unser_volume_label(dev, rec);
+              break;
+           case SOS_LABEL:
+               rtype = "Begin Session";
+              unser_session_label(&sessrec, rec);
+              break;
+           case EOS_LABEL:
+               rtype = "End Session";
+              break;
+           case EOM_LABEL:
+               rtype = "End of Media";
+              break;
+           default:
+               rtype = "Unknown";
+              break;
+        }
+        if (debug_level > 0) {
+            printf("%s Record: VolSessionId=%d VolSessionTime=%d JobId=%d DataLen=%d\n",
+              rtype, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len);
+        }
+
+         Dmsg1(40, "Got label = %d\n", rec->FileIndex);
+        if (rec->FileIndex == EOM_LABEL) { /* end of tape? */
+            Dmsg0(40, "Get EOM LABEL\n");
+           break;                         /* yes, get out */
+        }
+        continue;                         /* ignore other labels */
+      } /* end if label record */
+
+      /* 
+       * Apply BSR filter
+       */
+      if (bsr && !match_bsr(bsr, rec, &dev->VolHdr, &sessrec)) {
         continue;
       }
 
index a14a78b59e3bde769fc77b6f67fd1646cfdc3373..bf3bcc48753e934148049d0fb2dd853e7ad742e3 100644 (file)
@@ -100,7 +100,7 @@ int acquire_device_for_append(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
    int do_mount = 0;
 
    lock_device(dev);
-   Dmsg1(90, "acquire_append device is %s\n", dev_is_tape(dev)?"tape":"disk");
+   Dmsg1(190, "acquire_append device is %s\n", dev_is_tape(dev)?"tape":"disk");
 
 
    if (dev->state & ST_APPEND) {
@@ -187,7 +187,7 @@ int release_device(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
 
    } else if (dev->num_writers > 0) {
       dev->num_writers--;
-      Dmsg1(90, "There are %d writers in release_device\n", dev->num_writers);
+      Dmsg1(00, "There are %d writers in release_device\n", dev->num_writers);
       if (dev->num_writers == 0) {
         weof_dev(dev, 1);
          Dmsg0(100, "dir_create_jobmedia_record. Release\n");
@@ -234,7 +234,7 @@ static int mount_next_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, int releas
 {
    int recycle, ask, retry = 0, autochanger;
 
-   Dmsg0(90, "Enter mount_next_volume()\n");
+   Dmsg0(190, "Enter mount_next_volume()\n");
 
 mount_next_vol:
    if (retry++ > 5) {
@@ -415,7 +415,7 @@ read_volume:
             Dmsg1(500, "Vol NO_LABEL or IO_ERROR name=%s\n", jcr->VolumeName);
            /* If permitted, create a label */
            if (dev->capabilities & CAP_LABEL) {
-               Dmsg0(90, "Create volume label\n");
+               Dmsg0(190, "Create volume label\n");
               if (!write_volume_label_to_dev(jcr, (DEVRES *)dev->device, jcr->VolumeName,
                      jcr->pool_name)) {
                  goto mount_next_vol;
@@ -454,7 +454,7 @@ read_volume:
     *  If the tape is marked as Recycle, we rewrite the label.
     */
    if (dev->VolHdr.LabelType == PRE_LABEL || recycle) {
-      Dmsg1(90, "ready_for_append found freshly labeled volume. dev=%x\n", dev);
+      Dmsg1(190, "ready_for_append found freshly labeled volume. dev=%x\n", dev);
       dev->VolHdr.LabelType = VOL_LABEL; /* set Volume label */
       write_volume_label_to_block(jcr, dev, block);
       /*
@@ -514,7 +514,7 @@ read_volume:
        * we need to position to the end of the volume, since we are
        * just now putting it into append mode.
        */
-      Dmsg0(20, "Device previously written, moving to end of data\n");
+      Dmsg0(200, "Device previously written, moving to end of data\n");
       Jmsg(jcr, M_INFO, 0, _("Volume %s previously written, moving to end of data.\n"),
         jcr->VolumeName);
       if (!eod_dev(dev)) {
@@ -562,13 +562,13 @@ read_volume:
 int ready_dev_for_read(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
 {
    if (!(dev->state & ST_OPENED)) {
-       Dmsg1(20, "bstored: open vol=%s\n", jcr->VolumeName);
+       Dmsg1(120, "bstored: open vol=%s\n", jcr->VolumeName);
        if (open_dev(dev, jcr->VolumeName, READ_ONLY) < 0) {
           Jmsg(jcr, M_FATAL, 0, _("Open device %s volume %s failed, ERR=%s\n"), 
              dev_name(dev), jcr->VolumeName, strerror_dev(dev));
          return 0;
        }
-       Dmsg1(29, "open_dev %s OK\n", dev_name(dev));
+       Dmsg1(129, "open_dev %s OK\n", dev_name(dev));
    }
 
    for (;;) {
@@ -627,7 +627,7 @@ int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
    wait_time = time(NULL);
    status_dev(dev, &stat);
    if (stat & MT_EOD) {
-      Dmsg0(90, "======= Got EOD ========\n");
+      Dmsg0(190, "======= Got EOD ========\n");
 
       block_device(dev, BST_DOING_ACQUIRE);
 
@@ -654,7 +654,7 @@ int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
            dev->VolCatInfo.VolCatName, jcr->Job);
         return 0;                    /* device locked */
       }
-      Dmsg0(90, "Back from update_vol_info\n");
+      Dmsg0(190, "Back from update_vol_info\n");
 
       strcpy(PrevVolName, dev->VolCatInfo.VolCatName);
       strcpy(dev->VolHdr.PrevVolName, PrevVolName);
@@ -685,9 +685,9 @@ int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
        *  used tape, mount_next_volume() will return an
        *  empty label_blk, and nothing will be written.
        */
-      Dmsg0(90, "write label block to dev\n");
+      Dmsg0(190, "write label block to dev\n");
       if (!write_block_to_dev(dev, label_blk)) {
-         Dmsg1(0, "write_block_to_device Volume label failed. ERR=%s",
+         Pmsg1(0, "write_block_to_device Volume label failed. ERR=%s",
           strerror_dev(dev));
         free_block(label_blk);
         unblock_device(dev);
@@ -695,9 +695,9 @@ int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
       }
 
       /* Write overflow block to tape */
-      Dmsg0(90, "Write overflow block to dev\n");
+      Dmsg0(190, "Write overflow block to dev\n");
       if (!write_block_to_dev(dev, block)) {
-         Dmsg1(0, "write_block_to_device overflow block failed. ERR=%s",
+         Pmsg1(0, "write_block_to_device overflow block failed. ERR=%s",
           strerror_dev(dev));
         free_block(label_blk);
         unblock_device(dev);
@@ -705,7 +705,7 @@ int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
       }
 
       jcr->NumVolumes++;
-      Dmsg0(90, "Wake up any waiting threads.\n");
+      Dmsg0(190, "Wake up any waiting threads.\n");
       free_block(label_blk);
       for (JCR *mjcr=NULL; (mjcr=next_attached_jcr(dev, mjcr)); ) {
         /* Set new start/end positions */
@@ -740,7 +740,7 @@ int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
  */
 int open_device(DEVICE *dev)
 {
-   Dmsg0(20, "start open_output_device()\n");
+   Dmsg0(120, "start open_output_device()\n");
    if (!dev) {
       return 0;
    }
@@ -749,20 +749,20 @@ int open_device(DEVICE *dev)
 
    /* Defer opening files */
    if (!dev_is_tape(dev)) {
-      Dmsg0(29, "Device is file, deferring open.\n");
+      Dmsg0(129, "Device is file, deferring open.\n");
       unlock_device(dev);
       return 1;
    }
 
    if (!(dev->state & ST_OPENED)) {
-      Dmsg0(29, "Opening device.\n");
+      Dmsg0(129, "Opening device.\n");
       if (open_dev(dev, NULL, READ_WRITE) < 0) {
          Emsg1(M_FATAL, 0, _("dev open failed: %s\n"), dev->errmsg);
         unlock_device(dev);
         return 0;
       }
    }
-   Dmsg1(29, "open_dev %s OK\n", dev_name(dev));
+   Dmsg1(129, "open_dev %s OK\n", dev_name(dev));
 
    unlock_device(dev);
    return 1;
@@ -778,7 +778,7 @@ void lock_device(DEVICE *dev)
 {
    int stat;
 
-   Dmsg1(90, "lock %d\n", dev->dev_blocked);
+   Dmsg1(190, "lock %d\n", dev->dev_blocked);
    P(dev->mutex);
    if (dev->dev_blocked && !pthread_equal(dev->no_wait_id, pthread_self())) {
       dev->num_waiting++;            /* indicate that I am waiting */
@@ -795,7 +795,7 @@ void lock_device(DEVICE *dev)
 
 void unlock_device(DEVICE *dev) 
 {
-   Dmsg0(90, "unlock\n");
+   Dmsg0(190, "unlock\n");
    V(dev->mutex);
 }
 
@@ -809,7 +809,7 @@ void unlock_device(DEVICE *dev)
  */
 void block_device(DEVICE *dev, int state)
 {
-   Dmsg1(90, "block set %d\n", state);
+   Dmsg1(190, "block set %d\n", state);
    ASSERT(dev->dev_blocked == BST_NOT_BLOCKED);
    dev->dev_blocked = state;         /* make other threads wait */
    dev->no_wait_id = pthread_self();  /* allow us to continue */
@@ -820,7 +820,7 @@ void block_device(DEVICE *dev, int state)
  */
 void unblock_device(DEVICE *dev)
 {
-   Dmsg1(90, "unblock %d\n", dev->dev_blocked);
+   Dmsg1(190, "unblock %d\n", dev->dev_blocked);
    ASSERT(dev->dev_blocked);
    dev->dev_blocked = BST_NOT_BLOCKED;
    if (dev->num_waiting > 0) {
index f77fc060697451c8e210486c645ef97e7890fc3a..91714180ab2076fc510a6cea8ba58f6bc8bbd660 100644 (file)
@@ -111,7 +111,7 @@ void run_job(JCR *jcr)
    char ec1[30];
 
 
-   Dmsg1(20, "Start run Job=%s\n", jcr->Job);
+   Dmsg1(120, "Start run Job=%s\n", jcr->Job);
    bnet_fsend(dir, Job_start, jcr->Job); 
    time(&jcr->start_time);
    jcr->run_time = jcr->start_time;
@@ -164,7 +164,7 @@ static int append_data_cmd(JCR *jcr)
 
    Dmsg1(120, "Append data: %s", fd->msg);
    if (jcr->session_opened) {
-      Dmsg1(10, "<bfiled: %s", fd->msg);
+      Dmsg1(110, "<bfiled: %s", fd->msg);
       if (do_append_data(jcr)) {
         bnet_fsend(fd, OK_append);
         jcr->JobType = JT_BACKUP;
@@ -296,7 +296,7 @@ static int read_open_session(JCR *jcr)
         jcr->read_EndBlock);
    }
 
-   Dmsg1(10, "Read open session: %s\n", dev_name(jcr->device->dev));
+   Dmsg1(110, "Read open session: %s\n", dev_name(jcr->device->dev));
 
    jcr->session_opened = TRUE;
    jcr->JobType = JT_RESTORE;
index 897e38df44eb5a49c8b3732a28a2f2663b4eb1a0..45412246b0db4961c4e1e5100f334e9d7100b3a7 100644 (file)
@@ -75,7 +75,7 @@ int job_cmd(JCR *jcr)
     * Get JobId and permissions from Director
     */
 
-   Dmsg1(30, "Job_cmd: %s\n", dir->msg);
+   Dmsg1(130, "Job_cmd: %s\n", dir->msg);
    job = get_memory(dir->msglen);
    job_name = get_memory(dir->msglen);
    client_name = get_memory(dir->msglen);
@@ -126,7 +126,7 @@ int job_cmd(JCR *jcr)
    srandom(tv.tv_usec + tv.tv_sec);
    sprintf(auth_key, "%ld", (long)random());
    bnet_fsend(dir, OKjob, jcr->VolSessionId, jcr->VolSessionTime, auth_key);
-   Dmsg1(10, ">dird: %s", dir->msg);
+   Dmsg1(110, ">dird: %s", dir->msg);
    jcr->sd_auth_key = bstrdup(auth_key);
 
    /*
@@ -172,7 +172,7 @@ void connection_from_filed(void *arg)
    BSOCK *fd = (BSOCK *)arg;
    char job_name[MAX_NAME_LENGTH];
 
-   Dmsg0(10, "enter connection_from_filed\n");
+   Dmsg0(110, "enter connection_from_filed\n");
    if (bnet_recv(fd) <= 0) {
       Emsg0(M_FATAL, 0, _("Unable to authenticate Client.\n"));
       return;
@@ -198,7 +198,7 @@ void handle_filed_connection(BSOCK *fd, char *job_name)
 
    jcr->file_bsock = fd;
 
-   Dmsg1(10, "Found Job %s\n", job_name);
+   Dmsg1(110, "Found Job %s\n", job_name);
 
    if (jcr->authenticated) {
       Pmsg2(000, "Hey!!!! JobId %d Job %s already authenticated.\n", 
@@ -213,7 +213,7 @@ void handle_filed_connection(BSOCK *fd, char *job_name)
       Jmsg(jcr, M_FATAL, 0, _("Unable to authenticate File daemon\n"));
    } else {
       jcr->authenticated = TRUE;
-      Dmsg1(10, "OK Authentication Job %s\n", jcr->Job);
+      Dmsg1(110, "OK Authentication Job %s\n", jcr->Job);
    }
 
    P(jcr->mutex);
@@ -246,7 +246,7 @@ static int use_device_cmd(JCR *jcr)
       return 0;
    }
    
-   Dmsg1(20, "Use device: %s", dir->msg);
+   Dmsg1(120, "Use device: %s", dir->msg);
    dev_name = get_memory(dir->msglen);
    media_type = get_memory(dir->msglen);
    pool_name = get_memory(dir->msglen);
@@ -261,7 +261,7 @@ static int use_device_cmd(JCR *jcr)
       while ((device=(DEVRES *)GetNextRes(R_DEVICE, (RES *)device))) {
         /* Find resource, and make sure we were able to open it */
         if (strcmp(device->hdr.name, dev_name) == 0 && device->dev) {
-            Dmsg1(20, "Found device %s\n", device->hdr.name);
+            Dmsg1(120, "Found device %s\n", device->hdr.name);
            jcr->pool_name = get_memory(strlen(pool_name) + 1);
            strcpy(jcr->pool_name, pool_name);
            jcr->pool_type = get_memory(strlen(pool_type) + 1);
@@ -271,7 +271,7 @@ static int use_device_cmd(JCR *jcr)
            jcr->dev_name = get_memory(strlen(dev_name) + 1);
            strcpy(jcr->dev_name, dev_name);
            jcr->device = device;
-           Dmsg4(20, use_device, dev_name, media_type, pool_name, pool_type);
+           Dmsg4(120, use_device, dev_name, media_type, pool_name, pool_type);
            free_memory(dev_name);
            free_memory(media_type);
            free_memory(pool_name);
index a483f4b59f8b236cb47a85b3b75adfd787bc827a..09c095285d68f6c1866ff980a5395ae59f513741 100644 (file)
@@ -481,16 +481,20 @@ int write_session_label(JCR *jcr, DEV_BLOCK *block, int label)
    create_session_label(jcr, rec, label);
    rec->FileIndex = label;
 
-   if (!write_record_device(jcr, dev, block, rec)) {
-      Jmsg(jcr, M_FATAL, 0, _("Error writing Session label to %s: %s\n"), 
-                       dev_vol_name(dev), strerror(errno));
-      free_record(rec);
-      return 0;
+   while (!write_record_to_block(block, rec)) {
+      Dmsg2(190, "!write_record data_len=%d rem=%d\n", rec->data_len,
+                rec->remainder);
+      if (!write_block_to_device(jcr, dev, block)) {
+         Dmsg0(90, "Got session label write_block_to_dev error.\n");
+         Jmsg(jcr, M_FATAL, 0, _("Error writing Session label to %s: %s\n"), 
+                          dev_vol_name(dev), strerror(errno));
+        free_record(rec);
+        return 0;
+      }
    }
 
-   Dmsg1(90, "session_label record=%x\n", rec);
-   Dmsg5(90, "sesson_label record FI=%s SessId=%d Strm=%s len=%d\n\
-remainder=%d\n",
+   Dmsg6(20, "Write sesson_label record JobId=%d FI=%s SessId=%d Strm=%s len=%d\n\
+remainder=%d\n", jcr->JobId,
       FI_to_ascii(rec->FileIndex), rec->VolSessionId, 
       stream_to_ascii(rec->Stream), rec->data_len,
       rec->remainder);
index 8cb2be8e8034266bda162acb8420b1773070884c..d550a2a437dbce2878adcc2d00446718bfbf2a16 100644 (file)
@@ -148,4 +148,3 @@ int read_record_from_block(DEV_BLOCK *block, DEV_RECORD *rec);
 DEV_RECORD *new_record();
 void   free_record(DEV_RECORD *rec);
 int    read_record(DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *record);
-int    write_record_device(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *record);
index d7dc3eb4537efe18e6514172bc17c5df67060412..edfb265b68f16b11007a8fd488205291f60d9a6b 100644 (file)
@@ -142,32 +142,6 @@ int read_record(DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *record)
 }
 
 
-/*
- * Write a record to block 
- *   if necessary, write the block to the device with locking
- *   if necessary, handle getting a new Volume
- *
- *  Returns: 0 on failure
- *          1 on success
- */
-int write_record_device(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *record)
-{
-   Dmsg2(190, "write_device() dev=%x state=%x\n", dev, dev->state);
-
-   while (!write_record_to_block(block, record)) {
-      Dmsg2(190, "!write_record data_len=%d rem=%d\n", record->data_len,
-                record->remainder);
-      if (!write_block_to_device(jcr, dev, block)) {
-         Dmsg0(90, "Got write_block_to_dev error.\n");
-        return 0;
-      }
-   }
-   Dmsg4(190, "write_record FI=%s SessId=%d Strm=%s len=%d\n",
-      FI_to_ascii(record->FileIndex), record->VolSessionId, 
-      stream_to_ascii(record->Stream), record->data_len);
-   return 1;
-}
-
 /*
  * Write a Record to the block
  *