Allow a filesystem to control its visibility in /proc/filesystems.

PiperOrigin-RevId: 204508520
Change-Id: I09e5f8b6e69413370e1a0d39dbb7dc1ee0b6192d
This commit is contained in:
Neel Natu
2018-07-13 12:10:57 -07:00
committed by Shentubot
parent 68cf86b630
commit 5b09ec3b89
10 changed files with 47 additions and 0 deletions
+5
View File
@@ -49,6 +49,11 @@ func (*filesystem) AllowUserMount() bool {
return true
}
// AllowUserList allows this filesystem to be listed in /proc/filesystems.
func (*filesystem) AllowUserList() bool {
return true
}
// Flags returns that there is nothing special about this file system.
//
// In Linux, devtmpfs does the same thing.
+4
View File
@@ -55,6 +55,10 @@ type Filesystem interface {
// AllowUserMount determines whether mount(2) is allowed to mount a
// file system of this type.
AllowUserMount() bool
// AllowUserList determines whether this filesystem is listed in
// /proc/filesystems
AllowUserList() bool
}
// filesystems is the global set of registered file systems. It does not need
+5
View File
@@ -103,6 +103,11 @@ func (*filesystem) AllowUserMount() bool {
return false
}
// AllowUserList allows this filesystem to be listed in /proc/filesystems.
func (*filesystem) AllowUserList() bool {
return true
}
// Flags returns that there is nothing special about this file system.
//
// The 9p Linux client returns FS_RENAME_DOES_D_MOVE, see fs/9p/vfs_super.c.
+5
View File
@@ -66,6 +66,11 @@ func (*Filesystem) AllowUserMount() bool {
return false
}
// AllowUserList allows this filesystem to be listed in /proc/filesystems.
func (*Filesystem) AllowUserList() bool {
return true
}
// Flags returns that there is nothing special about this file system.
func (*Filesystem) Flags() fs.FilesystemFlags {
return 0
+5
View File
@@ -89,6 +89,11 @@ func (ofs *overlayFilesystem) AllowUserMount() bool {
return false
}
// AllowUserList implements Filesystem.AllowUserList.
func (*overlayFilesystem) AllowUserList() bool {
return true
}
// Mount implements Filesystem.Mount.
func (ofs *overlayFilesystem) Mount(ctx context.Context, device string, flags MountSourceFlags, data string) (*Inode, error) {
panic("overlayFilesystem.Mount should not be called!")
+3
View File
@@ -43,6 +43,9 @@ func (*filesystemsData) ReadSeqFileData(ctx context.Context, h seqfile.SeqHandle
// Generate the file contents.
var buf bytes.Buffer
for _, sys := range fs.GetFilesystems() {
if !sys.AllowUserList() {
continue
}
nodev := "nodev"
if sys.Flags()&fs.FilesystemRequiresDev != 0 {
nodev = ""
+5
View File
@@ -42,6 +42,11 @@ func (*filesystem) AllowUserMount() bool {
return true
}
// AllowUserList allows this filesystem to be listed in /proc/filesystems.
func (*filesystem) AllowUserList() bool {
return true
}
// Flags returns that there is nothing special about this file system.
//
// In Linux, proc returns FS_USERNS_VISIBLE | FS_USERNS_MOUNT, see fs/proc/root.c.
+5
View File
@@ -40,6 +40,11 @@ func (*filesystem) AllowUserMount() bool {
return true
}
// AllowUserList allows this filesystem to be listed in /proc/filesystems.
func (*filesystem) AllowUserList() bool {
return true
}
// Flags returns that there is nothing special about this file system.
//
// In Linux, sysfs returns FS_USERNS_VISIBLE | FS_USERNS_MOUNT, see fs/sysfs/mount.c.
+5
View File
@@ -67,6 +67,11 @@ func (*Filesystem) AllowUserMount() bool {
return true
}
// AllowUserList allows this filesystem to be listed in /proc/filesystems.
func (*Filesystem) AllowUserList() bool {
return true
}
// Flags returns that there is nothing special about this file system.
//
// In Linux, tmpfs returns FS_USERNS_MOUNT, see mm/shmem.c.
+5
View File
@@ -46,6 +46,11 @@ func (*filesystem) AllowUserMount() bool {
return false
}
// AllowUserList allows this filesystem to be listed in /proc/filesystems.
func (*filesystem) AllowUserList() bool {
return true
}
// Flags returns that there is nothing special about this file system.
func (*filesystem) Flags() fs.FilesystemFlags {
return 0