diff options
author | Richard Jones <rjones@redhat.com> | 2010-04-10 21:23:27 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2010-04-10 21:23:27 +0100 |
commit | 540da0bc1999deda670e846b8db7291826a1a728 (patch) | |
tree | d5ae22a7694dcab0afe1eab5d373a9f5db78ebd2 /daemon | |
parent | 5466638279b51d46e6b24d4f7148d520cb4f3c34 (diff) | |
download | libguestfs-540da0bc1999deda670e846b8db7291826a1a728.tar.gz libguestfs-540da0bc1999deda670e846b8db7291826a1a728.tar.xz libguestfs-540da0bc1999deda670e846b8db7291826a1a728.zip |
New API: checksum-device for checksumming devices.
Analogous to the usual 'checksum' call.
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/checksum.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/daemon/checksum.c b/daemon/checksum.c index 499d19db..13719fd7 100644 --- a/daemon/checksum.c +++ b/daemon/checksum.c @@ -27,11 +27,10 @@ #include "daemon.h" #include "actions.h" -char * -do_checksum (const char *csumtype, const char *path) +static char * +checksum (const char *csumtype, const char *path) { const char *program; - char *buf; char *out, *err; int r; int len; @@ -55,15 +54,7 @@ do_checksum (const char *csumtype, const char *path) return NULL; } - /* Make the path relative to /sysroot. */ - buf = sysroot_path (path); - if (!buf) { - reply_with_perror ("malloc"); - return NULL; - } - - r = command (&out, &err, program, buf, NULL); - free (buf); + r = command (&out, &err, program, path, NULL); if (r == -1) { reply_with_error ("%s: %s", program, err); free (out); @@ -79,3 +70,24 @@ do_checksum (const char *csumtype, const char *path) return out; /* Caller frees. */ } + +char * +do_checksum (const char *csumtype, const char *path) +{ + /* Make the path relative to /sysroot. */ + char *buf = sysroot_path (path); + if (!buf) { + reply_with_perror ("malloc"); + return NULL; + } + + char *r = checksum (csumtype, buf); + free (buf); + return r; +} + +char * +do_checksum_device (const char *csumtype, const char *device) +{ + return checksum (csumtype, device); +} |