From 7e38d643334647fb79c7cc8be35745699de264e6 Mon Sep 17 00:00:00 2001 From: Ayush Ranjan Date: Tue, 23 Jul 2019 20:34:49 -0700 Subject: ext: Inode creation logic. PiperOrigin-RevId: 259666476 --- pkg/sentry/fs/ext/disklayout/inode_new.go | 2 +- pkg/sentry/fs/ext/disklayout/inode_old.go | 6 +++--- pkg/sentry/fs/ext/disklayout/inode_test.go | 2 +- pkg/sentry/fs/ext/disklayout/superblock_old.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'pkg/sentry/fs/ext/disklayout') diff --git a/pkg/sentry/fs/ext/disklayout/inode_new.go b/pkg/sentry/fs/ext/disklayout/inode_new.go index 4f5348372..8f9f574ce 100644 --- a/pkg/sentry/fs/ext/disklayout/inode_new.go +++ b/pkg/sentry/fs/ext/disklayout/inode_new.go @@ -62,7 +62,7 @@ func (in *InodeNew) Size() uint64 { // InodeSize implements Inode.InodeSize. func (in *InodeNew) InodeSize() uint16 { - return oldInodeSize + in.ExtraInodeSize + return OldInodeSize + in.ExtraInodeSize } // ChangeTime implements Inode.ChangeTime. diff --git a/pkg/sentry/fs/ext/disklayout/inode_old.go b/pkg/sentry/fs/ext/disklayout/inode_old.go index 7d7cc9143..db25b11b6 100644 --- a/pkg/sentry/fs/ext/disklayout/inode_old.go +++ b/pkg/sentry/fs/ext/disklayout/inode_old.go @@ -21,8 +21,8 @@ import ( ) const ( - // oldInodeSize is the inode size in ext2/ext3. - oldInodeSize = 128 + // OldInodeSize is the inode size in ext2/ext3. + OldInodeSize = 128 ) // InodeOld implements Inode interface. It emulates ext2/ext3 inode struct. @@ -85,7 +85,7 @@ func (in *InodeOld) Size() uint64 { } // InodeSize implements Inode.InodeSize. -func (in *InodeOld) InodeSize() uint16 { return oldInodeSize } +func (in *InodeOld) InodeSize() uint16 { return OldInodeSize } // AccessTime implements Inode.AccessTime. func (in *InodeOld) AccessTime() time.Time { diff --git a/pkg/sentry/fs/ext/disklayout/inode_test.go b/pkg/sentry/fs/ext/disklayout/inode_test.go index 9cae9e4f0..dd03ee50e 100644 --- a/pkg/sentry/fs/ext/disklayout/inode_test.go +++ b/pkg/sentry/fs/ext/disklayout/inode_test.go @@ -24,7 +24,7 @@ import ( // TestInodeSize tests that the inode structs are of the correct size. func TestInodeSize(t *testing.T) { - assertSize(t, InodeOld{}, oldInodeSize) + assertSize(t, InodeOld{}, OldInodeSize) // This was updated from 156 bytes to 160 bytes in Oct 2015. assertSize(t, InodeNew{}, 160) diff --git a/pkg/sentry/fs/ext/disklayout/superblock_old.go b/pkg/sentry/fs/ext/disklayout/superblock_old.go index aada8b550..5a64aaaa1 100644 --- a/pkg/sentry/fs/ext/disklayout/superblock_old.go +++ b/pkg/sentry/fs/ext/disklayout/superblock_old.go @@ -81,7 +81,7 @@ func (sb *SuperBlockOld) ClusterSize() uint64 { return 1 << (10 + sb.LogClusterS func (sb *SuperBlockOld) ClustersPerGroup() uint32 { return sb.ClustersPerGroupRaw } // InodeSize implements SuperBlock.InodeSize. -func (sb *SuperBlockOld) InodeSize() uint16 { return oldInodeSize } +func (sb *SuperBlockOld) InodeSize() uint16 { return OldInodeSize } // InodesPerGroup implements SuperBlock.InodesPerGroup. func (sb *SuperBlockOld) InodesPerGroup() uint32 { return sb.InodesPerGroupRaw } -- cgit v1.2.3