Re: Compilation Error: variable has intializer but incomplete type
Jörn Engel (joern@wohnheim.fh-wedel.de)
Tue, 1 Apr 2003 12:21:26 +0200
On Tue, 1 April 2003 12:07:22 +0300, Marcus Alanen wrote:
>
> >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
>
> 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,
> };
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
--
Good warriors cause others to come to them and do not go to others.
-- Sun Tzu
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/