"AND JobMedia.MediaId=Media.MediaId "
"AND Job.Level IN ('I', 'D') AND JobStatus='T' "
"AND Job.FileSetId=FileSet.FileSetId "
- "%s"
- "AND FileSet.FileSet='%s' ";
+ "AND FileSet.FileSet='%s' "
+ "%s";
char *uar_list_temp =
"SELECT JobId,Level,JobFiles,StartTime,VolumeName,StartFile,"
/* Static globals */
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t timer = PTHREAD_COND_INITIALIZER;
-static int quit;
+static bool quit;
static bool wd_is_init = false;
/* Forward referenced callback functions */
Dmsg0(200, "Initialising NicB-hacked watchdog thread\n");
watchdog_time = time(NULL);
- quit = FALSE;
+ quit = false;
if ((stat = pthread_create(&wd_tid, NULL, watchdog_thread, NULL)) != 0) {
return stat;
}
watchdog_t *p, *n;
if (!wd_is_init) {
- Emsg0(M_ABORT, 0, "BUG! stop_watchdog called before start_watchdog\n");
+ return 0;
}
Dmsg0(200, "Sending stop signal to NicB-hacked watchdog thread\n");
" Fast Forward Space File = no\n\n"
"to your Device resource for this drive.\n");
}
+
+ Pmsg0(-1, "\n");
+ Pmsg0(0, _("Now forward spacing 4 more files.\n"));
+ if (!fsf_dev(dev, 4)) {
+ Pmsg1(0, "Bad status from fsr. ERR=%s\n", strerror_dev(dev));
+ goto bail_out;
+ }
+ Pmsg2(-1, _("We should be in file 5. I am at file %d. This is %s\n"),
+ dev->file, dev->file == 5 ? "correct!" : "NOT correct!!!!");
+ if (dev->file != 5) {
+ goto bail_out;
+ }
+
return 1;
bail_out:
goto all_done;
}
if (stat == -1) { /* first test failed */
- if (dev_cap(dev, CAP_EOM)) {
+ if (dev_cap(dev, CAP_EOM) || dev_cap(dev, CAP_FASTFSF)) {
Pmsg0(-1, "\nAppend test failed. Attempting again.\n"
"Setting \"Hardware End of Medium = no\n"
" and \"Fast Forward Space File = no\n"
* Move file by file to the end of the tape
*/
int file_num;
- for (file_num=0; !(dev->state & ST_EOT); ) {
+ for (file_num=dev->file; !(dev->state & ST_EOT); file_num++) {
Dmsg0(200, "eod_dev: doing fsf 1\n");
if (!fsf_dev(dev, 1)) {
Dmsg0(200, "fsf_dev error.\n");
* Avoid infinite loop. ***FIXME*** possibly add code
* to set EOD or to turn off CAP_FASTFSF if on.
*/
- if (file_num++ != (int)dev->file) {
+ if (file_num == (int)dev->file) {
+ Dmsg1(000, "fsf_dev did not advance from file %d\n", file_num);
return 0; /* we are not progressing, bail out */
}
}
* the second EOF.
*/
if (dev_cap(dev, CAP_BSFATEOM)) {
- stat = bsf_dev(dev, 1);
- dev->file++; /* keep same file */
+ struct mtget mt_stat;
+ /* Backup over EOF */
+ stat = bsf_dev(dev, 1);
+ /* If BSF worked and fileno is known (not -1), set file */
+ if (stat == 0 && ioctl(dev->fd, MTIOCGET, (char *)&mt_stat) == 0 &&
+ mt_stat.mt_fileno >= 0) {
+ dev->file = mt_stat.mt_fileno;
+ }
} else {
update_pos_dev(dev); /* update position */
stat = 1;