e2fsprogs: Undo I/O manager
Hi Ted,
Following patch implement the Undo I/O manager and undoe2fs.
The patches are on top of latest git(23edf9b4674ced1cdf8625bd609d95dbd62923b3)
-aneesh
PATCH 1/2 e2fsprogs: Add undo I/O manager
From: Aneesh Kumar K.V <[email protected]>
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);
--- lib/ext2fs/Makefile.in | 7 +- lib/ext2fs/ext2_io.h | 5 + lib/ext2fs/undo_io.c | 486 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 496 insertions(+), 2 deletions(-) create mode 100644 lib/ext2fs/undo_io.c
lib/ext2fs/Makefile.in +5 -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 \ tdb.h
@@ -583,3 +585,4 @@ 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 $(srcdir)/ext3_extents.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 $(srcdir)/ext2fs.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 +486 -0
486 lines not on this page · raw message
Signature · 1 line
1.5.3.rc0.63.gc956-dirty
PATCH 2/2 e2fsprogs: Add undoe2fs
From: Aneesh Kumar K.V <[email protected]>
undoe2fs can be used to replay the transaction saved in the transaction file using undo I/O Manager
--- misc/Makefile.in | 10 ++++++++-- misc/undoe2fs.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 misc/undoe2fs.c
misc/Makefile.in +8 -2
@@ -15,7 +15,7 @@ INSTALL = @INSTALL@ @IMAGER_CMT@E2IMAGE_MAN= e2image.8 SPROGS= mke2fs badblocks tune2fs dumpe2fs blkid logsave \ - $(E2IMAGE_PROG) @FSCK_PROG@ + $(E2IMAGE_PROG) @FSCK_PROG@ undoe2fs USPROGS= mklost+found filefrag SMANPAGES= tune2fs.8 mklost+found.8 mke2fs.8 dumpe2fs.8 badblocks.8 \ e2label.8 findfs.8 blkid.8 $(E2IMAGE_MAN) \
@@ -39,6 +39,7 @@ E2IMAGE_OBJS= e2image.o FSCK_OBJS= fsck.o base_device.o BLKID_OBJS= blkid.o FILEFRAG_OBJS= filefrag.o +UNDOE2FS_OBJS= undoe2fs.o XTRA_CFLAGS= -I$(srcdir)/../e2fsck -I.
@@ -47,7 +48,7 @@ SRCS= $(srcdir)/tune2fs.c $(srcdir)/mklost+found.c $(srcdir)/mke2fs.c \ $(srcdir)/badblocks.c $(srcdir)/fsck.c $(srcdir)/util.c \ $(srcdir)/uuidgen.c $(srcdir)/blkid.c $(srcdir)/logsave.c \ $(srcdir)/filefrag.c $(srcdir)/base_device.c \ - $(srcdir)/../e2fsck/profile.c + $(srcdir)/../e2fsck/profile.c $(srcdir)/undoe2fs.c LIBS= $(LIBEXT2FS) $(LIBCOM_ERR) DEPLIBS= $(LIBEXT2FS) $(LIBCOM_ERR)
@@ -108,6 +109,10 @@ e2image: $(E2IMAGE_OBJS) $(DEPLIBS) @echo " LD $@" @$(CC) $(ALL_LDFLAGS) -o e2image $(E2IMAGE_OBJS) $(LIBS) $(LIBINTL) +undoe2fs: $(UNDOE2FS_OBJS) $(DEPLIBS) + @echo " LD $@" + @$(CC) $(ALL_LDFLAGS) -o undoe2fs $(UNDOE2FS_OBJS) $(LIBS) + base_device: base_device.c @echo " LD $@" @$(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) $(srcdir)/base_device.c \
@@ -434,3 +439,4 @@ filefrag.o: $(srcdir)/filefrag.c base_device.o: $(srcdir)/base_device.c $(srcdir)/fsck.h profile.o: $(srcdir)/../e2fsck/profile.c $(top_srcdir)/lib/et/com_err.h \ $(srcdir)/../e2fsck/profile.h prof_err.h +undoe2fs.o: $(srcdir)/undoe2fs.c $(top_srcdir)/lib/ext2fs/tdb.h
misc/undoe2fs.c new file +48 -0
48 lines not on this page · raw message
Signature · 1 line
1.5.3.rc0.63.gc956-dirty