Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

snap: use const for descriptor

Protocols should be able to use constant value for the descriptor.
Minor whitespace cleanup as well

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Stephen Hemminger and committed by
David S. Miller
7ca98fa2 65689fef

+8 -4
+5 -1
include/net/psnap.h
··· 1 1 #ifndef _NET_PSNAP_H 2 2 #define _NET_PSNAP_H 3 3 4 - 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)); 4 + extern struct datalink_proto * 5 + register_snap_client(const unsigned char *desc, 6 + int (*rcvfunc)(struct sk_buff *, struct net_device *, 7 + struct packet_type *, 8 + struct net_device *orig_dev)); 5 9 extern void unregister_snap_client(struct datalink_proto *proto); 6 10 7 11 #endif
+3 -3
net/802/psnap.c
··· 29 29 /* 30 30 * Find a snap client by matching the 5 bytes. 31 31 */ 32 - static struct datalink_proto *find_snap_client(unsigned char *desc) 32 + static struct datalink_proto *find_snap_client(const unsigned char *desc) 33 33 { 34 34 struct datalink_proto *proto = NULL, *p; 35 35 ··· 122 122 /* 123 123 * Register SNAP clients. We don't yet use this for IP. 124 124 */ 125 - struct datalink_proto *register_snap_client(unsigned char *desc, 125 + struct datalink_proto *register_snap_client(const unsigned char *desc, 126 126 int (*rcvfunc)(struct sk_buff *, 127 127 struct net_device *, 128 128 struct packet_type *, ··· 137 137 138 138 proto = kmalloc(sizeof(*proto), GFP_ATOMIC); 139 139 if (proto) { 140 - memcpy(proto->type, desc,5); 140 + memcpy(proto->type, desc, 5); 141 141 proto->rcvfunc = rcvfunc; 142 142 proto->header_length = 5 + 3; /* snap + 802.2 */ 143 143 proto->request = snap_request;