2 * Copyright (C) 2013-2015 Kay Sievers
3 * Copyright (C) 2013-2015 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 * Copyright (C) 2013-2015 Daniel Mack <daniel@zonque.org>
5 * Copyright (C) 2013-2015 David Herrmann <dh.herrmann@gmail.com>
6 * Copyright (C) 2013-2015 Linux Foundation
8 * kdbus is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU Lesser General Public License as published by the
10 * Free Software Foundation; either version 2.1 of the License, or (at
11 * your option) any later version.
14 #ifndef __KDBUS_POLICY_H
15 #define __KDBUS_POLICY_H
17 #include <linux/hashtable.h>
18 #include <linux/rwsem.h>
24 * struct kdbus_policy_db - policy database
25 * @entries_hash: Hashtable of entries
26 * @entries_rwlock: Mutex to protect the database's access entries
28 struct kdbus_policy_db {
29 DECLARE_HASHTABLE(entries_hash, 6);
30 struct rw_semaphore entries_rwlock;
33 void kdbus_policy_db_init(struct kdbus_policy_db *db);
34 void kdbus_policy_db_clear(struct kdbus_policy_db *db);
36 int kdbus_policy_query_unlocked(struct kdbus_policy_db *db,
37 const struct cred *cred, const char *name,
39 int kdbus_policy_query(struct kdbus_policy_db *db, const struct cred *cred,
40 const char *name, unsigned int hash);
42 void kdbus_policy_remove_owner(struct kdbus_policy_db *db,
44 int kdbus_policy_set(struct kdbus_policy_db *db,
45 const struct kdbus_item *items,