vserver 2.0 rc7
[linux-2.6.git] / security / selinux / ss / hashtab.c
index 2a6752a..26661fc 100644 (file)
@@ -73,81 +73,6 @@ int hashtab_insert(struct hashtab *h, void *key, void *datum)
        return 0;
 }
 
-int hashtab_remove(struct hashtab *h, void *key,
-                  void (*destroy)(void *k, void *d, void *args),
-                  void *args)
-{
-       u32 hvalue;
-       struct hashtab_node *cur, *last;
-
-       if (!h)
-               return -EINVAL;
-
-       hvalue = h->hash_value(h, key);
-       last = NULL;
-       cur = h->htable[hvalue];
-       while (cur != NULL && h->keycmp(h, key, cur->key) > 0) {
-               last = cur;
-               cur = cur->next;
-       }
-
-       if (cur == NULL || (h->keycmp(h, key, cur->key) != 0))
-               return -ENOENT;
-
-       if (last == NULL)
-               h->htable[hvalue] = cur->next;
-       else
-               last->next = cur->next;
-
-       if (destroy)
-               destroy(cur->key, cur->datum, args);
-       kfree(cur);
-       h->nel--;
-       return 0;
-}
-
-int hashtab_replace(struct hashtab *h, void *key, void *datum,
-                   void (*destroy)(void *k, void *d, void *args),
-                   void *args)
-{
-       u32 hvalue;
-       struct hashtab_node *prev, *cur, *newnode;
-
-       if (!h)
-               return -EINVAL;
-
-       hvalue = h->hash_value(h, key);
-       prev = NULL;
-       cur = h->htable[hvalue];
-       while (cur != NULL && h->keycmp(h, key, cur->key) > 0) {
-               prev = cur;
-               cur = cur->next;
-       }
-
-       if (cur && (h->keycmp(h, key, cur->key) == 0)) {
-               if (destroy)
-                       destroy(cur->key, cur->datum, args);
-               cur->key = key;
-               cur->datum = datum;
-       } else {
-               newnode = kmalloc(sizeof(*newnode), GFP_KERNEL);
-               if (newnode == NULL)
-                       return -ENOMEM;
-               memset(newnode, 0, sizeof(*newnode));
-               newnode->key = key;
-               newnode->datum = datum;
-               if (prev) {
-                       newnode->next = prev->next;
-                       prev->next = newnode;
-               } else {
-                       newnode->next = h->htable[hvalue];
-                       h->htable[hvalue] = newnode;
-               }
-       }
-
-       return 0;
-}
-
 void *hashtab_search(struct hashtab *h, void *key)
 {
        u32 hvalue;
@@ -215,44 +140,6 @@ int hashtab_map(struct hashtab *h,
 }
 
 
-void hashtab_map_remove_on_error(struct hashtab *h,
-                                 int (*apply)(void *k, void *d, void *args),
-                                 void (*destroy)(void *k, void *d, void *args),
-                                 void *args)
-{
-       u32 i;
-       int ret;
-       struct hashtab_node *last, *cur, *temp;
-
-       if (!h)
-               return;
-
-       for (i = 0; i < h->size; i++) {
-               last = NULL;
-               cur = h->htable[i];
-               while (cur != NULL) {
-                       ret = apply(cur->key, cur->datum, args);
-                       if (ret) {
-                               if (last)
-                                       last->next = cur->next;
-                               else
-                                       h->htable[i] = cur->next;
-
-                               temp = cur;
-                               cur = cur->next;
-                               if (destroy)
-                                       destroy(temp->key, temp->datum, args);
-                               kfree(temp);
-                               h->nel--;
-                       } else {
-                               last = cur;
-                               cur = cur->next;
-                       }
-               }
-       }
-       return;
-}
-
 void hashtab_stat(struct hashtab *h, struct hashtab_info *info)
 {
        u32 i, chain_len, slots_used, max_chain_len;