]> git.sur5r.net Git - bacula/bacula/commitdiff
28Jul05
authorKern Sibbald <kern@sibbald.com>
Thu, 28 Jul 2005 09:50:31 +0000 (09:50 +0000)
committerKern Sibbald <kern@sibbald.com>
Thu, 28 Jul 2005 09:50:31 +0000 (09:50 +0000)
- Temporarily turn off disk seeking until I find the
  cause of the problem.
27Jul05
- Add OSF1 patch supplied by user.
- Use number of files selected from write_bsr() only
  if it is not defined.
- Explicitly seek to end of file when getting size for
  restore test.
- Correctly set EndBlock position in JobMedia record
  for files.
- Remove unnecessary set StartBlock in bscan. Caused bscan
  regression error.

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

13 files changed:
bacula/ReleaseNotes
bacula/kernstodo
bacula/kes-1.37
bacula/src/baconfig.h
bacula/src/dird/ua_label.c
bacula/src/dird/ua_restore.c
bacula/src/dird/ua_tree.c
bacula/src/findlib/attribs.c
bacula/src/stored/block.c
bacula/src/stored/bscan.c
bacula/src/stored/dev.c
bacula/src/stored/match_bsr.c
bacula/src/version.h

index 07d7e4ac60314385db9ff9dd778403bd5f27e7a6..05ed1e6bb4e18602d99c62cc3d1ffb57df403870 100644 (file)
@@ -11,7 +11,8 @@ Major Changes:
 - The Director, Storage daemon, and File daemons are
   Deamons are not compatible with  prior versions. 
   All FDs must be upgraded at the same time.
-- Multiple drive autochanger support.
+- Multiple drive autochanger support. You *must* update
+  your SD conf file.
 - Support for ANSI/IBM labels.
 - New communications protocol between DIR and SD to reserve 
   drives.
@@ -164,6 +165,9 @@ Items to note!!!
   old database (the PostgreSQL upgrade scripts not yet tested).
 - You must add --with-openssl to the configure command line if
   you want TLS communications encryption support.
+- If you use an Autochanger, you *must* update your SD conf file
+  to use the new Autochanger resource.  Otherwise, certain commands
+  such as "update slots" may not work.
 
 Other Items:
 - 2 new scripts, dvd-writepart and dvd-freespace, in the scripts directory,
index c93b18a511e5ba578c7ef2dfe6a775c664acc6b5..048a683ae2678958d61af48257b2dc851230483f 100644 (file)
@@ -10,10 +10,12 @@ Version 1.37                Kern (see below)
 Final items for 1.37 before release:
 1. Fix bugs
 -  --without-openssl breaks at least on Solaris.
-7. Write a bacula-web document
 9. Run the regression scripts on Solaris and FreeBSD
 -  Figure out how to package gui, and rescue programs.
 -  Test TLS.
+-  Arno had to do -- to get update slots=x to work
+   UPDATE Media SET InChanger=0,Slot=0 WHERE InChanger>0 AND Slot>0; (MySQL)
+
 
 Document:
 - Document cleaning up the spool files:
@@ -55,6 +57,18 @@ Document:
 =======
 
 For 1.39:
+--- create_file.c.orig  Fri Jul  8 12:13:05 2005
++++ create_file.c       Fri Jul  8 12:13:07 2005
+@@ -195,6 +195,8 @@
+                     attr->ofname, be.strerror());
+               return CF_ERROR;
+            }
++        } else if(S_ISSOCK(attr->statp.st_mode)) {
++            Dmsg1(200, "Skipping socket: %s\n", attr->ofname);
+         } else {          
+             Dmsg1(200, "Restore node: %s\n", attr->ofname);
+            if (mknod(attr->ofname, attr->statp.st_mode, attr->statp.st_rdev) != 0 && errno != EEXIST) {
+
 - Fix bpipe.c so that it does not modify results pointer.
   ***FIXME*** calling sequence should be changed.
 1.xx Major Projects:
@@ -1411,3 +1425,4 @@ Block Position: 0
 - Document that ChangerDevice is used for Alert command.
 - Add better documentation on how restores can be done
 8. Take one more try at making DVD writing work (no go)
+7. Write a bacula-web document
index 98a506754df5717dd5889389a6f1fac6449c8642..1a5812d5f5641c940754d0ce546808f86776a066 100644 (file)
@@ -4,6 +4,19 @@
 General:
 
 Changes to 1.37.32:
+28Jul05
+- Temporarily turn off disk seeking until I find the
+  cause of the problem.
+27Jul05
+- Add OSF1 patch supplied by user.
+- Use number of files selected from write_bsr() only
+  if it is not defined.
+- Explicitly seek to end of file when getting size for
+  restore test.
+- Correctly set EndBlock position in JobMedia record
+  for files.
+- Remove unnecessary set StartBlock in bscan. Caused bscan
+  regression error.
 26Jul05
 - Modify mtx-changer to wait a maximum of 300 seconds.
 - Do restart of failed jobs only for Backups job types.
index b3eed43bb940e4a79cf5558e8c398883c86784b5..f9580908997860512b133b02ce780fdd1ff7411d 100644 (file)
@@ -520,11 +520,15 @@ extern int thr_setconcurrency(int);
 
 #endif
 
-#ifdef HAVE_DARWIN_OS
+#if defined(HAVE_DARWIN_OS) || defined(HAVE_OSF1_OS)
 /* Apparently someone forgot to wrap getdomainname as a C function */
 extern "C" int getdomainname(char *name, int len);
 #endif
 
+#ifdef HAVE_OSF1_OS
+extern "C" int mknod ( const char *path, int mode, dev_t device );
+#endif
+
 #ifdef HAVE_CYGWIN
 /* They don't really have it */
 #undef HAVE_GETDOMAINNAME
index f49b8a0f789e7aaaad7caca31ad70765176ba356..f9c53967179dc5a4681bee4d8c0d7ab3cce3a8cf 100644 (file)
@@ -131,7 +131,7 @@ static bool get_user_slot_list(UAContext *ua, char *slot_list, int num_slots)
          slot_list[i] = 1;
       }
    }
-#ifdef xxx_debug
+#ifdef  xxx_debug
    printf("Slots turned on:\n");
    for (i=1; i <= num_slots; i++) {
       if (slot_list[i]) {
@@ -625,7 +625,7 @@ static bool send_label_request(UAContext *ua, MEDIA_DBR *mr, MEDIA_DBR *omr,
          dev_name, mr->VolumeName, pr->Name, mr->MediaType, mr->Slot);
       bsendmsg(ua, _("Sending label command for Volume \"%s\" Slot %d ...\n"),
          mr->VolumeName, mr->Slot);
-      Dmsg5(200, "label %s VolumeName=%s PoolName=%s MediaType=%s Slot=%d\n",
+      Dmsg5(100, "label %s VolumeName=%s PoolName=%s MediaType=%s Slot=%d\n",
          dev_name, mr->VolumeName, pr->Name, mr->MediaType, mr->Slot);
    }
 
@@ -727,7 +727,7 @@ static char *get_volume_name_from_SD(UAContext *ua, int Slot)
       }
    }
    close_sd_bsock(ua);
-   Dmsg1(200, "get_vol_name=%s\n", NPRT(VolName));
+   Dmsg1(100, "get_vol_name=%s\n", NPRT(VolName));
    return VolName;
 }
 
index 49d22e79200a6c325f6b2a6839c8d10a51e8d3db..ef8d764595f0b5b2a14f8f8391ab645c5da36b4b 100644 (file)
@@ -173,14 +173,19 @@ int restore_cmd(UAContext *ua, const char *cmd)
    }
 
    if (rx.bsr->JobId) {
+      uint32_t selected_files;
       if (!complete_bsr(ua, rx.bsr)) {   /* find Vol, SessId, SessTime from JobIds */
          bsendmsg(ua, _("Unable to construct a valid BSR. Cannot continue.\n"));
          goto bail_out;
       }
-      if (!(rx.selected_files = write_bsr_file(ua, rx.bsr))) {
+      if (!(selected_files = write_bsr_file(ua, rx.bsr))) {
          bsendmsg(ua, _("No files selected to be restored.\n"));
          goto bail_out;
       }
+      /* If no count of files, use bsr generated value (often wrong) */
+      if (rx.selected_files == 0) {
+         rx.selected_files = selected_files;
+      }
       bsendmsg(ua, _("\n%u file%s selected to be restored.\n\n"), rx.selected_files,
          rx.selected_files==1?"":"s");
    } else {
index cb9b56cbd09d37af72fe338d5b901bb85b66ac22..9174b27b2d8aa6cd5572a794b7393a6c7e8faa46 100644 (file)
@@ -156,6 +156,8 @@ int insert_tree_handler(void *ctx, int num_fields, char **row)
    int FileIndex;
    JobId_t JobId;
 
+// Dmsg4(000, "Path=%s%s FI=%s JobId=%s\n", row[0], row[1],
+//    row[2], row[3]);
    if (*row[1] == 0) {                /* no filename => directory */
       if (*row[0] != '/') {           /* Must be Win32 directory */
          type = TN_DIR_NLS;
index 38c0b1920ef36ce57f77b3ca0344398d93c5469d..cc5e20f000a2bc059eb97846f60b96465b4e6a8a 100755 (executable)
@@ -49,9 +49,9 @@ HANDLE bget_handle(BFILE *bfd);
 #endif
 
 /*=============================================================*/
-/*                                                            */
-/*            ***  A l l  S y s t e m s ***                   */
-/*                                                            */
+/*                                                             */
+/*             ***  A l l  S y s t e m s ***                   */
+/*                                                             */
 /*=============================================================*/
 
 /*
@@ -73,11 +73,11 @@ int select_data_stream(FF_PKT *ff_pkt)
 #ifdef HAVE_LIBZ
    if (ff_pkt->flags & FO_GZIP) {
       if (stream == STREAM_WIN32_DATA) {
-        stream = STREAM_WIN32_GZIP_DATA;
+         stream = STREAM_WIN32_GZIP_DATA;
       } else if (stream == STREAM_FILE_DATA) {
-        stream = STREAM_GZIP_DATA;
+         stream = STREAM_GZIP_DATA;
       } else {
-        stream = STREAM_SPARSE_GZIP_DATA;
+         stream = STREAM_SPARSE_GZIP_DATA;
       }
    }
 #endif
@@ -102,7 +102,7 @@ void encode_stat(char *buf, FF_PKT *ff_pkt, int data_stream)
    struct stat *statp = &ff_pkt->statp;
    /*
     *  Encode a stat packet.  I should have done this more intelligently
-    *  with a length so that it could be easily expanded.
+    *   with a length so that it could be easily expanded.
     */
    p += to_base64((int64_t)statp->st_dev, p);
    *p++ = ' ';                        /* separate fields with a space */
@@ -155,7 +155,7 @@ void encode_stat(char *buf, FF_PKT *ff_pkt, int data_stream)
 
 /* Do casting according to unknown type to keep compiler happy */
 #if !HAVE_GCC & HAVE_SUN_OS
-#define plug(st, val) st = val       /* brain damaged compiler */
+#define plug(st, val) st = val        /* brain damaged compiler */
 #else
 template <class T> void plug(T &st, uint64_t val)
     { st = static_cast<T>(val); }
@@ -253,32 +253,32 @@ int32_t decode_LinkFI(char *buf, struct stat *statp)
    char *p = buf;
    int64_t val;
 
-   skip_nonspaces(&p);               /* st_dev */
-   p++;                              /* skip space */
-   skip_nonspaces(&p);               /* st_ino */
+   skip_nonspaces(&p);                /* st_dev */
+   p++;                               /* skip space */
+   skip_nonspaces(&p);                /* st_ino */
    p++;
    p += from_base64(&val, p);
-   plug(statp->st_mode, val);        /* st_mode */
+   plug(statp->st_mode, val);         /* st_mode */
    p++;
-   skip_nonspaces(&p);               /* st_nlink */
+   skip_nonspaces(&p);                /* st_nlink */
    p++;
-   skip_nonspaces(&p);               /* st_uid */
+   skip_nonspaces(&p);                /* st_uid */
    p++;
-   skip_nonspaces(&p);               /* st_gid */
+   skip_nonspaces(&p);                /* st_gid */
    p++;
-   skip_nonspaces(&p);               /* st_rdev */
+   skip_nonspaces(&p);                /* st_rdev */
    p++;
-   skip_nonspaces(&p);               /* st_size */
+   skip_nonspaces(&p);                /* st_size */
    p++;
-   skip_nonspaces(&p);               /* st_blksize */
+   skip_nonspaces(&p);                /* st_blksize */
    p++;
-   skip_nonspaces(&p);               /* st_blocks */
+   skip_nonspaces(&p);                /* st_blocks */
    p++;
-   skip_nonspaces(&p);               /* st_atime */
+   skip_nonspaces(&p);                /* st_atime */
    p++;
-   skip_nonspaces(&p);               /* st_mtime */
+   skip_nonspaces(&p);                /* st_mtime */
    p++;
-   skip_nonspaces(&p);               /* st_ctime */
+   skip_nonspaces(&p);                /* st_ctime */
 
    /* Optional FileIndex of hard linked file data */
    if (*p == ' ' || (*p != 0 && *(p+1) == ' ')) {
@@ -296,7 +296,7 @@ int32_t decode_LinkFI(char *buf, struct stat *statp)
  *  ofile is the output filename (may be in a different directory)
  *
  * Returns:  true  on success
- *          false on failure
+ *           false on failure
  */
 bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
 {
@@ -309,7 +309,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
    if (attr->stream == STREAM_UNIX_ATTRIBUTES_EX &&
        set_win32_attributes(jcr, attr, ofd)) {
        if (is_bopen(ofd)) {
-          bclose(ofd);
+           bclose(ofd);
        }
        pm_strcpy(attr->ofname, "*none*");
        return true;
@@ -317,7 +317,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
    if (attr->data_stream == STREAM_WIN32_DATA ||
        attr->data_stream == STREAM_WIN32_GZIP_DATA) {
       if (is_bopen(ofd)) {
-        bclose(ofd);
+         bclose(ofd);
       }
       pm_strcpy(attr->ofname, "*none*");
       return true;
@@ -334,12 +334,12 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
    old_mask = umask(0);
    if (is_bopen(ofd)) {
       char ec1[50], ec2[50];
-      fsize = blseek(ofd, 0, SEEK_CUR);
-      bclose(ofd);                   /* first close file */
+      fsize = blseek(ofd, 0, SEEK_END);
+      bclose(ofd);                    /* first close file */
       if (fsize > 0 && fsize != (off_t)attr->statp.st_size) {
          Jmsg3(jcr, M_ERROR, 0, _("File size of restored file %s not correct. Original %s, restored %s.\n"),
-           attr->ofname, edit_uint64(attr->statp.st_size, ec1),
-           edit_uint64(fsize, ec2));
+            attr->ofname, edit_uint64(attr->statp.st_size, ec1),
+            edit_uint64(fsize, ec2));
       }
    }
 
@@ -349,38 +349,38 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
    /* ***FIXME**** optimize -- don't do if already correct */
    /*
     * For link, change owner of link using lchown, but don't
-    *  try to do a chmod as that will update the file behind it.
+    *   try to do a chmod as that will update the file behind it.
     */
    if (attr->type == FT_LNK) {
       /* Change owner of link, not of real file */
       if (lchown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0) {
-        berrno be;
+         berrno be;
          Jmsg2(jcr, M_ERROR, 0, _("Unable to set file owner %s: ERR=%s\n"),
-           attr->ofname, be.strerror());
-        ok = false;
+            attr->ofname, be.strerror());
+         ok = false;
       }
    } else {
       if (chown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0) {
-        berrno be;
+         berrno be;
          Jmsg2(jcr, M_ERROR, 0, _("Unable to set file owner %s: ERR=%s\n"),
-           attr->ofname, be.strerror());
-        ok = false;
+            attr->ofname, be.strerror());
+         ok = false;
       }
       if (chmod(attr->ofname, attr->statp.st_mode) < 0) {
-        berrno be;
+         berrno be;
          Jmsg2(jcr, M_ERROR, 0, _("Unable to set file modes %s: ERR=%s\n"),
-           attr->ofname, be.strerror());
-        ok = false;
+            attr->ofname, be.strerror());
+         ok = false;
       }
 
       /*
        * Reset file times.
        */
       if (utime(attr->ofname, &ut) < 0) {
-        berrno be;
+         berrno be;
          Jmsg2(jcr, M_ERROR, 0, _("Unable to set file times %s: ERR=%s\n"),
-           attr->ofname, be.strerror());
-        ok = false;
+            attr->ofname, be.strerror());
+         ok = false;
       }
 #ifdef HAVE_CHFLAGS
       /*
@@ -391,10 +391,10 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
        *  fail.
        */
       if (chflags(attr->ofname, attr->statp.st_flags) < 0) {
-        berrno be;
+         berrno be;
          Jmsg2(jcr, M_ERROR, 0, _("Unable to set file flags %s: ERR=%s\n"),
-           attr->ofname, be.strerror());
-        ok = false;
+            attr->ofname, be.strerror());
+         ok = false;
       }
 #endif
    }
@@ -405,9 +405,9 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
 
 
 /*=============================================================*/
-/*                                                            */
-/*                * * *  U n i x * * * *                      */
-/*                                                            */
+/*                                                             */
+/*                 * * *  U n i x * * * *                      */
+/*                                                             */
 /*=============================================================*/
 
 #if !defined(HAVE_CYGWIN) && !defined(HAVE_WIN32)
@@ -418,7 +418,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
  *   here.  They must be "self-contained" (i.e. you keep track
  *   of your own length), and they must be in ASCII string
  *   format. Using this feature is not recommended.
- * The code below shows how to return nothing. See the Win32
+ * The code below shows how to return nothing.  See the Win32
  *   code below for returning something in the attributes.
  */
 int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt)
@@ -435,7 +435,7 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt)
    }
    *p = 0;
 #else
-   *attribsEx = 0;                   /* no extended attributes */
+   *attribsEx = 0;                    /* no extended attributes */
 #endif
    return STREAM_UNIX_ATTRIBUTES;
 }
@@ -445,9 +445,9 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt)
 
 
 /*=============================================================*/
-/*                                                            */
-/*                * * *  W i n 3 2 * * * *                    */
-/*                                                            */
+/*                                                             */
+/*                 * * *  W i n 3 2 * * * *                    */
+/*                                                             */
 /*=============================================================*/
 
 #if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
@@ -458,10 +458,10 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt)
    WIN32_FILE_ATTRIBUTE_DATA atts;
    ULARGE_INTEGER li;
 
-   attribsEx[0] = 0;                 /* no extended attributes */
+   attribsEx[0] = 0;                  /* no extended attributes */
 
    // try unicode version
-   if (p_GetFileAttributesExW) {
+   if (p_GetFileAttributesExW)  {
       unix_name_to_win32(&ff_pkt->sys_fname, ff_pkt->fname);
 
       POOLMEM* pwszBuf = get_pool_memory (PM_FNAME);   
@@ -472,19 +472,19 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt)
 
       if (!b) {
          win_error(jcr, "GetFileAttributesExW:", ff_pkt->sys_fname);
-        return STREAM_UNIX_ATTRIBUTES;
+         return STREAM_UNIX_ATTRIBUTES;
       }
    }
    else {
       if (!p_GetFileAttributesExA)
-        return STREAM_UNIX_ATTRIBUTES;
+         return STREAM_UNIX_ATTRIBUTES;
 
       unix_name_to_win32(&ff_pkt->sys_fname, ff_pkt->fname);
 
       if (!p_GetFileAttributesExA(ff_pkt->sys_fname, GetFileExInfoStandard,
-                             (LPVOID)&atts)) {
+                              (LPVOID)&atts)) {
          win_error(jcr, "GetFileAttributesExA:", ff_pkt->sys_fname);
-        return STREAM_UNIX_ATTRIBUTES;
+         return STREAM_UNIX_ATTRIBUTES;
       }
    }
 
@@ -518,7 +518,7 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt)
          FILE_ATTRIBUTE_OFFLINE| \
          FILE_ATTRIBUTE_READONLY| \
          FILE_ATTRIBUTE_SYSTEM| \
-        FILE_ATTRIBUTE_TEMPORARY)
+         FILE_ATTRIBUTE_TEMPORARY)
 
 
 /*
@@ -528,7 +528,7 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt)
  *  ofile is the output filename (may be in a different directory)
  *
  * Returns:  true  on success
- *          false on failure
+ *           false on failure
  */
 static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
 {
@@ -542,10 +542,10 @@ static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
    if (!(p_SetFileAttributesW || p_SetFileAttributesA))
       return false;
 
-   if (!p || !*p) {                  /* we should have attributes */
+   if (!p || !*p) {                   /* we should have attributes */
       Dmsg2(100, "Attributes missing. of=%s ofd=%d\n", attr->ofname, ofd->fid);
       if (is_bopen(ofd)) {
-        bclose(ofd);
+         bclose(ofd);
       }
       return false;
    } else {
@@ -554,17 +554,17 @@ static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
 
    p += from_base64(&val, p);
    plug(atts.dwFileAttributes, val);
-   p++;                              /* skip space */
+   p++;                               /* skip space */
    p += from_base64(&val, p);
    li.QuadPart = val;
    atts.ftCreationTime.dwLowDateTime = li.LowPart;
    atts.ftCreationTime.dwHighDateTime = li.HighPart;
-   p++;                              /* skip space */
+   p++;                               /* skip space */
    p += from_base64(&val, p);
    li.QuadPart = val;
    atts.ftLastAccessTime.dwLowDateTime = li.LowPart;
    atts.ftLastAccessTime.dwHighDateTime = li.HighPart;
-   p++;                              /* skip space */
+   p++;                               /* skip space */
    p += from_base64(&val, p);
    li.QuadPart = val;
    atts.ftLastWriteTime.dwLowDateTime = li.LowPart;
@@ -586,15 +586,15 @@ static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
 
    if (!is_bopen(ofd)) {
       Dmsg1(100, "File not open: %s\n", attr->ofname);
-      bopen(ofd, attr->ofname, O_WRONLY|O_BINARY, 0);  /* attempt to open the file */
+      bopen(ofd, attr->ofname, O_WRONLY|O_BINARY, 0);   /* attempt to open the file */
    }
 
    if (is_bopen(ofd)) {
       Dmsg1(100, "SetFileTime %s\n", attr->ofname);
       if (!SetFileTime(bget_handle(ofd),
-                        &atts.ftCreationTime,
-                        &atts.ftLastAccessTime,
-                        &atts.ftLastWriteTime)) {
+                         &atts.ftCreationTime,
+                         &atts.ftLastAccessTime,
+                         &atts.ftLastWriteTime)) {
          win_error(jcr, "SetFileTime:", win32_ofile);
       }
       bclose(ofd);
@@ -604,19 +604,19 @@ static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
    if (!(atts.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) 
    {
       if (p_SetFileAttributesW) {
-        POOLMEM* pwszBuf = get_pool_memory (PM_FNAME);   
-        UTF8_2_wchar(&pwszBuf, win32_ofile);
+         POOLMEM* pwszBuf = get_pool_memory (PM_FNAME);   
+         UTF8_2_wchar(&pwszBuf, win32_ofile);
 
-        BOOL b=SetFileAttributesW((LPCWSTR)pwszBuf, atts.dwFileAttributes & SET_ATTRS);
-        free_pool_memory(pwszBuf);
+         BOOL b=SetFileAttributesW((LPCWSTR)pwszBuf, atts.dwFileAttributes & SET_ATTRS);
+         free_pool_memory(pwszBuf);
       
-        if (!b) 
+         if (!b) 
             win_error(jcr, "SetFileAttributesW:", win32_ofile); 
       }
       else {
-        if (!SetFileAttributes(win32_ofile, atts.dwFileAttributes & SET_ATTRS)) {
+         if (!SetFileAttributes(win32_ofile, atts.dwFileAttributes & SET_ATTRS)) {
             win_error(jcr, "SetFileAttributesA:", win32_ofile);
-        }
+         }
       }
    }
    free_pool_memory(win32_ofile);
@@ -628,13 +628,13 @@ void win_error(JCR *jcr, char *prefix, POOLMEM *win32_ofile)
    DWORD lerror = GetLastError();
    LPTSTR msg;
    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|
-                FORMAT_MESSAGE_FROM_SYSTEM,
-                NULL,
-                lerror,
-                0,
-                (LPTSTR)&msg,
-                0,
-                NULL);
+                 FORMAT_MESSAGE_FROM_SYSTEM,
+                 NULL,
+                 lerror,
+                 0,
+                 (LPTSTR)&msg,
+                 0,
+                 NULL);
    Dmsg3(100, "Error in %s on file %s: ERR=%s\n", prefix, win32_ofile, msg);
    strip_trailing_junk(msg);
    Jmsg(jcr, M_ERROR, 0, _("Error in %s file %s: ERR=%s\n"), prefix, win32_ofile, msg);
@@ -645,13 +645,13 @@ void win_error(JCR *jcr, char *prefix, DWORD lerror)
 {
    LPTSTR msg;
    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|
-                FORMAT_MESSAGE_FROM_SYSTEM,
-                NULL,
-                lerror,
-                0,
-                (LPTSTR)&msg,
-                0,
-                NULL);
+                 FORMAT_MESSAGE_FROM_SYSTEM,
+                 NULL,
+                 lerror,
+                 0,
+                 (LPTSTR)&msg,
+                 0,
+                 NULL);
    strip_trailing_junk(msg);
    if (jcr) {
       Jmsg2(jcr, M_ERROR, 0, _("Error in %s: ERR=%s\n"), prefix, msg);
@@ -673,4 +673,4 @@ void unix_name_to_win32(POOLMEM **win32_name, char *name)
    conv_unix_to_win32_path(name, *win32_name, dwSize);
 }
 
-#endif /* HAVE_CYGWIN */
+#endif  /* HAVE_CYGWIN */
index 6a2f20f8acf1f01e96f4b0fbd9ec3fb955da1c8a..bda9911ff500832510347d891adee06c969b3ced 100644 (file)
@@ -572,9 +572,12 @@ bool write_block_to_dev(DCR *dcr)
       dcr->EndBlock = dev->EndBlock;
       dcr->EndFile  = dev->EndFile;
    } else {
-      /* Save address of start of block just written */
-      dcr->EndBlock = (uint32_t)dev->file_addr;
-      dcr->EndFile = (uint32_t)(dev->file_addr >> 32);
+      /* Save address of block just written */
+      uint64_t addr = dev->file_addr + wlen - 1;
+      dcr->EndBlock = (uint32_t)addr;
+      dcr->EndFile = (uint32_t)(addr >> 32);
+      dev->block_num = dcr->EndBlock;
+      dev->file = dcr->EndFile;
    }
    if (dcr->VolFirstIndex == 0 && block->FirstIndex > 0) {
       dcr->VolFirstIndex = block->FirstIndex;
@@ -1037,13 +1040,14 @@ reread:
       dcr->EndBlock = dev->EndBlock;
       dcr->EndFile  = dev->EndFile;
    } else {
-      dcr->EndBlock = (uint32_t)dev->file_addr;
-      dcr->EndFile = (uint32_t)(dev->file_addr >> 32);
+      uint64_t addr = dev->file_addr + block->read_len - 1;
+      dcr->EndBlock = (uint32_t)addr;
+      dcr->EndFile = (uint32_t)(addr >> 32);
       dev->block_num = dcr->EndBlock;
       dev->file = dcr->EndFile;
    }
-   dev->file_addr += block->block_len;
-   dev->file_size += block->block_len;
+   dev->file_addr += block->read_len;
+   dev->file_size += block->read_len;
 
    /*
     * If we read a short block on disk,
index 17512b05d871b6fb3bee7a6da8aca898bd837aa8..a01236ef68d3a74ac1431a38d5f5e8513a184f97 100644 (file)
@@ -494,6 +494,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
          update_db = save_update_db;
 
          jr.PoolId = pr.PoolId;
+#ifdef xxx
          /* Set start positions into JCR */
          if (dev->is_tape()) {
             /*
@@ -506,6 +507,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
             dcr->StartBlock = (uint32_t)dev->file_addr;
             dcr->StartFile = (uint32_t)(dev->file_addr >> 32);
          }
+#endif
          mjcr->start_time = jr.StartTime;
          mjcr->JobLevel = jr.JobLevel;
 
index 48cc89505c5a6d6d078cbfa48627e393c275323c..617d077416711e60767c206095842674be5c6b65 100644 (file)
@@ -1420,7 +1420,7 @@ reposition_dev(DEVICE *dev, uint32_t file, uint32_t block)
    }
 
    if (!dev->is_tape()) {
-      off_t pos = (((off_t)file)<<32) + block;
+      off_t pos = (((off_t)file)<<32) + (off_t)block;
       Dmsg1(100, "===== lseek_dev to %d\n", (int)pos);
       if (lseek_dev(dev, pos, SEEK_SET) == (off_t)-1) {
          berrno be;
index 5825f9339ea97ff0190ed2c49f5ce47931f9773e..122d3228240fec99e6cc639d6e7c7700bf0127a9 100755 (executable)
@@ -159,9 +159,13 @@ BSR *find_next_bsr(BSR *root_bsr, DEVICE *dev)
 {
    BSR *bsr;
    BSR *found_bsr = NULL;
+   bool no_file_seek = !dev->is_tape();
+#ifdef FILE_SEEK
+   no_file_seek = false;
+#endif
 
    if (!root_bsr || !root_bsr->use_positioning ||
-       !root_bsr->reposition /* || !dev->is_tape()*/) {
+       !root_bsr->reposition || no_file_seek) {
       Dmsg2(300, "No nxt_bsr use_pos=%d repos=%d\n", root_bsr->use_positioning, root_bsr->reposition);
       return NULL;
    }
index ee0897e86f945e022f50492f04eadf3e809dff52..8e1525ad317aa2130cbc9a465d1b18eb828d3fc0 100644 (file)
@@ -1,8 +1,8 @@
 /* */
 #undef  VERSION
 #define VERSION "1.37.32"
-#define BDATE   "26 July 2005"
-#define LSMDATE "26Jul05"
+#define BDATE   "28 July 2005"
+#define LSMDATE "28Jul05"
 
 /* Debug flags */
 #undef  DEBUG
 /* If this is set stdout will not be closed on startup */
 #define DEVELOPER 1
 
-
-
 /* Debug flags not normally turned on */
 
+/* #define FILE_SEEK 1 */  
+
 /* #define TRACE_JCR_CHAIN 1 */
 /* #define TRACE_RES 1 */
 /* #define DEBUG_MEMSET 1 */