libsmack: implement internal hash table of labels
authorJan Cybulski <j.cybulski@samsung.com>
Tue, 28 Jan 2014 11:32:32 +0000 (12:32 +0100)
committerRafal Krypa <r.krypa@samsung.com>
Thu, 13 Feb 2014 16:18:44 +0000 (17:18 +0100)
commit1798aa4cc3c9fc82ef656110077a355c42ba0a28
tree290afda9266c042e2cd2d88b2d868832ba78352d
parent288fc95f5d50a7a60cbeccc7198b875fd0859aab
libsmack: implement internal hash table of labels

Use hash table implemented internally for dictionary of labels.

Thanks to that some operations are more efficient:
-it is possible to use better hashing function than in hsearch:
 DJB2 algorithm is used, which is much better, than hashing function
 used in hsearch. Hashing function in hsearch causes, that on 32bit
 machines, all labels that have common first eight bytes,
 share same bucket and this cause many conflicts in combination of labels
 naming convention with domain-based prefixes. This leads to significant
 performance degradation in real system. This was not detected on tests
 so far, because labels for test policies were generated randomly.
-it is possible to calculate hash during label validation.
-it would not cause drastic complexity growth to have number of labels
 near to number of allocated buckets as it happens in hsearch.
-it would be possible to add number of labels exceeding number of
 allocated buckets.

Signed-off-by: Jan Cybulski <j.cybulski@samsung.com>
libsmack/libsmack.c