Thread: [Netadm-devel] gwc/pf Makefile,1.1.1.1,1.2 pf.c,1.3,1.4 pf.h,1.2,1.3 sysioctl.h,1.2,1.3
Status: Beta
Brought to you by:
linuxpark
From: linuxpark <lin...@us...> - 2006-02-28 00:49:57
|
Update of /cvsroot/netadm/gwc/pf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25775 Modified Files: Makefile pf.c pf.h sysioctl.h Log Message: MOD: MOD: replace the code using kernel dynamic timer in pf to our sysktimer ADD: sysktimer in Makefile MOD: renaming macro in sysioctl Index: pf.h =================================================================== RCS file: /cvsroot/netadm/gwc/pf/pf.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pf.h 17 Feb 2006 06:59:00 -0000 1.2 --- pf.h 28 Feb 2006 00:49:54 -0000 1.3 *************** *** 9,25 **** #ident "@(#) $Header$" ! #ifndef __ASRV_PFILTER_H ! #define __ASRV_PFILTER_H #include <linux/udp.h> #include <linux/types.h> #if !defined(PFINFO) ! #define PFINFO "cherokee-pf" #endif #ifndef DEVICE_NAME ! #define DEVICE_NAME "cherokee-pf" #endif #ifndef KUIO_DEVICE_NAME ! #define KUIO_DEVICE_NAME "cherokee-kuio" #endif #define KUIO_MAJOR_NUM 253 --- 9,25 ---- #ident "@(#) $Header$" ! #ifndef __SYS_PF_H ! #define __SYS_PF_H #include <linux/udp.h> #include <linux/types.h> #if !defined(PFINFO) ! #define PFINFO "gwc-pf" #endif #ifndef DEVICE_NAME ! #define DEVICE_NAME "gwc-pf" #endif #ifndef KUIO_DEVICE_NAME ! #define KUIO_DEVICE_NAME "gwc-kuio" #endif #define KUIO_MAJOR_NUM 253 Index: pf.c =================================================================== RCS file: /cvsroot/netadm/gwc/pf/pf.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pf.c 17 Feb 2006 07:31:35 -0000 1.3 --- pf.c 28 Feb 2006 00:49:54 -0000 1.4 *************** *** 43,53 **** #include "pf.h" #include "sysioctl.h" static int debug __initdata = 0; static int kuio_rdopen = 0; static int kuio_wdopen = 0; static struct nf_hook_ops iphook_tab; - static struct timer_list pc_alz; - static void set_timer(void); /* block list hash table */ --- 43,58 ---- #include "pf.h" #include "sysioctl.h" + #include "sysktimer.h" + #include "../include/global.h" + + #define DRIVER_AUTHOR "jeho park <lin...@gm...>" + #define DRIVER_VERSION "gwc-pf-" SZSYSVERSION + #define DRIVER_DESC "pf of gwc in netadm project " DRIVER_VERSION + static pid_t tid; /* timer thread id */ static int debug __initdata = 0; static int kuio_rdopen = 0; static int kuio_wdopen = 0; static struct nf_hook_ops iphook_tab; /* block list hash table */ *************** *** 135,139 **** } ! static void update_pktcnt( unsigned long ptr ){ struct blk *blkh, **blkhp; int i; --- 140,144 ---- } ! static int update_pktcnt( void *arg ){ struct blk *blkh, **blkhp; int i; *************** *** 150,154 **** spin_unlock(&blk_hash_table[i].lock); } ! set_timer(); } --- 155,160 ---- spin_unlock(&blk_hash_table[i].lock); } ! ! return 1; } *************** *** 266,275 **** } ! static void set_timer(void) { ! pc_alz.function = update_pktcnt; ! pc_alz.data = 0; ! pc_alz.expires = jiffies + HZ; ! add_timer(&pc_alz); } --- 272,282 ---- } ! static void init_systimer (struct sys_timer_t * t) { ! t->func = update_pktcnt; /* handler */ ! t->data = NULL; /* param of handler */ ! t->t_time = 0; /* total time endless */ ! t->t.tv_sec = 0; /* sec */ ! t->t.tv_nsec = 1000000000; /* nano sec */ } *************** *** 534,539 **** static int __init ! cherokee_pf_init(void) { printk("%s: Loading %s module ...\n", DEVICE_NAME, DEVICE_NAME); --- 541,548 ---- static int __init ! gwc_pf_init(void) { + static struct sys_timer_t timer; + printk("%s: Loading %s module ...\n", DEVICE_NAME, DEVICE_NAME); *************** *** 544,555 **** init_pf(); init_kuio(); ! init_timer(&pc_alz); ! set_timer(); return 0; } static void __exit ! cherokee_pf_exit(void) { printk("%s: Unloading %s modules...\n", DEVICE_NAME, DEVICE_NAME); exit_pf(); --- 553,575 ---- init_pf(); init_kuio(); ! init_systimer(&timer); ! ! /* TODO : in futer, tid can be pid list for each timer thread */ ! if ( (tid = register_sys_timer( &timer)) < 0 ) { ! printk("%s: Failed to register timer\n", DEVICE_NAME); ! /* FIXME */ ! } return 0; } + module_init(gwc_pf_init); static void __exit ! gwc_pf_exit(void) { + + if ( tid > 0 && unregister_sys_timer(tid) < 0 ) { + printk("%s: Failed to unregister timer\n", DEVICE_NAME); + } + printk("%s: Unloading %s modules...\n", DEVICE_NAME, DEVICE_NAME); exit_pf(); *************** *** 559,570 **** } exit_kuio(); - del_timer(&pc_alz); } - module_init(cherokee_pf_init); - module_exit(cherokee_pf_exit); module_param(debug, int, 0444); MODULE_PARM_DESC(debug, "enable pfilter debug output (default 0 off)"); ! MODULE_LICENSE("Dual BSD/GPL"); ! MODULE_AUTHOR("jeho park <par...@ho...>"); ! MODULE_DESCRIPTION("wibro pf modules"); --- 579,590 ---- } exit_kuio(); } + module_exit(gwc_pf_exit); module_param(debug, int, 0444); MODULE_PARM_DESC(debug, "enable pfilter debug output (default 0 off)"); ! MODULE_AUTHOR(DRIVER_AUTHOR); ! MODULE_DESCRIPTION(DRIVER_DESC); ! MODULE_LICENSE("GPL"); ! MODULE_VERSION(DRIVER_VERSION); ! Index: Makefile =================================================================== RCS file: /cvsroot/netadm/gwc/pf/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile 30 Jan 2006 17:41:25 -0000 1.1.1.1 --- Makefile 28 Feb 2006 00:49:54 -0000 1.2 *************** *** 8,12 **** #ident "@(#) $Header$" ! obj-m := pf.o KDIR := /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) --- 8,13 ---- #ident "@(#) $Header$" ! obj-m += sysktimer.o ! obj-m += pf.o KDIR := /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) Index: sysioctl.h =================================================================== RCS file: /cvsroot/netadm/gwc/pf/sysioctl.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sysioctl.h 17 Feb 2006 06:59:00 -0000 1.2 --- sysioctl.h 28 Feb 2006 00:49:54 -0000 1.3 *************** *** 9,14 **** #ident "@(#) $Header$" ! #ifndef _IOCTLPF_H_ ! #define _IOCTLPF_H_ #define IOCTLPF_MAGIC 't' --- 9,14 ---- #ident "@(#) $Header$" ! #ifndef __SYS_IOCTL_H_ ! #define __SYS_IOCTL_H_ #define IOCTLPF_MAGIC 't' *************** *** 20,27 **** #define IOCTLPF_REGISTER_SRCBLOCK _IO (IOCTLPF_MAGIC, 0) ! #define IOCTLPF_REGISTER_MODSEQ _IO (IOCTLPF_MAGIC, 1) ! #define IOCTLPF_UNREGISTER_HOST _IO (IOCTLPF_MAGIC, 2) ! #define IOCTLPF_REFLESH _IO (IOCTLPF_MAGIC, 3) ! #define IOCTLPF_MAXNR 4 ! #endif /* _IOCTLPF_H_ */ --- 20,27 ---- #define IOCTLPF_REGISTER_SRCBLOCK _IO (IOCTLPF_MAGIC, 0) ! #define IOCTLPF_REGISTER_MODSEQ _IO (IOCTLPF_MAGIC, 1) ! #define IOCTLPF_UNREGISTER_HOST _IO (IOCTLPF_MAGIC, 2) ! #define IOCTLPF_REFLESH _IO (IOCTLPF_MAGIC, 3) ! #define IOCTLPF_MAXNR 4 ! #endif /* __SYS_IOCTL_H_ */ |