using namespace std;
-class hash
+class stap_hash
{
private:
struct mdfour md4;
std::ostringstream parm_stream;
public:
- hash() { start(); }
- hash(const hash &base) { md4 = base.md4; parm_stream << base.parm_stream.str(); }
+ stap_hash() { start(); }
+ stap_hash(const stap_hash &base) { md4 = base.md4; parm_stream << base.parm_stream.str(); }
void start();
void
-hash::start()
+stap_hash::start()
{
mdfour_begin(&md4);
}
void
-hash::add(const std::string& description, const unsigned char *buffer, size_t size)
+stap_hash::add(const std::string& description, const unsigned char *buffer, size_t size)
{
parm_stream << description << buffer << endl;
mdfour_update(&md4, buffer, size);
template <typename T> void
-hash::add(const std::string& d, const T& x)
+stap_hash::add(const std::string& d, const T& x)
{
parm_stream << d << x << endl;
mdfour_update(&md4, (const unsigned char *)&x, sizeof(x));
void
-hash::add_path(const std::string& description, const std::string& path)
+stap_hash::add_path(const std::string& description, const std::string& path)
{
struct stat st;
memset (&st, 0, sizeof(st));
void
-hash::result(string& r)
+stap_hash::result(string& r)
{
ostringstream rstream;
unsigned char sum[16];
log_file.close();
}
-static const hash&
+static const stap_hash&
get_base_hash (systemtap_session& s)
{
map<string, string> dummy;
if (s.base_hash)
return *s.base_hash;
- s.base_hash = new hash();
- hash& h = *s.base_hash;
+ s.base_hash = new stap_hash();
+ stap_hash& h = *s.base_hash;
// Hash kernel release and arch.
h.add("Kernel Release: ", s.kernel_release);
void
find_script_hash (systemtap_session& s, const string& script)
{
- hash h(get_base_hash(s));
+ stap_hash h(get_base_hash(s));
struct stat st;
// Hash getuid. This really shouldn't be necessary (since who you
void
find_stapconf_hash (systemtap_session& s)
{
- hash h(get_base_hash(s));
+ stap_hash h(get_base_hash(s));
// Add any custom kbuild flags
for (unsigned i = 0; i < s.kbuildflags.size(); i++)
string
find_tracequery_hash (systemtap_session& s, const string& header)
{
- hash h(get_base_hash(s));
+ stap_hash h(get_base_hash(s));
// Add the tracepoint header to the computed hash
h.add_path("Header ", header);
string
find_typequery_hash (systemtap_session& s, const string& name)
{
- hash h(get_base_hash(s));
+ stap_hash h(get_base_hash(s));
// Add the typequery name to distinguish the hash
h.add("Typequery Name: ", name);
string
find_uprobes_hash (systemtap_session& s)
{
- hash h(get_base_hash(s));
+ stap_hash h(get_base_hash(s));
// Hash runtime uprobes paths
h.add_path("Uprobes Runtime Path /uprobes ", s.runtime_path + "/uprobes");