summaryrefslogtreecommitdiff
path: root/lib/sqfs/frag_table.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqfs/frag_table.c')
-rw-r--r--lib/sqfs/frag_table.c75
1 files changed, 0 insertions, 75 deletions
diff --git a/lib/sqfs/frag_table.c b/lib/sqfs/frag_table.c
index 366cb85..f0b01da 100644
--- a/lib/sqfs/frag_table.c
+++ b/lib/sqfs/frag_table.c
@@ -14,54 +14,21 @@
#include "sqfs/block.h"
#include "compat.h"
-#include "hash_table.h"
-
#include <stdlib.h>
#include <string.h>
-
-typedef struct chunk_info_t {
- struct chunk_info_t *next;
- sqfs_u32 index;
- sqfs_u32 offset;
- sqfs_u32 size;
- sqfs_u32 hash;
-} chunk_info_t;
-
-
struct sqfs_frag_table_t {
sqfs_object_t base;
size_t capacity;
size_t used;
sqfs_fragment_t *table;
-
- struct hash_table *ht;
};
-static uint32_t chunk_info_hash(const void *key)
-{
- const chunk_info_t *chunk = key;
- return chunk->hash;
-}
-
-static bool chunk_info_equals(const void *a, const void *b)
-{
- const chunk_info_t *a_ = a, *b_ = b;
- return a_->size == b_->size &&
- a_->hash == b_->hash;
-}
-
-static void delete_function(struct hash_entry *entry)
-{
- free(entry->data);
-}
-
static void frag_table_destroy(sqfs_object_t *obj)
{
sqfs_frag_table_t *tbl = (sqfs_frag_table_t *)obj;
- hash_table_destroy(tbl->ht, delete_function);
free(tbl->table);
free(tbl);
}
@@ -76,8 +43,6 @@ static sqfs_object_t *frag_table_copy(const sqfs_object_t *obj)
return NULL;
memcpy(copy, tbl, sizeof(*tbl));
-
- copy->ht = hash_table_clone(tbl->ht);
return (sqfs_object_t *)copy;
}
@@ -92,8 +57,6 @@ sqfs_frag_table_t *sqfs_frag_table_create(sqfs_u32 flags)
if (tbl == NULL)
return NULL;
- tbl->ht = hash_table_create(chunk_info_hash, chunk_info_equals);
-
((sqfs_object_t *)tbl)->copy = frag_table_copy;
((sqfs_object_t *)tbl)->destroy = frag_table_destroy;
return tbl;
@@ -249,41 +212,3 @@ size_t sqfs_frag_table_get_size(sqfs_frag_table_t *tbl)
{
return tbl->used;
}
-
-int sqfs_frag_table_add_tail_end(sqfs_frag_table_t *tbl,
- sqfs_u32 index, sqfs_u32 offset,
- sqfs_u32 size, sqfs_u32 hash)
-{
- chunk_info_t *new = calloc(1, sizeof(*new));
- if (new == NULL)
- return SQFS_ERROR_ALLOC;
-
- new->index = index;
- new->offset = offset;
- new->size = size;
- new->hash = hash;
-
- hash_table_insert_pre_hashed(tbl->ht, new->hash, new, new);
-
- return 0;
-}
-
-int sqfs_frag_table_find_tail_end(sqfs_frag_table_t *tbl,
- sqfs_u32 hash, sqfs_u32 size,
- sqfs_u32 *index, sqfs_u32 *offset)
-{
- struct hash_entry *entry;
- chunk_info_t *chunk, search;
-
- search.hash = hash;
- search.size = size;
-
- entry = hash_table_search_pre_hashed(tbl->ht, hash, &search);
- if (!entry)
- return SQFS_ERROR_NO_ENTRY;
-
- chunk = entry->data;
- *index = chunk->index;
- *offset = chunk->offset;
- return 0;
-}