도움 부탁드립니다. 2.6에서 모듈 프로그래밍.
글쓴이: raison799 / 작성시간: 목, 2005/05/12 - 12:46오전
안녕하세요..
이곳 저곳에서 자료 찾아, 공부해서 작성한 패킷 캡처 프로그램입니다.
2.4에서는 돌아갔는데... 2.6에서는 컴파일 에러가 발생하네요..
#include <linux/module.h> #include <linux/version.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/skbuff.h> #include <linux/in.h> #include <linux/netdevice.h> #define TEST_PROTO_ID ETH_P_IP int test_pack_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt); int init_module(void); void cleanup_module(void); static struct packet_type test_protocol = { __constant_htons(TEST_PROTO_ID), NULL, test_pack_rcv, (void *) 1, NULL }; int test_pack_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt) { printk(KERN_ALERT "Test protocol : Packet Received with length : %u\n", skb->len); printk(KERN_ALERT "headroom size : %d\n", (skb->data - skb->head)); return skb->len; } int init_module(void) { printk(KERN_ALERT "Module start!!\n"); dev_add_pack(&test_protocol); return 0; } void cleanup_module(void) { dev_remove_pack(&test_protocol); }
In file included from /lib/modules/2.6.11.8/build/include/linux/irq.h:21, from /lib/modules/2.6.11.8/build/include/asm/hardirq.h:6, from /lib/modules/2.6.11.8/build/include/linux/hardirq.h:6, from /lib/modules/2.6.11.8/build/include/linux/interrupt.h:11, from /lib/modules/2.6.11.8/build/include/asm/highmem.h:24, from /lib/modules/2.6.11.8/build/include/linux/highmem.h:12, from /lib/modules/2.6.11.8/build/include/linux/skbuff.h:27, from project.c:12: /lib/modules/2.6.11.8/build/include/asm/irq.h:16:25: irq_vectors.h: 그런 파일이나 디렉토리가 없음 In file included from /lib/modules/2.6.11.8/build/include/asm/hardirq.h:6, from /lib/modules/2.6.11.8/build/include/linux/hardirq.h:6, from /lib/modules/2.6.11.8/build/include/linux/interrupt.h:11, from /lib/modules/2.6.11.8/build/include/asm/highmem.h:24, from /lib/modules/2.6.11.8/build/include/linux/highmem.h:12, from /lib/modules/2.6.11.8/build/include/linux/skbuff.h:27, from project.c:12: /lib/modules/2.6.11.8/build/include/linux/irq.h:72: error: `NR_IRQS' undeclared here (not in a function) In file included from /lib/modules/2.6.11.8/build/include/linux/irq.h:74, from /lib/modules/2.6.11.8/build/include/asm/hardirq.h:6, from /lib/modules/2.6.11.8/build/include/linux/hardirq.h:6, from /lib/modules/2.6.11.8/build/include/linux/interrupt.h:11, from /lib/modules/2.6.11.8/build/include/asm/highmem.h:24, from /lib/modules/2.6.11.8/build/include/linux/highmem.h:12, from /lib/modules/2.6.11.8/build/include/linux/skbuff.h:27, from project.c:12: /lib/modules/2.6.11.8/build/include/asm/hw_irq.h:28: error: `NR_IRQ_VECTORS' undeclared here (not in a function)
에러를 발생하는 파일(irq.h)를 열어보았더니, irq_vectors.h라는 파일을
include하는데.. 이 파일의 정체를 알수가 없네요..
도움 부탁드립니다..
Forums:
NR_IRQS나 NR_IRQ_VECTORS 는 irq_vector
NR_IRQS나 NR_IRQ_VECTORS 는
irq_vectors_limits.h 에 선언되어 있군요.
혹시 arch에 따른 header file의 link가 아직 안 만들어져 있는것 아닌가요?
그나저나 저 루틴을 이용한 패킷 캡처 모듈을
다른곳 참조하지 않고 그냥 소스 보다가 문득 생각났는데요 ...
그땐 그게 어찌나 기쁘던지...
내가 발견 했어!하고 생각했었는데 일반적으로 사용되는군요 :)
^^*
댓글 달기