3 * label.c Bacula routines to handle labels
11 Copyright (C) 2000-2004 Kern Sibbald and John Walker
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of
16 the License, or (at your option) any later version.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
23 You should have received a copy of the GNU General Public
24 License along with this program; if not, write to the Free
25 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
30 #include "bacula.h" /* pull in global headers */
31 #include "stored.h" /* pull in Storage Deamon headers */
33 /* Forward referenced functions */
34 static void create_volume_label_record(DCR *dcr, DEV_RECORD *rec);
36 extern char my_name[];
37 extern int debug_level;
40 * Read the volume label
42 * If dcr->VolumeName == NULL, we accept any Bacula Volume
43 * If dcr->VolumeName[0] == 0, we accept any Bacula Volume
44 * otherwise dcr->VolumeName must match the Volume.
46 * If VolName given, ensure that it matches
48 * Returns VOL_ code as defined in record.h
59 int read_dev_volume_label(DCR *dcr)
62 DEVICE *dev = dcr->dev;
63 char *VolName = dcr->VolumeName;
66 DEV_BLOCK *block = dcr->block;
68 Dmsg3(100, "Enter read_volume_label device=%s vol=%s dev_Vol=%s\n",
69 dev_name(dev), VolName, dev->VolHdr.VolName);
71 if (dev_state(dev, ST_LABEL)) { /* did we already read label? */
72 /* Compare Volume Names allow special wild card */
73 if (VolName && *VolName && *VolName != '*' && strcmp(dev->VolHdr.VolName, VolName) != 0) {
74 Mmsg(jcr->errmsg, _("Wrong Volume mounted on device %s: Wanted %s have %s\n"),
75 dev_name(dev), VolName, dev->VolHdr.VolName);
77 * Cancel Job if too many label errors
80 if (!dev->poll && jcr->label_errors++ > 100) {
81 Jmsg(jcr, M_FATAL, 0, "Too many tries: %s", jcr->errmsg);
83 return VOL_NAME_ERROR;
85 Dmsg0(30, "Leave read_volume_label() VOL_OK\n");
86 return VOL_OK; /* label already read */
89 dev->state &= ~(ST_LABEL|ST_APPEND|ST_READ); /* set no label, no append */
91 if (!rewind_dev(dev)) {
92 Mmsg(jcr->errmsg, _("Couldn't rewind device %s ERR=%s\n"), dev_name(dev),
94 Dmsg1(30, "%s", jcr->errmsg);
97 bstrncpy(dev->VolHdr.Id, "**error**", sizeof(dev->VolHdr.Id));
99 /* Read the Volume label block */
100 record = new_record();
102 Dmsg0(90, "Big if statement in read_volume_label\n");
103 if (!read_block_from_dev(dcr, NO_BLOCK_NUMBER_CHECK)) {
104 Mmsg(jcr->errmsg, _("Requested Volume \"%s\" on %s is not a Bacula "
105 "labeled Volume, because: ERR=%s"), NPRT(VolName), dev_name(dev),
107 Dmsg1(30, "%s", jcr->errmsg);
108 } else if (!read_record_from_block(block, record)) {
109 Mmsg(jcr->errmsg, _("Could not read Volume label from block.\n"));
110 Dmsg1(30, "%s", jcr->errmsg);
111 } else if (!unser_volume_label(dev, record)) {
112 Mmsg(jcr->errmsg, _("Could not unserialize Volume label: ERR=%s\n"),
114 Dmsg1(30, "%s", jcr->errmsg);
115 } else if (strcmp(dev->VolHdr.Id, BaculaId) != 0 &&
116 strcmp(dev->VolHdr.Id, OldBaculaId) != 0) {
117 Mmsg(jcr->errmsg, _("Volume Header Id bad: %s\n"), dev->VolHdr.Id);
118 Dmsg1(30, "%s", jcr->errmsg);
124 if (forge_on || jcr->ignore_label_errors) {
125 dev->state |= ST_LABEL; /* set has Bacula label */
126 Jmsg(jcr, M_ERROR, 0, "%s", jcr->errmsg);
135 /* If we are a streaming device, we only get one chance to read */
136 if (!dev_cap(dev, CAP_STREAM)) {
141 if (dev->VolHdr.VerNum != BaculaTapeVersion &&
142 dev->VolHdr.VerNum != OldCompatibleBaculaTapeVersion1 &&
143 dev->VolHdr.VerNum != OldCompatibleBaculaTapeVersion2) {
144 Mmsg(jcr->errmsg, _("Volume on %s has wrong Bacula version. Wanted %d got %d\n"),
145 dev_name(dev), BaculaTapeVersion, dev->VolHdr.VerNum);
146 Dmsg1(30, "%s", jcr->errmsg);
147 return VOL_VERSION_ERROR;
150 /* We are looking for either an unused Bacula tape (PRE_LABEL) or
151 * a Bacula volume label (VOL_LABEL)
153 if (dev->VolHdr.LabelType != PRE_LABEL && dev->VolHdr.LabelType != VOL_LABEL) {
154 Mmsg(jcr->errmsg, _("Volume on %s has bad Bacula label type: %x\n"),
155 dev_name(dev), dev->VolHdr.LabelType);
156 Dmsg1(30, "%s", jcr->errmsg);
157 return VOL_LABEL_ERROR;
160 dev->state |= ST_LABEL; /* set has Bacula label */
162 /* Compare Volume Names */
163 Dmsg2(30, "Compare Vol names: VolName=%s hdr=%s\n", VolName?VolName:"*", dev->VolHdr.VolName);
164 if (VolName && *VolName && *VolName != '*' && strcmp(dev->VolHdr.VolName, VolName) != 0) {
165 Mmsg(jcr->errmsg, _("Wrong Volume mounted on device %s: Wanted %s have %s\n"),
166 dev_name(dev), VolName, dev->VolHdr.VolName);
167 Dmsg1(30, "%s", jcr->errmsg);
169 * Cancel Job if too many label errors
170 * => we are in a loop
172 if (!dev->poll && jcr->label_errors++ > 100) {
173 Jmsg(jcr, M_FATAL, 0, "Too many tries: %s", jcr->errmsg);
175 return VOL_NAME_ERROR;
177 Dmsg1(30, "Copy vol_name=%s\n", dev->VolHdr.VolName);
179 if (debug_level >= 10) {
180 dump_volume_label(dev);
182 Dmsg0(30, "Leave read_volume_label() VOL_OK\n");
186 /* unser_volume_label
188 * Unserialize the Volume label into the device Volume_Label
191 * Assumes that the record is already read.
193 * Returns: false on error
197 bool unser_volume_label(DEVICE *dev, DEV_RECORD *rec)
201 if (rec->FileIndex != VOL_LABEL && rec->FileIndex != PRE_LABEL) {
202 Mmsg3(dev->errmsg, _("Expecting Volume Label, got FI=%s Stream=%s len=%d\n"),
203 FI_to_ascii(rec->FileIndex),
204 stream_to_ascii(rec->Stream, rec->FileIndex),
211 dev->VolHdr.LabelType = rec->FileIndex;
212 dev->VolHdr.LabelSize = rec->data_len;
215 /* Unserialize the record into the Volume Header */
216 rec->data = check_pool_memory_size(rec->data, SER_LENGTH_Volume_Label);
217 ser_begin(rec->data, SER_LENGTH_Volume_Label);
218 unser_string(dev->VolHdr.Id);
219 unser_uint32(dev->VolHdr.VerNum);
221 if (dev->VolHdr.VerNum >= 11) {
222 unser_btime(dev->VolHdr.label_btime);
223 unser_btime(dev->VolHdr.write_btime);
224 } else { /* old way */
225 unser_float64(dev->VolHdr.label_date);
226 unser_float64(dev->VolHdr.label_time);
228 unser_float64(dev->VolHdr.write_date); /* Unused with VerNum >= 11 */
229 unser_float64(dev->VolHdr.write_time); /* Unused with VerNum >= 11 */
231 unser_string(dev->VolHdr.VolName);
232 unser_string(dev->VolHdr.PrevVolName);
233 unser_string(dev->VolHdr.PoolName);
234 unser_string(dev->VolHdr.PoolType);
235 unser_string(dev->VolHdr.MediaType);
237 unser_string(dev->VolHdr.HostName);
238 unser_string(dev->VolHdr.LabelProg);
239 unser_string(dev->VolHdr.ProgVersion);
240 unser_string(dev->VolHdr.ProgDate);
242 ser_end(rec->data, SER_LENGTH_Volume_Label);
243 Dmsg0(90, "ser_read_vol\n");
244 if (debug_level >= 90) {
245 dump_volume_label(dev);
251 * Put a volume label into the block
253 * Returns: false on failure
256 bool write_volume_label_to_block(DCR *dcr)
259 DEVICE *dev = dcr->dev;
261 DEV_BLOCK *block = dcr->block;
263 Dmsg0(20, "write Label in write_volume_label_to_block()\n");
264 memset(&rec, 0, sizeof(rec));
265 rec.data = get_memory(SER_LENGTH_Volume_Label);
266 empty_block(block); /* Volume label always at beginning */
268 create_volume_label_record(dcr, &rec);
270 block->BlockNumber = 0;
271 if (!write_record_to_block(block, &rec)) {
272 free_pool_memory(rec.data);
273 Jmsg1(jcr, M_FATAL, 0, _("Cannot write Volume label to block for device %s\n"),
277 Dmsg1(90, "Wrote label of %d bytes to block\n", rec.data_len);
279 free_pool_memory(rec.data);
284 * create_volume_label_record
285 * Serialize label (from dev->VolHdr structure) into device record.
286 * Assumes that the dev->VolHdr structure is properly
289 static void create_volume_label_record(DCR *dcr, DEV_RECORD *rec)
293 DEVICE *dev = dcr->dev;
296 /* Serialize the label into the device record. */
298 rec->data = check_pool_memory_size(rec->data, SER_LENGTH_Volume_Label);
299 ser_begin(rec->data, SER_LENGTH_Volume_Label);
300 ser_string(dev->VolHdr.Id);
302 ser_uint32(dev->VolHdr.VerNum);
304 if (dev->VolHdr.VerNum >= 11) {
305 ser_btime(dev->VolHdr.label_btime);
306 dev->VolHdr.write_btime = get_current_btime();
307 ser_btime(dev->VolHdr.write_btime);
308 dev->VolHdr.write_date = 0;
309 dev->VolHdr.write_time = 0;
311 /* OLD WAY DEPRECATED */
312 ser_float64(dev->VolHdr.label_date);
313 ser_float64(dev->VolHdr.label_time);
314 get_current_time(&dt);
315 dev->VolHdr.write_date = dt.julian_day_number;
316 dev->VolHdr.write_time = dt.julian_day_fraction;
318 ser_float64(dev->VolHdr.write_date); /* 0 if VerNum >= 11 */
319 ser_float64(dev->VolHdr.write_time); /* 0 if VerNum >= 11 */
321 ser_string(dev->VolHdr.VolName);
322 ser_string(dev->VolHdr.PrevVolName);
323 ser_string(dev->VolHdr.PoolName);
324 ser_string(dev->VolHdr.PoolType);
325 ser_string(dev->VolHdr.MediaType);
327 ser_string(dev->VolHdr.HostName);
328 ser_string(dev->VolHdr.LabelProg);
329 ser_string(dev->VolHdr.ProgVersion);
330 ser_string(dev->VolHdr.ProgDate);
332 ser_end(rec->data, SER_LENGTH_Volume_Label);
333 rec->data_len = ser_length(rec->data);
334 rec->FileIndex = dev->VolHdr.LabelType;
335 rec->VolSessionId = jcr->VolSessionId;
336 rec->VolSessionTime = jcr->VolSessionTime;
337 rec->Stream = jcr->NumVolumes;
338 Dmsg2(100, "Created Vol label rec: FI=%s len=%d\n", FI_to_ascii(rec->FileIndex),
344 * Create a volume label in memory
346 void create_volume_label(DEVICE *dev, const char *VolName, const char *PoolName)
348 DEVRES *device = (DEVRES *)dev->device;
350 Dmsg0(90, "Start create_volume_label()\n");
354 memset(&dev->VolHdr, 0, sizeof(dev->VolHdr));
356 bstrncpy(dev->VolHdr.Id, BaculaId, sizeof(dev->VolHdr.Id));
357 dev->VolHdr.VerNum = BaculaTapeVersion;
358 dev->VolHdr.LabelType = PRE_LABEL; /* Mark tape as unused */
359 bstrncpy(dev->VolHdr.VolName, VolName, sizeof(dev->VolHdr.VolName));
360 bstrncpy(dev->VolHdr.PoolName, PoolName, sizeof(dev->VolHdr.PoolName));
361 bstrncpy(dev->VolHdr.MediaType, device->media_type, sizeof(dev->VolHdr.MediaType));
363 bstrncpy(dev->VolHdr.PoolType, "Backup", sizeof(dev->VolHdr.PoolType));
365 dev->VolHdr.label_btime = get_current_btime();
366 dev->VolHdr.label_date = 0;
367 dev->VolHdr.label_time = 0;
369 if (gethostname(dev->VolHdr.HostName, sizeof(dev->VolHdr.HostName)) != 0) {
370 dev->VolHdr.HostName[0] = 0;
372 bstrncpy(dev->VolHdr.LabelProg, my_name, sizeof(dev->VolHdr.LabelProg));
373 sprintf(dev->VolHdr.ProgVersion, "Ver. %s %s", VERSION, BDATE);
374 sprintf(dev->VolHdr.ProgDate, "Build %s %s", __DATE__, __TIME__);
375 dev->state |= ST_LABEL; /* set has Bacula label */
376 if (debug_level >= 90) {
377 dump_volume_label(dev);
382 * Write a Volume Label
383 * !!! Note, this is ONLY used for writing
384 * a fresh volume label. Any data
385 * after the label will be destroyed,
386 * in fact, we write the label 5 times !!!!
388 * This routine expects that open_device() was previously called.
390 * This routine should be used only when labeling a blank tape.
392 bool write_new_volume_label_to_dev(DCR *dcr, const char *VolName, const char *PoolName)
395 DEVICE *dev = dcr->dev;
398 Dmsg0(99, "write_volume_label()\n");
399 empty_block(dcr->block);
400 create_volume_label(dev, VolName, PoolName);
402 if (!rewind_dev(dev)) {
403 memset(&dev->VolHdr, 0, sizeof(dev->VolHdr));
404 Dmsg2(30, "Bad status on %s from rewind. ERR=%s\n", dev_name(dev), strerror_dev(dev));
410 create_volume_label_record(dcr, dcr->rec);
411 dcr->rec->Stream = 0;
413 if (!write_record_to_block(dcr->block, dcr->rec)) {
414 Dmsg2(30, "Bad Label write on %s. ERR=%s\n", dev_name(dev), strerror_dev(dev));
415 memset(&dev->VolHdr, 0, sizeof(dev->VolHdr));
418 Dmsg2(30, "Wrote label of %d bytes to %s\n", dcr->rec->data_len, dev_name(dev));
421 Dmsg0(99, "Call write_block_to_dev()\n");
422 if (!write_block_to_dev(dcr)) {
423 memset(&dev->VolHdr, 0, sizeof(dev->VolHdr));
424 Dmsg2(30, "Bad Label write on %s. ERR=%s\n", dev_name(dev), strerror_dev(dev));
427 Dmsg0(99, " Wrote block to device\n");
430 dev->state |= ST_LABEL;
433 if (debug_level >= 20) {
434 dump_volume_label(dev);
443 * Create session label
444 * The pool memory must be released by the calling program
446 void create_session_label(DCR *dcr, DEV_RECORD *rec, int label)
451 rec->VolSessionId = jcr->VolSessionId;
452 rec->VolSessionTime = jcr->VolSessionTime;
453 rec->Stream = jcr->JobId;
455 rec->data = check_pool_memory_size(rec->data, SER_LENGTH_Session_Label);
456 ser_begin(rec->data, SER_LENGTH_Session_Label);
457 ser_string(BaculaId);
458 ser_uint32(BaculaTapeVersion);
460 ser_uint32(jcr->JobId);
462 /* Changed in VerNum 11 */
463 ser_btime(get_current_btime());
466 ser_string(dcr->pool_name);
467 ser_string(dcr->pool_type);
468 ser_string(jcr->job_name); /* base Job name */
469 ser_string(jcr->client_name);
471 /* Added in VerNum 10 */
472 ser_string(jcr->Job); /* Unique name of this Job */
473 ser_string(jcr->fileset_name);
474 ser_uint32(jcr->JobType);
475 ser_uint32(jcr->JobLevel);
476 /* Added in VerNum 11 */
477 ser_string(jcr->fileset_md5);
479 if (label == EOS_LABEL) {
480 ser_uint32(jcr->JobFiles);
481 ser_uint64(jcr->JobBytes);
482 ser_uint32(dcr->StartBlock);
483 ser_uint32(dcr->EndBlock);
484 ser_uint32(dcr->StartFile);
485 ser_uint32(dcr->EndFile);
486 ser_uint32(jcr->JobErrors);
488 /* Added in VerNum 11 */
489 ser_uint32(jcr->JobStatus);
491 ser_end(rec->data, SER_LENGTH_Session_Label);
492 rec->data_len = ser_length(rec->data);
495 /* Write session label
496 * Returns: false on failure
499 bool write_session_label(DCR *dcr, int label)
502 DEVICE *dev = dcr->dev;
504 DEV_BLOCK *block = dcr->block;
507 Dmsg1(90, "session_label record=%x\n", rec);
510 if (dev->state & ST_TAPE) {
511 dcr->StartBlock = dev->block_num;
512 dcr->StartFile = dev->file;
514 dcr->StartBlock = (uint32_t)dev->file_addr;
515 dcr->StartFile = (uint32_t)(dev->file_addr >> 32);
519 if (dev->state & ST_TAPE) {
520 dcr->EndBlock = dev->EndBlock;
521 dcr->EndFile = dev->EndFile;
523 dcr->EndBlock = (uint32_t)dev->file_addr;
524 dcr->EndFile = (uint32_t)(dev->file_addr >> 32);
528 Jmsg1(jcr, M_ABORT, 0, _("Bad session label = %d\n"), label);
531 create_session_label(dcr, rec, label);
532 rec->FileIndex = label;
535 * We guarantee that the session record can totally fit
536 * into a block. If not, write the block, and put it in
537 * the next block. Having the sesssion record totally in
538 * one block makes reading them much easier (no need to
539 * read the next block).
541 if (!can_write_record_to_block(block, rec)) {
542 Dmsg0(100, "Cannot write session label to block.\n");
543 if (!write_block_to_device(dcr)) {
544 Dmsg0(90, "Got session label write_block_to_dev error.\n");
545 /* ****FIXME***** errno is not set here */
546 Jmsg(jcr, M_FATAL, 0, _("Error writing Session label to %s: %s\n"),
547 dev_vol_name(dev), strerror(errno));
552 if (!write_record_to_block(block, rec)) {
553 Jmsg(jcr, M_FATAL, 0, _("Error writing Session label to %s: %s\n"),
554 dev_vol_name(dev), strerror(errno));
559 Dmsg6(20, "Write sesson_label record JobId=%d FI=%s SessId=%d Strm=%s len=%d\n\
560 remainder=%d\n", jcr->JobId,
561 FI_to_ascii(rec->FileIndex), rec->VolSessionId,
562 stream_to_ascii(rec->Stream, rec->FileIndex), rec->data_len,
566 Dmsg2(20, "Leave write_session_label Block=%d File=%d\n",
567 dev->block_num, dev->file);
571 void dump_volume_label(DEVICE *dev)
573 int dbl = debug_level;
575 const char *LabelType;
582 switch (dev->VolHdr.LabelType) {
584 LabelType = "PRE_LABEL";
587 LabelType = "VOL_LABEL";
590 LabelType = "EOM_LABEL";
593 LabelType = "SOS_LABEL";
596 LabelType = "EOS_LABEL";
602 sprintf(buf, "Unknown %d", dev->VolHdr.LabelType);
607 Pmsg11(-1, "\nVolume Label:\n\
620 dev->VolHdr.Id, dev->VolHdr.VerNum,
621 dev->VolHdr.VolName, dev->VolHdr.PrevVolName,
622 File, LabelType, dev->VolHdr.LabelSize,
623 dev->VolHdr.PoolName, dev->VolHdr.MediaType,
624 dev->VolHdr.PoolType, dev->VolHdr.HostName);
626 if (dev->VolHdr.VerNum >= 11) {
628 bstrftime(dt, sizeof(dt), btime_to_unix(dev->VolHdr.label_btime));
629 Pmsg1(-1, "Date label written: %s\n", dt);
631 dt.julian_day_number = dev->VolHdr.label_date;
632 dt.julian_day_fraction = dev->VolHdr.label_time;
635 Date label written: %04d-%02d-%02d at %02d:%02d\n",
636 tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min);
643 bool unser_session_label(SESSION_LABEL *label, DEV_RECORD *rec)
647 rec->data = check_pool_memory_size(rec->data, SER_LENGTH_Session_Label);
648 unser_begin(rec->data, SER_LENGTH_Session_Label);
649 unser_string(label->Id);
650 unser_uint32(label->VerNum);
651 unser_uint32(label->JobId);
652 if (label->VerNum >= 11) {
653 unser_btime(label->write_btime);
655 unser_float64(label->write_date);
657 unser_float64(label->write_time);
658 unser_string(label->PoolName);
659 unser_string(label->PoolType);
660 unser_string(label->JobName);
661 unser_string(label->ClientName);
662 if (label->VerNum >= 10) {
663 unser_string(label->Job); /* Unique name of this Job */
664 unser_string(label->FileSetName);
665 unser_uint32(label->JobType);
666 unser_uint32(label->JobLevel);
668 if (label->VerNum >= 11) {
669 unser_string(label->FileSetMD5);
671 label->FileSetMD5[0] = 0;
673 if (rec->FileIndex == EOS_LABEL) {
674 unser_uint32(label->JobFiles);
675 unser_uint64(label->JobBytes);
676 unser_uint32(label->StartBlock);
677 unser_uint32(label->EndBlock);
678 unser_uint32(label->StartFile);
679 unser_uint32(label->EndFile);
680 unser_uint32(label->JobErrors);
681 if (label->VerNum >= 11) {
682 unser_uint32(label->JobStatus);
684 label->JobStatus = JS_Terminated; /* kludge */
691 static void dump_session_label(DEV_RECORD *rec, const char *type)
697 char ec1[30], ec2[30], ec3[30], ec4[30], ec5[30], ec6[30], ec7[30];
699 unser_session_label(&label, rec);
702 Pmsg7(-1, "\n%s Record:\n\
709 ", type, label.JobId, label.VerNum,
710 label.PoolName, label.PoolType,
711 label.JobName, label.ClientName);
713 if (label.VerNum >= 10) {
715 Job (unique name) : %s\n\
719 ", label.Job, label.FileSetName, label.JobType, label.JobLevel);
722 if (rec->FileIndex == EOS_LABEL) {
733 edit_uint64_with_commas(label.JobFiles, ec1),
734 edit_uint64_with_commas(label.JobBytes, ec2),
735 edit_uint64_with_commas(label.StartBlock, ec3),
736 edit_uint64_with_commas(label.EndBlock, ec4),
737 edit_uint64_with_commas(label.StartFile, ec5),
738 edit_uint64_with_commas(label.EndFile, ec6),
739 edit_uint64_with_commas(label.JobErrors, ec7),
742 if (label.VerNum >= 11) {
744 bstrftime(dt, sizeof(dt), btime_to_unix(label.write_btime));
745 Pmsg1(-1, _("Date written : %s\n"), dt);
747 dt.julian_day_number = label.write_date;
748 dt.julian_day_fraction = label.write_time;
751 Date written : %04d-%02d-%02d at %02d:%02d\n"),
752 tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min);
758 void dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose)
765 switch (rec->FileIndex) {
767 type = _("Fresh Volume");
773 type = _("Begin Job Session");
776 type = _("End Job Session");
779 type = _("End of Media");
782 type = ("End of Tape");
789 switch (rec->FileIndex) {
792 unser_volume_label(dev, rec);
793 dump_volume_label(dev);
796 dump_session_label(rec, type);
799 dump_session_label(rec, type);
802 Pmsg5(-1, "%s Record: SessId=%d SessTime=%d JobId=%d DataLen=%d\n",
803 type, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len);
806 Pmsg0(-1, _("End of physical tape.\n"));
809 Pmsg5(-1, "%s Record: SessId=%d SessTime=%d JobId=%d DataLen=%d\n",
810 type, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len);
815 switch (rec->FileIndex) {
817 unser_session_label(&label, rec);
818 Pmsg6(-1, "%s Record: SessId=%d SessTime=%d JobId=%d Level=%c Type=%c\n",
819 type, rec->VolSessionId, rec->VolSessionTime, rec->Stream,
820 label.JobLevel, label.JobType);
823 char ed1[30], ed2[30];
824 unser_session_label(&label, rec);
825 Pmsg6(-1, "%s Record: SessId=%d SessTime=%d JobId=%d Level=%c Type=%c\n",
826 type, rec->VolSessionId, rec->VolSessionTime, rec->Stream,
827 label.JobLevel, label.JobType);
828 Pmsg4(-1, " Files=%s Bytes=%s Errors=%d Status=%c\n",
829 edit_uint64_with_commas(label.JobFiles, ed1),
830 edit_uint64_with_commas(label.JobBytes, ed2),
831 label.JobErrors, (char)label.JobStatus);
837 Pmsg5(-1, "%s Record: SessId=%d SessTime=%d JobId=%d DataLen=%d\n",
838 type, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len);