src/stored/label.c
bool unser_volume_label(DEVICE *dev, DEV_RECORD *rec)
{
   ser_declare;
   char buf1[100], buf2[100];

   Enter(100);
   if (rec->FileIndex != VOL_LABEL && rec->FileIndex != PRE_LABEL) {
      Mmsg3(dev->errmsg, _("Expecting Volume Label, got FI=%s Stream=%s len=%d\n"),
              FI_to_ascii(buf1, rec->FileIndex),
              stream_to_ascii(buf2, rec->Stream, rec->FileIndex),
              rec->data_len);
      if (!forge_on) {
         Leave(100);
         return false;
      }
   }

   dev->VolHdr.LabelType = rec->FileIndex;
   dev->VolHdr.LabelSize = rec->data_len;


   /* Unserialize the record into the Volume Header */
   Dmsg2(100, "reclen=%d recdata=%s", rec->data_len, rec->data);
   rec->data = check_pool_memory_size(rec->data, SER_LENGTH_Volume_Label);
   Dmsg2(100, "reclen=%d recdata=%s", rec->data_len, rec->data);
   ser_begin(rec->data, SER_LENGTH_Volume_Label);
   unser_string(dev->VolHdr.Id);
   unser_uint32(dev->VolHdr.VerNum);

   if (dev->VolHdr.VerNum >= 11) {
      unser_btime(dev->VolHdr.label_btime);
      unser_btime(dev->VolHdr.write_btime);
   } else { /* old way */
      unser_float64(dev->VolHdr.label_date);
      unser_float64(dev->VolHdr.label_time);
   }
   unser_float64(dev->VolHdr.write_date);    /* Unused with VerNum >= 11 */
   unser_float64(dev->VolHdr.write_time);    /* Unused with VerNum >= 11 */

   unser_string(dev->VolHdr.VolumeName);
   unser_string(dev->VolHdr.PrevVolumeName);
   unser_string(dev->VolHdr.PoolName);
   unser_string(dev->VolHdr.PoolType);
   unser_string(dev->VolHdr.MediaType);

   unser_string(dev->VolHdr.HostName);
   unser_string(dev->VolHdr.LabelProg);
   unser_string(dev->VolHdr.ProgVersion);
   unser_string(dev->VolHdr.ProgDate);

//   unser_string(dev->VolHdr.AlignedVolumeName);
   dev->VolHdr.AlignedVolumeName[0] = 0;
   unser_uint64(dev->VolHdr.FirstData);
   unser_uint32(dev->VolHdr.FileAlignment);
   unser_uint32(dev->VolHdr.PaddingSize);
   unser_uint32(dev->VolHdr.BlockSize);

   ser_end(rec->data, SER_LENGTH_Volume_Label);
   Dmsg0(190, "unser_vol_label\n");
   if (chk_dbglvl(100)) {
      dev->dump_volume_label();
   }
   Leave(100);
   return true;
}
/*  unser_volume_label
 *
 * Unserialize the Bacula Volume label into the device Volume_Label
 * structure.
 *
 * Assumes that the record is already read.
 *
 * Returns: false on error
 *          true  on success
*/
unser_volume_label
Unserialize the Bacula Volume label into the device Volume_Label
structure.

Assumes that the record is already read.

false on error
true  on success
unser_volume_label Unserialize the Bacula Volume label into the device Volume_Label structure . Assumes that the record is already read . false on error true on success
bool unser_volume_label(DEVICE *dev, DEV_RECORD *rec)
{
   ser_declare;
   char buf1[100], buf2[100];
   Enter(100);
   if (rec->FileIndex != VOL_LABEL && rec->FileIndex != PRE_LABEL) {
      Mmsg3(dev->errmsg, _("Expecting Volume Label, got FI=%s Stream=%s len=%d\n"),
              FI_to_ascii(buf1, rec->FileIndex),
              stream_to_ascii(buf2, rec->Stream, rec->FileIndex),
              rec->data_len);
      if (!forge_on) {
         Leave(100);
         return false;
      }
   }
   dev->VolHdr.LabelType = rec->FileIndex;
   dev->VolHdr.LabelSize = rec->data_len;
   Dmsg2(100, "reclen=%d recdata=%s", rec->data_len, rec->data);
   rec->data = check_pool_memory_size(rec->data, SER_LENGTH_Volume_Label);
   Dmsg2(100, "reclen=%d recdata=%s", rec->data_len, rec->data);
   ser_begin(rec->data, SER_LENGTH_Volume_Label);
   unser_string(dev->VolHdr.Id);
   unser_uint32(dev->VolHdr.VerNum);
   if (dev->VolHdr.VerNum >= 11) {
      unser_btime(dev->VolHdr.label_btime);
      unser_btime(dev->VolHdr.write_btime);
   } else { 
      unser_float64(dev->VolHdr.label_date);
      unser_float64(dev->VolHdr.label_time);
   }
   unser_float64(dev->VolHdr.write_date);    
   unser_float64(dev->VolHdr.write_time);    
   unser_string(dev->VolHdr.VolumeName);
   unser_string(dev->VolHdr.PrevVolumeName);
   unser_string(dev->VolHdr.PoolName);
   unser_string(dev->VolHdr.PoolType);
   unser_string(dev->VolHdr.MediaType);
   unser_string(dev->VolHdr.HostName);
   unser_string(dev->VolHdr.LabelProg);
   unser_string(dev->VolHdr.ProgVersion);
   unser_string(dev->VolHdr.ProgDate);
   dev->VolHdr.AlignedVolumeName[0] = 0;
   unser_uint64(dev->VolHdr.FirstData);
   unser_uint32(dev->VolHdr.FileAlignment);
   unser_uint32(dev->VolHdr.PaddingSize);
   unser_uint32(dev->VolHdr.BlockSize);
   ser_end(rec->data, SER_LENGTH_Volume_Label);
   Dmsg0(190, "unser_vol_label\n");
   if (chk_dbglvl(100)) {
      dev->dump_volume_label();
   }
   Leave(100);
   return true;
}
bool unser_volume_label ( DEVICE * dev , DEV_RECORD * rec ) { ser_declare ; char buf1 [ 100 ] , buf2 [ 100 ] ; Enter ( 100 ) ; if ( rec -> FileIndex != VOL_LABEL && rec -> FileIndex != PRE_LABEL ) { Mmsg3 ( dev -> errmsg , _ ( " \n " ) , FI_to_ascii ( buf1 , rec -> FileIndex ) , stream_to_ascii ( buf2 , rec -> Stream , rec -> FileIndex ) , rec -> data_len ) ; if ( ! forge_on ) { Leave ( 100 ) ; return false ; } } dev -> VolHdr . LabelType = rec -> FileIndex ; dev -> VolHdr . LabelSize = rec -> data_len ; Dmsg2 ( 100 , " " , rec -> data_len , rec -> data ) ; rec -> data = check_pool_memory_size ( rec -> data , SER_LENGTH_Volume_Label ) ; Dmsg2 ( 100 , " " , rec -> data_len , rec -> data ) ; ser_begin ( rec -> data , SER_LENGTH_Volume_Label ) ; unser_string ( dev -> VolHdr . Id ) ; unser_uint32 ( dev -> VolHdr . VerNum ) ; if ( dev -> VolHdr . VerNum >= 11 ) { unser_btime ( dev -> VolHdr . label_btime ) ; unser_btime ( dev -> VolHdr . write_btime ) ; } else { unser_float64 ( dev -> VolHdr . label_date ) ; unser_float64 ( dev -> VolHdr . label_time ) ; } unser_float64 ( dev -> VolHdr . write_date ) ; unser_float64 ( dev -> VolHdr . write_time ) ; unser_string ( dev -> VolHdr . VolumeName ) ; unser_string ( dev -> VolHdr . PrevVolumeName ) ; unser_string ( dev -> VolHdr . PoolName ) ; unser_string ( dev -> VolHdr . PoolType ) ; unser_string ( dev -> VolHdr . MediaType ) ; unser_string ( dev -> VolHdr . HostName ) ; unser_string ( dev -> VolHdr . LabelProg ) ; unser_string ( dev -> VolHdr . ProgVersion ) ; unser_string ( dev -> VolHdr . ProgDate ) ; dev -> VolHdr . AlignedVolumeName [ 0 ] = 0 ; unser_uint64 ( dev -> VolHdr . FirstData ) ; unser_uint32 ( dev -> VolHdr . FileAlignment ) ; unser_uint32 ( dev -> VolHdr . PaddingSize ) ; unser_uint32 ( dev -> VolHdr . BlockSize ) ; ser_end ( rec -> data , SER_LENGTH_Volume_Label ) ; Dmsg0 ( 190 , " \n " ) ; if ( chk_dbglvl ( 100 ) ) { dev -> dump_volume_label ( ) ; } Leave ( 100 ) ; return true ; }
unser_volume_label
 Unserialize the Bacula Volume label into the device Volume_Label
 structure.
unser_volume_label Unserialize the Bacula Volume label into the device Volume_Label structure .
/* Unserialize the record into the Volume Header */ /* old way */ /* Unused with VerNum >= 11 */ /* Unused with VerNum >= 11 */ //   unser_string(dev->VolHdr.AlignedVolumeName);