/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2010 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2011 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.
set_find_options((FF_PKT *)jcr->ff, jcr->incremental, jcr->mtime);
- /** in accurate mode, we overwrite the find_one check function */
+ /** in accurate mode, we overload the find_one check function */
if (jcr->accurate) {
set_find_changed_function((FF_PKT *)jcr->ff, accurate_check_file);
}
#endif
BSOCK *sd = jcr->store_bsock;
- if (jcr->is_job_canceled()) {
+ if (jcr->is_canceled() || jcr->is_incomplete()) {
return 0;
}
case FT_NOFSCHG:
/* Suppress message for /dev filesystems */
if (!is_in_fileset(ff_pkt)) {
-#ifdef HAVE_WIN32
- Jmsg(jcr, M_INFO, 1, _(" %s is a junction point or a different filesystem. Will not descend from %s into it.\n"),
- ff_pkt->fname, ff_pkt->top_fname);
-#else
Jmsg(jcr, M_INFO, 1, _(" %s is a different filesystem. Will not descend from %s into it.\n"),
ff_pkt->fname, ff_pkt->top_fname);
-#endif
}
ff_pkt->type = FT_DIREND; /* Backup only the directory entry */
break;
ff_pkt->fname);
break;
case FT_REPARSE:
+ case FT_JUNCTION:
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 ||
+ ff_pkt->type == FT_REPARSE || ff_pkt->type == FT_JUNCTION ||
(!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;
+ ff_pkt->bfd.reparse_point = (ff_pkt->type == FT_REPARSE ||
+ ff_pkt->type == FT_JUNCTION);
if (bopen(&ff_pkt->bfd, ff_pkt->fname, O_RDONLY | O_BINARY | noatime, 0) < 0) {
ff_pkt->ff_errno = errno;
berrno be;
goto good_rtn;
}
flags = ff_pkt->flags;
- ff_pkt->flags &= ~(FO_GZIP|FO_SPARSE);
+ ff_pkt->flags &= ~(FO_GZIP|FO_SPARSE|FO_OFFSETS);
if (flags & FO_ENCRYPT) {
rsrc_stream = STREAM_ENCRYPTED_MACOS_FORK_DATA;
} else {
}
good_rtn:
- rtnstat = jcr->is_job_canceled() ? 0 : 1; /* good return if not canceled */
+ rtnstat = jcr->is_canceled() ? 0 : 1; /* good return if not canceled */
bail_out:
+ if (jcr->is_incomplete()) {
+ rtnstat = 0;
+ }
if (ff_pkt->cmd_plugin && plugin_started) {
send_plugin_name(jcr, sd, false); /* signal end of plugin data */
}
int zstat;
if (ff_pkt->flags & FO_GZIP) {
- if ((ff_pkt->flags & FO_SPARSE) || (ff_pkt->flags & FO_DELTA)) {
- cbuf = (Bytef *)jcr->compress_buf + SPARSE_FADDR_SIZE;
- max_compress_len = jcr->compress_buf_size - SPARSE_FADDR_SIZE;
+ if ((ff_pkt->flags & FO_SPARSE) || (ff_pkt->flags & FO_OFFSETS)) {
+ cbuf = (Bytef *)jcr->compress_buf + OFFSET_FADDR_SIZE;
+ max_compress_len = jcr->compress_buf_size - OFFSET_FADDR_SIZE;
} else {
cbuf = (Bytef *)jcr->compress_buf;
max_compress_len = jcr->compress_buf_size; /* set max length */
#endif
if (ff_pkt->flags & FO_ENCRYPT) {
- if (ff_pkt->flags & FO_SPARSE) {
- Jmsg0(jcr, M_FATAL, 0, _("Encrypting sparse data not supported.\n"));
+ if ((ff_pkt->flags & FO_SPARSE) || (ff_pkt->flags & FO_OFFSETS)) {
+ Jmsg0(jcr, M_FATAL, 0, _("Encrypting sparse or offset data not supported.\n"));
goto err;
}
/** Allocate the cipher context */
* Make space at beginning of buffer for fileAddr because this
* same buffer will be used for writing if compression is off.
*/
- if ((ff_pkt->flags & FO_SPARSE) || (ff_pkt->flags & FO_DELTA)) {
- rbuf += SPARSE_FADDR_SIZE;
- rsize -= SPARSE_FADDR_SIZE;
+ if ((ff_pkt->flags & FO_SPARSE) || (ff_pkt->flags & FO_OFFSETS)) {
+ rbuf += OFFSET_FADDR_SIZE;
+ rsize -= OFFSET_FADDR_SIZE;
#ifdef HAVE_FREEBSD_OS
/**
* To read FreeBSD partitions, the read size must be
}
if (!allZeros) {
/** Put file address as first data in buffer */
- ser_begin(wbuf, SPARSE_FADDR_SIZE);
+ ser_begin(wbuf, OFFSET_FADDR_SIZE);
ser_uint64(fileAddr); /* store fileAddr in begin of buffer */
}
fileAddr += sd->msglen; /* update file address */
if (allZeros) {
continue; /* skip block of zeros */
}
- } else if (ff_pkt->flags & FO_DELTA) {
+ } else if (ff_pkt->flags & FO_OFFSETS) {
ser_declare;
- ser_begin(wbuf, SPARSE_FADDR_SIZE);
+ ser_begin(wbuf, OFFSET_FADDR_SIZE);
ser_uint64(ff_pkt->bfd.offset); /* store offset in begin of buffer */
}
uint32_t initial_len = 0;
ser_declare;
- if ((ff_pkt->flags & FO_SPARSE) || (ff_pkt->flags & FO_DELTA)) {
- cipher_input_len += SPARSE_FADDR_SIZE;
+ if ((ff_pkt->flags & FO_SPARSE) || (ff_pkt->flags & FO_OFFSETS)) {
+ cipher_input_len += OFFSET_FADDR_SIZE;
}
/** Encrypt the length of the input block */
}
/* Send the buffer to the Storage daemon */
- if ((ff_pkt->flags & FO_SPARSE) || (ff_pkt->flags & FO_DELTA)) {
- sd->msglen += SPARSE_FADDR_SIZE; /* include fileAddr in size */
+ if ((ff_pkt->flags & FO_SPARSE) || (ff_pkt->flags & FO_OFFSETS)) {
+ sd->msglen += OFFSET_FADDR_SIZE; /* include fileAddr in size */
}
sd->msg = wbuf; /* set correct write buffer */
if (!sd->send()) {
int attr_stream;
int comp_len;
bool stat;
+ int hangup = get_hangup();
#ifdef FD_NO_SEND_TEST
return true;
#endif
pm_strcpy(jcr->last_fname, ff_pkt->fname);
jcr->unlock();
+ /* Debug code: check if we must hangup */
+ if (hangup && (jcr->JobFiles > (uint32_t)hangup)) {
+ jcr->setJobStatus(JS_Incomplete);
+ Jmsg1(jcr, M_FATAL, 0, "Debug hangup requested after %d files.\n", hangup);
+ set_hangup(0);
+ return false;
+ }
+
/**
* Send Attributes header to Storage daemon
* <file-index> <stream> <info>
*/
if (!sd->fsend("%ld %d 0", jcr->JobFiles, attr_stream)) {
- if (!jcr->is_job_canceled()) {
+ if (!jcr->is_canceled() && !jcr->is_incomplete()) {
Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
sd->bstrerror());
}
break;
case FT_DIREND:
case FT_REPARSE:
+ case FT_JUNCTION:
/* Here link is the canonical filename (i.e. with trailing slash) */
stat = sd->fsend("%ld %d %s%c%s%c%c%s%c%u%c", jcr->JobFiles,
ff_pkt->type, ff_pkt->link, 0, attribs, 0, 0,
ff_pkt->object_name = (char *)"job_metadata.xml";
ff_pkt->object = (char *)metadata;
ff_pkt->object_len = (wcslen(metadata) + 1) * sizeof(WCHAR);
+ ff_pkt->object_index = (int)time(NULL);
save_file(jcr, ff_pkt, true);
}
}