git.annexia.org
/
virt-mem.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
58c91a3
)
Warn if data file is missing.
author
Richard W.M. Jones
<rjones@redhat.com>
Tue, 23 Sep 2008 14:44:54 +0000
(15:44 +0100)
committer
Richard W.M. Jones
<rjones@redhat.com>
Tue, 23 Sep 2008 14:44:54 +0000
(15:44 +0100)
extract/codegen/pahole_parser.ml
patch
|
blob
|
history
diff --git
a/extract/codegen/pahole_parser.ml
b/extract/codegen/pahole_parser.ml
index
029ecde
..
19cbbf1
100644
(file)
--- a/
extract/codegen/pahole_parser.ml
+++ b/
extract/codegen/pahole_parser.ml
@@
-79,6
+79,10
@@
and string_of_f_type = function
| FInteger -> "int"
| FString width -> sprintf "char[%d]" width
| FInteger -> "int"
| FString width -> sprintf "char[%d]" width
+let file_exists name =
+ try Unix.access name [Unix.F_OK]; true
+ with Unix.Unix_error _ -> false
+
(* Regular expressions. We really really should use ocaml-mikmatch ... *)
let re_oldformat = Pcre.regexp "^RPM: \\d+: \\(build \\d+\\) ([-\\w]+) ([\\w.]+) ([\\w.]+) \\(.*?\\) (\\w+)"
let re_keyvalue = Pcre.regexp "^(\\w+): (.*)"
(* Regular expressions. We really really should use ocaml-mikmatch ... *)
let re_oldformat = Pcre.regexp "^RPM: \\d+: \\(build \\d+\\) ([-\\w]+) ([\\w.]+) ([\\w.]+) \\(.*?\\) (\\w+)"
let re_keyvalue = Pcre.regexp "^(\\w+): (.*)"
@@
-151,6
+155,23
@@
let list_kernels path =
basename = basename; arch = arch;
kernel_version = version }
) infos in
basename = basename; arch = arch;
kernel_version = version }
) infos in
+
+ (* Check the .data, .data.gz or .data.bz2 file exists, and skip with
+ * a warning if not.
+ *)
+ let infos = List.filter (
+ fun { basename = basename } ->
+ if not (file_exists (basename ^ ".data")) &&
+ not (file_exists (basename ^ ".data.gz")) &&
+ not (file_exists (basename ^ ".data.bz2")) then (
+ eprintf "warning: %s: no data file found for this kernel - skipping\n%!"
+ basename;
+ false
+ )
+ else
+ true
+ ) infos in
+
infos
(* XXX This would be better as a proper lex/yacc parser.
infos
(* XXX This would be better as a proper lex/yacc parser.
@@
-175,10
+196,6
@@
let load_structures { basename = basename } struct_names =
) struct_names;
(* Now read the data file and parse out the structures of interest. *)
) struct_names;
(* Now read the data file and parse out the structures of interest. *)
- let file_exists name =
- try Unix.access name [Unix.F_OK]; true
- with Unix.Unix_error _ -> false
- in
let close_process_in cmd chan =
match Unix.close_process_in chan with
| Unix.WEXITED 0 -> ()
let close_process_in cmd chan =
match Unix.close_process_in chan with
| Unix.WEXITED 0 -> ()