summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2018-05-23 18:07:20 +0200
committerJeff Cody <jcody@redhat.com>2018-06-05 10:15:12 -0400
commit03b036cc0ca3362ff1aacd70315f5e53f4234f5c (patch)
tree62bfd0a659349dc7865d2529839cc5ed9ffdfa2b /block
parent41feb5b955f0d7c9d071b2c5adbc404ae2895c7a (diff)
downloadqemu-03b036cc0ca3362ff1aacd70315f5e53f4234f5c.zip
sheepdog: cleanup repeated expression
The expression "SD_INODE_SIZE - sizeof(inode.data_vdi_id)" already has a macro defined for the same value (though with a nicer definition using offsetof). Replace it. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20180523160721.14018-2-pbonzini@redhat.com> Signed-off-by: Jeff Cody <jcody@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/sheepdog.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 2a5bc0a59a..cfc0e28aa5 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -2335,7 +2335,7 @@ static int sd_truncate(BlockDriverState *bs, int64_t offset,
}
/* we don't need to update entire object */
- datalen = SD_INODE_SIZE - sizeof(s->inode.data_vdi_id);
+ datalen = SD_INODE_HEADER_SIZE;
s->inode.vdi_size = offset;
ret = write_object(fd, s->bs, (char *)&s->inode,
vid_to_vdi_oid(s->inode.vdi_id), s->inode.nr_copies,
@@ -2703,7 +2703,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
*/
strncpy(s->inode.tag, sn_info->name, sizeof(s->inode.tag));
/* we don't need to update entire object */
- datalen = SD_INODE_SIZE - sizeof(s->inode.data_vdi_id);
+ datalen = SD_INODE_HEADER_SIZE;
inode = g_malloc(datalen);
/* refresh inode. */
@@ -2989,7 +2989,7 @@ static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab)
/* we don't need to read entire object */
ret = read_object(fd, s->bs, (char *)&inode,
vid_to_vdi_oid(vid),
- 0, SD_INODE_SIZE - sizeof(inode.data_vdi_id), 0,
+ 0, SD_INODE_HEADER_SIZE, 0,
s->cache_flags);
if (ret) {