src/stored/parse_bsr.c
void create_restore_volume_list(JCR *jcr, bool add_to_read_list)
{
   char *p, *n;
   VOL_LIST *vol;

   /*
    * Build a list of volumes to be processed
    */
   jcr->NumReadVolumes = 0;
   jcr->CurReadVolume = 0;
   if (jcr->bsr) {
      BSR *bsr = jcr->bsr;
      if (!bsr->volume || !bsr->volume->VolumeName[0]) {
         return;
      }
      for ( ; bsr; bsr=bsr->next) {
         BSR_VOLUME *bsrvol;
         BSR_VOLFILE *volfile;
         uint32_t sfile = UINT32_MAX;

         /* Find minimum start file so that we can forward space to it */
         for (volfile = bsr->volfile; volfile; volfile=volfile->next) {
            if (volfile->sfile < sfile) {
               sfile = volfile->sfile;
            }
         }
         /* Now add volumes for this bsr */
         for (bsrvol = bsr->volume; bsrvol; bsrvol=bsrvol->next) {
            vol = new_restore_volume();
            bstrncpy(vol->VolumeName, bsrvol->VolumeName, sizeof(vol->VolumeName));
            bstrncpy(vol->MediaType,  bsrvol->MediaType,  sizeof(vol->MediaType));
            bstrncpy(vol->device, bsrvol->device, sizeof(vol->device));
            vol->Slot = bsrvol->Slot;
            vol->start_file = sfile;
            if (add_restore_volume(jcr, vol, add_to_read_list)) {
               jcr->NumReadVolumes++;
               Dmsg2(400, "Added volume=%s mediatype=%s\n", vol->VolumeName,
                  vol->MediaType);
            } else {
               Dmsg1(400, "Duplicate volume %s\n", vol->VolumeName);
               free((char *)vol);
            }
            sfile = 0;                /* start at beginning of second volume */
         }
      }
   } else {
      /* This is the old way -- deprecated */
      for (p = jcr->dcr->VolumeName; p && *p; ) {
         n = strchr(p, '|');             /* volume name separator */
         if (n) {
            *n++ = 0;                    /* Terminate name */
         }
         vol = new_restore_volume();
         bstrncpy(vol->VolumeName, p, sizeof(vol->VolumeName));
         bstrncpy(vol->MediaType, jcr->dcr->media_type, sizeof(vol->MediaType));
         if (add_restore_volume(jcr, vol, add_to_read_list)) {
            jcr->NumReadVolumes++;
         } else {
            free((char *)vol);
         }
         p = n;
      }
   }
}
/*
 * Create a list of Volumes (and Slots and Start positions) to be
 *  used in the current restore job.
 */
Create a list of Volumes (and Slots and Start positions) to be
used in the current restore job.
Create a list of Volumes ( and Slots and Start positions ) to be used in the current restore job .
void create_restore_volume_list(JCR *jcr, bool add_to_read_list)
{
   char *p, *n;
   VOL_LIST *vol;
   jcr->NumReadVolumes = 0;
   jcr->CurReadVolume = 0;
   if (jcr->bsr) {
      BSR *bsr = jcr->bsr;
      if (!bsr->volume || !bsr->volume->VolumeName[0]) {
         return;
      }
      for ( ; bsr; bsr=bsr->next) {
         BSR_VOLUME *bsrvol;
         BSR_VOLFILE *volfile;
         uint32_t sfile = UINT32_MAX;
         for (volfile = bsr->volfile; volfile; volfile=volfile->next) {
            if (volfile->sfile < sfile) {
               sfile = volfile->sfile;
            }
         }
         for (bsrvol = bsr->volume; bsrvol; bsrvol=bsrvol->next) {
            vol = new_restore_volume();
            bstrncpy(vol->VolumeName, bsrvol->VolumeName, sizeof(vol->VolumeName));
            bstrncpy(vol->MediaType,  bsrvol->MediaType,  sizeof(vol->MediaType));
            bstrncpy(vol->device, bsrvol->device, sizeof(vol->device));
            vol->Slot = bsrvol->Slot;
            vol->start_file = sfile;
            if (add_restore_volume(jcr, vol, add_to_read_list)) {
               jcr->NumReadVolumes++;
               Dmsg2(400, "Added volume=%s mediatype=%s\n", vol->VolumeName,
                  vol->MediaType);
            } else {
               Dmsg1(400, "Duplicate volume %s\n", vol->VolumeName);
               free((char *)vol);
            }
            sfile = 0;                
         }
      }
   } else {
      for (p = jcr->dcr->VolumeName; p && *p; ) {
         n = strchr(p, '|');             
         if (n) {
            *n++ = 0;                    
         }
         vol = new_restore_volume();
         bstrncpy(vol->VolumeName, p, sizeof(vol->VolumeName));
         bstrncpy(vol->MediaType, jcr->dcr->media_type, sizeof(vol->MediaType));
         if (add_restore_volume(jcr, vol, add_to_read_list)) {
            jcr->NumReadVolumes++;
         } else {
            free((char *)vol);
         }
         p = n;
      }
   }
}
void create_restore_volume_list ( JCR * jcr , bool add_to_read_list ) { char * p , * n ; VOL_LIST * vol ; jcr -> NumReadVolumes = 0 ; jcr -> CurReadVolume = 0 ; if ( jcr -> bsr ) { BSR * bsr = jcr -> bsr ; if ( ! bsr -> volume || ! bsr -> volume -> VolumeName [ 0 ] ) { return ; } for ( ; bsr ; bsr = bsr -> next ) { BSR_VOLUME * bsrvol ; BSR_VOLFILE * volfile ; uint32_t sfile = UINT32_MAX ; for ( volfile = bsr -> volfile ; volfile ; volfile = volfile -> next ) { if ( volfile -> sfile < sfile ) { sfile = volfile -> sfile ; } } for ( bsrvol = bsr -> volume ; bsrvol ; bsrvol = bsrvol -> next ) { vol = new_restore_volume ( ) ; bstrncpy ( vol -> VolumeName , bsrvol -> VolumeName , sizeof ( vol -> VolumeName ) ) ; bstrncpy ( vol -> MediaType , bsrvol -> MediaType , sizeof ( vol -> MediaType ) ) ; bstrncpy ( vol -> device , bsrvol -> device , sizeof ( vol -> device ) ) ; vol -> Slot = bsrvol -> Slot ; vol -> start_file = sfile ; if ( add_restore_volume ( jcr , vol , add_to_read_list ) ) { jcr -> NumReadVolumes ++ ; Dmsg2 ( 400 , " \n " , vol -> VolumeName , vol -> MediaType ) ; } else { Dmsg1 ( 400 , " \n " , vol -> VolumeName ) ; free ( ( char * ) vol ) ; } sfile = 0 ; } } } else { for ( p = jcr -> dcr -> VolumeName ; p && * p ; ) { n = strchr ( p , ' ' ) ; if ( n ) { * n ++ = 0 ; } vol = new_restore_volume ( ) ; bstrncpy ( vol -> VolumeName , p , sizeof ( vol -> VolumeName ) ) ; bstrncpy ( vol -> MediaType , jcr -> dcr -> media_type , sizeof ( vol -> MediaType ) ) ; if ( add_restore_volume ( jcr , vol , add_to_read_list ) ) { jcr -> NumReadVolumes ++ ; } else { free ( ( char * ) vol ) ; } p = n ; } } }
Create a list of Volumes (and Slots and Start positions) to be
  used in the current restore job.
Create a list of Volumes ( and Slots and Start positions ) to be used in the current restore job .
/*
    * Build a list of volumes to be processed
    */ /* Find minimum start file so that we can forward space to it */ /* Now add volumes for this bsr */ /* start at beginning of second volume */ /* This is the old way -- deprecated */ /* volume name separator */ /* Terminate name */