From 9146d4479d41eedf34092aa0b1606c1c93d71b6c Mon Sep 17 00:00:00 2001 From: hartkopp Date: Tue, 30 Nov 2010 19:27:36 +0000 Subject: [PATCH] capabilities have been dropped in 2.6.33 http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.33.y.git;a=commitdiff;h=13f18aa05f5abe135f47b6417537ae2b2fedc18c git-svn-id: svn://svn.berlios.de//socketcan/trunk@1221 030b6a49-0b11-0410-94ab-b0dab22257f2 --- kernel/2.6/include/socketcan/can/core.h | 2 ++ kernel/2.6/net/can/af_can.c | 3 ++- kernel/2.6/net/can/bcm.c | 2 ++ kernel/2.6/net/can/isotp.c | 2 ++ kernel/2.6/net/can/raw.c | 17 ++++++++++++++++- 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/kernel/2.6/include/socketcan/can/core.h b/kernel/2.6/include/socketcan/can/core.h index 23ce1c9..b8a17b1 100644 --- a/kernel/2.6/include/socketcan/can/core.h +++ b/kernel/2.6/include/socketcan/can/core.h @@ -41,7 +41,9 @@ struct can_proto { int type; int protocol; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) int capability; +#endif struct proto_ops *ops; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12) struct proto *prot; diff --git a/kernel/2.6/net/can/af_can.c b/kernel/2.6/net/can/af_can.c index 4d8479d..e3f7b3c 100644 --- a/kernel/2.6/net/can/af_can.c +++ b/kernel/2.6/net/can/af_can.c @@ -198,11 +198,12 @@ static int can_create(struct socket *sock, int protocol) goto errout; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) if (cp->capability >= 0 && !capable(cp->capability)) { err = -EPERM; goto errout; } - +#endif sock->ops = cp->ops; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) diff --git a/kernel/2.6/net/can/bcm.c b/kernel/2.6/net/can/bcm.c index 9ffad22..0764968 100644 --- a/kernel/2.6/net/can/bcm.c +++ b/kernel/2.6/net/can/bcm.c @@ -1729,7 +1729,9 @@ static struct proto bcm_proto __read_mostly = { static struct can_proto bcm_can_proto __read_mostly = { .type = SOCK_DGRAM, .protocol = CAN_BCM, +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) .capability = -1, +#endif .ops = &bcm_ops, .prot = &bcm_proto, }; diff --git a/kernel/2.6/net/can/isotp.c b/kernel/2.6/net/can/isotp.c index 6c1f25c..b824984 100644 --- a/kernel/2.6/net/can/isotp.c +++ b/kernel/2.6/net/can/isotp.c @@ -1156,7 +1156,9 @@ static struct proto isotp_proto __read_mostly = { static struct can_proto isotp_can_proto __read_mostly = { .type = SOCK_DGRAM, .protocol = CAN_ISOTP, +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) .capability = -1, +#endif .ops = &isotp_ops, .prot = &isotp_proto, }; diff --git a/kernel/2.6/net/can/raw.c b/kernel/2.6/net/can/raw.c index 4503c3f..440989d 100644 --- a/kernel/2.6/net/can/raw.c +++ b/kernel/2.6/net/can/raw.c @@ -791,7 +791,22 @@ static struct proto_ops raw_ops __read_mostly = { .sendpage = sock_no_sendpage, }; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12) + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) +static struct proto raw_proto __read_mostly = { + .name = "CAN_RAW", + .owner = THIS_MODULE, + .obj_size = sizeof(struct raw_sock), + .init = raw_init, +}; + +static struct can_proto raw_can_proto __read_mostly = { + .type = SOCK_RAW, + .protocol = CAN_RAW, + .ops = &raw_ops, + .prot = &raw_proto, +}; +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12) static struct proto raw_proto __read_mostly = { .name = "CAN_RAW", .owner = THIS_MODULE, -- 2.39.2