On Fri, 2015-05-08 at 21:09 -0500, Eric W. Biederman wrote: > In preparation for changing how struct net is refcounted > on kernel sockets pass the knowledge that we are creating > a kernel socket from sock_create_kern through to sk_alloc.
... > > diff --git a/drivers/net/tun.c b/drivers/net/tun.c > index 3262f3e2b8b2..1a1c4f7b3ec5 100644 > --- a/drivers/net/tun.c > +++ b/drivers/net/tun.c > @@ -2148,7 +2148,7 @@ static int tun_chr_open(struct inode *inode, struct > file * file) > DBG1(KERN_INFO, "tunX: tun_chr_open\n"); > > tfile = (struct tun_file *)sk_alloc(net, AF_UNSPEC, GFP_KERNEL, > - &tun_proto); > + &tun_proto, 0); > if (!tfile) > return -ENOMEM; > RCU_INIT_POINTER(tfile->tun, NULL); ... > index 3a4898ec8c67..d8dcf91732b0 100644 > --- a/include/net/sock.h > +++ b/include/net/sock.h > @@ -1514,7 +1514,7 @@ static inline void unlock_sock_fast(struct sock *sk, > bool slow) > > > struct sock *sk_alloc(struct net *net, int family, gfp_t priority, > - struct proto *prot); > + struct proto *prot, int kern); Problem adding lot of parameters to functions, is that 0 (or false) means nothing when we read the code later and we have to go back to sk_alloc() definition to check. Sure, at the time you write the code everything is clear, but in 2 years we wont have the context in our heads. I would use an enumeration to ease code readability maybe. enum sk_alloc_kern { SK_ALLOC_USER, SK_ALLOC_KERN, }; -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html