Jmsg0(jcr, M_FATAL, 0, _("Director and Storage daemon passwords not the same.\n"));
return 0;
}
- Dmsg1(6, ">stored: %s", sd->msg);
+ Dmsg1(116, ">stored: %s", sd->msg);
if (bnet_recv(sd) <= 0) {
Emsg1(M_FATAL, 0, _("bdird<stored: bad response to Hello command: ERR=%s\n"),
bnet_strerror(sd));
return 0;
}
- Dmsg1(10, "<stored: %s", sd->msg);
+ Dmsg1(110, "<stored: %s", sd->msg);
if (strncmp(sd->msg, OKhello, sizeof(OKhello)) != 0) {
Emsg0(M_FATAL, 0, _("Storage daemon rejected Hello command\n"));
return 0;
Jmsg(jcr, M_FATAL, 0, _("Director and File daemon passwords not the same.\n"));
return 0;
}
- Dmsg1(6, ">filed: %s", fd->msg);
+ Dmsg1(116, ">filed: %s", fd->msg);
if (bnet_recv(fd) <= 0) {
Jmsg(jcr, M_FATAL, 0, _("bdird<filed: bad response to Hello command: ERR=%s\n"),
bnet_strerror(fd));
return 0;
}
- Dmsg1(10, "<stored: %s", fd->msg);
+ Dmsg1(110, "<stored: %s", fd->msg);
if (strncmp(fd->msg, FDOKhello, sizeof(FDOKhello)) != 0) {
Jmsg(jcr, M_FATAL, 0, _("File daemon rejected Hello command\n"));
return 0;
goto bail_out;
}
jcr->jr.FileSetId = fsr.FileSetId;
- Dmsg2(9, "Created FileSet %s record %d\n", jcr->fileset->hdr.name,
+ Dmsg2(119, "Created FileSet %s record %d\n", jcr->fileset->hdr.name,
jcr->jr.FileSetId);
/* Look up the last
strcpy(since, ", since=");
strcat(since, jcr->stime);
}
- Dmsg1(15, "Last start time = %s\n", jcr->stime);
+ Dmsg1(115, "Last start time = %s\n", jcr->stime);
break;
}
* will be contacting him for a backup session.
*
*/
- Dmsg0(10, "Open connection with storage daemon\n");
+ Dmsg0(110, "Open connection with storage daemon\n");
jcr->JobStatus = JS_Blocked;
/*
* Start conversation with Storage daemon
if (!start_storage_daemon_message_thread(jcr)) {
goto bail_out;
}
- Dmsg0(50, "Storage daemon connection OK\n");
+ Dmsg0(150, "Storage daemon connection OK\n");
jcr->JobStatus = JS_Blocked;
if (!connect_to_file_daemon(jcr, 10, FDConnectTimeout, 1)) {
jcr->JobLevel, jcr->JobLevel);
goto bail_out;
}
- Dmsg1(20, ">filed: %s", fd->msg);
+ Dmsg1(120, ">filed: %s", fd->msg);
if (!response(fd, OKlevel, "Level")) {
goto bail_out;
}
unbash_spaces(jcr->client->hdr.name);
unbash_spaces(jcr->fileset->hdr.name);
if (bnet_recv(sd) > 0) {
- Dmsg1(10, "<stored: %s", sd->msg);
+ Dmsg1(110, "<stored: %s", sd->msg);
if (sscanf(sd->msg, OKjob, &jcr->VolSessionId,
&jcr->VolSessionTime, &auth_key) != 3) {
Jmsg(jcr, M_FATAL, 0, _("Storage daemon rejected Job command: %s\n"), sd->msg);
return 0;
} else {
jcr->sd_auth_key = bstrdup(auth_key);
- Dmsg1(50, "sd_auth_key=%s\n", jcr->sd_auth_key);
+ Dmsg1(150, "sd_auth_key=%s\n", jcr->sd_auth_key);
}
} else {
Jmsg(jcr, M_FATAL, 0, _("<stored: bad response to Job command: %s\n"),
sd->msg = (char *) check_pool_memory_size(sd->msg, sizeof(device_name) +
device_name_len + media_type_len + pool_type_len + pool_name_len);
bnet_fsend(sd, use_device, device_name, media_type, pool_name, pool_type);
- Dmsg1(10, ">stored: %s", sd->msg);
+ Dmsg1(110, ">stored: %s", sd->msg);
status = response(sd, OK_device, "Use Device");
free_memory(device_name);
found = 0;
stat = 1;
- Dmsg1(20, "Command: %s\n", ua->UA_sock->msg);
+ Dmsg1(120, "Command: %s\n", ua->UA_sock->msg);
if (ua->argc == 0) {
return 1;
}
return 1;
}
- Dmsg4(20, "id=%d Num=%d Max=%d type=%s\n", pr.PoolId, pr.NumVols,
+ Dmsg4(120, "id=%d Num=%d Max=%d type=%s\n", pr.PoolId, pr.NumVols,
pr.MaxVols, pr.PoolType);
while (pr.MaxVols > 0 && pr.NumVols >= pr.MaxVols) {
bsendmsg(ua, _("Failed to connect to Storage daemon.\n"));
return;
}
- Dmsg0(20, _("Connected to storage daemon\n"));
+ Dmsg0(120, _("Connected to storage daemon\n"));
sd = ua->jcr->store_bsock;
bnet_fsend(sd, "setdebug=%d\n", level);
if (bnet_recv(sd) > 0) {
bsendmsg(ua, _("Failed to connect to Client.\n"));
return;
}
- Dmsg0(20, "Connected to file daemon\n");
+ Dmsg0(120, "Connected to file daemon\n");
fd = ua->jcr->file_bsock;
bnet_fsend(fd, "setdebug=%d\n", level);
if (bnet_recv(fd) > 0) {
}
if (!found) {
unique_store[i++] = store;
- Dmsg2(40, "Stuffing: %s:%d\n", store->address, store->SDport);
+ Dmsg2(140, "Stuffing: %s:%d\n", store->address, store->SDport);
}
}
UnlockRes();
}
if (!found) {
unique_client[i++] = client;
- Dmsg2(40, "Stuffing: %s:%d\n", client->address, client->FDport);
+ Dmsg2(140, "Stuffing: %s:%d\n", client->address, client->FDport);
}
}
UnlockRes();
if (!open_db(ua)) {
return 1;
}
- Dmsg1(20, "setdebug:%s:\n", cmd);
+ Dmsg1(120, "setdebug:%s:\n", cmd);
level = -1;
for (i=1; i<ua->argc; i++) {
if (!open_db(ua)) {
return;
}
- Dmsg1(20, "mount: %s\n", ua->UA_sock->msg);
+ Dmsg1(120, "mount: %s\n", ua->UA_sock->msg);
store = get_storage_resource(ua, cmd);
if (!store) {
return;
}
- Dmsg2(20, "Found storage, MediaType=%s DevName=%s\n",
+ Dmsg2(120, "Found storage, MediaType=%s DevName=%s\n",
store->media_type, store->dev_name);
ua->jcr->store = store;
}
}
- Dmsg0(50, "Open database\n");
+ Dmsg0(150, "Open database\n");
ua->db = db_init_database(ua->catalog->db_name, ua->catalog->db_user,
ua->catalog->db_password);
if (!db_open_database(ua->db)) {
return 0;
}
ua->jcr->db = ua->db;
- Dmsg1(50, "DB %s opened\n", ua->catalog->db_name);
+ Dmsg1(150, "DB %s opened\n", ua->catalog->db_name);
return 1;
}
jcr->JobStatus = JS_Running;
- Dmsg1(10, "bfiled: opened data connection %d to stored\n", sd->fd);
+ Dmsg1(110, "bfiled: opened data connection %d to stored\n", sd->fd);
if (!bnet_set_buffer_size(sd, MAX_NETWORK_BUFFER_SIZE, BNET_SETBUF_WRITE)) {
return 0;
Dmsg1(100, "set_find_options ff=%p\n", jcr->ff);
set_find_options(jcr->ff, jcr->incremental, jcr->mtime);
- Dmsg0(10, "start find files\n");
+ Dmsg0(110, "start find files\n");
/* Subroutine save_file() is called for each file */
/* ***FIXME**** add FSM code */
*/
static int hello_cmd(JCR *jcr)
{
- Dmsg0(20, "Calling Authenticate\n");
+ Dmsg0(120, "Calling Authenticate\n");
if (!authenticate_director(jcr)) {
return 0;
}
- Dmsg0(20, "OK Authenticate\n");
+ Dmsg0(120, "OK Authenticate\n");
jcr->authenticated = TRUE;
return 1;
}
BSOCK *dir = jcr->dir_bsock;
int level;
- Dmsg1(10, "setdebug_cmd: %s", dir->msg);
+ Dmsg1(110, "setdebug_cmd: %s", dir->msg);
if (sscanf(dir->msg, "setdebug=%d", &level) != 1 || level < 0) {
bnet_fsend(dir, "2991 Bad setdebug command: %s\n", dir->msg);
return 0;
}
jcr->sd_auth_key = bstrdup(sd_auth_key);
free_pool_memory(sd_auth_key);
- Dmsg2(20, "JobId=%d Auth=%s\n", jcr->JobId, jcr->sd_auth_key);
+ Dmsg2(120, "JobId=%d Auth=%s\n", jcr->JobId, jcr->sd_auth_key);
return bnet_fsend(dir, OKjob);
}
Jmsg(jcr, M_FATAL, 0, _("Bad storage command: %s"), dir->msg);
return 0;
}
- Dmsg2(10, "Open storage: %s:%d\n", jcr->stored_addr, stored_port);
+ Dmsg2(110, "Open storage: %s:%d\n", jcr->stored_addr, stored_port);
/* Open command communications with Storage daemon */
/* Try to connect for 1 hour at 10 second intervals */
sd = bnet_connect(jcr, 10, 3600, _("Storage daemon"),
Jmsg(jcr, M_FATAL, 0, _("Failed to authenticate Storage daemon.\n"));
return 0;
}
- Dmsg0(10, "Authenticated with SD.\n");
+ Dmsg0(110, "Authenticated with SD.\n");
/* Send OK to Director */
return bnet_fsend(dir, OKstore);
jcr->JobStatus = JS_ErrorTerminated;
goto cleanup;
}
- Dmsg1(10, "Got Ticket=%d\n", jcr->Ticket);
+ Dmsg1(110, "Got Ticket=%d\n", jcr->Ticket);
} else {
Jmsg(jcr, M_FATAL, 0, _("Bad response from stored to open command\n"));
jcr->JobStatus = JS_ErrorTerminated;
/*
* Send Files to Storage daemon
*/
- Dmsg1(10, "begin blast ff=%p\n", jcr->ff);
+ Dmsg1(110, "begin blast ff=%p\n", jcr->ff);
if (!blast_data_to_storage_daemon(jcr, NULL)) {
jcr->JobStatus = JS_ErrorTerminated;
} else {
} else {
/******FIXME***** use gethostbyname_r or mutex ****/
if ((hp = gethostbyname(host)) == NULL) {
- Dmsg2(0, "gethostbyname() for %s failed: ERR=%s\n", host, strerror(errno));
+ Pmsg2(0, "gethostbyname() for %s failed: ERR=%s\n", host, strerror(errno));
return NULL;
}
if (hp->h_length != sizeof(inaddr.s_addr) || hp->h_addrtype != AF_INET) {
Emsg1(M_ERROR, 0, "sockopt error: %s\n", strerror(errno));
dbuf_size -= TAPE_BSIZE;
}
- Dmsg1(20, "set network buffer size=%d\n", dbuf_size);
+ Dmsg1(200, "set network buffer size=%d\n", dbuf_size);
if (dbuf_size != MAX_NETWORK_BUFFER_SIZE)
Emsg1(M_WARNING, 0, "Warning network buffer = %d bytes not max size.\n", dbuf_size);
if (dbuf_size % TAPE_BSIZE != 0) {
Emsg1(M_ERROR, 0, "sockopt error: %s\n", strerror(errno));
dbuf_size -= TAPE_BSIZE;
}
- Dmsg1(20, "set network buffer size=%d\n", dbuf_size);
+ Dmsg1(200, "set network buffer size=%d\n", dbuf_size);
if (dbuf_size != MAX_NETWORK_BUFFER_SIZE)
Emsg1(M_WARNING, 0, "Warning network buffer = %d bytes not max size.\n", dbuf_size);
if (dbuf_size % TAPE_BSIZE != 0) {
TAPEOBJS = btape.o block.o dev.o device.o askdir.o label.o \
record.o stored_conf.o
-BLSOBJS = bls.o block.o device.o dev.o label.o record.o
+BLSOBJS = bls.o block.o device.o dev.o label.o match_bsr.o \
+ parse_bsr.o record.o
BEXTOBJS = bextract.o block.o device.o dev.o label.o record.o \
match_bsr.o parse_bsr.o
jcr->VolumeName[0] = 0; /* No volume */
if (bnet_recv(dir) <= 0) {
- Dmsg0(30, "getvolname error bnet_recv\n");
+ Dmsg0(130, "getvolname error bnet_recv\n");
return 0;
}
if (sscanf(dir->msg, OK_media, vol->VolCatName,
&vol->VolCatWrites, &vol->VolCatMaxBytes,
&vol->VolCatCapacityBytes, vol->VolCatStatus,
&vol->Slot) != 12) {
- Dmsg1(30, "Bad response from Dir: %s\n", dir->msg);
+ Dmsg1(130, "Bad response from Dir: %s\n", dir->msg);
return 0;
}
unbash_spaces(vol->VolCatName);
strcpy(jcr->VolumeName, vol->VolCatName); /* set desired VolumeName */
- Dmsg2(030, "do_reqest_vol_info got slot=%d Volume=%s\n",
+ Dmsg2(130, "do_reqest_vol_info got slot=%d Volume=%s\n",
vol->Slot, vol->VolCatName);
return 1;
}
vol->VolCatMounts, vol->VolCatErrors,
vol->VolCatWrites, vol->VolCatMaxBytes, EndTime,
vol->VolCatStatus, vol->Slot, relabel);
- Dmsg1(20, "update_volume_data(): %s", dir->msg);
+ Dmsg1(120, "update_volume_data(): %s", dir->msg);
if (bnet_recv(dir) <= 0) {
- Dmsg0(90, "updateVolCatInfo error bnet_recv\n");
+ Dmsg0(190, "updateVolCatInfo error bnet_recv\n");
return 0;
}
- Dmsg1(20, "Updatevol: %s", dir->msg);
+ Dmsg1(120, "Updatevol: %s", dir->msg);
if (strcmp(dir->msg, OK_update) != 0) {
- Dmsg1(30, "Bad response from Dir: %s\n", dir->msg);
+ Dmsg1(130, "Bad response from Dir: %s\n", dir->msg);
Jmsg(jcr, M_ERROR, 0, _("Error updating Volume Info: %s\n"), dir->msg);
return 0;
}
jcr->start_block, jcr->end_block);
Dmsg1(100, "create_jobmedia(): %s", dir->msg);
if (bnet_recv(dir) <= 0) {
- Dmsg0(90, "create_jobmedia error bnet_recv\n");
+ Dmsg0(190, "create_jobmedia error bnet_recv\n");
return 0;
}
- Dmsg1(020, "Create_jobmedia: %s", dir->msg);
+ Dmsg1(120, "Create_jobmedia: %s", dir->msg);
if (strcmp(dir->msg, OK_update) != 0) {
- Dmsg1(030, "Bad response from Dir: %s\n", dir->msg);
+ Dmsg1(130, "Bad response from Dir: %s\n", dir->msg);
Jmsg(jcr, M_ERROR, 0, _("Error creating JobMedia record: %s\n"), dir->msg);
return 0;
}
int dev_blocked;
char *msg;
- Dmsg0(30, "enter dir_ask_sysop_to_mount_next_volume\n");
+ Dmsg0(130, "enter dir_ask_sysop_to_mount_next_volume\n");
ASSERT(dev->dev_blocked);
wait_sec = min_wait;
for ( ;; ) {
*/
if (jcr->VolumeName[0] && !(dev->capabilities & CAP_REM) &&
dev->capabilities & CAP_LABEL) {
- Dmsg0(90, "Return 1 from mount without wait.\n");
+ Dmsg0(190, "Return 1 from mount without wait.\n");
return 1;
}
if (dev->capabilities & CAP_ANONVOLS) {
}
Jmsg(jcr, M_MOUNT, 0, _("%s Volume \"%s\" on Storage Device \"%s\" for Job %s\n"),
msg, jcr->VolumeName, jcr->dev_name, jcr->Job);
- Dmsg3(90, "Mount %s on %s for Job %s\n",
+ Dmsg3(190, "Mount %s on %s for Job %s\n",
jcr->VolumeName, jcr->dev_name, jcr->Job);
} else {
jstat = JS_WaitMedia;
dir_send_job_status(jcr);
for ( ;!job_cancelled(jcr); ) {
- Dmsg1(90, "I'm going to sleep on device %s\n", dev->dev_name);
+ Dmsg1(190, "I'm going to sleep on device %s\n", dev->dev_name);
stat = pthread_cond_timedwait(&dev->wait_next_vol, &dev->mutex, &timeout);
if (dev->dev_blocked == BST_WAITING_FOR_SYSOP) {
break;
Mmsg(&dev->errmsg, _("Gave up waiting to mount Storage Device \"%s\" for Job %s\n"),
jcr->dev_name, jcr->Job);
Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
- Dmsg1(90, "Gave up waiting on device %s\n", dev->dev_name);
+ Dmsg1(190, "Gave up waiting on device %s\n", dev->dev_name);
return 0; /* exceeded maximum waits */
}
continue;
Jmsg(jcr, M_WARNING, 0, _("pthread error in mount_next_volume stat=%d ERR=%s\n"), stat,
strerror(stat));
}
- Dmsg1(90, "Someone woke me for device %s\n", dev->dev_name);
+ Dmsg1(190, "Someone woke me for device %s\n", dev->dev_name);
/* Restart wait counters */
wait_sec = min_wait;
}
jcr->JobStatus = JS_Running;
dir_send_job_status(jcr);
- Dmsg0(30, "leave dir_ask_sysop_to_mount_next_volume\n");
+ Dmsg0(130, "leave dir_ask_sysop_to_mount_next_volume\n");
return 1;
}
struct timezone tz;
struct timespec timeout;
- Dmsg0(30, "enter dir_ask_sysop_to_mount_next_volume\n");
+ Dmsg0(130, "enter dir_ask_sysop_to_mount_next_volume\n");
if (!jcr->VolumeName[0]) {
Mmsg0(&dev->errmsg, _("Cannot request another volume: no volume name given.\n"));
return 0;
msg = _("Please mount");
Jmsg(jcr, M_MOUNT, 0, _("%s Volume \"%s\" on Storage Device \"%s\" for Job %s\n"),
msg, jcr->VolumeName, jcr->dev_name, jcr->Job);
- Dmsg3(90, "Mount %s on %s for Job %s\n",
+ Dmsg3(190, "Mount %s on %s for Job %s\n",
jcr->VolumeName, jcr->dev_name, jcr->Job);
/*
dir_send_job_status(jcr);
for ( ;!job_cancelled(jcr); ) {
- Dmsg1(90, "I'm going to sleep on device %s\n", dev->dev_name);
+ Dmsg1(190, "I'm going to sleep on device %s\n", dev->dev_name);
stat = pthread_cond_timedwait(&dev->wait_next_vol, &dev->mutex, &timeout);
if (dev->dev_blocked == BST_WAITING_FOR_SYSOP) {
break;
Mmsg(&dev->errmsg, _("Gave up waiting to mount Storage Device \"%s\" for Job %s\n"),
jcr->dev_name, jcr->Job);
Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
- Dmsg1(90, "Gave up waiting on device %s\n", dev->dev_name);
+ Dmsg1(190, "Gave up waiting on device %s\n", dev->dev_name);
return 0; /* exceeded maximum waits */
}
continue;
Jmsg(jcr, M_ERROR, 0, _("pthread error in mount_next_volume stat=%d ERR=%s\n"), stat,
strerror(stat));
}
- Dmsg1(90, "Someone woke me for device %s\n", dev->dev_name);
+ Dmsg1(190, "Someone woke me for device %s\n", dev->dev_name);
/* Restart wait counters */
wait_sec = min_wait;
}
jcr->JobStatus = JS_Running;
dir_send_job_status(jcr);
- Dmsg0(30, "leave dir_ask_sysop_to_mount_next_volume\n");
+ Dmsg0(130, "leave dir_ask_sysop_to_mount_next_volume\n");
return 1;
}
static FF_PKT ff;
+static BSR *bsr = NULL;
+
static void usage()
{
fprintf(stderr,
"Usage: bls [-d debug_level] <physical-device-name>\n"
-" -b list blocks\n"
+" -b <file> specify a bootstrap file\n"
" -e <file> exclude list\n"
" -i <file> include list\n"
" -j list jobs\n"
+" -k list blocks\n"
" -L list tape label\n"
" (none of above) list saved files\n"
" -t use default tape device\n"
memset(&ff, 0, sizeof(ff));
init_include_exclude_files(&ff);
- while ((ch = getopt(argc, argv, "bd:e:i:jLtv?")) != -1) {
+ while ((ch = getopt(argc, argv, "b:d:e:i:jkLtv?")) != -1) {
switch (ch) {
case 'b':
- list_blocks = TRUE;
+ bsr = parse_bsr(NULL, optarg);
break;
+
case 'd': /* debug level */
debug_level = atoi(optarg);
if (debug_level <= 0)
list_jobs = TRUE;
break;
+ case 'k':
+ list_blocks = TRUE;
+ break;
+
case 'L':
dump_label = TRUE;
break;
}
do_close();
}
+ if (bsr) {
+ free_bsr(bsr);
+ }
return 0;
}
dev->VolHdr.PrevVolName);
}
+ if (verbose) {
+ rec = new_record();
+ }
for ( ;; ) {
-
if (!read_block_from_device(dev, block)) {
- Dmsg0(20, "!read_record()\n");
+ Dmsg0(20, "!read_block()\n");
if (dev->state & ST_EOT) {
if (!mount_next_volume(infname)) {
break;
break;
}
- printf("Block: %d size=%d\n", block->BlockNumber, block->block_len);
+ if (verbose) {
+ read_record_from_block(block, rec);
+ Pmsg6(-1, "Block: %d blen=%d First rec FI=%s SessId=%d Strm=%s rlen=%d\n",
+ block->BlockNumber, block->block_len,
+ FI_to_ascii(rec->FileIndex), rec->VolSessionId,
+ stream_to_ascii(rec->Stream), rec->data_len);
+ rec->remainder = 0;
+ } else {
+ printf("Block: %d size=%d\n", block->BlockNumber, block->block_len);
+ }
}
return;
}
for ( ;; ) {
- if (!read_record(dev, block, rec)) {
- Dmsg0(20, "!read_record()\n");
+ if (!read_block_from_device(dev, block)) {
+ Dmsg0(20, "!read_block()\n");
if (dev->state & ST_EOT) {
if (!mount_next_volume(infname)) {
break;
continue;
}
if (dev->state & ST_SHORT) {
+ Pmsg0(000, "Got short block.\n");
Emsg0(M_INFO, 0, dev->errmsg);
continue;
}
display_error_status();
break;
}
-
- if (debug_level >= 30) {
- Dmsg4(30, "VolSId=%ld FI=%s Strm=%s Size=%ld\n", rec->VolSessionId,
- FI_to_ascii(rec->FileIndex), stream_to_ascii(rec->Stream),
- rec->data_len);
- }
+ while (read_record_from_block(block, rec)) {
+ if (debug_level >= 30) {
+ Dmsg4(30, "VolSId=%ld FI=%s Strm=%s Size=%ld\n", rec->VolSessionId,
+ FI_to_ascii(rec->FileIndex), stream_to_ascii(rec->Stream),
+ rec->data_len);
+ }
- /*
- * Check for End of File record (all zeros)
- * NOTE: this no longer exists
- */
- if (rec->VolSessionId == 0 && rec->VolSessionTime == 0) {
- Emsg0(M_ERROR_TERM, 0, "Zero VolSessionId and VolSessionTime. This shouldn't happen\n");
- }
+ /*
+ * Check for End of File record (all zeros)
+ * NOTE: this no longer exists
+ */
+ if (rec->VolSessionId == 0 && rec->VolSessionTime == 0) {
+ Emsg0(M_ERROR_TERM, 0, "Zero VolSessionId and VolSessionTime. This shouldn't happen\n");
+ }
- /*
- * Check for Start or End of Session Record
- *
- */
- if (rec->FileIndex < 0) {
- dump_label_record(dev, rec, verbose);
- continue;
+ /*
+ * Check for Start or End of Session Record
+ *
+ */
+ if (rec->FileIndex < 0) {
+ dump_label_record(dev, rec, verbose);
+ continue;
+ }
}
+ rec->remainder = 0;
}
return;
}
}
for ( ;; ) {
+ SESSION_LABEL sessrec;
+
if (!read_record(dev, block, rec)) {
Dmsg0(20, "!read_record()\n");
if (dev->state & ST_EOT) {
*
*/
if (rec->FileIndex < 0) {
- dump_label_record(dev, rec, 0);
+ char *rtype;
+ memset(&sessrec, 0, sizeof(sessrec));
+ switch (rec->FileIndex) {
+ case PRE_LABEL:
+ rtype = "Fresh Volume Label";
+ break;
+ case VOL_LABEL:
+ rtype = "Volume Label";
+ unser_volume_label(dev, rec);
+ break;
+ case SOS_LABEL:
+ rtype = "Begin Session";
+ unser_session_label(&sessrec, rec);
+ break;
+ case EOS_LABEL:
+ rtype = "End Session";
+ break;
+ case EOM_LABEL:
+ rtype = "End of Media";
+ break;
+ default:
+ rtype = "Unknown";
+ break;
+ }
+ if (debug_level > 0) {
+ printf("%s Record: VolSessionId=%d VolSessionTime=%d JobId=%d DataLen=%d\n",
+ rtype, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len);
+ }
+
+ Dmsg1(40, "Got label = %d\n", rec->FileIndex);
+ if (rec->FileIndex == EOM_LABEL) { /* end of tape? */
+ Dmsg0(40, "Get EOM LABEL\n");
+ break; /* yes, get out */
+ }
+ continue; /* ignore other labels */
+ } /* end if label record */
+
+ /*
+ * Apply BSR filter
+ */
+ if (bsr && !match_bsr(bsr, rec, &dev->VolHdr, &sessrec)) {
continue;
}
int do_mount = 0;
lock_device(dev);
- Dmsg1(90, "acquire_append device is %s\n", dev_is_tape(dev)?"tape":"disk");
+ Dmsg1(190, "acquire_append device is %s\n", dev_is_tape(dev)?"tape":"disk");
if (dev->state & ST_APPEND) {
} else if (dev->num_writers > 0) {
dev->num_writers--;
- Dmsg1(90, "There are %d writers in release_device\n", dev->num_writers);
+ Dmsg1(00, "There are %d writers in release_device\n", dev->num_writers);
if (dev->num_writers == 0) {
weof_dev(dev, 1);
Dmsg0(100, "dir_create_jobmedia_record. Release\n");
{
int recycle, ask, retry = 0, autochanger;
- Dmsg0(90, "Enter mount_next_volume()\n");
+ Dmsg0(190, "Enter mount_next_volume()\n");
mount_next_vol:
if (retry++ > 5) {
Dmsg1(500, "Vol NO_LABEL or IO_ERROR name=%s\n", jcr->VolumeName);
/* If permitted, create a label */
if (dev->capabilities & CAP_LABEL) {
- Dmsg0(90, "Create volume label\n");
+ Dmsg0(190, "Create volume label\n");
if (!write_volume_label_to_dev(jcr, (DEVRES *)dev->device, jcr->VolumeName,
jcr->pool_name)) {
goto mount_next_vol;
* If the tape is marked as Recycle, we rewrite the label.
*/
if (dev->VolHdr.LabelType == PRE_LABEL || recycle) {
- Dmsg1(90, "ready_for_append found freshly labeled volume. dev=%x\n", dev);
+ Dmsg1(190, "ready_for_append found freshly labeled volume. dev=%x\n", dev);
dev->VolHdr.LabelType = VOL_LABEL; /* set Volume label */
write_volume_label_to_block(jcr, dev, block);
/*
* we need to position to the end of the volume, since we are
* just now putting it into append mode.
*/
- Dmsg0(20, "Device previously written, moving to end of data\n");
+ Dmsg0(200, "Device previously written, moving to end of data\n");
Jmsg(jcr, M_INFO, 0, _("Volume %s previously written, moving to end of data.\n"),
jcr->VolumeName);
if (!eod_dev(dev)) {
int ready_dev_for_read(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
{
if (!(dev->state & ST_OPENED)) {
- Dmsg1(20, "bstored: open vol=%s\n", jcr->VolumeName);
+ Dmsg1(120, "bstored: open vol=%s\n", jcr->VolumeName);
if (open_dev(dev, jcr->VolumeName, READ_ONLY) < 0) {
Jmsg(jcr, M_FATAL, 0, _("Open device %s volume %s failed, ERR=%s\n"),
dev_name(dev), jcr->VolumeName, strerror_dev(dev));
return 0;
}
- Dmsg1(29, "open_dev %s OK\n", dev_name(dev));
+ Dmsg1(129, "open_dev %s OK\n", dev_name(dev));
}
for (;;) {
wait_time = time(NULL);
status_dev(dev, &stat);
if (stat & MT_EOD) {
- Dmsg0(90, "======= Got EOD ========\n");
+ Dmsg0(190, "======= Got EOD ========\n");
block_device(dev, BST_DOING_ACQUIRE);
dev->VolCatInfo.VolCatName, jcr->Job);
return 0; /* device locked */
}
- Dmsg0(90, "Back from update_vol_info\n");
+ Dmsg0(190, "Back from update_vol_info\n");
strcpy(PrevVolName, dev->VolCatInfo.VolCatName);
strcpy(dev->VolHdr.PrevVolName, PrevVolName);
* used tape, mount_next_volume() will return an
* empty label_blk, and nothing will be written.
*/
- Dmsg0(90, "write label block to dev\n");
+ Dmsg0(190, "write label block to dev\n");
if (!write_block_to_dev(dev, label_blk)) {
- Dmsg1(0, "write_block_to_device Volume label failed. ERR=%s",
+ Pmsg1(0, "write_block_to_device Volume label failed. ERR=%s",
strerror_dev(dev));
free_block(label_blk);
unblock_device(dev);
}
/* Write overflow block to tape */
- Dmsg0(90, "Write overflow block to dev\n");
+ Dmsg0(190, "Write overflow block to dev\n");
if (!write_block_to_dev(dev, block)) {
- Dmsg1(0, "write_block_to_device overflow block failed. ERR=%s",
+ Pmsg1(0, "write_block_to_device overflow block failed. ERR=%s",
strerror_dev(dev));
free_block(label_blk);
unblock_device(dev);
}
jcr->NumVolumes++;
- Dmsg0(90, "Wake up any waiting threads.\n");
+ Dmsg0(190, "Wake up any waiting threads.\n");
free_block(label_blk);
for (JCR *mjcr=NULL; (mjcr=next_attached_jcr(dev, mjcr)); ) {
/* Set new start/end positions */
*/
int open_device(DEVICE *dev)
{
- Dmsg0(20, "start open_output_device()\n");
+ Dmsg0(120, "start open_output_device()\n");
if (!dev) {
return 0;
}
/* Defer opening files */
if (!dev_is_tape(dev)) {
- Dmsg0(29, "Device is file, deferring open.\n");
+ Dmsg0(129, "Device is file, deferring open.\n");
unlock_device(dev);
return 1;
}
if (!(dev->state & ST_OPENED)) {
- Dmsg0(29, "Opening device.\n");
+ Dmsg0(129, "Opening device.\n");
if (open_dev(dev, NULL, READ_WRITE) < 0) {
Emsg1(M_FATAL, 0, _("dev open failed: %s\n"), dev->errmsg);
unlock_device(dev);
return 0;
}
}
- Dmsg1(29, "open_dev %s OK\n", dev_name(dev));
+ Dmsg1(129, "open_dev %s OK\n", dev_name(dev));
unlock_device(dev);
return 1;
{
int stat;
- Dmsg1(90, "lock %d\n", dev->dev_blocked);
+ Dmsg1(190, "lock %d\n", dev->dev_blocked);
P(dev->mutex);
if (dev->dev_blocked && !pthread_equal(dev->no_wait_id, pthread_self())) {
dev->num_waiting++; /* indicate that I am waiting */
void unlock_device(DEVICE *dev)
{
- Dmsg0(90, "unlock\n");
+ Dmsg0(190, "unlock\n");
V(dev->mutex);
}
*/
void block_device(DEVICE *dev, int state)
{
- Dmsg1(90, "block set %d\n", state);
+ Dmsg1(190, "block set %d\n", state);
ASSERT(dev->dev_blocked == BST_NOT_BLOCKED);
dev->dev_blocked = state; /* make other threads wait */
dev->no_wait_id = pthread_self(); /* allow us to continue */
*/
void unblock_device(DEVICE *dev)
{
- Dmsg1(90, "unblock %d\n", dev->dev_blocked);
+ Dmsg1(190, "unblock %d\n", dev->dev_blocked);
ASSERT(dev->dev_blocked);
dev->dev_blocked = BST_NOT_BLOCKED;
if (dev->num_waiting > 0) {
char ec1[30];
- Dmsg1(20, "Start run Job=%s\n", jcr->Job);
+ Dmsg1(120, "Start run Job=%s\n", jcr->Job);
bnet_fsend(dir, Job_start, jcr->Job);
time(&jcr->start_time);
jcr->run_time = jcr->start_time;
Dmsg1(120, "Append data: %s", fd->msg);
if (jcr->session_opened) {
- Dmsg1(10, "<bfiled: %s", fd->msg);
+ Dmsg1(110, "<bfiled: %s", fd->msg);
if (do_append_data(jcr)) {
bnet_fsend(fd, OK_append);
jcr->JobType = JT_BACKUP;
jcr->read_EndBlock);
}
- Dmsg1(10, "Read open session: %s\n", dev_name(jcr->device->dev));
+ Dmsg1(110, "Read open session: %s\n", dev_name(jcr->device->dev));
jcr->session_opened = TRUE;
jcr->JobType = JT_RESTORE;
* Get JobId and permissions from Director
*/
- Dmsg1(30, "Job_cmd: %s\n", dir->msg);
+ Dmsg1(130, "Job_cmd: %s\n", dir->msg);
job = get_memory(dir->msglen);
job_name = get_memory(dir->msglen);
client_name = get_memory(dir->msglen);
srandom(tv.tv_usec + tv.tv_sec);
sprintf(auth_key, "%ld", (long)random());
bnet_fsend(dir, OKjob, jcr->VolSessionId, jcr->VolSessionTime, auth_key);
- Dmsg1(10, ">dird: %s", dir->msg);
+ Dmsg1(110, ">dird: %s", dir->msg);
jcr->sd_auth_key = bstrdup(auth_key);
/*
BSOCK *fd = (BSOCK *)arg;
char job_name[MAX_NAME_LENGTH];
- Dmsg0(10, "enter connection_from_filed\n");
+ Dmsg0(110, "enter connection_from_filed\n");
if (bnet_recv(fd) <= 0) {
Emsg0(M_FATAL, 0, _("Unable to authenticate Client.\n"));
return;
jcr->file_bsock = fd;
- Dmsg1(10, "Found Job %s\n", job_name);
+ Dmsg1(110, "Found Job %s\n", job_name);
if (jcr->authenticated) {
Pmsg2(000, "Hey!!!! JobId %d Job %s already authenticated.\n",
Jmsg(jcr, M_FATAL, 0, _("Unable to authenticate File daemon\n"));
} else {
jcr->authenticated = TRUE;
- Dmsg1(10, "OK Authentication Job %s\n", jcr->Job);
+ Dmsg1(110, "OK Authentication Job %s\n", jcr->Job);
}
P(jcr->mutex);
return 0;
}
- Dmsg1(20, "Use device: %s", dir->msg);
+ Dmsg1(120, "Use device: %s", dir->msg);
dev_name = get_memory(dir->msglen);
media_type = get_memory(dir->msglen);
pool_name = get_memory(dir->msglen);
while ((device=(DEVRES *)GetNextRes(R_DEVICE, (RES *)device))) {
/* Find resource, and make sure we were able to open it */
if (strcmp(device->hdr.name, dev_name) == 0 && device->dev) {
- Dmsg1(20, "Found device %s\n", device->hdr.name);
+ Dmsg1(120, "Found device %s\n", device->hdr.name);
jcr->pool_name = get_memory(strlen(pool_name) + 1);
strcpy(jcr->pool_name, pool_name);
jcr->pool_type = get_memory(strlen(pool_type) + 1);
jcr->dev_name = get_memory(strlen(dev_name) + 1);
strcpy(jcr->dev_name, dev_name);
jcr->device = device;
- Dmsg4(20, use_device, dev_name, media_type, pool_name, pool_type);
+ Dmsg4(120, use_device, dev_name, media_type, pool_name, pool_type);
free_memory(dev_name);
free_memory(media_type);
free_memory(pool_name);
create_session_label(jcr, rec, label);
rec->FileIndex = label;
- if (!write_record_device(jcr, dev, block, rec)) {
- Jmsg(jcr, M_FATAL, 0, _("Error writing Session label to %s: %s\n"),
- dev_vol_name(dev), strerror(errno));
- free_record(rec);
- return 0;
+ while (!write_record_to_block(block, rec)) {
+ Dmsg2(190, "!write_record data_len=%d rem=%d\n", rec->data_len,
+ rec->remainder);
+ if (!write_block_to_device(jcr, dev, block)) {
+ Dmsg0(90, "Got session label write_block_to_dev error.\n");
+ Jmsg(jcr, M_FATAL, 0, _("Error writing Session label to %s: %s\n"),
+ dev_vol_name(dev), strerror(errno));
+ free_record(rec);
+ return 0;
+ }
}
- Dmsg1(90, "session_label record=%x\n", rec);
- Dmsg5(90, "sesson_label record FI=%s SessId=%d Strm=%s len=%d\n\
-remainder=%d\n",
+ Dmsg6(20, "Write sesson_label record JobId=%d FI=%s SessId=%d Strm=%s len=%d\n\
+remainder=%d\n", jcr->JobId,
FI_to_ascii(rec->FileIndex), rec->VolSessionId,
stream_to_ascii(rec->Stream), rec->data_len,
rec->remainder);
DEV_RECORD *new_record();
void free_record(DEV_RECORD *rec);
int read_record(DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *record);
-int write_record_device(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *record);
}
-/*
- * Write a record to block
- * if necessary, write the block to the device with locking
- * if necessary, handle getting a new Volume
- *
- * Returns: 0 on failure
- * 1 on success
- */
-int write_record_device(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *record)
-{
- Dmsg2(190, "write_device() dev=%x state=%x\n", dev, dev->state);
-
- while (!write_record_to_block(block, record)) {
- Dmsg2(190, "!write_record data_len=%d rem=%d\n", record->data_len,
- record->remainder);
- if (!write_block_to_device(jcr, dev, block)) {
- Dmsg0(90, "Got write_block_to_dev error.\n");
- return 0;
- }
- }
- Dmsg4(190, "write_record FI=%s SessId=%d Strm=%s len=%d\n",
- FI_to_ascii(record->FileIndex), record->VolSessionId,
- stream_to_ascii(record->Stream), record->data_len);
- return 1;
-}
-
/*
* Write a Record to the block
*