Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13f18aa0 authored by Eric Paris's avatar Eric Paris Committed by David S. Miller
Browse files

net: drop capability from protocol definitions



struct can_proto had a capability field which wasn't ever used.  It is
dropped entirely.

struct inet_protosw had a capability field which can be more clearly
expressed in the code by just checking if sock->type = SOCK_RAW.

Signed-off-by: default avatarEric Paris <eparis@redhat.com>
Acked-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 89794a6f
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -32,14 +32,12 @@
 * struct can_proto - CAN protocol structure
 * @type:       type argument in socket() syscall, e.g. SOCK_DGRAM.
 * @protocol:   protocol number in socket() syscall.
 * @capability: capability needed to open the socket, or -1 for no restriction.
 * @ops:        pointer to struct proto_ops for sock->ops.
 * @prot:       pointer to struct proto structure.
 */
struct can_proto {
	int              type;
	int              protocol;
	int              capability;
	struct proto_ops *ops;
	struct proto     *prot;
};
+0 −4
Original line number Diff line number Diff line
@@ -82,10 +82,6 @@ struct inet_protosw {
	struct proto	 *prot;
	const struct proto_ops *ops;
  
	int              capability; /* Which (if any) capability do
				      * we need to use this socket
				      * interface?
                                      */
	char             no_check;   /* checksum on rcv/xmit/none? */
	unsigned char	 flags;      /* See INET_PROTOSW_* below.  */
};
+0 −5
Original line number Diff line number Diff line
@@ -160,11 +160,6 @@ static int can_create(struct net *net, struct socket *sock, int protocol)
		goto errout;
	}

	if (cp->capability >= 0 && !capable(cp->capability)) {
		err = -EPERM;
		goto errout;
	}

	sock->ops = cp->ops;

	sk = sk_alloc(net, PF_CAN, GFP_KERNEL, cp->prot);
+0 −1
Original line number Diff line number Diff line
@@ -1576,7 +1576,6 @@ static struct proto bcm_proto __read_mostly = {
static struct can_proto bcm_can_proto __read_mostly = {
	.type       = SOCK_DGRAM,
	.protocol   = CAN_BCM,
	.capability = -1,
	.ops        = &bcm_ops,
	.prot       = &bcm_proto,
};
+0 −1
Original line number Diff line number Diff line
@@ -742,7 +742,6 @@ static struct proto raw_proto __read_mostly = {
static struct can_proto raw_can_proto __read_mostly = {
	.type       = SOCK_RAW,
	.protocol   = CAN_RAW,
	.capability = -1,
	.ops        = &raw_ops,
	.prot       = &raw_proto,
};
Loading