Device Driver Program's file operations error
Hi all,
now i m trying to writea simple device driver program.. in my first sample program, i m getting the following error.... error: variable `fo' has initializer but incomplete type error: storage size of `fo' isn't known plz anyone help me to solve this pbm this is the pgm =========== #define MODULE #include <linux/kernel.h> #include <linux/module.h> #include <linux/fs.h> int dopen(struct inode * inode,struct file *file) { printk("dopen\n"); return 0; } struct file_operations fo={0,0,0,0,0,0,0,dopen,0,0}; int init_module() { printk("init_module\n"); register_chrdev(251,"cde1",&fo); return 0; } void cleanup_module() { printk("cleanup_module\n"); unregister_chrdev(251,"cde1"); } |
Quote:
Wish you all the best. |
sorry i searched for it and found the defination of this structure in linux/fs.h and you have include that file. Now from my point of view there can be one of two problems.
1. You are giving and extra aurgument to the structure, means check for the number of the memebers of the structure and the number of the members you have initialized, are they same. Also try to give some other aurgument instead of 0's, Any dummy augument just to check, Coz while searching it, I read somwhere on search results by google that maybe you have assigned NULL to all the members, this can cause this error too. 2. open the file linux/fs.h and check for that structure and see the member list and order again. Wish you all the best |
Thank u for ur inormation...
But that structure is available in the <linux/fs.h> i checked the spelling also ... no pbm on that..... |
you need to #define __KERNEL__ before including any headers, or else the many kernel structure and defines won't be included.
|
Thanks a lot....
error is fixed after including the #define __KERNEL__ before including any header files.... |
All times are GMT -5. The time now is 12:28 AM. |