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 jcr->VolumeName == NULL, we accept any Bacula Volume
43 * If jcr->VolumeName[0] == 0, we accept any Bacula Volume
44 * otherwise jcr->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, DEV_BLOCK *block)
62 DEVICE *dev = dcr->dev;
63 char *VolName = jcr->VolumeName;
67 Dmsg3(100, "Enter read_volume_label device=%s vol=%s dev_Vol=%s\n",
68 dev_name(dev), VolName, dev->VolHdr.VolName);
70 if (dev_state(dev, ST_LABEL)) { /* did we already read label? */
71 /* Compare Volume Names allow special wild card */
72 if (VolName && *VolName && *VolName != '*' && strcmp(dev->VolHdr.VolName, VolName) != 0) {
73 Mmsg(&jcr->errmsg, _("Wrong Volume mounted on device %s: Wanted %s have %s\n"),
74 dev_name(dev), VolName, dev->VolHdr.VolName);
76 * Cancel Job if too many label errors
79 if (jcr->label_errors++ > 100) {
80 Jmsg(jcr, M_FATAL, 0, "%s", jcr->errmsg);
82 return jcr->label_status = VOL_NAME_ERROR;
84 Dmsg0(30, "Leave read_volume_label() VOL_OK\n");
85 return jcr->label_status = VOL_OK; /* label already read */
88 dev->state &= ~(ST_LABEL|ST_APPEND|ST_READ); /* set no label, no append */
90 if (!rewind_dev(dev)) {
91 Mmsg(&jcr->errmsg, _("Couldn't rewind device %s ERR=%s\n"), dev_name(dev),
93 return jcr->label_status = VOL_NO_MEDIA;
95 bstrncpy(dev->VolHdr.Id, "**error**", sizeof(dev->VolHdr.Id));
97 /* Read the Volume label block */
98 record = new_record();
99 Dmsg0(90, "Big if statement in read_volume_label\n");
100 if (!read_block_from_dev(dcr, block, NO_BLOCK_NUMBER_CHECK)) {
101 Mmsg(&jcr->errmsg, _("Requested Volume \"%s\" on %s is not a Bacula "
102 "labeled Volume, because: ERR=%s"), NPRT(VolName), dev_name(dev),
104 } else if (!read_record_from_block(block, record)) {
105 Mmsg(&jcr->errmsg, _("Could not read Volume label from block.\n"));
106 } else if (!unser_volume_label(dev, record)) {
107 Mmsg(&jcr->errmsg, _("Could not unserialize Volume label: ERR=%s\n"),
109 } else if (strcmp(dev->VolHdr.Id, BaculaId) != 0 &&
110 strcmp(dev->VolHdr.Id, OldBaculaId) != 0) {
111 Mmsg(&jcr->errmsg, _("Volume Header Id bad: %s\n"), dev->VolHdr.Id);
117 if (forge_on || jcr->ignore_label_errors) {
118 dev->state |= ST_LABEL; /* set has Bacula label */
119 Jmsg(jcr, M_ERROR, 0, "%s", jcr->errmsg);
120 return jcr->label_status = VOL_OK;
124 return jcr->label_status = VOL_NO_LABEL;
128 /* If we are a streaming device, we only get one chance to read */
129 if (!dev_cap(dev, CAP_STREAM)) {
134 if (dev->VolHdr.VerNum != BaculaTapeVersion &&
135 dev->VolHdr.VerNum != OldCompatibleBaculaTapeVersion1 &&
136 dev->VolHdr.VerNum != OldCompatibleBaculaTapeVersion2) {
137 Mmsg(&jcr->errmsg, _("Volume on %s has wrong Bacula version. Wanted %d got %d\n"),
138 dev_name(dev), BaculaTapeVersion, dev->VolHdr.VerNum);
139 return jcr->label_status = VOL_VERSION_ERROR;
142 /* We are looking for either an unused Bacula tape (PRE_LABEL) or
143 * a Bacula volume label (VOL_LABEL)
145 if (dev->VolHdr.LabelType != PRE_LABEL && dev->VolHdr.LabelType != VOL_LABEL) {
146 Mmsg(&jcr->errmsg, _("Volume on %s has bad Bacula label type: %x\n"),
147 dev_name(dev), dev->VolHdr.LabelType);
148 return jcr->label_status = VOL_LABEL_ERROR;
151 dev->state |= ST_LABEL; /* set has Bacula label */
153 /* Compare Volume Names */
154 Dmsg2(30, "Compare Vol names: VolName=%s hdr=%s\n", VolName?VolName:"*", dev->VolHdr.VolName);
155 if (VolName && *VolName && *VolName != '*' && strcmp(dev->VolHdr.VolName, VolName) != 0) {
156 Mmsg(&jcr->errmsg, _("Wrong Volume mounted on device %s: Wanted %s have %s\n"),
157 dev_name(dev), VolName, dev->VolHdr.VolName);
159 * Cancel Job if too many label errors
160 * => we are in a loop
162 if (jcr->label_errors++ > 100) {
163 Jmsg(jcr, M_FATAL, 0, "%s", jcr->errmsg);
165 return jcr->label_status = VOL_NAME_ERROR;
167 Dmsg1(30, "Copy vol_name=%s\n", dev->VolHdr.VolName);
169 if (debug_level >= 10) {
170 dump_volume_label(dev);
172 Dmsg0(30, "Leave read_volume_label() VOL_OK\n");
173 return jcr->label_status = VOL_OK;
176 /* unser_volume_label
178 * Unserialize the Volume label into the device Volume_Label
181 * Assumes that the record is already read.
183 * Returns: false on error
187 bool unser_volume_label(DEVICE *dev, DEV_RECORD *rec)
191 if (rec->FileIndex != VOL_LABEL && rec->FileIndex != PRE_LABEL) {
192 Mmsg3(&dev->errmsg, _("Expecting Volume Label, got FI=%s Stream=%s len=%d\n"),
193 FI_to_ascii(rec->FileIndex),
194 stream_to_ascii(rec->Stream, rec->FileIndex),
201 dev->VolHdr.LabelType = rec->FileIndex;
202 dev->VolHdr.LabelSize = rec->data_len;
205 /* Unserialize the record into the Volume Header */
206 rec->data = check_pool_memory_size(rec->data, SER_LENGTH_Volume_Label);
207 ser_begin(rec->data, SER_LENGTH_Volume_Label);
208 unser_string(dev->VolHdr.Id);
209 unser_uint32(dev->VolHdr.VerNum);
211 if (dev->VolHdr.VerNum >= 11) {
212 unser_btime(dev->VolHdr.label_btime);
213 unser_btime(dev->VolHdr.write_btime);
214 } else { /* old way */
215 unser_float64(dev->VolHdr.label_date);
216 unser_float64(dev->VolHdr.label_time);
218 unser_float64(dev->VolHdr.write_date); /* Unused with VerNum >= 11 */
219 unser_float64(dev->VolHdr.write_time); /* Unused with VerNum >= 11 */
221 unser_string(dev->VolHdr.VolName);
222 unser_string(dev->VolHdr.PrevVolName);
223 unser_string(dev->VolHdr.PoolName);
224 unser_string(dev->VolHdr.PoolType);
225 unser_string(dev->VolHdr.MediaType);
227 unser_string(dev->VolHdr.HostName);
228 unser_string(dev->VolHdr.LabelProg);
229 unser_string(dev->VolHdr.ProgVersion);
230 unser_string(dev->VolHdr.ProgDate);
232 ser_end(rec->data, SER_LENGTH_Volume_Label);
233 Dmsg0(90, "ser_read_vol\n");
234 if (debug_level >= 90) {
235 dump_volume_label(dev);
241 * Put a volume label into the block
243 * Returns: false on failure
246 bool write_volume_label_to_block(DCR *dcr, DEV_BLOCK *block)
249 DEVICE *dev = dcr->dev;
252 Dmsg0(20, "write Label in write_volume_label_to_block()\n");
253 memset(&rec, 0, sizeof(rec));
254 rec.data = get_memory(SER_LENGTH_Volume_Label);
256 create_volume_label_record(dcr, &rec);
258 empty_block(block); /* Volume label always at beginning */
259 block->BlockNumber = 0;
260 if (!write_record_to_block(block, &rec)) {
261 free_pool_memory(rec.data);
262 Jmsg1(jcr, M_FATAL, 0, _("Cannot write Volume label to block for device %s\n"),
266 Dmsg1(90, "Wrote label of %d bytes to block\n", rec.data_len);
268 free_pool_memory(rec.data);
273 * create_volume_label_record
274 * Serialize label (from dev->VolHdr structure) into device record.
275 * Assumes that the dev->VolHdr structure is properly
278 static void create_volume_label_record(DCR *dcr, DEV_RECORD *rec)
282 DEVICE *dev = dcr->dev;
285 /* Serialize the label into the device record. */
287 rec->data = check_pool_memory_size(rec->data, SER_LENGTH_Volume_Label);
288 ser_begin(rec->data, SER_LENGTH_Volume_Label);
289 ser_string(dev->VolHdr.Id);
291 ser_uint32(dev->VolHdr.VerNum);
293 if (dev->VolHdr.VerNum >= 11) {
294 ser_btime(dev->VolHdr.label_btime);
295 dev->VolHdr.write_btime = get_current_btime();
296 ser_btime(dev->VolHdr.write_btime);
297 dev->VolHdr.write_date = 0;
298 dev->VolHdr.write_time = 0;
300 /* OLD WAY DEPRECATED */
301 ser_float64(dev->VolHdr.label_date);
302 ser_float64(dev->VolHdr.label_time);
303 get_current_time(&dt);
304 dev->VolHdr.write_date = dt.julian_day_number;
305 dev->VolHdr.write_time = dt.julian_day_fraction;
307 ser_float64(dev->VolHdr.write_date); /* 0 if VerNum >= 11 */
308 ser_float64(dev->VolHdr.write_time); /* 0 if VerNum >= 11 */
310 ser_string(dev->VolHdr.VolName);
311 ser_string(dev->VolHdr.PrevVolName);
312 ser_string(dev->VolHdr.PoolName);
313 ser_string(dev->VolHdr.PoolType);
314 ser_string(dev->VolHdr.MediaType);
316 ser_string(dev->VolHdr.HostName);
317 ser_string(dev->VolHdr.LabelProg);
318 ser_string(dev->VolHdr.ProgVersion);
319 ser_string(dev->VolHdr.ProgDate);
321 ser_end(rec->data, SER_LENGTH_Volume_Label);
322 rec->data_len = ser_length(rec->data);
323 rec->FileIndex = dev->VolHdr.LabelType;
324 rec->VolSessionId = jcr->VolSessionId;
325 rec->VolSessionTime = jcr->VolSessionTime;
326 rec->Stream = jcr->NumVolumes;
327 Dmsg2(100, "Created Vol label rec: FI=%s len=%d\n", FI_to_ascii(rec->FileIndex),
333 * Create a volume label in memory
335 void create_volume_label(DEVICE *dev, const char *VolName, const char *PoolName)
337 DEVRES *device = (DEVRES *)dev->device;
339 Dmsg0(90, "Start create_volume_label()\n");
343 memset(&dev->VolHdr, 0, sizeof(dev->VolHdr));
345 bstrncpy(dev->VolHdr.Id, BaculaId, sizeof(dev->VolHdr.Id));
346 dev->VolHdr.VerNum = BaculaTapeVersion;
347 dev->VolHdr.LabelType = PRE_LABEL; /* Mark tape as unused */
348 bstrncpy(dev->VolHdr.VolName, VolName, sizeof(dev->VolHdr.VolName));
349 bstrncpy(dev->VolHdr.PoolName, PoolName, sizeof(dev->VolHdr.PoolName));
350 bstrncpy(dev->VolHdr.MediaType, device->media_type, sizeof(dev->VolHdr.MediaType));
352 bstrncpy(dev->VolHdr.PoolType, "Backup", sizeof(dev->VolHdr.PoolType));
354 dev->VolHdr.label_btime = get_current_btime();
355 dev->VolHdr.label_date = 0;
356 dev->VolHdr.label_time = 0;
358 if (gethostname(dev->VolHdr.HostName, sizeof(dev->VolHdr.HostName)) != 0) {
359 dev->VolHdr.HostName[0] = 0;
361 bstrncpy(dev->VolHdr.LabelProg, my_name, sizeof(dev->VolHdr.LabelProg));
362 sprintf(dev->VolHdr.ProgVersion, "Ver. %s %s", VERSION, BDATE);
363 sprintf(dev->VolHdr.ProgDate, "Build %s %s", __DATE__, __TIME__);
364 dev->state |= ST_LABEL; /* set has Bacula label */
365 if (debug_level >= 90) {
366 dump_volume_label(dev);
371 * Write a Volume Label
372 * !!! Note, this is ONLY used for writing
373 * a fresh volume label. Any data
374 * after the label will be destroyed,
375 * in fact, we write the label 5 times !!!!
377 * This routine expects that open_device() was previously called.
379 * This routine should be used only when labeling a blank tape.
381 bool write_new_volume_label_to_dev(DCR *dcr, const char *VolName, const char *PoolName)
386 DEVICE *dev = dcr->dev;
389 Dmsg0(99, "write_volume_label()\n");
390 create_volume_label(dev, VolName, PoolName);
392 if (!rewind_dev(dev)) {
393 memset(&dev->VolHdr, 0, sizeof(dev->VolHdr));
394 Dmsg2(30, "Bad status on %s from rewind. ERR=%s\n", dev_name(dev), strerror_dev(dev));
400 block = new_block(dev);
401 memset(&rec, 0, sizeof(rec));
402 rec.data = get_memory(SER_LENGTH_Volume_Label);
403 create_volume_label_record(dcr, &rec);
406 if (!write_record_to_block(block, &rec)) {
407 Dmsg2(30, "Bad Label write on %s. ERR=%s\n", dev_name(dev), strerror_dev(dev));
408 memset(&dev->VolHdr, 0, sizeof(dev->VolHdr));
411 Dmsg2(30, "Wrote label of %d bytes to %s\n", rec.data_len, dev_name(dev));
414 Dmsg0(99, "Call write_block_to_dev()\n");
415 if (!write_block_to_dev(dcr, block)) {
416 memset(&dev->VolHdr, 0, sizeof(dev->VolHdr));
417 Dmsg2(30, "Bad Label write on %s. ERR=%s\n", dev_name(dev), strerror_dev(dev));
420 Dmsg0(99, " Wrote block to device\n");
423 dev->state |= ST_LABEL;
426 if (debug_level >= 20) {
427 dump_volume_label(dev);
432 free_pool_memory(rec.data);
438 * Create session label
439 * The pool memory must be released by the calling program
441 void create_session_label(DCR *dcr, DEV_RECORD *rec, int label)
446 rec->VolSessionId = jcr->VolSessionId;
447 rec->VolSessionTime = jcr->VolSessionTime;
448 rec->Stream = jcr->JobId;
450 rec->data = check_pool_memory_size(rec->data, SER_LENGTH_Session_Label);
451 ser_begin(rec->data, SER_LENGTH_Session_Label);
452 ser_string(BaculaId);
453 ser_uint32(BaculaTapeVersion);
455 ser_uint32(jcr->JobId);
457 /* Changed in VerNum 11 */
458 ser_btime(get_current_btime());
461 ser_string(jcr->pool_name);
462 ser_string(jcr->pool_type);
463 ser_string(jcr->job_name); /* base Job name */
464 ser_string(jcr->client_name);
466 /* Added in VerNum 10 */
467 ser_string(jcr->Job); /* Unique name of this Job */
468 ser_string(jcr->fileset_name);
469 ser_uint32(jcr->JobType);
470 ser_uint32(jcr->JobLevel);
471 /* Added in VerNum 11 */
472 ser_string(jcr->fileset_md5);
474 if (label == EOS_LABEL) {
475 ser_uint32(jcr->JobFiles);
476 ser_uint64(jcr->JobBytes);
477 ser_uint32(dcr->StartBlock);
478 ser_uint32(dcr->EndBlock);
479 ser_uint32(dcr->StartFile);
480 ser_uint32(dcr->EndFile);
481 ser_uint32(jcr->JobErrors);
483 /* Added in VerNum 11 */
484 ser_uint32(jcr->JobStatus);
486 ser_end(rec->data, SER_LENGTH_Session_Label);
487 rec->data_len = ser_length(rec->data);
490 /* Write session label
491 * Returns: false on failure
494 bool write_session_label(DCR *dcr, DEV_BLOCK *block, int label)
497 DEVICE *dev = dcr->dev;
501 Dmsg1(90, "session_label record=%x\n", rec);
504 if (dev->state & ST_TAPE) {
505 dcr->StartBlock = dev->block_num;
506 dcr->StartFile = dev->file;
508 dcr->StartBlock = (uint32_t)dev->file_addr;
509 dcr->StartFile = (uint32_t)(dev->file_addr >> 32);
513 if (dev->state & ST_TAPE) {
514 dcr->EndBlock = dev->EndBlock;
515 dcr->EndFile = dev->EndFile;
517 dcr->EndBlock = (uint32_t)dev->file_addr;
518 dcr->EndFile = (uint32_t)(dev->file_addr >> 32);
522 Jmsg1(jcr, M_ABORT, 0, _("Bad session label = %d\n"), label);
525 create_session_label(dcr, rec, label);
526 rec->FileIndex = label;
529 * We guarantee that the session record can totally fit
530 * into a block. If not, write the block, and put it in
531 * the next block. Having the sesssion record totally in
532 * one block makes reading them much easier (no need to
533 * read the next block).
535 if (!can_write_record_to_block(block, rec)) {
536 Dmsg0(100, "Cannot write session label to block.\n");
537 if (!write_block_to_device(jcr->dcr, block)) {
538 Dmsg0(90, "Got session label write_block_to_dev error.\n");
539 Jmsg(jcr, M_FATAL, 0, _("Error writing Session label to %s: %s\n"),
540 dev_vol_name(dev), strerror(errno));
545 if (!write_record_to_block(block, rec)) {
546 Jmsg(jcr, M_FATAL, 0, _("Error writing Session label to %s: %s\n"),
547 dev_vol_name(dev), strerror(errno));
552 Dmsg6(20, "Write sesson_label record JobId=%d FI=%s SessId=%d Strm=%s len=%d\n\
553 remainder=%d\n", jcr->JobId,
554 FI_to_ascii(rec->FileIndex), rec->VolSessionId,
555 stream_to_ascii(rec->Stream, rec->FileIndex), rec->data_len,
559 Dmsg2(20, "Leave write_session_label Block=%d File=%d\n",
560 dev->block_num, dev->file);
564 void dump_volume_label(DEVICE *dev)
566 int dbl = debug_level;
568 const char *LabelType;
575 switch (dev->VolHdr.LabelType) {
577 LabelType = "PRE_LABEL";
580 LabelType = "VOL_LABEL";
583 LabelType = "EOM_LABEL";
586 LabelType = "SOS_LABEL";
589 LabelType = "EOS_LABEL";
595 sprintf(buf, "Unknown %d", dev->VolHdr.LabelType);
600 Pmsg11(-1, "\nVolume Label:\n\
613 dev->VolHdr.Id, dev->VolHdr.VerNum,
614 dev->VolHdr.VolName, dev->VolHdr.PrevVolName,
615 File, LabelType, dev->VolHdr.LabelSize,
616 dev->VolHdr.PoolName, dev->VolHdr.MediaType,
617 dev->VolHdr.PoolType, dev->VolHdr.HostName);
619 if (dev->VolHdr.VerNum >= 11) {
621 bstrftime(dt, sizeof(dt), btime_to_unix(dev->VolHdr.label_btime));
622 Pmsg1(-1, "Date label written: %s\n", dt);
624 dt.julian_day_number = dev->VolHdr.label_date;
625 dt.julian_day_fraction = dev->VolHdr.label_time;
628 Date label written: %04d-%02d-%02d at %02d:%02d\n",
629 tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min);
636 bool unser_session_label(SESSION_LABEL *label, DEV_RECORD *rec)
640 rec->data = check_pool_memory_size(rec->data, SER_LENGTH_Session_Label);
641 unser_begin(rec->data, SER_LENGTH_Session_Label);
642 unser_string(label->Id);
643 unser_uint32(label->VerNum);
644 unser_uint32(label->JobId);
645 if (label->VerNum >= 11) {
646 unser_btime(label->write_btime);
648 unser_float64(label->write_date);
650 unser_float64(label->write_time);
651 unser_string(label->PoolName);
652 unser_string(label->PoolType);
653 unser_string(label->JobName);
654 unser_string(label->ClientName);
655 if (label->VerNum >= 10) {
656 unser_string(label->Job); /* Unique name of this Job */
657 unser_string(label->FileSetName);
658 unser_uint32(label->JobType);
659 unser_uint32(label->JobLevel);
661 if (label->VerNum >= 11) {
662 unser_string(label->FileSetMD5);
664 label->FileSetMD5[0] = 0;
666 if (rec->FileIndex == EOS_LABEL) {
667 unser_uint32(label->JobFiles);
668 unser_uint64(label->JobBytes);
669 unser_uint32(label->StartBlock);
670 unser_uint32(label->EndBlock);
671 unser_uint32(label->StartFile);
672 unser_uint32(label->EndFile);
673 unser_uint32(label->JobErrors);
674 if (label->VerNum >= 11) {
675 unser_uint32(label->JobStatus);
677 label->JobStatus = JS_Terminated; /* kludge */
684 static void dump_session_label(DEV_RECORD *rec, const char *type)
690 char ec1[30], ec2[30], ec3[30], ec4[30], ec5[30], ec6[30], ec7[30];
692 unser_session_label(&label, rec);
695 Pmsg7(-1, "\n%s Record:\n\
702 ", type, label.JobId, label.VerNum,
703 label.PoolName, label.PoolType,
704 label.JobName, label.ClientName);
706 if (label.VerNum >= 10) {
708 Job (unique name) : %s\n\
712 ", label.Job, label.FileSetName, label.JobType, label.JobLevel);
715 if (rec->FileIndex == EOS_LABEL) {
726 edit_uint64_with_commas(label.JobFiles, ec1),
727 edit_uint64_with_commas(label.JobBytes, ec2),
728 edit_uint64_with_commas(label.StartBlock, ec3),
729 edit_uint64_with_commas(label.EndBlock, ec4),
730 edit_uint64_with_commas(label.StartFile, ec5),
731 edit_uint64_with_commas(label.EndFile, ec6),
732 edit_uint64_with_commas(label.JobErrors, ec7),
735 if (label.VerNum >= 11) {
737 bstrftime(dt, sizeof(dt), btime_to_unix(label.write_btime));
738 Pmsg1(-1, _("Date written : %s\n"), dt);
740 dt.julian_day_number = label.write_date;
741 dt.julian_day_fraction = label.write_time;
744 Date written : %04d-%02d-%02d at %02d:%02d\n"),
745 tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min);
751 void dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose)
758 switch (rec->FileIndex) {
760 type = _("Fresh Volume");
766 type = _("Begin Job Session");
769 type = _("End Job Session");
772 type = _("End of Media");
775 type = ("End of Tape");
782 switch (rec->FileIndex) {
785 unser_volume_label(dev, rec);
786 dump_volume_label(dev);
789 dump_session_label(rec, type);
792 dump_session_label(rec, type);
795 Pmsg5(-1, "%s Record: SessId=%d SessTime=%d JobId=%d DataLen=%d\n",
796 type, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len);
799 Pmsg0(-1, _("End of physical tape.\n"));
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);
808 switch (rec->FileIndex) {
810 unser_session_label(&label, rec);
811 Pmsg6(-1, "%s Record: SessId=%d SessTime=%d JobId=%d Level=%c Type=%c\n",
812 type, rec->VolSessionId, rec->VolSessionTime, rec->Stream,
813 label.JobLevel, label.JobType);
816 char ed1[30], ed2[30];
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);
821 Pmsg4(-1, " Files=%s Bytes=%s Errors=%d Status=%c\n",
822 edit_uint64_with_commas(label.JobFiles, ed1),
823 edit_uint64_with_commas(label.JobBytes, ed2),
824 label.JobErrors, (char)label.JobStatus);
830 Pmsg5(-1, "%s Record: SessId=%d SessTime=%d JobId=%d DataLen=%d\n",
831 type, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len);