Add support for zerofree command.
[libguestfs.git] / daemon / stubs.c
index 0e5b351..212634f 100644 (file)
@@ -2397,6 +2397,30 @@ done:
   xdr_free ((xdrproc_t) xdr_guestfs_hexdump_args, (char *) &args);
 }
 
+static void zerofree_stub (XDR *xdr_in)
+{
+  int r;
+  struct guestfs_zerofree_args args;
+  const char *device;
+
+  memset (&args, 0, sizeof args);
+
+  if (!xdr_guestfs_zerofree_args (xdr_in, &args)) {
+    reply_with_error ("%s: daemon failed to decode procedure arguments", "zerofree");
+    return;
+  }
+  device = args.device;
+
+  r = do_zerofree (device);
+  if (r == -1)
+    /* do_zerofree has already called reply_with_error */
+    goto done;
+
+  reply (NULL, NULL);
+done:
+  xdr_free ((xdrproc_t) xdr_guestfs_zerofree_args, (char *) &args);
+}
+
 void dispatch_incoming_message (XDR *xdr_in)
 {
   switch (proc_nr) {
@@ -2688,6 +2712,9 @@ void dispatch_incoming_message (XDR *xdr_in)
     case GUESTFS_PROC_HEXDUMP:
       hexdump_stub (xdr_in);
       break;
+    case GUESTFS_PROC_ZEROFREE:
+      zerofree_stub (xdr_in);
+      break;
     default:
       reply_with_error ("dispatch_incoming_message: unknown procedure number %d", proc_nr);
   }