diff mbox series

[V2,18/23] mdrestore: Introduce struct mdrestore_ops

Message ID 20230606092806.1604491-19-chandan.babu@oracle.com (mailing list archive)
State Superseded
Headers show
Series Metadump v2 | expand

Commit Message

Chandan Babu R June 6, 2023, 9:28 a.m. UTC
We will need two sets of functions to work with two versions of metadump
formats. This commit adds the definition for 'struct mdrestore_ops' to hold
pointers to version specific mdrestore functions.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
---
 mdrestore/xfs_mdrestore.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/mdrestore/xfs_mdrestore.c b/mdrestore/xfs_mdrestore.c
index 61e06598..08f52527 100644
--- a/mdrestore/xfs_mdrestore.c
+++ b/mdrestore/xfs_mdrestore.c
@@ -8,10 +8,18 @@ 
 #include "xfs_metadump.h"
 #include <libfrog/platform.h>
 
+struct mdrestore_ops {
+	void (*read_header)(void *header, FILE *md_fp);
+	void (*show_info)(void *header, const char *md_file);
+	void (*restore)(void *header, FILE *md_fp, int ddev_fd,
+			bool is_target_file);
+};
+
 static struct mdrestore {
-	bool	show_progress;
-	bool	show_info;
-	bool	progress_since_warning;
+	struct mdrestore_ops	*mdrops;
+	bool			show_progress;
+	bool			show_info;
+	bool			progress_since_warning;
 } mdrestore;
 
 static void