mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Add FilesystemType.Name method, and FilesystemType field to Filesystem struct.
Both have analogues in Linux: * struct file_system_type has a char *name field. * struct super_block keeps a pointer to the file_system_type. These fields are necessary to support the `filesystem type` field in /proc/[pid]/mountinfo. PiperOrigin-RevId: 303434063
This commit is contained in:
committed by
gVisor bot
parent
2a4aff7f7e
commit
10f2c8db91
@@ -63,6 +63,11 @@ type filesystem struct {
|
||||
nextInoMinusOne uint64 // accessed using atomic memory operations
|
||||
}
|
||||
|
||||
// Name implements vfs.FilesystemType.Name.
|
||||
func (FilesystemType) Name() string {
|
||||
return Name
|
||||
}
|
||||
|
||||
// GetFilesystem implements vfs.FilesystemType.GetFilesystem.
|
||||
func (fstype FilesystemType) GetFilesystem(ctx context.Context, vfsObj *vfs.VirtualFilesystem, creds *auth.Credentials, source string, opts vfs.GetFilesystemOptions) (*vfs.Filesystem, *vfs.Dentry, error) {
|
||||
memFileProvider := pgalloc.MemoryFileProviderFromContext(ctx)
|
||||
@@ -74,7 +79,7 @@ func (fstype FilesystemType) GetFilesystem(ctx context.Context, vfsObj *vfs.Virt
|
||||
memFile: memFileProvider.MemoryFile(),
|
||||
clock: clock,
|
||||
}
|
||||
fs.vfsfs.Init(vfsObj, &fs)
|
||||
fs.vfsfs.Init(vfsObj, &fstype, &fs)
|
||||
root := fs.newDentry(fs.newDirectory(creds, 01777))
|
||||
return &fs.vfsfs, &root.vfsd, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user