e2fsprogs: Add undo I/O manager.
RFC PATCH 1/1 e2fsprogs: Add undo I/O manager.
This I/O manager saves the contents of the location being overwritten to a tdb database. This helps in undoing the changes done to the file system.
The call sequence involve
set_undo_io_backing_manager(unix_io_manager);set_undo_io_backup_file("/tmp/test.tdb");
retval = ext2fs_open2(dev_name, 0, flags,
superblock, block_size, undo_io_manager, ¤t_fs);
Signed-off-by Aneesh Kumar K.V <[email protected]>
--- lib/ext2fs/Makefile.in | 10 +- lib/ext2fs/ext2_io.h | 5 + lib/ext2fs/undo_io.c | 533 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 546 insertions(+), 2 deletions(-) create mode 100644 lib/ext2fs/undo_io.c
lib/ext2fs/Makefile.in +8 -2
@@ -66,7 +66,8 @@ OBJS= $(DEBUGFS_LIB_OBJS) $(RESIZE_LIB_OBJS) $(E2IMAGE_LIB_OBJS) \ unix_io.o \ unlink.o \ valid_blk.o \ - version.o + version.o \ + undo_io.o SRCS= ext2_err.c \ $(srcdir)/alloc.c \
@@ -134,7 +135,8 @@ SRCS= ext2_err.c \ $(srcdir)/tst_bitops.c \ $(srcdir)/tst_byteswap.c \ $(srcdir)/tst_getsize.c \ - $(srcdir)/tst_iscan.c + $(srcdir)/tst_iscan.c \ + $(srcdir)/undo_io.c HFILES= bitops.h ext2fs.h ext2_io.h ext2_fs.h ext2_ext_attr.h ext3_extents.h HFILES_IN= ext2_err.h ext2_types.h
@@ -550,3 +552,7 @@ tst_iscan.o: $(srcdir)/tst_iscan.c $(srcdir)/ext2_fs.h \ $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fs.h \ $(srcdir)/ext2_fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h +undo_io.o: $(srcdir)/undo_io.c $(srcdir)/ext2_fs.h \ + $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fs.h \ + $(srcdir)/ext2_fs.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \ + $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
lib/ext2fs/ext2_io.h +5 -0
@@ -96,6 +96,11 @@ extern errcode_t io_channel_write_byte(io_channel channel,/* unix_io.c */ extern io_manager unix_io_manager; +/* undo_io.c */ +extern io_manager undo_io_manager; +extern errcode_t set_undo_io_backing_manager (io_manager manager); +extern errcode_t set_undo_io_backup_file (char *file_name); +/* test_io.c */ extern io_manager test_io_manager, test_io_backing_manager;extern void (*test_io_cb_read_blk)
lib/ext2fs/undo_io.c new file +533 -0
533 lines not on this page · raw message
Signature · 1 line
1.5.2.14.g45bde-dirty