chiark / gitweb /
logind: fix build for ARM with sizeof(dev_t) > sizeof(void*)
[elogind.git] / src / login / logind-session.c
index eea0bfb85b796608a60d4977f3dc2f9a1e8094ca..ce982efed45dc35b7af8dc3d4f3a56dfb28ebb1a 100644 (file)
 #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);