mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Compilation Error: variable has intializer but incomplete type
@ 2003-04-01  4:34 ramands
  2003-04-01  9:07 ` Marcus Alanen
  0 siblings, 1 reply; 4+ messages in thread
From: ramands @ 2003-04-01  4:34 UTC (permalink / raw)
  To: linux-kernel

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 !


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compilation Error: variable has intializer but incomplete type
  2003-04-01  4:34 Compilation Error: variable has intializer but incomplete type ramands
@ 2003-04-01  9:07 ` Marcus Alanen
  2003-04-01  9:24   ` Sean Neakums
  2003-04-01 10:21   ` Jörn Engel
  0 siblings, 2 replies; 4+ messages in thread
From: Marcus Alanen @ 2003-04-01  9:07 UTC (permalink / raw)
  To: ramands, linux-kernel

>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,
};


-- 
Marcus Alanen
maalanen@abo.fi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compilation Error: variable has intializer but incomplete type
  2003-04-01  9:07 ` Marcus Alanen
@ 2003-04-01  9:24   ` Sean Neakums
  2003-04-01 10:21   ` Jörn Engel
  1 sibling, 0 replies; 4+ messages in thread
From: Sean Neakums @ 2003-04-01  9:24 UTC (permalink / raw)
  To: Marcus Alanen; +Cc: ramands, linux-kernel

commence  Marcus Alanen quotation:

>>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,
> };

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.

-- 
Sean Neakums - <sneakums@zork.net>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compilation Error: variable has intializer but incomplete type
  2003-04-01  9:07 ` Marcus Alanen
  2003-04-01  9:24   ` Sean Neakums
@ 2003-04-01 10:21   ` Jörn Engel
  1 sibling, 0 replies; 4+ messages in thread
From: Jörn Engel @ 2003-04-01 10:21 UTC (permalink / raw)
  To: Marcus Alanen; +Cc: ramands, linux-kernel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-04-01 10:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-01  4:34 Compilation Error: variable has intializer but incomplete type ramands
2003-04-01  9:07 ` Marcus Alanen
2003-04-01  9:24   ` Sean Neakums
2003-04-01 10:21   ` Jörn Engel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®