diff options
author | Ayush Ranjan <ayushranjan@google.com> | 2019-07-23 18:59:55 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-07-23 19:01:05 -0700 |
commit | d7bb79b6f177e8c58d47695e0ee1a072475463c4 (patch) | |
tree | e9c9f6a6ad9b5267850fbfe1702adc2afee67fb4 /pkg/sentry/fs | |
parent | bd7708956f0c9e00e88eff9b35b22eea75e71f5f (diff) |
ext: Add ext2 and ext3 tiny images.
PiperOrigin-RevId: 259657917
Diffstat (limited to 'pkg/sentry/fs')
-rw-r--r-- | pkg/sentry/fs/ext/assets/README.md | 24 | ||||
-rw-r--r-- | pkg/sentry/fs/ext/assets/tiny.ext2 | bin | 0 -> 65536 bytes | |||
-rw-r--r-- | pkg/sentry/fs/ext/assets/tiny.ext3 | bin | 0 -> 65536 bytes | |||
-rw-r--r-- | pkg/sentry/fs/ext/extent_test.go | 3 |
4 files changed, 18 insertions, 9 deletions
diff --git a/pkg/sentry/fs/ext/assets/README.md b/pkg/sentry/fs/ext/assets/README.md index b6eac4f40..6f1e81b3a 100644 --- a/pkg/sentry/fs/ext/assets/README.md +++ b/pkg/sentry/fs/ext/assets/README.md @@ -1,19 +1,21 @@ -### Tiny Ext4 Image +### Tiny Ext(2/3/4) Images -The image is of size 64Kb which supports 64 1k blocks and 16 inodes. This is the -smallest size mkfs.ext4 works with. +The images are of size 64Kb which supports 64 1k blocks and 16 inodes. This is +the smallest size mkfs.ext(2/3/4) works with. -This image was generated using the following commands. +These images were generated using the following commands. ```bash -fallocate -l 64K tiny.ext4 -mkfs.ext4 -j tiny.ext4 +fallocate -l 64K tiny.ext$VERSION +mkfs.ext$VERSION -j tiny.ext$VERSION ``` +where `VERSION` is `2`, `3` or `4`. + You can mount it using: ```bash -sudo mount -o loop tiny.ext4 $MOUNTPOINT +sudo mount -o loop tiny.ext$VERSION $MOUNTPOINT ``` `file.txt`, `bigfile.txt` and `symlink.txt` were added to this image by just @@ -21,8 +23,14 @@ mounting it and copying (while preserving links) those files to the mountpoint directory using: ```bash -sudo cp -P {file.txt,symlink.txt,bigfile.txt} $MOUNTPOINT/ +sudo cp -P {file.txt,symlink.txt,bigfile.txt} $MOUNTPOINT ``` The files in this directory mirror the contents and organisation of the files stored in the image. + +You can umount the filesystem using: + +```bash +sudo umount $MOUNTPOINT +``` diff --git a/pkg/sentry/fs/ext/assets/tiny.ext2 b/pkg/sentry/fs/ext/assets/tiny.ext2 Binary files differnew file mode 100644 index 000000000..381ade9bf --- /dev/null +++ b/pkg/sentry/fs/ext/assets/tiny.ext2 diff --git a/pkg/sentry/fs/ext/assets/tiny.ext3 b/pkg/sentry/fs/ext/assets/tiny.ext3 Binary files differnew file mode 100644 index 000000000..0e97a324c --- /dev/null +++ b/pkg/sentry/fs/ext/assets/tiny.ext3 diff --git a/pkg/sentry/fs/ext/extent_test.go b/pkg/sentry/fs/ext/extent_test.go index c8c52f836..9e55187e5 100644 --- a/pkg/sentry/fs/ext/extent_test.go +++ b/pkg/sentry/fs/ext/extent_test.go @@ -145,7 +145,8 @@ func TestExtentTree(t *testing.T) { t.Fatalf("inode.buildExtTree failed: %v", err) } - if diff := cmp.Diff(&mockInode.root, node0, cmpopts.IgnoreUnexported(disklayout.ExtentNode{})); diff != "" { + opt := cmpopts.IgnoreUnexported(disklayout.ExtentIdx{}, disklayout.ExtentHeader{}) + if diff := cmp.Diff(&mockInode.root, node0, opt); diff != "" { t.Errorf("extent tree mismatch (-want +got):\n%s", diff) } } |