LCOV - code coverage report
Current view: top level - security/selinux/ss - symtab.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 12 0.0 %
Date: 2014-02-18 Functions: 0 3 0.0 %
Branches: 0 4 0.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Implementation of the symbol table type.
       3                 :            :  *
       4                 :            :  * Author : Stephen Smalley, <sds@epoch.ncsc.mil>
       5                 :            :  */
       6                 :            : #include <linux/kernel.h>
       7                 :            : #include <linux/string.h>
       8                 :            : #include <linux/errno.h>
       9                 :            : #include "symtab.h"
      10                 :            : 
      11                 :          0 : static unsigned int symhash(struct hashtab *h, const void *key)
      12                 :            : {
      13                 :            :         const char *p, *keyp;
      14                 :            :         unsigned int size;
      15                 :            :         unsigned int val;
      16                 :            : 
      17                 :            :         val = 0;
      18                 :            :         keyp = key;
      19                 :          0 :         size = strlen(keyp);
      20         [ #  # ]:          0 :         for (p = keyp; (p - keyp) < size; p++)
      21                 :          0 :                 val = (val << 4 | (val >> (8*sizeof(unsigned int)-4))) ^ (*p);
      22                 :          0 :         return val & (h->size - 1);
      23                 :            : }
      24                 :            : 
      25                 :          0 : static int symcmp(struct hashtab *h, const void *key1, const void *key2)
      26                 :            : {
      27                 :            :         const char *keyp1, *keyp2;
      28                 :            : 
      29                 :            :         keyp1 = key1;
      30                 :            :         keyp2 = key2;
      31                 :          0 :         return strcmp(keyp1, keyp2);
      32                 :            : }
      33                 :            : 
      34                 :            : 
      35                 :          0 : int symtab_init(struct symtab *s, unsigned int size)
      36                 :            : {
      37                 :          0 :         s->table = hashtab_create(symhash, symcmp, size);
      38         [ #  # ]:          0 :         if (!s->table)
      39                 :            :                 return -ENOMEM;
      40                 :          0 :         s->nprim = 0;
      41                 :          0 :         return 0;
      42                 :            : }
      43                 :            : 

Generated by: LCOV version 1.9