Fix sk_alloc function change since 4.2 Linux kernel.

This commit is contained in:
Ricky Zhang 2016-08-12 11:13:31 -04:00
parent 58eb2560c8
commit 212b8237b6
No known key found for this signature in database
GPG Key ID: 681AFAEF6CDEDB4C

View File

@ -23,6 +23,15 @@
#include <linux/version.h>
#include <linux/init.h>
/* wrap up socket object allocation */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 00)
#define compat_sk_alloc(_net, _family, _priority, _proto) \
sk_alloc(_net, _family, _priority, _proto, 0)
#else
#define compat_sk_alloc(_net, _family, _priority, _proto) \
sk_alloc(_net, _family, _priority, _proto)
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
#define LINUX_3_15
#endif
@ -587,7 +596,7 @@ static int sheep_net_ioctl(struct inode *inode, struct file *f, unsigned int cod
/* Allocate socket */
#ifdef LINUX_26
v->skt = sk_alloc(dev_net(v->ether), GFP_USER, 1, &sheep_proto);
v->skt = compat_sk_alloc(dev_net(v->ether), GFP_USER, 1, &sheep_proto);
#else
v->skt = sk_alloc(0, GFP_USER, 1);
#endif