From 77cab84ba36865540aa5f7fd792760d8268a71eb Mon Sep 17 00:00:00 2001
From: Mike Palmiotto <mike.palmiotto@crunchydata.com>
Date: Wed, 4 Mar 2020 03:53:33 +0000
Subject: [PATCH 08/11] Rename subprocess init to prep

---
 src/backend/postmaster/postmaster.c |  4 ++--
 src/backend/postmaster/subprocess.c | 28 ++++++++++++++--------------
 src/include/postmaster/subprocess.h |  4 ++--
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 8273d53c30..ceb738bf1e 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -5412,10 +5412,10 @@ StartSubprocess(SubprocessType type)
 	Assert(argc < lengthof(argv));
 
 	/* Prep the subprocesses for a fork */
-	if (MySubprocess->init)
+	if (MySubprocess->prep)
 	{
 		int rc = 0;
-		rc = MySubprocess->init(argc, argv);
+		rc = MySubprocess->prep(argc, argv);
 
 		if (rc != 0)
 			return 0;
diff --git a/src/backend/postmaster/subprocess.c b/src/backend/postmaster/subprocess.c
index 0bb1ba4655..dbb9be5f6b 100644
--- a/src/backend/postmaster/subprocess.c
+++ b/src/backend/postmaster/subprocess.c
@@ -34,7 +34,7 @@ static PgSubprocess process_types[] = {
 		.needs_shmem = true,
 		.needs_aux_proc = true,
 		.keep_postmaster_memcontext = false,
-		.init = NULL,
+		.prep = NULL,
 		.entrypoint = CheckerModeMain,
 		.cleanup = NULL,
 		.parent_main = NULL
@@ -45,7 +45,7 @@ static PgSubprocess process_types[] = {
 		.needs_shmem = true,
 		.needs_aux_proc = true,
 		.keep_postmaster_memcontext = false,
-		.init = NULL,
+		.prep = NULL,
 		.entrypoint = BootstrapModeMain,
 		.cleanup = NULL,
 		.parent_main = NULL
@@ -56,7 +56,7 @@ static PgSubprocess process_types[] = {
 		.needs_shmem = true,
 		.needs_aux_proc = true,
 		.keep_postmaster_memcontext = false,
-		.init = NULL,
+		.prep = NULL,
 		.entrypoint = StartupProcessMain,
 		.cleanup = StartupCleanup,
 		.parent_main = NULL
@@ -67,7 +67,7 @@ static PgSubprocess process_types[] = {
 		.needs_shmem = true,
 		.needs_aux_proc = true,
 		.keep_postmaster_memcontext = false,
-		.init = NULL,
+		.prep = NULL,
 		.entrypoint = BackgroundWriterMain,
 		.cleanup = NULL,
 		.parent_main = NULL
@@ -78,7 +78,7 @@ static PgSubprocess process_types[] = {
 		.needs_shmem = true,
 		.needs_aux_proc = true,
 		.keep_postmaster_memcontext = false,
-		.init = NULL,
+		.prep = NULL,
 		.entrypoint = CheckpointerMain,
 		.cleanup = NULL,
 		.parent_main = NULL
@@ -89,7 +89,7 @@ static PgSubprocess process_types[] = {
 		.needs_shmem = true,
 		.needs_aux_proc = true,
 		.keep_postmaster_memcontext = false,
-		.init = NULL,
+		.prep = NULL,
 		.entrypoint = WalWriterMain,
 		.cleanup = NULL,
 		.parent_main = NULL
@@ -101,7 +101,7 @@ static PgSubprocess process_types[] = {
 		.needs_shmem = true,
 		.needs_aux_proc = true,
 		.keep_postmaster_memcontext = false,
-		.init = NULL,
+		.prep = NULL,
 		.entrypoint = WalReceiverMain,
 		.cleanup = NULL,
 		.parent_main = NULL
@@ -112,7 +112,7 @@ static PgSubprocess process_types[] = {
 		.needs_shmem = true,
 		.needs_aux_proc = false,
 		.keep_postmaster_memcontext = false,
-		.init = NULL,
+		.prep = NULL,
 		.entrypoint = AutoVacLauncherMain,
 		.cleanup = NULL,
 		.parent_main = NULL
@@ -123,7 +123,7 @@ static PgSubprocess process_types[] = {
 		.needs_shmem = true,
 		.needs_aux_proc = false,
 		.keep_postmaster_memcontext = false,
-		.init = NULL,
+		.prep = NULL,
 		.entrypoint = AutoVacWorkerMain,
 		.cleanup = NULL,
 		.parent_main = NULL
@@ -134,7 +134,7 @@ static PgSubprocess process_types[] = {
 		.needs_shmem = true,
 		.needs_aux_proc = false,
 		.keep_postmaster_memcontext = false,
-		.init = PgstatCollectorPrep,
+		.prep = PgstatCollectorPrep,
 		.entrypoint = PgstatCollectorMain,
 		.cleanup = NULL,
 		.parent_main = NULL
@@ -145,7 +145,7 @@ static PgSubprocess process_types[] = {
 		.needs_shmem = false,
 		.needs_aux_proc = false,
 		.keep_postmaster_memcontext = false,
-		.init = PgArchiverPrep,
+		.prep = PgArchiverPrep,
 		.entrypoint = PgArchiverMain,
 		.cleanup = NULL,
 		.parent_main = NULL
@@ -156,7 +156,7 @@ static PgSubprocess process_types[] = {
 		.needs_shmem = false,
 		.needs_aux_proc = false,
 		.keep_postmaster_memcontext = true,
-		.init = SysLoggerPrep,
+		.prep = SysLoggerPrep,
 		.entrypoint = SysLoggerMain,
 		.cleanup = NULL,
 		.parent_main = SysLoggerParentMain
@@ -167,7 +167,7 @@ static PgSubprocess process_types[] = {
 		.needs_shmem = true,
 		.needs_aux_proc = false,
 		.keep_postmaster_memcontext = true,
-		.init = BgWorkerPrep,
+		.prep = BgWorkerPrep,
 		.entrypoint = BackgroundWorkerMain,
 		.cleanup = BackgroundWorkerCleanup,
 		.parent_main = BackgroundWorkerParentMain
@@ -178,7 +178,7 @@ static PgSubprocess process_types[] = {
 		.needs_shmem = true,
 		.needs_aux_proc = false,
 		.keep_postmaster_memcontext = true,
-		.init = BackendPrep,
+		.prep = BackendPrep,
 		.entrypoint = BackendMain,
 		.cleanup = BackendCleanup,
 		.parent_main = BackendParentMain
diff --git a/src/include/postmaster/subprocess.h b/src/include/postmaster/subprocess.h
index 2634bbd142..70a92647fe 100644
--- a/src/include/postmaster/subprocess.h
+++ b/src/include/postmaster/subprocess.h
@@ -37,7 +37,7 @@ typedef enum
 	NUMSUBPROCESSTYPES			/* Must be last! */
 } SubprocessType;
 
-typedef int (*SubprocessInit) (int argc, char *argv[]);
+typedef int (*SubprocessPrep) (int argc, char *argv[]);
 typedef void (*SubprocessEntryPoint) (int argc, char *argv[]);
 typedef bool (*SubprocessCleanup) (int child_errno);
 typedef void (*SubprocessParent) (int argc, char *argv[]);
@@ -54,7 +54,7 @@ typedef struct PgSubprocess
 	bool					needs_aux_proc;
 	bool					needs_full_proc;
 	bool					keep_postmaster_memcontext;
-	SubprocessInit			init;
+	SubprocessPrep			prep;
 	SubprocessEntryPoint	entrypoint;
 	SubprocessCleanup		cleanup;
 	SubprocessParent		parent_main;
-- 
2.21.0

