cfs/src/FsProc_JournalBasic.cc
// assumes that .calcBodySize() has been called and buf has that much space
assumes that .calcBodySize() has been called and buf has that much space
assumes that . calcBodySize () has been called and buf has that much space
size_t JournalEntry::serializeBody(uint8_t *buf) {
  uint64_t *uint64_header_fields = (uint64_t *)buf;
  ustime_serialized = (uint64_t)tap_ustime();
  uint64_header_fields[0] = JBODY_MAGIC;
  uint64_header_fields[1] = ustime_serialized;
  uint64_header_fields[3] = ile_vec.size();
  uint64_header_fields[4] = start_block;
  uint64_header_fields[5] = nblocks;
  uint8_t *ile_buf = (uint8_t *)&(uint64_header_fields[6]);
  for (InodeLogEntry *ile : ile_vec) {
    size_t nbytes = ile->serialize(ile_buf);
    ile_buf += nbytes;
  }
  size_t entry_size = ile_buf - buf;
  uint64_header_fields[2] = (uint64_t)entry_size;
  return entry_size;
}
size_t JournalEntry :: serializeBody ( uint8_t * buf ) { uint64_t * uint64_header_fields = ( uint64_t * ) buf ; ustime_serialized = ( uint64_t ) tap_ustime ( ) ; uint64_header_fields [ 0 ] = JBODY_MAGIC ; uint64_header_fields [ 1 ] = ustime_serialized ; uint64_header_fields [ 3 ] = ile_vec . size ( ) ; uint64_header_fields [ 4 ] = start_block ; uint64_header_fields [ 5 ] = nblocks ; uint8_t * ile_buf = ( uint8_t * ) & ( uint64_header_fields [ 6 ] ) ; for ( InodeLogEntry * ile : ile_vec ) { size_t nbytes = ile -> serialize ( ile_buf ) ; ile_buf += nbytes ; } size_t entry_size = ile_buf - buf ; uint64_header_fields [ 2 ] = ( uint64_t ) entry_size ; return entry_size ; }
assumes that .calcBodySize() has been called and buf has that much space
assumes that . calcBodySize () has been called and buf has that much space
// uint64_header_fields[2] is for the size of this journal entry