xt_mp2t: reduce redundant union/struct encapsulation

The unnamed union does not serve any purpose (there is just one union
member anyway), and the struct is also not referred to (e.g. address
taken), so just flatten the outer struct entirely.
This commit is contained in:
Jan Engelhardt
2010-11-04 00:57:49 +01:00
parent 4c986d8355
commit 23cae38513

View File

@@ -251,12 +251,8 @@ struct pid_data_t {
/* Data to match a stream / connection */ /* Data to match a stream / connection */
struct mp2t_stream_match { /* Like xt_hashlimit: dsthash_dst */ struct mp2t_stream_match { /* Like xt_hashlimit: dsthash_dst */
union { __be32 dst_addr; /* MC addr first */
struct { __be32 src_addr;
__be32 dst; /* MC addr first */
__be32 src;
} ip;
};
__be16 dst_port; __be16 dst_port;
__be16 src_port; __be16 src_port;
}; };
@@ -966,8 +962,8 @@ dissect_mp2t(unsigned char *payload_ptr, u16 payload_len,
/* Fill in the match struct */ /* Fill in the match struct */
memset(&match, 0, sizeof(match)); /* Worried about struct padding */ memset(&match, 0, sizeof(match)); /* Worried about struct padding */
match.ip.src = iph->saddr; match.src_addr = iph->saddr;
match.ip.dst = iph->daddr; match.dst_addr = iph->daddr;
match.src_port = uh->source; match.src_port = uh->source;
match.dst_port = uh->dest; match.dst_port = uh->dest;
@@ -1243,8 +1239,8 @@ static int mp2t_seq_show_real(struct mp2t_stream *stream, struct seq_file *s,
res = seq_printf(s, "bucket:%d dst:%pI4 src:%pI4 dport:%u sport:%u " res = seq_printf(s, "bucket:%d dst:%pI4 src:%pI4 dport:%u sport:%u "
"pids:%d skips:%llu discontinuity:%llu\n", "pids:%d skips:%llu discontinuity:%llu\n",
bucket, bucket,
&stream->match.ip.dst, &stream->match.dst_addr,
&stream->match.ip.src, &stream->match.src_addr,
ntohs(stream->match.dst_port), ntohs(stream->match.dst_port),
ntohs(stream->match.src_port), ntohs(stream->match.src_port),
stream->pid_list_len, stream->pid_list_len,