mirror of
https://github.com/postgres/postgres.git
synced 2025-04-20 00:42:27 +03:00
Update types in smgr API
Change data buffer to void *, from char *, and add const where appropriate. This makes it match the File API (see also 2d4f1ba6cfc2f0a977f1c30bda9848041343e248) and stdio. Discussion: https://www.postgresql.org/message-id/flat/11dda853-bb5b-59ba-a746-e168b1ce4bdb%40enterprisedb.com
This commit is contained in:
parent
a6cd1fc692
commit
b9f0e54bc9
@ -178,7 +178,7 @@ blbuildempty(Relation index)
|
|||||||
*/
|
*/
|
||||||
PageSetChecksumInplace(metapage, BLOOM_METAPAGE_BLKNO);
|
PageSetChecksumInplace(metapage, BLOOM_METAPAGE_BLKNO);
|
||||||
smgrwrite(RelationGetSmgr(index), INIT_FORKNUM, BLOOM_METAPAGE_BLKNO,
|
smgrwrite(RelationGetSmgr(index), INIT_FORKNUM, BLOOM_METAPAGE_BLKNO,
|
||||||
(char *) metapage, true);
|
metapage, true);
|
||||||
log_newpage(&(RelationGetSmgr(index))->smgr_rlocator.locator, INIT_FORKNUM,
|
log_newpage(&(RelationGetSmgr(index))->smgr_rlocator.locator, INIT_FORKNUM,
|
||||||
BLOOM_METAPAGE_BLKNO, metapage, true);
|
BLOOM_METAPAGE_BLKNO, metapage, true);
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ end_heap_rewrite(RewriteState state)
|
|||||||
PageSetChecksumInplace(state->rs_buffer, state->rs_blockno);
|
PageSetChecksumInplace(state->rs_buffer, state->rs_blockno);
|
||||||
|
|
||||||
smgrextend(RelationGetSmgr(state->rs_new_rel), MAIN_FORKNUM,
|
smgrextend(RelationGetSmgr(state->rs_new_rel), MAIN_FORKNUM,
|
||||||
state->rs_blockno, (char *) state->rs_buffer, true);
|
state->rs_blockno, state->rs_buffer, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -692,7 +692,7 @@ raw_heap_insert(RewriteState state, HeapTuple tup)
|
|||||||
PageSetChecksumInplace(page, state->rs_blockno);
|
PageSetChecksumInplace(page, state->rs_blockno);
|
||||||
|
|
||||||
smgrextend(RelationGetSmgr(state->rs_new_rel), MAIN_FORKNUM,
|
smgrextend(RelationGetSmgr(state->rs_new_rel), MAIN_FORKNUM,
|
||||||
state->rs_blockno, (char *) page, true);
|
state->rs_blockno, page, true);
|
||||||
|
|
||||||
state->rs_blockno++;
|
state->rs_blockno++;
|
||||||
state->rs_buffer_valid = false;
|
state->rs_buffer_valid = false;
|
||||||
|
@ -165,7 +165,7 @@ btbuildempty(Relation index)
|
|||||||
*/
|
*/
|
||||||
PageSetChecksumInplace(metapage, BTREE_METAPAGE);
|
PageSetChecksumInplace(metapage, BTREE_METAPAGE);
|
||||||
smgrwrite(RelationGetSmgr(index), INIT_FORKNUM, BTREE_METAPAGE,
|
smgrwrite(RelationGetSmgr(index), INIT_FORKNUM, BTREE_METAPAGE,
|
||||||
(char *) metapage, true);
|
metapage, true);
|
||||||
log_newpage(&RelationGetSmgr(index)->smgr_rlocator.locator, INIT_FORKNUM,
|
log_newpage(&RelationGetSmgr(index)->smgr_rlocator.locator, INIT_FORKNUM,
|
||||||
BTREE_METAPAGE, metapage, true);
|
BTREE_METAPAGE, metapage, true);
|
||||||
|
|
||||||
|
@ -664,7 +664,7 @@ _bt_blwritepage(BTWriteState *wstate, Page page, BlockNumber blkno)
|
|||||||
/* don't set checksum for all-zero page */
|
/* don't set checksum for all-zero page */
|
||||||
smgrextend(RelationGetSmgr(wstate->index), MAIN_FORKNUM,
|
smgrextend(RelationGetSmgr(wstate->index), MAIN_FORKNUM,
|
||||||
wstate->btws_pages_written++,
|
wstate->btws_pages_written++,
|
||||||
(char *) wstate->btws_zeropage,
|
wstate->btws_zeropage,
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -678,14 +678,14 @@ _bt_blwritepage(BTWriteState *wstate, Page page, BlockNumber blkno)
|
|||||||
{
|
{
|
||||||
/* extending the file... */
|
/* extending the file... */
|
||||||
smgrextend(RelationGetSmgr(wstate->index), MAIN_FORKNUM, blkno,
|
smgrextend(RelationGetSmgr(wstate->index), MAIN_FORKNUM, blkno,
|
||||||
(char *) page, true);
|
page, true);
|
||||||
wstate->btws_pages_written++;
|
wstate->btws_pages_written++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* overwriting a block we zero-filled before */
|
/* overwriting a block we zero-filled before */
|
||||||
smgrwrite(RelationGetSmgr(wstate->index), MAIN_FORKNUM, blkno,
|
smgrwrite(RelationGetSmgr(wstate->index), MAIN_FORKNUM, blkno,
|
||||||
(char *) page, true);
|
page, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
pfree(page);
|
pfree(page);
|
||||||
|
@ -170,7 +170,7 @@ spgbuildempty(Relation index)
|
|||||||
*/
|
*/
|
||||||
PageSetChecksumInplace(page, SPGIST_METAPAGE_BLKNO);
|
PageSetChecksumInplace(page, SPGIST_METAPAGE_BLKNO);
|
||||||
smgrwrite(RelationGetSmgr(index), INIT_FORKNUM, SPGIST_METAPAGE_BLKNO,
|
smgrwrite(RelationGetSmgr(index), INIT_FORKNUM, SPGIST_METAPAGE_BLKNO,
|
||||||
(char *) page, true);
|
page, true);
|
||||||
log_newpage(&(RelationGetSmgr(index))->smgr_rlocator.locator, INIT_FORKNUM,
|
log_newpage(&(RelationGetSmgr(index))->smgr_rlocator.locator, INIT_FORKNUM,
|
||||||
SPGIST_METAPAGE_BLKNO, page, true);
|
SPGIST_METAPAGE_BLKNO, page, true);
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ spgbuildempty(Relation index)
|
|||||||
|
|
||||||
PageSetChecksumInplace(page, SPGIST_ROOT_BLKNO);
|
PageSetChecksumInplace(page, SPGIST_ROOT_BLKNO);
|
||||||
smgrwrite(RelationGetSmgr(index), INIT_FORKNUM, SPGIST_ROOT_BLKNO,
|
smgrwrite(RelationGetSmgr(index), INIT_FORKNUM, SPGIST_ROOT_BLKNO,
|
||||||
(char *) page, true);
|
page, true);
|
||||||
log_newpage(&(RelationGetSmgr(index))->smgr_rlocator.locator, INIT_FORKNUM,
|
log_newpage(&(RelationGetSmgr(index))->smgr_rlocator.locator, INIT_FORKNUM,
|
||||||
SPGIST_ROOT_BLKNO, page, true);
|
SPGIST_ROOT_BLKNO, page, true);
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ spgbuildempty(Relation index)
|
|||||||
|
|
||||||
PageSetChecksumInplace(page, SPGIST_NULL_BLKNO);
|
PageSetChecksumInplace(page, SPGIST_NULL_BLKNO);
|
||||||
smgrwrite(RelationGetSmgr(index), INIT_FORKNUM, SPGIST_NULL_BLKNO,
|
smgrwrite(RelationGetSmgr(index), INIT_FORKNUM, SPGIST_NULL_BLKNO,
|
||||||
(char *) page, true);
|
page, true);
|
||||||
log_newpage(&(RelationGetSmgr(index))->smgr_rlocator.locator, INIT_FORKNUM,
|
log_newpage(&(RelationGetSmgr(index))->smgr_rlocator.locator, INIT_FORKNUM,
|
||||||
SPGIST_NULL_BLKNO, page, true);
|
SPGIST_NULL_BLKNO, page, true);
|
||||||
|
|
||||||
|
@ -1003,7 +1003,7 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
|
|||||||
/* new buffers are zero-filled */
|
/* new buffers are zero-filled */
|
||||||
MemSet((char *) bufBlock, 0, BLCKSZ);
|
MemSet((char *) bufBlock, 0, BLCKSZ);
|
||||||
/* don't set checksum for all-zero page */
|
/* don't set checksum for all-zero page */
|
||||||
smgrextend(smgr, forkNum, blockNum, (char *) bufBlock, false);
|
smgrextend(smgr, forkNum, blockNum, bufBlock, false);
|
||||||
|
|
||||||
pgstat_count_io_op(io_object, io_context, IOOP_EXTEND);
|
pgstat_count_io_op(io_object, io_context, IOOP_EXTEND);
|
||||||
|
|
||||||
@ -1032,7 +1032,7 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
|
|||||||
else
|
else
|
||||||
INSTR_TIME_SET_ZERO(io_start);
|
INSTR_TIME_SET_ZERO(io_start);
|
||||||
|
|
||||||
smgrread(smgr, forkNum, blockNum, (char *) bufBlock);
|
smgrread(smgr, forkNum, blockNum, bufBlock);
|
||||||
|
|
||||||
pgstat_count_io_op(io_object, io_context, IOOP_READ);
|
pgstat_count_io_op(io_object, io_context, IOOP_READ);
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ mdunlinkfork(RelFileLocatorBackend rlocator, ForkNumber forknum, bool isRedo)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||||
char *buffer, bool skipFsync)
|
const void *buffer, bool skipFsync)
|
||||||
{
|
{
|
||||||
off_t seekpos;
|
off_t seekpos;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
@ -669,7 +669,7 @@ mdwriteback(SMgrRelation reln, ForkNumber forknum,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||||
char *buffer)
|
void *buffer)
|
||||||
{
|
{
|
||||||
off_t seekpos;
|
off_t seekpos;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
@ -734,7 +734,7 @@ mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||||
char *buffer, bool skipFsync)
|
const void *buffer, bool skipFsync)
|
||||||
{
|
{
|
||||||
off_t seekpos;
|
off_t seekpos;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
|
@ -49,13 +49,13 @@ typedef struct f_smgr
|
|||||||
void (*smgr_unlink) (RelFileLocatorBackend rlocator, ForkNumber forknum,
|
void (*smgr_unlink) (RelFileLocatorBackend rlocator, ForkNumber forknum,
|
||||||
bool isRedo);
|
bool isRedo);
|
||||||
void (*smgr_extend) (SMgrRelation reln, ForkNumber forknum,
|
void (*smgr_extend) (SMgrRelation reln, ForkNumber forknum,
|
||||||
BlockNumber blocknum, char *buffer, bool skipFsync);
|
BlockNumber blocknum, const void *buffer, bool skipFsync);
|
||||||
bool (*smgr_prefetch) (SMgrRelation reln, ForkNumber forknum,
|
bool (*smgr_prefetch) (SMgrRelation reln, ForkNumber forknum,
|
||||||
BlockNumber blocknum);
|
BlockNumber blocknum);
|
||||||
void (*smgr_read) (SMgrRelation reln, ForkNumber forknum,
|
void (*smgr_read) (SMgrRelation reln, ForkNumber forknum,
|
||||||
BlockNumber blocknum, char *buffer);
|
BlockNumber blocknum, void *buffer);
|
||||||
void (*smgr_write) (SMgrRelation reln, ForkNumber forknum,
|
void (*smgr_write) (SMgrRelation reln, ForkNumber forknum,
|
||||||
BlockNumber blocknum, char *buffer, bool skipFsync);
|
BlockNumber blocknum, const void *buffer, bool skipFsync);
|
||||||
void (*smgr_writeback) (SMgrRelation reln, ForkNumber forknum,
|
void (*smgr_writeback) (SMgrRelation reln, ForkNumber forknum,
|
||||||
BlockNumber blocknum, BlockNumber nblocks);
|
BlockNumber blocknum, BlockNumber nblocks);
|
||||||
BlockNumber (*smgr_nblocks) (SMgrRelation reln, ForkNumber forknum);
|
BlockNumber (*smgr_nblocks) (SMgrRelation reln, ForkNumber forknum);
|
||||||
@ -491,7 +491,7 @@ smgrdounlinkall(SMgrRelation *rels, int nrels, bool isRedo)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
smgrextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
smgrextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||||
char *buffer, bool skipFsync)
|
const void *buffer, bool skipFsync)
|
||||||
{
|
{
|
||||||
smgrsw[reln->smgr_which].smgr_extend(reln, forknum, blocknum,
|
smgrsw[reln->smgr_which].smgr_extend(reln, forknum, blocknum,
|
||||||
buffer, skipFsync);
|
buffer, skipFsync);
|
||||||
@ -530,7 +530,7 @@ smgrprefetch(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
smgrread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
smgrread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||||
char *buffer)
|
void *buffer)
|
||||||
{
|
{
|
||||||
smgrsw[reln->smgr_which].smgr_read(reln, forknum, blocknum, buffer);
|
smgrsw[reln->smgr_which].smgr_read(reln, forknum, blocknum, buffer);
|
||||||
}
|
}
|
||||||
@ -552,7 +552,7 @@ smgrread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
smgrwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
smgrwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||||
char *buffer, bool skipFsync)
|
const void *buffer, bool skipFsync)
|
||||||
{
|
{
|
||||||
smgrsw[reln->smgr_which].smgr_write(reln, forknum, blocknum,
|
smgrsw[reln->smgr_which].smgr_write(reln, forknum, blocknum,
|
||||||
buffer, skipFsync);
|
buffer, skipFsync);
|
||||||
|
@ -27,13 +27,13 @@ extern void mdcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo);
|
|||||||
extern bool mdexists(SMgrRelation reln, ForkNumber forknum);
|
extern bool mdexists(SMgrRelation reln, ForkNumber forknum);
|
||||||
extern void mdunlink(RelFileLocatorBackend rlocator, ForkNumber forknum, bool isRedo);
|
extern void mdunlink(RelFileLocatorBackend rlocator, ForkNumber forknum, bool isRedo);
|
||||||
extern void mdextend(SMgrRelation reln, ForkNumber forknum,
|
extern void mdextend(SMgrRelation reln, ForkNumber forknum,
|
||||||
BlockNumber blocknum, char *buffer, bool skipFsync);
|
BlockNumber blocknum, const void *buffer, bool skipFsync);
|
||||||
extern bool mdprefetch(SMgrRelation reln, ForkNumber forknum,
|
extern bool mdprefetch(SMgrRelation reln, ForkNumber forknum,
|
||||||
BlockNumber blocknum);
|
BlockNumber blocknum);
|
||||||
extern void mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
extern void mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||||
char *buffer);
|
void *buffer);
|
||||||
extern void mdwrite(SMgrRelation reln, ForkNumber forknum,
|
extern void mdwrite(SMgrRelation reln, ForkNumber forknum,
|
||||||
BlockNumber blocknum, char *buffer, bool skipFsync);
|
BlockNumber blocknum, const void *buffer, bool skipFsync);
|
||||||
extern void mdwriteback(SMgrRelation reln, ForkNumber forknum,
|
extern void mdwriteback(SMgrRelation reln, ForkNumber forknum,
|
||||||
BlockNumber blocknum, BlockNumber nblocks);
|
BlockNumber blocknum, BlockNumber nblocks);
|
||||||
extern BlockNumber mdnblocks(SMgrRelation reln, ForkNumber forknum);
|
extern BlockNumber mdnblocks(SMgrRelation reln, ForkNumber forknum);
|
||||||
|
@ -91,13 +91,13 @@ extern void smgrcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo);
|
|||||||
extern void smgrdosyncall(SMgrRelation *rels, int nrels);
|
extern void smgrdosyncall(SMgrRelation *rels, int nrels);
|
||||||
extern void smgrdounlinkall(SMgrRelation *rels, int nrels, bool isRedo);
|
extern void smgrdounlinkall(SMgrRelation *rels, int nrels, bool isRedo);
|
||||||
extern void smgrextend(SMgrRelation reln, ForkNumber forknum,
|
extern void smgrextend(SMgrRelation reln, ForkNumber forknum,
|
||||||
BlockNumber blocknum, char *buffer, bool skipFsync);
|
BlockNumber blocknum, const void *buffer, bool skipFsync);
|
||||||
extern bool smgrprefetch(SMgrRelation reln, ForkNumber forknum,
|
extern bool smgrprefetch(SMgrRelation reln, ForkNumber forknum,
|
||||||
BlockNumber blocknum);
|
BlockNumber blocknum);
|
||||||
extern void smgrread(SMgrRelation reln, ForkNumber forknum,
|
extern void smgrread(SMgrRelation reln, ForkNumber forknum,
|
||||||
BlockNumber blocknum, char *buffer);
|
BlockNumber blocknum, void *buffer);
|
||||||
extern void smgrwrite(SMgrRelation reln, ForkNumber forknum,
|
extern void smgrwrite(SMgrRelation reln, ForkNumber forknum,
|
||||||
BlockNumber blocknum, char *buffer, bool skipFsync);
|
BlockNumber blocknum, const void *buffer, bool skipFsync);
|
||||||
extern void smgrwriteback(SMgrRelation reln, ForkNumber forknum,
|
extern void smgrwriteback(SMgrRelation reln, ForkNumber forknum,
|
||||||
BlockNumber blocknum, BlockNumber nblocks);
|
BlockNumber blocknum, BlockNumber nblocks);
|
||||||
extern BlockNumber smgrnblocks(SMgrRelation reln, ForkNumber forknum);
|
extern BlockNumber smgrnblocks(SMgrRelation reln, ForkNumber forknum);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user