commit - 594eb2b827e8318be5d2606ca25abf23d646bc32
commit + de16f13656e735233215439c688a6c68c1fbd97c
blob - 388f31e5487eeced6cadf7ea58850c6973749805
blob + 199c57e576a56e094d18f60d29a3f6c2cab28f5c
--- kamirepl.c
+++ kamirepl.c
}
static void
-handle_9p(const uint8_t *data, size_t len)
+handle_9p(const uint8_t *data, size_t size)
{
- struct np_msg_header hdr;
-
- assert(len >= HEADERSIZE);
+ uint32_t len;
+ uint16_t tag;
+ uint8_t type;
- memcpy(&hdr.len, data, sizeof(hdr.len));
- data += sizeof(hdr.len);
- memcpy(&hdr.type, data, sizeof(hdr.type));
- data += sizeof(hdr.len);
- memcpy(&hdr.tag, data, sizeof(hdr.tag));
- data += sizeof(hdr.tag);
+ assert(size >= HEADERSIZE);
- hdr.len = le32toh(hdr.len);
+ memcpy(&len, data, sizeof(len));
+ data += sizeof(len);
+
+ memcpy(&type, data, sizeof(type));
+ data += sizeof(type);
+
+ memcpy(&tag, data, sizeof(tag));
+ data += sizeof(tag);
+
+ len = le32toh(len);
/* type is one byte long, no endianness issues */
- hdr.tag = le16toh(hdr.tag);
+ tag = le16toh(tag);
clr();
- log_info("type=%"PRIu32"[%s] tag=%d len=%"PRIu32, hdr.tag,
- pp_msg_type(hdr.type), hdr.tag, hdr.len);
+ log_info("type=%"PRIu32"[%s] tag=%d len=%"PRIu32, type,
+ pp_msg_type(type), tag, len);
prompt();
}