3 * label.c Bacula routines to handle labels
11 Copyright (C) 2000-2003 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(JCR *jcr, DEVICE *dev, 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(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
61 char *VolName = jcr->VolumeName;
65 Dmsg3(100, "Enter read_volume_label device=%s vol=%s dev_Vol=%s\n",
66 dev_name(dev), VolName, dev->VolHdr.VolName);
68 if (dev->state & ST_LABEL) { /* did we already read label? */
69 /* Compare Volume Names allow special wild card */
70 if (VolName && *VolName && *VolName != '*' && strcmp(dev->VolHdr.VolName, VolName) != 0) {
71 Mmsg(&jcr->errmsg, _("Volume name mismatch on device %s: Wanted %s got %s\n"),
72 dev_name(dev), VolName, dev->VolHdr.VolName);
74 * Cancel Job if too many label errors
77 if (jcr->label_errors > 100) {
78 set_jcr_job_status(jcr, JS_ErrorTerminated);
79 Jmsg(jcr, M_FATAL, 0, "%s", jcr->errmsg);
81 return jcr->label_status = VOL_NAME_ERROR;
83 Dmsg0(30, "Leave read_volume_label() VOL_OK\n");
84 return jcr->label_status = VOL_OK; /* label already read */
87 dev->state &= ~(ST_LABEL|ST_APPEND|ST_READ); /* set no label, no append */
89 if (!rewind_dev(dev)) {
90 Mmsg(&jcr->errmsg, _("Couldn't rewind device %s ERR=%s\n"), dev_name(dev),
92 return jcr->label_status = VOL_NO_MEDIA;
94 strcpy(dev->VolHdr.Id, "**error**");
96 /* Read the device label block */
97 record = new_record();
98 Dmsg0(90, "Big if statement in read_volume_label\n");
99 if (!read_block_from_dev(dev, block)) {
100 Mmsg(&jcr->errmsg, _("Volume on %s is not a Bacula labeled Volume, \
101 because:\n %s"), dev_name(dev), strerror_dev(dev));
102 } else if (!read_record_from_block(block, record)) {
103 Mmsg(&jcr->errmsg, _("Could not read Volume label from block.\n"));
104 } else if (!unser_volume_label(dev, record)) {
105 Mmsg(&jcr->errmsg, _("Could not unserialize Volume label: %s\n"),
107 } else if (strcmp(dev->VolHdr.Id, BaculaId) != 0 &&
108 strcmp(dev->VolHdr.Id, OldBaculaId) != 0) {
109 Mmsg(&jcr->errmsg, _("Volume Header Id bad: %s\n"), dev->VolHdr.Id);
117 return jcr->label_status = VOL_NO_LABEL;
121 /* If we are a streaming device, we only get one chance to read */
122 if (!dev_cap(dev, CAP_STREAM)) {
127 if (dev->VolHdr.VerNum != BaculaTapeVersion &&
128 dev->VolHdr.VerNum != OldCompatibleBaculaTapeVersion1 &&
129 dev->VolHdr.VerNum != OldCompatibleBaculaTapeVersion2) {
130 Mmsg(&jcr->errmsg, _("Volume on %s has wrong Bacula version. Wanted %d got %d\n"),
131 dev_name(dev), BaculaTapeVersion, dev->VolHdr.VerNum);
132 return jcr->label_status = VOL_VERSION_ERROR;
135 /* Compare Volume Names */
136 Dmsg2(30, "Compare Vol names: VolName=%s hdr=%s\n", VolName?VolName:"*", dev->VolHdr.VolName);
137 if (VolName && *VolName && *VolName != '*' && strcmp(dev->VolHdr.VolName, VolName) != 0) {
138 Mmsg(&jcr->errmsg, _("Volume name mismatch. Wanted %s got %s\n"),
139 VolName, dev->VolHdr.VolName);
141 * Cancel Job if too many label errors
142 * => we are in a loop
144 if (jcr->label_errors > 100) {
145 set_jcr_job_status(jcr, JS_ErrorTerminated);
146 Jmsg(jcr, M_FATAL, 0, "%s", jcr->errmsg);
148 return jcr->label_status = VOL_NAME_ERROR;
150 Dmsg1(30, "Copy vol_name=%s\n", dev->VolHdr.VolName);
152 /* We are looking for either an unused Bacula tape (PRE_LABEL) or
153 * a Bacula volume label (VOL_LABEL)
155 if (dev->VolHdr.LabelType != PRE_LABEL && dev->VolHdr.LabelType != VOL_LABEL) {
156 Mmsg(&jcr->errmsg, _("Volume on %s has bad Bacula label type: %x\n"),
157 dev_name(dev), dev->VolHdr.LabelType);
158 return jcr->label_status = VOL_LABEL_ERROR;
161 dev->state |= ST_LABEL; /* set has Bacula label */
162 if (debug_level >= 10) {
163 dump_volume_label(dev);
165 Dmsg0(30, "Leave read_volume_label() VOL_OK\n");
166 return jcr->label_status = VOL_OK;
169 /* unser_volume_label
171 * Unserialize the Volume label into the device Volume_Label
174 * Assumes that the record is already read.
176 * Returns: 0 on error
180 int unser_volume_label(DEVICE *dev, DEV_RECORD *rec)
184 if (rec->FileIndex != VOL_LABEL && rec->FileIndex != PRE_LABEL) {
185 Mmsg3(&dev->errmsg, _("Expecting Volume Label, got FI=%s Stream=%s len=%d\n"),
186 FI_to_ascii(rec->FileIndex),
187 stream_to_ascii(rec->Stream, rec->FileIndex),
192 dev->VolHdr.LabelType = rec->FileIndex;
193 dev->VolHdr.LabelSize = rec->data_len;
196 /* Unserialize the record into the Volume Header */
197 rec->data = check_pool_memory_size(rec->data, SER_LENGTH_Volume_Label);
198 ser_begin(rec->data, SER_LENGTH_Volume_Label);
199 unser_string(dev->VolHdr.Id);
200 unser_uint32(dev->VolHdr.VerNum);
202 if (dev->VolHdr.VerNum >= 11) {
203 unser_btime(dev->VolHdr.label_btime);
204 unser_btime(dev->VolHdr.write_btime);
205 } else { /* old way */
206 unser_float64(dev->VolHdr.label_date);
207 unser_float64(dev->VolHdr.label_time);
209 unser_float64(dev->VolHdr.write_date); /* Unused with VerNum >= 11 */
210 unser_float64(dev->VolHdr.write_time); /* Unused with VerNum >= 11 */
212 unser_string(dev->VolHdr.VolName);
213 unser_string(dev->VolHdr.PrevVolName);
214 unser_string(dev->VolHdr.PoolName);
215 unser_string(dev->VolHdr.PoolType);
216 unser_string(dev->VolHdr.MediaType);
218 unser_string(dev->VolHdr.HostName);
219 unser_string(dev->VolHdr.LabelProg);
220 unser_string(dev->VolHdr.ProgVersion);
221 unser_string(dev->VolHdr.ProgDate);
223 ser_end(rec->data, SER_LENGTH_Volume_Label);
224 Dmsg0(90, "ser_read_vol\n");
225 if (debug_level >= 90) {
226 dump_volume_label(dev);
232 * Put a volume label into the block
234 * Returns: 0 on failure
237 int write_volume_label_to_block(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
241 Dmsg0(20, "write Label in write_volume_label_to_block()\n");
242 memset(&rec, 0, sizeof(rec));
243 rec.data = get_memory(SER_LENGTH_Volume_Label);
245 create_volume_label_record(jcr, dev, &rec);
247 empty_block(block); /* Volume label always at beginning */
248 if (!write_record_to_block(block, &rec)) {
249 free_pool_memory(rec.data);
250 Jmsg1(jcr, M_FATAL, 0, _("Cannot write Volume label to block for device %s\n"),
254 Dmsg1(90, "Wrote label of %d bytes to block\n", rec.data_len);
256 free_pool_memory(rec.data);
261 * create_volume_label_record
262 * Serialize label (from dev->VolHdr structure) into device record.
263 * Assumes that the dev->VolHdr structure is properly
266 static void create_volume_label_record(JCR *jcr, DEVICE *dev, DEV_RECORD *rec)
271 /* Serialize the label into the device record. */
273 rec->data = check_pool_memory_size(rec->data, SER_LENGTH_Volume_Label);
274 ser_begin(rec->data, SER_LENGTH_Volume_Label);
275 ser_string(dev->VolHdr.Id);
277 ser_uint32(dev->VolHdr.VerNum);
279 if (dev->VolHdr.VerNum >= 11) {
280 ser_btime(dev->VolHdr.label_btime);
281 dev->VolHdr.write_btime = get_current_btime();
282 ser_btime(dev->VolHdr.write_btime);
283 dev->VolHdr.write_date = 0;
284 dev->VolHdr.write_time = 0;
286 /* OLD WAY DEPRECATED */
287 ser_float64(dev->VolHdr.label_date);
288 ser_float64(dev->VolHdr.label_time);
289 get_current_time(&dt);
290 dev->VolHdr.write_date = dt.julian_day_number;
291 dev->VolHdr.write_time = dt.julian_day_fraction;
293 ser_float64(dev->VolHdr.write_date); /* 0 if VerNum >= 11 */
294 ser_float64(dev->VolHdr.write_time); /* 0 if VerNum >= 11 */
296 ser_string(dev->VolHdr.VolName);
297 ser_string(dev->VolHdr.PrevVolName);
298 ser_string(dev->VolHdr.PoolName);
299 ser_string(dev->VolHdr.PoolType);
300 ser_string(dev->VolHdr.MediaType);
302 ser_string(dev->VolHdr.HostName);
303 ser_string(dev->VolHdr.LabelProg);
304 ser_string(dev->VolHdr.ProgVersion);
305 ser_string(dev->VolHdr.ProgDate);
307 ser_end(rec->data, SER_LENGTH_Volume_Label);
308 rec->data_len = ser_length(rec->data);
309 rec->FileIndex = dev->VolHdr.LabelType;
310 rec->VolSessionId = jcr->VolSessionId;
311 rec->VolSessionTime = jcr->VolSessionTime;
312 rec->Stream = jcr->NumVolumes;
313 Dmsg2(100, "Created Vol label rec: FI=%s len=%d\n", FI_to_ascii(rec->FileIndex),
319 * Create a volume label in memory
320 * Returns: 0 on error
323 void create_volume_label(DEVICE *dev, char *VolName)
326 DEVRES *device = (DEVRES *)dev->device;
328 Dmsg0(90, "Start create_volume_label()\n");
332 memset(&dev->VolHdr, 0, sizeof(dev->VolHdr));
334 /* ***FIXME*** we really need to get the volume name,
335 * pool name, and pool type from the database.
336 * We also need to pickup the MediaType.
338 strcpy(dev->VolHdr.Id, BaculaId);
339 dev->VolHdr.VerNum = BaculaTapeVersion;
340 dev->VolHdr.LabelType = PRE_LABEL; /* Mark tape as unused */
341 bstrncpy(dev->VolHdr.VolName, VolName, sizeof(dev->VolHdr.VolName));
342 strcpy(dev->VolHdr.PoolName, "Default");
343 bstrncpy(dev->VolHdr.MediaType, device->media_type, sizeof(dev->VolHdr.MediaType));
344 strcpy(dev->VolHdr.PoolType, "Backup");
346 /* Put label time/date in header */
347 if (BaculaTapeVersion >= 11) {
348 dev->VolHdr.label_btime = get_current_btime();
349 dev->VolHdr.label_date = 0;
350 dev->VolHdr.label_time = 0;
352 /* OLD WAY DEPRECATED */
353 get_current_time(&dt);
354 dev->VolHdr.label_date = dt.julian_day_number;
355 dev->VolHdr.label_time = dt.julian_day_fraction;
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 int write_volume_label_to_dev(JCR *jcr, DEVRES *device, char *VolName, char *PoolName)
383 DEVICE *dev = device->dev;
389 Dmsg0(99, "write_volume_label()\n");
390 create_volume_label(dev, VolName);
391 bstrncpy(dev->VolHdr.MediaType, device->media_type, sizeof(dev->VolHdr.MediaType));
392 bstrncpy(dev->VolHdr.VolName, VolName, sizeof(dev->VolHdr.VolName));
393 bstrncpy(dev->VolHdr.PoolName, PoolName, sizeof(dev->VolHdr.PoolName));
395 if (!rewind_dev(dev)) {
396 memset(&dev->VolHdr, 0, sizeof(dev->VolHdr));
397 Dmsg2(30, "Bad status on %s from rewind. ERR=%s\n", dev_name(dev), strerror_dev(dev));
401 block = new_block(dev);
402 memset(&rec, 0, sizeof(rec));
403 rec.data = get_memory(SER_LENGTH_Volume_Label);
404 create_volume_label_record(jcr, dev, &rec);
407 if (!write_record_to_block(block, &rec)) {
408 Dmsg2(30, "Bad Label write on %s. ERR=%s\n", dev_name(dev), strerror_dev(dev));
409 memset(&dev->VolHdr, 0, sizeof(dev->VolHdr));
411 free_pool_memory(rec.data);
414 Dmsg2(30, "Wrote label of %d bytes to %s\n", rec.data_len, dev_name(dev));
416 free_pool_memory(rec.data);
418 Dmsg0(99, "Call write_block_to_device()\n");
419 if (!write_block_to_dev(jcr, dev, block)) {
420 memset(&dev->VolHdr, 0, sizeof(dev->VolHdr));
421 Dmsg2(30, "Bad Label write on %s. ERR=%s\n", dev_name(dev), strerror_dev(dev));
424 Dmsg0(99, " Wrote block to device\n");
428 dev->state |= ST_LABEL;
430 if (debug_level >= 20) {
431 dump_volume_label(dev);
439 * Create session label
440 * The pool memory must be released by the calling program
442 void create_session_label(JCR *jcr, DEV_RECORD *rec, int label)
447 rec->sync = 1; /* wait for completion */
448 rec->VolSessionId = jcr->VolSessionId;
449 rec->VolSessionTime = jcr->VolSessionTime;
450 rec->Stream = jcr->JobId;
452 rec->data = check_pool_memory_size(rec->data, SER_LENGTH_Session_Label);
453 ser_begin(rec->data, SER_LENGTH_Session_Label);
454 ser_string(BaculaId);
455 ser_uint32(BaculaTapeVersion);
457 ser_uint32(jcr->JobId);
459 if (BaculaTapeVersion >= 11) {
460 ser_btime(get_current_btime());
463 /* OLD WAY DEPRECATED */
464 get_current_time(&dt);
465 ser_float64(dt.julian_day_number);
466 ser_float64(dt.julian_day_fraction);
469 ser_string(jcr->pool_name);
470 ser_string(jcr->pool_type);
471 ser_string(jcr->job_name); /* base Job name */
472 ser_string(jcr->client_name);
474 /* Added in VerNum 10 */
475 ser_string(jcr->Job); /* Unique name of this Job */
476 ser_string(jcr->fileset_name);
477 ser_uint32(jcr->JobType);
478 ser_uint32(jcr->JobLevel);
479 if (BaculaTapeVersion >= 11) {
480 ser_string(jcr->fileset_md5);
483 if (label == EOS_LABEL) {
484 ser_uint32(jcr->JobFiles);
485 ser_uint64(jcr->JobBytes);
486 ser_uint32(jcr->StartBlock);
487 ser_uint32(jcr->EndBlock);
488 ser_uint32(jcr->StartFile);
489 ser_uint32(jcr->EndFile);
490 ser_uint32(jcr->JobErrors);
492 /* Added in VerNum 11 */
493 ser_uint32(jcr->JobStatus);
495 ser_end(rec->data, SER_LENGTH_Session_Label);
496 rec->data_len = ser_length(rec->data);
499 /* Write session label
500 * Returns: 0 on failure
503 int write_session_label(JCR *jcr, DEV_BLOCK *block, int label)
505 DEVICE *dev = jcr->device->dev;
509 Dmsg1(90, "session_label record=%x\n", rec);
512 if (dev->state & ST_TAPE) {
513 jcr->StartBlock = dev->block_num;
514 jcr->StartFile = dev->file;
516 jcr->StartBlock = (uint32_t)dev->file_addr;
517 jcr->StartFile = (uint32_t)(dev->file_addr >> 32);
521 if (dev->state & ST_TAPE) {
522 jcr->EndBlock = dev->EndBlock;
523 jcr->EndFile = dev->EndFile;
525 jcr->EndBlock = (uint32_t)dev->file_addr;
526 jcr->EndFile = (uint32_t)(dev->file_addr >> 32);
530 Jmsg1(jcr, M_ABORT, 0, _("Bad session label = %d\n"), label);
533 create_session_label(jcr, rec, label);
534 rec->FileIndex = label;
537 * We guarantee that the session record can totally fit
538 * into a block. If not, write the block, and put it in
539 * the next block. Having the sesssion record totally in
540 * one block makes reading them much easier (no need to
541 * read the next block).
543 if (!can_write_record_to_block(block, rec)) {
544 Dmsg0(100, "Cannot write session label to block.\n");
545 if (!write_block_to_device(jcr, dev, block)) {
546 Dmsg0(90, "Got session label write_block_to_dev error.\n");
547 Jmsg(jcr, M_FATAL, 0, _("Error writing Session label to %s: %s\n"),
548 dev_vol_name(dev), strerror(errno));
553 if (!write_record_to_block(block, rec)) {
554 Jmsg(jcr, M_FATAL, 0, _("Error writing Session label to %s: %s\n"),
555 dev_vol_name(dev), strerror(errno));
560 Dmsg6(20, "Write sesson_label record JobId=%d FI=%s SessId=%d Strm=%s len=%d\n\
561 remainder=%d\n", jcr->JobId,
562 FI_to_ascii(rec->FileIndex), rec->VolSessionId,
563 stream_to_ascii(rec->Stream, rec->FileIndex), rec->data_len,
567 Dmsg2(20, "Leave write_session_label Block=%d File=%d\n",
568 dev->block_num, dev->file);
572 void dump_volume_label(DEVICE *dev)
574 int dbl = debug_level;
576 char *LabelType, buf[30];
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 int 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, 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 Session");
776 type = _("End 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);
814 switch (rec->FileIndex) {
818 unser_session_label(&label, rec);
819 Pmsg6(-1, "%s Record: SessId=%d SessTime=%d JobId=%d Level=%c \
821 type, rec->VolSessionId, rec->VolSessionTime, rec->Stream,
822 label.JobLevel, label.JobType);
828 Pmsg5(-1, "%s Record: SessId=%d SessTime=%d JobId=%d DataLen=%d\n",
829 type, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len);