File: 005-pg_crypt_size.patch

package info (click to toggle)
db5.3 5.3.28-9
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 163,292 kB
  • sloc: ansic: 448,411; java: 111,824; tcl: 80,544; sh: 44,326; cs: 33,697; cpp: 21,604; perl: 14,557; xml: 10,799; makefile: 4,104; yacc: 1,003; awk: 965; sql: 801; erlang: 342; python: 216; php: 24; asm: 14
file content (29 lines) | stat: -rw-r--r-- 966 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--- db5.3.orig/src/dbinc/db_page.h
+++ db5.3/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)							\