X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=ruby%2Fext%2Fguestfs%2F_guestfs.c;h=12ca6dedb7778d645175a088d24b563d4df3975d;hp=9d97f9602fe5d65a6d49ad84006ae262ec26fa47;hb=9222136ac9b2e404dba128b1ac74dacaa8bf1038;hpb=2dc9e8a858b62830d15a8186fe575eb7903d2171;ds=sidebyside diff --git a/ruby/ext/guestfs/_guestfs.c b/ruby/ext/guestfs/_guestfs.c index 9d97f96..12ca6de 100644 --- a/ruby/ext/guestfs/_guestfs.c +++ b/ruby/ext/guestfs/_guestfs.c @@ -2661,6 +2661,24 @@ static VALUE ruby_guestfs_mv (VALUE gv, VALUE srcv, VALUE destv) return Qnil; } +static VALUE ruby_guestfs_drop_caches (VALUE gv, VALUE whattodropv) +{ + guestfs_h *g; + Data_Get_Struct (gv, guestfs_h, g); + if (!g) + rb_raise (rb_eArgError, "%s: used handle after closing it", "drop_caches"); + + int whattodrop = NUM2INT (whattodropv); + + int r; + + r = guestfs_drop_caches (g, whattodrop); + if (r == -1) + rb_raise (e_Error, "%s", guestfs_last_error (g)); + + return Qnil; +} + /* Initialize the module. */ void Init__guestfs () { @@ -2891,4 +2909,6 @@ void Init__guestfs () ruby_guestfs_cp_a, 2); rb_define_method (c_guestfs, "mv", ruby_guestfs_mv, 2); + rb_define_method (c_guestfs, "drop_caches", + ruby_guestfs_drop_caches, 1); }