mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
To: Marcus Alanen <marcus@infa.abo.fi>
Cc: ramands@indiatimes.com, linux-kernel@vger.kernel.org
Subject: Re: Compilation Error: variable has intializer but incomplete type
Date: Tue, 1 Apr 2003 12:21:26 +0200	[thread overview]
Message-ID: <20030401102126.GA6128@wohnheim.fh-wedel.de> (raw)
In-Reply-To: <200304010907.h3197Mi20706@infa.abo.fi>

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

      parent reply	other threads:[~2003-04-01 10:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-01  4:34 ramands
2003-04-01  9:07 ` Marcus Alanen
2003-04-01  9:24   ` Sean Neakums
2003-04-01 10:21   ` Jörn Engel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030401102126.GA6128@wohnheim.fh-wedel.de \
    --to=joern@wohnheim.fh-wedel.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcus@infa.abo.fi \
    --cc=ramands@indiatimes.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®