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@xxxxxxxxxx> Signed-off-by: Chandan Babu R <chandan.babu@xxxxxxxxxx> --- mdrestore/xfs_mdrestore.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/mdrestore/xfs_mdrestore.c b/mdrestore/xfs_mdrestore.c index d67a0629..53c5f68e 100644 --- a/mdrestore/xfs_mdrestore.c +++ b/mdrestore/xfs_mdrestore.c @@ -8,10 +8,23 @@ #include "xfs_metadump.h" #include <libfrog/platform.h> +union mdrestore_headers { + __be32 magic; + struct xfs_metablock v1; +}; + +struct mdrestore_ops { + void (*read_header)(union mdrestore_headers *header, FILE *md_fp); + void (*show_info)(union mdrestore_headers *header, const char *md_file); + void (*restore)(union mdrestore_headers *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 -- 2.39.1