smgr.h 3.0 KB
Newer Older
1 2 3
/*-------------------------------------------------------------------------
 *
 * smgr.h--
4
 *	  storage manager switch public interface declarations.
5 6 7 8
 *
 *
 * Copyright (c) 1994, Regents of the University of California
 *
9
 * $Id: smgr.h,v 1.11 1998/02/26 04:43:36 momjian Exp $
10 11 12 13 14 15
 *
 *-------------------------------------------------------------------------
 */
#ifndef SMGR_H
#define SMGR_H

16 17 18
#include <storage/spin.h>
#include <storage/block.h>
#include <utils/rel.h>
19

20 21
#define SM_FAIL			0
#define SM_SUCCESS		1
22

23
#define DEFAULT_SMGR	0
24

25 26 27 28 29 30
extern int	smgrinit(void);
extern int	smgrcreate(int16 which, Relation reln);
extern int	smgrunlink(int16 which, Relation reln);
extern int	smgrextend(int16 which, Relation reln, char *buffer);
extern int	smgropen(int16 which, Relation reln);
extern int	smgrclose(int16 which, Relation reln);
31 32
extern int
smgrread(int16 which, Relation reln, BlockNumber blocknum,
33
		 char *buffer);
34 35
extern int
smgrwrite(int16 which, Relation reln, BlockNumber blocknum,
36
		  char *buffer);
37 38
extern int
smgrflush(int16 which, Relation reln, BlockNumber blocknum,
39
		  char *buffer);
40 41
extern int
smgrblindwrt(int16 which, char *dbname, char *relname, Oid dbid,
42
			 Oid relid, BlockNumber blkno, char *buffer);
43 44 45 46
extern int	smgrnblocks(int16 which, Relation reln);
extern int	smgrtruncate(int16 which, Relation reln, int nblocks);
extern int	smgrcommit(void);
extern bool smgriswo(int16 smgrno);
47 48 49 50 51 52



/* internals: move me elsewhere -- ay 7/94 */

/* in md.c */
53 54 55 56 57 58 59 60 61
extern int	mdinit(void);
extern int	mdcreate(Relation reln);
extern int	mdunlink(Relation reln);
extern int	mdextend(Relation reln, char *buffer);
extern int	mdopen(Relation reln);
extern int	mdclose(Relation reln);
extern int	mdread(Relation reln, BlockNumber blocknum, char *buffer);
extern int	mdwrite(Relation reln, BlockNumber blocknum, char *buffer);
extern int	mdflush(Relation reln, BlockNumber blocknum, char *buffer);
62 63
extern int
mdblindwrt(char *dbstr, char *relstr, Oid dbid, Oid relid,
64
		   BlockNumber blkno, char *buffer);
65 66 67 68
extern int	mdnblocks(Relation reln);
extern int	mdtruncate(Relation reln, int nblocks);
extern int	mdcommit(void);
extern int	mdabort(void);
69 70 71 72

/* mm.c */
extern SPINLOCK MMCacheLock;

73 74 75 76 77 78 79 80 81 82
extern int	mminit(void);
extern int	mmshutdown(void);
extern int	mmcreate(Relation reln);
extern int	mmunlink(Relation reln);
extern int	mmextend(Relation reln, char *buffer);
extern int	mmopen(Relation reln);
extern int	mmclose(Relation reln);
extern int	mmread(Relation reln, BlockNumber blocknum, char *buffer);
extern int	mmwrite(Relation reln, BlockNumber blocknum, char *buffer);
extern int	mmflush(Relation reln, BlockNumber blocknum, char *buffer);
83 84
extern int
mmblindwrt(char *dbstr, char *relstr, Oid dbid, Oid relid,
85
		   BlockNumber blkno, char *buffer);
86 87 88 89
extern int	mmnblocks(Relation reln);
extern int	mmcommit(void);
extern int	mmabort(void);
extern int	MMShmemSize(void);
90

B
Bruce Momjian 已提交
91
/* smgrtype.c */
92 93 94 95
extern char *smgrout(int2 i);
extern int2 smgrin(char *s);
extern bool smgreq(int2 a, int2 b);
extern bool smgrne(int2 a, int2 b);
B
Bruce Momjian 已提交
96

97
#endif							/* SMGR_H */