License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2011-12-07 01:21:54 +08:00
|
|
|
/*
|
|
|
|
* fs/proc_namespace.c - handling of /proc/<pid>/{mounts,mountinfo,mountstats}
|
|
|
|
*
|
|
|
|
* In fact, that's a piece of procfs; it's *almost* isolated from
|
|
|
|
* the rest of fs/proc, but has rather close relationships with
|
|
|
|
* fs/namespace.c, thus here instead of fs/proc
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#include <linux/mnt_namespace.h>
|
|
|
|
#include <linux/nsproxy.h>
|
|
|
|
#include <linux/security.h>
|
|
|
|
#include <linux/fs_struct.h>
|
2017-02-06 17:57:33 +08:00
|
|
|
#include <linux/sched/task.h>
|
2024-06-11 20:08:33 +08:00
|
|
|
#include <linux/shield_mounts.h>
|
|
|
|
#include <linux/pid_namespace.h>
|
2017-02-06 17:57:33 +08:00
|
|
|
|
2011-12-07 01:21:54 +08:00
|
|
|
#include "proc/internal.h" /* only for get_proc_task() in ->open() */
|
|
|
|
|
|
|
|
#include "pnode.h"
|
|
|
|
#include "internal.h"
|
|
|
|
|
2017-07-03 13:02:18 +08:00
|
|
|
static __poll_t mounts_poll(struct file *file, poll_table *wait)
|
2011-12-07 01:21:54 +08:00
|
|
|
{
|
fs: use seq_open_private() for proc_mounts
A patchset to remove support for passing pre-allocated struct seq_file to
seq_open(). Such feature is undocumented and prone to error.
In particular, if seq_release() is used in release handler, it will
kfree() a pointer which was not allocated by seq_open().
So this patchset drops support for pre-allocated struct seq_file: it's
only of use in proc_namespace.c and can be easily replaced by using
seq_open_private()/seq_release_private().
Additionally, it documents the use of file->private_data to hold pointer
to struct seq_file by seq_open().
This patch (of 3):
Since patch described below, from v2.6.15-rc1, seq_open() could use a
struct seq_file already allocated by the caller if the pointer to the
structure is stored in file->private_data before calling the function.
Commit 1abe77b0fc4b485927f1f798ae81a752677e1d05
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Mon Nov 7 17:15:34 2005 -0500
[PATCH] allow callers of seq_open do allocation themselves
Allow caller of seq_open() to kmalloc() seq_file + whatever else they
want and set ->private_data to it. seq_open() will then abstain from
doing allocation itself.
Such behavior is only used by mounts_open_common().
In order to drop support for such uncommon feature, proc_mounts is
converted to use seq_open_private(), which take care of allocating the
proc_mounts structure, making it available through ->private in struct
seq_file.
Conversely, proc_mounts is converted to use seq_release_private(), in
order to release the private structure allocated by seq_open_private().
Then, ->private is used directly instead of proc_mounts() macro to access
to the proc_mounts structure.
Link: http://lkml.kernel.org/r/cover.1433193673.git.ydroneaud@opteya.com
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-07-01 05:57:30 +08:00
|
|
|
struct seq_file *m = file->private_data;
|
|
|
|
struct proc_mounts *p = m->private;
|
2011-12-07 01:21:54 +08:00
|
|
|
struct mnt_namespace *ns = p->ns;
|
2018-02-12 06:34:03 +08:00
|
|
|
__poll_t res = EPOLLIN | EPOLLRDNORM;
|
2013-09-29 22:59:59 +08:00
|
|
|
int event;
|
2011-12-07 01:21:54 +08:00
|
|
|
|
|
|
|
poll_wait(file, &p->ns->poll, wait);
|
|
|
|
|
locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE()
Please do not apply this to mainline directly, instead please re-run the
coccinelle script shown below and apply its output.
For several reasons, it is desirable to use {READ,WRITE}_ONCE() in
preference to ACCESS_ONCE(), and new code is expected to use one of the
former. So far, there's been no reason to change most existing uses of
ACCESS_ONCE(), as these aren't harmful, and changing them results in
churn.
However, for some features, the read/write distinction is critical to
correct operation. To distinguish these cases, separate read/write
accessors must be used. This patch migrates (most) remaining
ACCESS_ONCE() instances to {READ,WRITE}_ONCE(), using the following
coccinelle script:
----
// Convert trivial ACCESS_ONCE() uses to equivalent READ_ONCE() and
// WRITE_ONCE()
// $ make coccicheck COCCI=/home/mark/once.cocci SPFLAGS="--include-headers" MODE=patch
virtual patch
@ depends on patch @
expression E1, E2;
@@
- ACCESS_ONCE(E1) = E2
+ WRITE_ONCE(E1, E2)
@ depends on patch @
expression E;
@@
- ACCESS_ONCE(E)
+ READ_ONCE(E)
----
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: davem@davemloft.net
Cc: linux-arch@vger.kernel.org
Cc: mpe@ellerman.id.au
Cc: shuah@kernel.org
Cc: snitzer@redhat.com
Cc: thor.thayer@linux.intel.com
Cc: tj@kernel.org
Cc: viro@zeniv.linux.org.uk
Cc: will.deacon@arm.com
Link: http://lkml.kernel.org/r/1508792849-3115-19-git-send-email-paulmck@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-10-24 05:07:29 +08:00
|
|
|
event = READ_ONCE(ns->event);
|
fs: use seq_open_private() for proc_mounts
A patchset to remove support for passing pre-allocated struct seq_file to
seq_open(). Such feature is undocumented and prone to error.
In particular, if seq_release() is used in release handler, it will
kfree() a pointer which was not allocated by seq_open().
So this patchset drops support for pre-allocated struct seq_file: it's
only of use in proc_namespace.c and can be easily replaced by using
seq_open_private()/seq_release_private().
Additionally, it documents the use of file->private_data to hold pointer
to struct seq_file by seq_open().
This patch (of 3):
Since patch described below, from v2.6.15-rc1, seq_open() could use a
struct seq_file already allocated by the caller if the pointer to the
structure is stored in file->private_data before calling the function.
Commit 1abe77b0fc4b485927f1f798ae81a752677e1d05
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Mon Nov 7 17:15:34 2005 -0500
[PATCH] allow callers of seq_open do allocation themselves
Allow caller of seq_open() to kmalloc() seq_file + whatever else they
want and set ->private_data to it. seq_open() will then abstain from
doing allocation itself.
Such behavior is only used by mounts_open_common().
In order to drop support for such uncommon feature, proc_mounts is
converted to use seq_open_private(), which take care of allocating the
proc_mounts structure, making it available through ->private in struct
seq_file.
Conversely, proc_mounts is converted to use seq_release_private(), in
order to release the private structure allocated by seq_open_private().
Then, ->private is used directly instead of proc_mounts() macro to access
to the proc_mounts structure.
Link: http://lkml.kernel.org/r/cover.1433193673.git.ydroneaud@opteya.com
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-07-01 05:57:30 +08:00
|
|
|
if (m->poll_event != event) {
|
|
|
|
m->poll_event = event;
|
2018-02-12 06:34:03 +08:00
|
|
|
res |= EPOLLERR | EPOLLPRI;
|
2011-12-07 01:21:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct proc_fs_info {
|
|
|
|
int flag;
|
|
|
|
const char *str;
|
|
|
|
};
|
|
|
|
|
|
|
|
static int show_sb_opts(struct seq_file *m, struct super_block *sb)
|
|
|
|
{
|
|
|
|
static const struct proc_fs_info fs_info[] = {
|
2017-11-28 05:05:09 +08:00
|
|
|
{ SB_SYNCHRONOUS, ",sync" },
|
|
|
|
{ SB_DIRSYNC, ",dirsync" },
|
|
|
|
{ SB_MANDLOCK, ",mand" },
|
|
|
|
{ SB_LAZYTIME, ",lazytime" },
|
2011-12-07 01:21:54 +08:00
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
const struct proc_fs_info *fs_infop;
|
|
|
|
|
|
|
|
for (fs_infop = fs_info; fs_infop->flag; fs_infop++) {
|
|
|
|
if (sb->s_flags & fs_infop->flag)
|
|
|
|
seq_puts(m, fs_infop->str);
|
|
|
|
}
|
|
|
|
|
|
|
|
return security_sb_show_options(m, sb);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void show_mnt_opts(struct seq_file *m, struct vfsmount *mnt)
|
|
|
|
{
|
|
|
|
static const struct proc_fs_info mnt_info[] = {
|
|
|
|
{ MNT_NOSUID, ",nosuid" },
|
|
|
|
{ MNT_NODEV, ",nodev" },
|
|
|
|
{ MNT_NOEXEC, ",noexec" },
|
|
|
|
{ MNT_NOATIME, ",noatime" },
|
|
|
|
{ MNT_NODIRATIME, ",nodiratime" },
|
|
|
|
{ MNT_RELATIME, ",relatime" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
const struct proc_fs_info *fs_infop;
|
|
|
|
|
|
|
|
for (fs_infop = mnt_info; fs_infop->flag; fs_infop++) {
|
|
|
|
if (mnt->mnt_flags & fs_infop->flag)
|
|
|
|
seq_puts(m, fs_infop->str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void mangle(struct seq_file *m, const char *s)
|
|
|
|
{
|
|
|
|
seq_escape(m, s, " \t\n\\");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void show_type(struct seq_file *m, struct super_block *sb)
|
|
|
|
{
|
|
|
|
mangle(m, sb->s_type->name);
|
2019-03-26 00:38:31 +08:00
|
|
|
if (sb->s_subtype) {
|
2011-12-07 01:21:54 +08:00
|
|
|
seq_putc(m, '.');
|
|
|
|
mangle(m, sb->s_subtype);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-06-11 20:08:33 +08:00
|
|
|
static inline bool is_in_container(void)
|
|
|
|
{
|
|
|
|
if (task_active_pid_ns(current)->level)
|
|
|
|
return true;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool mnt_need_shield(struct vfsmount *mnt)
|
|
|
|
{
|
|
|
|
struct mount *r = real_mount(mnt);
|
|
|
|
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
|
|
|
|
char *p;
|
|
|
|
bool ret = false;
|
|
|
|
|
|
|
|
char *buf = (char *)__get_free_pages(GFP_KERNEL, 0);
|
|
|
|
if (!buf)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
p = d_path(&mnt_path, buf, PAGE_SIZE);
|
|
|
|
if (IS_ERR(p)) {
|
|
|
|
ret = PTR_ERR(p);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = is_mount_shielded(r->mnt_devname ? r->mnt_devname : "none", p);
|
|
|
|
|
|
|
|
out:
|
|
|
|
if (buf)
|
|
|
|
free_pages((unsigned long) buf, 0);
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-12-07 01:21:54 +08:00
|
|
|
static int show_vfsmnt(struct seq_file *m, struct vfsmount *mnt)
|
|
|
|
{
|
fs: use seq_open_private() for proc_mounts
A patchset to remove support for passing pre-allocated struct seq_file to
seq_open(). Such feature is undocumented and prone to error.
In particular, if seq_release() is used in release handler, it will
kfree() a pointer which was not allocated by seq_open().
So this patchset drops support for pre-allocated struct seq_file: it's
only of use in proc_namespace.c and can be easily replaced by using
seq_open_private()/seq_release_private().
Additionally, it documents the use of file->private_data to hold pointer
to struct seq_file by seq_open().
This patch (of 3):
Since patch described below, from v2.6.15-rc1, seq_open() could use a
struct seq_file already allocated by the caller if the pointer to the
structure is stored in file->private_data before calling the function.
Commit 1abe77b0fc4b485927f1f798ae81a752677e1d05
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Mon Nov 7 17:15:34 2005 -0500
[PATCH] allow callers of seq_open do allocation themselves
Allow caller of seq_open() to kmalloc() seq_file + whatever else they
want and set ->private_data to it. seq_open() will then abstain from
doing allocation itself.
Such behavior is only used by mounts_open_common().
In order to drop support for such uncommon feature, proc_mounts is
converted to use seq_open_private(), which take care of allocating the
proc_mounts structure, making it available through ->private in struct
seq_file.
Conversely, proc_mounts is converted to use seq_release_private(), in
order to release the private structure allocated by seq_open_private().
Then, ->private is used directly instead of proc_mounts() macro to access
to the proc_mounts structure.
Link: http://lkml.kernel.org/r/cover.1433193673.git.ydroneaud@opteya.com
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-07-01 05:57:30 +08:00
|
|
|
struct proc_mounts *p = m->private;
|
2011-12-07 01:21:54 +08:00
|
|
|
struct mount *r = real_mount(mnt);
|
|
|
|
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
|
2011-12-09 10:32:45 +08:00
|
|
|
struct super_block *sb = mnt_path.dentry->d_sb;
|
2024-06-11 20:08:33 +08:00
|
|
|
int err = 0;
|
|
|
|
|
|
|
|
if (is_in_container() && mnt_need_shield(mnt))
|
|
|
|
goto out;
|
2011-12-07 01:21:54 +08:00
|
|
|
|
2011-12-09 10:32:45 +08:00
|
|
|
if (sb->s_op->show_devname) {
|
|
|
|
err = sb->s_op->show_devname(m, mnt_path.dentry);
|
2011-12-07 01:21:54 +08:00
|
|
|
if (err)
|
|
|
|
goto out;
|
|
|
|
} else {
|
|
|
|
mangle(m, r->mnt_devname ? r->mnt_devname : "none");
|
|
|
|
}
|
|
|
|
seq_putc(m, ' ');
|
2014-12-16 11:59:37 +08:00
|
|
|
/* mountpoints outside of chroot jail will give SEQ_SKIP on this */
|
|
|
|
err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\");
|
|
|
|
if (err)
|
|
|
|
goto out;
|
2011-12-07 01:21:54 +08:00
|
|
|
seq_putc(m, ' ');
|
2011-12-09 10:32:45 +08:00
|
|
|
show_type(m, sb);
|
2011-12-07 01:21:54 +08:00
|
|
|
seq_puts(m, __mnt_is_readonly(mnt) ? " ro" : " rw");
|
2011-12-09 10:32:45 +08:00
|
|
|
err = show_sb_opts(m, sb);
|
2011-12-07 01:21:54 +08:00
|
|
|
if (err)
|
|
|
|
goto out;
|
|
|
|
show_mnt_opts(m, mnt);
|
2011-12-09 10:32:45 +08:00
|
|
|
if (sb->s_op->show_options)
|
2011-12-09 10:32:45 +08:00
|
|
|
err = sb->s_op->show_options(m, mnt_path.dentry);
|
2011-12-07 01:21:54 +08:00
|
|
|
seq_puts(m, " 0 0\n");
|
|
|
|
out:
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt)
|
|
|
|
{
|
fs: use seq_open_private() for proc_mounts
A patchset to remove support for passing pre-allocated struct seq_file to
seq_open(). Such feature is undocumented and prone to error.
In particular, if seq_release() is used in release handler, it will
kfree() a pointer which was not allocated by seq_open().
So this patchset drops support for pre-allocated struct seq_file: it's
only of use in proc_namespace.c and can be easily replaced by using
seq_open_private()/seq_release_private().
Additionally, it documents the use of file->private_data to hold pointer
to struct seq_file by seq_open().
This patch (of 3):
Since patch described below, from v2.6.15-rc1, seq_open() could use a
struct seq_file already allocated by the caller if the pointer to the
structure is stored in file->private_data before calling the function.
Commit 1abe77b0fc4b485927f1f798ae81a752677e1d05
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Mon Nov 7 17:15:34 2005 -0500
[PATCH] allow callers of seq_open do allocation themselves
Allow caller of seq_open() to kmalloc() seq_file + whatever else they
want and set ->private_data to it. seq_open() will then abstain from
doing allocation itself.
Such behavior is only used by mounts_open_common().
In order to drop support for such uncommon feature, proc_mounts is
converted to use seq_open_private(), which take care of allocating the
proc_mounts structure, making it available through ->private in struct
seq_file.
Conversely, proc_mounts is converted to use seq_release_private(), in
order to release the private structure allocated by seq_open_private().
Then, ->private is used directly instead of proc_mounts() macro to access
to the proc_mounts structure.
Link: http://lkml.kernel.org/r/cover.1433193673.git.ydroneaud@opteya.com
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-07-01 05:57:30 +08:00
|
|
|
struct proc_mounts *p = m->private;
|
2011-12-07 01:21:54 +08:00
|
|
|
struct mount *r = real_mount(mnt);
|
|
|
|
struct super_block *sb = mnt->mnt_sb;
|
|
|
|
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
|
2024-06-11 20:08:33 +08:00
|
|
|
int err = 0;
|
|
|
|
|
|
|
|
if (is_in_container() && mnt_need_shield(mnt))
|
|
|
|
goto out;
|
2011-12-07 01:21:54 +08:00
|
|
|
|
|
|
|
seq_printf(m, "%i %i %u:%u ", r->mnt_id, r->mnt_parent->mnt_id,
|
|
|
|
MAJOR(sb->s_dev), MINOR(sb->s_dev));
|
2015-11-19 05:58:20 +08:00
|
|
|
if (sb->s_op->show_path) {
|
2011-12-09 10:37:57 +08:00
|
|
|
err = sb->s_op->show_path(m, mnt->mnt_root);
|
2015-11-19 05:58:20 +08:00
|
|
|
if (err)
|
|
|
|
goto out;
|
|
|
|
} else {
|
2011-12-07 01:21:54 +08:00
|
|
|
seq_dentry(m, mnt->mnt_root, " \t\n\\");
|
2015-11-19 05:58:20 +08:00
|
|
|
}
|
2011-12-07 01:21:54 +08:00
|
|
|
seq_putc(m, ' ');
|
|
|
|
|
|
|
|
/* mountpoints outside of chroot jail will give SEQ_SKIP on this */
|
2012-10-18 00:29:36 +08:00
|
|
|
err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\");
|
2011-12-07 01:21:54 +08:00
|
|
|
if (err)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
seq_puts(m, mnt->mnt_flags & MNT_READONLY ? " ro" : " rw");
|
|
|
|
show_mnt_opts(m, mnt);
|
|
|
|
|
|
|
|
/* Tagged fields ("foo:X" or "bar") */
|
|
|
|
if (IS_MNT_SHARED(r))
|
|
|
|
seq_printf(m, " shared:%i", r->mnt_group_id);
|
|
|
|
if (IS_MNT_SLAVE(r)) {
|
|
|
|
int master = r->mnt_master->mnt_group_id;
|
|
|
|
int dom = get_dominating_id(r, &p->root);
|
|
|
|
seq_printf(m, " master:%i", master);
|
|
|
|
if (dom && dom != master)
|
|
|
|
seq_printf(m, " propagate_from:%i", dom);
|
|
|
|
}
|
|
|
|
if (IS_MNT_UNBINDABLE(r))
|
|
|
|
seq_puts(m, " unbindable");
|
|
|
|
|
|
|
|
/* Filesystem specific data */
|
|
|
|
seq_puts(m, " - ");
|
|
|
|
show_type(m, sb);
|
|
|
|
seq_putc(m, ' ');
|
2015-11-19 05:58:20 +08:00
|
|
|
if (sb->s_op->show_devname) {
|
2011-12-09 10:32:45 +08:00
|
|
|
err = sb->s_op->show_devname(m, mnt->mnt_root);
|
2015-11-19 05:58:20 +08:00
|
|
|
if (err)
|
|
|
|
goto out;
|
|
|
|
} else {
|
2011-12-07 01:21:54 +08:00
|
|
|
mangle(m, r->mnt_devname ? r->mnt_devname : "none");
|
2015-11-19 05:58:20 +08:00
|
|
|
}
|
2017-07-17 15:45:34 +08:00
|
|
|
seq_puts(m, sb_rdonly(sb) ? " ro" : " rw");
|
2011-12-07 01:21:54 +08:00
|
|
|
err = show_sb_opts(m, sb);
|
|
|
|
if (err)
|
|
|
|
goto out;
|
|
|
|
if (sb->s_op->show_options)
|
2011-12-09 10:32:45 +08:00
|
|
|
err = sb->s_op->show_options(m, mnt->mnt_root);
|
2011-12-07 01:21:54 +08:00
|
|
|
seq_putc(m, '\n');
|
|
|
|
out:
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
|
|
|
|
{
|
fs: use seq_open_private() for proc_mounts
A patchset to remove support for passing pre-allocated struct seq_file to
seq_open(). Such feature is undocumented and prone to error.
In particular, if seq_release() is used in release handler, it will
kfree() a pointer which was not allocated by seq_open().
So this patchset drops support for pre-allocated struct seq_file: it's
only of use in proc_namespace.c and can be easily replaced by using
seq_open_private()/seq_release_private().
Additionally, it documents the use of file->private_data to hold pointer
to struct seq_file by seq_open().
This patch (of 3):
Since patch described below, from v2.6.15-rc1, seq_open() could use a
struct seq_file already allocated by the caller if the pointer to the
structure is stored in file->private_data before calling the function.
Commit 1abe77b0fc4b485927f1f798ae81a752677e1d05
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Mon Nov 7 17:15:34 2005 -0500
[PATCH] allow callers of seq_open do allocation themselves
Allow caller of seq_open() to kmalloc() seq_file + whatever else they
want and set ->private_data to it. seq_open() will then abstain from
doing allocation itself.
Such behavior is only used by mounts_open_common().
In order to drop support for such uncommon feature, proc_mounts is
converted to use seq_open_private(), which take care of allocating the
proc_mounts structure, making it available through ->private in struct
seq_file.
Conversely, proc_mounts is converted to use seq_release_private(), in
order to release the private structure allocated by seq_open_private().
Then, ->private is used directly instead of proc_mounts() macro to access
to the proc_mounts structure.
Link: http://lkml.kernel.org/r/cover.1433193673.git.ydroneaud@opteya.com
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-07-01 05:57:30 +08:00
|
|
|
struct proc_mounts *p = m->private;
|
2011-12-07 01:21:54 +08:00
|
|
|
struct mount *r = real_mount(mnt);
|
|
|
|
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
|
2011-12-09 09:51:13 +08:00
|
|
|
struct super_block *sb = mnt_path.dentry->d_sb;
|
2015-11-19 05:58:32 +08:00
|
|
|
int err;
|
2011-12-07 01:21:54 +08:00
|
|
|
|
|
|
|
/* device */
|
2011-12-09 09:51:13 +08:00
|
|
|
if (sb->s_op->show_devname) {
|
2011-12-07 01:21:54 +08:00
|
|
|
seq_puts(m, "device ");
|
2011-12-09 10:32:45 +08:00
|
|
|
err = sb->s_op->show_devname(m, mnt_path.dentry);
|
2015-03-19 19:10:54 +08:00
|
|
|
if (err)
|
|
|
|
goto out;
|
2011-12-07 01:21:54 +08:00
|
|
|
} else {
|
|
|
|
if (r->mnt_devname) {
|
|
|
|
seq_puts(m, "device ");
|
|
|
|
mangle(m, r->mnt_devname);
|
|
|
|
} else
|
|
|
|
seq_puts(m, "no device");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mount point */
|
|
|
|
seq_puts(m, " mounted on ");
|
2014-12-16 11:59:37 +08:00
|
|
|
/* mountpoints outside of chroot jail will give SEQ_SKIP on this */
|
|
|
|
err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\");
|
|
|
|
if (err)
|
|
|
|
goto out;
|
2011-12-07 01:21:54 +08:00
|
|
|
seq_putc(m, ' ');
|
|
|
|
|
|
|
|
/* file system type */
|
|
|
|
seq_puts(m, "with fstype ");
|
2011-12-09 09:51:13 +08:00
|
|
|
show_type(m, sb);
|
2011-12-07 01:21:54 +08:00
|
|
|
|
|
|
|
/* optional statistics */
|
2011-12-09 09:51:13 +08:00
|
|
|
if (sb->s_op->show_stats) {
|
2011-12-07 01:21:54 +08:00
|
|
|
seq_putc(m, ' ');
|
2015-11-19 05:58:32 +08:00
|
|
|
err = sb->s_op->show_stats(m, mnt_path.dentry);
|
2011-12-07 01:21:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
seq_putc(m, '\n');
|
2014-12-16 11:59:37 +08:00
|
|
|
out:
|
2011-12-07 01:21:54 +08:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int mounts_open_common(struct inode *inode, struct file *file,
|
|
|
|
int (*show)(struct seq_file *, struct vfsmount *))
|
|
|
|
{
|
|
|
|
struct task_struct *task = get_proc_task(inode);
|
|
|
|
struct nsproxy *nsp;
|
|
|
|
struct mnt_namespace *ns = NULL;
|
|
|
|
struct path root;
|
|
|
|
struct proc_mounts *p;
|
fs: use seq_open_private() for proc_mounts
A patchset to remove support for passing pre-allocated struct seq_file to
seq_open(). Such feature is undocumented and prone to error.
In particular, if seq_release() is used in release handler, it will
kfree() a pointer which was not allocated by seq_open().
So this patchset drops support for pre-allocated struct seq_file: it's
only of use in proc_namespace.c and can be easily replaced by using
seq_open_private()/seq_release_private().
Additionally, it documents the use of file->private_data to hold pointer
to struct seq_file by seq_open().
This patch (of 3):
Since patch described below, from v2.6.15-rc1, seq_open() could use a
struct seq_file already allocated by the caller if the pointer to the
structure is stored in file->private_data before calling the function.
Commit 1abe77b0fc4b485927f1f798ae81a752677e1d05
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Mon Nov 7 17:15:34 2005 -0500
[PATCH] allow callers of seq_open do allocation themselves
Allow caller of seq_open() to kmalloc() seq_file + whatever else they
want and set ->private_data to it. seq_open() will then abstain from
doing allocation itself.
Such behavior is only used by mounts_open_common().
In order to drop support for such uncommon feature, proc_mounts is
converted to use seq_open_private(), which take care of allocating the
proc_mounts structure, making it available through ->private in struct
seq_file.
Conversely, proc_mounts is converted to use seq_release_private(), in
order to release the private structure allocated by seq_open_private().
Then, ->private is used directly instead of proc_mounts() macro to access
to the proc_mounts structure.
Link: http://lkml.kernel.org/r/cover.1433193673.git.ydroneaud@opteya.com
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-07-01 05:57:30 +08:00
|
|
|
struct seq_file *m;
|
2011-12-07 01:21:54 +08:00
|
|
|
int ret = -EINVAL;
|
|
|
|
|
|
|
|
if (!task)
|
|
|
|
goto err;
|
|
|
|
|
2014-02-04 11:13:49 +08:00
|
|
|
task_lock(task);
|
|
|
|
nsp = task->nsproxy;
|
2014-01-24 07:55:44 +08:00
|
|
|
if (!nsp || !nsp->mnt_ns) {
|
2014-02-04 11:13:49 +08:00
|
|
|
task_unlock(task);
|
2011-12-07 01:21:54 +08:00
|
|
|
put_task_struct(task);
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
ns = nsp->mnt_ns;
|
|
|
|
get_mnt_ns(ns);
|
|
|
|
if (!task->fs) {
|
|
|
|
task_unlock(task);
|
|
|
|
put_task_struct(task);
|
|
|
|
ret = -ENOENT;
|
|
|
|
goto err_put_ns;
|
|
|
|
}
|
|
|
|
get_fs_root(task->fs, &root);
|
|
|
|
task_unlock(task);
|
|
|
|
put_task_struct(task);
|
|
|
|
|
fs: use seq_open_private() for proc_mounts
A patchset to remove support for passing pre-allocated struct seq_file to
seq_open(). Such feature is undocumented and prone to error.
In particular, if seq_release() is used in release handler, it will
kfree() a pointer which was not allocated by seq_open().
So this patchset drops support for pre-allocated struct seq_file: it's
only of use in proc_namespace.c and can be easily replaced by using
seq_open_private()/seq_release_private().
Additionally, it documents the use of file->private_data to hold pointer
to struct seq_file by seq_open().
This patch (of 3):
Since patch described below, from v2.6.15-rc1, seq_open() could use a
struct seq_file already allocated by the caller if the pointer to the
structure is stored in file->private_data before calling the function.
Commit 1abe77b0fc4b485927f1f798ae81a752677e1d05
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Mon Nov 7 17:15:34 2005 -0500
[PATCH] allow callers of seq_open do allocation themselves
Allow caller of seq_open() to kmalloc() seq_file + whatever else they
want and set ->private_data to it. seq_open() will then abstain from
doing allocation itself.
Such behavior is only used by mounts_open_common().
In order to drop support for such uncommon feature, proc_mounts is
converted to use seq_open_private(), which take care of allocating the
proc_mounts structure, making it available through ->private in struct
seq_file.
Conversely, proc_mounts is converted to use seq_release_private(), in
order to release the private structure allocated by seq_open_private().
Then, ->private is used directly instead of proc_mounts() macro to access
to the proc_mounts structure.
Link: http://lkml.kernel.org/r/cover.1433193673.git.ydroneaud@opteya.com
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-07-01 05:57:30 +08:00
|
|
|
ret = seq_open_private(file, &mounts_op, sizeof(struct proc_mounts));
|
|
|
|
if (ret)
|
2011-12-07 01:21:54 +08:00
|
|
|
goto err_put_path;
|
|
|
|
|
fs: use seq_open_private() for proc_mounts
A patchset to remove support for passing pre-allocated struct seq_file to
seq_open(). Such feature is undocumented and prone to error.
In particular, if seq_release() is used in release handler, it will
kfree() a pointer which was not allocated by seq_open().
So this patchset drops support for pre-allocated struct seq_file: it's
only of use in proc_namespace.c and can be easily replaced by using
seq_open_private()/seq_release_private().
Additionally, it documents the use of file->private_data to hold pointer
to struct seq_file by seq_open().
This patch (of 3):
Since patch described below, from v2.6.15-rc1, seq_open() could use a
struct seq_file already allocated by the caller if the pointer to the
structure is stored in file->private_data before calling the function.
Commit 1abe77b0fc4b485927f1f798ae81a752677e1d05
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Mon Nov 7 17:15:34 2005 -0500
[PATCH] allow callers of seq_open do allocation themselves
Allow caller of seq_open() to kmalloc() seq_file + whatever else they
want and set ->private_data to it. seq_open() will then abstain from
doing allocation itself.
Such behavior is only used by mounts_open_common().
In order to drop support for such uncommon feature, proc_mounts is
converted to use seq_open_private(), which take care of allocating the
proc_mounts structure, making it available through ->private in struct
seq_file.
Conversely, proc_mounts is converted to use seq_release_private(), in
order to release the private structure allocated by seq_open_private().
Then, ->private is used directly instead of proc_mounts() macro to access
to the proc_mounts structure.
Link: http://lkml.kernel.org/r/cover.1433193673.git.ydroneaud@opteya.com
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-07-01 05:57:30 +08:00
|
|
|
m = file->private_data;
|
|
|
|
m->poll_event = ns->event;
|
2011-12-07 01:21:54 +08:00
|
|
|
|
fs: use seq_open_private() for proc_mounts
A patchset to remove support for passing pre-allocated struct seq_file to
seq_open(). Such feature is undocumented and prone to error.
In particular, if seq_release() is used in release handler, it will
kfree() a pointer which was not allocated by seq_open().
So this patchset drops support for pre-allocated struct seq_file: it's
only of use in proc_namespace.c and can be easily replaced by using
seq_open_private()/seq_release_private().
Additionally, it documents the use of file->private_data to hold pointer
to struct seq_file by seq_open().
This patch (of 3):
Since patch described below, from v2.6.15-rc1, seq_open() could use a
struct seq_file already allocated by the caller if the pointer to the
structure is stored in file->private_data before calling the function.
Commit 1abe77b0fc4b485927f1f798ae81a752677e1d05
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Mon Nov 7 17:15:34 2005 -0500
[PATCH] allow callers of seq_open do allocation themselves
Allow caller of seq_open() to kmalloc() seq_file + whatever else they
want and set ->private_data to it. seq_open() will then abstain from
doing allocation itself.
Such behavior is only used by mounts_open_common().
In order to drop support for such uncommon feature, proc_mounts is
converted to use seq_open_private(), which take care of allocating the
proc_mounts structure, making it available through ->private in struct
seq_file.
Conversely, proc_mounts is converted to use seq_release_private(), in
order to release the private structure allocated by seq_open_private().
Then, ->private is used directly instead of proc_mounts() macro to access
to the proc_mounts structure.
Link: http://lkml.kernel.org/r/cover.1433193673.git.ydroneaud@opteya.com
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-07-01 05:57:30 +08:00
|
|
|
p = m->private;
|
2011-12-07 01:21:54 +08:00
|
|
|
p->ns = ns;
|
|
|
|
p->root = root;
|
|
|
|
p->show = show;
|
2014-02-28 03:40:10 +08:00
|
|
|
p->cached_event = ~0ULL;
|
2011-12-07 01:21:54 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_put_path:
|
|
|
|
path_put(&root);
|
|
|
|
err_put_ns:
|
|
|
|
put_mnt_ns(ns);
|
|
|
|
err:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int mounts_release(struct inode *inode, struct file *file)
|
|
|
|
{
|
fs: use seq_open_private() for proc_mounts
A patchset to remove support for passing pre-allocated struct seq_file to
seq_open(). Such feature is undocumented and prone to error.
In particular, if seq_release() is used in release handler, it will
kfree() a pointer which was not allocated by seq_open().
So this patchset drops support for pre-allocated struct seq_file: it's
only of use in proc_namespace.c and can be easily replaced by using
seq_open_private()/seq_release_private().
Additionally, it documents the use of file->private_data to hold pointer
to struct seq_file by seq_open().
This patch (of 3):
Since patch described below, from v2.6.15-rc1, seq_open() could use a
struct seq_file already allocated by the caller if the pointer to the
structure is stored in file->private_data before calling the function.
Commit 1abe77b0fc4b485927f1f798ae81a752677e1d05
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Mon Nov 7 17:15:34 2005 -0500
[PATCH] allow callers of seq_open do allocation themselves
Allow caller of seq_open() to kmalloc() seq_file + whatever else they
want and set ->private_data to it. seq_open() will then abstain from
doing allocation itself.
Such behavior is only used by mounts_open_common().
In order to drop support for such uncommon feature, proc_mounts is
converted to use seq_open_private(), which take care of allocating the
proc_mounts structure, making it available through ->private in struct
seq_file.
Conversely, proc_mounts is converted to use seq_release_private(), in
order to release the private structure allocated by seq_open_private().
Then, ->private is used directly instead of proc_mounts() macro to access
to the proc_mounts structure.
Link: http://lkml.kernel.org/r/cover.1433193673.git.ydroneaud@opteya.com
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-07-01 05:57:30 +08:00
|
|
|
struct seq_file *m = file->private_data;
|
|
|
|
struct proc_mounts *p = m->private;
|
2011-12-07 01:21:54 +08:00
|
|
|
path_put(&p->root);
|
|
|
|
put_mnt_ns(p->ns);
|
fs: use seq_open_private() for proc_mounts
A patchset to remove support for passing pre-allocated struct seq_file to
seq_open(). Such feature is undocumented and prone to error.
In particular, if seq_release() is used in release handler, it will
kfree() a pointer which was not allocated by seq_open().
So this patchset drops support for pre-allocated struct seq_file: it's
only of use in proc_namespace.c and can be easily replaced by using
seq_open_private()/seq_release_private().
Additionally, it documents the use of file->private_data to hold pointer
to struct seq_file by seq_open().
This patch (of 3):
Since patch described below, from v2.6.15-rc1, seq_open() could use a
struct seq_file already allocated by the caller if the pointer to the
structure is stored in file->private_data before calling the function.
Commit 1abe77b0fc4b485927f1f798ae81a752677e1d05
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Mon Nov 7 17:15:34 2005 -0500
[PATCH] allow callers of seq_open do allocation themselves
Allow caller of seq_open() to kmalloc() seq_file + whatever else they
want and set ->private_data to it. seq_open() will then abstain from
doing allocation itself.
Such behavior is only used by mounts_open_common().
In order to drop support for such uncommon feature, proc_mounts is
converted to use seq_open_private(), which take care of allocating the
proc_mounts structure, making it available through ->private in struct
seq_file.
Conversely, proc_mounts is converted to use seq_release_private(), in
order to release the private structure allocated by seq_open_private().
Then, ->private is used directly instead of proc_mounts() macro to access
to the proc_mounts structure.
Link: http://lkml.kernel.org/r/cover.1433193673.git.ydroneaud@opteya.com
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-07-01 05:57:30 +08:00
|
|
|
return seq_release_private(inode, file);
|
2011-12-07 01:21:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int mounts_open(struct inode *inode, struct file *file)
|
|
|
|
{
|
|
|
|
return mounts_open_common(inode, file, show_vfsmnt);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int mountinfo_open(struct inode *inode, struct file *file)
|
|
|
|
{
|
|
|
|
return mounts_open_common(inode, file, show_mountinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int mountstats_open(struct inode *inode, struct file *file)
|
|
|
|
{
|
|
|
|
return mounts_open_common(inode, file, show_vfsstat);
|
|
|
|
}
|
|
|
|
|
|
|
|
const struct file_operations proc_mounts_operations = {
|
|
|
|
.open = mounts_open,
|
|
|
|
.read = seq_read,
|
|
|
|
.llseek = seq_lseek,
|
|
|
|
.release = mounts_release,
|
|
|
|
.poll = mounts_poll,
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct file_operations proc_mountinfo_operations = {
|
|
|
|
.open = mountinfo_open,
|
|
|
|
.read = seq_read,
|
|
|
|
.llseek = seq_lseek,
|
|
|
|
.release = mounts_release,
|
|
|
|
.poll = mounts_poll,
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct file_operations proc_mountstats_operations = {
|
|
|
|
.open = mountstats_open,
|
|
|
|
.read = seq_read,
|
|
|
|
.llseek = seq_lseek,
|
|
|
|
.release = mounts_release,
|
|
|
|
};
|