summaryrefslogtreecommitdiff
path: root/security/selinux/ss/hashtab.h
diff options
context:
space:
mode:
authorOndrej Mosnacek <omosnace@redhat.com>2020-04-28 15:55:12 +0300
committerPaul Moore <paul@paul-moore.com>2020-05-01 23:34:57 +0300
commit03414a49ad5f3c56988c36d2070e402ffa17feaf (patch)
tree810a13efb69606650b481efaf4afec11b5abacad /security/selinux/ss/hashtab.h
parent46619b44e431d85d64a8dfcb7166d0ae098544c8 (diff)
downloadlinux-03414a49ad5f3c56988c36d2070e402ffa17feaf.tar.xz
selinux: do not allocate hashtabs dynamically
It is simpler to allocate them statically in the corresponding structure, avoiding unnecessary kmalloc() calls and pointer dereferencing. Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com> [PM: manual merging required in policydb.c] Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/selinux/ss/hashtab.h')
-rw-r--r--security/selinux/ss/hashtab.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/security/selinux/ss/hashtab.h b/security/selinux/ss/hashtab.h
index dde54d9ff01c..31c11511fe10 100644
--- a/security/selinux/ss/hashtab.h
+++ b/security/selinux/ss/hashtab.h
@@ -35,14 +35,15 @@ struct hashtab_info {
};
/*
- * Creates a new hash table with the specified characteristics.
+ * Initializes a new hash table with the specified characteristics.
*
- * Returns NULL if insufficent space is available or
- * the new hash table otherwise.
+ * Returns -ENOMEM if insufficient space is available or 0 otherwise.
*/
-struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, const void *key),
- int (*keycmp)(struct hashtab *h, const void *key1, const void *key2),
- u32 nel_hint);
+int hashtab_init(struct hashtab *h,
+ u32 (*hash_value)(struct hashtab *h, const void *key),
+ int (*keycmp)(struct hashtab *h, const void *key1,
+ const void *key2),
+ u32 nel_hint);
/*
* Inserts the specified (key, datum) pair into the specified hash table.