diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2013-09-18 01:00:02 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-09-17 19:08:51 -0400 |
commit | 831dedef66dbf2650a9dc41263e624fe08f3bb7a (patch) | |
tree | 6ddb84586b43460eba6930ae596217aa9850466b /src/login/logind-session.c | |
parent | 3db604b907323b8df0fc810216f6112056d26a02 (diff) |
logind: fix build for ARM with sizeof(dev_t) > sizeof(void*)
Unfortunately on ARM-32 systems dev_t can be 64bit and thus we cannot
store it easily in void* keys for hashtables. Fix that by passing a
pointer to the dev_t variable instead.
Diffstat (limited to 'src/login/logind-session.c')
-rw-r--r-- | src/login/logind-session.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/login/logind-session.c b/src/login/logind-session.c index eea0bfb85b..ce982efed4 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -36,6 +36,21 @@ #include "dbus-common.h" #include "logind-session.h" +static unsigned devt_hash_func(const void *p) { + uint64_t u = *(const dev_t*)p; + + return uint64_hash_func(&u); +} + +static int devt_compare_func(const void *_a, const void *_b) { + dev_t a, b; + + a = *(const dev_t*) _a; + b = *(const dev_t*) _b; + + return a < b ? -1 : (a > b ? 1 : 0); +} + Session* session_new(Manager *m, const char *id) { Session *s; @@ -53,7 +68,7 @@ Session* session_new(Manager *m, const char *id) { return NULL; } - s->devices = hashmap_new(trivial_hash_func, trivial_compare_func); + s->devices = hashmap_new(devt_hash_func, devt_compare_func); if (!s->devices) { free(s->state_file); free(s); |