diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2009-06-29 12:47:20 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2009-06-29 12:47:20 +0100 |
commit | e492608f2f3809a824cb70ee03ff305964b69dd7 (patch) | |
tree | 953ec56c34431549dab177eec9e0fe979606e5eb /ruby | |
parent | 9a92446bcad09b492dee42dd5950bac67073fbea (diff) | |
download | libguestfs-e492608f2f3809a824cb70ee03ff305964b69dd7.tar.gz libguestfs-e492608f2f3809a824cb70ee03ff305964b69dd7.tar.xz libguestfs-e492608f2f3809a824cb70ee03ff305964b69dd7.zip |
Generated code for 'du' command.
Diffstat (limited to 'ruby')
-rw-r--r-- | ruby/ext/guestfs/_guestfs.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ruby/ext/guestfs/_guestfs.c b/ruby/ext/guestfs/_guestfs.c index 336a3a42..679c5b0f 100644 --- a/ruby/ext/guestfs/_guestfs.c +++ b/ruby/ext/guestfs/_guestfs.c @@ -4559,6 +4559,28 @@ static VALUE ruby_guestfs_df_h (VALUE gv) return rv; } +static VALUE ruby_guestfs_du (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", "du"); + + Check_Type (pathv, T_STRING); + const char *path = StringValueCStr (pathv); + if (!path) + rb_raise (rb_eTypeError, "expected string for parameter %s of %s", + "path", "du"); + + int64_t r; + + r = guestfs_du (g, path); + if (r == -1) + rb_raise (e_Error, "%s", guestfs_last_error (g)); + + return ULL2NUM (r); +} + /* Initialize the module. */ void Init__guestfs () { @@ -4925,4 +4947,6 @@ void Init__guestfs () ruby_guestfs_df, 0); rb_define_method (c_guestfs, "df_h", ruby_guestfs_df_h, 0); + rb_define_method (c_guestfs, "du", + ruby_guestfs_du, 1); } |