public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] HDLC patch for 2.5.5 (2/3)
@ 2002-02-17 18:31 Francois Romieu
  2002-02-17 23:27 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Francois Romieu @ 2002-02-17 18:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: khc, davem, torvalds, jgarzik

[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);
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] HDLC patch for 2.5.5 (2/3)
  2002-02-17 18:31 [PATCH] HDLC patch for 2.5.5 (2/3) Francois Romieu
@ 2002-02-17 23:27 ` Jeff Garzik
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2002-02-17 23:27 UTC (permalink / raw)
  To: Francois Romieu; +Cc: linux-kernel, khc, davem, torvalds

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

I like it.  It shows these changes are having a positive effect...

(presuming my concerns in previous e-mail about binary compatibility are
unfounded)

-- 
Jeff Garzik      | "Why is it that attractive girls like you
Building 1024    |  always seem to have a boyfriend?"
MandrakeSoft     | "Because I'm a nympho that owns a brewery?"
                 |             - BBC TV show "Coupling"

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-02-17 23:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-17 18:31 [PATCH] HDLC patch for 2.5.5 (2/3) Francois Romieu
2002-02-17 23:27 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox