Compilation Error: variable has intializer but incomplete type
i am trying to learn and write device driver on linux kernel 2.4 redhat distribution
iam getting compilation errors for driver code.
struct file_operations my_ops ={NULL,my_read,my_write,NULL,NULL,NULL NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL };
ERROR -> my_ops has intializer but incomplete type
Can anyone help me with this
Regards
Raman
Get Your Private, Free E-mail from Indiatimes at http://email.indiatimes.com
Buy The Best In BOOKS at http://www.bestsellers.indiatimes.com
Bid for for Air Tickets @ Re.1 on Air Sahara Flights. Just log on to http://airsahara.indiatimes.com and Bid Now !
Quoted 9 lines
i am trying to learn and write device driver on linux kernel 2.4 redhat
distributioniam getting compilation errors for driver code.
structfile_operationsmy_ops={NULL,my_read,my_write,NULL,NULL,NULL NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL };ERROR ->
my_opshas intializer but incomplete type
This is not a good way to do it. See e.g. fs/pipe.c#read_fifo_fops for an easier approach:
struct file_operations read_fifo_fops = {
llseek: no_llseek,
read: pipe_read,
write: bad_pipe_w,
poll: fifo_poll,
ioctl: pipe_ioctl,
open: pipe_read_open,
release: pipe_read_release,};
Signature · 2 lines
Marcus Alanen [email protected]
commence Marcus Alanen quotation:
Quoted 14 lines
Quoted 9 lines
i am trying to learn and write device driver on linux kernel 2.4 redhat
distributioniam getting compilation errors for driver code.
structfile_operationsmy_ops={NULL,my_read,my_write,NULL,NULL,NULL NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL };ERROR ->
my_opshas intializer but incomplete typeThis is not a good way to do it. See e.g. fs/pipe.c#read_fifo_fops for an easier approach:
struct
file_operationsread_fifo_fops= {
Quoted 8 lines
llseek: no_llseek, read: pipe_read, write: bad_pipe_w, poll: fifo_poll, ioctl: pipe_ioctl, open: pipe_read_open, release: pipe_read_release,};
Aside from this, the main issue is the "has intializer but incomplete type" error, which indicates that the definition of struct file_operations has not been seen by the compiler. This seems to be defined (in 2.4.20, at least) by include/linux/fs.h, so Raman will need to #include that file for the initialization to work.
Signature · 1 line
Sean Neakums - <[email protected]>
Quoted 15 lines · Marcus Alanen
Quoted 10 lines
i am trying to learn and write device driver on linux kernel 2.4 redhat
distributioniam getting compilation errors for driver code.
structfile_operationsmy_ops={NULL,my_read,my_write,NULL,NULL,NULL NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL };ERROR ->
my_opshas intializer but incomplete typeThis is not a good way to do it. See e.g. fs/pipe.c#read_fifo_fops for an easier approach:
struct
file_operationsread_fifo_fops= {
Quoted 8 lines
llseek: no_llseek, read: pipe_read, write: bad_pipe_w, poll: fifo_poll, ioctl: pipe_ioctl, open: pipe_read_open, release: pipe_read_release,};
You should use the c99 initializers, though.
struct file_operations read_fifo_fops = {
.llseek = no_llseek,
.read = pipe_read,
.write = bad_pipe_w,
.poll = fifo_poll,
.ioctl = pipe_ioctl,
.open = pipe_read_open,
.release = pipe_read_release,
};Jörn
Signature · 2 lines
Good warriors cause others to come to them and do not go to others. -- Sun Tzu