From 9222136ac9b2e404dba128b1ac74dacaa8bf1038 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 1 May 2009 11:18:53 +0100 Subject: Generated code for drop-caches command. --- ruby/ext/guestfs/_guestfs.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'ruby') diff --git a/ruby/ext/guestfs/_guestfs.c b/ruby/ext/guestfs/_guestfs.c index 9d97f960..12ca6ded 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); } -- cgit