]> git.sur5r.net Git - bacula/bacula/commitdiff
Eliminate email address + start on POOLMEM + fix bscan
authorKern Sibbald <kern@sibbald.com>
Tue, 10 Jun 2003 16:02:22 +0000 (16:02 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 10 Jun 2003 16:02:22 +0000 (16:02 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@575 91ce42f0-d328-0410-95d8-f526ca767f89

15 files changed:
bacula/kernstodo
bacula/src/baconfig.h
bacula/src/bacula.h
bacula/src/bc_types.h
bacula/src/cats/sql_get.c
bacula/src/lib/attr.c
bacula/src/lib/bnet.c
bacula/src/lib/bpipe.c
bacula/src/lib/bsys.c
bacula/src/lib/cram-md5.c
bacula/src/lib/jcr.c
bacula/src/lib/message.c
bacula/src/stored/bscan.c
bacula/src/stored/read_record.c
bacula/src/version.h

index fe52edebffa43e4224da025b925008dd8ec7b657..313859278b5b6ef1ce8d13d63d7dc20777c901bc 100644 (file)
@@ -1,5 +1,5 @@
                  Kern's ToDo List
-                  06 June 2003 
+                  10 June 2003 
 
 Documentation to do: (any release a little bit at a time)
 - Document running a test version.
@@ -73,7 +73,6 @@ For 1.31 release:
 - Add next Volume to be used to status output.
 - Add a recycle command.
 - Make bootstrap filename unique.
-- Implement FileSet VolIndex -- done, but must update old records.
 - Sort JobIds entered into recover tree.
 - The bsr for Dan's job has file indexes covering the whole range rather
   than only the range contained on the volume.
@@ -975,3 +974,4 @@ Done: (see kernsdone for more)
 - Implement Release Storage=xxx
 - Fix restore on Win95/98  
 - Remove the Jmsg() in sql_find.c:102 or only print on hard error.
+- Implement FileSet VolIndex -- done, but must update old records.
index 4a7dc15d97ee459f3d2ef1255936e10a0a04d9a0..be964a624ff7ba807984cca44935ee6a821e2d4c 100644 (file)
@@ -377,7 +377,7 @@ extern void _v(char *file, int line, pthread_mutex_t *m);
 #define Mmsg15(buf,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15) m_msg(__FILE__,__LINE__,buf,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15)
 
 /* Edit message into Pool Memory buffer -- no __FILE__ and __LINE__ */
-int  Mmsg(char **msgbuf, char *fmt,...);
+int  Mmsg(POOLMEM **msgbuf, char *fmt,...);
 
 
 struct JCR;
@@ -385,7 +385,7 @@ void d_msg(char *file, int line, int level, char *fmt,...);
 void p_msg(char *file, int line, int level, char *fmt,...);
 void e_msg(char *file, int line, int type, int level, char *fmt,...);
 void j_msg(char *file, int line, JCR *jcr, int type, int level, char *fmt,...);
-int  m_msg(char *file, int line, char **msgbuf, char *fmt,...);
+int  m_msg(char *file, int line, POOLMEM **msgbuf, char *fmt,...);
 
 
 /* Use our strdup with smartalloc */
index d8ed8df41a713a6a59f4e28ce36c37c53c30778d..ba6c5a262046c27b8b410395014f2e8adf08263b 100644 (file)
@@ -95,8 +95,8 @@
  *  includes before these.  
  */
 #include "version.h"
-#include "baconfig.h"
 #include "bc_types.h"
+#include "baconfig.h"
 #include "lib/lib.h"
 
 #ifndef HAVE_ZLIB_H
index aa63873720f3f2f20988e40a2610e138216dfe19..e0916b2ecec811fdcafe61cfc24e0289a7f91775 100644 (file)
 #ifndef __bc_types_INCLUDED
 #define __bc_types_INCLUDED
 
-typedef char POOLMEM;
+typedef char POOLMEM;   
+#define mp_chr(x) x
+#ifdef xxxxx
+#define mp_chr(x) ((char*)(x))
+struct POOLMEM { };
+#endif
 
 /* Types */
 
index 7369abbcc9d5cc5cd88e433c9cd70c22d4c5fad9..eb658aa2787b9d9ebf0e40df5d21d571f7554626 100644 (file)
@@ -627,7 +627,7 @@ int db_get_fileset_record(JCR *jcr, B_DB *mdb, FILESET_DBR *fsr)
            "WHERE FileSetId=%u", fsr->FileSetId);
    } else {                          /* find by name */
       Mmsg(&mdb->cmd, 
-           "SELECT FileSetId,FileSet,CreateTime MD5,FROM FileSet "
+           "SELECT FileSetId,FileSet,CreateTime,MD5 FROM FileSet "
            "WHERE FileSet='%s'", fsr->FileSet);
    }  
 
index bd30d9e792845fa8ed109ba52fdbf20b2e77a2fb..4147da5670a6690313eca4e97d662e628170b60d 100644 (file)
@@ -103,8 +103,8 @@ int unpack_attributes_record(JCR *jcr, int32_t stream, char *rec, ATTR *attr)
    Dmsg7(200, "unpack_attr FI=%d Type=%d fname=%s attr=%s lname=%s attrEx=%s ds=%d\n",
       attr->file_index, attr->type, attr->fname, attr->attr, attr->lname,
       attr->attrEx, attr->data_stream);
-   *attr->ofname = 0;
-   *attr->olname = 0;
+   *mp_chr(attr->ofname) = 0;
+   *mp_chr(attr->olname) = 0;
    return 1;
 }
 
@@ -153,7 +153,7 @@ void build_attr_output_fnames(JCR *jcr, ATTR *attr)
            pm_strcpy(&attr->olname, jcr->where);
            add_link = true;
         } else {
-           attr->olname[0] = 0;
+           mp_chr(attr->olname)[0] = 0;
            add_link = false;
         }
          if (win32_client && attr->lname[1] == ':') {
@@ -193,7 +193,7 @@ void print_ls_output(JCR *jcr, ATTR *attr)
    p = encode_time(attr->statp.st_ctime, p);
    *p++ = ' ';
    *p++ = ' ';
-   for (f=attr->ofname; *f && (p-buf) < (int)sizeof(buf)-10; ) {
+   for (f=mp_chr(attr->ofname); *f && (p-buf) < (int)sizeof(buf)-10; ) {
       *p++ = *f++;
    }
    if (attr->type == FT_LNK) {
@@ -202,7 +202,7 @@ void print_ls_output(JCR *jcr, ATTR *attr)
       *p++ = '>';
       *p++ = ' ';
       /* Copy link name */
-      for (f=attr->olname; *f && (p-buf) < (int)sizeof(buf)-10; ) {
+      for (f=mp_chr(attr->olname); *f && (p-buf) < (int)sizeof(buf)-10; ) {
         *p++ = *f++;
       }
    }
index b274f93781e5452c61781ce1e4fe5c3d4bb9e930..58868caf09d6aeb7addb939aa494037782479744 100644 (file)
@@ -138,7 +138,7 @@ int32_t bnet_recv(BSOCK *bsock)
    int32_t nbytes;
    int32_t pktsiz;
 
-   bsock->msg[0] = 0;
+   mp_chr(bsock->msg)[0] = 0;
    if (bsock->errors || bsock->terminated) {
       return BNET_HARDEOF;
    }
@@ -198,7 +198,7 @@ int32_t bnet_recv(BSOCK *bsock)
    bsock->timer_start = watchdog_time; /* set start wait time */
    bsock->timed_out = 0;
    /* now read the actual data */
-   if ((nbytes = read_nbytes(bsock, bsock->msg, pktsiz)) <=  0) {
+   if ((nbytes = read_nbytes(bsock, mp_chr(bsock->msg), pktsiz)) <=  0) {
       bsock->timer_start = 0;        /* clear timer */
       if (errno == 0) {
         bsock->b_errno = ENODATA;
@@ -224,7 +224,7 @@ int32_t bnet_recv(BSOCK *bsock)
     * string that was send to us. Note, we ensured above that the
     * buffer is at least one byte longer than the message length.
     */
-   bsock->msg[nbytes] = 0;           /* terminate in case it is a string */
+   mp_chr(bsock->msg)[nbytes] = 0;    /* terminate in case it is a string */
    sm_check(__FILE__, __LINE__, False);
    return nbytes;                    /* return actual length of message */
 }
@@ -344,7 +344,7 @@ bnet_send(BSOCK *bsock)
    /* send data packet */
    bsock->timer_start = watchdog_time; /* start timer */
    bsock->timed_out = 0;              
-   rc = write_nbytes(bsock, bsock->msg, bsock->msglen);
+   rc = write_nbytes(bsock, mp_chr(bsock->msg), bsock->msglen);
    bsock->timer_start = 0;           /* clear timer */
    if (rc != bsock->msglen) {
       bsock->errors++;
@@ -629,7 +629,7 @@ bnet_fsend(BSOCK *bs, char *fmt, ...)
 again:
    maxlen = sizeof_pool_memory(bs->msg) - 1;
    va_start(arg_ptr, fmt);
-   bs->msglen = bvsnprintf(bs->msg, maxlen, fmt, arg_ptr);
+   bs->msglen = bvsnprintf(mp_chr(bs->msg), maxlen, fmt, arg_ptr);
    va_end(arg_ptr);
    if (bs->msglen < 0 || bs->msglen >= maxlen) {
       bs->msg = realloc_pool_memory(bs->msg, maxlen + 200);
index 577fc4d188e60656a361e21e7893a69a3c318d8a..46f66886049ace7e77f8184ec9f5c1d04f9944f9 100644 (file)
@@ -57,7 +57,7 @@ BPIPE *open_bpipe(char *prog, int wait, char *mode)
    /* Build arguments for running program. */
    tprog = get_pool_memory(PM_FNAME);
    pm_strcpy(&tprog, prog);
-   build_argc_argv(tprog, &bargc, bargv, MAX_ARGV);
+   build_argc_argv(mp_chr(tprog), &bargc, bargv, MAX_ARGV);
 #ifdef xxxxxx
    printf("argc=%d\n", bargc);
    int i;
@@ -215,8 +215,8 @@ int run_program(char *prog, int wait, POOLMEM *results)
       return 0;
    }
    if (results) {
-      results[0] = 0;
-      stat1 = fgets(results, sizeof_pool_memory(results), bpipe->rfd) == NULL;
+      mp_chr(results)[0] = 0;
+      stat1 = fgets(mp_chr(results), sizeof_pool_memory(results), bpipe->rfd) == NULL;
    } else {
       stat1 = 0;
    }
index 38b592f7eb34b7346e70fb9500b8ce2443ded890..79c7072f197760b6ac827c22061d60be955095c2 100644 (file)
@@ -299,10 +299,10 @@ void create_pid_file(char *dir, char *progname, int port)
    struct stat statp;
 
    Mmsg(&fname, "%s/%s.%d.pid", dir, progname, port);
-   if (stat(fname, &statp) == 0) {
+   if (stat(mp_chr(fname), &statp) == 0) {
       /* File exists, see what we have */
       *pidbuf = 0;
-      if ((pidfd = open(fname, O_RDONLY)) < 0 || 
+      if ((pidfd = open(mp_chr(fname), O_RDONLY)) < 0 || 
           read(pidfd, &pidbuf, sizeof(pidbuf)) < 0 ||
            sscanf(pidbuf, "%d", &oldpid) != 1) {
          Emsg2(M_ERROR_TERM, 0, _("Cannot open pid file. %s ERR=%s\n"), fname, strerror(errno));
@@ -313,10 +313,10 @@ void create_pid_file(char *dir, char *progname, int port)
               progname, oldpid, fname);
       }
       /* He is not alive, so take over file ownership */
-      unlink(fname);                 /* remove stale pid file */
+      unlink(mp_chr(fname));                 /* remove stale pid file */
    }
    /* Create new pid file */
-   if ((pidfd = open(fname, O_CREAT | O_TRUNC | O_WRONLY, 0644)) >= 0) {
+   if ((pidfd = open(mp_chr(fname), O_CREAT | O_TRUNC | O_WRONLY, 0644)) >= 0) {
       len = sprintf(pidbuf, "%d\n", (int)getpid());
       write(pidfd, pidbuf, len);
       close(pidfd);
@@ -342,7 +342,7 @@ int delete_pid_file(char *dir, char *progname, int port)
    }
    del_pid_file_ok = FALSE;
    Mmsg(&fname, "%s/%s.%d.pid", dir, progname, port);
-   unlink(fname);
+   unlink(mp_chr(fname));
    free_pool_memory(fname);
 #endif
    return 1;
index 514c190755e55ee8ac0b51741dfdd11a9f4386f2..27a2d41a1ad419b7535ad6a7c203c6242984094e 100644 (file)
@@ -64,7 +64,7 @@ int cram_md5_auth(BSOCK *bs, char *password, int ssl_need)
    }
    hmac_md5((uint8_t *)chal, strlen(chal), (uint8_t *)password, strlen(password), hmac);
    bin_to_base64(host, (char *)hmac, 16);
-   ok = strcmp(bs->msg, host) == 0;
+   ok = strcmp(mp_chr(bs->msg), host) == 0;
    Dmsg3(99, "Authenticate %s: wanted %s, got %s\n", 
               ok ? "OK" : "NOT OK", host, bs->msg);
    if (ok) {
@@ -92,9 +92,9 @@ int cram_md5_get_auth(BSOCK *bs, char *password, int ssl_need)
       bmicrosleep(5, 0);
       return 0;
    }
-   if (sscanf(bs->msg, "auth cram-md5 %s ssl=%d\n", chal, &ssl_has) != 2) {
+   if (sscanf(mp_chr(bs->msg), "auth cram-md5 %s ssl=%d\n", chal, &ssl_has) != 2) {
       ssl_has = BNET_SSL_NONE;
-      if (sscanf(bs->msg, "auth cram-md5 %s\n", chal) != 1) {
+      if (sscanf(mp_chr(bs->msg), "auth cram-md5 %s\n", chal) != 1) {
         bmicrosleep(5, 0);
         return 0;
       }
@@ -104,7 +104,7 @@ int cram_md5_get_auth(BSOCK *bs, char *password, int ssl_need)
    }
 
    hmac_md5((uint8_t *)chal, strlen(chal), (uint8_t *)password, strlen(password), hmac);
-   bs->msglen = bin_to_base64(bs->msg, (char *)hmac, 16) + 1;
+   bs->msglen = bin_to_base64(mp_chr(bs->msg), (char *)hmac, 16) + 1;
    if (!bnet_send(bs)) {
       return 0;
    }
@@ -113,7 +113,7 @@ int cram_md5_get_auth(BSOCK *bs, char *password, int ssl_need)
       bmicrosleep(5, 0);
       return 0;
    }
-   if (strcmp(bs->msg, "1000 OK auth\n") == 0) {
+   if (strcmp(mp_chr(bs->msg), "1000 OK auth\n") == 0) {
       return 1;
    }
    bmicrosleep(5, 0);
index 25435d1277b0ddfb9f1524667c9b7ac1cec7df37..630ada2f5b5dbef06d48432d1f6cbe7caf98b9f7 100755 (executable)
@@ -59,9 +59,9 @@ JCR *new_jcr(int size, JCR_free_HANDLER *daemon_free_jcr)
    pthread_mutex_init(&(jcr->mutex), NULL);
    jcr->JobStatus = JS_Created;       /* ready to run */
    jcr->VolumeName = get_pool_memory(PM_FNAME);
-   jcr->VolumeName[0] = 0;
+   mp_chr(jcr->VolumeName)[0] = 0;
    jcr->errmsg = get_pool_memory(PM_MESSAGE);
-   jcr->errmsg[0] = 0;
+   mp_chr(jcr->errmsg)[0] = 0;
    strcpy(jcr->Job, "*Console*");     /* default */
 
    sigtimer.sa_flags = 0;
index b68c96b823df2ee2cd30236d581ee417927b2e8f..709c7b230a9063a153dfde57e57d625c27064835 100755 (executable)
@@ -315,7 +315,7 @@ int open_spool_file(JCR *jcr, BSOCK *bs)
     POOLMEM *name  = get_pool_memory(PM_MESSAGE);
 
     make_unique_spool_filename(jcr, &name, bs->fd);
-    bs->spool_fd = fopen(name, "w+");
+    bs->spool_fd = fopen(mp_chr(name), "w+");
     if (!bs->spool_fd) {
        Jmsg(jcr, M_ERROR, 0, "fopen spool file %s failed: ERR=%s\n", name, strerror(errno));
        free_pool_memory(name);
@@ -331,7 +331,7 @@ int close_spool_file(JCR *jcr, BSOCK *bs)
 
     make_unique_spool_filename(jcr, &name, bs->fd);
     fclose(bs->spool_fd);
-    unlink(name);
+    unlink(mp_chr(name));
     free_pool_memory(name);
     bs->spool_fd = NULL;
     bs->spool = 0;
@@ -368,7 +368,8 @@ static BPIPE *open_mail_pipe(JCR *jcr, POOLMEM **cmd, DEST *d)
    fflush(stdout);
 
    if (!(bpipe = open_bpipe(*cmd, 120, "rw"))) {
-      Jmsg(jcr, M_ERROR, 0, "open mail pipe %s failed: ERR=%s\n", *cmd, strerror(errno));
+      Jmsg(jcr, M_ERROR, 0, "open mail pipe %s failed: ERR=%s\n", 
+        *cmd, strerror(errno));
    } 
    return bpipe;
 }
@@ -426,7 +427,7 @@ void close_msg(JCR *jcr)
            len = d->max_len+10;
            line = get_memory(len);
            rewind(d->fd);
-           while (fgets(line, len, d->fd)) {
+           while (fgets(mp_chr(line), len, d->fd)) {
               fputs(line, bpipe->wfd);
            }
            if (!close_wpipe(bpipe)) {       /* close write pipe sending mail */
@@ -440,7 +441,7 @@ void close_msg(JCR *jcr)
             */
            if (msgs != daemon_msgs) {
               /* read what mail prog returned -- should be nothing */
-              while (fgets(line, len, bpipe->rfd)) {
+              while (fgets(mp_chr(line), len, bpipe->rfd)) {
                   Jmsg1(jcr, M_INFO, 0, _("Mail prog: %s"), line);
               }
            }
@@ -455,7 +456,7 @@ void close_msg(JCR *jcr)
 rem_temp_file:
            /* Remove temp file */
            fclose(d->fd);
-           unlink(d->mail_filename);
+           unlink(mp_chr(d->mail_filename));
            free_pool_memory(d->mail_filename);
            d->mail_filename = NULL;
             Dmsg0(150, "end mail or mail on error\n");
@@ -616,9 +617,9 @@ void dispatch_message(JCR *jcr, int type, int level, char *msg)
             case MD_MAIL_ON_ERROR:
                 Dmsg1(800, "MAIL for following msg: %s", msg);
                if (!d->fd) {
-                  POOLMEM *name  = get_pool_memory(PM_MESSAGE);
-                  make_unique_mail_filename(jcr, &name, d);
-                   d->fd = fopen(name, "w+");
+                  POOLMEM *name = get_pool_memory(PM_MESSAGE);
+                  make_unique_mail_filename(jcr, &mp_chr(name), d);
+                   d->fd = fopen(mp_chr(name), "w+");
                   if (!d->fd) {
                      d->fd = stdout;
                       Emsg2(M_ERROR, 0, "fopen %s failed: ERR=%s\n", name, strerror(errno));
@@ -918,7 +919,8 @@ Jmsg(JCR *jcr, int type, int level, char *fmt,...)
     if (jcr && jcr->JobId == 0 && jcr->dir_bsock) {
        BSOCK *dir = jcr->dir_bsock;
        va_start(arg_ptr, fmt);
-       dir->msglen = bvsnprintf(dir->msg, sizeof_pool_memory(dir->msg), fmt, arg_ptr);
+       dir->msglen = bvsnprintf(mp_chr(dir->msg), sizeof_pool_memory(dir->msg), 
+                               fmt, arg_ptr);
        va_end(arg_ptr);
        bnet_send(jcr->dir_bsock);
        return;
@@ -995,7 +997,7 @@ int m_msg(char *file, int line, POOLMEM **pool_buf, char *fmt, ...)
    va_list   arg_ptr;
    int i, len, maxlen;
 
-   i = sprintf(*pool_buf, "%s:%d ", file, line);
+   i = sprintf(mp_chr(*pool_buf), "%s:%d ", file, line);
 
 again:
    maxlen = sizeof_pool_memory(*pool_buf) - i - 1; 
index 9056f635f7419ee1f10730312dae77f507762469..e01911f95e7a9a21b318013e8811b5c0f3b343ec 100644 (file)
@@ -109,7 +109,7 @@ static void usage()
 "       -r                list records\n"
 "       -s                synchronize or store in database\n"
 "       -v                verbose\n"
-"       -V              specify Volume names (separated by |)\n"
+"       -V                specify Volume names (separated by |)\n"
 "       -w dir            specify working directory (default from conf file)\n"
 "       -?                print this message\n\n"));
    exit(1);
@@ -125,7 +125,7 @@ int main (int argc, char *argv[])
    init_msg(NULL, NULL);
 
 
-   while ((ch = getopt(argc, argv, "b:c:d:mn:p:rsu:vw:?")) != -1) {
+   while ((ch = getopt(argc, argv, "b:c:d:mn:p:rsu:vVw:?")) != -1) {
       switch (ch) {
       case 'b':
         bsr = parse_bsr(NULL, optarg);
@@ -250,6 +250,39 @@ int main (int argc, char *argv[])
    return 0;
 }
   
+/*  
+ * We are at the end of reading a tape. Now, we simulate handling
+ *   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)
+{
+   Dmsg1(100, "Walk attached jcrs. Volume=%s\n", dev->VolCatInfo.VolCatName);
+   for (JCR *mjcr=NULL; (mjcr=next_attached_jcr(dev, mjcr)); ) {
+      if (verbose) {
+         Pmsg1(000, _("Create JobMedia for Job %s\n"), mjcr->Job);
+      }
+      if (dev->state & ST_TAPE) {
+        mjcr->EndBlock = dev->EndBlock;
+        mjcr->EndFile = dev->EndFile;
+      } else {
+        mjcr->EndBlock = (uint32_t)dev->file_addr;
+        mjcr->StartBlock = (uint32_t)(dev->file_addr >> 32);
+      }
+      if (!create_jobmedia_record(db, mjcr)) {
+         Pmsg2(000, _("Could not create JobMedia record for Volume=%s Job=%s\n"),
+           dev->VolCatInfo.VolCatName, mjcr->Job);
+      }
+   }  
+   /* Now let common read routine get up next tape. Note,
+    * 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);
+   /* we must once more detach ourselves (attached by mount_next ...) */
+   detach_jcr_from_device(dev, jcr); /* detach bscan jcr */
+   return stat;
+}
 
 static void do_scan()            
 {
@@ -262,9 +295,10 @@ static void do_scan()
    memset(&fsr, 0, sizeof(fsr));
    memset(&fr, 0, sizeof(fr));
 
+   /* Detach bscan's jcr as we are not a real Job on the tape */
    detach_jcr_from_device(dev, bjcr);
 
-   read_records(bjcr, dev, record_cb, mount_next_read_volume);
+   read_records(bjcr, dev, record_cb, bscan_mount_next_read_volume);
    release_device(bjcr, dev);
 
    free_attr(attr);
@@ -299,6 +333,7 @@ static void record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
          Pmsg0(000, _("Volume is prelabeled. This tape cannot be scanned.\n"));
         return;
         break;
+
       case VOL_LABEL:
         unser_volume_label(dev, rec);
         /* Check Pool info */
@@ -358,6 +393,7 @@ static void record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
 
          Pmsg1(000, _("VOL_LABEL: OK for Volume: %s\n"), mr.VolumeName);
         break;
+
       case SOS_LABEL:
         mr.VolJobs++;
         if (ignored_msgs > 0) {
@@ -430,6 +466,7 @@ static void record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
            return;
         }
         break;
+
       case EOS_LABEL:
         unser_session_label(&elabel, rec);
 
@@ -458,8 +495,10 @@ static void record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
         free_jcr(mjcr);
 
         break;
+
       case EOM_LABEL:
         break;
+
       case EOT_LABEL:             /* end of all tapes */
         /* 
          * Wiffle through all jobs still open and close
@@ -486,7 +525,7 @@ static void record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
         mr.VolBytes += mr.VolBlocks * WRITE_BLKHDR_LENGTH; /* approx. */
         mr.VolMounts++;
         update_media_record(db, &mr);
-         Pmsg3(0, _("End of Volume. VolFiles=%u VolBlocks=%u VolBytes=%s\n"), mr.VolFiles,
+         Pmsg3(0, _("End of all Volumes. VolFiles=%u VolBlocks=%u VolBytes=%s\n"), mr.VolFiles,
                    mr.VolBlocks, edit_uint64_with_commas(mr.VolBytes, ec1));
         break;
       default:
@@ -1112,29 +1151,6 @@ int      dir_send_job_status(JCR *jcr) {return 1;}
 
 int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
 {
-   /*  
-    * We are at the end of reading a tape. Now, we simulate handling
-    *  the end of writing a tape by wiffling through the attached
-    *  jcrs creating jobmedia records.
-    */
-   Dmsg1(100, "Walk attached jcrs. Volume=%s\n", dev->VolCatInfo.VolCatName);
-   for (JCR *mjcr=NULL; (mjcr=next_attached_jcr(dev, mjcr)); ) {
-      if (verbose) {
-         Pmsg1(000, _("Create JobMedia for Job %s\n"), mjcr->Job);
-      }
-      if (dev->state & ST_TAPE) {
-        mjcr->EndBlock = dev->EndBlock;
-        mjcr->EndFile = dev->EndFile;
-      } else {
-        mjcr->EndBlock = (uint32_t)dev->file_addr;
-        mjcr->StartBlock = (uint32_t)(dev->file_addr >> 32);
-      }
-      if (!create_jobmedia_record(db, mjcr)) {
-         Pmsg2(000, _("Could not create JobMedia record for Volume=%s Job=%s\n"),
-           dev->VolCatInfo.VolCatName, mjcr->Job);
-      }
-   }
-
    fprintf(stderr, _("Mount Volume %s on device %s and press return when ready: "),
       jcr->VolumeName, dev_name(dev));
    getchar();  
index 273be3d2d9f4ea7de2e9a2d6fe35d4bed80aebb9..4f5c676d41fa87f4a9c8f60a9fbb835be39e0964 100644 (file)
@@ -63,7 +63,10 @@ int read_records(JCR *jcr,  DEVICE *dev,
 
             Dmsg3(100, "EOT. stat=%s blk=%d rem=%d\n", rec_state_to_str(rec), 
                  block->BlockNumber, rec->remainder);
+            Jmsg(jcr, M_INFO, 0, "Got EOM at file %u  on device %s, Volume \"%s\"\n", 
+                dev->file, dev_name(dev), jcr->VolumeName);
            if (!mount_cb(jcr, dev, block)) {
+               Jmsg(jcr, M_INFO, 0, "End of all volumes.\n");
                Dmsg3(100, "After mount next vol. stat=%s blk=%d rem=%d\n", rec_state_to_str(rec), 
                  block->BlockNumber, rec->remainder);
               ok = FALSE;
index 5b3cc3ebd31b5ab959ac4fb7a00ee5c9c4c93196..38d81bbbe0501ab937f3c33cc7deb7905e508b70 100644 (file)
@@ -1,8 +1,8 @@
 /* */
 #define VERSION "1.31"
 #define VSTRING "1"
-#define BDATE   "04 Jun 2003"
-#define LSMDATE "04Jun03"
+#define BDATE   "10 Jun 2003"
+#define LSMDATE "10Jun03"
 
 /* Debug flags */
 #define DEBUG 1