From 5822be994224da27cacf5bb253c9a4bad2aa19c0 Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Sun, 8 Mar 2020 01:09:36 +0300 Subject: [PATCH] Disable disk cache in tests. It is useless since host OS cache is used anyway. It also slows down coverage collection because of many taken branches. Specialized tests should be written to test disk cache specifically. --- ...#xfs_#s05k_ls_all_dir_types_ftype1.ref.log | 2 +- ...f70s1_#xfs_#s05k_ls_all_dir_types_ftype1.t | 2 +- ...#xfs_#s05k_ls_all_dir_types_ftype0.ref.log | 2 +- ...f70s1_#xfs_#s05k_ls_all_dir_types_ftype0.t | 2 +- ...70s0_#xfs_#s05k_read_without_holes.ref.log | 2 +- ...f70_#f70s0_#xfs_#s05k_read_without_holes.t | 2 +- test/004_#f70_#f70s5_#xfs_stat.ref.log | 2 +- test/004_#f70_#f70s5_#xfs_stat.t | 2 +- test/005_#f30_#xfs_cur_dir.ref.log | 2 +- test/005_#f30_#xfs_cur_dir.t | 2 +- ..._#f70s0_#xfs_#s05k_read_with_holes.ref.log | 2 +- ...6_#f70_#f70s0_#xfs_#s05k_read_with_holes.t | 2 +- test/007_#f70_#xfs_#lookup_all.ref.log | 2 +- test/007_#f70_#xfs_#lookup_all.t | 2 +- ..._#xfs_#s4k_ls_all_dir_types_ftype0.ref.log | 2 +- ...#f70s1_#xfs_#s4k_ls_all_dir_types_ftype0.t | 2 +- ...70_#f70s0_#f70s1_#xfs_#s05k_#xattr.ref.log | 2 +- ...009_#f70_#f70s0_#f70s1_#xfs_#s05k_#xattr.t | 2 +- test/010_#f70_#xfs_#lookup_#xattr_all.ref.log | 2 +- test/010_#f70_#xfs_#lookup_#xattr_all.t | 2 +- ...0_#f70s1_#xfs_#lookup_#unicode_all.ref.log | 2 +- ...11_#f70_#f70s1_#xfs_#lookup_#unicode_all.t | 2 +- ..._#v5_#s05k_ls_all_dir_types_ftype1.ref.log | 2 +- ...1_#xfs_#v5_#s05k_ls_all_dir_types_ftype1.t | 2 +- test/013_#f70_#xfs_#v5_#lookup_all.ref.log | 2 +- test/013_#f70_#xfs_#v5_#lookup_all.t | 2 +- ...0s0_#xfs_#v5_#s05k_read_with_holes.ref.log | 2 +- ...70_#f70s0_#xfs_#v5_#s05k_read_with_holes.t | 2 +- ..._#xfs_#v5_#s05k_read_without_holes.ref.log | 2 +- ...#f70s0_#xfs_#v5_#s05k_read_without_holes.t | 2 +- test/016_#f01_#draw_all.ref.log | 2 +- test/016_#f01_#draw_all.t | 2 +- test/makefile | 4 +-- umka.asm | 3 ++ umka_fuse.c | 2 +- umka_shell.c | 32 ++++++++++++++++--- vdisk.c | 21 +++++++----- vdisk.h | 10 +++--- 38 files changed, 84 insertions(+), 52 deletions(-) diff --git a/test/001_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype1.ref.log b/test/001_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype1.ref.log index 636bfc4..f8ded10 100644 --- a/test/001_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype1.ref.log +++ b/test/001_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype1.ref.log @@ -1,4 +1,4 @@ -/> disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.img hd0 +/> disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.img hd0 -c 0 /hd0/1: xfs /> ls70 /hd0/1/sf_empty status = 6 end_of_file, count = 2 diff --git a/test/001_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype1.t b/test/001_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype1.t index b4cd75b..59f3ec8 100644 --- a/test/001_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype1.t +++ b/test/001_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype1.t @@ -1,4 +1,4 @@ -disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.img hd0 +disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.img hd0 -c 0 ls70 /hd0/1/sf_empty ls70 /hd0/1/sf ls70 /hd0/1/block diff --git a/test/002_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype0.ref.log b/test/002_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype0.ref.log index 780d769..e3b7ae8 100644 --- a/test/002_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype0.ref.log +++ b/test/002_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype0.ref.log @@ -1,4 +1,4 @@ -/> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k.img hd0 +/> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k.img hd0 -c 0 /hd0/1: xfs /> ls70 /hd0/1/sf_empty status = 6 end_of_file, count = 2 diff --git a/test/002_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype0.t b/test/002_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype0.t index c467d2e..1a3b452 100644 --- a/test/002_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype0.t +++ b/test/002_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype0.t @@ -1,4 +1,4 @@ -disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k.img hd0 +disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k.img hd0 -c 0 ls70 /hd0/1/sf_empty ls70 /hd0/1/sf ls70 /hd0/1/block diff --git a/test/003_#f70_#f70s0_#xfs_#s05k_read_without_holes.ref.log b/test/003_#f70_#f70s0_#xfs_#s05k_read_without_holes.ref.log index 4c3baf7..b233a60 100644 --- a/test/003_#f70_#f70s0_#xfs_#s05k_read_without_holes.ref.log +++ b/test/003_#f70_#f70s0_#xfs_#s05k_read_without_holes.ref.log @@ -1,4 +1,4 @@ -/> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 +/> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0 /hd0/1: xfs # zero length /> read70 /hd0/1/no_hole 0 0 -b diff --git a/test/003_#f70_#f70s0_#xfs_#s05k_read_without_holes.t b/test/003_#f70_#f70s0_#xfs_#s05k_read_without_holes.t index 0439652..d84b43a 100644 --- a/test/003_#f70_#f70s0_#xfs_#s05k_read_without_holes.t +++ b/test/003_#f70_#f70s0_#xfs_#s05k_read_without_holes.t @@ -1,4 +1,4 @@ -disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 +disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0 # zero length read70 /hd0/1/no_hole 0 0 -b read70 /hd0/1/no_hole 1 0 -b diff --git a/test/004_#f70_#f70s5_#xfs_stat.ref.log b/test/004_#f70_#f70s5_#xfs_stat.ref.log index 7dddaf9..02ea508 100644 --- a/test/004_#f70_#f70s5_#xfs_stat.ref.log +++ b/test/004_#f70_#f70s5_#xfs_stat.ref.log @@ -1,4 +1,4 @@ -/> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 +/> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0 /hd0/1: xfs /> stat70 /hd0/1/ status = 0 success diff --git a/test/004_#f70_#f70s5_#xfs_stat.t b/test/004_#f70_#f70s5_#xfs_stat.t index a788b31..735d9fc 100644 --- a/test/004_#f70_#f70s5_#xfs_stat.t +++ b/test/004_#f70_#f70s5_#xfs_stat.t @@ -1,4 +1,4 @@ -disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 +disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0 stat70 /hd0/1/ stat70 /hd0/1/hole_begin disk_del hd0 diff --git a/test/005_#f30_#xfs_cur_dir.ref.log b/test/005_#f30_#xfs_cur_dir.ref.log index d8f8c94..2050223 100644 --- a/test/005_#f30_#xfs_cur_dir.ref.log +++ b/test/005_#f30_#xfs_cur_dir.ref.log @@ -1,4 +1,4 @@ -/> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 +/> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0 /hd0/1: xfs /> pwd / diff --git a/test/005_#f30_#xfs_cur_dir.t b/test/005_#f30_#xfs_cur_dir.t index 14b4227..3f8d762 100644 --- a/test/005_#f30_#xfs_cur_dir.t +++ b/test/005_#f30_#xfs_cur_dir.t @@ -1,4 +1,4 @@ -disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 +disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0 pwd cd /hd0 pwd diff --git a/test/006_#f70_#f70s0_#xfs_#s05k_read_with_holes.ref.log b/test/006_#f70_#f70s0_#xfs_#s05k_read_with_holes.ref.log index 580c437..ed7f51e 100644 --- a/test/006_#f70_#f70s0_#xfs_#s05k_read_with_holes.ref.log +++ b/test/006_#f70_#f70s0_#xfs_#s05k_read_with_holes.ref.log @@ -1,4 +1,4 @@ -/> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 +/> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0 /hd0/1: xfs # hole begin # zero length diff --git a/test/006_#f70_#f70s0_#xfs_#s05k_read_with_holes.t b/test/006_#f70_#f70s0_#xfs_#s05k_read_with_holes.t index e4255e1..e4de391 100644 --- a/test/006_#f70_#f70s0_#xfs_#s05k_read_with_holes.t +++ b/test/006_#f70_#f70s0_#xfs_#s05k_read_with_holes.t @@ -1,4 +1,4 @@ -disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 +disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0 # hole begin # zero length read70 /hd0/1/hole_begin 0 0 -b diff --git a/test/007_#f70_#xfs_#lookup_all.ref.log b/test/007_#f70_#xfs_#lookup_all.ref.log index ed55687..9e5d627 100644 --- a/test/007_#f70_#xfs_#lookup_all.ref.log +++ b/test/007_#f70_#xfs_#lookup_all.ref.log @@ -1,4 +1,4 @@ -/> disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.img hd0 +/> disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.img hd0 -c 0 /hd0/1: xfs /> stat70 /hd0/1/sf_empty status = 0 success diff --git a/test/007_#f70_#xfs_#lookup_all.t b/test/007_#f70_#xfs_#lookup_all.t index 0f5f58e..1e9674d 100644 --- a/test/007_#f70_#xfs_#lookup_all.t +++ b/test/007_#f70_#xfs_#lookup_all.t @@ -1,4 +1,4 @@ -disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.img hd0 +disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.img hd0 -c 0 stat70 /hd0/1/sf_empty stat70 /hd0/1/sf_empty/. stat70 /hd0/1/sf_empty/.. diff --git a/test/008_#f70_#f70s1_#xfs_#s4k_ls_all_dir_types_ftype0.ref.log b/test/008_#f70_#f70s1_#xfs_#s4k_ls_all_dir_types_ftype0.ref.log index 791d926..7d9d2a4 100644 --- a/test/008_#f70_#f70s1_#xfs_#s4k_ls_all_dir_types_ftype0.ref.log +++ b/test/008_#f70_#f70s1_#xfs_#s4k_ls_all_dir_types_ftype0.ref.log @@ -1,4 +1,4 @@ -/> disk_add ../img/xfs_v4_ftype0_s4k_b4k_n8k.img hd0 +/> disk_add ../img/xfs_v4_ftype0_s4k_b4k_n8k.img hd0 -c 0 /hd0/1: xfs /> ls70 /hd0/1/sf status = 6 end_of_file, count = 5 diff --git a/test/008_#f70_#f70s1_#xfs_#s4k_ls_all_dir_types_ftype0.t b/test/008_#f70_#f70s1_#xfs_#s4k_ls_all_dir_types_ftype0.t index a314160..a2bc1b8 100644 --- a/test/008_#f70_#f70s1_#xfs_#s4k_ls_all_dir_types_ftype0.t +++ b/test/008_#f70_#f70s1_#xfs_#s4k_ls_all_dir_types_ftype0.t @@ -1,4 +1,4 @@ -disk_add ../img/xfs_v4_ftype0_s4k_b4k_n8k.img hd0 +disk_add ../img/xfs_v4_ftype0_s4k_b4k_n8k.img hd0 -c 0 ls70 /hd0/1/sf ls70 /hd0/1/block ls70 /hd0/1/leaf diff --git a/test/009_#f70_#f70s0_#f70s1_#xfs_#s05k_#xattr.ref.log b/test/009_#f70_#f70s0_#f70s1_#xfs_#s05k_#xattr.ref.log index 450fe3e..682338e 100644 --- a/test/009_#f70_#f70s0_#f70s1_#xfs_#s05k_#xattr.ref.log +++ b/test/009_#f70_#f70s0_#f70s1_#xfs_#s05k_#xattr.ref.log @@ -1,4 +1,4 @@ -/> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.img hd0 +/> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.img hd0 -c 0 /hd0/1: xfs /> ls70 /hd0/1/sf_empty status = 6 end_of_file, count = 2 diff --git a/test/009_#f70_#f70s0_#f70s1_#xfs_#s05k_#xattr.t b/test/009_#f70_#f70s0_#f70s1_#xfs_#s05k_#xattr.t index 1f04c51..4795eca 100644 --- a/test/009_#f70_#f70s0_#f70s1_#xfs_#s05k_#xattr.t +++ b/test/009_#f70_#f70s0_#f70s1_#xfs_#s05k_#xattr.t @@ -1,4 +1,4 @@ -disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.img hd0 +disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.img hd0 -c 0 ls70 /hd0/1/sf_empty ls70 /hd0/1/sf ls70 /hd0/1/block diff --git a/test/010_#f70_#xfs_#lookup_#xattr_all.ref.log b/test/010_#f70_#xfs_#lookup_#xattr_all.ref.log index d8b29a1..e1d703f 100644 --- a/test/010_#f70_#xfs_#lookup_#xattr_all.ref.log +++ b/test/010_#f70_#xfs_#lookup_#xattr_all.ref.log @@ -1,4 +1,4 @@ -/> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.img hd0 +/> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.img hd0 -c 0 /hd0/1: xfs /> stat70 /hd0/1/sf_empty status = 0 success diff --git a/test/010_#f70_#xfs_#lookup_#xattr_all.t b/test/010_#f70_#xfs_#lookup_#xattr_all.t index c02ccc3..d519852 100644 --- a/test/010_#f70_#xfs_#lookup_#xattr_all.t +++ b/test/010_#f70_#xfs_#lookup_#xattr_all.t @@ -1,4 +1,4 @@ -disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.img hd0 +disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.img hd0 -c 0 stat70 /hd0/1/sf_empty stat70 /hd0/1/sf_empty/. stat70 /hd0/1/sf_empty/.. diff --git a/test/011_#f70_#f70s1_#xfs_#lookup_#unicode_all.ref.log b/test/011_#f70_#f70s1_#xfs_#lookup_#unicode_all.ref.log index fbf0c52..44cb06f 100644 --- a/test/011_#f70_#f70s1_#xfs_#lookup_#unicode_all.ref.log +++ b/test/011_#f70_#f70s1_#xfs_#lookup_#unicode_all.ref.log @@ -1,4 +1,4 @@ -/> disk_add ../img/xfs_v4_unicode.img hd0 +/> disk_add ../img/xfs_v4_unicode.img hd0 -c 0 /hd0/1: xfs /> stat80 /hd0/1/dir0 diff --git a/test/011_#f70_#f70s1_#xfs_#lookup_#unicode_all.t b/test/011_#f70_#f70s1_#xfs_#lookup_#unicode_all.t index a224221..59f8f99 100644 --- a/test/011_#f70_#f70s1_#xfs_#lookup_#unicode_all.t +++ b/test/011_#f70_#f70s1_#xfs_#lookup_#unicode_all.t @@ -1,4 +1,4 @@ -disk_add ../img/xfs_v4_unicode.img hd0 +disk_add ../img/xfs_v4_unicode.img hd0 -c 0 stat80 /hd0/1/dir0 stat80 /hd0/1/dir0/ diff --git a/test/012_#f70_#f70s1_#xfs_#v5_#s05k_ls_all_dir_types_ftype1.ref.log b/test/012_#f70_#f70s1_#xfs_#v5_#s05k_ls_all_dir_types_ftype1.ref.log index de751c1..43de5b2 100644 --- a/test/012_#f70_#f70s1_#xfs_#v5_#s05k_ls_all_dir_types_ftype1.ref.log +++ b/test/012_#f70_#f70s1_#xfs_#v5_#s05k_ls_all_dir_types_ftype1.ref.log @@ -1,4 +1,4 @@ -/> disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.img hd0 +/> disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.img hd0 -c 0 /hd0/1: xfs /> ls70 /hd0/1/sf_empty status = 6 end_of_file, count = 2 diff --git a/test/012_#f70_#f70s1_#xfs_#v5_#s05k_ls_all_dir_types_ftype1.t b/test/012_#f70_#f70s1_#xfs_#v5_#s05k_ls_all_dir_types_ftype1.t index 3ded066..3fac9b1 100644 --- a/test/012_#f70_#f70s1_#xfs_#v5_#s05k_ls_all_dir_types_ftype1.t +++ b/test/012_#f70_#f70s1_#xfs_#v5_#s05k_ls_all_dir_types_ftype1.t @@ -1,4 +1,4 @@ -disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.img hd0 +disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.img hd0 -c 0 ls70 /hd0/1/sf_empty ls70 /hd0/1/sf ls70 /hd0/1/block diff --git a/test/013_#f70_#xfs_#v5_#lookup_all.ref.log b/test/013_#f70_#xfs_#v5_#lookup_all.ref.log index 1fd03ab..f1a3ae9 100644 --- a/test/013_#f70_#xfs_#v5_#lookup_all.ref.log +++ b/test/013_#f70_#xfs_#v5_#lookup_all.ref.log @@ -1,4 +1,4 @@ -/> disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.img hd0 +/> disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.img hd0 -c 0 /hd0/1: xfs /> stat70 /hd0/1/sf_empty status = 0 success diff --git a/test/013_#f70_#xfs_#v5_#lookup_all.t b/test/013_#f70_#xfs_#v5_#lookup_all.t index f54a58c..0169677 100644 --- a/test/013_#f70_#xfs_#v5_#lookup_all.t +++ b/test/013_#f70_#xfs_#v5_#lookup_all.t @@ -1,4 +1,4 @@ -disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.img hd0 +disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.img hd0 -c 0 stat70 /hd0/1/sf_empty stat70 /hd0/1/sf_empty/. stat70 /hd0/1/sf_empty/.. diff --git a/test/014_#f70_#f70s0_#xfs_#v5_#s05k_read_with_holes.ref.log b/test/014_#f70_#f70s0_#xfs_#v5_#s05k_read_with_holes.ref.log index 69e7ee9..60c8ec9 100644 --- a/test/014_#f70_#f70s0_#xfs_#v5_#s05k_read_with_holes.ref.log +++ b/test/014_#f70_#f70s0_#xfs_#v5_#s05k_read_with_holes.ref.log @@ -1,4 +1,4 @@ -/> disk_add ../img/xfs_v5_files_s05k_b4k_n8k.img hd0 +/> disk_add ../img/xfs_v5_files_s05k_b4k_n8k.img hd0 -c 0 /hd0/1: xfs # hole begin # zero length diff --git a/test/014_#f70_#f70s0_#xfs_#v5_#s05k_read_with_holes.t b/test/014_#f70_#f70s0_#xfs_#v5_#s05k_read_with_holes.t index 7123363..630c998 100644 --- a/test/014_#f70_#f70s0_#xfs_#v5_#s05k_read_with_holes.t +++ b/test/014_#f70_#f70s0_#xfs_#v5_#s05k_read_with_holes.t @@ -1,4 +1,4 @@ -disk_add ../img/xfs_v5_files_s05k_b4k_n8k.img hd0 +disk_add ../img/xfs_v5_files_s05k_b4k_n8k.img hd0 -c 0 # hole begin # zero length read70 /hd0/1/hole_begin 0 0 -b diff --git a/test/015_#f70_#f70s0_#xfs_#v5_#s05k_read_without_holes.ref.log b/test/015_#f70_#f70s0_#xfs_#v5_#s05k_read_without_holes.ref.log index c757034..8c3ef58 100644 --- a/test/015_#f70_#f70s0_#xfs_#v5_#s05k_read_without_holes.ref.log +++ b/test/015_#f70_#f70s0_#xfs_#v5_#s05k_read_without_holes.ref.log @@ -1,4 +1,4 @@ -/> disk_add ../img/xfs_v5_files_s05k_b4k_n8k.img hd0 +/> disk_add ../img/xfs_v5_files_s05k_b4k_n8k.img hd0 -c 0 /hd0/1: xfs # zero length /> read70 /hd0/1/no_hole 0 0 -b diff --git a/test/015_#f70_#f70s0_#xfs_#v5_#s05k_read_without_holes.t b/test/015_#f70_#f70s0_#xfs_#v5_#s05k_read_without_holes.t index ad7a7ef..356730a 100644 --- a/test/015_#f70_#f70s0_#xfs_#v5_#s05k_read_without_holes.t +++ b/test/015_#f70_#f70s0_#xfs_#v5_#s05k_read_without_holes.t @@ -1,4 +1,4 @@ -disk_add ../img/xfs_v5_files_s05k_b4k_n8k.img hd0 +disk_add ../img/xfs_v5_files_s05k_b4k_n8k.img hd0 -c 0 # zero length read70 /hd0/1/no_hole 0 0 -b read70 /hd0/1/no_hole 1 0 -b diff --git a/test/016_#f01_#draw_all.ref.log b/test/016_#f01_#draw_all.ref.log index 3cc20ef..cc08f3d 100644 --- a/test/016_#f01_#draw_all.ref.log +++ b/test/016_#f01_#draw_all.ref.log @@ -1,4 +1,4 @@ -/> disk_add ../img/kolibri.img rd +/> disk_add ../img/kolibri.img rd -c 0 /rd/1: fat /> set_skin /sys/DEFAULT.SKN status: 0 diff --git a/test/016_#f01_#draw_all.t b/test/016_#f01_#draw_all.t index c6af22c..0939e35 100644 --- a/test/016_#f01_#draw_all.t +++ b/test/016_#f01_#draw_all.t @@ -1,4 +1,4 @@ -disk_add ../img/kolibri.img rd +disk_add ../img/kolibri.img rd -c 0 set_skin /sys/DEFAULT.SKN window_redraw 1 draw_window 0 300 0 200 0x000088 1 1 1 0 1 4 hello diff --git a/test/makefile b/test/makefile index dea5906..39089cc 100644 --- a/test/makefile +++ b/test/makefile @@ -35,8 +35,8 @@ draw: $(draw_tests) %.out.log: %.ref.log %.t $(UMKA_SHELL) < $*.t > $@ - @ cmp $@ $< - @ if [ -f "$*.ref.png" ]; then cmp $*.out.png $*.ref.png; fi + @ cmp $*.{out,ref}.log + @ if [ -f "$*.ref.png" ]; then cmp $*.{out,ref}.png; fi coverage: ../covpreproc ../umka.lst 0x34 coverage.* > ../umka.cov diff --git a/umka.asm b/umka.asm index 765d49e..3609485 100644 --- a/umka.asm +++ b/umka.asm @@ -389,6 +389,9 @@ uglobal context_counter dd ? LAPIC_BASE dd ? irq_mode dd ? +ioapic_cnt dd ? +ioapic_gsi_base dd ? +MAX_IOAPICS = 2 cache_ide0 IDE_CACHE cache_ide1 IDE_CACHE DiskNumber db ? diff --git a/umka_fuse.c b/umka_fuse.c index f628da1..b527a34 100644 --- a/umka_fuse.c +++ b/umka_fuse.c @@ -140,7 +140,7 @@ int main(int argc, char *argv[]) { exit(1); } kos_init(); - void *userdata = vdisk_init(argv[2]); + void *userdata = vdisk_init(argv[2], 0u); void *vdisk = disk_add(&vdisk_functions, "hd0", userdata, 0); disk_media_changed(vdisk, 1); return fuse_main(argc-1, argv, &umka_oper, NULL); diff --git a/umka_shell.c b/umka_shell.c index 871b3f8..e29fd36 100644 --- a/umka_shell.c +++ b/umka_shell.c @@ -62,7 +62,7 @@ diskfunc_t vdisk_functions = { .read = vdisk_read, .write = vdisk_write, .flush = NULL, - .adjust_cache_size = vdisk_adjust_cache_size, + .adjust_cache_size = NULL, }; char cur_dir[PATH_MAX] = "/"; const char *last_dir = cur_dir; @@ -224,11 +224,33 @@ void umka_disk_list_partitions(disk_t *d) { } void umka_disk_add(int argc, char **argv) { - (void)argc; - const char *file_name = argv[1]; - const char *disk_name = argv[2]; + const char *usage = \ + "usage: disk_add [option]...\n" + " absolute or relative path\n" + " disk name, e.g. hd0 or rd\n" + " -c cache size size of disk cache in bytes"; + if (argc < 3) { + puts(usage); + return; + } + unsigned cache_size = 0u; + int opt; + optind = 1; + const char *file_name = argv[optind++]; + const char *disk_name = argv[optind++]; + while ((opt = getopt(argc, argv, "c:")) != -1) { + switch (opt) { + case 'c': + cache_size = strtoul(optarg, NULL, 0); + vdisk_functions.adjust_cache_size = vdisk_adjust_cache_size; + break; + default: + puts(usage); + return; + } + } - void *userdata = vdisk_init(file_name); + void *userdata = vdisk_init(file_name, cache_size); if (userdata) { void *vdisk = disk_add(&vdisk_functions, disk_name, userdata, 0); if (vdisk) { diff --git a/vdisk.c b/vdisk.c index 088dec8..0da3f4b 100644 --- a/vdisk.c +++ b/vdisk.c @@ -7,11 +7,12 @@ typedef struct { FILE *file; - uint64_t sect_cnt; uint32_t sect_size; + uint64_t sect_cnt; + unsigned cache_size; } vdisk_t; -void *vdisk_init(const char *fname) { +void *vdisk_init(const char *fname, unsigned cache_size) { FILE *f = fopen(fname, "r+"); if (!f) { printf("vdisk: can't open file '%s': %s\n", fname, strerror(errno)); @@ -25,7 +26,10 @@ void *vdisk_init(const char *fname) { sect_size = 4096; } vdisk_t *vdisk = (vdisk_t*)malloc(sizeof(vdisk_t)); - *vdisk = (vdisk_t){f, (uint64_t)fsize / sect_size, sect_size}; + *vdisk = (vdisk_t){.file = f, + .sect_size = sect_size, + .sect_cnt = (uint64_t)fsize / sect_size, + .cache_size = cache_size}; return vdisk; } @@ -37,7 +41,8 @@ void vdisk_close(void *userdata) { } __attribute__((__stdcall__)) -int vdisk_read(void *userdata, void *buffer, off_t startsector, size_t *numsectors) { +int vdisk_read(void *userdata, void *buffer, off_t startsector, + size_t *numsectors) { vdisk_t *vdisk = userdata; fseeko(vdisk->file, startsector * vdisk->sect_size, SEEK_SET); fread(buffer, *numsectors * vdisk->sect_size, 1, vdisk->file); @@ -45,7 +50,8 @@ int vdisk_read(void *userdata, void *buffer, off_t startsector, size_t *numsecto } __attribute__((__stdcall__)) -int vdisk_write(void *userdata, void *buffer, off_t startsector, size_t *numsectors) { +int vdisk_write(void *userdata, void *buffer, off_t startsector, + size_t *numsectors) { vdisk_t *vdisk = userdata; fseeko(vdisk->file, startsector * vdisk->sect_size, SEEK_SET); fwrite(buffer, *numsectors * vdisk->sect_size, 1, vdisk->file); @@ -62,8 +68,7 @@ int vdisk_querymedia(void *userdata, diskmediainfo_t *minfo) { } __attribute__((__stdcall__)) -unsigned int vdisk_adjust_cache_size(void *userdata, unsigned int suggested_size) { - (void)userdata; +unsigned vdisk_adjust_cache_size(vdisk_t *vdisk, unsigned suggested_size) { (void)suggested_size; - return 64*1024; + return vdisk->cache_size; } diff --git a/vdisk.h b/vdisk.h index e1c71ba..1f54ed6 100644 --- a/vdisk.h +++ b/vdisk.h @@ -5,21 +5,23 @@ #include #include "kolibri.h" -void *vdisk_init(const char *fname); +void *vdisk_init(const char *fname, unsigned cache_size); __attribute__((__stdcall__)) void vdisk_close(void *userdata); __attribute__((__stdcall__)) -int vdisk_read(void *userdata, void *buffer, off_t startsector, size_t *numsectors); +int vdisk_read(void *userdata, void *buffer, off_t startsector, + size_t *numsectors); __attribute__((__stdcall__)) -int vdisk_write(void *userdata, void *buffer, off_t startsector, size_t *numsectors); +int vdisk_write(void *userdata, void *buffer, off_t startsector, + size_t *numsectors); __attribute__((__stdcall__)) int vdisk_querymedia(void *userdata, diskmediainfo_t *minfo); __attribute__((__stdcall__)) -unsigned int vdisk_adjust_cache_size(void *userdata, unsigned int suggested_size); +unsigned int vdisk_adjust_cache_size(void *userdata, unsigned suggested_size); #endif // VDISK_H_INCLUDED