diff options
author | Richard Jones <rjones@redhat.com> | 2009-04-20 10:19:45 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-04-20 10:19:45 +0100 |
commit | 24ccbb29ac475187f51a27dcd318db2b4824a0c1 (patch) | |
tree | ecb06a1b2985b33b7bdd8dad6e222a380b274ac5 /ruby | |
parent | aef3d2013fee188c9607f35657c45df88503cd64 (diff) | |
download | libguestfs-24ccbb29ac475187f51a27dcd318db2b4824a0c1.tar.gz libguestfs-24ccbb29ac475187f51a27dcd318db2b4824a0c1.tar.xz libguestfs-24ccbb29ac475187f51a27dcd318db2b4824a0c1.zip |
Generated code for 'checksum' command.
Diffstat (limited to 'ruby')
-rw-r--r-- | ruby/ext/guestfs/_guestfs.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ruby/ext/guestfs/_guestfs.c b/ruby/ext/guestfs/_guestfs.c index 0104017c..3861d9b7 100644 --- a/ruby/ext/guestfs/_guestfs.c +++ b/ruby/ext/guestfs/_guestfs.c @@ -2066,6 +2066,33 @@ static VALUE ruby_guestfs_download (VALUE gv, VALUE remotefilenamev, VALUE filen return Qnil; } +static VALUE ruby_guestfs_checksum (VALUE gv, VALUE csumtypev, VALUE pathv) +{ + guestfs_h *g; + Data_Get_Struct (gv, guestfs_h, g); + if (!g) + rb_raise (rb_eArgError, "%s: used handle after closing it", "checksum"); + + const char *csumtype = StringValueCStr (csumtypev); + if (!csumtype) + rb_raise (rb_eTypeError, "expected string for parameter %s of %s", + "csumtype", "checksum"); + const char *path = StringValueCStr (pathv); + if (!path) + rb_raise (rb_eTypeError, "expected string for parameter %s of %s", + "path", "checksum"); + + char *r; + + r = guestfs_checksum (g, csumtype, path); + if (r == NULL) + rb_raise (e_Error, "%s", guestfs_last_error (g)); + + VALUE rv = rb_str_new2 (r); + free (r); + return rv; +} + /* Initialize the module. */ void Init__guestfs () { @@ -2248,4 +2275,6 @@ void Init__guestfs () ruby_guestfs_upload, 2); rb_define_method (c_guestfs, "download", ruby_guestfs_download, 2); + rb_define_method (c_guestfs, "checksum", + ruby_guestfs_checksum, 2); } |