From 1f329b5e2af4710a254e252529e8eee2fab4fd67 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 20 Apr 2009 16:41:52 -0700 Subject: Add a function to hash typequery modules --- hash.cxx | 20 ++++++++++++++++++++ hash.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/hash.cxx b/hash.cxx index 01013c43..45ae05eb 100644 --- a/hash.cxx +++ b/hash.cxx @@ -273,4 +273,24 @@ find_tracequery_hash (systemtap_session& s) s.tracequery_path = hashdir + "/tracequery_" + result + ".ko"; } + +void +find_typequery_hash (systemtap_session& s, const string& name, string& module) +{ + hash h; + get_base_hash(s, h); + + // Add the typequery name to distinguish the hash + h.add(name); + + // Get the directory path to store our cached module + string result, hashdir; + h.result(result); + if (!create_hashdir(s, result, hashdir)) + return; + + module = hashdir + "/typequery_" + result + + (name[0] == 'k' ? ".ko" : ".so"); +} + /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */ diff --git a/hash.h b/hash.h index bb3d5ae1..7e432216 100644 --- a/hash.h +++ b/hash.h @@ -37,5 +37,7 @@ public: void find_hash (systemtap_session& s, const std::string& script); void find_tracequery_hash (systemtap_session& s); +void find_typequery_hash (systemtap_session& s, const std::string& name, + std::string& module); /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */ -- cgit