]> git.ipfire.org Git - location/libloc.git/commitdiff
database: Increase page size to 64k
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 22 Aug 2022 10:37:29 +0000 (10:37 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 22 Aug 2022 10:37:29 +0000 (10:37 +0000)
Since libloc is currently only using mmap() to map any databases into
memory, all mapped address range needs to be page aligned.

In the past, every database was aligned to a 4k page boundary. Some
architectures use 64k pages by default which could therefore not open
the database.

This patch changes the alignment to 64k which should hopefully be a
good common denominator. However, older database cannot be opened.

If we would ever have to support an architecture which's page size
is not evenly fitting into 64k, we will have to implement an
alternative to mmap.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libloc/format.h

index a04c089491772bee44c8043f641f110059934ff7..064adb904d3f1b7f823089f68861921d8afd27ce 100644 (file)
@@ -32,8 +32,8 @@ enum loc_database_version {
 
 #define LOC_DATABASE_DOMAIN "_v%u._db.location.ipfire.org"
 
-#define LOC_DATABASE_PAGE_SIZE         4096
-#define LOC_SIGNATURE_MAX_LENGTH       (LOC_DATABASE_PAGE_SIZE / 2)
+#define LOC_DATABASE_PAGE_SIZE         65536
+#define LOC_SIGNATURE_MAX_LENGTH       2048
 
 struct loc_database_magic {
        char magic[7];