memset(o, 0, sizeof(*o));
o->repo = repo;
+ o->packfiles = packfile_store_new(o);
INIT_LIST_HEAD(&o->packed_git_mru);
hashmap_init(&o->pack_map, pack_map_entry_cmp, NULL, 0);
pthread_mutex_init(&o->replace_mutex, NULL);
};
struct packed_git;
+struct packfile_store;
struct cached_object_entry;
/*
*
* should only be accessed directly by packfile.c
*/
-
+ struct packfile_store *packfiles;
struct packed_git *packed_git;
/* A most-recently-used ordered version of the packed_git list. */
struct list_head packed_git_mru;
*len = hdr - out;
return 0;
}
+
+struct packfile_store *packfile_store_new(struct object_database *odb)
+{
+ struct packfile_store *store;
+ CALLOC_ARRAY(store, 1);
+ store->odb = odb;
+ return store;
+}
+
+void packfile_store_free(struct packfile_store *store)
+{
+ free(store);
+}
char pack_name[FLEX_ARRAY]; /* more */
};
+/*
+ * A store that manages packfiles for a given object database.
+ */
+struct packfile_store {
+ struct object_database *odb;
+};
+
+/*
+ * Allocate and initialize a new empty packfile store for the given object
+ * database.
+ */
+struct packfile_store *packfile_store_new(struct object_database *odb);
+
+/*
+ * Free the packfile store and all its associated state.
+ */
+void packfile_store_free(struct packfile_store *store);
+
static inline int pack_map_entry_cmp(const void *cmp_data UNUSED,
const struct hashmap_entry *entry,
const struct hashmap_entry *entry2,