aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-03-30 05:25:51 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-03-30 05:25:51 +0000
commitdcbbdb1b3ee17bee849f96734f0c40d2b74f2ab5 (patch)
treef551013be9ad8f0506b1f24402a5a3bf17a57254
parentd0f6ae68f5db762f3083777df10f617c41f6b076 (diff)
downloadpostgresql-dcbbdb1b3ee17bee849f96734f0c40d2b74f2ab5.tar.gz
postgresql-dcbbdb1b3ee17bee849f96734f0c40d2b74f2ab5.zip
Add appropriately ifdef'd hack to make ARM compiler allocate ItemPointerData
as six bytes not eight. This fixes a regression test failure but more importantly avoids wasting four bytes of pad space in every tuple header. Also add some commentary about what's going on.
-rw-r--r--src/include/storage/itemptr.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/include/storage/itemptr.h b/src/include/storage/itemptr.h
index 5b2c715e01e..b26fab11e76 100644
--- a/src/include/storage/itemptr.h
+++ b/src/include/storage/itemptr.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: itemptr.h,v 1.17 2001/03/22 04:01:06 momjian Exp $
+ * $Id: itemptr.h,v 1.18 2001/03/30 05:25:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,15 +20,29 @@
/*
* ItemPointer:
*
- * this is a pointer to an item on another disk page in the same file.
+ * This is a pointer to an item within a disk page of a known file
+ * (for example, a cross-link from an index to its parent table).
* blkid tells us which block, posid tells us which entry in the linp
* (ItemIdData) array we want.
+ *
+ * Note: because there is an item pointer in each tuple header and index
+ * tuple header on disk, it's very important not to waste space with
+ * structure padding bytes. The struct is designed to be six bytes long
+ * (it contains three int16 fields) but a few compilers will pad it to
+ * eight bytes unless coerced. We apply appropriate persuasion where
+ * possible, and to cope with unpersuadable compilers, we try to use
+ * "SizeOfIptrData" rather than "sizeof(ItemPointerData)" when computing
+ * on-disk sizes.
*/
typedef struct ItemPointerData
{
BlockIdData ip_blkid;
OffsetNumber ip_posid;
-} ItemPointerData;
+}
+#ifdef __arm__
+__attribute__((packed)) /* Appropriate whack upside the head for ARM */
+#endif
+ ItemPointerData;
#define SizeOfIptrData \
(offsetof(ItemPointerData, ip_posid) + sizeof(OffsetNumber))