public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Francois Romieu <romieu@cogenit.fr>
To: linux-kernel@vger.kernel.org
Cc: khc@pm.waw.pl, davem@redhat.com, torvalds@transmeta.com,
	jgarzik@mandrakesoft.com
Subject: [PATCH] HDLC patch for 2.5.5 (2/3)
Date: Sun, 17 Feb 2002 19:31:10 +0100	[thread overview]
Message-ID: <20020217193110.D14629@se1.cogenit.fr> (raw)

[2/3]:
- conversion of drivers/net/wan/hdlc_xxx.c files.


diff -burpN linux-2.5.5-pre1-kh/drivers/net/wan/hdlc_cisco.c linux-2.5.5-pre1-ma_pomme/drivers/net/wan/hdlc_cisco.c
--- linux-2.5.5-pre1-kh/drivers/net/wan/hdlc_cisco.c	Sun Feb 17 17:39:21 2002
+++ linux-2.5.5-pre1-ma_pomme/drivers/net/wan/hdlc_cisco.c	Sun Feb 17 17:46:49 2002
@@ -247,21 +247,16 @@ static void cisco_close(hdlc_device *hdl
 
 int hdlc_cisco_ioctl(hdlc_device *hdlc, struct ifreq *ifr)
 {
+	cisco_proto *cisco_s = &ifr->ifr_settings->ifs_hdlc.hdlcs_cisco;
 	const size_t size = sizeof(cisco_proto);
 	struct net_device *dev = hdlc_to_dev(hdlc);
 	int result;
 
-	switch (ifr->ifr_settings.type) {
+	switch (ifr->ifr_settings->type) {
 	case IF_GET_PROTO:
-		ifr->ifr_settings.type = IF_PROTO_CISCO;
-		if (ifr->ifr_settings.data_length == 0)
-			return 0; /* return protocol only */
-		if (ifr->ifr_settings.data_length < size)
-			return -ENOMEM;	/* buffer too small */
-		if (copy_to_user(ifr->ifr_settings.data,
-				 &hdlc->state.cisco.settings, size))
+		ifr->ifr_settings->type = IF_PROTO_CISCO;
+		if (copy_to_user(cisco_s, &hdlc->state.cisco.settings, size))
 			return -EFAULT;
-		ifr->ifr_settings.data_length = size;
 		return 0;
 
 	case IF_PROTO_CISCO:
@@ -271,11 +266,7 @@ int hdlc_cisco_ioctl(hdlc_device *hdlc, 
 		if(dev->flags & IFF_UP)
 			return -EBUSY;
 
-		if (ifr->ifr_settings.data_length != size)
-			return -ENOMEM;	/* incorrect data length */
-			
-		if (copy_from_user(&hdlc->state.cisco.settings,
-				   ifr->ifr_settings.data, size))
+		if (copy_from_user(&hdlc->state.cisco.settings, cisco_s, size))
 			return -EFAULT;
 
 		/* FIXME - put sanity checks here */
diff -burpN linux-2.5.5-pre1-kh/drivers/net/wan/hdlc_fr.c linux-2.5.5-pre1-ma_pomme/drivers/net/wan/hdlc_fr.c
--- linux-2.5.5-pre1-kh/drivers/net/wan/hdlc_fr.c	Sun Feb 17 17:39:21 2002
+++ linux-2.5.5-pre1-ma_pomme/drivers/net/wan/hdlc_fr.c	Sun Feb 17 17:46:49 2002
@@ -776,22 +776,17 @@ static void fr_destroy(hdlc_device *hdlc
 
 int hdlc_fr_ioctl(hdlc_device *hdlc, struct ifreq *ifr)
 {
+	fr_proto *fr_s = &ifr->ifr_settings->ifs_hdlc.hdlcs_fr;
 	const size_t size = sizeof(fr_proto);
 	struct net_device *dev = hdlc_to_dev(hdlc);
 	fr_proto_pvc pvc;
 	int result;
 
-	switch (ifr->ifr_settings.type) {
+	switch (ifr->ifr_settings->type) {
 	case IF_GET_PROTO:
-		ifr->ifr_settings.type = IF_PROTO_FR;
-		if (ifr->ifr_settings.data_length == 0)
-			return 0; /* return protocol only */
-		if (ifr->ifr_settings.data_length < size)
-			return -ENOMEM;	/* buffer too small */
-		if (copy_to_user(ifr->ifr_settings.data,
-				 &hdlc->state.fr.settings, size))
+		ifr->ifr_settings->type = IF_PROTO_FR;
+		if (copy_to_user(fr_s, &hdlc->state.fr.settings, size))
 			return -EFAULT;
-		ifr->ifr_settings.data_length = size;
 		return 0;
 
 	case IF_PROTO_FR:
@@ -801,11 +796,7 @@ int hdlc_fr_ioctl(hdlc_device *hdlc, str
 		if(dev->flags & IFF_UP)
 			return -EBUSY;
 
-		if (ifr->ifr_settings.data_length != size)
-			return -ENOMEM;	/* incorrect data length */
-
-		if (copy_from_user(&hdlc->state.fr.settings,
-				   ifr->ifr_settings.data, size))
+		if (copy_from_user(&hdlc->state.fr.settings, fr_s, size))
 			return -EFAULT;
 
 		/* FIXME - put sanity checks here */
@@ -839,12 +830,12 @@ int hdlc_fr_ioctl(hdlc_device *hdlc, str
 		if(!capable(CAP_NET_ADMIN))
 			return -EPERM;
 
-		if (copy_from_user(&pvc, ifr->ifr_settings.data,
+		if (copy_from_user(&pvc, &ifr->ifr_settings->ifs_hdlc.hdlcs_pvc,
 				   sizeof(fr_proto_pvc)))
 			return -EFAULT;
 
 		return fr_pvc(hdlc, pvc.dlci,
-			      ifr->ifr_settings.type == IF_PROTO_FR_ADD_PVC);
+			      ifr->ifr_settings->type == IF_PROTO_FR_ADD_PVC);
 	}
 
 	return -EINVAL;
diff -burpN linux-2.5.5-pre1-kh/drivers/net/wan/hdlc_generic.c linux-2.5.5-pre1-ma_pomme/drivers/net/wan/hdlc_generic.c
--- linux-2.5.5-pre1-kh/drivers/net/wan/hdlc_generic.c	Sun Feb 17 17:44:14 2002
+++ linux-2.5.5-pre1-ma_pomme/drivers/net/wan/hdlc_generic.c	Sun Feb 17 17:46:49 2002
@@ -75,13 +75,13 @@ int hdlc_ioctl(struct net_device *dev, s
 	if (cmd != SIOCWANDEV)
 		return -EINVAL;
 
-	switch(ifr->ifr_settings.type) {
+	switch(ifr->ifr_settings->type) {
 	case IF_PROTO_HDLC:
 	case IF_PROTO_PPP:
 	case IF_PROTO_CISCO:
 	case IF_PROTO_FR:
 	case IF_PROTO_X25:
-		proto = ifr->ifr_settings.type;
+		proto = ifr->ifr_settings->type;
 		break;
 
 	default:
diff -burpN linux-2.5.5-pre1-kh/drivers/net/wan/hdlc_ppp.c linux-2.5.5-pre1-ma_pomme/drivers/net/wan/hdlc_ppp.c
--- linux-2.5.5-pre1-kh/drivers/net/wan/hdlc_ppp.c	Sun Feb 17 17:39:21 2002
+++ linux-2.5.5-pre1-ma_pomme/drivers/net/wan/hdlc_ppp.c	Sun Feb 17 17:46:49 2002
@@ -82,10 +82,9 @@ int hdlc_ppp_ioctl(hdlc_device *hdlc, st
 	struct net_device *dev = hdlc_to_dev(hdlc);
 	int result;
 
-	switch (ifr->ifr_settings.type) {
+	switch (ifr->ifr_settings->type) {
 	case IF_GET_PROTO:
-		ifr->ifr_settings.type = IF_PROTO_PPP;
-		ifr->ifr_settings.data_length = 0;
+		ifr->ifr_settings->type = IF_PROTO_PPP;
 		return 0; /* return protocol only, no settable parameters */
 
 	case IF_PROTO_PPP:
@@ -95,8 +94,7 @@ int hdlc_ppp_ioctl(hdlc_device *hdlc, st
 		if(dev->flags & IFF_UP)
 			return -EBUSY;
 
-		if (ifr->ifr_settings.data_length != 0)
-			return -EINVAL;	/* no settable parameters */
+		/* no settable parameters */
 
 		hdlc_detach(hdlc);
 
diff -burpN linux-2.5.5-pre1-kh/drivers/net/wan/hdlc_raw.c linux-2.5.5-pre1-ma_pomme/drivers/net/wan/hdlc_raw.c
--- linux-2.5.5-pre1-kh/drivers/net/wan/hdlc_raw.c	Sun Feb 17 17:44:14 2002
+++ linux-2.5.5-pre1-ma_pomme/drivers/net/wan/hdlc_raw.c	Sun Feb 17 17:46:49 2002
@@ -37,21 +37,15 @@ static void raw_rx(struct sk_buff *skb)
 
 int hdlc_raw_ioctl(hdlc_device *hdlc, struct ifreq *ifr)
 {
-	const size_t size = sizeof(hdlc_proto);
+	raw_hdlc_proto *raw_s = &ifr->ifr_settings->ifs_hdlc.hdlcs_raw;
+	const size_t size = sizeof(raw_hdlc_proto);
 	struct net_device *dev = hdlc_to_dev(hdlc);
 	int result;
 
-	switch (ifr->ifr_settings.type) {
+	switch (ifr->ifr_settings->type) {
 	case IF_GET_PROTO:
-		ifr->ifr_settings.type = IF_PROTO_HDLC;
-		if (ifr->ifr_settings.data_length == 0)
-			return 0; /* return protocol only */
-		if (ifr->ifr_settings.data_length < size)
-			return -ENOMEM;	/* buffer too small */
-		if (copy_to_user(ifr->ifr_settings.data,
-				 &hdlc->state.raw_hdlc.settings, size))
+		if (copy_to_user(raw_s, &hdlc->state.raw_hdlc.settings, size))
 			return -EFAULT;
-		ifr->ifr_settings.data_length = size;
 		return 0;
 
 	case IF_PROTO_HDLC:
@@ -61,12 +55,9 @@ int hdlc_raw_ioctl(hdlc_device *hdlc, st
 		if(dev->flags & IFF_UP)
 			return -EBUSY;
 
-		if (ifr->ifr_settings.data_length != size)
-			return -ENOMEM;	/* incorrect data length */
-
-		if (copy_from_user(&hdlc->state.raw_hdlc.settings,
-				   ifr->ifr_settings.data, size))
+		if (copy_from_user(&hdlc->state.raw_hdlc.settings, raw_s, size))
 			return -EFAULT;
+
 
 		/* FIXME - put sanity checks here */
 		hdlc_detach(hdlc);
diff -burpN linux-2.5.5-pre1-kh/drivers/net/wan/hdlc_x25.c linux-2.5.5-pre1-ma_pomme/drivers/net/wan/hdlc_x25.c
--- linux-2.5.5-pre1-kh/drivers/net/wan/hdlc_x25.c	Sun Feb 17 17:39:21 2002
+++ linux-2.5.5-pre1-ma_pomme/drivers/net/wan/hdlc_x25.c	Sun Feb 17 17:46:49 2002
@@ -184,10 +184,9 @@ int hdlc_x25_ioctl(hdlc_device *hdlc, st
 	struct net_device *dev = hdlc_to_dev(hdlc);
 	int result;
 
-	switch (ifr->ifr_settings.type) {
+	switch (ifr->ifr_settings->type) {
 	case IF_GET_PROTO:
-		ifr->ifr_settings.type = IF_PROTO_X25;
-		ifr->ifr_settings.data_length = 0;
+		ifr->ifr_settings->type = IF_PROTO_X25;
 		return 0; /* return protocol only, no settable parameters */
 
 	case IF_PROTO_X25:
@@ -196,9 +195,6 @@ int hdlc_x25_ioctl(hdlc_device *hdlc, st
 
 		if(dev->flags & IFF_UP)
 			return -EBUSY;
-
-		if (ifr->ifr_settings.data_length != 0)
-			return -EINVAL;	/* no settable parameters */
 
 		hdlc_detach(hdlc);
 

             reply	other threads:[~2002-02-17 18:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-17 18:31 Francois Romieu [this message]
2002-02-17 23:27 ` [PATCH] HDLC patch for 2.5.5 (2/3) Jeff Garzik

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=20020217193110.D14629@se1.cogenit.fr \
    --to=romieu@cogenit.fr \
    --cc=davem@redhat.com \
    --cc=jgarzik@mandrakesoft.com \
    --cc=khc@pm.waw.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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