#include <common/macros.h>
#include <common/payload.h>
#include <common/payload-view.h>
+#include <common/hashtable/hashtable.h>
+#include <common/hashtable/utils.h>
#include <fcntl.h>
#include <lttng/constant.h>
#include <lttng/kernel-probe.h>
const struct lttng_kernel_probe_location *a,
const struct lttng_kernel_probe_location *b);
+static
+unsigned long lttng_kernel_probe_location_address_hash(
+ const struct lttng_kernel_probe_location *location);
+
+static
+unsigned long lttng_kernel_probe_location_symbol_hash(
+ const struct lttng_kernel_probe_location *location);
+
enum lttng_kernel_probe_location_type lttng_kernel_probe_location_get_type(
const struct lttng_kernel_probe_location *location)
{
ret->type = LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS;
ret->equal = lttng_kernel_probe_location_address_is_equal;
ret->serialize = lttng_kernel_probe_location_address_serialize;
+ ret->hash = lttng_kernel_probe_location_address_hash;
end:
return ret;
ret->type = LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET;
ret->equal = lttng_kernel_probe_location_symbol_is_equal;
ret->serialize = lttng_kernel_probe_location_symbol_serialize;
+ ret->hash = lttng_kernel_probe_location_symbol_hash;
goto end;
error:
return ret;
}
+static
+unsigned long lttng_kernel_probe_location_address_hash(
+ const struct lttng_kernel_probe_location *location)
+{
+ unsigned long hash = hash_key_ulong(
+ (void *) LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS,
+ lttng_ht_seed);
+ struct lttng_kernel_probe_location_address *address_location =
+ container_of(location, typeof(*address_location),
+ parent);
+
+ hash ^= hash_key_u64(&address_location->address, lttng_ht_seed);
+
+ return hash;
+}
+
static
bool lttng_kernel_probe_location_address_is_equal(
const struct lttng_kernel_probe_location *_a,
return is_equal;
}
+static
+unsigned long lttng_kernel_probe_location_symbol_hash(
+ const struct lttng_kernel_probe_location *location)
+{
+ unsigned long hash = hash_key_ulong(
+ (void *) LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET,
+ lttng_ht_seed);
+ struct lttng_kernel_probe_location_symbol *symbol_location =
+ container_of(location, typeof(*symbol_location),
+ parent);
+
+ hash ^= hash_key_str(symbol_location->symbol_name, lttng_ht_seed);
+ hash ^= hash_key_u64(&symbol_location->offset, lttng_ht_seed);
+
+ return hash;
+}
+
static
bool lttng_kernel_probe_location_symbol_is_equal(
const struct lttng_kernel_probe_location *_a,
err:
return new_location;
}
+
+LTTNG_HIDDEN
+unsigned long lttng_kernel_probe_location_hash(
+ const struct lttng_kernel_probe_location *location)
+{
+ return location->hash(location);
+}