diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2009-06-29 15:18:17 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2009-06-29 15:19:10 +0100 |
commit | c6d6f5ae1b76ec9aa5c540906aeed73d25d13eb9 (patch) | |
tree | 3f090396c5b90e0829c3ab25f8c3d8275726a46e /ruby | |
parent | 4dff42aa13dd726fb6b02843d0f4db4b4b330fe3 (diff) | |
download | libguestfs-c6d6f5ae1b76ec9aa5c540906aeed73d25d13eb9.tar.gz libguestfs-c6d6f5ae1b76ec9aa5c540906aeed73d25d13eb9.tar.xz libguestfs-c6d6f5ae1b76ec9aa5c540906aeed73d25d13eb9.zip |
Generated code for 'initrd-list'.
Diffstat (limited to 'ruby')
-rw-r--r-- | ruby/ext/guestfs/_guestfs.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ruby/ext/guestfs/_guestfs.c b/ruby/ext/guestfs/_guestfs.c index 679c5b0f..0d4c6dc7 100644 --- a/ruby/ext/guestfs/_guestfs.c +++ b/ruby/ext/guestfs/_guestfs.c @@ -4581,6 +4581,36 @@ static VALUE ruby_guestfs_du (VALUE gv, VALUE pathv) return ULL2NUM (r); } +static VALUE ruby_guestfs_initrd_list (VALUE gv, VALUE pathv) +{ + guestfs_h *g; + Data_Get_Struct (gv, guestfs_h, g); + if (!g) + rb_raise (rb_eArgError, "%s: used handle after closing it", "initrd_list"); + + Check_Type (pathv, T_STRING); + const char *path = StringValueCStr (pathv); + if (!path) + rb_raise (rb_eTypeError, "expected string for parameter %s of %s", + "path", "initrd_list"); + + char **r; + + r = guestfs_initrd_list (g, path); + if (r == NULL) + rb_raise (e_Error, "%s", guestfs_last_error (g)); + + int i, len = 0; + for (i = 0; r[i] != NULL; ++i) len++; + VALUE rv = rb_ary_new2 (len); + for (i = 0; r[i] != NULL; ++i) { + rb_ary_push (rv, rb_str_new2 (r[i])); + free (r[i]); + } + free (r); + return rv; +} + /* Initialize the module. */ void Init__guestfs () { @@ -4949,4 +4979,6 @@ void Init__guestfs () ruby_guestfs_df_h, 0); rb_define_method (c_guestfs, "du", ruby_guestfs_du, 1); + rb_define_method (c_guestfs, "initrd_list", + ruby_guestfs_initrd_list, 1); } |