device driver
when i declare a file_operations structure i get many errors
here is the struct struct file_operations test_fops = { .read = test_read, .write = test_write, .open = test_open, .release = test_release }; some errors: variable `test_fops` has initializer but incomplete type unknown field read in initializer unknown field write in initializer i have include the <linux.fs.h> header file any help would be great thanks |
file_operations is a struct full of function pointers that map the read/write/... operations to different functions depening on the file system.
You should probably take a look at how the current file systems use the struct. Look in the linux kernel source under fs/ext2 for an example. The functions used in the struct in the ext2/file.c are declared in /usr/include/linux/ext2_fs.h |
|
try:
Code:
struct file_operations test_fops = { Code:
struct file_operations test_fops; |
Hi,
For your device driver, it looks like you're not using GNU tagged initialization correctly. Try something like: struct file_operations test_fops = { read: test_read, write: test_write, open: test_open, release: test_release }; that seems to be the method of doing tagged initiliazion of a struct. ymmv. Aaron |
All times are GMT -5. The time now is 09:23 PM. |