linux-mount.c~

Path: ext/linux-mount.c~
Last Update: Wed, Jul 07 2004 09:24:25 +0000

include <ruby.h> include <rubyio.h> include <sys/mount.h>

/*

 *  call-seq:
 *      Linux.mount(filename) -> array
 *
 *  Returns an array with all attributes
 *
 *      Linux.mount("none", "/coda", "coda", 0, MountOptions.new.pack)
 *
 */

static VALUE rb_linux_mount(obj, source, target, filesystemtype, mountflags, data)

        VALUE obj, source, target, filesystemtype, mountflags, data;

{

        int ret;
        VALUE retval;

        Check_Type(source, T_STRING);
        Check_Type(target, T_STRING);
        Check_Type(filesystemtype, T_STRING);
        Check_Type(mountflags, T_FIXNUM);
        Check_Type(data, T_STRING);

        ret = mount(StringValueCStr(source), StringValueCStr(target), StringValueCStr(filesystemtype), (int)mountflags, StringValueStr(data));
        if(ret != 0) {
                rb_sys_fail(StringValueCStr(target));
        }

        return ret;

}

void Init_linux_mount () {

        VALUE rb_mLinux;
        rb_mLinux = rb_define_module("Linux");
        rb_define_singleton_method(rb_mLinux, "mount",
                                   rb_linux_mount, 5);

}

[Validate]