auto &hs_cache = hs_known_files_cache::get();
const auto *log_func = RSPAMD_LOG_FUNC;
- return raii_mmaped_file::mmap_shared(fname, O_RDONLY, PROT_READ)
+ return raii_mmaped_file::mmap_shared(fname, O_RDONLY, PROT_READ, offset)
.and_then([&]<class T>(T &&cached_serialized) -> tl::expected<hs_shared_database, error> {
#if defined(HS_MAJOR) && defined(HS_MINOR) && HS_MAJOR >= 5 && HS_MINOR >= 4
auto unserialized_fname = fmt::format("{}.unser", fname);
#define C_DB_FROM_CXX(obj) (reinterpret_cast<rspamd_hyperscan_t *>(obj))
rspamd_hyperscan_t *
-rspamd_hyperscan_maybe_load(const char *filename)
+rspamd_hyperscan_maybe_load(const char *filename, goffset offset)
{
- auto maybe_db = rspamd::util::load_cached_hs_file(filename);
+ auto maybe_db = rspamd::util::load_cached_hs_file(filename, offset);
if (maybe_db.has_value()) {
auto *ndb = new rspamd::util::hs_shared_database;
* @param filename
* @return cached database if available
*/
-rspamd_hyperscan_t *rspamd_hyperscan_maybe_load(const char *filename);
+rspamd_hyperscan_t *rspamd_hyperscan_maybe_load(const char *filename, goffset offset);
/**
* Creates a wrapper for a raw hs db. Ownership is transferred to the enclosing object returned
map->cfg->hs_cache_dir,
(gint)rspamd_cryptobox_HASHBYTES / 2, re_map->re_digest);
- re_map->hs_db = rspamd_hyperscan_maybe_load(fp);
+ re_map->hs_db = rspamd_hyperscan_maybe_load(fp, 0);
return re_map->hs_db != NULL;
}
rspamd_snprintf (fp, sizeof (fp), "%s/%*xs.hsmp", hs_cache_dir,
(gint)rspamd_cryptobox_HASHBYTES / 2, hash);
- mp->hs_db = rspamd_hyperscan_maybe_load(fp);
+ mp->hs_db = rspamd_hyperscan_maybe_load(fp, 0);
return mp->hs_db != NULL;
}