diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2018-02-07 18:18:32 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2018-02-07 18:18:32 +0100 |
commit | d8999511e0921e2aaa45f862c5b4ca9098d78a96 (patch) | |
tree | 84d487963c656bc38b4b14c61989729911fca620 /rc | |
parent | 650e5db5a2df96e8dc7a267e6831dbcce1bce9dc (diff) |
fstype: make copy of first sector in /env to avoid unaligned reads on the disk (for devfs)
devfs crypto partitions do not support unaligned reads,
so we make a copy of the first in /env/block and then
slice it to find filesystem signatures.
thanks mykhal for reporting the issue.
Diffstat (limited to 'rc')
-rwxr-xr-x | rc/bin/fstype | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/rc/bin/fstype b/rc/bin/fstype index 71e3adba9..67c3cd20b 100755 --- a/rc/bin/fstype +++ b/rc/bin/fstype @@ -6,15 +6,16 @@ if(~ $"m 01CD00101){ echo 9660 exit } +dd -if $1 -count 1 >/env/block >[2]/dev/null fn fat { - m=`{dd -if $1 -bs 1 -count 3 -skip $2 >[2]/dev/null} + m=`{dd -if /env/block -bs 1 -count 3 -skip $1 >[2]/dev/null} ~ $"m FAT } -if(fat $1 54 || fat $1 82){ +if(fat 54 || fat 82){ echo dos exit } -m=`{dd -if $1 -bs 4 -count 1 >[2]/dev/null | xd | sed 's,0000000 ,,;q'} +m=`{dd -if /env/block -bs 4 -count 1 >[2]/dev/null | xd | sed 's,0000000 ,,;q'} if(~ $"m 529ab12b){ echo paqfs exit @@ -23,13 +24,12 @@ if(~ $"m 011ce50d){ echo hjfs exit } -m=`{dd -if $1 -bs 16 -count 1 -skip 16 >[2]/dev/null} +m=`{dd -if /env/block -bs 16 -count 1 -skip 16 >[2]/dev/null} if(~ $"m 'kfs wren device'){ echo kfs exit } -dd -if $1 -count 1 >[2]/dev/null | \ -awk ' +</env/block awk ' /^(blocksize|daddrbits|daddrbits|indirblks|dirblks|namelen)/{p[$1]=$2} END{ ca["fs", "blocksize"] = 4*1024 |