mirror of
https://github.com/systemd/systemd.git
synced 2025-03-19 22:50:17 +03:00
pidref: export hash funcs
That way we can use them for definition of additional hash_ops that map pidrefs to arbitrary other resources.
This commit is contained in:
parent
a147e72add
commit
2ad187fb68
@ -457,11 +457,11 @@ bool pidref_is_automatic(const PidRef *pidref) {
|
||||
return pidref && pid_is_automatic(pidref->pid);
|
||||
}
|
||||
|
||||
static void pidref_hash_func(const PidRef *pidref, struct siphash *state) {
|
||||
void pidref_hash_func(const PidRef *pidref, struct siphash *state) {
|
||||
siphash24_compress_typesafe(pidref->pid, state);
|
||||
}
|
||||
|
||||
static int pidref_compare_func(const PidRef *a, const PidRef *b) {
|
||||
int pidref_compare_func(const PidRef *a, const PidRef *b) {
|
||||
return CMP(a->pid, b->pid);
|
||||
}
|
||||
|
||||
|
@ -108,5 +108,9 @@ int pidref_verify(const PidRef *pidref);
|
||||
|
||||
#define TAKE_PIDREF(p) TAKE_GENERIC((p), PidRef, PIDREF_NULL)
|
||||
|
||||
struct siphash;
|
||||
void pidref_hash_func(const PidRef *pidref, struct siphash *state);
|
||||
int pidref_compare_func(const PidRef *a, const PidRef *b);
|
||||
|
||||
extern const struct hash_ops pidref_hash_ops;
|
||||
extern const struct hash_ops pidref_hash_ops_free; /* Has destructor call for pidref_free(), i.e. expects heap allocated PidRef as keys */
|
||||
|
Loading…
x
Reference in New Issue
Block a user