snap: use const for descirptor
Subsystems (2)
PATCH 1/2 snap: use const for descirptor
Protocols should be able to use constant value for the descriptor. Minor whitespace cleanup as well
net/802/psnap.c +3 -3
@@ -29,7 +29,7 @@ static struct llc_sap *snap_sap;/* * Find a snap client by matching the 5 bytes. */ -static struct datalink_proto *find_snap_client (unsigned char *desc) +static struct datalink_proto *find_snap_client (const unsigned char *desc) {struct datalink_proto *proto =NULL , *p;
@@ -122,7 +122,7 @@ module_exit(snap_exit);/* * Register SNAP clients. We don't yet use this for IP. */ -struct datalink_proto *register_snap_client(unsigned char *desc, +struct datalink_proto *register_snap_client(const unsigned char *desc, int (*rcvfunc)(struct sk_buff *, struct net_device *, struct packet_type *,
@@ -137,7 +137,7 @@ struct datalink_proto *register_snap_cli proto =kmalloc (sizeof (*proto),GFP_ATOMIC );if (proto) { -memcpy (proto->type, desc,5 ); +memcpy (proto->type, desc,5 ); proto->rcvfunc = rcvfunc; proto->header_length =5 +3 ;/* snap + 802.2 */ proto->request = snap_request;
include/net/psnap.h +5 -1
@@ -1,7 +1,11 @@#ifndef _NET_PSNAP_H#define _NET_PSNAP_H -extern struct datalink_proto *register_snap_client (unsigned char *desc,int (*rcvfunc)(struct sk_buff *,struct net_device *,struct packet_type *,struct net_device *orig_dev)); +extern struct datalink_proto * +register_snap_client (const unsigned char *desc, +int (*rcvfunc)(struct sk_buff *,struct net_device *, +struct packet_type *, +struct net_device *orig_dev));extern void unregister_snap_client (struct datalink_proto *proto);#endif
PATCH 2/2 ipx: use constant for strings and desciptor
Fix compiler warning about non-const format string.
net/ipx/af_ipx.c +6 -6
@@ -1975,15 +1975,15 @@ static struct notifier_block ipx_dev_notextern struct datalink_proto *make_EII_client (void );extern void destroy_EII_client (struct datalink_proto *); -static unsigned char ipx_8022_type =0xE0 ; -static unsigned char ipx_snap_id[5 ] = {0x0 ,0x0 ,0x0 ,0x81 ,0x37 }; -static char ipx_EII_err_msg[]__initdata = +static const unsigned char ipx_8022_type =0xE0 ; +static const unsigned char ipx_snap_id[5 ] = {0x0 ,0x0 ,0x0 ,0x81 ,0x37 }; +static const char ipx_EII_err_msg[]__initconst =KERN_CRIT "IPX: Unable to register with Ethernet II\n" ; -static char ipx_8023_err_msg[]__initdata = +static const char ipx_8023_err_msg[]__initconst =KERN_CRIT "IPX: Unable to register with 802.3\n" ; -static char ipx_llc_err_msg[]__initdata = +static const char ipx_llc_err_msg[]__initconst =KERN_CRIT "IPX: Unable to register with 802.2\n" ; -static char ipx_snap_err_msg[]__initdata = +static const char ipx_snap_err_msg[]__initconst =KERN_CRIT "IPX: Unable to register with SNAP\n" ;static int __init ipx_init (void )
Re: [PATCH 2/2] ipx: use constant for strings and desciptor
Em Fri, Mar 20, 2009 at 08:45:39AM -0700, Stephen Hemminger escreveu:
Quoted 4 lines
Fix compiler warning about non-const format string.
Signed-off-by Stephen Hemminger <[email protected]>
- Arnaldo
Re: [PATCH 2/2] ipx: use constant for strings and desciptor
From: Arnaldo Carvalho de Melo <[email protected]>
Date: Fri, 20 Mar 2009 15:17:23 -0300
Quoted 7 lines
Em Fri, Mar 20, 2009 at 08:45:39AM -0700, Stephen Hemminger escreveu:
Quoted 4 lines
Fix compiler warning about non-const format string.
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
PATCH 2/2 ipx: use constant for strings and desciptor
In reply to Stephen HemmingerFix compiler warning about non-const format string.
net/ipx/af_ipx.c +6 -6
@@ -1975,15 +1975,15 @@ static struct notifier_block ipx_dev_notextern struct datalink_proto *make_EII_client (void );extern void destroy_EII_client (struct datalink_proto *); -static unsigned char ipx_8022_type =0xE0 ; -static unsigned char ipx_snap_id[5 ] = {0x0 ,0x0 ,0x0 ,0x81 ,0x37 }; -static char ipx_EII_err_msg[]__initdata = +static const unsigned char ipx_8022_type =0xE0 ; +static const unsigned char ipx_snap_id[5 ] = {0x0 ,0x0 ,0x0 ,0x81 ,0x37 }; +static const char ipx_EII_err_msg[]__initconst =KERN_CRIT "IPX: Unable to register with Ethernet II\n" ; -static char ipx_8023_err_msg[]__initdata = +static const char ipx_8023_err_msg[]__initconst =KERN_CRIT "IPX: Unable to register with 802.3\n" ; -static char ipx_llc_err_msg[]__initdata = +static const char ipx_llc_err_msg[]__initconst =KERN_CRIT "IPX: Unable to register with 802.2\n" ; -static char ipx_snap_err_msg[]__initdata = +static const char ipx_snap_err_msg[]__initconst =KERN_CRIT "IPX: Unable to register with SNAP\n" ;static int __init ipx_init (void )
Em Fri, Mar 20, 2009 at 08:43:14AM -0700, Stephen Hemminger escreveu:
Quoted 4 lines
Protocols should be able to use constant value for the descriptor. Minor whitespace cleanup as well
Signed-off-by Stephen Hemminger <[email protected]>
Looks ok, thanks
Quoted 44 lines
net/802/psnap.c +3
-3@@ -29,7 +29,7 @@ static struct llc_sap *snap_sap;/* * Find a snap client by matching the 5 bytes. */ -static struct datalink_proto *find_snap_client (unsigned char *desc) +static struct datalink_proto *find_snap_client (const unsigned char *desc) {struct datalink_proto *proto =NULL , *p;@@ -122,7 +122,7 @@ module_exit(snap_exit);/* * Register SNAP clients. We don't yet use this for IP. */ -struct datalink_proto *register_snap_client(unsigned char *desc, +struct datalink_proto *register_snap_client(const unsigned char *desc, int (*rcvfunc)(struct sk_buff *, struct net_device *, struct packet_type *,@@ -137,7 +137,7 @@ struct datalink_proto *register_snap_cli proto =kmalloc (sizeof (*proto),GFP_ATOMIC );if (proto) { -memcpy (proto->type, desc,5 ); +memcpy (proto->type, desc,5 ); proto->rcvfunc = rcvfunc; proto->header_length =5 +3 ;/* snap + 802.2 */ proto->request = snap_request;include/net/psnap.h +5
-1@@ -1,7 +1,11 @@#ifndef _NET_PSNAP_H#define _NET_PSNAP_H -extern struct datalink_proto *register_snap_client (unsigned char *desc,int (*rcvfunc)(struct sk_buff *,struct net_device *,struct packet_type *,struct net_device *orig_dev)); +extern struct datalink_proto * +register_snap_client (const unsigned char *desc, +int (*rcvfunc)(struct sk_buff *,struct net_device *, +struct packet_type *, +struct net_device *orig_dev));extern void unregister_snap_client (struct datalink_proto *proto);#endif
From: Arnaldo Carvalho de Melo <[email protected]>
Date: Fri, 20 Mar 2009 15:16:25 -0300
Quoted 10 lines
Em Fri, Mar 20, 2009 at 08:43:14AM -0700, Stephen Hemminger escreveu:
Quoted 4 lines
Protocols should be able to use constant value for the descriptor. Minor whitespace cleanup as well
Signed-off-by Stephen Hemminger <[email protected]>Looks ok, thanks
Applied.