#define STREAM_ENCRYPTED_MACOS_FORK_DATA 25 /* Encrypted, uncompressed Mac resource fork */
#define STREAM_PLUGIN_NAME 26 /* Plugin "file" string */
#define STREAM_PLUGIN_DATA 27 /* Plugin specific data */
+#define STREAM_RESTORE_OBJECT 28 /* Special restore object */
/**
* Additional Stream definitions. Once defined these must NEVER
db_start_transaction(jcr, jcr->db); /* start transaction if not already open */
ar = jcr->ar;
- /* Start by scanning directly in the message buffer to get Stream
+ /*
+ * Start by scanning directly in the message buffer to get Stream
* there may be a cached attr so we cannot yet write into
* jcr->attr or jcr->ar
*/
skip_nonspaces(&p); /* FileAttributes */
p += 1;
unser_begin(p, 0);
- unser_uint32(VolSessionId);
- unser_uint32(VolSessionTime);
- unser_int32(FileIndex);
- unser_int32(Stream);
- unser_uint32(data_len);
- p += unser_length(p);
+ unser_uint32(VolSessionId); /* VolSessionId */
+ unser_uint32(VolSessionTime); /* VolSessionTime */
+ unser_int32(FileIndex); /* FileIndex */
+ unser_int32(Stream); /* Stream */
+ unser_uint32(data_len); /* Record length */
+ p += unser_length(p); /* Raw record follows */
+
+ /*
+ * At this point p points to the raw record, which varies according
+ * to what kind of a record (Stream) was sent
+ */
Dmsg1(400, "UpdCat msg=%s\n", msg);
Dmsg5(400, "UpdCat VolSessId=%d VolSessT=%d FI=%d Strm=%d data_len=%d\n",
Dmsg2(400, "dird<filed: stream=%d %s\n", Stream, fname);
Dmsg1(400, "dird<filed: attr=%s\n", attr);
+ } else if (Stream == STREAM_RESTORE_OBJECT) {
+ /* p is beginning of RESTORE_OBJECT */
+ /* ***FIXME**** put RESTORE_OBJECT into catalog */
+
} else if (crypto_digest_stream_type(Stream) != CRYPTO_DIGEST_NONE) {
fname = p;
if (ar->FileIndex != FileIndex) {
if (!jcr->pool->catalog_files) {
return; /* user disabled cataloging */
}
- if (job_canceled(jcr)) {
+ if (jcr->is_job_canceled()) {
goto bail_out;
}
if (!jcr->db) {
update_attribute(jcr, bs->msg, bs->msglen);
bail_out:
- if (job_canceled(jcr)) {
+ if (jcr->is_job_canceled()) {
cancel_storage_daemon_job(jcr);
}
}
Dmsg0(100, "Begin despool_attributes_from_file\n");
- if (job_canceled(jcr) || !jcr->pool->catalog_files || !jcr->db) {
+ if (jcr->is_job_canceled() || !jcr->pool->catalog_files || !jcr->db) {
goto bail_out; /* user disabled cataloging */
}
last = size;
}
}
- if (!job_canceled(jcr)) {
+ if (!jcr->is_job_canceled()) {
update_attribute(jcr, msg, msglen);
- if (job_canceled(jcr)) {
+ if (jcr->is_job_canceled()) {
goto bail_out;
}
}
fclose(spool_fd);
}
- if (job_canceled(jcr)) {
+ if (jcr->is_job_canceled()) {
cancel_storage_daemon_job(jcr);
}
plugin_name_stream(jcr, sd->msg);
break;
+ case STREAM_RESTORE_OBJECT:
+ close_previous_stream(rctx);
+ break;
+
default:
close_previous_stream(rctx);
Jmsg(jcr, M_ERROR, 0, _("Unknown stream=%d ignored. This shouldn't happen!\n"),
*/
dcr->VolFirstIndex = dcr->VolLastIndex = 0;
jcr->run_time = time(NULL); /* start counting time for rates */
- for (last_file_index = 0; ok && !job_canceled(jcr); ) {
+ for (last_file_index = 0; ok && !jcr->is_job_canceled(); ) {
/* Read Stream header from the File daemon.
* The stream header consists of the following:
/* Read data stream from the File daemon.
* The data stream is just raw bytes
*/
- while ((n=bget_msg(fd)) > 0 && !job_canceled(jcr)) {
+ while ((n=bget_msg(fd)) > 0 && !jcr->is_job_canceled()) {
rec.VolSessionId = jcr->VolSessionId;
rec.VolSessionTime = jcr->VolSessionTime;
rec.FileIndex = file_index;
stream_to_ascii(buf2, rec.Stream, rec.FileIndex), rec.data_len);
/* Send attributes and digest to Director for Catalog */
- if (stream == STREAM_UNIX_ATTRIBUTES || stream == STREAM_UNIX_ATTRIBUTES_EX ||
+ if (stream == STREAM_UNIX_ATTRIBUTES ||
+ stream == STREAM_UNIX_ATTRIBUTES_EX ||
+ stream == STREAM_RESTORE_OBJECT ||
crypto_digest_stream_type(stream) != CRYPTO_DIGEST_NONE) {
if (!jcr->no_attributes) {
BSOCK *dir = jcr->dir_bsock;
Dmsg1(650, "End read loop with FD. Stat=%d\n", n);
if (fd->is_error()) {
- if (!job_canceled(jcr)) {
+ if (!jcr->is_job_canceled()) {
Dmsg1(350, "Network read error from FD. ERR=%s\n", fd->bstrerror());
Jmsg1(jcr, M_FATAL, 0, _("Network error reading from FD. ERR=%s\n"),
fd->bstrerror());
if (ok || dev->can_write()) {
if (!write_session_label(dcr, EOS_LABEL)) {
/* Print only if ok and not cancelled to avoid spurious messages */
- if (ok && !job_canceled(jcr)) {
+ if (ok && !jcr->is_job_canceled()) {
Jmsg1(jcr, M_FATAL, 0, _("Error writing end session label. ERR=%s\n"),
dev->bstrerror());
}
/* Flush out final partial block of this session */
if (!write_block_to_device(dcr)) {
/* Print only if ok and not cancelled to avoid spurious messages */
- if (ok && !job_canceled(jcr)) {
+ if (ok && !jcr->is_job_canceled()) {
Jmsg2(jcr, M_FATAL, 0, _("Fatal append error on device %s: ERR=%s\n"),
dev->print_name(), dev->bstrerror());
Dmsg0(100, _("Set ok=FALSE after write_block_to_device.\n"));
*/
release_device(dcr);
- if (!ok || job_canceled(jcr)) {
+ if (!ok || jcr->is_job_canceled()) {
discard_attribute_spool(jcr);
} else {
commit_attribute_spool(jcr);
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2006-2009 Free Software Foundation Europe e.V.
+ Copyright (C) 2006-2010 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.
*
* Kern Sibbald, January MMVI
*
- * Version $Id$
*/
#include "bacula.h"
/* Send attributes and digest to Director for Catalog */
stream = rec->Stream;
- if (stream == STREAM_UNIX_ATTRIBUTES || stream == STREAM_UNIX_ATTRIBUTES_EX ||
+ if (stream == STREAM_UNIX_ATTRIBUTES ||
+ stream == STREAM_UNIX_ATTRIBUTES_EX ||
+ stream == STREAM_RESTORE_OBJECT ||
crypto_digest_stream_type(stream) != CRYPTO_DIGEST_NONE) {
if (!jcr->no_attributes) {
BSOCK *dir = jcr->dir_bsock;
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2002-2008 Free Software Foundation Europe e.V.
+ Copyright (C) 2002-2010 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.
*
* Kern Sibbald, June MMII
*
- * Version $Id$
*/
/*
if (bsr->fileregex_re == NULL)
return 1;
- if (bsr->attr == NULL)
+ if (bsr->attr == NULL) {
bsr->attr = new_attr(jcr);
+ }
- /* The code breaks if the first record associated with a file is
+ /*
+ * The code breaks if the first record associated with a file is
* not of this type
*/
if (rec->Stream == STREAM_UNIX_ATTRIBUTES ||
* Kern Sibbald, April MMI
* added BB02 format October MMII
*
- * Version $Id$
- *
*/
return "UATTR";
case STREAM_FILE_DATA:
return "DATA";
+ case STREAM_RESTORE_OBJECT:
+ return "RESTORE_OBJECT";
case STREAM_WIN32_DATA:
return "WIN32-DATA";
case STREAM_WIN32_GZIP_DATA:
return "contUATTR";
case -STREAM_FILE_DATA:
return "contDATA";
+ case -STREAM_RESTORE_OBJECT:
+ return "contRESTORE_OBJECT";
case -STREAM_WIN32_DATA:
return "contWIN32-DATA";
case -STREAM_WIN32_GZIP_DATA: