src/stored/record_read.c
static void read_data(DEV_BLOCK *block, DEV_RECORD *rec)
{
   char buf1[100], buf2[100];

   Dmsg0(dbgep, "=== rpath 22 read_data\n");
   ASSERT2(!block->adata, "Block is adata. Wrong!");
   /*
    * At this point, we have read the header, now we
    * must transfer as much of the data record as
    * possible taking into account: 1. A partial
    * data record may have previously been transferred,
    * 2. The current block may not contain the whole data
    * record.
    */
   if (rec->remlen >= rec->data_bytes) {
      Dmsg0(dbgep, "=== rpath 23 full record\n");
      /* Got whole record */
      memcpy(rec->data+rec->data_len, block->bufp, rec->data_bytes);
      block->bufp += rec->data_bytes;
      block->binbuf -= rec->data_bytes;
      rec->data_len += rec->data_bytes;
      rec->remainder = 0;
      Dmsg6(190, "Rdata full adata=%d FI=%s SessId=%d Strm=%s len=%d block=%p\n",
         block->adata, FI_to_ascii(buf1, rec->FileIndex), rec->VolSessionId,
         stream_to_ascii(buf2, rec->Stream, rec->FileIndex), rec->data_len,
         block);
   } else {
      Dmsg0(dbgep, "=== rpath 24 partial record\n");
      /* Partial record */
      memcpy(rec->data+rec->data_len, block->bufp, rec->remlen);
      block->bufp += rec->remlen;
      block->binbuf -= rec->remlen;
      rec->data_len += rec->remlen;
      rec->remainder = 1;             /* partial record transferred */
      Dmsg1(read_dbglvl, "read_data: partial xfered=%d\n", rec->data_len);
      rec->state_bits |= (REC_PARTIAL_RECORD | REC_BLOCK_EMPTY);
   }
}
/*
 * We have just read a header, now read the data into the record.
 *  Note, if we do not read the full record, we will return to
 *  read the next header, which will then come back here later
 *  to finish reading the full record.
 */
We have just read a header, now read the data into the record.
Note, if we do not read the full record, we will return to
read the next header, which will then come back here later
to finish reading the full record.
We have just read a header now read the data into the record . Note if we do not read the full record we will return to read the next header which will then come back here later to finish reading the full record .
static void read_data(DEV_BLOCK *block, DEV_RECORD *rec)
{
   char buf1[100], buf2[100];
   Dmsg0(dbgep, "=== rpath 22 read_data\n");
   ASSERT2(!block->adata, "Block is adata. Wrong!");
   if (rec->remlen >= rec->data_bytes) {
      Dmsg0(dbgep, "=== rpath 23 full record\n");
      memcpy(rec->data+rec->data_len, block->bufp, rec->data_bytes);
      block->bufp += rec->data_bytes;
      block->binbuf -= rec->data_bytes;
      rec->data_len += rec->data_bytes;
      rec->remainder = 0;
      Dmsg6(190, "Rdata full adata=%d FI=%s SessId=%d Strm=%s len=%d block=%p\n",
         block->adata, FI_to_ascii(buf1, rec->FileIndex), rec->VolSessionId,
         stream_to_ascii(buf2, rec->Stream, rec->FileIndex), rec->data_len,
         block);
   } else {
      Dmsg0(dbgep, "=== rpath 24 partial record\n");
      memcpy(rec->data+rec->data_len, block->bufp, rec->remlen);
      block->bufp += rec->remlen;
      block->binbuf -= rec->remlen;
      rec->data_len += rec->remlen;
      rec->remainder = 1;             
      Dmsg1(read_dbglvl, "read_data: partial xfered=%d\n", rec->data_len);
      rec->state_bits |= (REC_PARTIAL_RECORD | REC_BLOCK_EMPTY);
   }
}
static void read_data ( DEV_BLOCK * block , DEV_RECORD * rec ) { char buf1 [ 100 ] , buf2 [ 100 ] ; Dmsg0 ( dbgep , " \n " ) ; ASSERT2 ( ! block -> adata , " " ) ; if ( rec -> remlen >= rec -> data_bytes ) { Dmsg0 ( dbgep , " \n " ) ; memcpy ( rec -> data + rec -> data_len , block -> bufp , rec -> data_bytes ) ; block -> bufp += rec -> data_bytes ; block -> binbuf -= rec -> data_bytes ; rec -> data_len += rec -> data_bytes ; rec -> remainder = 0 ; Dmsg6 ( 190 , " \n " , block -> adata , FI_to_ascii ( buf1 , rec -> FileIndex ) , rec -> VolSessionId , stream_to_ascii ( buf2 , rec -> Stream , rec -> FileIndex ) , rec -> data_len , block ) ; } else { Dmsg0 ( dbgep , " \n " ) ; memcpy ( rec -> data + rec -> data_len , block -> bufp , rec -> remlen ) ; block -> bufp += rec -> remlen ; block -> binbuf -= rec -> remlen ; rec -> data_len += rec -> remlen ; rec -> remainder = 1 ; Dmsg1 ( read_dbglvl , " \n " , rec -> data_len ) ; rec -> state_bits |= ( REC_PARTIAL_RECORD | REC_BLOCK_EMPTY ) ; } }
We have just read a header, now read the data into the record.
We have just read a header now read the data into the record .
/*
    * At this point, we have read the header, now we
    * must transfer as much of the data record as
    * possible taking into account: 1. A partial
    * data record may have previously been transferred,
    * 2. The current block may not contain the whole data
    * record.
    */ /* Got whole record */ /* Partial record */ /* partial record transferred */