#define FT_NOOPEN 15 /* Could not open directory */
#define FT_RAW 16 /* Raw block device */
#define FT_FIFO 17 /* Raw fifo device */
-/* This directory packet is sent to the FD file processing routine so
+/* The DIRBEGIN packet is sent to the FD file processing routine so
* that it can filter packets, but otherwise, it is not used
* or saved */
#define FT_DIRBEGIN 18 /* Directory at beginning (not saved) */
#define FT_INVALIDFS 19 /* File system not allowed for */
#define FT_INVALIDDT 20 /* Drive type not allowed for */
+#define FT_REPARSE 21 /* Win NTFS reparse point */
/* Definitions for upper part of type word (see above). */
#define AR_DATA_STREAM (1<<16) /* Data stream id present */
Jmsg(jcr, M_INFO, 1, _(" Disallowed drive type. Will not descend into %s\n"),
ff_pkt->fname);
break;
+ case FT_REPARSE:
case FT_DIREND:
Dmsg1(130, "FT_DIREND: %s\n", ff_pkt->link);
break;
do_read = ff_pkt->statp.st_size > 0;
#endif
} else if (ff_pkt->type == FT_RAW || ff_pkt->type == FT_FIFO ||
+ ff_pkt->type == FT_REPARSE ||
(!is_portable_backup(&ff_pkt->bfd) && ff_pkt->type == FT_DIREND)) {
do_read = true;
}
tid = NULL;
}
int noatime = ff_pkt->flags & FO_NOATIME ? O_NOATIME : 0;
+ ff_pkt->bfd.reparse_point = ff_pkt->type == FT_REPARSE;
if (bopen(&ff_pkt->bfd, ff_pkt->fname, O_RDONLY | O_BINARY | noatime, 0) < 0) {
ff_pkt->ff_errno = errno;
berrno be;
stat = sd->fsend("%ld %d %s%c%s%c%s%c%s%c", jcr->JobFiles,
ff_pkt->type, ff_pkt->fname, 0, attribs, 0, ff_pkt->link, 0,
attribsEx, 0);
- } else if (ff_pkt->type == FT_DIREND) {
+ } else if (ff_pkt->type == FT_DIREND || ff_pkt->type == FT_REPARSE) {
/* Here link is the canonical filename (i.e. with trailing slash) */
stat = sd->fsend("%ld %d %s%c%s%c%c%s%c", jcr->JobFiles,
ff_pkt->type, ff_pkt->link, 0, attribs, 0, 0, attribsEx, 0);
-/*
- * Bacula File Daemon estimate.c
- * Make and estimate of the number of files and size to be saved.
- *
- * Kern Sibbald, September MMI
- *
- * Version $Id$
- *
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2001-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2001-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ * Bacula File Daemon estimate.c
+ * Make and estimate of the number of files and size to be saved.
+ *
+ * Kern Sibbald, September MMI
+ *
+ * Version $Id$
+ *
+ */
#include "bacula.h"
#include "filed.h"
case FT_NOFSCHG:
case FT_INVALIDFS:
case FT_INVALIDDT:
+ case FT_REPARSE:
case FT_DIREND:
case FT_SPEC:
case FT_RAW:
edit_uint64_with_commas(njcr->JobBytes, b2),
edit_uint64_with_commas(bps, b3));
sendit(msg.c_str(), len, arg);
- len = Mmsg(msg, _(" Files Examined=%s\n"),
- edit_uint64_with_commas(njcr->num_files_examined, b1));
+ len = Mmsg(msg, _(" Files Examined=%s Errors=%d\n"),
+ edit_uint64_with_commas(njcr->num_files_examined, b1),
+ njcr->JobErrors);
sendit(msg.c_str(), len, arg);
if (njcr->JobFiles > 0) {
njcr->lock();
case FT_DIRBEGIN:
jcr->num_files_examined--; /* correct file count */
return 1; /* ignored */
+ case FT_REPARSE:
case FT_DIREND:
Dmsg1(30, "FT_DIR saving: %s\n", ff_pkt->fname);
break;
stat = bnet_fsend(dir, "%d %d %s %s%c%s%c%s%c", jcr->JobFiles,
STREAM_UNIX_ATTRIBUTES, ff_pkt->VerifyOpts, ff_pkt->fname,
0, attribs, 0, ff_pkt->link, 0);
- } else if (ff_pkt->type == FT_DIREND) {
+ } else if (ff_pkt->type == FT_DIREND || ff_pkt->type == FT_REPARSE) {
/* Here link is the canonical filename (i.e. with trailing slash) */
stat = bnet_fsend(dir,"%d %d %s %s%c%s%c%c", jcr->JobFiles,
STREAM_UNIX_ATTRIBUTES, ff_pkt->VerifyOpts, ff_pkt->link,
-/*
- * Bacula low level File I/O routines. This routine simulates
- * open(), read(), write(), and close(), but using native routines.
- * I.e. on Windows, we use Windows APIs.
- *
- * Kern Sibbald, April MMIII
- *
- * Version $Id$
- *
- */
/*
Bacula® - The Network Backup Solution
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ * Bacula low level File I/O routines. This routine simulates
+ * open(), read(), write(), and close(), but using native routines.
+ * I.e. on Windows, we use Windows APIs.
+ *
+ * Kern Sibbald, April MMIII
+ *
+ * Version $Id$
+ *
+ */
#include "bacula.h"
#include "find.h"
dwflags = 0;
}
- // unicode or ascii open for create write
if (p_CreateFileW && p_MultiByteToWideChar) {
+ // unicode open for create write
bfd->fh = p_CreateFileW((LPCWSTR)win32_fname_wchar,
dwaccess, /* Requested access */
0, /* Shared mode */
dwflags, /* Flags and attributes */
NULL); /* TemplateFile */
} else {
+ // ascii open
bfd->fh = p_CreateFileA(win32_fname,
dwaccess, /* Requested access */
0, /* Shared mode */
} else if (flags & O_WRONLY) { /* Open existing for write */
if (bfd->use_backup_api) {
dwaccess = GENERIC_WRITE|WRITE_OWNER|WRITE_DAC;
- dwflags = FILE_FLAG_BACKUP_SEMANTICS;
+ dwflags = FILE_FLAG_BACKUP_SEMANTICS;
} else {
dwaccess = GENERIC_WRITE;
dwflags = 0;
}
- // unicode or ascii open for open existing write
if (p_CreateFileW && p_MultiByteToWideChar) {
+ // unicode open for open existing write
bfd->fh = p_CreateFileW((LPCWSTR)win32_fname_wchar,
dwaccess, /* Requested access */
0, /* Shared mode */
dwflags, /* Flags and attributes */
NULL); /* TemplateFile */
} else {
+ // ascii open
bfd->fh = p_CreateFileA(win32_fname,
dwaccess, /* Requested access */
0, /* Shared mode */
} else { /* Read */
if (bfd->use_backup_api) {
dwaccess = GENERIC_READ|READ_CONTROL|ACCESS_SYSTEM_SECURITY;
- dwflags = FILE_FLAG_BACKUP_SEMANTICS;
+ dwflags = FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_SEQUENTIAL_SCAN |
+ FILE_FLAG_OPEN_REPARSE_POINT;
dwshare = FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE;
} else {
dwaccess = GENERIC_READ;
dwshare = FILE_SHARE_READ|FILE_SHARE_WRITE;
}
- // unicode or ascii open for open existing read
if (p_CreateFileW && p_MultiByteToWideChar) {
+ // unicode open for open existing read
bfd->fh = p_CreateFileW((LPCWSTR)win32_fname_wchar,
dwaccess, /* Requested access */
dwshare, /* Share modes */
dwflags, /* Flags and attributes */
NULL); /* TemplateFile */
} else {
+ // ascii open
bfd->fh = p_CreateFileA(win32_fname,
dwaccess, /* Requested access */
dwshare, /* Share modes */
Python_IO pio; /* Python I/O routines */
PROCESS_WIN32_BACKUPAPIBLOCK_CONTEXT win32DecompContext; /* context for decomposition of win32 backup streams */
int use_backup_decomp; /* set if using BackupRead Stream Decomposition */
+ bool reparse_point; /* set if reparse point */
};
HANDLE bget_handle(BFILE *bfd);
Python_IO pio; /* Python I/O routines */
PROCESS_WIN32_BACKUPAPIBLOCK_CONTEXT win32DecompContext; /* context for decomposition of win32 backup streams */
int use_backup_decomp; /* set if using BackupRead Stream Decomposition */
+ bool reparse_point; /* not used in Unix */
};
#endif
bool exists = false;
struct stat mstatp;
+ bfd->reparse_point = false;
if (is_win32_stream(attr->data_stream)) {
set_win32_backup(bfd);
} else {
#endif
} /* End inner switch */
+ case FT_REPARSE:
+ bfd->reparse_point = true;
+ /* Fall through wanted */
case FT_DIRBEGIN:
case FT_DIREND:
Dmsg2(200, "Make dir mode=%o dir=%s\n", new_mode, attr->ofname);
case FT_INVALIDFS:
case FT_INVALIDDT:
case FT_NOOPEN:
+ case FT_REPARSE:
// return ff->callback(ff, hpkt, top_level);
/* These items can be filtered */
} else {
ff_pkt->type = FT_DIRBEGIN;
}
+ /* We have set st_rdev to 1 if it is a reparse point, otherwise 0 */
+ if (have_win32_api() && ff_pkt->statp.st_rdev) {
+ ff_pkt->type = FT_REPARSE;
+ }
/*
* Note, we return the directory to the calling program (handle_file)
* when we first see the directory (FT_DIRBEGIN.
* in the directory is seen (i.e. the FT_DIREND).
*/
rtn_stat = handle_file(ff_pkt, pkt, top_level);
- if (rtn_stat < 1) { /* ignore or error status */
+ if (rtn_stat < 1 || ff_pkt->type == FT_REPARSE) { /* ignore or error status */
free(link);
return rtn_stat;
}
free_tls_connection(bsock->tls);
bsock->tls = NULL;
}
- if (bsock->is_timed_out() || bsock->is_terminated()) {
+ if (bsock->is_timed_out()) {
shutdown(bsock->m_fd, SHUT_RDWR); /* discard any pending I/O */
}
socketClose(bsock->m_fd); /* normal close */
int flags;
/* Set socket blocking for shutdown */
- flags = bsock->set_blocking();
+ bsock->set_blocking();
err = SSL_shutdown(bsock->tls->openssl);
openssl_post_errors(M_ERROR, _("TLS shutdown failure."));
break;
}
-
- /* Restore saved flags */
- bsock->restore_blocking(flags);
}
/* Does all the manual labor for tls_bsock_readn() and tls_bsock_writen() */
*/
#undef VERSION
-#define VERSION "2.1.21"
+#define VERSION "2.1.22"
#define BDATE "24 June 2007"
#define LSMDATE "24Jun07"
Technical notes on version 2.1
General:
+Release 2.1.22 beta Win32 binaries only:
24Jun07
+kes Implement Windows reparse points -- similar to directories, but
+ we do not descend into it. This is a first cut. They seem to
+ be backed up, but restore is not yet tested.
+kes Remove restore_blocking in tls code when shutting a socket to leave
+ it in blocking mode. Hopefully this will fix the encryption bug
+ reported by Frank Sweetser.
+kes When opening a file for backup, tell the OS that we are going to
+ read it sequentially -- optimization.
kes Change variable names in authenticate_director() to not conflict
with member names in bat. Caused great confusion with compiler,
but no warnings.
21Jun07
kes Don't print clock skew message in FD if less than 3 seconds diff.
kes Add a bit of VSS info to status client.
-kes Make a gross first cut of Vista VSS, using Win2003 code.
+kes Implement a first cut of Vista VSS, using Win2003 code.
-Release: 2.1.18 beta
+Release: 2.1.20 beta
20Jun07
kes Fixed bug #886 (multidrive autochanger: SD doesn't use drive with
loaded tape but uses first drive).