[Howard Spoelstra and Joel Mauras]

Patches to update Linux NetDriver to work with newer kernel versions.
This commit is contained in:
asvitkine 2010-04-08 03:58:26 +00:00
parent 8a0002de43
commit 812db6ed4f
2 changed files with 18 additions and 6 deletions

View File

@ -7,6 +7,7 @@ MP := $(shell test -f $(KERNEL_SOURCE)/Rules.make && echo "o" || echo "ko")
ifeq ($(LV),26)
# Kernel 2.6
KERNEL_DRIVER = $(KERNEL_DIR)/kernel/drivers
obj-m = sheep_net.o
sheep_net.ko: sheep_net.c
@ -26,6 +27,7 @@ LDFLAGS =
LIBS =
## Files
KERNEL_DRIVER = $(KERNEL_DIR)
OBJS = sheep_net.o
## Rules
@ -44,8 +46,8 @@ dev:
mknod /dev/sheep_net c 10 198
install: sheep_net.$(MP)
install -d $(KERNEL_DIR)/misc
install -m 644 sheep_net.$(MP) $(KERNEL_DIR)/misc
install -d $(KERNEL_DRIVER)/misc
install -m 644 sheep_net.$(MP) $(KERNEL_DRIVER)/misc
depmod -a
# DO NOT DELETE

View File

@ -17,6 +17,15 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* modversions.h redefines kernel symbols. Now include other headers */
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/version.h>
/* Compatibility glue */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
#define LINUX_26_30
#else
/* determine whether to use checksummed versions of kernel symbols */
/***
@ -33,10 +42,7 @@
#include <linux/modversions.h>
#endif
/* modversions.h redefines kernel symbols. Now include other headers */
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/version.h>
#endif
#include <linux/types.h>
#include <linux/miscdevice.h>
@ -218,7 +224,9 @@ static int sheep_net_open(struct inode *inode, struct file *f)
if (v == NULL)
return -ENOMEM;
#ifndef LINUX_26_30
lock_kernel();
#endif
memset(v, 0, sizeof(struct SheepVars));
skb_queue_head_init(&v->queue);
init_waitqueue_head(&v->wait);
@ -236,7 +244,9 @@ static int sheep_net_open(struct inode *inode, struct file *f)
#ifndef LINUX_26
MOD_INC_USE_COUNT;
#endif
#ifndef LINUX_26_30
unlock_kernel();
#endif
return 0;
}