Add debian/ directory (temporarily).
[libguestfs.git] / generator / generator_xdr.ml
index c6d8a4d..5714c80 100644 (file)
@@ -65,12 +65,14 @@ let generate_xdr () =
 
   List.iter (
     fun (shortname, (ret, args, optargs), _, _, _, _, _) ->
-      if optargs <> [] then
-        failwithf "optional arguments not supported in XDR yet";
-
       let name = "guestfs_" ^ shortname in
 
-      (match args with
+      (* Ordinary arguments and optional arguments are concatenated
+       * together in the XDR args struct.  The optargs_bitmask field
+       * in the header controls which optional arguments are
+       * meaningful.
+       *)
+      (match args @ optargs with
        | [] -> ()
        | args ->
            pr "struct %s_args {\n" name;
@@ -158,7 +160,7 @@ let generate_xdr () =
  */
 
 const GUESTFS_PROGRAM = 0x2000F5F5;
-const GUESTFS_PROTOCOL_VERSION = 3;
+const GUESTFS_PROTOCOL_VERSION = 4;
 
 /* These constants must be larger than any possible message length. */
 const GUESTFS_LAUNCH_FLAG = 0xf5f55ff5;
@@ -193,6 +195,8 @@ struct guestfs_message_header {
   guestfs_procedure proc;            /* GUESTFS_PROC_x */
   guestfs_message_direction direction;
   unsigned serial;                   /* message serial number */
+  unsigned hyper progress_hint;      /* upload hint for progress bar */
+  unsigned hyper optargs_bitmask;    /* bitmask for optional args */
   guestfs_message_status status;
 };