Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc9a7345

Browse files
committed
>the extra level of struct naming for pd_opaque has no obvious
>usefulness.>>> [...] should I post a patch that puts pagesize directly into>> PageHeaderData?>>If you're so inclined. Given that pd_opaque is hidden in those macros,>there wouldn't be much of any gain in readability either, so I haven't>worried about changing the declaration.Thanks for the clarification. Here is the patch. Not much gain, but atleast it saves the next junior hacker from scratching his head ...Manfred Koizar
1 parent22347d6 commitc9a7345

File tree

2 files changed

+18
-26
lines changed

2 files changed

+18
-26
lines changed

‎src/backend/access/hash/hashutil.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashutil.c,v 1.30 2002/06/20 20:29:24 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashutil.c,v 1.31 2002/07/02 06:18:57 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -131,13 +131,13 @@ _hash_checkpage(Page page, int flags)
131131
HashPageOpaqueopaque;
132132

133133
Assert(page);
134-
Assert(((PageHeader) (page))->pd_lower >=(sizeof(PageHeaderData)-sizeof(ItemIdData)));
134+
Assert(((PageHeader) (page))->pd_lower >=SizeOfPageHeaderData);
135135
#if1
136136
Assert(((PageHeader) (page))->pd_upper <=
137137
(BLCKSZ-MAXALIGN(sizeof(HashPageOpaqueData))));
138138
Assert(((PageHeader) (page))->pd_special==
139139
(BLCKSZ-MAXALIGN(sizeof(HashPageOpaqueData))));
140-
Assert(((PageHeader) (page))->pd_opaque.od_pagesize==BLCKSZ);
140+
Assert(PageGetPageSize(page)==BLCKSZ);
141141
#endif
142142
if (flags)
143143
{

‎src/include/storage/bufpage.h‎

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: bufpage.h,v 1.49 2002/07/0205:48:44 momjian Exp $
10+
* $Id: bufpage.h,v 1.50 2002/07/0206:18:57 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -65,8 +65,7 @@
6565
* byte-offset position, tuples can be physically shuffled on a page
6666
* whenever the need arises.
6767
*
68-
* AM-generic per-page information is kept in the pd_opaque field of
69-
* the PageHeaderData.(Currently, only the page size is kept here.)
68+
* AM-generic per-page information is kept in PageHeaderData.
7069
*
7170
* AM-specific per-page data (if any) is kept in the area marked "special
7271
* space"; each AM has an "opaque" structure defined somewhere that is
@@ -92,25 +91,18 @@ typedef uint16 LocationIndex;
9291

9392

9493
/*
94+
* disk page organization
9595
* space management information generic to any page
9696
*
97-
*od_pagesize- size in bytes.
98-
* Minimum possible page size is perhaps 64B to fit
99-
* page header, opaque space and a minimal tuple;
100-
* of course, in reality you want it much bigger.
101-
* On the high end, we can only support pages up
102-
* to 32KB because lp_off/lp_len are 15 bits.
103-
*/
104-
typedefstructOpaqueData
105-
{
106-
uint16od_pagesize;
107-
}OpaqueData;
108-
109-
typedefOpaqueData*Opaque;
110-
111-
112-
/*
113-
* disk page organization
97+
*pd_lower - offset to start of free space.
98+
*pd_upper - offset to end of free space.
99+
*pd_special - offset to start of special space.
100+
*pd_pagesize- size in bytes.
101+
* Minimum possible page size is perhaps 64B to fit
102+
* page header, opaque space and a minimal tuple;
103+
* of course, in reality you want it much bigger.
104+
* On the high end, we can only support pages up
105+
* to 32KB because lp_off/lp_len are 15 bits.
114106
*/
115107
typedefstructPageHeaderData
116108
{
@@ -124,7 +116,7 @@ typedef struct PageHeaderData
124116
LocationIndexpd_lower;/* offset to start of free space */
125117
LocationIndexpd_upper;/* offset to end of free space */
126118
LocationIndexpd_special;/* offset to start of special space */
127-
OpaqueDatapd_opaque;/* AM-generic information */
119+
uint16pd_pagesize;
128120
ItemIdDatapd_linp[1];/* beginning of line pointer array */
129121
}PageHeaderData;
130122

@@ -216,14 +208,14 @@ typedef enum
216208
* however, it can be called on a page for which there is no buffer.
217209
*/
218210
#definePageGetPageSize(page) \
219-
((Size) ((PageHeader) (page))->pd_opaque.od_pagesize)
211+
((Size) ((PageHeader) (page))->pd_pagesize)
220212

221213
/*
222214
* PageSetPageSize
223215
*Sets the page size of a page.
224216
*/
225217
#definePageSetPageSize(page,size) \
226-
(((PageHeader) (page))->pd_opaque.od_pagesize = (size))
218+
(((PageHeader) (page))->pd_pagesize = (size))
227219

228220
/* ----------------
229221
*page special data macros

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp