PDA

View Full Version : problem while initializing the struct



awais
February 5th, 2006, 06:46 AM
Actually I am writing a device driver in ubuntu. And I have a problem while initializing the struct of file_operations. When I compile the code listed below like this
gcc -c UsbDrv.c
then an error came like this
the struct file_operations is of incomplete type
So, if any one knows how to fix the problem, kindly reply me.

struct file_operations fops= {
read_device,
write_device,
release_device
};

toojays
February 5th, 2006, 08:15 AM
You need to specify the types of the struct members.

David Marrs
February 5th, 2006, 09:08 PM
Try removing "struct" from the initialisation code. If that doesn't work, can we see the definition of the struct itself?

file_operations fops= {
read_device,
write_device,
release_device
};

LordHunter317
February 5th, 2006, 09:44 PM
Neither of those answers are correct. You haven't included the declaration of struct file_operations yet. You need to include it or declare it yourself.

Also, don't start the same thread twice.