summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/ext/disklayout
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/fs/ext/disklayout')
-rw-r--r--pkg/sentry/fs/ext/disklayout/inode.go11
-rw-r--r--pkg/sentry/fs/ext/disklayout/inode_old.go6
2 files changed, 9 insertions, 8 deletions
diff --git a/pkg/sentry/fs/ext/disklayout/inode.go b/pkg/sentry/fs/ext/disklayout/inode.go
index b48001910..9ab9a4988 100644
--- a/pkg/sentry/fs/ext/disklayout/inode.go
+++ b/pkg/sentry/fs/ext/disklayout/inode.go
@@ -107,16 +107,17 @@ type Inode interface {
// Flags returns InodeFlags which represents the inode flags.
Flags() InodeFlags
- // Blocks returns the underlying inode.i_block array. This field is special
- // and is used to store various kinds of things depending on the filesystem
- // version and inode type.
+ // Data returns the underlying inode.i_block array as a slice so it's
+ // modifiable. This field is special and is used to store various kinds of
+ // things depending on the filesystem version and inode type. The underlying
+ // field name in Linux is a little misleading.
// - In ext2/ext3, it contains the block map.
- // - In ext4, it contains the extent tree.
+ // - In ext4, it contains the extent tree root node.
// - For inline files, it contains the file contents.
// - For symlinks, it contains the link path (if it fits here).
//
// See https://www.kernel.org/doc/html/latest/filesystems/ext4/dynamic.html#the-contents-of-inode-i-block.
- Blocks() [60]byte
+ Data() []byte
}
// Inode flags. This is not comprehensive and flags which were not used in
diff --git a/pkg/sentry/fs/ext/disklayout/inode_old.go b/pkg/sentry/fs/ext/disklayout/inode_old.go
index dc4c9d8e4..7d7cc9143 100644
--- a/pkg/sentry/fs/ext/disklayout/inode_old.go
+++ b/pkg/sentry/fs/ext/disklayout/inode_old.go
@@ -47,7 +47,7 @@ type InodeOld struct {
BlocksCountLo uint32
FlagsRaw uint32
VersionLo uint32 // This is OS dependent.
- BlocksRaw [60]byte
+ DataRaw [60]byte
Generation uint32
FileACLLo uint32
SizeHi uint32
@@ -113,5 +113,5 @@ func (in *InodeOld) LinksCount() uint16 { return in.LinksCountRaw }
// Flags implements Inode.Flags.
func (in *InodeOld) Flags() InodeFlags { return InodeFlagsFromInt(in.FlagsRaw) }
-// Blocks implements Inode.Blocks.
-func (in *InodeOld) Blocks() [60]byte { return in.BlocksRaw }
+// Data implements Inode.Data.
+func (in *InodeOld) Data() []byte { return in.DataRaw[:] }