vpnor: rename APIs

To maintain consistency, rename vpnor_create_partition_table to
init_vpnor and vpnor_destroy_partition_table to destroy_vpnor. Also move
a bunch of vpnor specific string copy code from main() to init_vpnor().

Change-Id: Ia1b6598d4d308dd727916dc79be9b3b733f314f2
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/mboxd.c b/mboxd.c
index 43d2aa1..6e95b56 100644
--- a/mboxd.c
+++ b/mboxd.c
@@ -344,11 +344,7 @@
 	}
 
 #ifdef VIRTUAL_PNOR_ENABLED
-	vpnor_create_partition_table(context);
-
-	strcpy(context->paths.ro_loc, PARTITION_FILES_RO_LOC);
-	strcpy(context->paths.rw_loc, PARTITION_FILES_RW_LOC);
-	strcpy(context->paths.prsv_loc, PARTITION_FILES_PRSV_LOC);
+	init_vpnor(context);
 #endif
 
 	/* Set the LPC bus mapping */
@@ -377,7 +373,7 @@
 	free_mbox_dev(context);
 	free_windows(context);
 #ifdef VIRTUAL_PNOR_ENABLED
-	vpnor_destroy_partition_table(context);
+	destroy_vpnor(context);
 #endif
 	free(context);
 
diff --git a/mboxd_pnor_partition_table.cpp b/mboxd_pnor_partition_table.cpp
index 60066f5..2de790b 100644
--- a/mboxd_pnor_partition_table.cpp
+++ b/mboxd_pnor_partition_table.cpp
@@ -3,6 +3,7 @@
 #include "mbox.h"
 #include "mboxd_flash.h"
 #include "pnor_partition_table.hpp"
+#include "config.h"
 #include <experimental/filesystem>
 
 struct vpnor_partition_table
@@ -10,10 +11,14 @@
     openpower::virtual_pnor::partition::Table* table = nullptr;
 };
 
-void vpnor_create_partition_table(struct mbox_context *context)
+void init_vpnor(struct mbox_context *context)
 {
     if (context && !context->vpnor)
     {
+        strcpy(context->paths.ro_loc, PARTITION_FILES_RO_LOC);
+        strcpy(context->paths.rw_loc, PARTITION_FILES_RW_LOC);
+        strcpy(context->paths.prsv_loc, PARTITION_FILES_PRSV_LOC);
+
         context->vpnor = new vpnor_partition_table;
         context->vpnor->table =
             new openpower::virtual_pnor::partition::Table(
@@ -98,7 +103,7 @@
                static_cast<uint8_t*>(context->mem) + hbbOffset, hbbSize);
 }
 
-void vpnor_destroy_partition_table(struct mbox_context *context)
+void destroy_vpnor(struct mbox_context *context)
 {
     if(context && context->vpnor)
     {
diff --git a/mboxd_pnor_partition_table.h b/mboxd_pnor_partition_table.h
index df15d24..452a871 100644
--- a/mboxd_pnor_partition_table.h
+++ b/mboxd_pnor_partition_table.h
@@ -27,7 +27,7 @@
  *  already exists, this function will not do anything further. This function
  *  will not do anything if the context is NULL.
  */
-void vpnor_create_partition_table(struct mbox_context *context);
+void init_vpnor(struct mbox_context *context);
 
 /** @brief Create a virtual PNOR partition table.
  *
@@ -88,7 +88,7 @@
  *
  *  @param[in] context - mbox context pointer
  */
-void vpnor_destroy_partition_table(struct mbox_context *context);
+void destroy_vpnor(struct mbox_context *context);
 
 #ifdef __cplusplus
 }