Sha256: 7b866db006d5fe049b0fe7752049b66d52c5980c73ee8b566bb1ec4423041b59

Contents?: true

Size: 685 Bytes

Versions: 14

Compression:

Stored size: 685 Bytes

Contents

require 'fs/ext4/superblock'

module Ext4Probe
  def self.probe(dobj)
    $log.debug("Ext4Probe >> dobj=#{dobj}") if $log
    unless dobj.kind_of?(MiqDisk)
      $log.debug "Ext4Probe << FALSE because Disk Object class is not MiqDisk, but is '#{dobj.class}'" if $log
      return false
    end

    begin
      dobj.seek(0, IO::SEEK_SET)
      sb = Ext4::Superblock.new(dobj)

      # If initializing the superblock does not throw any errors, then this is Ext4
      $log.debug("Ext4Probe << TRUE")
      return true
    rescue => err
      $log.debug "Ext4Probe << FALSE because #{err.message}" if $log
      return false
    ensure
      dobj.seek(0, IO::SEEK_SET)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
manageiq-smartstate-0.2.6 lib/fs/MiqFS/modules/Ext4Probe.rb
manageiq-smartstate-0.2.5 lib/fs/MiqFS/modules/Ext4Probe.rb
manageiq-smartstate-0.2.4 lib/fs/MiqFS/modules/Ext4Probe.rb
manageiq-smartstate-0.2.3 lib/fs/MiqFS/modules/Ext4Probe.rb
manageiq-smartstate-0.2.2 lib/fs/MiqFS/modules/Ext4Probe.rb
manageiq-smartstate-0.2.1 lib/fs/MiqFS/modules/Ext4Probe.rb
manageiq-smartstate-0.2.0 lib/fs/MiqFS/modules/Ext4Probe.rb
manageiq-smartstate-0.1.6 lib/fs/MiqFS/modules/Ext4Probe.rb
manageiq-smartstate-0.1.5 lib/fs/MiqFS/modules/Ext4Probe.rb
manageiq-smartstate-0.1.4 lib/fs/MiqFS/modules/Ext4Probe.rb
manageiq-smartstate-0.1.3 lib/fs/MiqFS/modules/Ext4Probe.rb
manageiq-smartstate-0.1.2 lib/fs/MiqFS/modules/Ext4Probe.rb
manageiq-smartstate-0.1.1 lib/fs/MiqFS/modules/Ext4Probe.rb
manageiq-smartstate-0.1.0 lib/fs/MiqFS/modules/Ext4Probe.rb