From: David Miller <davem@davemloft.net>
To: gerrit@erg.abdn.ac.uk
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] [UDP(-Lite)]: consolidate v4 and v6 get|setsockopt code
Date: Mon, 27 Nov 2006 09:31:34 -0800 (PST) [thread overview]
Message-ID: <20061127.093134.45504470.davem@davemloft.net> (raw)
In-Reply-To: <200611271044.34091@strip-the-willow>
From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Date: Mon, 27 Nov 2006 10:44:33 +0000
> [UDP(-Lite)]: consolidate v4 and v6 get|setsockopt code
>
> This is for 2.6.20.
>
> This patch consolidates set/getsockopt code between UDP(-Lite) v4 and 6. The
> justification is that UDP(-Lite) is a transport-layer protocol and therefore
> the socket option code (at least in theory) should be AF-independent.
>
> Furthermore, there is the following code reduplication:
> * do_udp{,v6}_getsockopt is 100% identical between v4 and v6
> * do_udp{,v6}_setsockopt is identical up to the following differerence
> --v4 in contrast to v4 additionally allows the experimental encapsulation
> types UDP_ENCAP_ESPINUDP and UDP_ENCAP_ESPINUDP_NON_IKE
> --the remainder is identical between v4 and v6
> I believe that this difference is of little relevance.
>
> The advantages in not duplicating twice almost completely identical code.
>
> The patch further simplifies the interface of udp{,v6}_push_pending_frames,
> since for the second argument (struct udp_sock *up) it always holds that
> up = udp_sk(sk); where sk is the first function argument.
>
>
> Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Applied, except that I fixed up the extraneous spaces here:
> @@ -1366,7 +1368,8 @@ int udp_setsockopt(struct sock *sk, int
> char __user *optval, int optlen)
> {
> if (level == SOL_UDP || level == SOL_UDPLITE)
> - return do_udp_setsockopt(sk, level, optname, optval, optlen);
> + return udp_lib_setsockopt(sk, level, optname, optval, optlen,
> + udp_push_pending_frames );
> return ip_setsockopt(sk, level, optname, optval, optlen);
> }
>
> @@ -1375,13 +1378,14 @@ int compat_udp_setsockopt(struct sock *s
> char __user *optval, int optlen)
> {
> if (level == SOL_UDP || level == SOL_UDPLITE)
> - return do_udp_setsockopt(sk, level, optname, optval, optlen);
> + return udp_lib_setsockopt(sk, level, optname, optval, optlen,
> + udp_push_pending_frames );
> return compat_ip_setsockopt(sk, level, optname, optval, optlen);
> }
> #endif
and here:
> int udpv6_setsockopt(struct sock *sk, int level, int optname,
> char __user *optval, int optlen)
> {
> if (level == SOL_UDP || level == SOL_UDPLITE)
> - return do_udpv6_setsockopt(sk, level, optname, optval, optlen);
> + return udp_lib_setsockopt(sk, level, optname, optval, optlen,
> + udp_v6_push_pending_frames );
> return ipv6_setsockopt(sk, level, optname, optval, optlen);
> }
>
> @@ -919,58 +860,17 @@ int compat_udpv6_setsockopt(struct sock
> char __user *optval, int optlen)
> {
> if (level == SOL_UDP || level == SOL_UDPLITE)
> - return do_udpv6_setsockopt(sk, level, optname, optval, optlen);
> + return udp_lib_setsockopt(sk, level, optname, optval, optlen,
> + udp_v6_push_pending_frames );
> return compat_ipv6_setsockopt(sk, level, optname, optval, optlen);
> }
> #endif
Specifically, the space between the push_pending_frames final argument
passed and the closing parenthesis was removed. Why did you put
that there? It looks fugly :)
next prev parent reply other threads:[~2006-11-27 17:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-27 10:44 [PATCH] [UDP(-Lite)]: consolidate v4 and v6 get|setsockopt code Gerrit Renker
2006-11-27 17:31 ` David Miller [this message]
2006-11-27 18:12 ` Gerrit Renker
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=20061127.093134.45504470.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=gerrit@erg.abdn.ac.uk \
--cc=netdev@vger.kernel.org \
/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).