From: "Anthony Chee" <anthony.chee@polyu.edu.hk>
To: "Keith Owens" <kaos@ocs.com.au>
Cc: <linux-kernel@vger.kernel.org>, <kbuild-devel@vger.kernel.org>,
<kernelnewbies@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>
Subject: Re: undefined reference
Date: Sat, 30 Mar 2002 22:19:01 +0800 [thread overview]
Message-ID: <001401c1d7f5$d896b7c0$0100a8c0@winxp> (raw)
In-Reply-To: <21554.1017121798@kao2.melbourne.sgi.com>
> >
> >Then I use "make bzImage", I got no error message on compiling inode.c,
but
> >I got
> >
> >"fs/fs.o(.text+0x1377d): undefined reference to `func'"
>
> You cannot do that. The kernel must be self contained. The only way
> for the kernel to access module code and data is for the module to
> register that code and data when the module is loaded and for the
> kernel to access the module via the registration list.
>
> See any module that handles a filesystem. sys_open() does not call the
> module directly. A module registers its file operations on load. The
> kernel (dentry_open) calls the module via f->f_op->open.
>
>
Thanks for your help. I use another apporach to communicate with module,
similiar to the method you stated above.
What I did in the kernel source,
1. In fs.h, I added one line in struct super_operations
int (*query_module) (struct inode *);
2. In write_inode() of inode.c, added
result = inode->i_sb->s_op->query_module(inode);
What I did in the module,
1. Build up my own function, kernel_query_module(struct inode *inode)
2. In init_module(), added
struct super_block *sb_ptr;
sb_ptr = get_super(MKDEV(8,1)); /* suppose I want to
get super_block of /dev/sda1 */
sb_ptr -> s_op -> query_module = &kernel_query_module;
Then, I compile the module and didi not get error message
When I compile the kernel, I got the follow error message,
inode.c:195: structure has no member named `query_module'
It made me crazy. Why the module can access the s_op and register the
address of kernel_query_module, but not the kernel source? I already added
one more item in the struct super_operation, but got the error message the
struct has no such member.
Any thing I missed? Thanks.
prev parent reply other threads:[~2002-03-30 14:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-24 16:16 Anthony Chee
2002-03-25 21:45 ` Bart Trojanowski
2002-03-26 4:17 ` Anthony Chee
2002-03-26 5:49 ` Keith Owens
2002-03-30 14:19 ` Anthony Chee [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='001401c1d7f5$d896b7c0$0100a8c0@winxp' \
--to=anthony.chee@polyu.edu.hk \
--cc=kaos@ocs.com.au \
--cc=kbuild-devel@vger.kernel.org \
--cc=kernelnewbies@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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®