[Techtalk] Where in the kernel is /proc/mount?

John Clarke johnc+linuxchix at kirriwa.net
Mon Jan 26 17:50:14 EST 2004


On Sun, Jan 25, 2004 at 05:02:31 +0100, Dan Richter wrote:

> Does anyone happen to know where in the Linux kernel I can find the 
> function that handles /proc/mounts - not /proc in general, but the 
> /proc/mounts part? What's the function's name and what file is it in?

In my 2.4.20 kernel:

    [johnc at dropbear /usr/src/linux-2.4/fs/proc]$ grep -w mounts *.c
    base.c:  E(PROC_PID_MOUNTS,  "mounts",       S_IFREG|S_IRUGO),
    proc_misc.c: proc_symlink("mounts", NULL, "self/mounts");

The stuff in proc_misc.c is only the initialisation, what I think
you're looking for is in base.c:

    static struct file_operations proc_mounts_operations = {
	    open:		mounts_open,
	    read:		seq_read,
	    llseek:		seq_lseek,
	    release:	mounts_release,
    };

mounts_open() and mounts_release() are in this base.c, seq_read() and
seq_lseek() are in /usr/src/linux-2.4/fs/seq_file.c.


Cheers,

John
-- 
whois !JC774-AU at whois.aunic.net
GPG key id: 0xD59C360F
http://kirriwa.net/john/


More information about the Techtalk mailing list