From 645af7cdd8a183ce80218b1ad275001084c133ce Mon Sep 17 00:00:00 2001 From: Nicolas Lacasse Date: Wed, 27 Mar 2019 11:07:41 -0700 Subject: Dev device methods should take pointer receiver. PiperOrigin-RevId: 240600504 Change-Id: I7dd5f27c8da31f24b68b48acdf8f1c19dbd0c32d --- pkg/sentry/fs/dev/dev.go | 2 +- pkg/sentry/fs/dev/full.go | 2 +- pkg/sentry/fs/dev/random.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/sentry/fs/dev/dev.go b/pkg/sentry/fs/dev/dev.go index 2ec4c9bff..e1eaa08cb 100644 --- a/pkg/sentry/fs/dev/dev.go +++ b/pkg/sentry/fs/dev/dev.go @@ -117,6 +117,6 @@ func New(ctx context.Context, msrc *fs.MountSource, binderEnabled bool, ashmemEn type readZeros struct{} // Read implements fs.FileOperations.Read. -func (readZeros) Read(ctx context.Context, file *fs.File, dst usermem.IOSequence, offset int64) (int64, error) { +func (*readZeros) Read(ctx context.Context, file *fs.File, dst usermem.IOSequence, offset int64) (int64, error) { return dst.ZeroOut(ctx, math.MaxInt64) } diff --git a/pkg/sentry/fs/dev/full.go b/pkg/sentry/fs/dev/full.go index cbdd40161..0cb513004 100644 --- a/pkg/sentry/fs/dev/full.go +++ b/pkg/sentry/fs/dev/full.go @@ -73,6 +73,6 @@ type fullFileOperations struct { var _ fs.FileOperations = (*fullFileOperations)(nil) // Write implements FileOperations.Write. -func (fullFileOperations) Write(context.Context, *fs.File, usermem.IOSequence, int64) (int64, error) { +func (*fullFileOperations) Write(context.Context, *fs.File, usermem.IOSequence, int64) (int64, error) { return 0, syserror.ENOSPC } diff --git a/pkg/sentry/fs/dev/random.go b/pkg/sentry/fs/dev/random.go index 837b7793a..b9b78db7a 100644 --- a/pkg/sentry/fs/dev/random.go +++ b/pkg/sentry/fs/dev/random.go @@ -51,7 +51,7 @@ func newRandomDevice(ctx context.Context, owner fs.FileOwner, mode linux.FileMod } // GetFile implements fs.InodeOperations.GetFile. -func (randomDevice) GetFile(ctx context.Context, dirent *fs.Dirent, flags fs.FileFlags) (*fs.File, error) { +func (*randomDevice) GetFile(ctx context.Context, dirent *fs.Dirent, flags fs.FileFlags) (*fs.File, error) { return fs.NewFile(ctx, dirent, flags, &randomFileOperations{}), nil } @@ -71,6 +71,6 @@ type randomFileOperations struct { var _ fs.FileOperations = (*randomFileOperations)(nil) // Read implements fs.FileOperations.Read. -func (randomFileOperations) Read(ctx context.Context, _ *fs.File, dst usermem.IOSequence, _ int64) (int64, error) { +func (*randomFileOperations) Read(ctx context.Context, _ *fs.File, dst usermem.IOSequence, _ int64) (int64, error) { return dst.CopyOutFrom(ctx, safemem.FromIOReader{rand.Reader}) } -- cgit v1.2.3