On Wed, Sep 25, 2013 at 05:02:55PM -0400, Jeff Cody wrote: > +static int vhdx_log_write(BlockDriverState *bs, BDRVVHDXState *s, > + void *data, uint32_t length, uint64_t offset) > +{ > + int ret = 0; > + void *buffer = NULL; > + void *merged_sector = NULL; > + void *data_tmp, *sector_write; > + unsigned int i; > + int sector_offset; > + uint32_t desc_sectors, sectors, total_length; > + uint32_t sectors_written = 0; > + uint32_t aligned_length; > + uint32_t leading_length = 0; > + uint32_t trailing_length = 0; > + uint32_t partial_sectors = 0; > + uint32_t bytes_written = 0; > + uint64_t file_offset; > + VHDXHeader *header; > + VHDXLogEntryHeader new_hdr; > + VHDXLogDescriptor *new_desc = NULL; > + VHDXLogDataSector *data_sector = NULL; > + MSGUID new_guid = { 0 }; > + > + header = s->headers[s->curr_header]; > + > + /* need to have offset read data, and be on 4096 byte boundary */ > + > + if (length > header->log_length) { > + /* no log present. we could create a log here instead of failing */ > + ret = -EINVAL; > + goto exit; > + } > + > + if (guid_eq(header->log_guid, zero_guid)) { > + vhdx_guid_generate(&new_guid); > + vhdx_update_headers(bs, s, false, &new_guid); > + } else { > + /* currently, we require that the log be flushed after > + * every write. */ > + ret = -ENOTSUP;
Missing goto exit?