mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Set the FilesytemType in MountSource from the Filesystem.
And stop storing the Filesystem in the MountSource. This allows us to decouple the MountSource filesystem type from the name of the filesystem. PiperOrigin-RevId: 247292982 Change-Id: I49cbcce3c17883b7aa918ba76203dfd6d1b03cc8
This commit is contained in:
committed by
Shentubot
parent
cbf6ab9697
commit
bfd9f75ba4
@@ -110,9 +110,8 @@ type MountSource struct {
|
||||
// MountSourceOperations defines filesystem specific behavior.
|
||||
MountSourceOperations
|
||||
|
||||
// Filesystem is the filesystem backing the mount. Can be nil if there
|
||||
// is no filesystem backing the mount.
|
||||
Filesystem Filesystem
|
||||
// FilesystemType is the type of the filesystem backing this mount.
|
||||
FilesystemType string
|
||||
|
||||
// Flags are the flags that this filesystem was mounted with.
|
||||
Flags MountSourceFlags
|
||||
@@ -158,10 +157,14 @@ const DefaultDirentCacheSize uint64 = 1000
|
||||
// NewMountSource returns a new MountSource. Filesystem may be nil if there is no
|
||||
// filesystem backing the mount.
|
||||
func NewMountSource(mops MountSourceOperations, filesystem Filesystem, flags MountSourceFlags) *MountSource {
|
||||
fsType := "none"
|
||||
if filesystem != nil {
|
||||
fsType = filesystem.Name()
|
||||
}
|
||||
return &MountSource{
|
||||
MountSourceOperations: mops,
|
||||
Flags: flags,
|
||||
Filesystem: filesystem,
|
||||
FilesystemType: fsType,
|
||||
fscache: NewDirentCache(DefaultDirentCacheSize),
|
||||
children: make(map[*MountSource]struct{}),
|
||||
}
|
||||
|
||||
@@ -139,11 +139,7 @@ func (mif *mountInfoFile) ReadSeqFileData(ctx context.Context, handle seqfile.Se
|
||||
fmt.Fprintf(&buf, "- ")
|
||||
|
||||
// (9) Filesystem type.
|
||||
name := "none"
|
||||
if m.Filesystem != nil {
|
||||
name = m.Filesystem.Name()
|
||||
}
|
||||
fmt.Fprintf(&buf, "%s ", name)
|
||||
fmt.Fprintf(&buf, "%s ", m.FilesystemType)
|
||||
|
||||
// (10) Mount source: filesystem-specific information or "none".
|
||||
fmt.Fprintf(&buf, "none ")
|
||||
@@ -190,11 +186,7 @@ func (mf *mountsFile) ReadSeqFileData(ctx context.Context, handle seqfile.SeqHan
|
||||
if m.Flags.ReadOnly {
|
||||
opts = "ro"
|
||||
}
|
||||
name := "none"
|
||||
if m.Filesystem != nil {
|
||||
name = m.Filesystem.Name()
|
||||
}
|
||||
fmt.Fprintf(&buf, "%s %s %s %s %d %d\n", "none", mountPath, name, opts, 0, 0)
|
||||
fmt.Fprintf(&buf, "%s %s %s %s %d %d\n", "none", mountPath, m.FilesystemType, opts, 0, 0)
|
||||
})
|
||||
|
||||
return []seqfile.SeqData{{Buf: buf.Bytes(), Handle: (*mountsFile)(nil)}}, 0
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
load("//tools/go_stateify:defs.bzl", "go_library", "go_test")
|
||||
|
||||
package(licenses = ["notice"]) # Apache 2.0
|
||||
package(
|
||||
licenses = ["notice"], # Apache 2.0
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "muxed",
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
package(licenses = ["notice"]) # Apache 2.0
|
||||
package(
|
||||
licenses = ["notice"], # Apache 2.0
|
||||
)
|
||||
|
||||
load("//tools/go_generics:defs.bzl", "go_template_instance")
|
||||
load("//tools/go_stateify:defs.bzl", "go_library")
|
||||
|
||||
+3
-1
@@ -1,4 +1,6 @@
|
||||
package(licenses = ["notice"]) # Apache 2.0
|
||||
package(
|
||||
licenses = ["notice"], # Apache 2.0
|
||||
)
|
||||
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_binary")
|
||||
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_deb", "pkg_tar")
|
||||
|
||||
Reference in New Issue
Block a user