Class: Suzuna::IOCTL::Create

Inherits:
Object
  • Object
show all
Extended by:
IOC
Includes:
CommonModule
Defined in:
lib/suzuna.rb

Constant Summary collapse

REQ =
_IOWR("m".ord, 0, self)

Constants included from IOC

IOC::IOCPARM_MASK, IOC::IOCPARM_SHIFT, IOC::IOC_IN, IOC::IOC_INOUT, IOC::IOC_OUT

Class Method Summary collapse

Methods included from IOC

_IOC, _IOWR

Methods included from CommonModule

#post

Class Method Details

.post(mediasize, flags, sectorsize: 512, info: nil, timeout: G_GATE_TIMEOUT, unit: G_GATE_UNIT_AUTO) ⇒ Object



318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/suzuna.rb', line 318

def self.post(mediasize, flags, sectorsize: 512, info: nil, timeout: G_GATE_TIMEOUT, unit: G_GATE_UNIT_AUTO)
  ioc = IOCTL::Create.new
  ioc.version = G_GATE_VERSION
  ioc.unit = unit ? unit : G_GATE_UNIT_AUTO
  ioc.mediasize = mediasize
  ioc.sectorsize = sectorsize
  ioc.timeout = timeout
  ioc.flags = flags
  ioc.maxcount = 0
  ioc.info = info if info
  ioc.post

  if unit == G_GATE_UNIT_AUTO
    puts "%s%u\n" % [G_GATE_PROVIDER_NAME, ioc.unit]
  end

  ioc.unit
end