Skip to content

Commit b92f9f7

Browse files
committed
Split macros from visibilitymap.h into a separate header
That allows to include just visibilitymapdefs.h from file.c, and in turn, remove include of postgres.h from relcache.h. Reported-by: Andres Freund Discussion: https://postgr.es/m/20210913232614.czafiubr435l6egi%40alap3.anarazel.de Author: Alexander Korotkov Reviewed-by: Andres Freund, Tom Lane, Alvaro Herrera Backpatch-through: 13
1 parent ad8a166 commit b92f9f7

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

src/bin/pg_upgrade/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <linux/fs.h>
2020
#endif
2121

22-
#include "access/visibilitymap.h"
22+
#include "access/visibilitymapdefs.h"
2323
#include "common/file_perm.h"
2424
#include "pg_upgrade.h"
2525
#include "storage/bufpage.h"

src/include/access/visibilitymap.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,12 @@
1414
#ifndef VISIBILITYMAP_H
1515
#define VISIBILITYMAP_H
1616

17+
#include "access/visibilitymapdefs.h"
1718
#include "access/xlogdefs.h"
1819
#include "storage/block.h"
1920
#include "storage/buf.h"
2021
#include "utils/relcache.h"
2122

22-
/* Number of bits for one heap page */
23-
#define BITS_PER_HEAPBLOCK 2
24-
25-
/* Flags for bit map */
26-
#define VISIBILITYMAP_ALL_VISIBLE 0x01
27-
#define VISIBILITYMAP_ALL_FROZEN 0x02
28-
#define VISIBILITYMAP_VALID_BITS 0x03 /* OR of all valid visibilitymap
29-
* flags bits */
30-
3123
/* Macros for visibilitymap test */
3224
#define VM_ALL_VISIBLE(r, b, v) \
3325
((visibilitymap_get_status((r), (b), (v)) & VISIBILITYMAP_ALL_VISIBLE) != 0)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* visibilitymapdefs.h
4+
* macros for accessing contents of visibility map pages
5+
*
6+
*
7+
* Copyright (c) 2021, PostgreSQL Global Development Group
8+
*
9+
* src/include/access/visibilitymapdefs.h
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
#ifndef VISIBILITYMAPDEFS_H
14+
#define VISIBILITYMAPDEFS_H
15+
16+
/* Number of bits for one heap page */
17+
#define BITS_PER_HEAPBLOCK 2
18+
19+
/* Flags for bit map */
20+
#define VISIBILITYMAP_ALL_VISIBLE 0x01
21+
#define VISIBILITYMAP_ALL_FROZEN 0x02
22+
#define VISIBILITYMAP_VALID_BITS 0x03 /* OR of all valid visibilitymap
23+
* flags bits */
24+
25+
#endif /* VISIBILITYMAPDEFS_H */

src/include/utils/relcache.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#ifndef RELCACHE_H
1515
#define RELCACHE_H
1616

17-
#include "postgres.h"
1817
#include "access/tupdesc.h"
1918
#include "nodes/bitmapset.h"
2019

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy