2011-04-21 10:40:03 +00:00
|
|
|
#!/bin/rc
|
2011-05-02 01:21:55 +00:00
|
|
|
rfork e
|
2011-04-21 10:40:03 +00:00
|
|
|
m=`{dd -if $1 -bs 2048 -skip 16 >[2]/dev/null | xd -c | sed 1q | \
|
|
|
|
sed 's/.........(....................).*/\1/; s/ //g'}
|
|
|
|
if(~ $"m 01CD00101){
|
|
|
|
echo 9660
|
|
|
|
exit
|
|
|
|
}
|
2018-02-07 17:18:32 +00:00
|
|
|
dd -if $1 -count 1 >/env/block >[2]/dev/null
|
2011-05-02 01:21:55 +00:00
|
|
|
fn fat {
|
2018-02-07 17:18:32 +00:00
|
|
|
m=`{dd -if /env/block -bs 1 -count 3 -skip $1 >[2]/dev/null}
|
2011-05-02 01:21:55 +00:00
|
|
|
~ $"m FAT
|
|
|
|
}
|
2018-02-07 17:18:32 +00:00
|
|
|
if(fat 54 || fat 82){
|
2011-05-02 01:21:55 +00:00
|
|
|
echo dos
|
|
|
|
exit
|
|
|
|
}
|
2018-02-07 17:18:32 +00:00
|
|
|
m=`{dd -if /env/block -bs 4 -count 1 >[2]/dev/null | xd | sed 's,0000000 ,,;q'}
|
2011-08-16 02:06:37 +00:00
|
|
|
if(~ $"m 529ab12b){
|
|
|
|
echo paqfs
|
|
|
|
exit
|
|
|
|
}
|
2012-08-07 15:57:04 +00:00
|
|
|
if(~ $"m 011ce50d){
|
|
|
|
echo hjfs
|
|
|
|
exit
|
|
|
|
}
|
2018-02-07 17:18:32 +00:00
|
|
|
m=`{dd -if /env/block -bs 16 -count 1 -skip 16 >[2]/dev/null}
|
2014-07-30 18:34:45 +00:00
|
|
|
if(~ $"m 'kfs wren device'){
|
|
|
|
echo kfs
|
|
|
|
exit
|
|
|
|
}
|
2018-02-07 17:18:32 +00:00
|
|
|
</env/block awk '
|
2011-04-21 10:40:03 +00:00
|
|
|
/^(blocksize|daddrbits|daddrbits|indirblks|dirblks|namelen)/{p[$1]=$2}
|
|
|
|
END{
|
|
|
|
ca["fs", "blocksize"] = 4*1024
|
|
|
|
ca["fs", "namelen"] = 28
|
|
|
|
ca["fs", "dirblks"] = 6
|
|
|
|
ca["fs", "indirblks"] = 2
|
|
|
|
ca["fs", "daddrbits"] = 32
|
|
|
|
|
|
|
|
ca["fs64", "blocksize"] = 8*1024
|
|
|
|
ca["fs64", "namelen"] = 56
|
|
|
|
ca["fs64", "dirblks"] = 6
|
|
|
|
ca["fs64", "indirblks"] = 4
|
|
|
|
ca["fs64", "daddrbits"] = 64
|
|
|
|
|
|
|
|
ca["cwfs", "blocksize"] = 16*1024
|
|
|
|
ca["cwfs", "namelen"] = 28
|
|
|
|
ca["cwfs", "dirblks"] = 6
|
|
|
|
ca["cwfs", "indirblks"] = 2
|
|
|
|
ca["cwfs", "daddrbits"] = 32
|
|
|
|
|
|
|
|
ca["cwfs64", "blocksize"] = 16*1024
|
|
|
|
ca["cwfs64", "namelen"] = 56
|
|
|
|
ca["cwfs64", "dirblks"] = 6
|
|
|
|
ca["cwfs64", "indirblks"] = 4
|
|
|
|
ca["cwfs64", "daddrbits"] = 64
|
|
|
|
|
|
|
|
ca["cwfs64x", "blocksize"] = 16*1024
|
|
|
|
ca["cwfs64x", "namelen"] = 144
|
|
|
|
ca["cwfs64x", "dirblks"] = 6
|
|
|
|
ca["cwfs64x", "indirblks"] = 4
|
|
|
|
ca["cwfs64x", "daddrbits"] = 64
|
|
|
|
|
|
|
|
for(e in ca){
|
|
|
|
split(e, k, SUBSEP)
|
|
|
|
if(ca[k[1],k[2]] == p[k[2]])
|
|
|
|
fs[k[1]]++
|
|
|
|
}
|
|
|
|
for(i in fs)
|
|
|
|
if(fs[i] > fs[j])
|
|
|
|
j=i
|
|
|
|
if(fs[j]){
|
|
|
|
print j
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
'
|