Module: UBLK::Native

Defined in:
ext/ublk/ublk.c

Defined Under Namespace

Classes: Control, Server

Class Method Summary collapse

Class Method Details

.layoutObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'ext/ublk/ublk.c', line 11

static VALUE native_layout(VALUE self)
{
  VALUE result = rb_hash_new();
  (void)self;
#ifdef __linux__
  rb_hash_aset(result, ID2SYM(rb_intern("ctrl_cmd_size")), SIZET2NUM(sizeof(struct ublk_rb_ctrl_cmd)));
  rb_hash_aset(result, ID2SYM(rb_intern("dev_info_size")), SIZET2NUM(sizeof(struct ublk_rb_dev_info)));
  rb_hash_aset(result, ID2SYM(rb_intern("params_size")), SIZET2NUM(sizeof(struct ublk_rb_params)));
  rb_hash_aset(result, ID2SYM(rb_intern("io_desc_size")), SIZET2NUM(sizeof(struct ublksrv_io_desc)));
  rb_hash_aset(result, ID2SYM(rb_intern("io_desc_start_sector_offset")), SIZET2NUM(offsetof(struct ublksrv_io_desc, start_sector)));
#endif
  return result;
}

.lock_memory!Object



385
386
387
388
389
390
391
392
393
394
# File 'ext/ublk/server.c', line 385

static VALUE native_lock_memory(VALUE self)
{
  (void)self;
#ifdef HAVE_MLOCKALL
  if (mlockall(MCL_CURRENT | MCL_FUTURE) < 0) rb_sys_fail("mlockall");
  return Qtrue;
#else
  rb_raise(rb_eNotImpError, "mlockall is unavailable");
#endif
}

.supported?Boolean

Returns:

  • (Boolean)