X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=generator%2Fgenerator_xdr.ml;h=5714c803fbbcfbef30a48ef9847d492581bb96cf;hb=8037da06feea097716ce700f38c0eac0d5411a7c;hp=494214996842031e6ef018c4108624fb74989326;hpb=14490c3e1aac61c6ac90f28828896683f64f0dc9;p=libguestfs.git diff --git a/generator/generator_xdr.ml b/generator/generator_xdr.ml index 4942149..5714c80 100644 --- a/generator/generator_xdr.ml +++ b/generator/generator_xdr.ml @@ -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; @@ -86,6 +88,7 @@ let generate_xdr () = | BufferIn n -> pr " opaque %s<>;\n" n | FileIn _ | FileOut _ -> () + | Pointer _ -> assert false ) args; pr "};\n\n" ); @@ -157,7 +160,7 @@ let generate_xdr () = */ const GUESTFS_PROGRAM = 0x2000F5F5; -const GUESTFS_PROTOCOL_VERSION = 2; +const GUESTFS_PROTOCOL_VERSION = 4; /* These constants must be larger than any possible message length. */ const GUESTFS_LAUNCH_FLAG = 0xf5f55ff5; @@ -181,7 +184,8 @@ enum guestfs_message_status { pr "\ struct guestfs_message_error { - int linux_errno; /* Linux errno if available. */ + string errno_string<32>; /* errno eg. \"EINVAL\", empty string + if errno not available */ string error_message; }; @@ -191,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; };