src/stored/label.c
static void create_volume_label_record(DCR *dcr, DEVICE *dev,
     DEV_RECORD *rec, bool adata)
{
   ser_declare;
   struct date_time dt;
   JCR *jcr = dcr->jcr;
   char buf[100];

   /* Serialize the label into the device record. */

   Enter(100);
   rec->data = check_pool_memory_size(rec->data, SER_LENGTH_Volume_Label);
   memset(rec->data, 0, SER_LENGTH_Volume_Label);
   ser_begin(rec->data, SER_LENGTH_Volume_Label);
   ser_string(dev->VolHdr.Id);

   ser_uint32(dev->VolHdr.VerNum);

   if (dev->VolHdr.VerNum >= 11) {
      ser_btime(dev->VolHdr.label_btime);
      dev->VolHdr.write_btime = get_current_btime();
      ser_btime(dev->VolHdr.write_btime);
      dev->VolHdr.write_date = 0;
      dev->VolHdr.write_time = 0;
   } else {
      /* OLD WAY DEPRECATED */
      ser_float64(dev->VolHdr.label_date);
      ser_float64(dev->VolHdr.label_time);
      get_current_time(&dt);
      dev->VolHdr.write_date = dt.julian_day_number;
      dev->VolHdr.write_time = dt.julian_day_fraction;
   }
   ser_float64(dev->VolHdr.write_date);   /* 0 if VerNum >= 11 */
   ser_float64(dev->VolHdr.write_time);   /* 0  if VerNum >= 11 */

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

   ser_string(dev->VolHdr.HostName);
   ser_string(dev->VolHdr.LabelProg);
   ser_string(dev->VolHdr.ProgVersion);
   ser_string(dev->VolHdr.ProgDate);
   /* ***FIXME*** */
   dev->VolHdr.AlignedVolumeName[0] = 0;
   ser_string(dev->VolHdr.AlignedVolumeName);

   /* This is adata Volume information */
   ser_uint64(dev->VolHdr.FirstData);
   ser_uint32(dev->VolHdr.FileAlignment);
   ser_uint32(dev->VolHdr.PaddingSize);
   /* adata and dedup volumes */
   ser_uint32(dev->VolHdr.BlockSize);

   ser_end(rec->data, SER_LENGTH_Volume_Label);
   if (!adata) {
      bstrncpy(dcr->VolumeName, dev->VolHdr.VolumeName, sizeof(dcr->VolumeName));
   }
   ASSERT2(dcr->VolumeName[0], "Empty Volume name");
   rec->data_len = ser_length(rec->data);
   rec->FileIndex = dev->VolHdr.LabelType;
   Dmsg2(100, "LabelType=%d adata=%d\n", dev->VolHdr.LabelType, dev->adata);
   rec->VolSessionId = jcr->VolSessionId;
   rec->VolSessionTime = jcr->VolSessionTime;
   rec->Stream = jcr->NumWriteVolumes;
   rec->maskedStream = jcr->NumWriteVolumes;
   Dmsg3(100, "Created adata=%d Vol label rec: FI=%s len=%d\n", adata, FI_to_ascii(buf, rec->FileIndex),
      rec->data_len);
   Dmsg2(100, "reclen=%d recdata=%s", rec->data_len, rec->data);
   Leave(100);
}
/*
 *  create_volume_label_record
 *   Note: it is assumed that you have created the volume_header
 *     (label) prior to calling this subroutine.
 *   Serialize label (from dev->VolHdr structure) into device record.
 *   Assumes that the dev->VolHdr structure is properly
 *   initialized.
*/
create_volume_label_record
Note: it is assumed that you have created the volume_header
(label) prior to calling this subroutine.
Serialize label (from dev->VolHdr structure) into device record.
Assumes that the dev->VolHdr structure is properly
initialized.
create_volume_label_record Note : it is assumed that you have created the volume_header ( label ) prior to calling this subroutine . Serialize label ( from dev - > VolHdr structure ) into device record . Assumes that the dev - > VolHdr structure is properly initialized .
static void create_volume_label_record(DCR *dcr, DEVICE *dev,
     DEV_RECORD *rec, bool adata)
{
   ser_declare;
   struct date_time dt;
   JCR *jcr = dcr->jcr;
   char buf[100];
   Enter(100);
   rec->data = check_pool_memory_size(rec->data, SER_LENGTH_Volume_Label);
   memset(rec->data, 0, SER_LENGTH_Volume_Label);
   ser_begin(rec->data, SER_LENGTH_Volume_Label);
   ser_string(dev->VolHdr.Id);
   ser_uint32(dev->VolHdr.VerNum);
   if (dev->VolHdr.VerNum >= 11) {
      ser_btime(dev->VolHdr.label_btime);
      dev->VolHdr.write_btime = get_current_btime();
      ser_btime(dev->VolHdr.write_btime);
      dev->VolHdr.write_date = 0;
      dev->VolHdr.write_time = 0;
   } else {
      ser_float64(dev->VolHdr.label_date);
      ser_float64(dev->VolHdr.label_time);
      get_current_time(&dt);
      dev->VolHdr.write_date = dt.julian_day_number;
      dev->VolHdr.write_time = dt.julian_day_fraction;
   }
   ser_float64(dev->VolHdr.write_date);   
   ser_float64(dev->VolHdr.write_time);   
   ser_string(dev->VolHdr.VolumeName);
   ser_string(dev->VolHdr.PrevVolumeName);
   ser_string(dev->VolHdr.PoolName);
   ser_string(dev->VolHdr.PoolType);
   ser_string(dev->VolHdr.MediaType);
   ser_string(dev->VolHdr.HostName);
   ser_string(dev->VolHdr.LabelProg);
   ser_string(dev->VolHdr.ProgVersion);
   ser_string(dev->VolHdr.ProgDate);
   dev->VolHdr.AlignedVolumeName[0] = 0;
   ser_string(dev->VolHdr.AlignedVolumeName);
   ser_uint64(dev->VolHdr.FirstData);
   ser_uint32(dev->VolHdr.FileAlignment);
   ser_uint32(dev->VolHdr.PaddingSize);
   ser_uint32(dev->VolHdr.BlockSize);
   ser_end(rec->data, SER_LENGTH_Volume_Label);
   if (!adata) {
      bstrncpy(dcr->VolumeName, dev->VolHdr.VolumeName, sizeof(dcr->VolumeName));
   }
   ASSERT2(dcr->VolumeName[0], "Empty Volume name");
   rec->data_len = ser_length(rec->data);
   rec->FileIndex = dev->VolHdr.LabelType;
   Dmsg2(100, "LabelType=%d adata=%d\n", dev->VolHdr.LabelType, dev->adata);
   rec->VolSessionId = jcr->VolSessionId;
   rec->VolSessionTime = jcr->VolSessionTime;
   rec->Stream = jcr->NumWriteVolumes;
   rec->maskedStream = jcr->NumWriteVolumes;
   Dmsg3(100, "Created adata=%d Vol label rec: FI=%s len=%d\n", adata, FI_to_ascii(buf, rec->FileIndex),
      rec->data_len);
   Dmsg2(100, "reclen=%d recdata=%s", rec->data_len, rec->data);
   Leave(100);
}
static void create_volume_label_record ( DCR * dcr , DEVICE * dev , DEV_RECORD * rec , bool adata ) { ser_declare ; struct date_time dt ; JCR * jcr = dcr -> jcr ; char buf [ 100 ] ; Enter ( 100 ) ; rec -> data = check_pool_memory_size ( rec -> data , SER_LENGTH_Volume_Label ) ; memset ( rec -> data , 0 , SER_LENGTH_Volume_Label ) ; ser_begin ( rec -> data , SER_LENGTH_Volume_Label ) ; ser_string ( dev -> VolHdr . Id ) ; ser_uint32 ( dev -> VolHdr . VerNum ) ; if ( dev -> VolHdr . VerNum >= 11 ) { ser_btime ( dev -> VolHdr . label_btime ) ; dev -> VolHdr . write_btime = get_current_btime ( ) ; ser_btime ( dev -> VolHdr . write_btime ) ; dev -> VolHdr . write_date = 0 ; dev -> VolHdr . write_time = 0 ; } else { ser_float64 ( dev -> VolHdr . label_date ) ; ser_float64 ( dev -> VolHdr . label_time ) ; get_current_time ( & dt ) ; dev -> VolHdr . write_date = dt . julian_day_number ; dev -> VolHdr . write_time = dt . julian_day_fraction ; } ser_float64 ( dev -> VolHdr . write_date ) ; ser_float64 ( dev -> VolHdr . write_time ) ; ser_string ( dev -> VolHdr . VolumeName ) ; ser_string ( dev -> VolHdr . PrevVolumeName ) ; ser_string ( dev -> VolHdr . PoolName ) ; ser_string ( dev -> VolHdr . PoolType ) ; ser_string ( dev -> VolHdr . MediaType ) ; ser_string ( dev -> VolHdr . HostName ) ; ser_string ( dev -> VolHdr . LabelProg ) ; ser_string ( dev -> VolHdr . ProgVersion ) ; ser_string ( dev -> VolHdr . ProgDate ) ; dev -> VolHdr . AlignedVolumeName [ 0 ] = 0 ; ser_string ( dev -> VolHdr . AlignedVolumeName ) ; ser_uint64 ( dev -> VolHdr . FirstData ) ; ser_uint32 ( dev -> VolHdr . FileAlignment ) ; ser_uint32 ( dev -> VolHdr . PaddingSize ) ; ser_uint32 ( dev -> VolHdr . BlockSize ) ; ser_end ( rec -> data , SER_LENGTH_Volume_Label ) ; if ( ! adata ) { bstrncpy ( dcr -> VolumeName , dev -> VolHdr . VolumeName , sizeof ( dcr -> VolumeName ) ) ; } ASSERT2 ( dcr -> VolumeName [ 0 ] , " " ) ; rec -> data_len = ser_length ( rec -> data ) ; rec -> FileIndex = dev -> VolHdr . LabelType ; Dmsg2 ( 100 , " \n " , dev -> VolHdr . LabelType , dev -> adata ) ; rec -> VolSessionId = jcr -> VolSessionId ; rec -> VolSessionTime = jcr -> VolSessionTime ; rec -> Stream = jcr -> NumWriteVolumes ; rec -> maskedStream = jcr -> NumWriteVolumes ; Dmsg3 ( 100 , " \n " , adata , FI_to_ascii ( buf , rec -> FileIndex ) , rec -> data_len ) ; Dmsg2 ( 100 , " " , rec -> data_len , rec -> data ) ; Leave ( 100 ) ; }
create_volume_label_record
   Note: it is assumed that you have created the volume_header
     (label) prior to calling this subroutine.
create_volume_label_record Note : it is assumed that you have created the volume_header ( label ) prior to calling this subroutine .
/* Serialize the label into the device record. */ /* OLD WAY DEPRECATED */ /* 0 if VerNum >= 11 */ /* 0  if VerNum >= 11 */ /* ***FIXME*** */ /* This is adata Volume information */ /* adata and dedup volumes */