Module: JIO

Defined in:
lib/jio.rb,
lib/jio/file.rb,
lib/jio/version.rb,
ext/jio/jio_ext.c

Defined Under Namespace

Classes: File, Transaction

Constant Summary collapse

VERSION =
'0.1'
J_ESUCCESS =

Journal check specific constants

INT2NUM(J_ESUCCESS)
J_ENOENT =
INT2NUM(J_ENOENT)
J_ENOJOURNAL =
INT2NUM(J_ENOJOURNAL)
J_ENOMEM =
INT2NUM(J_ENOMEM)
J_ECLEANUP =
INT2NUM(J_ECLEANUP)
J_EIO =
INT2NUM(J_EIO)
J_CLEANUP =

jfscheck specific constants

INT2NUM(J_CLEANUP)
RDONLY =

Open specific constants (POSIX)

INT2NUM(O_RDONLY)
WRONLY =
INT2NUM(O_WRONLY)
RDWR =
INT2NUM(O_RDWR)
CREAT =
INT2NUM(O_CREAT)
EXCL =
INT2NUM(O_EXCL)
TRUNC =
INT2NUM(O_TRUNC)
APPEND =
INT2NUM(O_APPEND)
NONBLOCK =
INT2NUM(O_NONBLOCK)
NDELAY =
INT2NUM(O_NDELAY)
SYNC =
INT2NUM(O_SYNC)
ASYNC =
INT2NUM(O_ASYNC)
SEEK_SET =

lseek specific constants

INT2NUM(SEEK_SET)
SEEK_CUR =
INT2NUM(SEEK_CUR)
SEEK_END =
INT2NUM(SEEK_END)
J_NOLOCK =
INT2NUM(J_NOLOCK)
J_NOROLLBACK =
INT2NUM(J_NOROLLBACK)
J_LINGER =
INT2NUM(J_LINGER)
J_COMMITTED =
INT2NUM(J_COMMITTED)
J_ROLLBACKED =
INT2NUM(J_ROLLBACKED)
J_ROLLBACKING =
INT2NUM(J_ROLLBACKING)
J_RDONLY =
INT2NUM(J_RDONLY)

Class Method Summary collapse

Class Method Details

.check("/path/file", JIO: :J_CLEANUP) ⇒ Hash

Checks and repairs a file previously created and managed through libjio.

Examples

JIO.check("/path/file", JIO::J_CLEANUP)    =>  Hash

Returns:

  • (Hash)


32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'ext/jio/jio_ext.c', line 32

static VALUE rb_jio_s_check(JIO_UNUSED VALUE jio, VALUE path, VALUE flags)
{
    int ret;
    VALUE result;
    struct jfsck_result res;
    Check_Type(path, T_STRING);
    Check_Type(flags, T_FIXNUM);
    ret = jfsck(RSTRING_PTR(path), NULL, &res, FIX2UINT(flags));
    if (ret == J_ENOMEM) rb_memerror();
    if (ret < 0) rb_sys_fail("jfsck");
    result = rb_hash_new();
    rb_hash_aset(result, jio_s_total, INT2NUM(res.total));
    rb_hash_aset(result, jio_s_invalid, INT2NUM(res.invalid));
    rb_hash_aset(result, jio_s_in_progress, INT2NUM(res.in_progress));
    rb_hash_aset(result, jio_s_broken, INT2NUM(res.broken));
    rb_hash_aset(result, jio_s_corrupt, INT2NUM(res.corrupt));
    rb_hash_aset(result, jio_s_reapplied, INT2NUM(res.reapplied));
    return result;
}