/* Responses received from File daemon */
-static char OKinc[] = "2000 OK include\n";
-static char OKexc[] = "2000 OK exclude\n";
-static char OKjob[] = "2000 OK Job";
+static char OKinc[] = "2000 OK include\n";
+static char OKexc[] = "2000 OK exclude\n";
+static char OKjob[] = "2000 OK Job";
+static char OKbootstrap[] = "2000 OK bootstrap\n";
/* Forward referenced functions */
}
bnet_sig(fd, BNET_EOD); /* end of data */
if (list == INC_LIST) {
- if (!response(fd, OKinc, "Include", 1)) {
+ if (!response(jcr, fd, OKinc, "Include", DISPLAY_ERROR)) {
goto bail_out;
}
- } else if (!response(fd, OKexc, "Exclude", 1)) {
+ } else if (!response(jcr, fd, OKexc, "Exclude", DISPLAY_ERROR)) {
goto bail_out;
}
return 1;
}
+/*
+ * Send bootstrap file if any to the File daemon.
+ * This is used for restore and verify VolumeToCatalog
+ */
+int send_bootstrap_file(JCR *jcr)
+{
+ FILE *bs;
+ char buf[1000];
+ BSOCK *fd = jcr->file_bsock;
+ char *bootstrap = "bootstrap\n";
+
+ Dmsg1(400, "send_bootstrap_file: %s\n", jcr->RestoreBootstrap);
+ if (!jcr->RestoreBootstrap) {
+ return 1;
+ }
+ bs = fopen(jcr->RestoreBootstrap, "r");
+ if (!bs) {
+ Jmsg(jcr, M_FATAL, 0, _("Could not open bootstrap file %s: ERR=%s\n"),
+ jcr->RestoreBootstrap, strerror(errno));
+ set_jcr_job_status(jcr, JS_ErrorTerminated);
+ return 0;
+ }
+ strcpy(fd->msg, bootstrap);
+ fd->msglen = strlen(fd->msg);
+ bnet_send(fd);
+ while (fgets(buf, sizeof(buf), bs)) {
+ fd->msglen = Mmsg(&fd->msg, "%s", buf);
+ bnet_send(fd);
+ }
+ bnet_sig(fd, BNET_EOD);
+ fclose(bs);
+ if (!response(jcr, fd, OKbootstrap, "Bootstrap", DISPLAY_ERROR)) {
+ set_jcr_job_status(jcr, JS_ErrorTerminated);
+ return 0;
+ }
+ return 1;
+}
+
+
/*
* Read the attributes from the File daemon for
* a Verify job and store them in the catalog.
Dmsg0(120, "bdird: waiting to receive file attributes\n");
/* Pickup file attributes and signature */
- while (!fd->errors && (n = bget_msg(fd, 0)) > 0) {
+ while (!fd->errors && (n = bget_dirmsg(fd)) > 0) {
/*****FIXME****** improve error handling to stop only on
* really fatal problems, or the number of errors is too
*fn = *p++; /* term filename and point to attribs */
attr = p;
- if (stream == STREAM_UNIX_ATTRIBUTES || stream == STREAM_WIN32_ATTRIBUTES) {
+ if (stream == STREAM_UNIX_ATTRIBUTES || stream == STREAM_UNIX_ATTRIBUTES_EX) {
jcr->JobFiles++;
jcr->FileIndex = file_index;
ar.attr = attr;