diff options
author | Richard Jones <rjones@redhat.com> | 2009-04-30 23:10:22 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-04-30 23:10:22 +0100 |
commit | e118c14b9552de311cbc1734e03a3226b484c1e8 (patch) | |
tree | 6e7952088d10df67004db83bfe2f370e2e4ffba2 /ruby/ext | |
parent | b55bf8158f0b7f6b1760b7b3b5f7c1274a149127 (diff) | |
download | libguestfs-e118c14b9552de311cbc1734e03a3226b484c1e8.tar.gz libguestfs-e118c14b9552de311cbc1734e03a3226b484c1e8.tar.xz libguestfs-e118c14b9552de311cbc1734e03a3226b484c1e8.zip |
Generated code for grub-install command.
Diffstat (limited to 'ruby/ext')
-rw-r--r-- | ruby/ext/guestfs/_guestfs.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/ruby/ext/guestfs/_guestfs.c b/ruby/ext/guestfs/_guestfs.c index 1e87d043..f9117506 100644 --- a/ruby/ext/guestfs/_guestfs.c +++ b/ruby/ext/guestfs/_guestfs.c @@ -2561,6 +2561,31 @@ static VALUE ruby_guestfs_zero (VALUE gv, VALUE devicev) return Qnil; } +static VALUE ruby_guestfs_grub_install (VALUE gv, VALUE rootv, VALUE devicev) +{ + guestfs_h *g; + Data_Get_Struct (gv, guestfs_h, g); + if (!g) + rb_raise (rb_eArgError, "%s: used handle after closing it", "grub_install"); + + const char *root = StringValueCStr (rootv); + if (!root) + rb_raise (rb_eTypeError, "expected string for parameter %s of %s", + "root", "grub_install"); + const char *device = StringValueCStr (devicev); + if (!device) + rb_raise (rb_eTypeError, "expected string for parameter %s of %s", + "device", "grub_install"); + + int r; + + r = guestfs_grub_install (g, root, device); + if (r == -1) + rb_raise (e_Error, "%s", guestfs_last_error (g)); + + return Qnil; +} + /* Initialize the module. */ void Init__guestfs () { @@ -2783,4 +2808,6 @@ void Init__guestfs () ruby_guestfs_fsck, 2); rb_define_method (c_guestfs, "zero", ruby_guestfs_zero, 1); + rb_define_method (c_guestfs, "grub_install", + ruby_guestfs_grub_install, 2); } |