From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
To: "David S. Miller" <davem@davemloft.net>
Cc: Networking Team <netdev@oss.sgi.com>
Subject: [PATCH] merge udp_opt with udp_sock
Date: Tue, 11 Jan 2005 04:51:17 -0200 [thread overview]
Message-ID: <41E37765.4030105@conectiva.com.br> (raw)
[-- Attachment #1: Type: text/plain, Size: 109 bytes --]
David,
Please consider pulling from:
bk://kernel.bkbits.net/acme/connection_sock-2.6
Regards,
- Arnaldo
[-- Attachment #2: udp.patch --]
[-- Type: text/plain, Size: 5555 bytes --]
===================================================================
ChangeSet@1.2279, 2005-01-11 02:47:15-02:00, acme@conectiva.com.br
[UDP] merge udp_sock with udp_opt
No need for two structs, follow the new inet_sock layout
style.
Signed-off-by: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/ipv6.h | 3 +--
include/linux/udp.h | 22 +++++++++-------------
net/ipv4/udp.c | 16 ++++++++--------
net/ipv6/udp.c | 10 +++++-----
4 files changed, 23 insertions(+), 28 deletions(-)
diff -Nru a/include/linux/ipv6.h b/include/linux/ipv6.h
--- a/include/linux/ipv6.h 2005-01-11 04:45:45 -02:00
+++ b/include/linux/ipv6.h 2005-01-11 04:45:45 -02:00
@@ -262,8 +262,7 @@
};
struct udp6_sock {
- struct inet_sock inet;
- struct udp_opt udp;
+ struct udp_sock udp;
struct ipv6_pinfo inet6;
};
diff -Nru a/include/linux/udp.h b/include/linux/udp.h
--- a/include/linux/udp.h 2005-01-11 04:45:45 -02:00
+++ b/include/linux/udp.h 2005-01-11 04:45:45 -02:00
@@ -40,26 +40,22 @@
#include <net/sock.h>
#include <linux/ip.h>
-struct udp_opt {
- int pending; /* Any pending frames ? */
- unsigned int corkflag; /* Cork is required */
- __u16 encap_type; /* Is this an Encapsulation socket? */
+struct udp_sock {
+ /* inet_sock has to be the first member */
+ struct inet_sock inet;
+ int pending; /* Any pending frames ? */
+ unsigned int corkflag; /* Cork is required */
+ __u16 encap_type; /* Is this an Encapsulation socket? */
/*
* Following member retains the infomation to create a UDP header
* when the socket is uncorked.
*/
- __u16 len; /* total length of pending frames */
-};
-
-/* WARNING: don't change the layout of the members in udp_sock! */
-struct udp_sock {
- struct inet_sock inet;
- struct udp_opt udp;
+ __u16 len; /* total length of pending frames */
};
-static inline struct udp_opt * udp_sk(const struct sock *__sk)
+static inline struct udp_sock *udp_sk(const struct sock *sk)
{
- return &((struct udp_sock *)__sk)->udp;
+ return (struct udp_sock *)sk;
}
#endif
diff -Nru a/net/ipv4/udp.c b/net/ipv4/udp.c
--- a/net/ipv4/udp.c 2005-01-11 04:45:45 -02:00
+++ b/net/ipv4/udp.c 2005-01-11 04:45:45 -02:00
@@ -386,7 +386,7 @@
*/
static void udp_flush_pending_frames(struct sock *sk)
{
- struct udp_opt *up = udp_sk(sk);
+ struct udp_sock *up = udp_sk(sk);
if (up->pending) {
up->len = 0;
@@ -398,7 +398,7 @@
/*
* Push out all pending data as one UDP datagram. Socket is locked.
*/
-static int udp_push_pending_frames(struct sock *sk, struct udp_opt *up)
+static int udp_push_pending_frames(struct sock *sk, struct udp_sock *up)
{
struct inet_sock *inet = inet_sk(sk);
struct flowi *fl = &inet->cork.fl;
@@ -483,7 +483,7 @@
size_t len)
{
struct inet_sock *inet = inet_sk(sk);
- struct udp_opt *up = udp_sk(sk);
+ struct udp_sock *up = udp_sk(sk);
int ulen = len;
struct ipcm_cookie ipc;
struct rtable *rt = NULL;
@@ -672,7 +672,7 @@
static int udp_sendpage(struct sock *sk, struct page *page, int offset,
size_t size, int flags)
{
- struct udp_opt *up = udp_sk(sk);
+ struct udp_sock *up = udp_sk(sk);
int ret;
if (!up->pending) {
@@ -902,7 +902,7 @@
#ifndef CONFIG_XFRM
return 1;
#else
- struct udp_opt *up = udp_sk(sk);
+ struct udp_sock *up = udp_sk(sk);
struct udphdr *uh = skb->h.uh;
struct iphdr *iph;
int iphlen, len;
@@ -988,7 +988,7 @@
*/
static int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
{
- struct udp_opt *up = udp_sk(sk);
+ struct udp_sock *up = udp_sk(sk);
/*
* Charge it to the socket, dropping if the queue is full.
@@ -1223,7 +1223,7 @@
static int udp_setsockopt(struct sock *sk, int level, int optname,
char __user *optval, int optlen)
{
- struct udp_opt *up = udp_sk(sk);
+ struct udp_sock *up = udp_sk(sk);
int val;
int err = 0;
@@ -1272,7 +1272,7 @@
static int udp_getsockopt(struct sock *sk, int level, int optname,
char __user *optval, int __user *optlen)
{
- struct udp_opt *up = udp_sk(sk);
+ struct udp_sock *up = udp_sk(sk);
int val, len;
if (level != SOL_UDP)
diff -Nru a/net/ipv6/udp.c b/net/ipv6/udp.c
--- a/net/ipv6/udp.c 2005-01-11 04:45:45 -02:00
+++ b/net/ipv6/udp.c 2005-01-11 04:45:45 -02:00
@@ -549,7 +549,7 @@
*/
static void udp_v6_flush_pending_frames(struct sock *sk)
{
- struct udp_opt *up = udp_sk(sk);
+ struct udp_sock *up = udp_sk(sk);
if (up->pending) {
up->len = 0;
@@ -562,7 +562,7 @@
* Sending
*/
-static int udp_v6_push_pending_frames(struct sock *sk, struct udp_opt *up)
+static int udp_v6_push_pending_frames(struct sock *sk, struct udp_sock *up)
{
struct sk_buff *skb;
struct udphdr *uh;
@@ -623,7 +623,7 @@
struct msghdr *msg, size_t len)
{
struct ipv6_txoptions opt_space;
- struct udp_opt *up = udp_sk(sk);
+ struct udp_sock *up = udp_sk(sk);
struct inet_sock *inet = inet_sk(sk);
struct ipv6_pinfo *np = inet6_sk(sk);
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) msg->msg_name;
@@ -878,7 +878,7 @@
static int udpv6_setsockopt(struct sock *sk, int level, int optname,
char __user *optval, int optlen)
{
- struct udp_opt *up = udp_sk(sk);
+ struct udp_sock *up = udp_sk(sk);
int val;
int err = 0;
@@ -925,7 +925,7 @@
static int udpv6_getsockopt(struct sock *sk, int level, int optname,
char __user *optval, int __user *optlen)
{
- struct udp_opt *up = udp_sk(sk);
+ struct udp_sock *up = udp_sk(sk);
int val, len;
if (level != SOL_UDP)
next reply other threads:[~2005-01-11 6:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-11 6:51 Arnaldo Carvalho de Melo [this message]
2005-01-14 21:45 ` [PATCH] merge udp_opt with udp_sock David S. Miller
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=41E37765.4030105@conectiva.com.br \
--to=acme@conectiva.com.br \
--cc=davem@davemloft.net \
--cc=netdev@oss.sgi.com \
/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).