/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-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.
This program is Free Software; you can redistribute it and/or
- modify it under the terms of version two of the GNU General Public
+ modify it under the terms of version three of the GNU Affero General Public
License as published by the Free Software Foundation and included
in the file LICENSE.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License
+ You should have received a copy of the GNU Affero General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
* Append code for Storage daemon
* Kern Sibbald, May MM
*
- * Version $Id$
*/
#include "bacula.h"
FI_to_ascii(buf1, rec.FileIndex), rec.VolSessionId,
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 ||
- stream == STREAM_RESTORE_OBJECT ||
- crypto_digest_stream_type(stream) != CRYPTO_DIGEST_NONE) {
- if (!jcr->no_attributes) {
- BSOCK *dir = jcr->dir_bsock;
- if (are_attributes_spooled(jcr)) {
- dir->set_spooling();
- }
- Dmsg0(850, "Send attributes to dir.\n");
- if (!dir_update_file_attributes(dcr, &rec)) {
- dir->clear_spooling();
- Jmsg(jcr, M_FATAL, 0, _("Error updating file attributes. ERR=%s\n"),
- dir->bstrerror());
- ok = false;
- break;
- }
- dir->clear_spooling();
- }
- }
+ send_attrs_to_dir(jcr, &rec);
Dmsg0(650, "Enter bnet_get\n");
}
Dmsg1(650, "End read loop with FD. Stat=%d\n", n);
Dmsg1(100, "return from do_append_data() ok=%d\n", ok);
return ok;
}
+
+
+/* Send attributes and digest to Director for Catalog */
+bool send_attrs_to_dir(JCR *jcr, DEV_RECORD *rec)
+{
+ int stream = rec->Stream;
+
+ 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;
+ if (are_attributes_spooled(jcr)) {
+ dir->set_spooling();
+ }
+ Dmsg0(850, "Send attributes to dir.\n");
+ if (!dir_update_file_attributes(jcr->dcr, rec)) {
+ Jmsg(jcr, M_FATAL, 0, _("Error updating file attributes. ERR=%s\n"),
+ dir->bstrerror());
+ dir->clear_spooling();
+ return false;
+ }
+ dir->clear_spooling();
+ }
+ }
+ return true;
+}