Skip to contentSkip to conversation

Pipefs : doubts

DISCUSSION selvakumar nagendran 2 participants 4 messages Jan 10, 2005

lore
Share & tools
lore
#0 lore raw

Hello linux-experts,
I went through the kernel source code file
/fs/pipe.c and I found that the pipe file system configured as a module. But in lsmod I am unable to see it. This is my first doubt.
My second doubt is, in pipe.c we have lot of
symbols like

PIPE_WAITING_READERS(*inode) PIPE_WAIT(*inode)
PIPE_MAX_RCHUNK(*inode)
What are they? funtions or macros? What they do or
where are their implementation in the kernel source tree?

Thanks,
selva

__________________________________
Do you Yahoo!?
The all-new My Yahoo! - Get yours free!
http://my.yahoo.com

#1 lore raw
Quoted 5 lines · selvakumar nagendran

Hello linux-experts,
I went through the kernel source code file
/fs/pipe.c and I found that the pipe file system configured as a module. But in lsmod I am unable to see it. This is my first doubt.

Where do you see that?
fs/pipe.o is always built into the kernel image.

Quoted 9 lines

My second doubt is, in pipe.c we have lot of
symbols like

PIPE_WAITING_READERS(*inode) PIPE_WAIT(*inode)
PIPE_MAX_RCHUNK(*inode)
What are they? funtions or macros? What they do or
where are their implementation in the kernel source tree?

Macros.
See include/linux/pipe_fs_i.h

Signature · 1 line
~Randy
#2 lore raw

Module : Pipefs : doubts

Hello Randy,
Thanks for ur help. See I do know that pipe.o is
compiled into the main kernel image. But the following code block in pipe.c, made me to think as if pipefs has been implemented as a module in the kernel. Bcoz it used module_init and module_exit macros. That's why I got confused. Can u explain the reason for this?

Thanks,
selva

------------------
static DECLARE_FSTYPE(pipe_fs_type, "pipefs", pipefs_read_super, FS_NOMOUNT);

static int __init init_pipe_fs(void)

{
	int err = register_filesystem(&pipe_fs_type);
	if (!err) {
		pipe_mnt = kern_mount(&pipe_fs_type);
		err = PTR_ERR(pipe_mnt);
		if (IS_ERR(pipe_mnt))
			unregister_filesystem(&pipe_fs_type);
		else
			err = 0;
	}
	return err;
}

static void __exit exit_pipe_fs(void)

{
	unregister_filesystem(&pipe_fs_type);
	mntput(pipe_mnt);
}

module_init(init_pipe_fs)
module_exit(exit_pipe_fs)

Quoted 7 lines · --- "Randy.Dunlap
Quoted 4 lines · selvakumar nagendran

Hello linux-experts,
I went through the kernel source code file
/fs/pipe.c and I found that the pipe file system
configured as a module. But in lsmod I am unable

to

Quoted 1 line

see it. This is my first doubt.

Where do you see that?
fs/pipe.o is always built into the kernel image.

__________________________________
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250

#3 lore raw

Re: Module : Pipefs : doubts

Quoted 7 lines · selvakumar nagendran

Hello Randy,
Thanks for ur help. See I do know that pipe.o is
compiled into the main kernel image. But the following code block in pipe.c, made me to think as if pipefs has been implemented as a module in the kernel. Bcoz it used module_init and module_exit macros. That's why I got confused. Can u explain the reason for this?

Here's what I suggest. Look at the kernel header files, in particular: include/linux/init.h .

Find /module_init/ in that header file.
It has different #defines depending on whether the including file (e.g., pipe.c) is being built as a module or not (#ifdef MODULE).

Once you have found that module_init() means __initcall(), then you can find that __initcall() means device_initcall(), which in turns means define_initcall("6",fn); which is a (normal, common) method of setting up a "module" (functional module, not only for separate loadable modules) initialization entry point. There, darn, I've said too much and my rubout key doesn't work.

Quoted 44 lines

------------------
static DECLARE_FSTYPE(pipe_fs_type, "pipefs", pipefs_read_super, FS_NOMOUNT);

static int __init init_pipe_fs(void)

{
	int err = register_filesystem(&pipe_fs_type);
	if (!err) {
		pipe_mnt = kern_mount(&pipe_fs_type);
		err = PTR_ERR(pipe_mnt);
		if (IS_ERR(pipe_mnt))
			unregister_filesystem(&pipe_fs_type);
		else
			err = 0;
	}
	return err;
}

static void __exit exit_pipe_fs(void)

{
	unregister_filesystem(&pipe_fs_type);
	mntput(pipe_mnt);
}

module_init(init_pipe_fs)
module_exit(exit_pipe_fs)

Quoted 10 lines · --- "Randy.Dunlap
Quoted 4 lines · selvakumar nagendran

Hello linux-experts,
I went through the kernel source code file
/fs/pipe.c and I found that the pipe file system
configured as a module. But in lsmod I am unable

to

Quoted 1 line

see it. This is my first doubt.

Where do you see that?
fs/pipe.o is always built into the kernel image.

Signature · 1 line
~Randy