Imported Upstream version 0.10.2

parent 9542a64f
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
/* Define to 1 if you have the <ext2fs/ext2fs.h> header file. */
#undef HAVE_EXT2FS_EXT2FS_H
......@@ -48,6 +51,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
......@@ -60,6 +66,18 @@
/* Version number of package */
#undef VERSION
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
......
This diff is collapsed.
This diff is collapsed.
......@@ -6,7 +6,7 @@ dnl CW_VERSION_REVISION : Increment every public release; or set to 0
define(CW_VERSION_MAJOR, 0)
define(CW_VERSION_MINOR, 10)
define(CW_VERSION_REVISION, 1)
define(CW_VERSION_REVISION, 2)
define(CW_PACKAGE_NAME, [ext3grep])
define(CW_BUGREPORT, [carlo@alinoe.com])
......
ext3grep (0.10.1-3.2) unstable; urgency=low
* Fix FTBFS (Closes: #634412)
+ some versions of the ext2 headers call a field s_frags_per_group and some
call it s_clusters_per_group, define one to the other so the code works
with both
+ i_reseved2 has been split into two fields in recent versions of the
headers, use the "hurd" side of the union to continue to access it in
one piece
* Add sh4 to arch list. (Closes: #617447)
-- Peter Michael Green <plugwash@debian.org> Thu, 07 Jun 2012 20:02:02 +0000
ext3grep (0.10.1-3.1) unstable; urgency=low
* NMU, added armhf to arch list. (Closes: #604656)
-- Konstantinos Margaritis <markos@debian.org> Thu, 24 Feb 2011 17:16:07 +0000
ext3grep (0.10.1-3) unstable; urgency=low
* Updating package to standards version 3.8.2.
* Adding lintian overrides.
-- Daniel Baumann <daniel@debian.org> Thu, 09 Jul 2009 11:50:30 +0200
ext3grep (0.10.1-2) unstable; urgency=low
* Passing flags to configure as arguments.
* Prefixing debhelper files with package name.
* Adding myself to copyright.
* Upgrading package to standards 3.8.1.
* Tidy rules file.
-- Daniel Baumann <daniel@debian.org> Thu, 28 May 2009 21:08:53 +0200
ext3grep (0.10.1-1) unstable; urgency=low
* Merging upstream version 0.10.1.
-- Daniel Baumann <daniel@debian.org> Fri, 19 Dec 2008 23:21:00 +0100
ext3grep (0.10.0-1) unstable; urgency=low
* Merging upstream version 0.10.0.
* Replacing obsolete dh_clean -k with dh_prep.
-- Daniel Baumann <daniel@debian.org> Fri, 28 Nov 2008 09:16:00 +0100
ext3grep (0.9.0-1) unstable; urgency=low
[ Daniel Baumann ]
* Rewording author section in the manpage, also adding reference to
ext3grep upstream author.
* Removing imported whitespace at EOL in changelog.
* Removing imported whitespace at EOF in control.
* Polishing formating of the manpage.
* Using package long description in manpage.
* Updating vcs fields.
* Regenerating changelog for 0.6.0-1 and 0.8.0-1 from git commit log.
* Updating download url in copyright file.
* Merging upstream version 0.9.0. (Closes: #501018)
-- Luca Bruno <lucab@debian.org> Fri, 17 Oct 2008 21:54:42 +0200
ext3grep (0.8.0-1) unstable; urgency=low
[ Luca Bruno ]
* Imported Upstream version 0.7.0:
[ Rich Ercolani ]
* Imported Upstream version 0.8.0
- Allow inode_size_ to be larger than sizeof(Inode) (Closes: #491621)
* Config --disable-optimization changed to --disable-optimize in this version
[ Luca Bruno ]
* Removed all big-endian arch, as ext3grep won't work there
-- Rich Ercolani <rercola@acm.jhu.edu> Fri, 15 Aug 2008 01:41:12 -0400
ext3grep (0.6.0-1) unstable; urgency=low
[ Rich Ercolani ]
* Initial release (Closes: #470813).
[ Luca Bruno ]
* Now maintained within the Debian Forensics team
* Added the Vcs-Git related tag
[ Daniel Baumann ]
* Updating package to debhelper 7.
* Sorting control fields.
* Removing unneded build-dependencies to essential packages.
* Adding soname independent build-depends alternative for libncurses5-dev.
* Updating to standards 3.8.0.
* Using punct rather than double-backslash for empty lines in package
long-description.
* Removing cruft from watch file.
* Reordering rules file.
* Moving manpage into sub-directory of debian/.
* Rewriting copyright file in machine-interpretable format.
* Using NEWS file as changelog.
* Removing unused dirs debhelper file.
* Forgot to remove manpage file in old location.
* Rewrapping and reformating manpage.
* Adding copyright notice for src/kernel-jbd.h to copyright file.
* Sorting vcs fields in control.
[ Luca Bruno ]
* Added missing pkg-config build-dep
* Removing -dbg package (for now)
-- Rich Ercolani <rercola@acm.jhu.edu> Fri, 14 Mar 2008 22:19:59 -0400
Source: ext3grep
Section: admin
Priority: extra
Maintainer: Debian Forensics <forensics-devel@lists.alioth.debian.org>
Uploaders: Luca Bruno <lucab@debian.org>, Rich Ercolani <rercola@acm.jhu.edu>
Build-Depends: debhelper (>= 7), autotools-dev, e2fslibs-dev, libncurses5 | libncurses-dev, pkg-config
Standards-Version: 3.8.2
Homepage: http://code.google.com/p/ext3grep/
Vcs-Browser: http://git.debian.net/?p=debian-forensics/ext3grep.git
Vcs-Git: git://git.debian.net/git/debian-forensics/ext3grep.git
Package: ext3grep
Architecture: alpha amd64 arm armel armhf i386 ia64 mipsel sh4
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Tool to help recover deleted files on ext3 filesystems
ext3grep is a simple tool intended to aid anyone who accidentally deletes a
file on an ext3 filesystem, only to find that they wanted it shortly
thereafter.
Author: Carlo Wood <carlo@alinoe.com>
Download: http://code.google.com/p/ext3grep/downloads/list
Files: *
Copyright: (C) 2008 Carlo Wood <carlo@alinoe.com>
License: GPL-2+
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.
On Debian systems, the complete text of the GNU General Public License
can be found in /usr/share/common-licenses/GPL-2 file.
Files: src/kernel-jbd.h
Copyright: (C) 1998-2000 Red Hat, Inc
License: GPL-2+
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.
On Debian systems, the complete text of the GNU General Public License
can be found in /usr/share/common-licenses/GPL-2 file.
Files: debian/*
Copyright:
(C) 2008-2009 Rich Ercolani <rercola@acm.jhu.edu>
(C) 2008-2009 Daniel Baumann <daniel@debian.org>
License: GPL-2+
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.
On Debian systems, the complete text of the GNU General Public License
can be found in /usr/share/common-licenses/GPL-2 file.
.TH EXT3GREP 8 "2008-09-14" "0.8.0" "recover files on ext3 filesystems"
.SH NAME
ext3grep \- ext3 file recovery tool
.SH SYNOPSIS
\fBext3grep\fR [\fIOPTIONS\fR] \fIFILE\fR \&...
.SH DESCRIPTION
ext3grep is a simple tool intended to aid anyone who accidentally deletes a file on an ext3 filesystem, only to find that they wanted it shortly thereafter.
.SH OPTIONS
.IP "\fB\-\-superblock\fR" 4
Print contents of superblock in addition to the rest. If no action is specified then this option is implied.
.IP "\fB\-\-print\fR" 4
Print contents of block or inode, if any.
.IP "\fB\-\-ls\fR" 4
Print directories, one line per entry. See the \fBFILTERS\fR section for details on filtering this output.
.IP "\fB\-\-accept\fR \fIFILE\fR" 4
Accepts 'file' as a legal filename. Can be used multiple times. If you change any \fB\-\-accept\fR you must remove BOTH stage* files!
.IP "\fB\-\-journal\fR" 4
Prints the contents of the journal.
.IP "\fB\-\-show\-path\-inodes\fR" 4
Show the inode of each directory component in paths.
.PP
.SS "Filters:"
.IP "\fB\-\-group\fR \fIgid\fR" 4
Only show/process files owned by process group \fIgid\fR.
.IP "\fB\-\-directory\fR" 4
Only show/process process directory inodes.
.IP "\fB\-\-after\fR \fIdtime\fR" 4
Only show/process entries deleted on or after \fIdtime\fR.
.IP "\fB\-\-before\fR \fIdtime\fR" 4
Only show/process entries deleted before \fIdtime\fR.
.IP "\fB\-\-deleted\fR" 4
Only show/process deleted entries.
.IP "\fB\-\-allocated\fR" 4
Only show/process allocated inodes/blocks.
.IP "\fB\-\-unallocated\fR" 4
Only show/process unallocated inodes/blocks.
.IP "\fB\-\-reallocated\fR" 4
Do not suppress entries with reallocated inodes. Inodes are considered 'reallocated' if the entry is deleted but the inode is allocated, but also when the file type in the dir entry and the inode are different.
.IP "\fB\-\-zeroed\-inodes\fR" 4
Do not suppress entries with zeroed inodes. Linked entries are always shown, regardless of this option.
.IP "\fB\-\-depth\fR depth"
Process directories recursively up till a depth of 'depth'.
.PP
.SS "Actions:"
.IP "\fB\-\-inode\-to\-block\fR \fIinode_num\fR" 4
Print the block that contains inode \fIinode_num\fR.
.IP "\fB\-\-inode\fR \fIinode_num\fR" 4
Show info on inode \fIinode_num\fR. If \fB\-\-ls\fR is used and the inode is a directory, then the filters apply to the entries of the directory. If you do not use \fB\-\-ls\fR then \fB\-\-print\fR is implied.
.IP "\fB\-\-block\fR \fIblock_num\fR" 4
Show info on block \fIblock_num\fR. If \fB\-\-ls\fR is used and the block is the first block of a directory, then the filters apply to entries of the directory. If you do not use \fB\-\-ls\fR then \fB\-\-print\fR is implied.
.IP "\fB\-\-histogram\fR=[\fIatime\fR|\fIctime\fR|\fImtime\fR|\fIdtime\fR|\fIgroup\fR]" 4
Generate a histogram based on the given specs. Using atime, ctime or mtime will change the meaning of \fB\-\-after\fR and \fB\-\-before\fR to those times.
.IP "\fB\-\-journal\-block\fR \fIblock_num\fR" 4
Show info on journal block \fIblock_num\fR.
.IP "\fB\-\-journal\-transaction\fR \fIseq\fR" 4
Show info on transaction with sequence number \fIseq\fR.
.IP "\fB\-\-dump\-names\fR" 4
Write the paths of files to stdout. This implies \fB\-\-ls\fR but suppresses its output.
.IP "\fB\-\-search\-start\fR \fIstr\fR" 4
Find blocks that start with the fixed string \fIstr\fR.
.IP "\fB\-\-search\fR \fIstr\fR" 4
Find blocks that contain the fixed string \fIstr\fR.
.IP "\fB\-\-search\-inode\fR \fIblock_num\fR" 4
Find inodes that refer to block \fIblock_num\fR.
.IP "\fB\-\-search\-zeroed\-inodes\fR" 4
Return allocated inode table entries that are zeroed.
.IP "\fB\-\-inode\-dirblock\-table\fR \fIdir\fR" 4
Print a table for directory path \fIdir\fR of directory block numbers found and the inodes used for each file.
.IP "\fB\-\-show\-journal\-inodes\fR \fIinode_num\fR" 4
Show copies of inode \fIinode_num\fR still in the journal.
.IP "\fB\-\-restore\-file\fR \fIpath\fR" 4
Will restore file \fIpath\fR. \fIpath\fR is relative to root of the partition and does not start with a '/' (it must be one of the paths returned by \fB\-\-dump\-names\fR). The restored directory, file or symbolic link is created in the current directory as ./\fIpath\fR.
.IP "\fB\-\-restore\-all\fR" 4
As \fB\-\-restore\-file\fR but attempts to restore everything. The use of \fB\-\-after\fR is highly recommended because the attempt to restore very old files will only result in them being hard linked to a more recently deleted file and as such pollute the output.
.IP "\fB\-\-show\-hardlinks\fR" 4
Show all inodes that are shared by two or more files.
.IP "\fB\-\-version\fR, \fB\-[vV]\fR" 4
Prints the version information and exits.
.IP "\fB\-\-help\fR," 4
Prints a help message and exits.
.SH EXAMPLES
\fBRestoring all files from the ext3 partition/file /backup/sda1:\fR
.nf
ext3grep \-\-restore-all /backup/sda1
.fi
\fBListing the files owned by GID 1000 on /backup/sda1:\fR
.nf
ext3grep \-\-ls \-\-group 1000 /backup/sda1
.fi
\fBFinding all files containing the string Critical_report in their name on /backup/sda1:\fR
.nf
ext3grep \-\-dump-names /backup/sda1 | grep 'Critical_report'
.fi
.SH LIMITATIONS
Do not attempt to use ext3grep for recovery from a mounted filesystem. Ever.
.PP
No, not even then.
.PP
ext3grep sometimes runs out of memory spare on 32-bit architectures and crashes. It is highly recommended that you run ext3grep in a 64-bit environment when dealing with large filesystems, though this is seen as a bug.
.PP
ext3grep cannot recover files if there are no remnants of them.
.PP
Some files that ext3grep recovers may have trailing null bytes - just scrape them off like the burnt bits on toast.
.SH SEE ALSO
\fIdebugfs\fR(8)
.SH AUTHOR
ext3grep was written by Carlo Wood <\fIcarlo@alinoe.com\fR>.
.PP
This manual page was written by Rich Ercolani <\fIrercola@acm.jhu.edu\fR>, for the Debian project (but may be used by others). It may be distributed under the same terms as ext3grep, the GNU General Public License, either version 2 or (at your option) any later version.
#!/usr/bin/make -f
# Uncomment the following line to disable optimization and enable
# richer debug information.
# DEB_BUILD_OPTIONS += nostrip noopt
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
else
CROSS= --build $(DEB_BUILD_GNU_TYPE)
endif
ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
EXTRA += --enable-debug --disable-optimize
endif
clean:
dh_testdir
dh_testroot
rm -f build-stamp
[ ! -f Makefile ] || $(MAKE) distclean
dh_clean
config.status: configure
dh_testdir
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
cp -f /usr/share/misc/config.guess config.guess
endif
./configure $(CROSS) --prefix=/usr $(EXTRA) CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
build: build-stamp
build-stamp: config.status
dh_testdir
$(MAKE)
touch build-stamp
install: build
dh_testdir
dh_testroot
dh_prep
$(MAKE) DESTDIR=$(CURDIR)/debian/ext3grep install
binary: binary-arch
binary-arch: install
dh_testdir
dh_testroot
dh_installchangelogs NEWS
dh_installdocs
dh_installman
dh_lintian
dh_strip
dh_compress
dh_fixperms
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary-indep:
.PHONY: clean build install binary binary-arch binary-indep
# Avoid warnings if non-uploaders to uploads.
ext3grep source: changelog-should-mention-nmu
ext3grep source: source-nmu-has-incorrect-version-number
version=3
http://code.google.com/p/ext3grep/downloads/list http://ext3grep.googlecode.com/files/ext3grep-(.*).tar.gz
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2006-12-25.00
scriptversion=2009-04-28.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
......@@ -515,5 +515,6 @@ done
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2006-05-10.23
scriptversion=2009-04-28.21; # UTC
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
# 2008, 2009 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
......@@ -18,9 +18,7 @@ scriptversion=2006-05-10.23
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
......@@ -89,6 +87,9 @@ Supported PROGRAM values:
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
\`g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
......@@ -106,15 +107,22 @@ Send bug reports to <bug-automake@gnu.org>."
esac
# normalize program name to check for.
program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program).
# the program). This is about non-GNU programs, so use $1 not
# $program.
case $1 in
lex|yacc)
lex*|yacc*)
# Not GNU programs, they don't have --version.
;;
tar)
tar*)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
......@@ -138,7 +146,7 @@ esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $1 in
case $program in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
......@@ -148,7 +156,7 @@ WARNING: \`$1' is $msg. You should only need it if
touch aclocal.m4
;;
autoconf)
autoconf*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
......@@ -157,7 +165,7 @@ WARNING: \`$1' is $msg. You should only need it if
touch configure
;;
autoheader)
autoheader*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
......@@ -187,7 +195,7 @@ WARNING: \`$1' is $msg. You should only need it if
while read f; do touch "$f"; done
;;
autom4te)
autom4te*)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
......@@ -210,7 +218,7 @@ WARNING: \`$1' is needed, but is $msg.
fi
;;
bison|yacc)
bison*|yacc*)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
......@@ -240,7 +248,7 @@ WARNING: \`$1' $msg. You should only need it if
fi
;;
lex|flex)
lex*|flex*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
......@@ -263,7 +271,7 @@ WARNING: \`$1' is $msg. You should only need it if
fi
;;
help2man)
help2man*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
......@@ -277,11 +285,11 @@ WARNING: \`$1' is $msg. You should only need it if
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
exit $?
fi
;;
makeinfo)
makeinfo*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
......@@ -310,7 +318,7 @@ WARNING: \`$1' is $msg. You should only need it if
touch $file
;;
tar)
tar*)
shift
# We have already tried tar in the generic part.
......@@ -363,5 +371,6 @@ exit 0
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
This diff is collapsed.
......@@ -149,10 +149,14 @@ static void print_usage(std::ostream& os)
os << " block numbers found and the inodes used for each file.\n";
os << " --show-journal-inodes ino\n";
os << " Show copies of inode 'ino' still in the journal.\n";
os << " --restore-inode ino[,ino,...]\n";
os << " --restore-inode ino[@seqnr][,ino[@seqnr],...]\n";
os << " Restore the file(s) with known inode number 'ino'.\n";
os << " The restored files are created in ./" << outputdir << "\n";
os << " with their inode number as extension (ie, inode.12345).\n";
os << " If '@seqnr' is provided then (only) the journal entry\n";
os << " with that sequence number is used, otherwise the latest\n";
os << " entry is used (if any). You can use that in the case a\n";
os << " a file was overwritten or truncated, rather than deleted.\n";
os << " --restore-file 'path' [--restore-file 'path' ...]\n";
os << " Will restore file 'path'. 'path' is relative to the\n";
os << " root of the partition and does not start with a '/' (it\n";
......
......@@ -24,6 +24,7 @@
#ifndef USE_PCH
#include "sys.h"
#include <sys/types.h>
#include <sys/time.h>
#include "ext3.h"
#include "debug.h"
#endif
......
......@@ -24,17 +24,6 @@
#ifndef EXT3_H
#define EXT3_H
// this trickery needs to happen before ext2_fs is included so
// bail out if it has already been included by another path
#ifdef _LINUX_EXT2_FS_H
#error please include this file before any other includes of ext2fs/ext2_fs.h
#endif
// some versions of the ext2 headers call this s_frags_per_group and some
// call it s_clusters_per_group, define one to the other so our code works
// with both
#define s_clusters_per_group s_frags_per_group
// Use the header files from e2progs (http://e2fsprogs.sourceforge.net)
// We can use these headers and then everything named ext2 or ext3.
#include <ext2fs/ext2_fs.h> // Definitions of ext2, ext3 and ext4.
......@@ -121,12 +110,6 @@ struct Inode : protected ext3_inode {
__u32 faddr(void) const { return i_faddr; }
__u16 uid_high(void) const { return i_uid_high; }
__u16 gid_high(void) const { return i_gid_high; }
#ifndef i_reserved2
//i_reserved2 has been split into two fields in recent
//versions of the headers, luckilly we can still access
//it in one peice through the hurd side of the union
#define i_reserved2 osd2.hurd2.h_i_author
#endif
__u32 reserved2(void) const { return i_reserved2; }
void set_reserved2(__u32 val) { i_reserved2 = val; }
......
......@@ -497,10 +497,18 @@ void run_program(void)
char comma;
while(is >> inodenr)
{
int seqnr = latest;
if (is.peek() == '@')
{
is >> comma; // Eat the '@'.
is >> seqnr;
}
InodePointer real_inode = get_inode(inodenr);
std::ostringstream oss;
oss << "inode." << inodenr;
restore_inode(inodenr, real_inode, oss.str());
if (seqnr != latest)
oss << '@' << seqnr;
restore_inode(inodenr, real_inode, oss.str(), seqnr);
is >> comma;
};
}
......
......@@ -35,6 +35,8 @@
//
#if !USE_MMAP
void load_meta_data(int group);
void load_inodes(int group)
{
DoutEntering(dc::notice, "load_inodes(" << group << ")");
......
......@@ -49,10 +49,10 @@
void iterate_over_all_blocks_of__with__restore_file_action(void) { restore_file_action(0, 0, NULL); }
#endif
get_undeleted_inode_type get_undeleted_inode(int inodenr, Inode& inode, int* sequence)
get_undeleted_inode_type get_undeleted_inode(int inodenr, Inode& inode, int* sequence, int seqnr)
{
InodePointer real_inode(get_inode(inodenr));
if (!real_inode->is_deleted())
if (!real_inode->is_deleted() && seqnr == latest)
{
inode = *real_inode;
return ui_real_inode;
......@@ -62,7 +62,7 @@ get_undeleted_inode_type get_undeleted_inode(int inodenr, Inode& inode, int* seq
for (std::vector<std::pair<int, Inode> >::iterator iter = inodes.begin(); iter != inodes.end(); ++iter)
{
Inode const& journal_inode(iter->second);
if (!journal_inode.is_deleted())
if (!journal_inode.is_deleted() && (seqnr == latest || iter->first == seqnr))
{
inode = journal_inode;
if (sequence)
......@@ -169,7 +169,7 @@ void restore_file(std::string const& outfile)
restore_inode(inodenr, real_inode, outfile);
}
void restore_inode(int inodenr, InodePointer real_inode, std::string const& outfile)
void restore_inode(int inodenr, InodePointer real_inode, std::string const& outfile, int seqnr)
{
std::string outputdir_outfile = outputdir + outfile;
if (is_directory(*real_inode))
......@@ -203,11 +203,16 @@ void restore_inode(int inodenr, InodePointer real_inode, std::string const& outf
else
{
Inode inode;
get_undeleted_inode_type res = get_undeleted_inode(inodenr, inode);
get_undeleted_inode_type res = get_undeleted_inode(inodenr, inode, NULL, seqnr);
if (res != ui_real_inode && res != ui_journal_inode)
{
if (res == ui_no_inode)
std::cout << "Cannot find an undeleted inode for file \"" << outfile << "\".\n";
{
std::cout << "Cannot find an undeleted inode for file \"" << outfile << "\"";
if (seqnr != latest)
std::cout << " in journal entry with sequence number " << seqnr;
std::cout << ".\n";
}
else
std::cout << "Not undeleting \"" << outfile << "\" because it was deleted before " << commandline_after << " (" << inode.ctime() << ")\n";
return;
......
......@@ -32,8 +32,9 @@
// Real constants.
std::string const outputdir = "RESTORED_FILES/";
int const latest = -1;
void restore_inode(int inodenr, InodePointer real_inode, std::string const& outfile);
void restore_inode(int inodenr, InodePointer real_inode, std::string const& outfile, int seqnr = latest);