class LUNDesc

Public Class Methods

put_to_svipack(val) click to toggle source
# File lib/svi/api.rb, line 64
def self.put_to_svipack val
  raise "LUNDesc elements array.count%4 shall be 0" unless val.count%4 == 0
  res = ''

  res << Integer.put_to_svipack(val.count/4)

  val.each do |elem|
    res << Integer.put_to_svipack(elem)
  end

  res
end
scan_from_svipack(buf) click to toggle source
# File lib/svi/api.rb, line 44
def self.scan_from_svipack buf 
  count, buf = Integer.scan_from_svipack buf

  luns = []

  # TODO: Kill Constant «8»
  raise ArgumentError, "LUNDesc: error count #{count}" unless count <= 8 and count > 0

  count.times do
    start, buf = Integer.scan_from_svipack buf
    len, buf   = Integer.scan_from_svipack buf
    mode, buf  = Integer.scan_from_svipack buf
    flags, buf = Integer.scan_from_svipack buf

    luns << start << len << mode << flags
  end

  [ luns, buf ]
end