The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
}
if (!sd->set_buffer_size(buf_size, BNET_SETBUF_WRITE)) {
jcr->setJobStatus(JS_ErrorTerminated);
}
if (!sd->set_buffer_size(buf_size, BNET_SETBUF_WRITE)) {
jcr->setJobStatus(JS_ErrorTerminated);
* same output buffer can be used without growing it.
*
* For LZO1X compression the recommended value is :
* same output buffer can be used without growing it.
*
* For LZO1X compression the recommended value is :
*
* The zlib compression workset is initialized here to minimize
* the "per file" load. The jcr member is only set, if the init
*
* The zlib compression workset is initialized here to minimize
* the "per file" load. The jcr member is only set, if the init
pZlibStream->state = Z_NULL;
if (deflateInit(pZlibStream, Z_DEFAULT_COMPRESSION) == Z_OK) {
pZlibStream->state = Z_NULL;
if (deflateInit(pZlibStream, Z_DEFAULT_COMPRESSION) == Z_OK) {
/* Subroutine save_file() is called for each file */
if (!find_files(jcr, (FF_PKT *)jcr->ff, save_file, plugin_save)) {
/* Subroutine save_file() is called for each file */
if (!find_files(jcr, (FF_PKT *)jcr->ff, save_file, plugin_save)) {
- if (jcr->xacl->get_acl_nr_errors() > 0) {
- Jmsg(jcr, M_WARNING, 0, _("Had %ld acl errors while doing backup\n"), jcr->xacl->get_acl_nr_errors());
- }
-
- if (jcr->xacl->get_xattr_nr_errors() > 0) {
- Jmsg(jcr, M_WARNING, 0, _("Had %ld xattr errors while doing backup\n"), jcr->xacl->get_xattr_nr_errors());
+ if (jcr->xacl) {
+ if (jcr->xacl->get_acl_nr_errors() > 0) {
+ Jmsg(jcr, M_WARNING, 0, _("Had %ld acl errors while doing backup\n"),
+ jcr->xacl->get_acl_nr_errors());
+ }
+ if (jcr->xacl->get_xattr_nr_errors() > 0) {
+ Jmsg(jcr, M_WARNING, 0, _("Had %ld xattr errors while doing backup\n"),
+ jcr->xacl->get_xattr_nr_errors());
+ }
/* Delete or keep snapshots */
close_snapshot_backup_session(jcr);
close_vss_backup_session(jcr);
/* Delete or keep snapshots */
close_snapshot_backup_session(jcr);
close_vss_backup_session(jcr);
} else if (now >= jcr->last_stat_time + jcr->stat_interval) {
jcr->dir_bsock->fsend("Progress Job=x files=%ld bytes=%lld bps=%ld\n",
} else if (now >= jcr->last_stat_time + jcr->stat_interval) {
jcr->dir_bsock->fsend("Progress Job=x files=%ld bytes=%lld bps=%ld\n",
Dmsg2(130, "FT_LNKSAVED hard link: %s => %s\n", ff_pkt->fname, ff_pkt->link);
break;
case FT_REGE:
Dmsg2(130, "FT_LNKSAVED hard link: %s => %s\n", ff_pkt->fname, ff_pkt->link);
break;
case FT_REGE:
- Jmsg(jcr, M_INFO, 1, _(" Recursion turned off. Will not descend from %s into %s\n"),
- ff_pkt->top_fname, ff_pkt->fname);
+ Jmsg(jcr, M_INFO, 1, _(" Recursion turned off. Will not descend from %s into %s\n"),
+ ff_pkt->top_fname, ff_pkt->fname);
ff_pkt->type = FT_DIREND; /* Backup only the directory entry */
break;
case FT_NOFSCHG:
/* Suppress message for /dev filesystems */
if (!is_in_fileset(ff_pkt)) {
ff_pkt->type = FT_DIREND; /* Backup only the directory entry */
break;
case FT_NOFSCHG:
/* Suppress message for /dev filesystems */
if (!is_in_fileset(ff_pkt)) {
- 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);
+ 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);
- Jmsg(jcr, M_INFO, 1, _(" Disallowed filesystem. Will not descend from %s into %s\n"),
- ff_pkt->top_fname, ff_pkt->fname);
+ Jmsg(jcr, M_INFO, 1, _(" Disallowed filesystem. Will not descend from %s into %s\n"),
+ ff_pkt->top_fname, ff_pkt->fname);
- Jmsg(jcr, M_INFO, 1, _(" Disallowed drive type. Will not descend into %s\n"),
- ff_pkt->fname);
+ Jmsg(jcr, M_INFO, 1, _(" Disallowed drive type. Will not descend into %s\n"),
+ ff_pkt->fname);
case FT_SPEC:
Dmsg1(130, "FT_SPEC saving: %s\n", ff_pkt->fname);
if (S_ISSOCK(ff_pkt->statp.st_mode)) {
case FT_SPEC:
Dmsg1(130, "FT_SPEC saving: %s\n", ff_pkt->fname);
if (S_ISSOCK(ff_pkt->statp.st_mode)) {
- Jmsg(jcr, M_SKIPPED, 1, _(" Socket file skipped: %s\n"), ff_pkt->fname);
- return 1;
+ Jmsg(jcr, M_SKIPPED, 1, _(" Socket file skipped: %s\n"), ff_pkt->fname);
+ return 1;
case FT_NOACCESS: {
berrno be;
Jmsg(jcr, M_NOTSAVED, 0, _(" Could not access \"%s\": ERR=%s\n"), ff_pkt->fname,
case FT_NOACCESS: {
berrno be;
Jmsg(jcr, M_NOTSAVED, 0, _(" Could not access \"%s\": ERR=%s\n"), ff_pkt->fname,
jcr->JobErrors++;
return 1;
}
case FT_NOFOLLOW: {
berrno be;
Jmsg(jcr, M_NOTSAVED, 0, _(" Could not follow link \"%s\": ERR=%s\n"),
jcr->JobErrors++;
return 1;
}
case FT_NOFOLLOW: {
berrno be;
Jmsg(jcr, M_NOTSAVED, 0, _(" Could not follow link \"%s\": ERR=%s\n"),
jcr->JobErrors++;
return 1;
}
case FT_NOSTAT: {
berrno be;
Jmsg(jcr, M_NOTSAVED, 0, _(" Could not stat \"%s\": ERR=%s\n"), ff_pkt->fname,
jcr->JobErrors++;
return 1;
}
case FT_NOSTAT: {
berrno be;
Jmsg(jcr, M_NOTSAVED, 0, _(" Could not stat \"%s\": ERR=%s\n"), ff_pkt->fname,
case FT_NOOPEN: {
berrno be;
Jmsg(jcr, M_NOTSAVED, 0, _(" Could not open directory \"%s\": ERR=%s\n"),
case FT_NOOPEN: {
berrno be;
Jmsg(jcr, M_NOTSAVED, 0, _(" Could not open directory \"%s\": ERR=%s\n"),
- Jmsg(jcr, M_NOTSAVED, 0, _(" Unknown file type %d; not saved: %s\n"),
- ff_pkt->type, ff_pkt->fname);
+ Jmsg(jcr, M_NOTSAVED, 0, _(" Unknown file type %d; not saved: %s\n"),
+ ff_pkt->type, ff_pkt->fname);
/* ask the option plugin what to do with this file */
switch (plugin_option_handle_file(jcr, ff_pkt, &sp)) {
case bRC_OK:
/* ask the option plugin what to do with this file */
switch (plugin_option_handle_file(jcr, ff_pkt, &sp)) {
case bRC_OK:
- Dmsg2(10, "Option plugin %s will be used to backup %s\n",
- ff_pkt->plugin, ff_pkt->fname);
- do_plugin_set = true;
- break;
+ Dmsg2(10, "Option plugin %s will be used to backup %s\n",
+ ff_pkt->plugin, ff_pkt->fname);
+ do_plugin_set = true;
+ break;
- Dmsg2(10, "Option plugin %s decided to skip %s\n",
- ff_pkt->plugin, ff_pkt->fname);
- goto good_rtn;
+ Dmsg2(10, "Option plugin %s decided to skip %s\n",
+ ff_pkt->plugin, ff_pkt->fname);
+ goto good_rtn;
- Dmsg2(10, "Option plugin %s decided to let bacula handle %s\n",
- ff_pkt->plugin, ff_pkt->fname);
- break;
+ Dmsg2(10, "Option plugin %s decided to let bacula handle %s\n",
+ ff_pkt->plugin, ff_pkt->fname);
+ break;
}
}
if (do_plugin_set) {
/* Tell bfile that it needs to call plugin */
if (!set_cmd_plugin(&ff_pkt->bfd, jcr)) {
}
}
if (do_plugin_set) {
/* Tell bfile that it needs to call plugin */
if (!set_cmd_plugin(&ff_pkt->bfd, jcr)) {
/** Set up the encryption context and send the session data to the SD */
if (has_file_data && jcr->crypto.pki_encrypt) {
if (!crypto_session_send(jcr, sd)) {
/** Set up the encryption context and send the session data to the SD */
if (has_file_data && jcr->crypto.pki_encrypt) {
if (!crypto_session_send(jcr, sd)) {
- ff_pkt->type == FT_REPARSE || ff_pkt->type == FT_JUNCTION ||
- (!is_portable_backup(&ff_pkt->bfd) && ff_pkt->type == FT_DIREND)) {
+ ff_pkt->type == FT_REPARSE || ff_pkt->type == FT_JUNCTION ||
+ (!is_portable_backup(&ff_pkt->bfd) && ff_pkt->type == FT_DIREND)) {
}
int noatime = ff_pkt->flags & FO_NOATIME ? O_NOATIME : 0;
ff_pkt->bfd.reparse_point = (ff_pkt->type == FT_REPARSE ||
}
int noatime = ff_pkt->flags & FO_NOATIME ? O_NOATIME : 0;
ff_pkt->bfd.reparse_point = (ff_pkt->type == FT_REPARSE ||
set_fattrs(&ff_pkt->bfd, &ff_pkt->statp);
if (bopen(&ff_pkt->bfd, ff_pkt->fname, O_RDONLY | O_BINARY | noatime, 0) < 0) {
set_fattrs(&ff_pkt->bfd, &ff_pkt->statp);
if (bopen(&ff_pkt->bfd, ff_pkt->fname, O_RDONLY | O_BINARY | noatime, 0) < 0) {
- ff_pkt->ff_errno = errno;
- berrno be;
- Jmsg(jcr, M_NOTSAVED, 0, _(" Cannot open \"%s\": ERR=%s.\n"), ff_pkt->fname,
- be.bstrerror());
- jcr->JobErrors++;
- if (tid) {
- stop_thread_timer(tid);
- tid = NULL;
- }
- goto good_rtn;
+ ff_pkt->ff_errno = errno;
+ berrno be;
+ Jmsg(jcr, M_NOTSAVED, 0, _(" Cannot open \"%s\": ERR=%s.\n"), ff_pkt->fname,
+ be.bstrerror());
+ jcr->JobErrors++;
+ if (tid) {
+ stop_thread_timer(tid);
+ tid = NULL;
+ }
+ goto good_rtn;
}
stat = send_data(bctx, bctx.data_stream);
if (ff_pkt->flags & FO_CHKCHANGES) {
}
stat = send_data(bctx, bctx.data_stream);
if (ff_pkt->flags & FO_CHKCHANGES) {
send_plugin_name(jcr, sd, false); /* signal end of plugin data */
}
if (ff_pkt->opt_plugin) {
send_plugin_name(jcr, sd, false); /* signal end of plugin data */
}
if (ff_pkt->opt_plugin) {
- bctx.rbuf = sd->msg; /* read buffer */
- bctx.wbuf = sd->msg; /* write buffer */
- bctx.cipher_input = (uint8_t *)bctx.rbuf; /* encrypt uncompressed data */
+ bctx.rbuf = sd->msg; /* read buffer */
+ bctx.wbuf = sd->msg; /* write buffer */
+ bctx.cipher_input = (uint8_t *)bctx.rbuf; /* encrypt uncompressed data */
Dmsg1(300, "Saving data, type=%d\n", bctx.ff_pkt->type);
Dmsg1(300, "Saving data, type=%d\n", bctx.ff_pkt->type);
*/
if (!sd->fsend("%ld %d %lld", jcr->JobFiles, stream,
*/
if (!sd->fsend("%ld %d %lld", jcr->JobFiles, stream,
- Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
- sd->bstrerror());
+ Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
+ sd->bstrerror());
*/
if ((bctx.ff_pkt->flags & FO_SPARSE) || (bctx.ff_pkt->flags & FO_OFFSETS)) {
bctx.rbuf += OFFSET_FADDR_SIZE;
*/
if ((bctx.ff_pkt->flags & FO_SPARSE) || (bctx.ff_pkt->flags & FO_OFFSETS)) {
bctx.rbuf += OFFSET_FADDR_SIZE;
Dmsg1(200, "Fattrs=0X%x\n", bctx.ff_pkt->bfd.fattrs);
if (bctx.ff_pkt->bfd.fattrs & FILE_ATTRIBUTE_ENCRYPTED) {
if (!p_ReadEncryptedFileRaw) {
Dmsg1(200, "Fattrs=0X%x\n", bctx.ff_pkt->bfd.fattrs);
if (bctx.ff_pkt->bfd.fattrs & FILE_ATTRIBUTE_ENCRYPTED) {
if (!p_ReadEncryptedFileRaw) {
- Jmsg0(bctx.jcr, M_FATAL, 0, _("Windows Encrypted data not supported on this OS.\n"));
- goto err;
+ Jmsg0(bctx.jcr, M_FATAL, 0, _("Windows Encrypted data not supported on this OS.\n"));
+ goto err;
}
/* This single call reads all EFS data delivers it to a callback */
if (p_ReadEncryptedFileRaw((PFE_EXPORT_FUNC)read_efs_data_cb, &bctx,
}
/* This single call reads all EFS data delivers it to a callback */
if (p_ReadEncryptedFileRaw((PFE_EXPORT_FUNC)read_efs_data_cb, &bctx,
*/
while ((sd->msglen=(uint32_t)bread(&bctx.ff_pkt->bfd, bctx.rbuf, bctx.rsize)) > 0) {
if (!process_and_send_data(bctx)) {
*/
while ((sd->msglen=(uint32_t)bread(&bctx.ff_pkt->bfd, bctx.rbuf, bctx.rsize)) > 0) {
if (!process_and_send_data(bctx)) {
berrno be;
Jmsg(jcr, M_ERROR, 0, _("Read error on file %s. ERR=%s\n"),
berrno be;
Jmsg(jcr, M_ERROR, 0, _("Read error on file %s. ERR=%s\n"),
- bctx.ff_pkt->fname, be.bstrerror(bctx.ff_pkt->bfd.berrno));
- if (jcr->JobErrors++ > 1000) { /* insanity check */
- Jmsg(jcr, M_FATAL, 0, _("Too many errors. JobErrors=%d.\n"), jcr->JobErrors);
+ bctx.ff_pkt->fname, be.bstrerror(bctx.ff_pkt->bfd.berrno));
+ if (jcr->JobErrors++ > 1000) { /* insanity check */
+ Jmsg(jcr, M_FATAL, 0, _("Too many errors. JobErrors=%d.\n"), jcr->JobErrors);
- &bctx.encrypted_len)) {
- /* Padding failed. Shouldn't happen. */
- Jmsg(jcr, M_FATAL, 0, _("Encryption padding error\n"));
- goto err;
+ &bctx.encrypted_len)) {
+ /* Padding failed. Shouldn't happen. */
+ Jmsg(jcr, M_FATAL, 0, _("Encryption padding error\n"));
+ goto err;
}
/** Note, on SSL pre-0.9.7, there is always some output */
if (bctx.encrypted_len > 0) {
}
/** Note, on SSL pre-0.9.7, there is always some output */
if (bctx.encrypted_len > 0) {
- sd->msglen = bctx.encrypted_len; /* set encrypted length */
- sd->msg = jcr->crypto.crypto_buf; /* set correct write buffer */
- if (!sd->send()) {
- if (!jcr->is_job_canceled()) {
- Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
- sd->bstrerror());
- }
- goto err;
- }
- Dmsg1(130, "Send data to SD len=%d\n", sd->msglen);
- jcr->JobBytes += sd->msglen; /* count bytes saved possibly compressed/encrypted */
- sd->msg = bctx.msgsave; /* restore bnet buffer */
+ sd->msglen = bctx.encrypted_len; /* set encrypted length */
+ sd->msg = jcr->crypto.crypto_buf; /* set correct write buffer */
+ if (!sd->send()) {
+ if (!jcr->is_job_canceled()) {
+ Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
+ sd->bstrerror());
+ }
+ goto err;
+ }
+ Dmsg1(130, "Send data to SD len=%d\n", sd->msglen);
+ jcr->JobBytes += sd->msglen; /* count bytes saved possibly compressed/encrypted */
+ sd->msg = bctx.msgsave; /* restore bnet buffer */
- Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
- sd->bstrerror());
+ Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
+ sd->bstrerror());
- bctx.fileAddr+sd->msglen < (uint64_t)bctx.ff_pkt->statp.st_size) ||
- ((bctx.ff_pkt->type == FT_RAW || bctx.ff_pkt->type == FT_FIFO) &&
- (uint64_t)bctx.ff_pkt->statp.st_size == 0)) {
- allZeros = is_buf_zero(bctx.rbuf, bctx.rsize);
+ bctx.fileAddr+sd->msglen < (uint64_t)bctx.ff_pkt->statp.st_size) ||
+ ((bctx.ff_pkt->type == FT_RAW || bctx.ff_pkt->type == FT_FIFO) &&
+ (uint64_t)bctx.ff_pkt->statp.st_size == 0)) {
+ allZeros = is_buf_zero(bctx.rbuf, bctx.rsize);
- /** Put file address as first data in buffer */
- ser_begin(bctx.wbuf, OFFSET_FADDR_SIZE);
- ser_uint64(bctx.fileAddr); /* store fileAddr in begin of buffer */
+ /** Put file address as first data in buffer */
+ ser_begin(bctx.wbuf, OFFSET_FADDR_SIZE);
+ ser_uint64(bctx.fileAddr); /* store fileAddr in begin of buffer */
Dmsg1(20, "Encrypt len=%d\n", bctx.cipher_input_len);
if (!crypto_cipher_update(bctx.cipher_ctx, packet_len, sizeof(packet_len),
Dmsg1(20, "Encrypt len=%d\n", bctx.cipher_input_len);
if (!crypto_cipher_update(bctx.cipher_ctx, packet_len, sizeof(packet_len),
- (uint8_t *)jcr->crypto.crypto_buf, &initial_len)) {
- /** Encryption failed. Shouldn't happen. */
- Jmsg(jcr, M_FATAL, 0, _("Encryption error\n"));
- goto err;
+ (uint8_t *)jcr->crypto.crypto_buf, &initial_len)) {
+ /** Encryption failed. Shouldn't happen. */
+ Jmsg(jcr, M_FATAL, 0, _("Encryption error\n"));
+ goto err;
}
/** Encrypt the input block */
if (crypto_cipher_update(bctx.cipher_ctx, bctx.cipher_input, bctx.cipher_input_len,
}
/** Encrypt the input block */
if (crypto_cipher_update(bctx.cipher_ctx, bctx.cipher_input, bctx.cipher_input_len,
- (uint8_t *)&jcr->crypto.crypto_buf[initial_len], &bctx.encrypted_len)) {
- if ((initial_len + bctx.encrypted_len) == 0) {
- /** No full block of data available, read more data */
- return true;
- }
- Dmsg2(400, "encrypted len=%d unencrypted len=%d\n", bctx.encrypted_len,
- sd->msglen);
- sd->msglen = initial_len + bctx.encrypted_len; /* set encrypted length */
+ (uint8_t *)&jcr->crypto.crypto_buf[initial_len], &bctx.encrypted_len)) {
+ if ((initial_len + bctx.encrypted_len) == 0) {
+ /** No full block of data available, read more data */
+ return true;
+ }
+ Dmsg2(400, "encrypted len=%d unencrypted len=%d\n", bctx.encrypted_len,
+ sd->msglen);
+ sd->msglen = initial_len + bctx.encrypted_len; /* set encrypted length */
- /** Encryption failed. Shouldn't happen. */
- Jmsg(jcr, M_FATAL, 0, _("Encryption error\n"));
- goto err;
+ /** Encryption failed. Shouldn't happen. */
+ Jmsg(jcr, M_FATAL, 0, _("Encryption error\n"));
+ goto err;
if ((bctx.ff_pkt->flags & FO_SPARSE) || (bctx.ff_pkt->flags & FO_OFFSETS)) {
sd->msglen += OFFSET_FADDR_SIZE; /* include fileAddr in size */
}
if ((bctx.ff_pkt->flags & FO_SPARSE) || (bctx.ff_pkt->flags & FO_OFFSETS)) {
sd->msglen += OFFSET_FADDR_SIZE; /* include fileAddr in size */
}
- Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
- sd->bstrerror());
+ Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
+ sd->bstrerror());
Dmsg3(300, "File %s\nattribs=%s\nattribsEx=%s\n", ff_pkt->fname, attribs, attribsEx);
jcr->lock();
Dmsg3(300, "File %s\nattribs=%s\nattribsEx=%s\n", ff_pkt->fname, attribs, attribsEx);
jcr->lock();
ff_pkt->FileIndex = jcr->JobFiles; /* return FileIndex */
pm_strcpy(jcr->last_fname, ff_pkt->fname);
jcr->unlock();
ff_pkt->FileIndex = jcr->JobFiles; /* return FileIndex */
pm_strcpy(jcr->last_fname, ff_pkt->fname);
jcr->unlock();
*/
if (!sd->fsend("%ld %d 0", jcr->JobFiles, attr_stream)) {
if (!jcr->is_canceled() && !jcr->is_incomplete()) {
*/
if (!sd->fsend("%ld %d 0", jcr->JobFiles, attr_stream)) {
if (!jcr->is_canceled() && !jcr->is_incomplete()) {
- Jmsg2(jcr, M_FATAL, 0, _("Network send error to SD. Data=%s ERR=%s\n"),
- sd->msg, sd->bstrerror());
+ Jmsg2(jcr, M_FATAL, 0, _("Network send error to SD. Data=%s ERR=%s\n"),
+ sd->msg, sd->bstrerror());
*
* For a directory, link is the same as fname, but with trailing
* slash. For a linked file, link is the link.
*
* For a directory, link is the same as fname, but with trailing
* slash. For a linked file, link is the link.
case FT_LNKSAVED:
Dmsg3(300, "Link %d %s to %s\n", jcr->JobFiles, ff_pkt->fname, ff_pkt->link);
stat = sd->fsend("%ld %d %s%c%s%c%s%c%s%c%u%c", jcr->JobFiles,
case FT_LNKSAVED:
Dmsg3(300, "Link %d %s to %s\n", jcr->JobFiles, ff_pkt->fname, ff_pkt->link);
stat = sd->fsend("%ld %d %s%c%s%c%s%c%s%c%u%c", jcr->JobFiles,
- ff_pkt->type, ff_pkt->fname, 0, attribs, 0,
- ff_pkt->link, 0, attribsEx, 0, ff_pkt->delta_seq, 0);
+ ff_pkt->type, ff_pkt->fname, 0, attribs, 0,
+ ff_pkt->link, 0, attribsEx, 0, ff_pkt->delta_seq, 0);
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,
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,
- attribsEx, 0, ff_pkt->delta_seq, 0);
+ ff_pkt->type, ff_pkt->link, 0, attribs, 0, 0,
+ attribsEx, 0, ff_pkt->delta_seq, 0);
break;
case FT_PLUGIN_CONFIG:
case FT_RESTORE_FIRST:
comp_len = ff_pkt->object_len;
ff_pkt->object_compression = 0;
if (ff_pkt->object_len > 1000) {
break;
case FT_PLUGIN_CONFIG:
case FT_RESTORE_FIRST:
comp_len = ff_pkt->object_len;
ff_pkt->object_compression = 0;
if (ff_pkt->object_len > 1000) {
- /* Big object, compress it */
- comp_len = ff_pkt->object_len + 1000;
- POOLMEM *comp_obj = get_memory(comp_len);
- /* *** FIXME *** check Zdeflate error */
- Zdeflate(ff_pkt->object, ff_pkt->object_len, comp_obj, comp_len);
- if (comp_len < ff_pkt->object_len) {
- ff_pkt->object = comp_obj;
- ff_pkt->object_compression = 1; /* zlib level 9 compression */
- } else {
- /* Uncompressed object smaller, use it */
- comp_len = ff_pkt->object_len;
- }
- Dmsg2(100, "Object compressed from %d to %d bytes\n", ff_pkt->object_len, comp_len);
+ /* Big object, compress it */
+ comp_len = ff_pkt->object_len + 1000;
+ POOLMEM *comp_obj = get_memory(comp_len);
+ /* *** FIXME *** check Zdeflate error */
+ Zdeflate(ff_pkt->object, ff_pkt->object_len, comp_obj, comp_len);
+ if (comp_len < ff_pkt->object_len) {
+ ff_pkt->object = comp_obj;
+ ff_pkt->object_compression = 1; /* zlib level 9 compression */
+ } else {
+ /* Uncompressed object smaller, use it */
+ comp_len = ff_pkt->object_len;
+ }
+ Dmsg2(100, "Object compressed from %d to %d bytes\n", ff_pkt->object_len, comp_len);
- jcr->JobFiles, ff_pkt->type, ff_pkt->object_index,
- comp_len, ff_pkt->object_len, ff_pkt->object_compression,
- ff_pkt->fname, 0, ff_pkt->object_name, 0);
+ jcr->JobFiles, ff_pkt->type, ff_pkt->object_index,
+ comp_len, ff_pkt->object_len, ff_pkt->object_compression,
+ ff_pkt->fname, 0, ff_pkt->object_name, 0);
sd->msg = check_pool_memory_size(sd->msg, sd->msglen + comp_len + 2);
memcpy(sd->msg + sd->msglen, ff_pkt->object, comp_len);
/* Note we send one extra byte so Dir can store zero after object */
sd->msglen += comp_len + 1;
stat = sd->send();
if (ff_pkt->object_compression) {
sd->msg = check_pool_memory_size(sd->msg, sd->msglen + comp_len + 2);
memcpy(sd->msg + sd->msglen, ff_pkt->object, comp_len);
/* Note we send one extra byte so Dir can store zero after object */
sd->msglen += comp_len + 1;
stat = sd->send();
if (ff_pkt->object_compression) {
- ff_pkt->type, ff_pkt->fname, 0, attribs, 0, 0, attribsEx, 0,
- ff_pkt->delta_seq, 0);
+ ff_pkt->type, ff_pkt->fname, 0, attribs, 0, 0, attribsEx, 0,
+ ff_pkt->delta_seq, 0);
- ff_pkt->type, ff_pkt->fname, 0, attribs, 0, 0,
- attribsEx, 0, ff_pkt->delta_seq, 0);
+ ff_pkt->type, ff_pkt->fname, 0, attribs, 0, 0,
+ attribsEx, 0, ff_pkt->delta_seq, 0);
Dmsg2(300, ">stored: attr len=%d: %s\n", sd->msglen, sd->msg);
if (!stat && !jcr->is_job_canceled()) {
Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
Dmsg2(300, ">stored: attr len=%d: %s\n", sd->msglen, sd->msg);
if (!stat && !jcr->is_job_canceled()) {
Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
if ((bctx.ff_pkt->flags & FO_COMPRESS) && bctx.ff_pkt->Compress_algo == COMPRESS_GZIP) {
if ((bctx.ff_pkt->flags & FO_SPARSE) || (bctx.ff_pkt->flags & FO_OFFSETS)) {
if ((bctx.ff_pkt->flags & FO_COMPRESS) && bctx.ff_pkt->Compress_algo == COMPRESS_GZIP) {
if ((bctx.ff_pkt->flags & FO_SPARSE) || (bctx.ff_pkt->flags & FO_OFFSETS)) {
- bctx.cbuf = (Bytef *)jcr->compress_buf + OFFSET_FADDR_SIZE;
- bctx.max_compress_len = jcr->compress_buf_size - OFFSET_FADDR_SIZE;
+ bctx.cbuf = (Bytef *)jcr->compress_buf + OFFSET_FADDR_SIZE;
+ bctx.max_compress_len = jcr->compress_buf_size - OFFSET_FADDR_SIZE;
- bctx.cbuf = (Bytef *)jcr->compress_buf;
- bctx.max_compress_len = jcr->compress_buf_size; /* set max length */
+ bctx.cbuf = (Bytef *)jcr->compress_buf;
+ bctx.max_compress_len = jcr->compress_buf_size; /* set max length */
- /** set gzip compression level - must be done per file */
- if ((zstat=deflateParams((z_stream*)jcr->pZLIB_compress_workset,
- bctx.ff_pkt->Compress_level, Z_DEFAULT_STRATEGY)) != Z_OK) {
- Jmsg(jcr, M_FATAL, 0, _("Compression deflateParams error: %d\n"), zstat);
- jcr->setJobStatus(JS_ErrorTerminated);
- return false;
- }
+ /** set gzip compression level - must be done per file */
+ if ((zstat=deflateParams((z_stream*)jcr->pZLIB_compress_workset,
+ bctx.ff_pkt->Compress_level, Z_DEFAULT_STRATEGY)) != Z_OK) {
+ Jmsg(jcr, M_FATAL, 0, _("Compression deflateParams error: %d\n"), zstat);
+ jcr->setJobStatus(JS_ErrorTerminated);
+ return false;
+ }
if ((bctx.ff_pkt->flags & FO_COMPRESS) && bctx.ff_pkt->Compress_algo == COMPRESS_LZO1X) {
if ((bctx.ff_pkt->flags & FO_SPARSE) || (bctx.ff_pkt->flags & FO_OFFSETS)) {
if ((bctx.ff_pkt->flags & FO_COMPRESS) && bctx.ff_pkt->Compress_algo == COMPRESS_LZO1X) {
if ((bctx.ff_pkt->flags & FO_SPARSE) || (bctx.ff_pkt->flags & FO_OFFSETS)) {
- bctx.cbuf = (Bytef *)jcr->compress_buf + OFFSET_FADDR_SIZE;
- bctx.cbuf2 = (Bytef *)jcr->compress_buf + OFFSET_FADDR_SIZE + sizeof(comp_stream_header);
- bctx.max_compress_len = jcr->compress_buf_size - OFFSET_FADDR_SIZE;
+ bctx.cbuf = (Bytef *)jcr->compress_buf + OFFSET_FADDR_SIZE;
+ bctx.cbuf2 = (Bytef *)jcr->compress_buf + OFFSET_FADDR_SIZE + sizeof(comp_stream_header);
+ bctx.max_compress_len = jcr->compress_buf_size - OFFSET_FADDR_SIZE;
- bctx.cbuf = (Bytef *)jcr->compress_buf;
- bctx.cbuf2 = (Bytef *)jcr->compress_buf + sizeof(comp_stream_header);
- bctx.max_compress_len = jcr->compress_buf_size; /* set max length */
+ bctx.cbuf = (Bytef *)jcr->compress_buf;
+ bctx.cbuf2 = (Bytef *)jcr->compress_buf + sizeof(comp_stream_header);
+ bctx.max_compress_len = jcr->compress_buf_size; /* set max length */
if (ff_pkt->type != FT_LNKSAVED && (S_ISREG(ff_pkt->statp.st_mode) &&
ff_pkt->flags & FO_HFSPLUS)) {
if (ff_pkt->hfsinfo.rsrclength > 0) {
if (ff_pkt->type != FT_LNKSAVED && (S_ISREG(ff_pkt->statp.st_mode) &&
ff_pkt->flags & FO_HFSPLUS)) {
if (ff_pkt->hfsinfo.rsrclength > 0) {
- int flags;
- int rsrc_stream;
- if (bopen_rsrc(&ff_pkt->bfd, ff_pkt->fname, O_RDONLY | O_BINARY, 0) < 0) {
- ff_pkt->ff_errno = errno;
- berrno be;
- Jmsg(jcr, M_NOTSAVED, -1, _(" Cannot open resource fork for \"%s\": ERR=%s.\n"),
- ff_pkt->fname, be.bstrerror());
- jcr->JobErrors++;
- if (is_bopen(&ff_pkt->bfd)) {
- bclose(&ff_pkt->bfd);
- }
- return true;
- }
- flags = ff_pkt->flags;
- ff_pkt->flags &= ~(FO_COMPRESS|FO_SPARSE|FO_OFFSETS);
- if (flags & FO_ENCRYPT) {
- rsrc_stream = STREAM_ENCRYPTED_MACOS_FORK_DATA;
- } else {
- rsrc_stream = STREAM_MACOS_FORK_DATA;
- }
- stat = send_data(bctx, rsrc_stream);
- ff_pkt->flags = flags;
- bclose(&ff_pkt->bfd);
- if (!stat) {
- return false;
- }
+ int flags;
+ int rsrc_stream;
+ if (bopen_rsrc(&ff_pkt->bfd, ff_pkt->fname, O_RDONLY | O_BINARY, 0) < 0) {
+ ff_pkt->ff_errno = errno;
+ berrno be;
+ Jmsg(jcr, M_NOTSAVED, -1, _(" Cannot open resource fork for \"%s\": ERR=%s.\n"),
+ ff_pkt->fname, be.bstrerror());
+ jcr->JobErrors++;
+ if (is_bopen(&ff_pkt->bfd)) {
+ bclose(&ff_pkt->bfd);
+ }
+ return true;
+ }
+ flags = ff_pkt->flags;
+ ff_pkt->flags &= ~(FO_COMPRESS|FO_SPARSE|FO_OFFSETS);
+ if (flags & FO_ENCRYPT) {
+ rsrc_stream = STREAM_ENCRYPTED_MACOS_FORK_DATA;
+ } else {
+ rsrc_stream = STREAM_MACOS_FORK_DATA;
+ }
+ stat = send_data(bctx, rsrc_stream);
+ ff_pkt->flags = flags;
+ bclose(&ff_pkt->bfd);
+ if (!stat) {
+ return false;
+ }
Dmsg3(400, "cbuf=0x%x rbuf=0x%x len=%u\n", bctx.cbuf, bctx.rbuf, sd->msglen);
((z_stream*)jcr->pZLIB_compress_workset)->next_in = (Bytef *)bctx.rbuf;
Dmsg3(400, "cbuf=0x%x rbuf=0x%x len=%u\n", bctx.cbuf, bctx.rbuf, sd->msglen);
((z_stream*)jcr->pZLIB_compress_workset)->next_in = (Bytef *)bctx.rbuf;
- Jmsg(jcr, M_FATAL, 0, _("Compression deflate error: %d\n"), zstat);
- jcr->setJobStatus(JS_ErrorTerminated);
- return false;
+ Jmsg(jcr, M_FATAL, 0, _("Compression deflate error: %d\n"), zstat);
+ jcr->setJobStatus(JS_ErrorTerminated);
+ return false;
}
bctx.compress_len = ((z_stream*)jcr->pZLIB_compress_workset)->total_out;
/** reset zlib stream to be able to begin from scratch again */
if ((zstat=deflateReset((z_stream*)jcr->pZLIB_compress_workset)) != Z_OK) {
}
bctx.compress_len = ((z_stream*)jcr->pZLIB_compress_workset)->total_out;
/** reset zlib stream to be able to begin from scratch again */
if ((zstat=deflateReset((z_stream*)jcr->pZLIB_compress_workset)) != Z_OK) {
- Jmsg(jcr, M_FATAL, 0, _("Compression deflateReset error: %d\n"), zstat);
- jcr->setJobStatus(JS_ErrorTerminated);
- return false;
+ Jmsg(jcr, M_FATAL, 0, _("Compression deflateReset error: %d\n"), zstat);
+ jcr->setJobStatus(JS_ErrorTerminated);
+ return false;
}
Dmsg2(400, "GZIP compressed len=%d uncompressed len=%d\n", bctx.compress_len,
}
Dmsg2(400, "GZIP compressed len=%d uncompressed len=%d\n", bctx.compress_len,
/** Do compression if turned on */
if (bctx.ff_pkt->flags & FO_COMPRESS && bctx.ff_pkt->Compress_algo == COMPRESS_LZO1X && jcr->LZO_compress_workset) {
/** Do compression if turned on */
if (bctx.ff_pkt->flags & FO_COMPRESS && bctx.ff_pkt->Compress_algo == COMPRESS_LZO1X && jcr->LZO_compress_workset) {
Dmsg3(400, "cbuf=0x%x rbuf=0x%x len=%u\n", bctx.cbuf, bctx.rbuf, sd->msglen);
lzores = lzo1x_1_compress((const unsigned char*)bctx.rbuf, sd->msglen, bctx.cbuf2,
Dmsg3(400, "cbuf=0x%x rbuf=0x%x len=%u\n", bctx.cbuf, bctx.rbuf, sd->msglen);
lzores = lzo1x_1_compress((const unsigned char*)bctx.rbuf, sd->msglen, bctx.cbuf2,
- /* complete header */
- ser_uint32(COMPRESS_LZO1X);
- ser_uint32(bctx.compress_len);
- ser_uint16(bctx.ch.level);
- ser_uint16(bctx.ch.version);
+ /* complete header */
+ ser_uint32(COMPRESS_LZO1X);
+ ser_uint32(bctx.compress_len);
+ ser_uint16(bctx.ch.level);
+ ser_uint16(bctx.ch.version);
- /** this should NEVER happen */
- Jmsg(jcr, M_FATAL, 0, _("Compression LZO error: %d\n"), lzores);
- jcr->setJobStatus(JS_ErrorTerminated);
- return false;
+ /** this should NEVER happen */
+ Jmsg(jcr, M_FATAL, 0, _("Compression LZO error: %d\n"), lzores);
+ jcr->setJobStatus(JS_ErrorTerminated);
+ return false;
}
Dmsg2(400, "LZO compressed len=%d uncompressed len=%d\n", bctx.compress_len,
}
Dmsg2(400, "LZO compressed len=%d uncompressed len=%d\n", bctx.compress_len,
- if (ff->fname[sp_first] == '/') { /* compare with the first character of the string (sp_first not sp_first-1) */
- ff->snap_fname[last] = 0;
- }
+ if (ff->fname[sp_first] == '/') { /* compare with the first character of the string (sp_first not sp_first-1) */
+ ff->snap_fname[last] = 0;
+ }
- if (ff->fname[sp_first] != '/') {
- pm_strcat(ff->snap_fname, "/");
- }
+ if (ff->fname[sp_first] != '/') {
+ pm_strcat(ff->snap_fname, "/");
+ }
- if (ff->link[sp_first] == '/') { /* compare with the first character of the string (sp_first not sp_first-1) */
- ff->snap_fname[last] = 0;
- }
+ if (ff->link[sp_first] == '/') { /* compare with the first character of the string (sp_first not sp_first-1) */
+ ff->snap_fname[last] = 0;
+ }
- if (ff->link[sp_first] != '/') {
- pm_strcat(ff->snap_fname, "/");
- }
+ if (ff->link[sp_first] != '/') {
+ pm_strcat(ff->snap_fname, "/");
+ }
- stripped, count, numsep, numsep>count);
+ stripped, count, numsep, numsep>count);
if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
pm_strcpy(ff_pkt->link_save, ff_pkt->link);
Dmsg2(500, "strcpy link_save=%d link=%d\n", strlen(ff_pkt->link_save),
if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
pm_strcpy(ff_pkt->link_save, ff_pkt->link);
Dmsg2(500, "strcpy link_save=%d link=%d\n", strlen(ff_pkt->link_save),
/** Strip links but not symlinks */
if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
if (!do_strip(ff_pkt->strip_path, ff_pkt->link)) {
/** Strip links but not symlinks */
if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
if (!do_strip(ff_pkt->strip_path, ff_pkt->link)) {
strcpy(ff_pkt->fname, ff_pkt->fname_save);
if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
Dmsg2(10, "strcpy link=%s link_save=%s\n", ff_pkt->link,
strcpy(ff_pkt->fname, ff_pkt->fname_save);
if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
Dmsg2(10, "strcpy link=%s link_save=%s\n", ff_pkt->link,
strcpy(ff_pkt->link, ff_pkt->link_save);
Dmsg2(10, "strcpy link=%d link_save=%d\n", strlen(ff_pkt->link),
strcpy(ff_pkt->link, ff_pkt->link_save);
Dmsg2(10, "strcpy link=%d link_save=%d\n", strlen(ff_pkt->link),
- /* inform user about writer states */
- for (int i=0; i<(int)g_pVSSClient->GetWriterCount(); i++) {
- int msg_type = M_INFO;
- if (g_pVSSClient->GetWriterState(i) < 1) {
- msg_type = M_WARNING;
- jcr->JobErrors++;
- }
- Jmsg(jcr, msg_type, 0, _("VSS Writer (BackupComplete): %s\n"), g_pVSSClient->GetWriterInfo(i));
- }
+ /* inform user about writer states */
+ for (int i=0; i<(int)g_pVSSClient->GetWriterCount(); i++) {
+ int msg_type = M_INFO;
+ if (g_pVSSClient->GetWriterState(i) < 1) {
+ msg_type = M_WARNING;
+ jcr->JobErrors++;
+ }
+ Jmsg(jcr, msg_type, 0, _("VSS Writer (BackupComplete): %s\n"), g_pVSSClient->GetWriterInfo(i));
+ }
- FF_PKT *ff_pkt = jcr->ff;
- ff_pkt->fname = (char *)"*all*"; /* for all plugins */
- ff_pkt->type = FT_RESTORE_FIRST;
- ff_pkt->LinkFI = 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);
+ FF_PKT *ff_pkt = jcr->ff;
+ ff_pkt->fname = (char *)"*all*"; /* for all plugins */
+ ff_pkt->type = FT_RESTORE_FIRST;
+ ff_pkt->LinkFI = 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);