2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/fs/MiqFS/modules/Fat32Probe.rb', line 2
def self.probe(dobj)
unless dobj.kind_of?(MiqDisk)
$log&.debug "Fat32Probe << FALSE because Disk Object class is not MiqDisk, but is '#{dobj.class}'"
return false
end
dobj.seek(0)
bs = dobj.read(512)
if bs.nil? || bs[66] != 0x29
$log&.debug("Fat32Probe << FALSE because there is no extended signature")
return false
end
if bs.length < 90
$log&.debug("Fat32Probe << FALSE because there is no filesystem label")
return false
end
fslabel = bs[82, 8].unpack('a8')[0].strip
fat32 = fslabel == 'FAT32'
if $log
$log.debug("Fat32Probe << TRUE") if fat32
$log.debug("Fat32Probe << FALSE because FS label is NOT FAT32, but is '#{fslabel}'") unless fat32
end
fat32
end
|