| RBool _ | RString _ | RStringList _
| RStruct _ | RStructList _
| RHashtable _ ->
- pr " if (!xdr_%s_ret (xdr, &ctx->ret)) {\n" name;
- pr " error (g, \"%%s: failed to parse reply\", \"%s\");\n" name;
- pr " return;\n";
- pr " }\n";
+ pr " if (!xdr_%s_ret (xdr, &ctx->ret)) {\n" name;
+ pr " error (g, \"%%s: failed to parse reply\", \"%s\");\n" name;
+ pr " return;\n";
+ pr " }\n";
);
pr " done:\n";
List.iter (
fun (name, style, _, _, _, _, _) ->
- generate_prototype
- ~single_line:true ~newline:true ~in_daemon:true ~prefix:"do_"
- name style;
+ generate_prototype
+ ~single_line:true ~newline:true ~in_daemon:true ~prefix:"do_"
+ name style;
) daemon_functions
(* Generate the server-side stubs. *)
List.iter (
fun (name, style, _, _, _, _, _) ->
- pr " case GUESTFS_PROC_%s:\n" (String.uppercase name);
- pr " %s_stub (xdr_in);\n" name;
- pr " break;\n"
+ pr " case GUESTFS_PROC_%s:\n" (String.uppercase name);
+ pr " %s_stub (xdr_in);\n" name;
+ pr " break;\n"
) daemon_functions;
pr " default:\n";
pr " int i, j;\n";
pr "\n";
(*
- pr " fprintf (stderr, \"%%s: <<%%s>>\\n\", __func__, str);\n";
- pr "\n";
+ pr " fprintf (stderr, \"%%s: <<%%s>>\\n\", __func__, str);\n";
+ pr "\n";
*)
pr " if (!str) {\n";
pr " fprintf (stderr, \"%%s: failed: passed a NULL string\\n\", __func__);\n";
(* print_* functions *)
List.iter (
fun (typ, cols) ->
+ let needs_i =
+ List.exists (function (_, FUUID) -> true | _ -> false) cols in
+
pr "static void print_%s (struct guestfs_%s *%s)\n" typ typ typ;
pr "{\n";
+ if needs_i then (
+ pr " int i;\n";
+ pr "\n"
+ );
List.iter (
function
| name, FString ->
pr " printf (\"%s: %%s\\n\", %s->%s);\n" name typ name
| name, FUUID ->
pr " printf (\"%s: \");\n" name;
- pr " for (int i = 0; i < 32; ++i)\n";
+ pr " for (i = 0; i < 32; ++i)\n";
pr " printf (\"%%c\", %s->%s[i]);\n" typ name;
pr " printf (\"\\n\");\n"
| name, (FUInt64|FBytes) ->
LVs, what filesystem is in each LV, etc.). It can also run commands
in the context of the guest. Also you can access filesystems over FTP.
+See also L<Sys::Guestfs::Lib(3)> for a set of useful library
+functions for using libguestfs from Perl, including integration
+with libvirt.
+
=head1 ERRORS
All errors turn into calls to C<croak> (see L<Carp(3)>).
=head1 SEE ALSO
-L<guestfs(3)>, L<guestfish(1)>.
+L<guestfs(3)>,
+L<guestfish(1)>,
+L<http://libguestfs.org>,
+L<Sys::Guestfs::Lib(3)>.
=cut
"
| RStringList _ | RStructList _ -> true
| RErr | RBool _ | RInt _ | RInt64 _ | RConstString _
| RString _ | RStruct _ | RHashtable _ -> false) ||
- List.exists (function StringList _ -> true | _ -> false) (snd style) in
+ List.exists (function StringList _ -> true | _ -> false) (snd style) in
if needs_i then
pr " int i;\n";
CallStringList ["1"]; CallBool false;
CallInt 0; CallString ""; CallString ""]
- (* XXX Add here tests of the return and error functions. *)
+(* XXX Add here tests of the return and error functions. *)
(* This is used to generate the src/MAX_PROC_NR file which
* contains the maximum procedure number, a surrogate for the
let () =
check_functions ();
- if not (Sys.file_exists "config.status") then (
+ if not (Sys.file_exists "HACKING") then (
eprintf "\
You are probably running this from the wrong directory.
Run it from the top source directory using the command