From 921626431fc21d04e7da9bcf3c8ef7eb46a6e38c Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Thu, 28 Jul 2005 09:50:31 +0000 Subject: [PATCH] 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. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2264 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/ReleaseNotes | 6 +- bacula/kernstodo | 17 +++- bacula/kes-1.37 | 13 +++ bacula/src/baconfig.h | 6 +- bacula/src/dird/ua_label.c | 6 +- bacula/src/dird/ua_restore.c | 7 +- bacula/src/dird/ua_tree.c | 2 + bacula/src/findlib/attribs.c | 184 +++++++++++++++++----------------- bacula/src/stored/block.c | 18 ++-- bacula/src/stored/bscan.c | 2 + bacula/src/stored/dev.c | 2 +- bacula/src/stored/match_bsr.c | 6 +- bacula/src/version.h | 8 +- 13 files changed, 165 insertions(+), 112 deletions(-) diff --git a/bacula/ReleaseNotes b/bacula/ReleaseNotes index 07d7e4ac60..05ed1e6bb4 100644 --- a/bacula/ReleaseNotes +++ b/bacula/ReleaseNotes @@ -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, diff --git a/bacula/kernstodo b/bacula/kernstodo index c93b18a511..048a683ae2 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -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 diff --git a/bacula/kes-1.37 b/bacula/kes-1.37 index 98a506754d..1a5812d5f5 100644 --- a/bacula/kes-1.37 +++ b/bacula/kes-1.37 @@ -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. diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index b3eed43bb9..f958090899 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -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 diff --git a/bacula/src/dird/ua_label.c b/bacula/src/dird/ua_label.c index f49b8a0f78..f9c5396717 100644 --- a/bacula/src/dird/ua_label.c +++ b/bacula/src/dird/ua_label.c @@ -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; } diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index 49d22e7920..ef8d764595 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -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 { diff --git a/bacula/src/dird/ua_tree.c b/bacula/src/dird/ua_tree.c index cb9b56cbd0..9174b27b2d 100644 --- a/bacula/src/dird/ua_tree.c +++ b/bacula/src/dird/ua_tree.c @@ -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; diff --git a/bacula/src/findlib/attribs.c b/bacula/src/findlib/attribs.c index 38c0b1920e..cc5e20f000 100755 --- a/bacula/src/findlib/attribs.c +++ b/bacula/src/findlib/attribs.c @@ -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 void plug(T &st, uint64_t val) { st = static_cast(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 */ diff --git a/bacula/src/stored/block.c b/bacula/src/stored/block.c index 6a2f20f8ac..bda9911ff5 100644 --- a/bacula/src/stored/block.c +++ b/bacula/src/stored/block.c @@ -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, diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index 17512b05d8..a01236ef68 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -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; diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index 48cc89505c..617d077416 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -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; diff --git a/bacula/src/stored/match_bsr.c b/bacula/src/stored/match_bsr.c index 5825f9339e..122d322824 100755 --- a/bacula/src/stored/match_bsr.c +++ b/bacula/src/stored/match_bsr.c @@ -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; } diff --git a/bacula/src/version.h b/bacula/src/version.h index ee0897e86f..8e1525ad31 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -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 @@ -14,10 +14,10 @@ /* 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 */ -- 2.39.5