Skip to content

Instantly share code, notes, and snippets.

@orlandov
Created May 11, 2010 00:31
Show Gist options
  • Select an option

  • Save orlandov/396746 to your computer and use it in GitHub Desktop.

Select an option

Save orlandov/396746 to your computer and use it in GitHub Desktop.
FFI = require("./ffi");
sys = require("sys");
var funcs = {
"libzfs_init": ["pointer", []],
"libzfs_fini": ["void", [ 'pointer' ]],
"zfs_dataset_exists": ["byte", [ 'pointer', 'string', 'uint32' ]]
};
libzfs = new FFI.Library("libzfs", funcs);
var foo = libzfs.libzfs_init();
sys.puts("dataset exists " + libzfs.zfs_dataset_exists(foo, 'foobar', 1));
sys.puts("dataset exists " + libzfs.zfs_dataset_exists(foo, 'zfoobar', 1))
libzfs.libzfs_fini(foo);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment