aboutgitcodebugslistschat
path: root/tcp_splice.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-08-01 13:36:46 +1000
committerStefano Brivio <sbrivio@redhat.com>2023-08-04 01:17:57 +0200
commit8218d990138b7da8411351488ea06243134ae37b (patch)
tree518c9c6cd5a8915b10d35adf24cc5283f8b9de05 /tcp_splice.c
parent649068a287b2b559f83b6d255c66221991d68327 (diff)
downloadpasst-8218d990138b7da8411351488ea06243134ae37b.tar
passt-8218d990138b7da8411351488ea06243134ae37b.tar.gz
passt-8218d990138b7da8411351488ea06243134ae37b.tar.bz2
passt-8218d990138b7da8411351488ea06243134ae37b.tar.lz
passt-8218d990138b7da8411351488ea06243134ae37b.tar.xz
passt-8218d990138b7da8411351488ea06243134ae37b.tar.zst
passt-8218d990138b7da8411351488ea06243134ae37b.zip
Use C11 anonymous members to make poll refs less verbose to use
union epoll_ref has a deeply nested set of structs and unions to let us subdivide it into the various different fields we want. This means that referencing elements can involve an awkward long string of intermediate fields. Using C11 anonymous structs and unions lets us do this less clumsily. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp_splice.c')
-rw-r--r--tcp_splice.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/tcp_splice.c b/tcp_splice.c
index 71256b0..03e14c1 100644
--- a/tcp_splice.c
+++ b/tcp_splice.c
@@ -173,10 +173,10 @@ static int tcp_splice_epoll_ctl(const struct ctx *c,
struct tcp_splice_conn *conn)
{
int m = conn->c.in_epoll ? EPOLL_CTL_MOD : EPOLL_CTL_ADD;
- union epoll_ref ref_a = { .r.proto = IPPROTO_TCP, .r.s = conn->a,
- .r.p.tcp.tcp.index = CONN_IDX(conn) };
- union epoll_ref ref_b = { .r.proto = IPPROTO_TCP, .r.s = conn->b,
- .r.p.tcp.tcp.index = CONN_IDX(conn) };
+ union epoll_ref ref_a = { .proto = IPPROTO_TCP, .s = conn->a,
+ .tcp.index = CONN_IDX(conn) };
+ union epoll_ref ref_b = { .proto = IPPROTO_TCP, .s = conn->b,
+ .tcp.index = CONN_IDX(conn) };
struct epoll_event ev_a = { .data.u64 = ref_a.u64 };
struct epoll_event ev_b = { .data.u64 = ref_b.u64 };
uint32_t events_a, events_b;
@@ -516,8 +516,7 @@ bool tcp_splice_conn_from_sock(struct ctx *c, union epoll_ref ref,
c->tcp.splice_conn_count++;
conn->a = s;
- if (tcp_splice_new(c, conn, ref.r.p.tcp.tcp.index,
- ref.r.p.tcp.tcp.outbound))
+ if (tcp_splice_new(c, conn, ref.tcp.index, ref.tcp.outbound))
conn_flag(c, conn, CLOSING);
return true;