1/*-------------------------------------------------------------------------
2 *
3 * md.h
4 * magnetic disk storage manager public interface declarations.
5 *
6 *
7 * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/include/storage/md.h
11 *
12 *-------------------------------------------------------------------------
13 */
14#ifndef MD_H
15#define MD_H
16
17#include "storage/block.h"
18#include "storage/relfilenode.h"
19#include "storage/smgr.h"
20#include "storage/sync.h"
21
22/* md storage manager functionality */
23extern void mdinit(void);
24extern void mdclose(SMgrRelation reln, ForkNumber forknum);
25extern void mdcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo);
26extern bool mdexists(SMgrRelation reln, ForkNumber forknum);
27extern void mdunlink(RelFileNodeBackend rnode, ForkNumber forknum, bool isRedo);
28extern void mdextend(SMgrRelation reln, ForkNumber forknum,
29 BlockNumber blocknum, char *buffer, bool skipFsync);
30extern void mdprefetch(SMgrRelation reln, ForkNumber forknum,
31 BlockNumber blocknum);
32extern void mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
33 char *buffer);
34extern void mdwrite(SMgrRelation reln, ForkNumber forknum,
35 BlockNumber blocknum, char *buffer, bool skipFsync);
36extern void mdwriteback(SMgrRelation reln, ForkNumber forknum,
37 BlockNumber blocknum, BlockNumber nblocks);
38extern BlockNumber mdnblocks(SMgrRelation reln, ForkNumber forknum);
39extern void mdtruncate(SMgrRelation reln, ForkNumber forknum,
40 BlockNumber nblocks);
41extern void mdimmedsync(SMgrRelation reln, ForkNumber forknum);
42
43extern void ForgetDatabaseSyncRequests(Oid dbid);
44extern void DropRelationFiles(RelFileNode *delrels, int ndelrels, bool isRedo);
45
46/* md sync callbacks */
47extern int mdsyncfiletag(const FileTag *ftag, char *path);
48extern int mdunlinkfiletag(const FileTag *ftag, char *path);
49extern bool mdfiletagmatches(const FileTag *ftag, const FileTag *candidate);
50
51#endif /* MD_H */
52