summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/tmpfs/tmpfs.go
diff options
context:
space:
mode:
authorAdin Scannell <adin@scannell.ca>2019-01-24 17:01:20 -0800
committerShentubot <shentubot@google.com>2019-01-24 17:02:52 -0800
commitb5088ba59c4b6e6fe19a38e15a5472d36f80b397 (patch)
tree52dcf10f7e28d91ff3c9b921d98a98eb0108fd88 /pkg/sentry/fs/tmpfs/tmpfs.go
parent01679f3b5ab957c274690a62f0fce5d332ee94af (diff)
cleanup: extract the kernel from context
Change-Id: I94704a90beebb53164325e0cce1fcb9a0b97d65c PiperOrigin-RevId: 230817308
Diffstat (limited to 'pkg/sentry/fs/tmpfs/tmpfs.go')
-rw-r--r--pkg/sentry/fs/tmpfs/tmpfs.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/sentry/fs/tmpfs/tmpfs.go b/pkg/sentry/fs/tmpfs/tmpfs.go
index a0277a132..4b1762ce4 100644
--- a/pkg/sentry/fs/tmpfs/tmpfs.go
+++ b/pkg/sentry/fs/tmpfs/tmpfs.go
@@ -81,10 +81,10 @@ type Dir struct {
var _ fs.InodeOperations = (*Dir)(nil)
// NewDir returns a new directory.
-func NewDir(ctx context.Context, contents map[string]*fs.Inode, owner fs.FileOwner, perms fs.FilePermissions, msrc *fs.MountSource, kernel *kernel.Kernel) *fs.Inode {
+func NewDir(ctx context.Context, contents map[string]*fs.Inode, owner fs.FileOwner, perms fs.FilePermissions, msrc *fs.MountSource) *fs.Inode {
d := &Dir{
ramfsDir: ramfs.NewDir(ctx, contents, owner, perms),
- kernel: kernel,
+ kernel: kernel.KernelFromContext(ctx),
}
// Manually set the CreateOps.
@@ -208,7 +208,7 @@ func (d *Dir) SetTimestamps(ctx context.Context, i *fs.Inode, ts fs.TimeSpec) er
func (d *Dir) newCreateOps() *ramfs.CreateOps {
return &ramfs.CreateOps{
NewDir: func(ctx context.Context, dir *fs.Inode, perms fs.FilePermissions) (*fs.Inode, error) {
- return NewDir(ctx, nil, fs.FileOwnerFromContext(ctx), perms, dir.MountSource, d.kernel), nil
+ return NewDir(ctx, nil, fs.FileOwnerFromContext(ctx), perms, dir.MountSource), nil
},
NewFile: func(ctx context.Context, dir *fs.Inode, perms fs.FilePermissions) (*fs.Inode, error) {
uattr := fs.WithCurrentTime(ctx, fs.UnstableAttr{
@@ -217,7 +217,7 @@ func (d *Dir) newCreateOps() *ramfs.CreateOps {
// Always start unlinked.
Links: 0,
})
- iops := NewInMemoryFile(ctx, usage.Tmpfs, uattr, d.kernel)
+ iops := NewInMemoryFile(ctx, usage.Tmpfs, uattr)
return fs.NewInode(iops, dir.MountSource, fs.StableAttr{
DeviceID: tmpfsDevice.DeviceID(),
InodeID: tmpfsDevice.NextIno(),