N_("[-a] [-e] [-g] [-m max_extent] [-w] [-o] filename"),
N_("dump metadata to a file"), metadump_help };
+struct metadump_ops {
+ /*
+ * Initialize Metadump. This may perform actions such as
+ * 1. Allocating memory for structures required for dumping the
+ * metadata.
+ * 2. Writing a header to the beginning of the metadump file.
+ */
+ int (*init)(void);
+ /*
+ * Write metadata to the metadump file along with the required ancillary
+ * data. @off and @len are in units of 512 byte blocks.
+ */
+ int (*write)(enum typnm type, const char *data, xfs_daddr_t off,
+ int len);
+ /*
+ * Flush any in-memory remanents of metadata to the metadump file.
+ */
+ int (*finish_dump)(void);
+ /*
+ * Free resources allocated during metadump process.
+ */
+ void (*release)(void);
+};
+
static struct metadump {
int version;
bool show_progress;
xfs_ino_t cur_ino;
/* Metadump file */
FILE *outf;
+ struct metadump_ops *mdops;
/* header + index + buffers */
struct xfs_metablock *metablock;
__be64 *block_index;