file_operations.에서
글쓴이: quintus / 작성시간: 토, 2004/12/04 - 7:39오후
404 static struct file_operations input_fops = {
405 owner: THIS_MODULE,
406 open: input_open_file,
407 };
위에서 나온 owner: 의 콜론은 언제 쓰이는거죠?
file_operations 구조체중 open 에 해당하는 함수 포인터인 건 짐작이 가는데
C 책 뒤져 보면. goto 문의 label 일 때 쓰이는거 이외에는
콜론의 쓰임새를 찾을 수가 없어서요.
860 struct file_operations {
861 struct module *owner;
862 loff_t (*llseek) (struct file *, loff_t, int);
863 ssize_t (*read) (struct file *, char *, size_t, loff_t *);
864 ssize_t (*write) (struct file *, const char *, size_t, loff_t *);
865 int (*readdir) (struct file *, void *, filldir_t);
866 unsigned int (*poll) (struct file *, struct poll_table_struct *);
867 int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
868 int (*mmap) (struct file *, struct vm_area_struct *);
869 int (*open) (struct inode *, struct file *);
870 int (*flush) (struct file *);
871 int (*release) (struct inode *, struct file *);
872 int (*fsync) (struct file *, struct dentry *, int datasync);
873 int (*fasync) (int, struct file *, int);
874 int (*lock) (struct file *, int, struct file_lock *);
875 ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *);
876 ssize_t (*writev) (struct file *, const struct iovec *, unsigned long, loff_t *);
877 ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
878 unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
879 };
arch/i386/kernel/traps.c 안에 있는
struct desc_struct idt_table[256] __attribute__((__section__(".data.idt"))) = { {0, 0}, };
의 내용을 보고 싶은데 어찌 해야 하는지요?
아래 부분이 그 내용인듯 싶은데, 19번 이상은 어디서 보아야하지요?
966 set_trap_gate(0,÷_error); 967 set_trap_gate(1,&debug); 968 set_intr_gate(2,&nmi); 969 set_system_gate(3,&int3); /* int3-5 can be called from all */ 970 set_system_gate(4,&overflow); 971 set_system_gate(5,&bounds); 972 set_trap_gate(6,&invalid_op); 973 set_trap_gate(7,&device_not_available); 974 set_trap_gate(8,&double_fault); 975 set_trap_gate(9,&coprocessor_segment_overrun); 976 set_trap_gate(10,&invalid_TSS); 977 set_trap_gate(11,&segment_not_present); 978 set_trap_gate(12,&stack_segment); 979 set_trap_gate(13,&general_protection); 980 set_intr_gate(14,&page_fault); 981 set_trap_gate(15,&spurious_interrupt_bug); 982 set_trap_gate(16,&coprocessor_error); 983 set_trap_gate(17,&alignment_check); 984 set_trap_gate(18,&machine_check); 985 set_trap_gate(19,&simd_coprocessor_error); 986 987 set_system_gate(SYSCALL_VECTOR,&system_call); 988 989 /* 990 * default LDT is a single-entry callgate to lcall7 for iBCS 991 * and a callgate to lcall27 for Solaris/x86 binaries 992 */ 993 set_call_gate(&default_ldt[0],lcall7); 994 set_call_gate(&default_ldt[4],lcall27);
Forums:


GCC 의 확장 기능입니다.
404 static struct file_operations input_fops = { 405 owner: THIS_MODULE, 406 open: input_open_file, 407 };GCC 에서 제공하는 기능으로 구조체 멤버 중에서 원하는 값만을 초기화할 때 사용하는 방법입니다.
2.6 커널에서는 아래와 같이 C 언어에서 표준적으로 제공하는 방법을 사용합니다.
573 static struct file_operations input_fops = { 574 .owner = THIS_MODULE, 575 .open = input_open_file, 576 };리눅스에서는 0 부터 31 까지의 예외와 NMI 벡터 중에서 19번 까지만 사용하고 있습니다.
32 번 부터는 하드웨어 인터럽트 (IRQ) 에서 사용하고 있으며
이는 request_irq() 함수를 검색해서 찾아볼 수 있습니다.
Re: file_operations.에서
제가 알기론 어떤 구조체의 값을 바로 지정해서 집어넣는걸 의미합니다.
구조체.멤버변수 = 어쩌구;
이런식이 아니라 선언하면서 바로
멤버변수 : 어쩌구;
이렇게 넣어버린다는 고운 하루되세요.
댓글 달기