object-store: move `struct packed_git` into "packfile.h"
The "object-store.h" header contains the definition of `struct packed_git`. As this structure hosts all kind of information about a specific packfile it is arguably a bit out of place in a generic place like "object-store.h". Move the structure as well as `pack_map_entry_cmp()` into "packfile.h". Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
d61ff9c237
commit
ddb28da58f
|
@ -92,65 +92,8 @@ struct oidtree *odb_loose_cache(struct object_directory *odb,
|
|||
/* Empty the loose object cache for the specified object directory. */
|
||||
void odb_clear_loose_cache(struct object_directory *odb);
|
||||
|
||||
struct packed_git {
|
||||
struct hashmap_entry packmap_ent;
|
||||
struct packed_git *next;
|
||||
struct list_head mru;
|
||||
struct pack_window *windows;
|
||||
off_t pack_size;
|
||||
const void *index_data;
|
||||
size_t index_size;
|
||||
uint32_t num_objects;
|
||||
size_t crc_offset;
|
||||
struct oidset bad_objects;
|
||||
int index_version;
|
||||
time_t mtime;
|
||||
int pack_fd;
|
||||
int index; /* for builtin/pack-objects.c */
|
||||
unsigned pack_local:1,
|
||||
pack_keep:1,
|
||||
pack_keep_in_core:1,
|
||||
freshened:1,
|
||||
do_not_close:1,
|
||||
pack_promisor:1,
|
||||
multi_pack_index:1,
|
||||
is_cruft:1;
|
||||
unsigned char hash[GIT_MAX_RAWSZ];
|
||||
struct revindex_entry *revindex;
|
||||
const uint32_t *revindex_data;
|
||||
const uint32_t *revindex_map;
|
||||
size_t revindex_size;
|
||||
/*
|
||||
* mtimes_map points at the beginning of the memory mapped region of
|
||||
* this pack's corresponding .mtimes file, and mtimes_size is the size
|
||||
* of that .mtimes file
|
||||
*/
|
||||
const uint32_t *mtimes_map;
|
||||
size_t mtimes_size;
|
||||
|
||||
/* repo denotes the repository this packfile belongs to */
|
||||
struct repository *repo;
|
||||
|
||||
/* something like ".git/objects/pack/xxxxx.pack" */
|
||||
char pack_name[FLEX_ARRAY]; /* more */
|
||||
};
|
||||
|
||||
struct packed_git;
|
||||
struct multi_pack_index;
|
||||
|
||||
static inline int pack_map_entry_cmp(const void *cmp_data UNUSED,
|
||||
const struct hashmap_entry *entry,
|
||||
const struct hashmap_entry *entry2,
|
||||
const void *keydata)
|
||||
{
|
||||
const char *key = keydata;
|
||||
const struct packed_git *pg1, *pg2;
|
||||
|
||||
pg1 = container_of(entry, const struct packed_git, packmap_ent);
|
||||
pg2 = container_of(entry2, const struct packed_git, packmap_ent);
|
||||
|
||||
return strcmp(pg1->pack_name, key ? key : pg2->pack_name);
|
||||
}
|
||||
|
||||
struct cached_object_entry;
|
||||
|
||||
struct raw_object_store {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "object-store.h"
|
||||
#include "thread-utils.h"
|
||||
#include "pack.h"
|
||||
#include "packfile.h"
|
||||
|
||||
struct repository;
|
||||
|
||||
|
|
59
packfile.h
59
packfile.h
|
@ -1,13 +1,70 @@
|
|||
#ifndef PACKFILE_H
|
||||
#define PACKFILE_H
|
||||
|
||||
#include "list.h"
|
||||
#include "object.h"
|
||||
#include "oidset.h"
|
||||
|
||||
/* in object-store.h */
|
||||
struct packed_git;
|
||||
struct object_info;
|
||||
|
||||
struct packed_git {
|
||||
struct hashmap_entry packmap_ent;
|
||||
struct packed_git *next;
|
||||
struct list_head mru;
|
||||
struct pack_window *windows;
|
||||
off_t pack_size;
|
||||
const void *index_data;
|
||||
size_t index_size;
|
||||
uint32_t num_objects;
|
||||
size_t crc_offset;
|
||||
struct oidset bad_objects;
|
||||
int index_version;
|
||||
time_t mtime;
|
||||
int pack_fd;
|
||||
int index; /* for builtin/pack-objects.c */
|
||||
unsigned pack_local:1,
|
||||
pack_keep:1,
|
||||
pack_keep_in_core:1,
|
||||
freshened:1,
|
||||
do_not_close:1,
|
||||
pack_promisor:1,
|
||||
multi_pack_index:1,
|
||||
is_cruft:1;
|
||||
unsigned char hash[GIT_MAX_RAWSZ];
|
||||
struct revindex_entry *revindex;
|
||||
const uint32_t *revindex_data;
|
||||
const uint32_t *revindex_map;
|
||||
size_t revindex_size;
|
||||
/*
|
||||
* mtimes_map points at the beginning of the memory mapped region of
|
||||
* this pack's corresponding .mtimes file, and mtimes_size is the size
|
||||
* of that .mtimes file
|
||||
*/
|
||||
const uint32_t *mtimes_map;
|
||||
size_t mtimes_size;
|
||||
|
||||
/* repo denotes the repository this packfile belongs to */
|
||||
struct repository *repo;
|
||||
|
||||
/* something like ".git/objects/pack/xxxxx.pack" */
|
||||
char pack_name[FLEX_ARRAY]; /* more */
|
||||
};
|
||||
|
||||
static inline int pack_map_entry_cmp(const void *cmp_data UNUSED,
|
||||
const struct hashmap_entry *entry,
|
||||
const struct hashmap_entry *entry2,
|
||||
const void *keydata)
|
||||
{
|
||||
const char *key = keydata;
|
||||
const struct packed_git *pg1, *pg2;
|
||||
|
||||
pg1 = container_of(entry, const struct packed_git, packmap_ent);
|
||||
pg2 = container_of(entry2, const struct packed_git, packmap_ent);
|
||||
|
||||
return strcmp(pg1->pack_name, key ? key : pg2->pack_name);
|
||||
}
|
||||
|
||||
struct pack_window {
|
||||
struct pack_window *next;
|
||||
unsigned char *base;
|
||||
|
|
Loading…
Reference in New Issue