0
0
mirror of https://github.com/openwrt/packages.git synced 2025-01-31 03:41:44 +00:00
packages/libs/db/patches/160-pg_crypt_size.patch
Rosen Penev e7badaa6cb db47: replace with db
There's no need to maintain an old version.

Removed all patches as they are all upstream.

Import new ones from Arch, Debian, and OpenEmbedded.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2024-08-22 20:41:15 -07:00

30 lines
953 B
Diff

--- a/src/dbinc/db_page.h
+++ b/src/dbinc/db_page.h
@@ -256,6 +256,17 @@ typedef struct __pg_crypto {
*/
} PG_CRYPTO;
+/*
+ * With most compilers sizeof(PG_CRYPTO) == 38. However some ABIs
+ * require it to be padded to 40 bytes. The padding must be excluded
+ * from our size calculations due to the 16-byte alignment requirement
+ * for crypto.
+ *
+ * A similar problem applies to PG_CHKSUM, but it's too late to change
+ * that.
+ */
+#define SIZEOF_PG_CRYPTO 38
+
typedef struct _db_page {
DB_LSN lsn; /* 00-07: Log sequence number. */
db_pgno_t pgno; /* 08-11: Current page number. */
@@ -291,7 +302,7 @@ typedef struct _db_page {
*/
#define P_INP(dbp, pg) \
((db_indx_t *)((u_int8_t *)(pg) + SIZEOF_PAGE + \
- (F_ISSET((dbp), DB_AM_ENCRYPT) ? sizeof(PG_CRYPTO) : \
+ (F_ISSET((dbp), DB_AM_ENCRYPT) ? SIZEOF_PG_CRYPTO : \
(F_ISSET((dbp), DB_AM_CHKSUM) ? sizeof(PG_CHKSUM) : 0))))
#define P_IV(dbp, pg) \