|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 1/4] xenguest: Reduce number of parts in write_split_record
From: Frediano Ziglio <frediano.ziglio@xxxxxxxxxx>
Small optimization.
There's no much sense to split the header in 2 pieces, it will
just take more time and space to reassemble them in the final
buffer.
This also avoids truncating combined_length to 32 bit in case of
64 bit machines potentially avoiding following record_length check.
The function become more coherent with following read_record
function.
Signed-off-by: Frediano Ziglio <frediano.ziglio@xxxxxxxxxx>
---
tools/libs/guest/xg_sr_common.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/libs/guest/xg_sr_common.c b/tools/libs/guest/xg_sr_common.c
index 7ccdc3b1f6..86c148c62f 100644
--- a/tools/libs/guest/xg_sr_common.c
+++ b/tools/libs/guest/xg_sr_common.c
@@ -59,11 +59,11 @@ int write_split_record(struct xc_sr_context *ctx, struct
xc_sr_record *rec,
static const char zeroes[(1u << REC_ALIGN_ORDER) - 1] = { 0 };
xc_interface *xch = ctx->xch;
- typeof(rec->length) combined_length = rec->length + sz;
+ size_t combined_length = rec->length + sz;
size_t record_length = ROUNDUP(combined_length, REC_ALIGN_ORDER);
+ struct xc_sr_rhdr rhdr = { rec->type, combined_length };
struct iovec parts[] = {
- { &rec->type, sizeof(rec->type) },
- { &combined_length, sizeof(combined_length) },
+ { &rhdr, sizeof(rhdr) },
{ rec->data, rec->length },
{ buf, sz },
{ (void *)zeroes, record_length - combined_length },
--
2.43.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |