For backwards compatibility.
static VALUE
ruby_guestfs_create (int argc, VALUE *argv, VALUE module)
{
guestfs_h *g;
unsigned flags;
if (argc > 1)
rb_raise (rb_eArgError, "expecting 0 or 1 arguments");
flags = parse_flags (argc, argv);
g = guestfs_create_flags (flags);
if (!g)
rb_raise (e_Error, "failed to create guestfs handle");
/* Don't print error messages to stderr by default. */
guestfs_set_error_handler (g, NULL, NULL);
return Data_Wrap_Struct (c_guestfs, NULL, ruby_guestfs_free, g);
}
Call
guestfs_event_to_string[http://libguestfs.org/guestfs.3.html#guestfs_event_to_string]
to convert an event or event bitmask into a printable string.
static VALUE
ruby_event_to_string (VALUE modulev, VALUE eventsv)
{
uint64_t events;
char *str;
events = NUM2ULL (eventsv);
str = guestfs_event_to_string (events);
if (str == NULL)
rb_raise (e_Error, "%s", strerror (errno));
volatile VALUE rv = rb_str_new2 (str);
free (str);
return rv;
}