From: Thomas Munro Date: Wed, 17 Jul 2019 02:15:27 +0000 (+1200) Subject: Prepare to support multiple SMGR implementations. X-Git-Url: http://git.postgresql.org/gitweb/static/developers.postgresql.org?a=commitdiff_plain;h=e3f1fb93eb7a8c5fad276c7dd6d82087135ae015;p=users%2Frhaas%2Fpostgres.git Prepare to support multiple SMGR implementations. Move the "which" decision into a function that later patches can add to. Author: Thomas Munro --- diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c index b0d9f21e68..d00b275e46 100644 --- a/src/backend/storage/smgr/smgr.c +++ b/src/backend/storage/smgr/smgr.c @@ -97,6 +97,18 @@ static dlist_head unowned_relns; /* local function prototypes */ static void smgrshutdown(int code, Datum arg); +/* + * Which implementation should handle a given RelFileNode? + */ +static int +smgrwhich(RelFileNode rnode) +{ + switch (rnode.dbNode) + { + default: + return 0; /* md.c */ + } +} /* * smgrinit(), smgrshutdown() -- Initialize or shut down storage @@ -176,7 +188,7 @@ smgropen(RelFileNode rnode, BackendId backend) reln->smgr_targblock = InvalidBlockNumber; reln->smgr_fsm_nblocks = InvalidBlockNumber; reln->smgr_vm_nblocks = InvalidBlockNumber; - reln->smgr_which = 0; /* we only have md.c at present */ + reln->smgr_which = smgrwhich(rnode); /* implementation-specific initialization */ smgrsw[reln->smgr_which].smgr_open(reln);