Re: [Qemu-devel] [PATCH v2 5/9] block: vhdx - break endian translation functions out

2013-08-07 Thread Kevin Wolf
Am 01.08.2013 um 05:23 hat Jeff Cody geschrieben:
 This moves the endian translation functions out from the vhdx.c source,
 into a separate source file. In addition to the previously defined
 endian functions, new endian translation functions for log support are
 added as well.
 
 Signed-off-by: Jeff Cody jc...@redhat.com

 +void vhdx_log_entry_hdr_le_import(VHDXLogEntryHeader *hdr)
 +{
 +assert(hdr != NULL);
 +
 +le32_to_cpus(hdr-signature);
 +le32_to_cpus(hdr-checksum);
 +le32_to_cpus(hdr-entry_length);
 +le32_to_cpus(hdr-tail);
 +le64_to_cpus(hdr-sequence_number);
 +le32_to_cpus(hdr-descriptor_count);
 +leguid_to_cpus(hdr-log_guid);
 +le64_to_cpus(hdr-flushed_file_offset);
 +le64_to_cpus(hdr-last_file_offset);
 +}
 +
 +void vhdx_log_entry_hdr_le_export(VHDXLogEntryHeader *hdr)
 +{
 +assert(hdr != NULL);
 +
 +cpu_to_le32s(hdr-signature);
 +cpu_to_le32s(hdr-checksum);
 +cpu_to_le32s(hdr-entry_length);
 +cpu_to_le32s(hdr-tail);
 +cpu_to_le64s(hdr-sequence_number);
 +cpu_to_le32s(hdr-descriptor_count);
 +cpu_to_le64s(hdr-flushed_file_offset);
 +cpu_to_le64s(hdr-last_file_offset);
 +cpu_to_leguids(hdr-log_guid);
 +}

Almost as critical as Stefan's comment: Can you keep the order of fields
consistent between import and export?

Kevin



Re: [Qemu-devel] [PATCH v2 5/9] block: vhdx - break endian translation functions out

2013-08-07 Thread Jeff Cody
On Wed, Aug 07, 2013 at 05:29:04PM +0200, Kevin Wolf wrote:
 Am 01.08.2013 um 05:23 hat Jeff Cody geschrieben:
  This moves the endian translation functions out from the vhdx.c source,
  into a separate source file. In addition to the previously defined
  endian functions, new endian translation functions for log support are
  added as well.
  
  Signed-off-by: Jeff Cody jc...@redhat.com
 
  +void vhdx_log_entry_hdr_le_import(VHDXLogEntryHeader *hdr)
  +{
  +assert(hdr != NULL);
  +
  +le32_to_cpus(hdr-signature);
  +le32_to_cpus(hdr-checksum);
  +le32_to_cpus(hdr-entry_length);
  +le32_to_cpus(hdr-tail);
  +le64_to_cpus(hdr-sequence_number);
  +le32_to_cpus(hdr-descriptor_count);
  +leguid_to_cpus(hdr-log_guid);
  +le64_to_cpus(hdr-flushed_file_offset);
  +le64_to_cpus(hdr-last_file_offset);
  +}
  +
  +void vhdx_log_entry_hdr_le_export(VHDXLogEntryHeader *hdr)
  +{
  +assert(hdr != NULL);
  +
  +cpu_to_le32s(hdr-signature);
  +cpu_to_le32s(hdr-checksum);
  +cpu_to_le32s(hdr-entry_length);
  +cpu_to_le32s(hdr-tail);
  +cpu_to_le64s(hdr-sequence_number);
  +cpu_to_le32s(hdr-descriptor_count);
  +cpu_to_le64s(hdr-flushed_file_offset);
  +cpu_to_le64s(hdr-last_file_offset);
  +cpu_to_leguids(hdr-log_guid);
  +}
 
 Almost as critical as Stefan's comment: Can you keep the order of fields
 consistent between import and export?
 

Absolutely! :)



Re: [Qemu-devel] [PATCH v2 5/9] block: vhdx - break endian translation functions out

2013-08-01 Thread Jeff Cody
On Thu, Aug 01, 2013 at 05:03:39PM +0200, Stefan Hajnoczi wrote:
 On Wed, Jul 31, 2013 at 11:23:50PM -0400, Jeff Cody wrote:
  diff --git a/block/vhdx.h b/block/vhdx.h
  index 2db6615..5e0a1d3 100644
  --- a/block/vhdx.h
  +++ b/block/vhdx.h
  @@ -398,4 +398,17 @@ static inline void cpu_to_leguids(MSGUID *guid)
   cpu_to_le16s(guid-data3);
   }
   
  +void vhdx_header_le_import(VHDXHeader *h);
  +void vhdx_header_le_export(VHDXHeader *orig_h, VHDXHeader *new_h);
  +void vhdx_log_desc_le_import(VHDXLogDescriptor *d);
  +void vhdx_log_desc_le_export(VHDXLogDescriptor *d);
  +void vhdx_log_data_le_export(VHDXLogDataSector *d);
  +void vhdx_log_entry_hdr_le_import(VHDXLogEntryHeader *hdr);
  +void vhdx_log_entry_hdr_le_export(VHDXLogEntryHeader *hdr);
  +
  +
  +
  +
  +
  +
   #endif
 
 You are a generous man when it comes to newlines!

Thanks!










-Jeff



Re: [Qemu-devel] [PATCH v2 5/9] block: vhdx - break endian translation functions out

2013-08-01 Thread Stefan Hajnoczi
On Wed, Jul 31, 2013 at 11:23:50PM -0400, Jeff Cody wrote:
 diff --git a/block/vhdx.h b/block/vhdx.h
 index 2db6615..5e0a1d3 100644
 --- a/block/vhdx.h
 +++ b/block/vhdx.h
 @@ -398,4 +398,17 @@ static inline void cpu_to_leguids(MSGUID *guid)
  cpu_to_le16s(guid-data3);
  }
  
 +void vhdx_header_le_import(VHDXHeader *h);
 +void vhdx_header_le_export(VHDXHeader *orig_h, VHDXHeader *new_h);
 +void vhdx_log_desc_le_import(VHDXLogDescriptor *d);
 +void vhdx_log_desc_le_export(VHDXLogDescriptor *d);
 +void vhdx_log_data_le_export(VHDXLogDataSector *d);
 +void vhdx_log_entry_hdr_le_import(VHDXLogEntryHeader *hdr);
 +void vhdx_log_entry_hdr_le_export(VHDXLogEntryHeader *hdr);
 +
 +
 +
 +
 +
 +
  #endif

You are a generous man when it comes to newlines!