lib/virt_mem_capture.ml
lib/virt_mem_kallsyms.ml
lib/virt_mem_kallsyms.mli
+lib/virt_mem_kernels.ml
lib/virt_mem_ksyms.ml
lib/virt_mem_ksyms.mli
lib/virt_mem.ml
(basename, version, arch)
) infos in
+ let nr_kernels = List.length infos in
+
(* For quick access to the opener strings, build a hash. *)
let openers = Hashtbl.create 13 in
List.iter (
) what;
(* Now read the data files and parse out the structures of interest. *)
- let datas = List.map (
- fun (basename, version, arch) ->
+ let kernels = List.mapi (
+ fun i (basename, version, arch) ->
+ printf "Loading kernel data file %d/%d\r%!" (i+1) nr_kernels;
+
let file_exists name =
try Unix.access name [Unix.F_OK]; true
with Unix.Unix_error _ -> false
in
- let datas = List.map (
+ let kernels = List.map (
fun (basename, version, arch, bodies) ->
let structures = List.filter_map (
fun (struct_name, (_, _, _, wanted_fields)) ->
) what in
(basename, version, arch, structures)
- ) datas in
+ ) kernels in
if debug then
List.iter (
) fields;
printf " } /* %d bytes */\n\n" total_size;
) structures;
- ) datas;
+ ) kernels;
+
+ (* First output file is a simple list of kernels, to support the
+ * 'virt-mem --list-kernels' option.
+ *)
+ let () =
+ let _loc = Loc.ghost in
+
+ let versions = List.map (fun (_, version, _, _) -> version) kernels in
+
+ (* Sort them in reverse because we are going to generate the
+ * final list in reverse.
+ *)
+ let cmp a b = compare b a in
+ let versions = List.sort ~cmp versions in
+
+ let xs =
+ List.fold_left (fun xs version -> <:expr< $str:version$ :: $xs$ >>)
+ <:expr< [] >> versions in
+
+ let code = <:str_item<
+ let kernels = $xs$
+ >> in
+
+ let output_file = outputdir // "virt_mem_kernels.ml" in
+ printf "Writing list of kernels to %s ...\n%!" output_file;
+ Printers.OCaml.print_implem ~output_file code in
(* We'll generate a code file for each structure type (eg. task_struct
- * across all kernel versions), so rearrange 'datas' for that purpose.
+ * across all kernel versions), so rearrange 'kernels' for that purpose.
*
* XXX This loop is O(n^3), luckily n is small!
*)
fun (basename, version, arch, structures) ->
try Some (basename, version, arch, List.assoc name structures)
with Not_found -> None
- ) datas in
+ ) kernels in
(* Sort the kernels, which makes the generated output more stable
* and makes patches more useful.
name, kernels
) what in
- let datas = () in ignore datas; (* garbage collect *)
+ let kernels = () in ignore kernels; (* garbage collect *)
(* Get just the field types. It's plausible that a field with the
* same name has a different type between kernel versions, so we must
(* Code (.ml file). *)
let code = <:str_item<
- let warning = "This code is automatically generated from the kernel database by kerneldb-to-parser program. Any edits you make will be lost."
let zero = 0
let struct_name = $str:struct_name$
let match_err = "failed to match kernel structure"
let ichan = open_in new_output_file in
let ochan = open_out output_file in
+ output_string ochan "\
+(* WARNING: This file and the corresponding mli (interface) are
+ * automatically generated by the extract/codegen/kerneldb_to_parser.ml
+ * program.
+ *
+ * Any edits you make to this file will be lost.
+ *
+ * To update this file from the latest kernel database, it is recommended
+ * that you do 'make update-kernel-structs'.
+ *)
+";
+
let rec loop () =
let line = input_line ichan in
let line =
virt_mem_gettext.cmx virt_mem_ksyms.cmi
virt_mem.cmo: virt_mem_version.cmo virt_mem_utsname.cmi virt_mem_utils.cmo \
virt_mem_types.cmi virt_mem_tasks.cmi virt_mem_mmap.cmi \
- virt_mem_ksyms.cmi virt_mem_kallsyms.cmi virt_mem_gettext.cmo \
- virt_mem.cmi
+ virt_mem_ksyms.cmi virt_mem_kernels.cmo virt_mem_kallsyms.cmi \
+ virt_mem_gettext.cmo virt_mem.cmi
virt_mem.cmx: virt_mem_version.cmx virt_mem_utsname.cmx virt_mem_utils.cmx \
virt_mem_types.cmx virt_mem_tasks.cmx virt_mem_mmap.cmx \
- virt_mem_ksyms.cmx virt_mem_kallsyms.cmx virt_mem_gettext.cmx \
- virt_mem.cmi
+ virt_mem_ksyms.cmx virt_mem_kernels.cmx virt_mem_kallsyms.cmx \
+ virt_mem_gettext.cmx virt_mem.cmi
virt_mem_mmap.cmo: virt_mem_utils.cmo virt_mem_mmap.cmi
virt_mem_mmap.cmx: virt_mem_utils.cmx virt_mem_mmap.cmi
virt_mem_tasks.cmo: virt_mem_utils.cmo virt_mem_types.cmi virt_mem_mmap.cmi \
OBJS = virt_mem_gettext.cmo \
virt_mem_version.cmo \
+ virt_mem_kernels.cmo \
virt_mem_utils.cmo \
virt_mem_mmap_c.o \
virt_mem_mmap.cmo \
-let warning =
- "This code is automatically generated from the kernel database by kerneldb-to-parser program. Any edits you make will be lost.";;
+(* WARNING: This file and the corresponding mli (interface) are
+ * automatically generated by the extract/codegen/kerneldb_to_parser.ml
+ * program.
+ *
+ * Any edits you make to this file will be lost.
+ *
+ * To update this file from the latest kernel database, it is recommended
+ * that you do 'make update-kernel-structs'.
+ *)
let zero = 0;;
let struct_name = "net_device";;
let match_err = "failed to match kernel structure";;
-let warning =
- "This code is automatically generated from the kernel database by kerneldb-to-parser program. Any edits you make will be lost.";;
+(* WARNING: This file and the corresponding mli (interface) are
+ * automatically generated by the extract/codegen/kerneldb_to_parser.ml
+ * program.
+ *
+ * Any edits you make to this file will be lost.
+ *
+ * To update this file from the latest kernel database, it is recommended
+ * that you do 'make update-kernel-structs'.
+ *)
let zero = 0;;
let struct_name = "task_struct";;
let match_err = "failed to match kernel structure";;
exit 0
in
+ (* Handle --list-kernels option. *)
+ let list_kernels () =
+ List.iter print_endline Virt_mem_kernels.kernels;
+ exit 0
+ in
+
(* Function to collect up any anonymous args (domain names/IDs). *)
let anon_arg str = anon_args := str :: !anon_args in
"uri " ^ s_ "Connect to URI";
"--debug", Arg.Set debug,
" " ^ s_"Debug mode (default: false)";
+ "--list-kernels", Arg.Unit list_kernels,
+ " " ^ s_"List known kernels";
"-t", Arg.String memory_image,
"image " ^ s_"Use saved kernel memory image";
"--version", Arg.Unit version,
--- /dev/null
+let kernels =
+ [ "2.6.18-1.2798.fc6.i586"; "2.6.18-1.2798.fc6.i686";
+ "2.6.18-1.2798.fc6.i686"; "2.6.18-1.2798.fc6.i686";
+ "2.6.18-1.2798.fc6.ppc"; "2.6.18-1.2798.fc6.ppc";
+ "2.6.18-1.2798.fc6.ppc64"; "2.6.18-1.2798.fc6.ppc64";
+ "2.6.18-1.2798.fc6.ppc64iseries"; "2.6.18-1.2798.fc6.ppc64iseries";
+ "2.6.18-1.2798.fc6.x86_64"; "2.6.18-1.2798.fc6.x86_64";
+ "2.6.18-1.2798.fc6.x86_64"; "2.6.20-1.2933.fc6.i586";
+ "2.6.20-1.2933.fc6.i686"; "2.6.20-1.2933.fc6.i686";
+ "2.6.20-1.2933.fc6.i686"; "2.6.20-1.2933.fc6.i686";
+ "2.6.20-1.2933.fc6.i686"; "2.6.20-1.2933.fc6.i686";
+ "2.6.20-1.2933.fc6.ppc"; "2.6.20-1.2933.fc6.ppc";
+ "2.6.20-1.2933.fc6.ppc64"; "2.6.20-1.2933.fc6.ppc64";
+ "2.6.20-1.2933.fc6.x86_64"; "2.6.20-1.2933.fc6.x86_64";
+ "2.6.20-1.2933.fc6.x86_64"; "2.6.20-1.2933.fc6.x86_64";
+ "2.6.21-1.3128.fc7.i586"; "2.6.21-1.3128.fc7.i686";
+ "2.6.21-1.3128.fc7.i686"; "2.6.21-1.3128.fc7.ppc";
+ "2.6.21-1.3128.fc7.ppc"; "2.6.21-1.3128.fc7.ppc64";
+ "2.6.21-1.3128.fc7.ppc64"; "2.6.21-1.3128.fc7.x86_64";
+ "2.6.21-1.3128.fc7.x86_64"; "2.6.21-1.3132.fc7.i586";
+ "2.6.21-1.3132.fc7.i686"; "2.6.21-1.3132.fc7.i686";
+ "2.6.21-1.3132.fc7.ppc"; "2.6.21-1.3132.fc7.ppc";
+ "2.6.21-1.3132.fc7.ppc64"; "2.6.21-1.3132.fc7.ppc64";
+ "2.6.21-1.3132.fc7.x86_64"; "2.6.21-1.3132.fc7.x86_64";
+ "2.6.21-1.3141.fc7.i586"; "2.6.21-1.3141.fc7.i686";
+ "2.6.21-1.3141.fc7.i686"; "2.6.21-1.3141.fc7.ppc";
+ "2.6.21-1.3141.fc7.ppc"; "2.6.21-1.3141.fc7.ppc64";
+ "2.6.21-1.3141.fc7.ppc64"; "2.6.21-1.3141.fc7.x86_64";
+ "2.6.21-1.3141.fc7.x86_64"; "2.6.21-1.3144.fc7.i586";
+ "2.6.21-1.3144.fc7.i686"; "2.6.21-1.3144.fc7.i686";
+ "2.6.21-1.3144.fc7.ppc"; "2.6.21-1.3144.fc7.ppc";
+ "2.6.21-1.3144.fc7.ppc64"; "2.6.21-1.3144.fc7.ppc64";
+ "2.6.21-1.3144.fc7.x86_64"; "2.6.21-1.3144.fc7.x86_64";
+ "2.6.21-1.3145.fc7.i586"; "2.6.21-1.3145.fc7.i686";
+ "2.6.21-1.3145.fc7.i686"; "2.6.21-1.3145.fc7.i686";
+ "2.6.21-1.3145.fc7.i686"; "2.6.21-1.3145.fc7.ppc";
+ "2.6.21-1.3145.fc7.ppc"; "2.6.21-1.3145.fc7.ppc64";
+ "2.6.21-1.3145.fc7.ppc64"; "2.6.21-1.3145.fc7.x86_64";
+ "2.6.21-1.3145.fc7.x86_64"; "2.6.21-1.3145.fc7.x86_64";
+ "2.6.21-1.3190.fc7.i586"; "2.6.21-1.3190.fc7.i686";
+ "2.6.21-1.3190.fc7.i686"; "2.6.21-1.3190.fc7.i686";
+ "2.6.21-1.3190.fc7.i686"; "2.6.21-1.3190.fc7.ppc";
+ "2.6.21-1.3190.fc7.ppc"; "2.6.21-1.3190.fc7.ppc64";
+ "2.6.21-1.3190.fc7.ppc64"; "2.6.21-1.3190.fc7.x86_64";
+ "2.6.21-1.3190.fc7.x86_64"; "2.6.21-1.3190.fc7.x86_64";
+ "2.6.21-1.3209.fc8.i586"; "2.6.21-1.3209.fc8.i686";
+ "2.6.21-1.3209.fc8.i686"; "2.6.21-1.3209.fc8.ppc";
+ "2.6.21-1.3209.fc8.ppc"; "2.6.21-1.3209.fc8.ppc64";
+ "2.6.21-1.3209.fc8.ppc64"; "2.6.21-1.3209.fc8.x86_64";
+ "2.6.21-1.3218.fc8.i586"; "2.6.21-1.3218.fc8.i686";
+ "2.6.21-1.3218.fc8.i686"; "2.6.21-1.3218.fc8.ppc";
+ "2.6.21-1.3218.fc8.ppc"; "2.6.21-1.3218.fc8.ppc64";
+ "2.6.21-1.3218.fc8.ppc64"; "2.6.21-1.3218.fc8.x86_64";
+ "2.6.21-1.3221.fc8.i586"; "2.6.21-1.3221.fc8.i686";
+ "2.6.21-1.3221.fc8.i686"; "2.6.21-1.3221.fc8.ppc";
+ "2.6.21-1.3221.fc8.ppc"; "2.6.21-1.3221.fc8.ppc64";
+ "2.6.21-1.3221.fc8.ppc64"; "2.6.21-1.3221.fc8.x86_64";
+ "2.6.21-1.3228.fc7.i586"; "2.6.21-1.3228.fc7.i686";
+ "2.6.21-1.3228.fc7.i686"; "2.6.21-1.3228.fc7.i686";
+ "2.6.21-1.3228.fc7.i686"; "2.6.21-1.3228.fc7.ppc";
+ "2.6.21-1.3228.fc7.ppc"; "2.6.21-1.3228.fc7.ppc64";
+ "2.6.21-1.3228.fc7.ppc64"; "2.6.21-1.3228.fc7.x86_64";
+ "2.6.21-1.3228.fc7.x86_64"; "2.6.21-1.3228.fc7.x86_64";
+ "2.6.21-1.3234.fc8.i686"; "2.6.21-1.3234.fc8.i686";
+ "2.6.21-1.3234.fc8.ppc"; "2.6.21-1.3234.fc8.ppc";
+ "2.6.21-1.3234.fc8.ppc64"; "2.6.21-1.3234.fc8.ppc64";
+ "2.6.21-1.3234.fc8.x86_64"; "2.6.21-1.3236.fc8.i686";
+ "2.6.21-1.3236.fc8.i686"; "2.6.21-1.3236.fc8.ppc";
+ "2.6.21-1.3236.fc8.ppc"; "2.6.21-1.3236.fc8.ppc64";
+ "2.6.21-1.3236.fc8.ppc64"; "2.6.21-1.3236.fc8.x86_64";
+ "2.6.21-1.3238.fc8.i686"; "2.6.21-1.3238.fc8.i686";
+ "2.6.21-1.3238.fc8.ppc"; "2.6.21-1.3238.fc8.ppc";
+ "2.6.21-1.3238.fc8.ppc64"; "2.6.21-1.3238.fc8.ppc64";
+ "2.6.21-1.3238.fc8.x86_64"; "2.6.21-1.3242.fc8.i686";
+ "2.6.21-1.3242.fc8.i686"; "2.6.21-1.3242.fc8.ppc";
+ "2.6.21-1.3242.fc8.ppc"; "2.6.21-1.3242.fc8.ppc64";
+ "2.6.21-1.3242.fc8.ppc64"; "2.6.21-1.3242.fc8.x86_64";
+ "2.6.22-0.23.rc7.git6.fc8.i686"; "2.6.22-0.23.rc7.git6.fc8.i686";
+ "2.6.22-0.23.rc7.git6.fc8.ppc"; "2.6.22-0.23.rc7.git6.fc8.ppc";
+ "2.6.22-0.23.rc7.git6.fc8.ppc64"; "2.6.22-0.23.rc7.git6.fc8.ppc64";
+ "2.6.22-0.23.rc7.git6.fc8.x86_64"; "2.6.22-0.rc7.2.fc8.i686";
+ "2.6.22-0.rc7.2.fc8.i686"; "2.6.22-0.rc7.2.fc8.ppc";
+ "2.6.22-0.rc7.2.fc8.ppc"; "2.6.22-0.rc7.2.fc8.ppc64";
+ "2.6.22-0.rc7.2.fc8.ppc64"; "2.6.22-0.rc7.2.fc8.x86_64";
+ "2.6.23.14-135.fc8.i586"; "2.6.23.14-135.fc8.i686";
+ "2.6.23.14-135.fc8.i686"; "2.6.23.14-135.fc8.i686";
+ "2.6.23.14-135.fc8.i686"; "2.6.23.14-135.fc8.ppc";
+ "2.6.23.14-135.fc8.ppc"; "2.6.23.14-135.fc8.ppc64";
+ "2.6.23.14-135.fc8.ppc64"; "2.6.23.14-135.fc8.x86_64";
+ "2.6.23.14-135.fc8.x86_64"; "2.6.23.14-78.fc7.i586";
+ "2.6.23.14-78.fc7.i686"; "2.6.23.14-78.fc7.i686";
+ "2.6.23.14-78.fc7.i686"; "2.6.23.14-78.fc7.ppc"; "2.6.23.14-78.fc7.ppc";
+ "2.6.23.14-78.fc7.ppc64"; "2.6.23.14-78.fc7.ppc64";
+ "2.6.23.14-78.fc7.x86_64"; "2.6.23.14-78.fc7.x86_64";
+ "2.6.24-0.167.rc8.git4.fc9.i586"; "2.6.24-0.167.rc8.git4.fc9.i686";
+ "2.6.24-0.167.rc8.git4.fc9.i686"; "2.6.24-0.167.rc8.git4.fc9.ppc";
+ "2.6.24-0.167.rc8.git4.fc9.ppc"; "2.6.24-0.167.rc8.git4.fc9.ppc64";
+ "2.6.24-0.167.rc8.git4.fc9.ppc64"; "2.6.24-0.167.rc8.git4.fc9.x86_64";
+ "2.6.24-7.fc9.i586"; "2.6.24-7.fc9.i686"; "2.6.24-7.fc9.i686";
+ "2.6.24-7.fc9.ppc"; "2.6.24-7.fc9.ppc"; "2.6.24-7.fc9.ppc64";
+ "2.6.24-7.fc9.ppc64"; "2.6.24-7.fc9.x86_64"; "2.6.24-9.fc9.i586";
+ "2.6.24-9.fc9.i686"; "2.6.24-9.fc9.i686"; "2.6.24-9.fc9.ppc";
+ "2.6.24-9.fc9.ppc"; "2.6.24-9.fc9.ppc64"; "2.6.24-9.fc9.ppc64";
+ "2.6.24-9.fc9.x86_64"; "2.6.25.11-97.fc9.i686";
+ "2.6.25.11-97.fc9.x86_64"; "2.6.26.2-2.fc8.i586"; "2.6.26.2-2.fc8.i686";
+ "2.6.26.2-2.fc8.i686"; "2.6.26.2-2.fc8.i686"; "2.6.26.2-2.fc8.i686";
+ "2.6.26.2-2.fc8.ppc"; "2.6.26.2-2.fc8.ppc"; "2.6.26.2-2.fc8.ppc64";
+ "2.6.26.2-2.fc8.ppc64"; "2.6.26.2-2.fc8.x86_64"; "2.6.26.2-2.fc8.x86_64";
+ "2.6.27-0.244.rc2.git1.fc10.i586"; "2.6.27-0.244.rc2.git1.fc10.i686";
+ "2.6.27-0.244.rc2.git1.fc10.i686"; "2.6.27-0.244.rc2.git1.fc10.ppc";
+ "2.6.27-0.244.rc2.git1.fc10.ppc"; "2.6.27-0.244.rc2.git1.fc10.ppc64";
+ "2.6.27-0.244.rc2.git1.fc10.ppc64"; "2.6.27-0.244.rc2.git1.fc10.x86_64" ];;
.\" ========================================================================
.\"
.IX Title "VIRT-MEM 1"
-.TH VIRT-MEM 1 "2008-08-07" "virt-mem-0.2.9" "Virtualization Support"
+.TH VIRT-MEM 1 "2008-08-11" "virt-mem-0.2.9" "Virtualization Support"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.IP "\fB\-\-help\fR" 4
.IX Item "--help"
Display usage summary.
+.IP "\fB\-\-list\-kernels\fR" 4
+.IX Item "--list-kernels"
+List which guest kernel versions are known/supported, then exit.
.IP "\fB\-t memoryimage\fR" 4
.IX Item "-t memoryimage"
Post-mortem analysis mode.
Display usage summary.
+=item B<--list-kernels>
+
+List which guest kernel versions are known/supported, then exit.
+
=item B<-t memoryimage>
Post-mortem analysis mode.
--help
Display usage summary.
+ --list-kernels
+ List which guest kernel versions are known/supported, then exit.
+
-t memoryimage
Post-mortem analysis mode.