From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Riku Voipio" <riku.voipio@iki.fi>,
"Laurent Vivier" <laurent@vivier.eu>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [Qemu-devel] [RFC PATCH v7 9/9] linux-user/syscall: Align target_sockaddr fields using ABI types
Date: Sun, 15 Sep 2019 23:39:24 +0200 [thread overview]
Message-ID: <20190915213924.22223-10-f4bug@amsat.org> (raw)
In-Reply-To: <20190915213924.22223-1-f4bug@amsat.org>
Target architectures align types differently for instance
m68k aligns on 16bit whereas others on 32bit).
Use ABI types to keep alignments good.
Suggested-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
RFC: Is target_sockaddr_ll.sll_ifindex of type abi_int?
linux-user/syscall_defs.h | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 7694d72446..852d4498e0 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -134,22 +134,22 @@
#define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
struct target_sockaddr {
- uint16_t sa_family;
+ abi_ushort sa_family;
uint8_t sa_data[14];
};
struct target_sockaddr_ll {
- uint16_t sll_family; /* Always AF_PACKET */
- uint16_t sll_protocol; /* Physical layer protocol */
- int sll_ifindex; /* Interface number */
- uint16_t sll_hatype; /* ARP hardware type */
- uint8_t sll_pkttype; /* Packet type */
- uint8_t sll_halen; /* Length of address */
- uint8_t sll_addr[8]; /* Physical layer address */
+ abi_ushort sll_family; /* Always AF_PACKET */
+ abi_ushort sll_protocol; /* Physical layer protocol */
+ int sll_ifindex; /* Interface number */
+ abi_ushort sll_hatype; /* ARP hardware type */
+ uint8_t sll_pkttype; /* Packet type */
+ uint8_t sll_halen; /* Length of address */
+ uint8_t sll_addr[8]; /* Physical layer address */
};
struct target_sockaddr_un {
- uint16_t su_family;
+ abi_ushort su_family;
uint8_t sun_path[108];
};
@@ -161,24 +161,24 @@ struct target_sockaddr_nl {
};
struct target_in_addr {
- uint32_t s_addr; /* big endian */
+ abi_uint s_addr; /* big endian */
};
struct target_sockaddr_in {
- uint16_t sin_family;
- int16_t sin_port; /* big endian */
+ abi_ushort sin_family;
+ abi_short sin_port; /* big endian */
struct target_in_addr sin_addr;
uint8_t __pad[sizeof(struct target_sockaddr) -
- sizeof(uint16_t) - sizeof(int16_t) -
+ sizeof(abi_ushort) - sizeof(abi_short) -
sizeof(struct target_in_addr)];
};
struct target_sockaddr_in6 {
- uint16_t sin6_family;
- uint16_t sin6_port; /* big endian */
- uint32_t sin6_flowinfo; /* big endian */
+ abi_ushort sin6_family;
+ abi_ushort sin6_port; /* big endian */
+ abi_uint sin6_flowinfo; /* big endian */
struct in6_addr sin6_addr; /* IPv6 address, big endian */
- uint32_t sin6_scope_id;
+ abi_uint sin6_scope_id;
};
struct target_sock_filter {
--
2.20.1
next prev parent reply other threads:[~2019-09-15 21:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-15 21:39 [Qemu-devel] [PATCH v7 0/9] linux-user: strace improvements Philippe Mathieu-Daudé
2019-09-15 21:39 ` [Qemu-devel] [PATCH v7 3/9] linux-user/strace: Improve settimeofday() Philippe Mathieu-Daudé
2019-09-15 21:39 ` [Qemu-devel] [PATCH v7 4/9] linux-user/syscall: Introduce target_sockaddr_nl Philippe Mathieu-Daudé
2019-10-21 9:42 ` Laurent Vivier
2019-09-15 21:39 ` [Qemu-devel] [PATCH v7 6/9] linux-user/strace: Add print_sockfd() Philippe Mathieu-Daudé
2019-10-21 9:51 ` Laurent Vivier
2019-09-15 21:39 ` [Qemu-devel] [PATCH v7 8/9] linux-user/strace: Let print_sockaddr() have a 'last' argument Philippe Mathieu-Daudé
2019-10-21 9:56 ` Laurent Vivier
2019-09-15 21:39 ` Philippe Mathieu-Daudé [this message]
2019-10-21 9:59 ` [RFC PATCH v7 9/9] linux-user/syscall: Align target_sockaddr fields using ABI types Laurent Vivier
2019-09-30 15:44 ` [PATCH v7 0/9] linux-user: strace improvements Philippe Mathieu-Daudé
2019-10-17 12:48 ` Philippe Mathieu-Daudé
[not found] ` <20190915213924.22223-2-f4bug@amsat.org>
2019-10-21 9:38 ` [PATCH v7 1/9] linux-user/strace: Display invalid pointer in print_timeval() Laurent Vivier
[not found] ` <20190915213924.22223-3-f4bug@amsat.org>
2019-10-21 9:40 ` [PATCH v7 2/9] linux-user/strace: Add print_timezone() Laurent Vivier
[not found] ` <20190915213924.22223-6-f4bug@amsat.org>
2019-10-21 9:48 ` [PATCH v7 5/9] linux-user/strace: Dump AF_NETLINK sockaddr content Laurent Vivier
[not found] ` <20190915213924.22223-8-f4bug@amsat.org>
2019-10-21 9:53 ` [PATCH v7 7/9] linux-user/strace: Improve bind() output Laurent Vivier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190915213924.22223-10-f4bug@amsat.org \
--to=f4bug@amsat.org \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).