case 'e': /* exclude list */
if ((fd = fopen(optarg, "r")) == NULL) {
- Dmsg2(0, "Could not open exclude file: %s, ERR=%s\n",
+ Pmsg2(0, "Could not open exclude file: %s, ERR=%s\n",
optarg, strerror(errno));
exit(1);
}
case 'i': /* include list */
if ((fd = fopen(optarg, "r")) == NULL) {
- Dmsg2(0, "Could not open include file: %s, ERR=%s\n",
+ Pmsg2(0, "Could not open include file: %s, ERR=%s\n",
optarg, strerror(errno));
exit(1);
}
argv += optind;
if (!argc && !default_tape) {
- Dmsg0(0, "No archive name specified\n");
+ Pmsg0(0, "No archive name specified\n");
usage();
}
Dmsg2(10, "Device=%s, Vol=%s.\n", infname, VolName);
dev = init_dev(NULL, infname);
if (!dev) {
- Emsg1(M_ABORT, 0, "Cannot open %s\n", infname);
+ Emsg1(M_FATAL, 0, "Cannot open %s\n", infname);
+ exit(1);
}
/* ***FIXME**** init capabilities */
if (!open_device(dev)) {
- Emsg1(M_ABORT, 0, "Cannot open %s\n", infname);
+ Emsg1(M_FATAL, 0, "Cannot open %s\n", infname);
+ exit(1);
}
Dmsg0(90, "Device opened for read.\n");
CurVolume++;
Dmsg1(20, "There is another volume %s.\n", p);
VolName = p;
- close_dev(dev);
jcr->VolumeName = check_pool_memory_size(jcr->VolumeName,
strlen(VolName)+1);
strcpy(jcr->VolumeName, VolName);
- printf("Mount Volume %s on device %s and press return when ready.",
- VolName, infname);
- getchar();
- block->binbuf = 0; /* consumed all bytes */
- if (!ready_dev_for_read(jcr, dev, block)) {
- Emsg2(M_ABORT, 0, "Cannot open Dev=%s, Vol=%s\n", infname, VolName);
+
+ close_dev(dev);
+ dev->state &= ~ST_READ;
+ if (!acquire_device_for_read(jcr, dev, block)) {
+ Emsg2(M_FATAL, 0, "Cannot open Dev=%s, Vol=%s\n", infname, VolName);
+ exit(1);
}
return 1; /* Next volume mounted */
}
status_dev(dev, &status);
Dmsg1(20, "Device status: %x\n", status);
if (status & MT_EOD)
- Emsg0(M_ABORT, 0, "Unexpected End of Data\n");
+ Emsg0(M_ERROR_TERM, 0, "Unexpected End of Data\n");
else if (status & MT_EOT)
- Emsg0(M_ABORT, 0, "Unexpected End of Tape\n");
+ Emsg0(M_ERROR_TERM, 0, "Unexpected End of Tape\n");
else if (status & MT_EOF)
- Emsg0(M_ABORT, 0, "Unexpected End of File\n");
+ Emsg0(M_ERROR_TERM, 0, "Unexpected End of File\n");
else if (status & MT_DR_OPEN)
- Emsg0(M_ABORT, 0, "Tape Door is Open\n");
+ Emsg0(M_ERROR_TERM, 0, "Tape Door is Open\n");
else if (!(status & MT_ONLINE))
- Emsg0(M_ABORT, 0, "Unexpected Tape is Off-line\n");
+ Emsg0(M_ERROR_TERM, 0, "Unexpected Tape is Off-line\n");
else
- Emsg2(M_ABORT, 0, "Read error on Record Header %s: %s\n", dev_name(dev), strerror(errno));
+ Emsg2(M_ERROR_TERM, 0, "Read error on Record Header %s: %s\n", dev_name(dev), strerror(errno));
}
* If on second or subsequent volume, adjust buffer pointer
*/
if (dev->VolHdr.PrevVolName[0] != 0) { /* second volume */
- Dmsg1(0, "\n\
+ Pmsg1(0, "\n\
Warning, this Volume is a continuation of Volume %s\n",
dev->VolHdr.PrevVolName);
}
* If on second or subsequent volume, adjust buffer pointer
*/
if (dev->VolHdr.PrevVolName[0] != 0) { /* second volume */
- Dmsg1(0, "\n\
+ Pmsg1(0, "\n\
Warning, this Volume is a continuation of Volume %s\n",
dev->VolHdr.PrevVolName);
}
* NOTE: this no longer exists
*/
if (rec->VolSessionId == 0 && rec->VolSessionTime == 0) {
- Emsg0(M_ABORT, 0, "Zero VolSessionId and VolSessionTime. This shouldn't happen\n");
+ Emsg0(M_ERROR_TERM, 0, "Zero VolSessionId and VolSessionTime. This shouldn't happen\n");
}
/*
* If on second or subsequent volume, adjust buffer pointer
*/
if (dev->VolHdr.PrevVolName[0] != 0) { /* second volume */
- Dmsg1(0, "\n\
+ Pmsg1(0, "\n\
Warning, this Volume is a continuation of Volume %s\n",
dev->VolHdr.PrevVolName);
}
* NOTE: this no longer exists
*/
if (rec->VolSessionId == 0 && rec->VolSessionTime == 0) {
- Emsg0(M_ABORT, 0, "Zero VolSessionId and VolSessionTime. This shouldn't happen\n");
+ Emsg0(M_ERROR_TERM, 0, "Zero VolSessionId and VolSessionTime. This shouldn't happen\n");
}
/*
char *ap;
sscanf(rec->data, "%ld %d %s", &record_file_index, &type, fname);
if (record_file_index != rec->FileIndex) {
- Emsg2(M_ABORT, 0, "Record header file index %ld not equal record index %ld\n",
+ Emsg2(M_ERROR_TERM, 0, "Record header file index %ld not equal record index %ld\n",
rec->FileIndex, record_file_index);
}
ap = rec->data;
static void print_ls_output(char *fname, char *link, int type, struct stat *statp)
{
char buf[1000];
+ char ec1[30];
char *p, *f;
int n;
p += n;
n = sprintf(p, "%-8.8s %-8.8s", getuser(statp->st_uid), getgroup(statp->st_gid));
p += n;
- n = sprintf(p, "%8" lld " ", (uint64_t)statp->st_size);
+ n = sprintf(p, "%8.8s ", edit_uint64(statp->st_size, ec1));
p += n;
p = encode_time(statp->st_ctime, p);
*p++ = ' ';
*p++ = ' ';
/* Copy file name */
- for (f=fname; *f; )
+ for (f=fname; *f && (p-buf) < (int)sizeof(buf); )
*p++ = *f++;
- if (type == FT_DIR) {
- *p++ = '/';
- }
if (type == FT_LNK) {
*p++ = ' ';
*p++ = '-';
*p++ = '>';
*p++ = ' ';
/* Copy link name */
- for (f=link; *f; )
+ for (f=link; *f && (p-buf) < (int)sizeof(buf); )
*p++ = *f++;
}
*p++ = '\n';
*p = 0;
fputs(buf, stdout);
}
+
+/* Dummies to replace askdir.c */
+int dir_get_volume_info(JCR *jcr) { return 1;}
+int dir_find_next_appendable_volume(JCR *jcr) { return 1;}
+int dir_update_volume_info(JCR *jcr, VOLUME_CAT_INFO *vol, int relabel) { return 1; }
+int dir_create_job_media_record(JCR *jcr) { return 1; }
+int dir_ask_sysop_to_mount_next_volume(JCR *jcr, DEVICE *dev) { return 1; }
+int dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec) { return 1;}
+int dir_send_job_status(JCR *jcr) {return 1;}
+
+
+int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
+{
+ fprintf(stderr, "Mount Volume %s on device %s and press return when ready: ",
+ jcr->VolumeName, dev_name(dev));
+ getchar();
+ return 1;
+}