Imported reiserfsprogs-3.6.9

This commit is contained in:
Jeff Mahoney committed 2012-10-11 11:29:29 -04:00
1 parent 99c89460c3
commit cccefa4d84
86 files changed
+13393 -6954

No files matched your search

+90
View File
@@ -0,0 +1,90 @@
/*
Copyright 1996-2003 by Hans Reiser, licensing governed by
reiserfsprogs/README.
*/
Hans Reiser was the project initiator, source of all funding for the first 5.5
years. He is the architect and official maintainer.
Vladimir Saveliev started as the most junior programmer on the team, and became
the lead programmer. He is now an experienced highly productive programmer. He
wrote the extent handling code for Reiser4, plus parts of the balancing code
and file write and file read.
Alexander Zarochentcev (zam) wrote the high low priority locking code, online
resizer for V3 and V4, online repacker for V4, block allocation code, and major
parts of the flush code, and maintains the transaction manager code. We give
him the stuff that we know will be hard to debug, or needs to be very cleanly
structured.
Nikita Danilov wrote most of the core balancing code, plugin infrastructure,
and directory code. He steadily worked long hours, and is the reason so much of
the Reiser4 plugin infrastructure is well abstracted in its details. The carry
function, and the use of non-recursive balancing, are his idea.
Vladimir Demidov wrote the parser for sys_reiser4(), the V3 alpha port, part of
the V3 journal relocation code, and helped Hans keep the business side of
things running.
Chris Mason wrote the journaling code for V3, which was enormously more useful
to users than just waiting until we could create a wandering log filesystem as
Hans would have unwisely done without him.
Jeff Mahoney optimized the bitmap scanning code for V3, and performed the big
endian cleanups.
Elena Gryaznova performed testing and benchmarking.
Oleg Drokin was the debugger for V3 during most of the time that V4 was under
development, and was quite skilled and fast at it. He wrote the large write
optimization of V3.
Edward Shushkin wrote the encryption and compression file plugins, and the V3
journal relocation code.
Alexander Lyamin keeps our hardware running, and was very generous to our
project in many little ways.
Vitaly Fertman wrote fsck for V3 and maintains the reiserfsprogs package now.
He wrote librepair, userspace plugins repair code, fsck for V4, and worked on
developing libreiser4 and userspace plugins with Umka.
Yury Umanets (aka Umka) developed libreiser4, userspace plugins, and all
userspace tools (reiser4progs) except of fsck.
Joshua Macdonald wrote the first draft of the transaction manager. Yuri Rupasov
did testing and benchmarking, plus he invented the r5 hash (also used by the
dcache code). Yura Rupasov, Anatoly Pinchuk, Igor Krasheninnikov, Grigory
Zaigralin, Mikhail Gilula, Igor Zagorovsky, Roman Pozlevich, Konstantin
Shvachko, and Joshua MacDonald are former contributors to the project.
Jeremy Fitzhardinge wrote the teahash.c code for V3. Colin Plumb also
contributed to that.
The Defense Advanced Research Projects Agency (DARPA, www.darpa.mil) is the
primary sponsor of Reiser4. DARPA does not endorse this project; it merely
sponsors it.
Continuing core development of ReiserFS is mostly paid for by Hans Reiser from
money made selling licenses in addition to the GPL to companies who don't want
it known that they use ReiserFS as a foundation for their proprietary product.
And my lawyer asked 'People pay you money for this?'. Yup. Life is good. If you
buy ReiserFS, you can focus on your value add rather than reinventing an entire
FS.
BigStorage (www.bigstorage.com) contributes to our general fund every month,
and has done so for quite a long time.
SuSE (www.suse.com) pays for continuing work on journaling for version 3, paid
for much of the previous version 3 work, and is paying for Chris and Jeff to do
V3 maintenance. Reiserfs integration in their distro is consistently solid, and
they were key to our becoming widely used.
Lycos (www.lycos.com) has a support contract with us that consistently comes in
just when we would otherwise miss payroll, and that they keep doubling every
year. Much thanks to them.
Many persons came to www.namesys.com/support.html, and got a question answered
for $25, or just gave us a small donation there.
Thanks to all of those sponsors, including the secret ones. Without you, we
would each still have that day job.
+137 -1
View File
@@ -1,3 +1,139 @@
2003-07-16
*reiserfsprogs
Credits were changed.
A pair of them are printed at mkfs time.
*reiserfsprogs
3.6.9 release.
2003-06-25
*reiserfsprogs
Bugs were fixed:
- in reiserfsck rebuild-sb of relocated journal;
- in reiserfstune --no-journal-available;
- in bitmap handling during resizing;
- in mkreiserfs with notstandard journal on the main device
with not standard offset;
- in not standard journal creation.
2003-05-29
*reiserfsprogs
Bugs in journal traversing and in rebuild-sb were fixed.
2003-05-20
*reiserfsck
Forks another process with openned file descriptor of the
partition being checked when fscking on boot and sleep for
5 secs to avoid reading of all bitmaps on mount again.
2003-05-16
*mkreiserfs
A bug with not standard journal cretion was fixed.
*reiserfsprogs
3.6.8 release.
2003-05-07
*reiserfsck
Exit codes were fixed;
--yes option was added into fsck
*mkreiserfs
--quiet option was added into mkfs
2003-05-06
*reiserfsprogs
A bug in journal replaying code when the only transaction
exists was fixed.
2003-05-01
*reiserfsprogs
Make fsck to proceed when wrong journal parameters in the journal
header on a fs with standard journal detected fixing them with the
warning.
*reiserfsprogs
3.6.7 release.
2003-04-24
*reiserfsprogs
3.6.6 release.
2003-04-01
*reiserfsprogs
Bug with flushing buffers on bad file descriptor was fixed.
*reiserfstune
Bugs with not standard journal were fixed.
2003-03-13
*reiserfsck
Leaves recovery was improved - if some items are detected, try
to recover the leaf even if block head is corrupted.
2003-03-04
*reiserfsck
The objectid handling was improved, significant speedup at
semantic pass and lost+found pass.
2003-02-27
*reiserfsprogs
The check if the last block on fs is readable was moved from
bitmap check to fs_open.
Check transactions content before replaying, sware on invalid
content instead of replay attempts, print about results.
*reiserfsprogs
3.6.5 release.
2003-02-21
*reiserfsck
a critical bug on pass0 of rebuild-tree with overflowing while
checking unformatted item offsets was fixed.
*reiserfsprogs
3.6.5-pre2 release.
2003-02-20
*reiserfsck
reiserfsck -a (started at boot) replays journal, checks error
flags in sb, bitmaps, fs size, 2 levels of internal tree and
switches to fixble mode if any problem is detected. For root
fs fixable cannot be performed (as fs is mounted) and just
--check will be done.
2003-02-14
*reiserfsck
fix-fixable does not relocated shared object ids anymore.
Bug in relocation - entry key was not updated correctly with
the new key of relocated file.
2003-02-12
*reiserfsprogs
Journal replay was improved - check blocks if they are journable
before replaying; - replay only transactions which has trans_id
== last replayed transaction trans_id + 1.
2003-02-10
*reiserfsprogs
le bitops operations were added back to avoid arch dependence
with including asm/bitops.h - we should use le operations even
on be mashins.
2003-01-31
*reiserfsprogs
Warning messages about the broken hardware were improved.
2003-01-30
*reiserfsprogs
Check for bits in ondisk bitmaps after the last valid bit was
added - all these bits should be set to 1.
2002-12-13
*reiserfsck
Keep only permanent fields of the super block, but not the whole
super block, in separate memory while replaying.
2002-12-11
*reiserfsck
While openning the journal check that journal parameters in
super block and in jheader mathches; Advice to run rebuild-sb
if not. While rebuilding super block, do the same check and ask
the user if he wants to rebuild the jheader or continue without
the journal or he wants to change the start of the partition
before using reiserfsck.
2002-12-04
*reiserfsprogs
3.6.5-pre1 is released.
2002-12-02
*reiserfsck
a few bugs were fixed:
- bug in balancing code led to abort when a leaf could be viewed
as a super block;
- bug in checking statdata size for symlinks - there cannot be a
hole at the end of symlink.
2002-11-28
*reiserfsck
pass0 does not need a true objectid map, just those objectids
which are not used. This sppedups pass0 a lot as many memoves
are eliminated.
*reiserfsck
bug with item format for symlinks was fixed.
2002-10-02
*reiserfsprogs
3.6.4 is released.
2002-09-24
*reiserfsck
bitmap handling was improved: fix-fixable fixes not only those
@@ -213,7 +349,7 @@
* reiserfsprogs.spec (Anthon van der Neut)
rpm can be built as non-root
link from reiserfsck to fsck.reiserfs
rpm -e reiserfsprogs should now work w/o rmdir of /
rpm -e reiserfsprogs should now work without rmdir of /
2001-03-13
* reiserfsck
--quiet option is added
+2 -2
View File
@@ -1,8 +1,8 @@
SUBDIRS = include lib reiserfscore fsck debugreiserfs resize_reiserfs mkreiserfs tune
SUBDIRS = include lib reiserfscore fsck debugreiserfs resize_reiserfs mkreiserfs tune tests
noinst_DATA = reiserfsprogs.spec
EXTRA_DIST = version.h
EXTRA_DIST = CREDITS version.h
dist-hook:
cp -f reiserfsprogs.spec $(distdir)
+346 -207
View File
@@ -1,6 +1,8 @@
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -10,124 +12,141 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
SUBDIRS = include lib reiserfscore fsck debugreiserfs resize_reiserfs mkreiserfs tune
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
SUBDIRS = include lib reiserfscore fsck debugreiserfs resize_reiserfs mkreiserfs tune tests
noinst_DATA = reiserfsprogs.spec
EXTRA_DIST = version.h
EXTRA_DIST = CREDITS version.h
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ./include/config.h
CONFIG_CLEAN_FILES =
DATA = $(noinst_DATA)
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
Makefile.in NEWS acconfig.h aclocal.m4 configure configure.in \
include/config.h.in include/stamp-h.in install-sh missing mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
DATA = $(noinst_DATA)
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
ps-recursive install-info-recursive uninstall-info-recursive \
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
Makefile.in NEWS aclocal.m4 configure configure.in depcomp \
install-sh missing mkinstalldirs
DIST_SUBDIRS = $(SUBDIRS)
all: all-recursive
TAR = tar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)
$(ACLOCAL_M4): configure.in
cd $(srcdir) && $(ACLOCAL)
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
include/config.h: include/stamp-h
@if test ! -f $@; then \
rm -f include/stamp-h; \
$(MAKE) include/stamp-h; \
else :; fi
include/stamp-h: $(srcdir)/include/config.h.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES= CONFIG_HEADERS=include/config.h \
$(SHELL) ./config.status
@echo timestamp > include/stamp-h 2> /dev/null
$(srcdir)/include/config.h.in: $(srcdir)/include/stamp-h.in
@if test ! -f $@; then \
rm -f $(srcdir)/include/stamp-h.in; \
$(MAKE) $(srcdir)/include/stamp-h.in; \
else :; fi
$(srcdir)/include/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
cd $(top_srcdir) && $(AUTOHEADER)
@echo timestamp > $(srcdir)/include/stamp-h.in 2> /dev/null
mostlyclean-hdr:
clean-hdr:
distclean-hdr:
-rm -f include/config.h
maintainer-clean-hdr:
$(ACLOCAL_M4): configure.in
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
@@ -135,13 +154,8 @@ maintainer-clean-hdr:
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
@SET_MAKE@
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive info-recursive dvi-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
$(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -161,13 +175,18 @@ check-recursive installcheck-recursive info-recursive dvi-recursive:
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
rev="$$subdir $$rev"; \
test "$$subdir" != "." || dot_seen=yes; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
test "$$dot_seen" = "no" && rev=". $$rev"; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
@@ -183,174 +202,294 @@ tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
mkid -fID $$unique
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
fi; \
fi; \
done; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
mostlyclean-tags:
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
clean-tags:
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = .
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" \
distdir=../$(distdir)/$$subdir \
distdir) \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist dist-all: distdir
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
-rm -rf $(distdir)
GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
$(am__remove_distdir)
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
dc_install_base=`cd $(distdir)/=inst && pwd`; \
cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) dist
-rm -rf $(distdir)
@banner="$(distdir).tar.gz is ready for distribution"; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
echo "$$dashes"
dist: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
dist-all: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
distdir: $(DISTFILES)
-rm -rf $(distdir)
mkdir $(distdir)
-chmod 777 $(distdir)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
for subdir in $(SUBDIRS); do \
if test "$$subdir" = .; then :; else \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
chmod 777 $(distdir)/$$subdir; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook
info-am:
info: info-recursive
dvi-am:
dvi: dvi-recursive
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
&& rm -f $(distdir).tar.gz \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@echo "$(distdir).tar.gz is ready for distribution" | \
sed 'h;s/./=/g;p;x;p;x'
distuninstallcheck:
cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
installcheck-am:
installcheck: installcheck-recursive
install-exec-am:
install-exec: install-exec-recursive
install-data-am:
install-data: install-data-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-recursive
uninstall-am:
uninstall: uninstall-recursive
all-am: Makefile $(DATA)
all-redirect: all-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
info: info-recursive
info-am:
install-data-am:
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf autom4te.cache
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
clean-am: clean-hdr clean-tags clean-generic mostlyclean-am
mostlyclean-am: mostlyclean-generic
clean: clean-recursive
pdf: pdf-recursive
distclean-am: distclean-hdr distclean-tags distclean-generic clean-am
pdf-am:
distclean: distclean-recursive
-rm -f config.status
ps: ps-recursive
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
ps-am:
maintainer-clean: maintainer-clean-recursive
-rm -f config.status
uninstall-am: uninstall-info-am
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
install-data-recursive uninstall-data-recursive install-exec-recursive \
uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
all-recursive check-recursive installcheck-recursive info-recursive \
dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all installdirs-am \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
clean-generic clean-recursive ctags ctags-recursive dist \
dist-all dist-gzip distcheck distclean distclean-generic \
distclean-recursive distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am dvi-recursive info info-am \
info-recursive install install-am install-data install-data-am \
install-data-recursive install-exec install-exec-am \
install-exec-recursive install-info install-info-am \
install-info-recursive install-man install-recursive \
install-strip installcheck installcheck-am installdirs \
installdirs-am installdirs-recursive maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive mostlyclean \
mostlyclean-generic mostlyclean-recursive pdf pdf-am \
pdf-recursive ps ps-am ps-recursive tags tags-recursive \
uninstall uninstall-am uninstall-info-am \
uninstall-info-recursive uninstall-recursive
dist-hook:
cp -f reiserfsprogs.spec $(distdir)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
+39 -149
View File
@@ -1,157 +1,47 @@
[LICENSING]
ReiserFS is hereby licensed under the GNU General
Public License version 2.
Reiserfs is a file system based on balanced tree algorithms, which is described
at www.namesys.com.
Source code files that contain the phrase "licensing governed by
reiserfs/README" are "governed files" throughout this file. Governed
files are licensed under the GPL. The portions of them owned by Hans
Reiser, or authorized to be licensed by him, have been in the past,
and likely will be in the future, licensed to other parties under
other licenses. If you add your code to governed files, and don't
want it to be owned by Hans Reiser, put your copyright label on that
code so the poor blight and his customers can keep things straight.
All portions of governed files not labeled otherwise are owned by Hans
Reiser, and by adding your code to it, widely distributing it to
others or sending us a patch, and leaving the sentence in stating that
licensing is governed by the statement in this file, you accept this.
It will be a kindness if you identify whether Hans Reiser is allowed
to license code labeled as owned by you on your behalf other than
under the GPL, because he wants to know if it is okay to do so and put
a check in the mail to you (for non-trivial improvements) when he
makes his next sale. He makes no guarantees as to the amount if any,
though he feels motivated to motivate contributors, and you can surely
discuss this with him before or after contributing. You have the
right to decline to allow him to license your code contribution other
than under the GPL.
[LICENSING]
Further licensing options are available for commercial and/or other
interests directly from Hans Reiser: hans@reiser.to. If you interpret
the GPL as not allowing those additional licensing options, you read
it wrongly, and Richard Stallman agrees with me, when carefully read
you can see that those restrictions on additional terms do not apply
to the owner of the copyright, and my interpretation of this shall
govern for this license.
Finally, nothing in this license shall be interpreted to allow you to
fail to fairly credit me, or to remove my credits, without my
permission, unless you are an end user not redistributing to others.
If you have doubts about how to properly do that, or about what is
fair, ask. (Last I spoke with him Richard was contemplating how best
to address the fair crediting issue in the next GPL version.)
ReiserFSprogs is hereby licensed under the GNU General Public License version 2
but with the following "Anti-Plagiarism" modification: You may not remove any
credits or brand marks, or cause them to not display, unless you are an end
user (that is, you are not redistributing to others). Yes, there really are
people with the nerve to remove credits from software they did not write, or
only wrote a small part of, and they are even frequently occurring sad to say.
Credits are not ads, credits describe someone's contribution to the project
(e.g. labor or money) whereas an ad says something else.
Source code files that contain the phrase "licensing governed by
reiserfsprogs/README" are "governed files" throughout that file. Governed files
are licensed under this license. The portions of them owned by Hans Reiser, or
authorized to be licensed by him, have been in the past, and likely will be in
the future, licensed to other parties under other licenses. If you add your
code to governed files, and don't want it to be owned by Hans Reiser, put your
copyright label on that code so we can keep things straight. It will be a
kindness if you identify whether Hans Reiser is allowed to license code labeled
as owned by you on your behalf other than under this license, because he wants
to know if it is okay to do so and put a check in the mail to you (for
non-trivial improvements) when he makes his next sale. He makes no guarantees
as to the amount if any, though he feels motivated to motivate contributors,
and you can surely discuss this with him before or after contributing. You have
the right to decline to allow him to license your code contribution other than
under this license or the GPL. Further licensing options are available for
commercial and/or other interests directly from reiser@namesys.com<P>
[END LICENSING]
Reiserfs is a file system based on balanced tree algorithms, which is
described at http://www.namesys.com .
Send bug reports to reiserfs-dev@namesys.com.
Stop reading here. Go there, then return.
Send bug reports to yura@namesys.botik.ru.
mkreiserfs and other utilities are in reiserfs/utils, or wherever your
Linux provider put them. There is some disagreement about how useful
it is for users to get their fsck and mkreiserfs out of sync with the
version of reiserfs that is in their kernel, with many important
distributors wanting them out of sync.:-) Please try to remember to
recompile and reinstall fsck and mkreiserfs with every update of
reiserfs, this is a common source of confusion. Note that some of the
utilities cannot be compiled without accessing the balancing code
which is in the kernel code, and relocating the utilities may require
you to specify where that code can be found.
Yes, if you update your reiserfs kernel module you do have to
recompile your kernel, most of the time. The errors you get will be
quite cryptic if your forget to do so.
Real users, as opposed to folks who want to hack and then understand
what went wrong, will want REISERFS_CHECK off.
Hideous Commercial Pitch: Spread your development costs across other OS
vendors. Select from the best in the world, not the best in your
building, by buying from third party OS component suppliers. Leverage
the software component development power of the internet. Be the most
aggressive in taking advantage of the commercial possibilities of
decentralized internet development, and add value through your branded
integration that you sell as an operating system. Let your competitors
be the ones to compete against the entire internet by themselves. Be
hip, get with the new economic trend, before your competitors do. Send
email to hans@reiser.to.
To understand the code, after reading the website, start reading the
code by reading reiserfs_fs.h first.
Hans Reiser was the project initiator, primary architect, source of all
funding for the first 5.5 years, and one of the programmers. He owns
the copyright.
Vladimir Saveljev was one of the programmers, and he worked long hours
writing the cleanest code. He always made the effort to be the best he
could be, and to make his code the best that it could be. What resulted
was quite remarkable. I don't think that money can ever motivate someone
to work the way he did, he is one of the most selfless men I know.
Yura helps with benchmarking, coding hashes, and block pre-allocation
code.
Anatoly Pinchuk is a former member of our team who worked closely with
Vladimir throughout the project's development. He wrote a quite
substantial portion of the total code. He realized that there was a
space problem with packing tails of files for files larger than a node
that start on a node aligned boundary (there are reasons to want to node
align files), and he invented and implemented indirect items and
unformatted nodes as the solution.
Konstantin Shvachko, with the help of the Russian version of a VC,
tried to put me in a position where I was forced into giving control
of the project to him. (Fortunately, as the person paying the money
for all salaries from my dayjob I owned all copyrights, and you can't
really force takeovers of sole proprietorships.) This was something
curious, because he never really understood the value of our project,
why we should do what we do, or why innovation was possible in
general, but he was sure that he ought to be controlling it. Every
innovation had to be forced past him while he was with us. He added
two years to the time required to complete reiserfs, and was a net
loss for me. Mikhail Gilula was a brilliant innovator who also left
in a destructive way that erased the value of his contributions, and
that he was shown much generosity just makes it more painful.
Grigory Zaigralin was an extremely effective system administrator for
our group.
Igor Krasheninnikov was wonderful at hardware procurement, repair, and
network installation.
Jeremy Fitzhardinge wrote the teahash.c code, and he gives credit to a
textbook he got the algorithm from in the code. Note that his analysis
of how we could use the hashing code in making 32 bit NFS cookies work
was probably more important than the actual algorithm. Colin Plumb also
contributed to it.
Chris Mason dived right into our code, and in just a few months produced
the journaling code that dramatically increased the value of ReiserFS.
He is just an amazing programmer.
Igor Zagorovsky is writing much of the new item handler and extent code
for our next major release.
Alexander Zarochentcev (sometimes known as zam, or sasha), wrote the
resizer, and is hard at work on implementing allocate on flush. SGI
implemented allocate on flush before us for XFS, and generously took
the time to convince me we should do it also. They are great people,
and a great company.
Yuri Shevchuk and Nikita Danilov are doing squid cache optimization.
Vitaly Fertman is doing fsck.
SuSE, IntegratedLinux.com, Ecila, MP3.com, bigstorage.com, and the
Alpha PC Company made it possible for me to not have a day job
anymore, and to dramatically increase our staffing. Ecila funded
hypertext feature development, MP3.com funded journaling, SuSE funded
core development, IntegratedLinux.com funded squid web cache
appliances, bigstorage.com funded HSM, and the alpha PC company funded
the alpha port. Many of these tasks were helped by sponsors other
than the ones just named. SuSE has helped in much more than just
funding....
Hideous Commercial Pitch: Spread your development costs across other OS
vendors. Select from the best in the world, not the best in your building, by
buying from third party OS component suppliers. Leverage the software component
development power of the internet. Be the most aggressive in taking advantage
of the commercial possibilities of decentralized internet development, and add
value through your branded integration that you sell as an operating system.
Let your competitors be the ones to compete against the entire internet by
themselves. Be hip, get with the new economic trend, before your competitors
do. Send email to reiser@namesys.com.
To understand the code, after reading the website, start reading the code by
reading reiserfs_fs.h first.
-3
View File
@@ -1,3 +0,0 @@
/*
* Copyright 1996, 1997 Hans Reiser, see reiserfs/README for licensing and copyright details
*/
Vendored
+761 -77
View File
@@ -1,70 +1,255 @@
dnl aclocal.m4 generated automatically by aclocal 1.4-p5
# generated automatically by aclocal 1.7.2 -*- Autoconf -*-
dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
# Do all the work for Automake. -*- Autoconf -*-
# serial 1
# This macro actually does too much some checks are only needed if
# your package does certain things. But this isn't really a big deal.
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# 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, 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# serial 8
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
AC_PREREQ([2.54])
# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow
# the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out. PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition. After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
VERSION=[$2]
AC_SUBST(VERSION)
dnl test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
# test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" &&
test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
ifelse([$3],,
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_REQUIRE([AC_PROG_MAKE_SET])])
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])dnl
AC_SUBST([VERSION], [AC_PACKAGE_VERSION])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
AM_MISSING_PROG(AMTAR, tar)
AM_PROG_INSTALL_SH
AM_PROG_INSTALL_STRIP
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
])
])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[_am_stamp_count=`expr ${_am_stamp_count-0} + 1`
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
# Copyright 2002 Free Software Foundation, Inc.
# 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, 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., 59 Temple Place - Suite 330, Boston, MA
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.7.2])])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright 2001, 2002 Free Software Foundation, Inc.
# 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, 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# serial 2
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# ------------------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
# _AM_SET_OPTIONS(OPTIONS)
# ----------------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
#
# Check to make sure that the build environment is sane.
#
# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
# 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, 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# serial 3
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftestfile
echo timestamp > conftest.file
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
if test "[$]*" = "X"; then
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftestfile`
set X `ls -t $srcdir/configure conftest.file`
fi
if test "[$]*" != "X $srcdir/configure conftestfile" \
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
@@ -74,7 +259,7 @@ if (
alias in your environment])
fi
test "[$]2" = conftestfile
test "$[2]" = conftest.file
)
then
# Ok.
@@ -83,45 +268,544 @@ else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
rm -f conftest*
AC_MSG_RESULT(yes)])
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
# -*- Autoconf -*-
# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
# 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, 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# serial 3
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
if ($2 --version) < /dev/null > /dev/null 2>&1; then
$1=$2
AC_MSG_RESULT(found)
else
$1="$3/missing $2"
AC_MSG_RESULT(missing)
fi
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# Like AC_CONFIG_HEADER, but automatically create stamp file.
AC_DEFUN([AM_CONFIG_HEADER],
[AC_PREREQ([2.12])
AC_CONFIG_HEADER([$1])
dnl When config.status generates a header, we must update the stamp-h file.
dnl This file resides in the same directory as the config header
dnl that is generated. We must strip everything past the first ":",
dnl and everything past the last "/".
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
<<am_indx=1
for am_file in <<$1>>; do
case " <<$>>CONFIG_HEADERS " in
*" <<$>>am_file "*<<)>>
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
;;
esac
am_indx=`expr "<<$>>am_indx" + 1`
done<<>>dnl>>)
changequote([,]))])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it supports --run.
# If it does, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
AC_MSG_WARN([`missing' script is too old or missing])
fi
])
# AM_AUX_DIR_EXPAND
# Copyright 2001 Free Software Foundation, Inc.
# 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, 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is `.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
# Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])
AC_DEFUN([AM_AUX_DIR_EXPAND], [
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
# Copyright 2001 Free Software Foundation, Inc.
# 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, 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"$am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
# AM_PROG_INSTALL_STRIP
# Copyright 2001 Free Software Foundation, Inc.
# 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, 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in `make install-strip', and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# serial 4 -*- Autoconf -*-
# Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
# 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, 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "GCJ", or "OBJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
for depmode in $am_compiler_list; do
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
echo '#include "conftest.h"' > conftest.c
echo 'int i;' > conftest.h
echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
case $depmode in
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
none) break ;;
esac
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this.
if depmode=$depmode \
source=conftest.c object=conftest.o \
depfile=conftest.Po tmpdepfile=conftest.TPo \
$SHELL ./depcomp $depcc -c -o conftest.o conftest.c >/dev/null 2>&1 &&
grep conftest.h conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
AC_DEFUN([AM_SET_DEPDIR],
[rm -f .deps 2>/dev/null
mkdir .deps 2>/dev/null
if test -d .deps; then
DEPDIR=.deps
else
# MS-DOS does not allow filenames that begin with a dot.
DEPDIR=_deps
fi
rmdir .deps 2>/dev/null
AC_SUBST([DEPDIR])
])
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking,
[ --disable-dependency-tracking Speeds up one-time builds
--enable-dependency-tracking Do not reject slow dependency extractors])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
# 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, 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#serial 2
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[for mf in $CONFIG_FILES; do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# So let's grep whole file.
if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
# Extract the definition of DEP_FILES from the Makefile without
# running `make'.
DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
test -z "$DEPDIR" && continue
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n -e '/^U = / s///p' < "$mf"`
test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
# We invoke sed twice because it is the simplest approach to
# changing $(DEPDIR) to its actual value in the expansion.
for file in `sed -n -e '
/^DEP_FILES = .*\\\\$/ {
s/^DEP_FILES = //
:loop
s/\\\\$//
p
n
/\\\\$/ b loop
p
}
/^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each `.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002 Free Software Foundation, Inc.
# 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, 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# serial 2
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
doit:
@echo done
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# We grep out `Entering directory' and `Leaving directory'
# messages which can occur if `w' ends up in MAKEFLAGS.
# In particular we don't look at `^make:' because GNU make might
# be invoked under some other name (usually "gmake"), in which
# case it prints its new name instead of `make'.
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
am__include=include
am__quote=
_am_result=GNU
fi
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
am__include=.include
am__quote="\""
_am_result=BSD
fi
fi
AC_SUBST(am__include)
AC_SUBST(am__quote)
AC_MSG_RESULT($_am_result)
rm -f confinc confmf
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
# 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, 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# serial 5
AC_PREREQ(2.52)
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])
AC_SUBST([$1_FALSE])
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.])
fi])])
# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*-
# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
# 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, 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
AC_PREREQ([2.52])
# serial 6
# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
Vendored
+2977 -1427
View File
File diff suppressed because it is too large. Load diff
+86 -2
View File
@@ -1,7 +1,7 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(version.h)
AM_INIT_AUTOMAKE(reiserfsprogs, 3.6.4)
AM_INIT_AUTOMAKE(reiserfsprogs, 3.6.9)
dnl We install in /sbin, the utils are to be available on boot
dnl AC_PREFIX(/)
@@ -50,4 +50,88 @@ AC_ARG_ENABLE(io-failure-emulation,
fi
])
AC_OUTPUT(include/Makefile mkreiserfs/Makefile resize_reiserfs/Makefile fsck/Makefile lib/Makefile Makefile reiserfscore/Makefile debugreiserfs/Makefile tune/Makefile)
AC_DEFUN(AC_PREPARE_CREDITS,
[
AC_MSG_CHECKING(for CREDITS)
AC_TRY_RUN([
#define _GNU_SOURSE
#include <stdio.h>
#include <errno.h>
#include <string.h>
int main (void) {
FILE *fin, *fout;
char *line = NULL;
unsigned int len = 0;
int start, count;
if ((fin = fopen("CREDITS", "r")) == NULL) {
fprintf(stderr, "Error occured while openning the file 'CREDITS': "
"%s.\n", strerror(errno));
return 1;
}
if ((fout = fopen("include/credits.h", "w")) == NULL) {
fprintf(stderr, "Error occured while openning the file 'credits.h': "
"%s.\n", strerror(errno));
return 1;
}
/* Replicate the header. */
while (getline(&line, &len, fin) != -1) {
fprintf(fout, line);
if (!strcmp(line, "\n"))
break;
}
fprintf(fout, "char *credits[] = {\n");
start = 2; count = 0;
while (getline(&line, &len, fin) != -1) {
if (!strcmp(line, "\n") || strlen(line) < 1) {
start = 1;
count++;
} else {
if (!start)
fprintf(fout, "\t\\\" "\n");
else if (start == 1)
fprintf(fout, ",\n\n");
line[strlen(line) - 1] = 0;
fprintf(fout, "\t\"%s\\\n\"", line);
start = 0;
}
}
fprintf(fout, "\n};\n");
fprintf(fout, "#define CREDITS_COUNT %d\n", count);
free(line);
fclose(fin);
fclose(fout);
return 0;
}
], AC_MSG_RESULT(yes), AC_MSG_RESULT(no) ; exit)
])
AC_PREPARE_CREDITS()
AC_OUTPUT(
include/Makefile
mkreiserfs/Makefile
resize_reiserfs/Makefile
fsck/Makefile
lib/Makefile
Makefile
reiserfscore/Makefile
debugreiserfs/Makefile
tune/Makefile
tests/Makefile
tests/PROGS/Makefile)
+1 -1
View File
@@ -1,6 +1,6 @@
sbin_PROGRAMS = debugreiserfs unpack
debugreiserfs_SOURCES = debugreiserfs.c pack.c stat.c corruption.c scan.c recover.c journal.c
debugreiserfs_SOURCES = debugreiserfs.c pack.c stat.c corruption.c scan.c recover.c
unpack_SOURCES = unpack.c pack.c debugreiserfs.h
man_MANS = debugreiserfs.8
EXTRA_DIST = $(man_MANS)
+315 -215
View File
@@ -1,6 +1,8 @@
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -10,174 +12,233 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
sbin_PROGRAMS = debugreiserfs unpack
debugreiserfs_SOURCES = debugreiserfs.c pack.c stat.c corruption.c scan.c recover.c journal.c
debugreiserfs_SOURCES = debugreiserfs.c pack.c stat.c corruption.c scan.c recover.c
unpack_SOURCES = unpack.c pack.c debugreiserfs.h
man_MANS = debugreiserfs.8
EXTRA_DIST = $(man_MANS)
LDADD = $(top_srcdir)/lib/libmisc.a $(top_srcdir)/reiserfscore/libcore.a
subdir = debugreiserfs
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../include/config.h
CONFIG_CLEAN_FILES =
PROGRAMS = $(sbin_PROGRAMS)
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
sbin_PROGRAMS = debugreiserfs$(EXEEXT) unpack$(EXEEXT)
PROGRAMS = $(sbin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir) -I../include
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
debugreiserfs_OBJECTS = debugreiserfs.o pack.o stat.o corruption.o \
scan.o recover.o journal.o
am_debugreiserfs_OBJECTS = debugreiserfs.$(OBJEXT) pack.$(OBJEXT) \
stat.$(OBJEXT) corruption.$(OBJEXT) scan.$(OBJEXT) \
recover.$(OBJEXT)
debugreiserfs_OBJECTS = $(am_debugreiserfs_OBJECTS)
debugreiserfs_LDADD = $(LDADD)
debugreiserfs_DEPENDENCIES = $(top_srcdir)/lib/libmisc.a \
$(top_srcdir)/reiserfscore/libcore.a
debugreiserfs_LDFLAGS =
unpack_OBJECTS = unpack.o pack.o
debugreiserfs_DEPENDENCIES = $(top_srcdir)/lib/libmisc.a \
$(top_srcdir)/reiserfscore/libcore.a
debugreiserfs_LDFLAGS =
am_unpack_OBJECTS = unpack.$(OBJEXT) pack.$(OBJEXT)
unpack_OBJECTS = $(am_unpack_OBJECTS)
unpack_LDADD = $(LDADD)
unpack_DEPENDENCIES = $(top_srcdir)/lib/libmisc.a \
$(top_srcdir)/reiserfscore/libcore.a
unpack_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
unpack_DEPENDENCIES = $(top_srcdir)/lib/libmisc.a \
$(top_srcdir)/reiserfscore/libcore.a
unpack_LDFLAGS =
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/corruption.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/debugreiserfs.Po ./$(DEPDIR)/pack.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/recover.Po ./$(DEPDIR)/scan.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/stat.Po ./$(DEPDIR)/unpack.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
man8dir = $(mandir)/man8
MANS = $(man_MANS)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(debugreiserfs_SOURCES) $(unpack_SOURCES)
NROFF = nroff
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
MANS = $(man_MANS)
DIST_COMMON = Makefile.am Makefile.in
SOURCES = $(debugreiserfs_SOURCES) $(unpack_SOURCES)
OBJECTS = $(debugreiserfs_OBJECTS) $(unpack_OBJECTS)
all: all-redirect
all: all-am
.SUFFIXES:
.SUFFIXES: .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps debugreiserfs/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-sbinPROGRAMS:
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
distclean-sbinPROGRAMS:
maintainer-clean-sbinPROGRAMS:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu debugreiserfs/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
install-sbinPROGRAMS: $(sbin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(sbindir)
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f"; \
$(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f || exit 1; \
else :; fi; \
done
uninstall-sbinPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(sbin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f $(DESTDIR)$(sbindir)/$$f"; \
rm -f $(DESTDIR)$(sbindir)/$$f; \
done
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
debugreiserfs$(EXEEXT): $(debugreiserfs_OBJECTS) $(debugreiserfs_DEPENDENCIES)
@rm -f debugreiserfs$(EXEEXT)
$(LINK) $(debugreiserfs_LDFLAGS) $(debugreiserfs_OBJECTS) $(debugreiserfs_LDADD) $(LIBS)
unpack$(EXEEXT): $(unpack_OBJECTS) $(unpack_DEPENDENCIES)
@rm -f unpack$(EXEEXT)
$(LINK) $(unpack_LDFLAGS) $(unpack_OBJECTS) $(unpack_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
-rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/corruption.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debugreiserfs.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pack.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/recover.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unpack.Po@am__quote@
debugreiserfs: $(debugreiserfs_OBJECTS) $(debugreiserfs_DEPENDENCIES)
@rm -f debugreiserfs
$(LINK) $(debugreiserfs_LDFLAGS) $(debugreiserfs_OBJECTS) $(debugreiserfs_LDADD) $(LIBS)
distclean-depend:
-rm -rf ./$(DEPDIR)
unpack: $(unpack_OBJECTS) $(unpack_DEPENDENCIES)
@rm -f unpack
$(LINK) $(unpack_LDFLAGS) $(unpack_OBJECTS) $(unpack_LDADD) $(LIBS)
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
install-man8:
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am:
man8dir = $(mandir)/man8
install-man8: $(man8_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(man8dir)
@list='$(man8_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.8*) list="$$list $$i" ;; \
esac; \
@@ -186,173 +247,212 @@ install-man8:
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
8*) ;; \
*) ext='8' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \
done
uninstall-man8:
@list='$(man8_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
@$(NORMAL_UNINSTALL)
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.8*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
8*) ;; \
*) ext='8' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \
rm -f $(DESTDIR)$(man8dir)/$$inst; \
done
install-man: $(MANS)
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-man8
uninstall-man:
@$(NORMAL_UNINSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-man8
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
mkid -fID $$unique
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
mostlyclean-tags:
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
clean-tags:
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = debugreiserfs
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
corruption.o: corruption.c debugreiserfs.h ../include/io.h \
../include/misc.h ../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h ../include/config.h ../version.h
debugreiserfs.o: debugreiserfs.c debugreiserfs.h ../include/io.h \
../include/misc.h ../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h ../include/config.h ../version.h
journal.o: journal.c debugreiserfs.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h ../include/config.h ../version.h
pack.o: pack.c debugreiserfs.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h ../include/config.h ../version.h
recover.o: recover.c debugreiserfs.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h ../include/config.h ../version.h
scan.o: scan.c debugreiserfs.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h ../include/config.h ../version.h
stat.o: stat.c debugreiserfs.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h ../include/config.h ../version.h
unpack.o: unpack.c debugreiserfs.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h ../include/config.h ../version.h
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-sbinPROGRAMS
install-exec: install-exec-am
all-am: Makefile $(PROGRAMS) $(MANS)
install-data-am: install-man
installdirs:
$(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-sbinPROGRAMS uninstall-man
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS) $(MANS)
all-redirect: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-sbinPROGRAMS mostlyclean-compile \
mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-sbinPROGRAMS clean-compile clean-tags clean-generic \
mostlyclean-am
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
distclean-am: distclean-sbinPROGRAMS distclean-compile distclean-tags \
distclean-generic clean-am
clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-sbinPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am: install-man
install-exec-am: install-sbinPROGRAMS
install-info: install-info-am
install-man: install-man8
installcheck-am:
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS \
clean-sbinPROGRAMS maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \
install-sbinPROGRAMS mostlyclean-compile distclean-compile \
clean-compile maintainer-clean-compile install-man8 uninstall-man8 \
install-man uninstall-man tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
check-am installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-man uninstall-sbinPROGRAMS
uninstall-man: uninstall-man8
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-sbinPROGRAMS ctags distclean distclean-compile \
distclean-depend distclean-generic distclean-tags distdir dvi \
dvi-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-man8 install-sbinPROGRAMS \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am uninstall-man \
uninstall-man8 uninstall-sbinPROGRAMS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
+1097 -277
View File
File diff suppressed because it is too large. Load diff
+4 -4
View File
@@ -1,7 +1,7 @@
.\" -*- nroff -*-
.\" Copyright 1996-2002 Hans Reiser.
.\" Copyright 1996-2003 Hans Reiser.
.\"
.TH DEBUGREISERFS 8 "January 2002" "Reiserfsprogs 3.6.4"
.TH DEBUGREISERFS 8 "April 2003" "Reiserfsprogs 3.6.9"
.SH NAME
debugreiserfs
.SH SYNOPSIS
@@ -20,7 +20,7 @@ debugreiserfs
.I device
.SH DESCRIPTION
It helps sometimes to solve problems with reiserfs filesystems. Being
called w/o options it prints super block of reiserfs filesystem found
called without options it prints super block of reiserfs filesystem found
on the \fIdevice\fR.
.TP
.I device
@@ -76,7 +76,7 @@ Suppress showing speed of progress when
.\" -s or
-p is in use
.SH AUTHOR
This version of \fBdebugreiserfs\fR has been written by Hans Reiser <reiser@idiom.com>.
This version of \fBdebugreiserfs\fR has been written by Hans Reiser <reiser@namesys.com>.
.SH BUGS
There are probably few of them. Please, report bugs to ReiserFS mail-list <reiserfs-list@namesys.com>.
.SH SEE ALSO
File diff suppressed because it is too large. Load diff
+38 -15
View File
@@ -1,5 +1,6 @@
/*
* Copyright 2000-2002 by Hans Reiser, licensing governed by reiserfs/README
* Copyright 2000-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#define _GNU_SOURCE
@@ -30,17 +31,21 @@ extern reiserfs_filsys_t * fs;
*/
#define DO_DUMP 1 /* not a real dump, just printing to stdout contents of
tree nodes */
#define DO_CORRUPT 2 /* used to make filesystem corruption and then test fsck */
#define DO_SCAN 3
#define DO_RECOVER 4
#define DO_TEST 6
#define DO_PACK 7 /* -p extract meta data of reiserfs filesystem */
#define DO_STAT 8
#define DO_SCAN_FOR_NAME 9 /* -n */
#define DO_LOOK_FOR_NAME 10 /* -N */
#define DO_SCAN_JOURNAL 11 /* -J */
#define DO_EXTRACT_BADBLOCKS 12
#define DO_FILE_MAP 13
#define DO_CORRUPT_ONE 2 /* used to make filesystem corruption and then test fsck */
#define DO_CORRUPT_FILE 3 /* used to make filesystem corruption and then test fsck, the list of corruption is set on the file */
#define DO_RANDOM_CORRUPTION 4
#define DO_SCAN 5
#define DO_RECOVER 6
#define DO_TEST 7
#define DO_PACK 8 /* -p extract meta data of reiserfs filesystem */
#define DO_STAT 9
#define DO_SCAN_FOR_NAME 10 /* -n */
#define DO_LOOK_FOR_NAME 11 /* -N */
#define DO_SCAN_JOURNAL 12 /* -J */
#define DO_EXTRACT_BADBLOCKS 13
#define DO_FILE_MAP 14
#define DO_ZERO_BITMAP 15
/*first bits are in reiserfs_fs.b*/
@@ -210,13 +215,13 @@ sent_bytes += 8;\
struct debugreiserfs_data {
int mode; /* DO_DUMP | DO_PACK | DO_CORRUPT... */
int mode; /* DO_DUMP | DO_PACK | DO_CORRUPT_ONE... */
#define USED_BLOCKS 1
#define EXTERN_BITMAP 2
#define ALL_BLOCKS 3
#define UNUSED_BLOCKS 4
int scan_area; /* for -p, -s and -n */
int scan_area; /* for -p, -s and -n */
char * input_bitmap; /* when ->scan_area is set to EXTERN_BITMAP */
reiserfs_bitmap_t * bitmap; /* bitmap is read from ->input_bitmap */
unsigned long block; /* set by -B. this is a must for -C, option for -p and -d */
@@ -228,6 +233,10 @@ struct debugreiserfs_data {
unsigned long options; /* -q only yet*/
int JJ;
/* log file name and handle */
char * log_file_name;
FILE * log ;
};
#define data(fs) ((struct debugreiserfs_data *)((fs)->fs_vp))
@@ -249,7 +258,10 @@ struct debugreiserfs_data {
void do_stat (reiserfs_filsys_t * fs);
/* corruption.c */
void do_corrupt_one_block (reiserfs_filsys_t * fs);
void do_corrupt_one_block (reiserfs_filsys_t * fs, char * fline);
void do_leaves_corruption (reiserfs_filsys_t * fs, unsigned long nr_leaves_cr);
void do_bitmap_corruption (reiserfs_filsys_t * fs);
void do_fs_random_corrupt (reiserfs_filsys_t * fs);
/* recover.c */
void do_recover (reiserfs_filsys_t * fs);
@@ -269,4 +281,15 @@ struct saved_item {
struct saved_item * si_next; /* list of items having the same key */
};
/*
Local variables:
c-indentation-style: "K&R"
mode-name: "LC"
c-basic-offset: 4
tab-width: 4
fill-column: 80
End:
*/
-196
View File
@@ -1,196 +0,0 @@
/*
* Copyright 2002 Hans Reiser
*/
#include "debugreiserfs.h"
extern unsigned long * badblocks;
extern int badblocks_nr;
#if 0
static void look_in_transaction (reiserfs_filsys_t * fs,
reiserfs_trans_t * trans)
{
struct buffer_head * d_bh, * c_bh, * logged, * in_place;
struct reiserfs_journal_desc * desc;
struct reiserfs_journal_commit * commit;
int i, j;
int who;
d_bh = bread (fs->fs_dev, trans->desc_blocknr, fs->fs_blocksize);
if (!d_bh) {
reiserfs_warning (stdout, "reading descriptor block %lu failed\n",
trans->desc_blocknr);
return;
}
c_bh = bread (fs->fs_dev, trans->commit_blocknr, fs->fs_blocksize);
if (!c_bh) {
reiserfs_warning (stdout, "reading commit block %lu failed\n",
trans->commit_blocknr);
brelse (d_bh);
return;
}
// desc = (struct reiserfs_journal_desc *)(d_bh->b_data);
// commit = (struct reiserfs_journal_commit *)(c_bh->b_data);
reiserfs_warning (stdout, "Transaction %lu\n", trans->trans_id);
for (i = 0; i < badblocks_nr; i ++) {
for (j = 0; j < get_jd_len (d_bh); j ++) {
if ((j < JOURNAL_TRANS_HALF && badblocks [i] == le32_to_cpu (desc->j2_realblock[j])) ||
(j >= JOURNAL_TRANS_HALF && badblocks [i] == le32_to_cpu (commit->j3_realblock[j - JOURNAL_TRANS_HALF]))) {
reiserfs_warning (stdout,
"\tblock %lu is logged in it (block of journal area %lu - ",
badblocks [i], d_bh->b_blocknr + j + 1);
logged = 0;
in_place = 0;
logged = bread (fs->fs_dev, d_bh->b_blocknr + j + 1, fs->fs_blocksize);
in_place = bread (fs->fs_dev, badblocks [i], fs->fs_blocksize);
if (!logged || !in_place) {
reiserfs_warning (stdout, "Could not read blocks\n");
brelse (logged);
brelse (in_place);
continue;
}
who = who_is_this (logged->b_data, logged->b_size);
if (who != THE_LEAF && who != HAS_IH_ARRAY) {
brelse (logged);
brelse (in_place);
continue;
}
reiserfs_warning (stdout, "%s\n", which_block (who));
if (data (fs)->JJ > 1) {
/* overwrite in-place block with a logged version */
if (who_is_this (in_place->b_data, in_place->b_size) == THE_LEAF)
reiserfs_warning (stderr, "Block %d is leaf already, skip it\n",
in_place->b_blocknr);
else {
memcpy (in_place->b_data, logged->b_data, fs->fs_blocksize);
mark_buffer_dirty (in_place);
bwrite (in_place);
if (input_bitmap (fs))
reiserfs_bitmap_set_bit (input_bitmap (fs), in_place->b_blocknr);
}
}
brelse (logged);
brelse (in_place);
}
}
}
brelse (d_bh);
brelse (c_bh);
}
/* go through all transactions in the journal to check whether block is there */
static void find_in_journal (reiserfs_filsys_t * fs)
{
for_each_transaction (fs, look_in_transaction);
}
#endif
#define BLOCK_IN_Q 12762
static void check_block_9555 (reiserfs_filsys_t * fs, reiserfs_trans_t * trans,
int index,
unsigned long in_journal, unsigned long in_place)
{
struct buffer_head * bh;
if (in_place == 17) {
/* read block of journal which contains block 17 abd check whether bit
BLOCK_IN_Q is set */
bh = bread (fs->fs_journal_dev, in_journal, fs->fs_blocksize);
if (!bh) {
reiserfs_warning (stderr, "could not read block %lu (of journal area)\n",
in_journal);
return;
}
if (test_bit (BLOCK_IN_Q, bh->b_data))
reiserfs_warning (stdout, "trans %lu, pos %d - block 17: block %d is marked used in it\n",
trans->trans_id, index, BLOCK_IN_Q);
else
reiserfs_warning (stdout, "trans %lu, pos %d - block 17: block %d is marked free in it\n",
trans->trans_id, index, BLOCK_IN_Q);
brelse (bh);
}
if (in_place == BLOCK_IN_Q) {
reiserfs_warning (stdout, "trans %lu, block %d is logged at pos %d\n",
trans->trans_id, BLOCK_IN_Q, index);
}
}
/* remove when the problem is found */
static void check_transaction (reiserfs_filsys_t * fs, reiserfs_trans_t * trans)
{
for_each_block (fs, trans, check_block_9555);
}
void scan_journal (reiserfs_filsys_t * fs)
{
for_each_transaction (fs, check_transaction);
}
#if 0
/* read block numbers from stdin, look for them in the journal, and (if -JJ is
given) write then "in-place" amd mark overwritten blocks used in the bitmap
specified with -b */
void scan_journal (reiserfs_filsys_t * fs)
{
char * str = 0;
size_t n = 0;
/* store all blocks which come from stdin */
while (1) {
if (getline (&str, &n, stdin) == -1)
break;
if (!strcmp (str, "\n"))
break;
str [strlen (str) - 1] = 0;
badblocks = realloc (badblocks, (badblocks_nr + 1) * 4);
if (!badblocks)
reiserfs_panic ("realloc failed");
badblocks [badblocks_nr ++] = atol (str);
free (str);
str = 0;
n = 0;
}
if (data (fs)->JJ > 1)
reiserfs_reopen (fs, O_RDWR);
reiserfs_warning (stdout, "%d blocks given\n", badblocks_nr); fflush (stdout);
find_in_journal (fs);
if (data (fs)->JJ > 1 && input_bitmap (fs)) {
FILE * fp;
fp = fopen (input_bitmap_file_name (fs), "w+");
if (!fp) {
reiserfs_warning (stderr, "reiserfs_bitmap_save: could not save bitmap in %s: %m",
input_bitmap_file_name (fs));
return;
}
reiserfs_bitmap_save (fp, input_bitmap (fs));
fclose (fp);
}
}
#endif
+10 -97
View File
@@ -1,6 +1,6 @@
/*
* Copyright 2000-2002 by Hans Reiser, licensing governed by reiserfs/README
* Copyright 2000-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "debugreiserfs.h"
@@ -147,7 +147,7 @@ static int should_pack_indirect (__u32 * ind_item, int unfm_num)
static void pack_indirect (struct packed_item * pi, struct buffer_head * bh,
struct item_head * ih)
{
int i;
unsigned int i;
__u32 * ind_item;
__u16 len;
@@ -305,14 +305,14 @@ static void pack_stat_data (struct packed_item * pi, struct buffer_head * bh,
set_pi_mask (pi, get_pi_mask (pi) | NLINK_BITS_32);
nlink32 = sd->sd_nlink;
} else {
/* This is required to deal w/ big endian systems */
/* This is required to deal with big endian systems */
nlink16 = cpu_to_le16 ((__u16)sd_v2_nlink (sd));
}
if (sd_v2_size (sd) > 0xffffffff) {
set_pi_mask (pi, get_pi_mask (pi) | SIZE_BITS_64);
size64 = sd->sd_size;
} else {
/* This is required to deal w/ big endian systems */
/* This is required to deal with big endian systems */
size32 = cpu_to_le32 ((__u32)sd_v2_size (sd));
}
@@ -561,11 +561,11 @@ static void send_block (reiserfs_filsys_t * fs, struct buffer_head * bh, int sen
/* super block, journal, bitmaps */
static void pack_frozen_data (reiserfs_filsys_t * fs)
{
int i;
struct buffer_head * bh;
unsigned long block;
__u16 magic16;
int sent_journal_start_magic = 0;
unsigned int i;
if (is_reiserfs_jr_magic_string(fs->fs_ondisk_sb) &&
get_jp_journal_dev(sb_jp(fs->fs_ondisk_sb)) &&
@@ -646,12 +646,12 @@ static void pack_frozen_data (reiserfs_filsys_t * fs)
/* pack all "not data blocks" and correct leaf */
void pack_partition (reiserfs_filsys_t * fs)
{
int i;
struct buffer_head * bh;
__u32 magic32;
__u16 blocksize;
__u16 magic16;
unsigned long done = 0, total;
unsigned int i;
magic32 = REISERFS_SUPER_MAGIC;
@@ -724,6 +724,9 @@ void pack_one_block (reiserfs_filsys_t * fs, unsigned long block)
bh = bread (fs->fs_dev, block, fs->fs_blocksize);
if (!bh)
return;
if (who_is_this (bh->b_data, bh->b_size) == THE_LEAF)
pack_leaf (fs, bh);
else
@@ -738,93 +741,3 @@ void pack_one_block (reiserfs_filsys_t * fs, unsigned long block)
fprintf (stderr, "Done\n");
}
#if 0
//
// this test program has two modes: 'pack file blocknr'
// and 'unpack file'
// in the first mode blocknr-th 4k block of the 'file' will be packed out to stdout
// the the second mode standard input will be converted to the reiserfs leaf on 'file'
//
static int do_unpack (char * file)
{
char * buf;
int fd;
fd = open (file, O_RDONLY);
if (fd == -1) {
perror ("open failed");
return 0;
}
buf = malloc (4096);
if (!buf) {
perror ("malloc failed");
return 0;
}
fread (buf, 4096, 1, stdin);
if (!feof (stdin)) {
printf ("fread returned not eof\n");
return 0;
}
unpack_leaf (buf, fd);
free (buf);
close (fd);
return 0;
}
static int do_pack (char * file, unsigned long block)
{
int fd;
struct buffer_head * bh;
char * buf;
int len;
fprintf (stderr, "dumping block %d of the \"%s\"\n", block, file);
fd = open (file, O_RDONLY);
if (fd == -1) {
perror ("open failed");
return 0;
}
bh = bread (fd, block, 4096);
if (!bh) {
fprintf (stderr, "bread failed\n");
return 0;
}
if (who_is_this (bh->b_data, bh->b_size) != THE_LEAF) {
fprintf (stderr, "block %d is not a leaf\n", block);
return 0;
}
len = pack_leaf (bh, buf);
fwrite (buf, len, 1, stdout);
free (buf);
close (fd);
return 0;
}
int main (int argc, char ** argv)
{
if (argc == 3 && !strcmp (argv[1], "unpack"))
return do_unpack (argv[2]);
if (argc == 4 && !strcmp (argv[1], "pack"))
return do_pack (argv[2], atoi (argv[3]));
fprintf (stderr, "Usage: \n\t%s pack filename block\nor\n"
"\t%s unpack filename\n", argv[0], argv[0]);
return 0;
}
#endif /* 0 */
+5 -3
View File
@@ -1,5 +1,6 @@
/*
* Copyright 2000-2002 by Hans Reiser, licensing governed by reiserfs/README
* Copyright 2000-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "debugreiserfs.h"
@@ -264,7 +265,8 @@ static void recover_items(FILE *fp, reiserfs_filsys_t * fs, FILE *target_file) {
int size = sizeof(struct saved_item) - sizeof(struct saved_item *);
struct saved_item *map = NULL;
__u32 map_size = 0;
int i, start = 0, j;
int start = 0;
unsigned int i, j;
__u64 offset = 0, length;
long int result = 0;
unsigned long unfm_ptr;
@@ -285,7 +287,7 @@ static void recover_items(FILE *fp, reiserfs_filsys_t * fs, FILE *target_file) {
if (i == map_size / sizeof(struct saved_item)) {
if (start != -1) {
reiserfs_print_item(stdout, bh, B_N_PITEM_HEAD (bh, (cur - 1)->si_item_num));
result = get_answer((long int)i - start) + start;
result = get_answer(i - start) + start;
} else {
result = i - 1;
}
+41 -38
View File
@@ -1,5 +1,6 @@
/*
* Copyright 2000-2002 by Hans Reiser, licensing governed by reiserfs/README
* Copyright 2000-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "debugreiserfs.h"
@@ -169,7 +170,7 @@ static void add_name (struct saved_name * name, struct saved_name * name_in)
/* take each name matching to a given pattern, */
static void scan_for_name (struct buffer_head * bh)
{
int i, j;
int i, j, i_num;
struct item_head * ih;
struct reiserfs_de_head * deh;
int namelen;
@@ -181,7 +182,8 @@ static void scan_for_name (struct buffer_head * bh)
int ih_entry_count = 0;
ih = B_N_PITEM_HEAD (bh, 0);
for (i = 0; i < B_NR_ITEMS (bh); i ++, ih ++) {
i_num = leaf_item_number_estimate(bh);
for (i = 0; i < i_num; i ++, ih ++) {
if (!is_direntry_ih (ih))
continue;
if (is_it_bad_item (fs, ih, B_I_PITEM (bh, ih), 0, 1))
@@ -254,14 +256,15 @@ static void scan_for_name (struct buffer_head * bh)
item in the sorted list of items of a file */
static void scan_items (struct buffer_head * bh)
{
int i;
int i, i_num;
struct item_head * ih;
struct saved_name * name_in_store;
void * res;
ih = B_N_PITEM_HEAD (bh, 0);
for (i = 0; i < B_NR_ITEMS (bh); i ++, ih ++) {
i_num = leaf_item_number_estimate(bh);
for (i = 0; i < i_num; i ++, ih ++) {
res = tfind (&ih->ih_key, &key_index, comp_pointed);
if (!res)
/* there were no names pointing to this key */
@@ -340,7 +343,7 @@ static void do_append (struct item_head * ih, void * data)
{
int i;
int padd;
loff_t off = get_offset (&ih->ih_key);
unsigned long long off = get_offset (&ih->ih_key);
if (is_indirect_ih (ih)) {
@@ -354,8 +357,7 @@ static void do_append (struct item_head * ih, void * data)
map.head_len += (padd + I_UNFM_NUM (ih));
} else if (is_direct_ih (ih)) {
int tail_start;
int skip;
unsigned int tail_start, skip;
// find correct tail first
tail_start = (off & ~(fs->fs_blocksize - 1)) + 1;
@@ -391,18 +393,18 @@ static void do_append (struct item_head * ih, void * data)
// map contains
static void do_overwrite (struct item_head * ih, void * data)
{
int skip; // now may bytes/pointers to skip
int to_compare;
int to_append;
loff_t off = get_offset (&ih->ih_key);
char * p;
unsigned long long off, skip;
int to_compare, to_append;
struct item_head tmp_ih;
char * p;
off = get_offset (&ih->ih_key);
if (is_indirect_ih (ih)) {
skip = (off - 1) / fs->fs_blocksize;
to_compare = (map.head_len - skip > I_UNFM_NUM (ih)) ? I_UNFM_NUM (ih) :
(map.head_len - skip);
to_compare = (map.head_len - skip > I_UNFM_NUM (ih)) ?
I_UNFM_NUM (ih) : (map.head_len - skip);
to_append = I_UNFM_NUM (ih) - to_compare;
p = (char *)map.head + skip * 4;
@@ -418,7 +420,7 @@ static void do_overwrite (struct item_head * ih, void * data)
}
} else if (is_direct_ih (ih)) {
int tail_start;
unsigned int tail_start;
int i;
// find correct tail first
@@ -652,12 +654,16 @@ void print_map(reiserfs_filsys_t * fs) {
print_items(fp, fs);
if (fp != stdin)
if (fp != stdin) {
fclose (fp);
fp = NULL;
}
}
static FILE *fp = 0;
FILE * log_to;
static void save_items(const void *nodep, VISIT value, int level) {
struct saved_item *item;
@@ -683,7 +689,7 @@ static void make_map(const void *nodep, VISIT value, int level) {
if (value == leaf || value == postorder) {
while (name) {
asprintf(&file_name, "%s.%d", map_file(fs), ++nr);
reiserfs_warning (stdout, "%d - (%d): [%K]:\"%s\": stored in the %s\n",
reiserfs_warning (log_to, "%d - (%d): [%K]:\"%s\": stored in the %s\n",
nr, name->count, &name->parent_dirid, name->name, file_name);
if (fp == 0) {
@@ -697,6 +703,7 @@ static void make_map(const void *nodep, VISIT value, int level) {
name = name->name_next;
fclose(fp);
fp = NULL;
free(file_name);
}
}
@@ -800,25 +807,23 @@ static void look_for_name (reiserfs_filsys_t * fs)
}
}
FILE * log;
static void scan_for_key (struct buffer_head * bh, struct key * key)
{
int i, j;
int i, j, i_num;
struct item_head * ih;
struct reiserfs_de_head * deh;
int min_entry_size = 1;
int ih_entry_count = 0;
ih = B_N_PITEM_HEAD (bh, 0);
for (i = 0; i < B_NR_ITEMS (bh); i ++, ih ++) {
if ((get_key_dirid (&ih->ih_key) == get_key_dirid (key) ||
(int)get_key_dirid (key) == -1) &&
(get_key_objectid (&ih->ih_key) == get_key_objectid (key) ||
(int)get_key_objectid (key) == -1)) {
reiserfs_warning (log, "%d-th item of block %lu is item of file %K: %H\n",
i_num = leaf_item_number_estimate(bh);
for (i = 0; i < i_num; i ++, ih ++) {
if ((get_key_dirid(&ih->ih_key) == get_key_dirid(key) ||
get_key_dirid(key) == ~0ul) &&
(get_key_objectid(&ih->ih_key) == get_key_objectid(key) ||
get_key_objectid(key) == ~0ul))
{
reiserfs_warning(log_to, "%d-th item of block %lu is item of file %K: %H\n",
i, bh->b_blocknr, key, ih);
}
if (!is_direntry_ih (ih))
@@ -835,7 +840,7 @@ static void scan_for_key (struct buffer_head * bh, struct key * key)
for (j = 0; j < ih_entry_count; j ++, deh ++) {
if ((get_deh_dirid (deh) == get_key_dirid (key) || (int)get_key_dirid (key) == -1) &&
(get_deh_objectid (deh) == get_key_objectid (key) || (int)get_key_objectid (key) == -1)) {
reiserfs_warning (log, "dir item %d (%H) of block %lu has "
reiserfs_warning (log_to, "dir item %d (%H) of block %lu has "
"entry (%d-th) %.*s pointing to %K\n",
i, ih, bh->b_blocknr, j,
name_in_entry_length (ih, deh, j), name_in_entry (deh, j), key);
@@ -857,12 +862,6 @@ void do_scan (reiserfs_filsys_t * fs)
struct key key = {0, 0, };
unsigned long done, total;
if (debug_mode (fs) == DO_SCAN_JOURNAL) {
scan_journal (fs);
return;
}
if (debug_mode (fs) == DO_LOOK_FOR_NAME) {
/* look for a file in using tree algorithms */
look_for_name (fs);
@@ -879,7 +878,7 @@ void do_scan (reiserfs_filsys_t * fs)
total = reiserfs_bitmap_ones (input_bitmap (fs));
log = fopen ("scan.log", "w+");
log_to = fopen ("scan.log", "w+");
printf ("Log file 'scan.log' is opened\n");
if (debug_mode (fs) == DO_SCAN_FOR_NAME) {
@@ -928,6 +927,7 @@ void do_scan (reiserfs_filsys_t * fs)
reiserfs_bitmap_clear_bit (input_bitmap (fs), i);
break;
case THE_LEAF:
case HAS_IH_ARRAY:
if (debug_mode (fs) == DO_SCAN_FOR_NAME) {
scan_for_name (bh);
} else if (get_key_dirid (&key)) {
@@ -959,6 +959,8 @@ void do_scan (reiserfs_filsys_t * fs)
total = reiserfs_bitmap_ones (input_bitmap (fs));
printf ("%ld bits set in bitmap\n", total);
for (i = 0; i < get_sb_block_count (fs->fs_ondisk_sb); i ++) {
int type;
if (!reiserfs_bitmap_test_bit (input_bitmap (fs), i))
continue;
bh = bread (fs->fs_dev, i, fs->fs_blocksize);
@@ -966,7 +968,8 @@ void do_scan (reiserfs_filsys_t * fs)
printf ("could not read block %lu\n", i);
continue;
}
if (who_is_this (bh->b_data, bh->b_size) != THE_LEAF) {
type = who_is_this (bh->b_data, bh->b_size);
if (type != THE_LEAF && type != HAS_IH_ARRAY) {
brelse (bh);
continue;
}
+7 -9
View File
@@ -1,5 +1,6 @@
/*
* Copyright 2002 by Hans Reiser, licensing governed by reiserfs/README
* Copyright 2002-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "debugreiserfs.h"
@@ -114,14 +115,15 @@ static int is_unique_item (struct obstack * ostack, void ** tree, void * ih)
static void stat1_the_leaf (reiserfs_filsys_t * fs, struct buffer_head * bh)
{
int i;
int i, i_num;
struct item_head * ih;
int is_there_unique_item;
ih = B_N_PITEM_HEAD (bh, 0);
is_there_unique_item = 0;
for (i = 0; i < get_blkh_nr_items (B_BLK_HEAD (bh)); i ++, ih ++) {
i_num = leaf_item_number_estimate(bh);
for (i = 0; i < i_num; i ++, ih ++) {
/* count all items */
fs_stat.all ++;
@@ -140,7 +142,7 @@ static void stat1_the_leaf (reiserfs_filsys_t * fs, struct buffer_head * bh)
} else {
ih = B_N_PITEM_HEAD (bh, 0);
/* node contains at least one unique item. We will put it in, count items of each type */
for (i = 0; i < get_blkh_nr_items (B_BLK_HEAD (bh)); i ++, ih ++) {
for (i = 0; i < i_num; i ++, ih ++) {
fs_stat.items [get_type (&ih->ih_key)] ++;
}
}
@@ -178,10 +180,6 @@ void do_stat (reiserfs_filsys_t * fs)
return;
*/
total = reiserfs_bitmap_ones (input_bitmap (fs));
/* pass 0 of stating */
total = reiserfs_bitmap_ones (input_bitmap (fs));
done = 0;
@@ -197,7 +195,7 @@ void do_stat (reiserfs_filsys_t * fs)
continue;
}
type = who_is_this (bh->b_data, bh->b_size);
if (type != THE_LEAF) {
if (type != THE_LEAF && type != HAS_IH_ARRAY) {
reiserfs_bitmap_clear_bit (input_bitmap (fs), i);
brelse (bh);
continue;
+14 -8
View File
@@ -1,5 +1,6 @@
/*
* Copyright 2000-2002 by Hans Reiser, licensing governed by reiserfs/README
* Copyright 2000-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "debugreiserfs.h"
@@ -88,8 +89,8 @@ static void unpack_direntry (struct packed_item * pi, struct buffer_head * bh,
int location;
char * item;
if (!hash_func)
die ("unpack_direntry: hash function is not set");
/* if (!hash_func)
die ("unpack_direntry: hash function is not set");*/
if (!(get_pi_mask(pi) & IH_FREE_SPACE))
die ("ih_entry_count must be packed for directory items");
@@ -126,7 +127,7 @@ static void unpack_direntry (struct packed_item * pi, struct buffer_head * bh,
else if (*(item + location) == '.' && *(item + location + 1) == '.' && namelen == 2)
/* old or new ".." */
set_deh_offset (deh, DOT_DOT_OFFSET);
else
else if (hash_func)
set_deh_offset (deh, GET_HASH_VALUE (hash_func (item + location,
namelen)));
if (mask & HAS_GEN_COUNTER) {
@@ -488,7 +489,7 @@ static void unpack_unformatted_bitmap (int dev, int blocksize)
// read packed reiserfs partition metadata from stdin
void unpack_partition (int fd, int jfd)
{
__u32 magic32;
__u32 magic32, position;
__u16 magic16;
__u16 blocksize;
int dev = fd;
@@ -562,13 +563,18 @@ void unpack_partition (int fd, int jfd)
break;
case END_MAGIC:
break;
goto out;
default:
die ("unpack_partition: bad magic found - %x", magic16 & 0xff);
position = ftell(stdin);
if (position == ~0ul)
die ("unpack_partition: bad magic found - %x", magic16 & 0xff);
else
die ("unpack_partition: bad magic found - %x, position %lu",
magic16 & 0xff, ftell(stdin));
}
}
out:
fprintf (stderr, "Unpacked %d leaves, %d full blocks\n", leaves, full);
Executable
+423
View File
@@ -0,0 +1,423 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
# Copyright 1999, 2000 Free Software Foundation, Inc.
# 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, 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# `libtool' can also be set to `yes' or `no'.
if test -z "$depfile"; then
base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
dir=`echo "$object" | sed 's,/.*$,/,'`
if test "$dir" = "$object"; then
dir=
fi
# FIXME: should be _deps on DOS.
depfile="$dir.deps/$base"
fi
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. This file always lives in the current directory.
# Also, the AIX compiler puts `$object:' at the start of each line;
# $object doesn't have directory information.
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
outname="$stripped.o"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1="$dir.libs/$base.lo.d"
tmpdepfile2="$dir.libs/$base.d"
"$@" -Wc,-MD
else
tmpdepfile1="$dir$base.o.d"
tmpdepfile2="$dir$base.d"
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
if test -f "$tmpdepfile1"; then
tmpdepfile="$tmpdepfile1"
else
tmpdepfile="$tmpdepfile2"
fi
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a space and a tab in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'. We will use -o /dev/null later,
# however we can't do the remplacement now because
# `-o $object' might simply not be used
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
"$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
-*)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
+1 -1
View File
@@ -7,5 +7,5 @@ ufile.c check_tree.c info.c super.c fsck.h
man_MANS = reiserfsck.8
EXTRA_DIST = $(man_MANS)
LDADD = $(top_srcdir)/lib/libmisc.a $(top_srcdir)/reiserfscore/libcore.a
LDADD = $(LDFLAGS) $(top_srcdir)/lib/libmisc.a $(top_srcdir)/reiserfscore/libcore.a
+327 -231
View File
@@ -1,6 +1,8 @@
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -10,167 +12,243 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
sbin_PROGRAMS = reiserfsck
reiserfsck_SOURCES = main.c pass0.c pass1.c pass2.c semantic_check.c semantic_rebuild.c pass4.c lost+found.c ubitmap.c uobjectid.c ustree.c ufile.c check_tree.c info.c super.c fsck.h
reiserfsck_SOURCES = main.c pass0.c pass1.c pass2.c semantic_check.c \
semantic_rebuild.c pass4.c lost+found.c ubitmap.c uobjectid.c ustree.c \
ufile.c check_tree.c info.c super.c fsck.h
man_MANS = reiserfsck.8
EXTRA_DIST = $(man_MANS)
LDADD = $(top_srcdir)/lib/libmisc.a $(top_srcdir)/reiserfscore/libcore.a
LDADD = $(LDFLAGS) $(top_srcdir)/lib/libmisc.a $(top_srcdir)/reiserfscore/libcore.a
subdir = fsck
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../include/config.h
CONFIG_CLEAN_FILES =
PROGRAMS = $(sbin_PROGRAMS)
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
sbin_PROGRAMS = reiserfsck$(EXEEXT)
PROGRAMS = $(sbin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir) -I../include
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
reiserfsck_OBJECTS = main.o pass0.o pass1.o pass2.o semantic_check.o \
semantic_rebuild.o pass4.o lost+found.o ubitmap.o uobjectid.o ustree.o \
ufile.o check_tree.o info.o super.o
am_reiserfsck_OBJECTS = main.$(OBJEXT) pass0.$(OBJEXT) pass1.$(OBJEXT) \
pass2.$(OBJEXT) semantic_check.$(OBJEXT) \
semantic_rebuild.$(OBJEXT) pass4.$(OBJEXT) lost+found.$(OBJEXT) \
ubitmap.$(OBJEXT) uobjectid.$(OBJEXT) ustree.$(OBJEXT) \
ufile.$(OBJEXT) check_tree.$(OBJEXT) info.$(OBJEXT) \
super.$(OBJEXT)
reiserfsck_OBJECTS = $(am_reiserfsck_OBJECTS)
reiserfsck_LDADD = $(LDADD)
reiserfsck_DEPENDENCIES = $(top_srcdir)/lib/libmisc.a \
$(top_srcdir)/reiserfscore/libcore.a
reiserfsck_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
reiserfsck_DEPENDENCIES = $(top_srcdir)/lib/libmisc.a \
$(top_srcdir)/reiserfscore/libcore.a
reiserfsck_LDFLAGS =
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/check_tree.Po ./$(DEPDIR)/info.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/lost+found.Po ./$(DEPDIR)/main.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/pass0.Po ./$(DEPDIR)/pass1.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/pass2.Po ./$(DEPDIR)/pass4.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/semantic_check.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/semantic_rebuild.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/super.Po ./$(DEPDIR)/ubitmap.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/ufile.Po ./$(DEPDIR)/uobjectid.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/ustree.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
man8dir = $(mandir)/man8
MANS = $(man_MANS)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(reiserfsck_SOURCES)
NROFF = nroff
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
MANS = $(man_MANS)
DIST_COMMON = Makefile.am Makefile.in
SOURCES = $(reiserfsck_SOURCES)
OBJECTS = $(reiserfsck_OBJECTS)
all: all-redirect
all: all-am
.SUFFIXES:
.SUFFIXES: .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps fsck/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-sbinPROGRAMS:
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
distclean-sbinPROGRAMS:
maintainer-clean-sbinPROGRAMS:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu fsck/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
install-sbinPROGRAMS: $(sbin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(sbindir)
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f"; \
$(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f || exit 1; \
else :; fi; \
done
uninstall-sbinPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(sbin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f $(DESTDIR)$(sbindir)/$$f"; \
rm -f $(DESTDIR)$(sbindir)/$$f; \
done
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
reiserfsck$(EXEEXT): $(reiserfsck_OBJECTS) $(reiserfsck_DEPENDENCIES)
@rm -f reiserfsck$(EXEEXT)
$(LINK) $(reiserfsck_LDFLAGS) $(reiserfsck_OBJECTS) $(reiserfsck_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
-rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_tree.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/info.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lost+found.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pass0.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pass1.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pass2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pass4.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/semantic_check.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/semantic_rebuild.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/super.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ubitmap.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uobjectid.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ustree.Po@am__quote@
reiserfsck: $(reiserfsck_OBJECTS) $(reiserfsck_DEPENDENCIES)
@rm -f reiserfsck
$(LINK) $(reiserfsck_LDFLAGS) $(reiserfsck_OBJECTS) $(reiserfsck_LDADD) $(LIBS)
distclean-depend:
-rm -rf ./$(DEPDIR)
install-man8:
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am:
man8dir = $(mandir)/man8
install-man8: $(man8_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(man8dir)
@list='$(man8_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.8*) list="$$list $$i" ;; \
esac; \
@@ -179,194 +257,212 @@ install-man8:
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
8*) ;; \
*) ext='8' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \
done
uninstall-man8:
@list='$(man8_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
@$(NORMAL_UNINSTALL)
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.8*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
8*) ;; \
*) ext='8' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \
rm -f $(DESTDIR)$(man8dir)/$$inst; \
done
install-man: $(MANS)
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-man8
uninstall-man:
@$(NORMAL_UNINSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-man8
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
mkid -fID $$unique
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
mostlyclean-tags:
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
clean-tags:
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = fsck
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check_tree.o: check_tree.c fsck.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
info.o: info.c fsck.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
lost+found.o: lost+found.c fsck.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
main.o: main.c fsck.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h ../include/config.h ../version.h
pass0.o: pass0.c fsck.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
pass1.o: pass1.c fsck.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
pass2.o: pass2.c fsck.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
pass4.o: pass4.c fsck.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
semantic_check.o: semantic_check.c fsck.h ../include/io.h \
../include/misc.h ../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
semantic_rebuild.o: semantic_rebuild.c fsck.h ../include/io.h \
../include/misc.h ../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
super.o: super.c fsck.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
ubitmap.o: ubitmap.c fsck.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
ufile.o: ufile.c fsck.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
uobjectid.o: uobjectid.c fsck.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
ustree.o: ustree.c fsck.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-sbinPROGRAMS
install-exec: install-exec-am
all-am: Makefile $(PROGRAMS) $(MANS)
install-data-am: install-man
installdirs:
$(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-sbinPROGRAMS uninstall-man
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS) $(MANS)
all-redirect: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-sbinPROGRAMS mostlyclean-compile \
mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-sbinPROGRAMS clean-compile clean-tags clean-generic \
mostlyclean-am
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
distclean-am: distclean-sbinPROGRAMS distclean-compile distclean-tags \
distclean-generic clean-am
clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-sbinPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am: install-man
install-exec-am: install-sbinPROGRAMS
install-info: install-info-am
install-man: install-man8
installcheck-am:
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS \
clean-sbinPROGRAMS maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \
install-sbinPROGRAMS mostlyclean-compile distclean-compile \
clean-compile maintainer-clean-compile install-man8 uninstall-man8 \
install-man uninstall-man tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
check-am installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-man uninstall-sbinPROGRAMS
uninstall-man: uninstall-man8
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-sbinPROGRAMS ctags distclean distclean-compile \
distclean-depend distclean-generic distclean-tags distdir dvi \
dvi-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-man8 install-sbinPROGRAMS \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am uninstall-man \
uninstall-man8 uninstall-sbinPROGRAMS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
+129 -122
View File
@@ -1,5 +1,6 @@
/*
* Copyright 1999, 2000, 2001, 2002 Hans Reiser
* Copyright 1999-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "fsck.h"
@@ -11,7 +12,7 @@ struct check_relocated {
struct check_relocated * next;
};
struct check_relocated * relocated_list;
static struct check_relocated * relocated_list;
void to_be_relocated (struct key * key)
{
@@ -34,32 +35,51 @@ void to_be_relocated (struct key * key)
new_relocated->next = prev->next;
prev->next = new_relocated;
} else {
new_relocated->next = 0;
new_relocated->next = relocated_list;
relocated_list = new_relocated;
}
}
int should_be_relocated (struct key * key)
{
struct check_relocated * cur, * next;
struct check_relocated *cur, *prev;
int ret = 0;
if (!key)
return 0;
cur = relocated_list;
prev = NULL;
while (cur && comp_short_keys(key, (struct key *)cur) != 1) {
if (comp_short_keys (key, (struct key *)cur) == 0) {
ret = 1;
break;
}
cur = cur->next;
prev = cur;
cur = cur->next;
}
while (relocated_list != cur) {
if (ret) {
/* cur is found */
if (prev) /* not the first */
prev->next = cur->next;
else /* first */
relocated_list = cur->next;
freemem (cur);
}
return ret;
}
void clear_relocated_list() {
struct check_relocated *next;
while (relocated_list) {
next = relocated_list->next;
freemem (relocated_list);
relocated_list = next;
}
return ret;
}
//
@@ -116,7 +136,7 @@ static int did_we_meet_it (unsigned long block)
static void init_control_bitmap (reiserfs_filsys_t * fs)
{
int i;
unsigned int i;
unsigned long block;
unsigned long reserved;
@@ -223,8 +243,8 @@ static void handle_bitmaps (reiserfs_filsys_t * fs)
} else if (problem) {
fsck_log ("vpf-10640: The on-disk and the correct bitmaps differs.\n");
while (problem) {
/* fixable corruptions because we can try to recover them w/out rebuilding the tree */
one_more_corruption (fs, fixable);
/* fixable corruptions because we can try to recover them without rebuilding the tree */
one_more_corruption (fs, FIXABLE);
problem --;
}
}
@@ -234,6 +254,21 @@ static void handle_bitmaps (reiserfs_filsys_t * fs)
return;
}
static int auto_handle_bitmaps (reiserfs_filsys_t *fs) {
unsigned long i;
if (source_bitmap->bm_byte_size != control_bitmap->bm_byte_size)
return -1;
for (i = 0; i < source_bitmap->bm_byte_size; i ++) {
if (control_bitmap->bm_map[i] & ~source_bitmap->bm_map[i]) {
return 1;
}
}
return 0;
}
/* is this block legal to be pointed to by some place of the tree? */
static int bad_block_number (reiserfs_filsys_t * fs, unsigned long block)
@@ -276,58 +311,12 @@ static int got_already (reiserfs_filsys_t * fs, unsigned long block)
return 0;
}
/* 1 if some of fields in the block head of bh look bad */
static int bad_block_head (reiserfs_filsys_t * fs, struct buffer_head * bh)
{
struct block_head * blkh;
int sum_length = 0;
blkh = B_BLK_HEAD (bh);
if (get_blkh_nr_items (blkh) > (bh->b_size - BLKH_SIZE) / IH_SIZE) {
fsck_log ("block %lu: The number of items (%u) exceeds the limit.\n",
bh->b_blocknr, get_blkh_nr_items (blkh));
one_more_corruption (fs, fatal);
return 1;
}
if (who_is_this (bh->b_data, bh->b_size) != THE_LEAF) {
fsck_log ("block %lu: The block has wrong structure of items.\n", bh->b_blocknr);
one_more_corruption (fs, fatal);
return 1;
}
sum_length = (get_blkh_nr_items (blkh) > 0) ?
get_ih_location (B_N_PITEM_HEAD (bh, get_blkh_nr_items (blkh) - 1)) : bh->b_size;
if (get_blkh_free_space (blkh) !=
sum_length - BLKH_SIZE - IH_SIZE * get_blkh_nr_items (blkh))
{
fsck_log ("block %lu: The free space (%lu) is incorrect, should be (%lu)",
bh->b_blocknr, get_blkh_free_space (blkh), sum_length - BLKH_SIZE - IH_SIZE * get_blkh_nr_items (blkh) );
if (fsck_mode(fs) == FSCK_FIX_FIXABLE) {
set_blkh_free_space (blkh, sum_length - BLKH_SIZE - IH_SIZE * get_blkh_nr_items (blkh));
fsck_log (" - corrected\n");
mark_buffer_dirty (bh);
} else {
fsck_log ("\n");
one_more_corruption (fs, fixable);
return 1;
}
}
return 0;
}
/* 1 if it does not look like reasonable stat data */
static int bad_stat_data (reiserfs_filsys_t * fs, struct buffer_head * bh, struct item_head * ih)
{
unsigned long objectid;
struct stat_data * sd;
__u32 pos;
// __u32 links;
objectid = get_key_objectid (&ih->ih_key);
if (!is_objectid_used (fs, objectid)) {
/* FIXME: this could be cured right here */
@@ -338,21 +327,21 @@ static int bad_stat_data (reiserfs_filsys_t * fs, struct buffer_head * bh, struc
no way to call one_less_corruption later
*/
if (fsck_mode (fs) != FSCK_FIX_FIXABLE)
one_more_corruption (fs, fixable);
one_more_corruption (fs, FIXABLE);
}
if (is_objectid_really_used (proper_id_map (fs), objectid, &pos)) {
if (id_map_mark(proper_id_map (fs), objectid)) {
fsck_log ("bad_stat_data: The objectid (%lu) is shared by at least two files\n", objectid);
if (fsck_mode (fs) == FSCK_FIX_FIXABLE)
to_be_relocated (&ih->ih_key);
one_more_corruption (fs, fixable);
return 0;
// one_more_corruption (fs, FIXABLE);
}
sd = (struct stat_data *)B_I_PITEM(bh,ih);
return 0;
/* Check this on semantic_check pass.
sd = (struct stat_data *)B_I_PITEM(bh,ih);
get_sd_nlink (ih, sd, &links);
if (S_ISDIR(sd->sd_mode)) {
if (links < 2) {
@@ -368,8 +357,6 @@ static int bad_stat_data (reiserfs_filsys_t * fs, struct buffer_head * bh, struc
}
}
*/
__mark_objectid_really_used (proper_id_map (fs), objectid, pos);
return 0;
}
@@ -386,7 +373,7 @@ inline void handle_one_pointer (reiserfs_filsys_t * fs, struct buffer_head * bh,
*ptr = 0;
mark_buffer_dirty (bh);
} else {
one_more_corruption (fs, fixable);
one_more_corruption (fs, FIXABLE);
}
}
@@ -455,13 +442,13 @@ static int bad_badblocks_item (reiserfs_filsys_t * fs, struct buffer_head * bh,
static int bad_indirect_item (reiserfs_filsys_t * fs, struct buffer_head * bh,
struct item_head * ih)
{
int i;
__u32 * ind = (__u32 *)B_I_PITEM (bh, ih);
unsigned int i;
if (get_ih_item_len (ih) % 4) {
fsck_log ("%s: block %lu: The item (%H) has the bad length (%u)\n",
__FUNCTION__, bh->b_blocknr, ih, get_ih_item_len (ih));
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
return 1;
}
@@ -513,9 +500,9 @@ static int bad_indirect_item (reiserfs_filsys_t * fs, struct buffer_head * bh,
/* FIXME: this was is_bad_directory from pass0.c */
static int bad_directory_item (reiserfs_filsys_t * fs, struct buffer_head * bh, struct item_head * ih)
{
int i;
char * name;
int namelen;
unsigned int count, i;
struct reiserfs_de_head * deh = B_I_DEH (bh, ih);
int min_entry_size = 1;/* We have no way to understand whether the
filesystem was created in 3.6 format or
@@ -523,31 +510,38 @@ static int bad_directory_item (reiserfs_filsys_t * fs, struct buffer_head * bh,
length is 1 */
__u16 state;
count = get_ih_entry_count (ih);
if (count == 0) {
one_more_corruption (fs, FATAL);
return 1;
}
/* make sure item looks like a directory */
if (get_ih_item_len (ih) / (DEH_SIZE + min_entry_size) < get_ih_entry_count (ih)) {
if (get_ih_item_len (ih) / (DEH_SIZE + min_entry_size) < count) {
/* entry count can not be that big */
fsck_log ("%s: block %lu: The directory item %k has the exsessively big entry count (%u)\n",
__FUNCTION__, bh->b_blocknr, &ih->ih_key, get_ih_entry_count (ih));
one_more_corruption (fs, fatal);
__FUNCTION__, bh->b_blocknr, &ih->ih_key, count);
one_more_corruption (fs, FATAL);
return 1;
}
if (get_deh_location (&deh[get_ih_entry_count (ih) - 1]) != DEH_SIZE * get_ih_entry_count (ih)) {
if (get_deh_location (&deh[count - 1]) != DEH_SIZE * count) {
/* last entry should start right after array of dir entry headers */
fsck_log ("%s: block %lu: The directory item %k has the corrupted entry structure\n",
__FUNCTION__, bh->b_blocknr, &ih->ih_key);
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
return 1;
}
/* check name hashing */
for (i = 0; i < get_ih_entry_count (ih); i ++, deh ++) {
for (i = 0; i < count; i ++, deh ++) {
namelen = name_in_entry_length (ih, deh, i);
name = name_in_entry (deh, i);
if (!is_properly_hashed (fs, name, namelen, get_deh_offset (deh))) {
fsck_log ("%s: block %lu: The directory item %k has a not properly hashed entry (%d)\n",
__FUNCTION__, bh->b_blocknr, &ih->ih_key, i);
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
return 1;
}
}
@@ -555,7 +549,7 @@ static int bad_directory_item (reiserfs_filsys_t * fs, struct buffer_head * bh,
deh = B_I_DEH (bh, ih);
state = (1 << DEH_Visible2);
/* ok, items looks like a directory */
for (i = 0; i < get_ih_entry_count (ih); i ++, deh ++) {
for (i = 0; i < count; i ++, deh ++) {
if (get_deh_state (deh) != state) {
fsck_log ("bad_directory_item: block %lu: The directory item %k has the entry (%d) "
"\"%.*s\" with a not legal state (%o), (%o) expected",
@@ -566,7 +560,7 @@ static int bad_directory_item (reiserfs_filsys_t * fs, struct buffer_head * bh,
mark_buffer_dirty (bh);
fsck_log (" - corrected\n");
} else
one_more_corruption (fs, fixable);
one_more_corruption (fs, FIXABLE);
fsck_log ("\n");
}
@@ -584,8 +578,8 @@ static int bad_item (reiserfs_filsys_t * fs, struct buffer_head * bh, int num)
ih = B_N_PITEM_HEAD (bh, num);
if ((get_ih_flags(ih)) != 0) {
if (fsck_mode(fs) == FSCK_CHECK) {
one_more_corruption (fs, fixable);
if (fsck_mode(fs) != FSCK_FIX_FIXABLE) {
one_more_corruption (fs, FIXABLE);
fsck_log ("%s: vpf-10570: block %lu: The item header (%d) has not cleaned flags.\n",
__FUNCTION__, bh->b_blocknr, num);
} else {
@@ -605,8 +599,8 @@ static int bad_item (reiserfs_filsys_t * fs, struct buffer_head * bh, int num)
format = key_format(&ih->ih_key);
if (format != get_ih_key_format(ih)) {
if (fsck_mode(fs) == FSCK_CHECK) {
one_more_corruption (fs, fixable);
if (fsck_mode(fs) != FSCK_FIX_FIXABLE) {
one_more_corruption (fs, FIXABLE);
fsck_log ("%s: vpf-10710: block %lu: The format (%d) specified in the item header (%d) "
"differs from the key format (%d).\n", __FUNCTION__, bh->b_blocknr,
get_ih_key_format(ih), num, format);
@@ -646,7 +640,7 @@ static int bad_item (reiserfs_filsys_t * fs, struct buffer_head * bh, int num)
/* it does not look like safe link */
/* dir_id == -1 can be used only by safe links */
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
fsck_log ("%s: vpf-10290: block %lu, item %d: The item has a wrong key %k\n",
__FUNCTION__, num, bh->b_blocknr, &ih->ih_key);
return 1;
@@ -661,13 +655,13 @@ static int bad_item (reiserfs_filsys_t * fs, struct buffer_head * bh, int num)
return bad_badblocks_item (fs, bh, ih);
} else {*/
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
fsck_log ("%s: vpf-10300: block %lu, item %d: The item has a wrong key %k\n",
__FUNCTION__, num, bh->b_blocknr, &ih->ih_key);
return 1;
}
} else if (get_key_objectid (&ih->ih_key) == (__u32)-1) {
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
fsck_log ("%s: vpf-10310: block %lu, item %d: The item has a wrong key %k\n",
__FUNCTION__, num, bh->b_blocknr, &ih->ih_key);
return 1;
@@ -695,7 +689,7 @@ int bad_pair (reiserfs_filsys_t * fs, struct buffer_head * bh, int pos)
if (comp_keys (&((ih - 1)->ih_key), &ih->ih_key) != -1) {
if (fsck_mode (fs) != FSCK_REBUILD)
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
return 1;
}
@@ -703,7 +697,7 @@ int bad_pair (reiserfs_filsys_t * fs, struct buffer_head * bh, int pos)
/* left item must be of another object */
if (comp_short_keys (&((ih - 1)->ih_key), &ih->ih_key) != -1) {
if (fsck_mode (fs) != FSCK_REBUILD)
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
return 1;
}
@@ -733,7 +727,7 @@ int bad_pair (reiserfs_filsys_t * fs, struct buffer_head * bh, int pos)
file */
if (not_of_one_file (&((ih - 1)->ih_key), &ih->ih_key)) {
if (fsck_mode (fs) != FSCK_REBUILD)
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
return 1;
}
@@ -742,7 +736,7 @@ int bad_pair (reiserfs_filsys_t * fs, struct buffer_head * bh, int pos)
get_offset (&(ih - 1)->ih_key) + get_bytes_number (ih-1, bh->b_size) ==
get_offset (&ih->ih_key)))) {
if (fsck_mode (fs) != FSCK_REBUILD)
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
return 1;
}
}
@@ -752,7 +746,7 @@ int bad_pair (reiserfs_filsys_t * fs, struct buffer_head * bh, int pos)
if (not_of_one_file (&((ih - 1)->ih_key), &ih->ih_key) ||
!is_stat_data_ih (ih - 1)) {
if (fsck_mode (fs) != FSCK_REBUILD)
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
return 1;
}
}
@@ -765,9 +759,8 @@ static int bad_leaf (reiserfs_filsys_t * fs, struct buffer_head * bh)
{
int i;
if (bad_block_head (fs, bh)) {
if (leaf_structure_check(fs, bh))
return 1;
}
for (i = 0; i < B_NR_ITEMS (bh); i ++) {
if (bad_item (fs, bh, i)) {
@@ -777,7 +770,8 @@ static int bad_leaf (reiserfs_filsys_t * fs, struct buffer_head * bh)
if (i && bad_pair (fs, bh, i)) {
fsck_log ("bad_leaf: block %lu, items %d and %d: The wrong order of items: %k, %k\n",
bh->b_blocknr, i-1, i, &B_N_PITEM_HEAD (bh, i-1)->ih_key, &B_N_PITEM_HEAD (bh, i)->ih_key);
bh->b_blocknr, i-1, i, &B_N_PITEM_HEAD (bh, i-1)->ih_key,
&B_N_PITEM_HEAD (bh, i)->ih_key);
}
}
return 0;
@@ -792,17 +786,19 @@ static int bad_internal (reiserfs_filsys_t * fs, struct buffer_head * bh)
if (i != B_NR_ITEMS (bh) && i != B_NR_ITEMS (bh) - 1)
/* make sure that keys are in increasing order */
if (comp_keys (B_N_PDELIM_KEY (bh, i), B_N_PDELIM_KEY (bh, i + 1)) != -1) {
fsck_log ("%s: vpf-10320: block %lu, items %d and %d: The wrong order of items: %k, %k\n",
__FUNCTION__, bh->b_blocknr, i, i+1, B_N_PDELIM_KEY (bh, i), B_N_PDELIM_KEY (bh, i + 1));
one_more_corruption (fs, fatal);
fsck_log ("%s: vpf-10320: block %lu, items %d and %d: The wrong order "
"of items: %k, %k\n", __FUNCTION__, bh->b_blocknr, i, i+1,
B_N_PDELIM_KEY (bh, i), B_N_PDELIM_KEY (bh, i + 1));
one_more_corruption (fs, FATAL);
return 1;
}
/* make sure that the child is correct */
if (bad_block_number (fs, get_dc_child_blocknr (B_N_CHILD (bh,i)))) {
fsck_log ("%s: vpf-10330: block %lu, item %d: The internal item points to the not legal block (%lu)\n",
__FUNCTION__, bh->b_blocknr, i, get_dc_child_blocknr (B_N_CHILD (bh,i)));
one_more_corruption (fs, fatal);
fsck_log ("%s: vpf-10330: block %lu, item %d: The internal item points to the "
"not legal block (%lu)\n", __FUNCTION__, bh->b_blocknr, i,
get_dc_child_blocknr (B_N_CHILD (bh,i)));
one_more_corruption (fs, FATAL);
return 1;
}
}
@@ -818,29 +814,28 @@ static inline int h_to_level (reiserfs_filsys_t * fs, int h)
/* bh must be formatted node. blk_level must be tree_height - h + 1 */
static int bad_node (reiserfs_filsys_t * fs, struct buffer_head ** path,
int h)
static int bad_node (reiserfs_filsys_t * fs, struct buffer_head ** path, int h)
{
struct buffer_head ** pbh = &path[h];
if (B_LEVEL (*pbh) != h_to_level (fs, h)) {
fsck_log ("block %lu: The level of the node (%d) is not correct, (%d) expected\n",
(*pbh)->b_blocknr, B_LEVEL (*pbh), h_to_level (fs, h));
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
return 1;
}
if (bad_block_number (fs, (*pbh)->b_blocknr)) {
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
fsck_log ("%s: vpf-10340: The node in the wrong block number (%lu) found in the tree\n",
__FUNCTION__, (*pbh)->b_blocknr);
return 1;
}
if (got_already (fs, (*pbh)->b_blocknr)) {
fsck_log ("%s: vpf-10350: The block (%lu) is used more then once in the tree.\n",
fsck_log ("%s: vpf-10350: The block (%lu) is used more than once in the tree.\n",
__FUNCTION__, (*pbh)->b_blocknr);
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
return 1;
}
@@ -922,9 +917,10 @@ static int bad_path (reiserfs_filsys_t * fs, struct buffer_head ** path, int h1)
if (dk && comp_keys (dk, B_N_PKEY (path[h], 0))) {
/* left delimiting key must be equal to the key of 0-th item in the
node */
fsck_log ("bad_path: The left delimiting key %k of the node (%lu) must be equal to the first element's "
"key %k within the node.\n", dk, path[h]->b_blocknr, B_N_PKEY (path[h], 0));
one_more_corruption (fs, fatal);
fsck_log ("bad_path: The left delimiting key %k of the node (%lu) must "
"be equal to the first element's key %k within the node.\n", dk,
path[h]->b_blocknr, B_N_PKEY (path[h], 0));
one_more_corruption (fs, FATAL);
return 1;
}
@@ -932,10 +928,11 @@ static int bad_path (reiserfs_filsys_t * fs, struct buffer_head ** path, int h1)
if (dk && comp_keys (dk, B_N_PKEY (path[h],
get_blkh_nr_items (B_BLK_HEAD (path[h])) - 1)) != 1) {
/* right delimiting key must be greater than the key of the last item in the node */
fsck_log ("bad_path: The right delimiting key %k of the node (%lu) must be greater then the last (%d) element's"
"key %k within the node.\n", dk, path[h]->b_blocknr, get_blkh_nr_items (B_BLK_HEAD (path[h])) - 1,
fsck_log ("bad_path: The right delimiting key %k of the node (%lu) must "
"be greater than the last (%d) element's key %k within the node.\n",
dk, path[h]->b_blocknr, get_blkh_nr_items (B_BLK_HEAD (path[h])) - 1,
B_N_PKEY (path[h], get_blkh_nr_items (B_BLK_HEAD (path[h])) - 1));
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
return 1;
}
@@ -944,10 +941,12 @@ static int bad_path (reiserfs_filsys_t * fs, struct buffer_head ** path, int h1)
BLKH_SIZE != path[h]->b_size))
{
/* wrong dc_size */
fsck_log ("bad_path: block %lu, pointer %d: The used space (%d) of the child block (%lu)",
path[h-1]->b_blocknr, pos, get_dc_child_size (B_N_CHILD(path[h-1],pos)), path[h]->b_blocknr);
fsck_log (" is not equal to the (blocksize (4096) - free space (%d) - header size (%u))",
get_blkh_free_space ((struct block_head *)path[h]->b_data), BLKH_SIZE);
fsck_log ("bad_path: block %lu, pointer %d: The used space (%d) of the "
"child block (%lu)", path[h-1]->b_blocknr, pos,
get_dc_child_size(B_N_CHILD(path[h-1],pos)), path[h]->b_blocknr);
fsck_log (" is not equal to the (blocksize (4096) - free space (%d) - "
"header size (%u))",
get_blkh_free_space((struct block_head *)path[h]->b_data), BLKH_SIZE);
if (fsck_mode (fs) == FSCK_FIX_FIXABLE) {
set_dc_child_size (B_N_CHILD(path[h-1],pos), path[h]->b_size -
@@ -955,7 +954,7 @@ static int bad_path (reiserfs_filsys_t * fs, struct buffer_head ** path, int h1)
fsck_log (" - corrected to (%lu)\n", get_dc_child_size (B_N_CHILD(path[h-1],pos)));
mark_buffer_dirty (path[h-1]);
} else {
one_more_corruption (fs, fixable);
one_more_corruption (fs, FIXABLE);
fsck_log ("\n");
return 1;
}
@@ -970,14 +969,14 @@ static void before_check_fs_tree (reiserfs_filsys_t * fs) {
source_bitmap = reiserfs_create_bitmap (get_sb_block_count (fs->fs_ondisk_sb));
reiserfs_bitmap_copy (source_bitmap, fs->fs_bitmap2);
proper_id_map (fs) = init_id_map ();
proper_id_map (fs) = id_map_init();
}
static void after_check_fs_tree (reiserfs_filsys_t * fs) {
if (fsck_mode(fs) == FSCK_FIX_FIXABLE) {
fs->fs_dirt = 1;
reiserfs_flush_to_ondisk_bitmap (fs->fs_bitmap2, fs);
reiserfs_flush (fs);
fs->fs_dirt = 1;
reiserfs_bitmap_delta (source_bitmap, control_bitmap);
fsck_deallocate_bitmap(fs) = source_bitmap;
} else
@@ -993,13 +992,20 @@ void check_fs_tree (reiserfs_filsys_t * fs)
before_check_fs_tree (fs);
fsck_progress ("Checking internal tree..");
pass_through_tree (fs, bad_node, bad_path);
pass_through_tree (fs, bad_node, bad_path, fsck_mode(fs) == FSCK_AUTO ? 2 : -1);
/* internal tree is correct (including all objects have correct
sequences of items) */
fsck_progress ("finished\n");
/* compare created bitmap with the original */
handle_bitmaps (fs);
if (fsck_mode(fs) == FSCK_AUTO) {
if (auto_handle_bitmaps(fs)) {
fprintf(stderr, "The on-disk bitmap looks corrupted.");
one_more_corruption(fs, FIXABLE);
}
id_map_free(proper_id_map(fs));
} else
handle_bitmaps (fs);
after_check_fs_tree (fs);
}
@@ -1028,8 +1034,9 @@ static int clean_attributes_handler (reiserfs_filsys_t * fs, struct buffer_head
}
void do_clean_attributes (reiserfs_filsys_t * fs) {
pass_through_tree (fs, clean_attributes_handler, NULL);
pass_through_tree (fs, clean_attributes_handler, NULL, -1);
set_sb_v2_flag (fs->fs_ondisk_sb, reiserfs_attrs_cleared);
mark_buffer_dirty (fs->fs_super_bh);
}
+67 -66
View File
@@ -1,5 +1,6 @@
/*
* Copyright 1996-2002 Hans Reiser
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#define _GNU_SOURCE
@@ -26,18 +27,25 @@
extern reiserfs_filsys_t * fs;
int main (int argc, char * argv []);
/* Exit codes. */
#define EXIT_OK 0
#define EXIT_FIXED 1
#define EXIT_FATAL 4
#define EXIT_FIXABLE 6
#define EXIT_OPER 8 /* Some operation returns error. */
#define EXIT_USER 16
/*
* modes
*/
#define DO_NOTHING 0 /* -a specified */
#define DO_NOTHING 0
#define FSCK_CHECK 1
#define FSCK_FIX_FIXABLE 2
#define FSCK_SB 3
#define FSCK_REBUILD 4
#define FSCK_ROLLBACK_CHANGES 5
#define FSCK_CLEAN_ATTRIBUTES 7
#define AUTO 8 /* -p specified */
#define FSCK_AUTO 8 /* -a || -p specified */
/* temporary */
#define DO_TEST 9
@@ -45,30 +53,32 @@ int main (int argc, char * argv []);
/*
* options
*/
#define OPT_INTERACTIVE 0x1
//#define OPT_FIX_FIXABLE 0x2 /* not default yet */
#define OPT_ADJUST_FILE_SIZE 0x4 /* not default yet */
#define OPT_QUIET 0x8 /* no "speed" info */
/*#define OPT_SAVE_EXTERN_BITMAP 0x10*/
#define OPT_SILENT 0x20 /* no complains about found corruptions */
#define OPT_BACKGROUND 0x40
#define OPT_SKIP_JOURNAL 0x80
#define OPT_HASH_DEFINED 0x100
#define OPT_SAVE_PASSES_DUMP 0x200
#define BADBLOCKS_FILE 0x400
#define OPT_SAVE_ROLLBACK 0x800
#define OPT_INTERACTIVE 1 << 0
#define OPT_ADJUST_FILE_SIZE 1 << 1 /* not default yet */
#define OPT_QUIET 1 << 2 /* no "speed" info */
#define OPT_SILENT 1 << 3 /* no complains about found corruptions */
#define OPT_BACKGROUND 1 << 4
#define OPT_SKIP_JOURNAL 1 << 5
#define OPT_HASH_DEFINED 1 << 6
#define OPT_SAVE_PASSES_DUMP 1 << 7
#define OPT_SAVE_ROLLBACK 1 << 8
#define OPT_YES 1 << 9
#define BADBLOCKS_FILE 1 << 10
/* pass0.c */
void pass_0 (reiserfs_filsys_t *);
void load_pass_0_result (FILE *, reiserfs_filsys_t *);
int leaf_structure_check(reiserfs_filsys_t * fs, struct buffer_head * bh);
int is_used_leaf (unsigned long block);
int is_good_unformatted (unsigned long block);
void mark_good_unformatted (unsigned long block);
int is_bad_unformatted (unsigned long block);
int are_there_allocable_blocks (int amout_needed);
int are_there_allocable_blocks (unsigned int amout_needed);
unsigned long alloc_block (void);
void make_allocable (unsigned long block);
void register_uninsertable (unsigned long block);
@@ -117,11 +127,11 @@ void rewrite_object (struct item_head * ih, int do_remap);
void pass_2_take_bad_blocks_put_into_tree (void);
/*int is_remapped (struct item_head * ih);*/
void link_relocated_files (void);
//void relocate_file (struct item_head * ih, int change_ih);
int should_relocate (struct item_head * ih);
void relocate_dir (struct item_head * ih, int change_ih);
__u32 objectid_for_relocation (struct key * key);
int should_be_relocated (struct key * key);
extern __u32 objectid_for_relocation (struct key * key);
extern void linked_already(struct key *new_key);
/* file.c */
struct si {
@@ -134,7 +144,7 @@ struct si {
struct si * last_known;
};
void put_saved_items_into_tree (struct si *);
int reiserfsck_file_write (struct item_head * ih, char * item, int);
int reiserfsck_file_write (struct item_head * ih, char * item, int was_in_tree);
int are_file_items_correct (struct item_head * sd_ih, void * sd, __u64 * size, __u32 * blocks, int mark_passed_items, int * symlink);
int delete_N_items_after_key(struct key * start_key, struct si ** save_here, int skip_dir_items, int n_to_delete);
void rewrite_file (struct item_head * ih, int should_relocate, int should_change_ih);
@@ -182,11 +192,9 @@ void pass_4_check_unaccessed_items (void);
/* check.c */
int is_leaf_bad (struct buffer_head * bh);
int is_internal_bad (struct buffer_head * bh);
int is_bad_item (struct buffer_head * bh, struct item_head *, char *);
/*int check_file_system (void);*/
void reiserfsck_check_pass1 (void);
void reiserfsck_check_after_all (void);
/*char * bad_name (char * name, int namelen);*/
/* to test result of direcotry item recovering on pass 0 */
int is_bad_directory (struct item_head * ih, char * item, int dev, int blocksize);
@@ -200,7 +208,9 @@ void do_clean_attributes (reiserfs_filsys_t * fs);
int bad_pair (reiserfs_filsys_t *, struct buffer_head * bh, int i);
int bad_leaf_2 (reiserfs_filsys_t *, struct buffer_head * bh);
extern int should_be_relocated (struct key * key);
extern void to_be_relocated (struct key * key);
extern void clear_relocated_list(void);
/* ustree.c */
void reiserfsck_paste_into_item (struct path * path, const char * body, int size);
@@ -217,7 +227,7 @@ void reiserfsck_cut_from_item (struct path * path, int cut_size);
typedef int do_after_read_t (reiserfs_filsys_t *, struct buffer_head **, int h);
typedef int do_on_full_path_t (reiserfs_filsys_t *, struct buffer_head **, int);
void pass_through_tree (reiserfs_filsys_t *, do_after_read_t, do_on_full_path_t);
void pass_through_tree (reiserfs_filsys_t *, do_after_read_t, do_on_full_path_t, int depth);
//int comp_keys_3 (void * key1, void * key2);
//int comp_dir_entries (void * key1, void * key2);
@@ -239,50 +249,31 @@ int is_block_uninsertable (unsigned long block);
/* objectid.c */
int comp_ids(const void *p1, const void *p2);
int is_objectid_used (reiserfs_filsys_t *, __u32 objectid);
__u32 get_unused_objectid (reiserfs_filsys_t *);
struct id_map * init_id_map (void);
void free_id_map (struct id_map *);
int is_objectid_really_used (struct id_map *, __u32 id, __u32 * ppos);
int mark_objectid_really_used (struct id_map *, __u32 id);
int __mark_objectid_really_used (struct id_map *, __u32 id, __u32 pos);
void flush_objectid_map (struct id_map * map, reiserfs_filsys_t * fs);
typedef struct id_map {
void **index;
__u32 count, last_used;
} id_map_t;
id_map_t *id_map_init();
void id_map_free(id_map_t *);
int id_map_test(id_map_t *map, __u32 id);
int id_map_mark(id_map_t *map, __u32 id);
__u32 id_map_alloc(id_map_t *map);
void id_map_flush(struct id_map * map, reiserfs_filsys_t * fs);
/* FIXME: Needs to be implemented
void fetch_objectid_map (struct id_map * map, reiserfs_filsys_t * fs);
void reiserfs_objectid_map_save (FILE * fp, struct id_map * id_map);
struct id_map * reiserfs_objectid_map_load (FILE * fp);
/* segments.c */
/*
struct overwritten_unfm_segment {
int ous_begin;
int ous_end;
struct overwritten_unfm_segment * ous_next;
};
struct overwritten_unfm * look_for_overwritten_unfm (__u32);
struct overwritten_unfm_segment * find_overwritten_unfm (unsigned long unfm, int length, struct overwritten_unfm_segment * segment_to_init);
int get_unoverwritten_segment (struct overwritten_unfm_segment * list_head, struct overwritten_unfm_segment * unoverwritten_segment);
void save_unfm_overwriting (unsigned long unfm, struct item_head * direct_ih);
void free_overwritten_unfms (void);
*/
void mark_formatted_pointed_by_indirect (__u32);
int is_formatted_pointed_by_indirect (__u32);
/* size of 1 piece of in-memory map */
#define MAP_SIZE 4096
struct id_map {
__u32 * m_begin; /* pointer to map area */
__u32 m_used_slots_count;
int m_page_count; /* objectid map expands by one page at
time. This is size of objectid map size in
pages */
unsigned long objectids_marked; /* number of objectids marked used
in a map */
};
#define MAP_NOT_PACKED 0
#define MAP_PACKED 1
struct pass0_stat {
unsigned long dealt_with; /* number of blocks read during pass 0 */
@@ -357,8 +348,10 @@ struct rebuild_info {
struct pass0_stat pass0;
struct pass1_stat pass1;
struct pass2_stat pass2;
struct semantic_stat semantic;
struct lost_found_stat lost_found;
struct {
struct semantic_stat semantic;
struct lost_found_stat lost_found;
} tree;
struct pass_4_stat pass4;
} pass_u;
@@ -428,8 +421,8 @@ struct fsck_data {
FILE * progress;
/* objectid maps */
struct id_map * proper_id_map;
struct id_map * semantic_id_map; /* this objectid map is used to
id_map_t * proper_id_map;
id_map_t * semantic_id_map; /* this objectid map is used to
cure objectid sharing problem */
};
@@ -438,8 +431,8 @@ struct fsck_data {
#define pass_0_stat(fs) (&(fsck_data(fs)->rebuild.pass_u.pass0))
#define pass_1_stat(fs) (&(fsck_data(fs)->rebuild.pass_u.pass1))
#define pass_2_stat(fs) (&(fsck_data(fs)->rebuild.pass_u.pass2))
#define sem_pass_stat(fs) (&(fsck_data(fs)->rebuild.pass_u.semantic))
#define lost_found_pass_stat(fs) (&(fsck_data(fs)->rebuild.pass_u.lost_found))
#define sem_pass_stat(fs) (&(fsck_data(fs)->rebuild.pass_u.tree.semantic))
#define lost_found_pass_stat(fs) (&(fsck_data(fs)->rebuild.pass_u.tree.lost_found))
#define pass_4_stat(fs) (&(fsck_data(fs)->rebuild.pass_u.pass4))
#define fsck_check_stat(fs) (&(fsck_data(fs)->check))
@@ -470,10 +463,10 @@ struct fsck_data {
#define fsck_adjust_file_size(fs) (fsck_data(fs)->options & OPT_ADJUST_FILE_SIZE)
#define fsck_quiet(fs) (fsck_data(fs)->options & OPT_QUIET)
#define fsck_silent(fs) (fsck_data(fs)->options & OPT_SILENT)
#define fsck_save_leaf_bitmap(fs) (fsck_data(fs)->options & OPT_SAVE_EXTERN_BITMAP)
#define fsck_in_background(fs) (fsck_data(fs)->options & OPT_BACKGROUND)
#define fsck_hash_defined(fs) (fsck_data(fs)->options & OPT_HASH_DEFINED)
#define fsck_skip_journal(fs) (fsck_data(fs)->options & OPT_SKIP_JOURNAL)
#define fsck_yes_all(fs) (fsck_data(fs)->options & OPT_YES)
#define fsck_mode(fs) (fsck_data(fs)->mode)
@@ -508,11 +501,19 @@ reiserfs_warning (fsck_progress_file(fs), fmt, ## list);\
fflush (fsck_progress_file(fs));\
}
#define FATAL 1
#define FIXABLE 2
void one_more_corruption(reiserfs_filsys_t *fs, int kind);
void one_less_corruption(reiserfs_filsys_t *fs, int kind);
/*
#define one_more_corruption(fs,kind) fsck_check_stat (fs)->kind##_corruptions++
#define one_less_corruption(fs,kind) fsck_check_stat (fs)->kind##_corruptions--
*/
#define fsck_exit(fmt, list...) \
{\
reiserfs_warning (fsck_progress_file(fs), fmt, ## list);\
exit (16);\
exit (EXIT_USER);\
}
+4 -3
View File
@@ -1,5 +1,6 @@
/*
* Copyright 1996-2002 Hans Reiser
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "fsck.h"
@@ -35,7 +36,7 @@ void stage_report (int pass, reiserfs_filsys_t * fs)
if (stat->wrong_pointers)
fsck_progress ("\t\tpointers in indirect items to wrong area %lu (zeroed)\n",
stat->wrong_pointers);
fsck_progress ("\t\tObjectids found %lu\n", proper_id_map (fs)->objectids_marked);
fsck_progress ("\t\tObjectids found %lu\n", proper_id_map(fs)->count);
}
break;
@@ -74,7 +75,7 @@ void stage_report (int pass, reiserfs_filsys_t * fs)
if (stat->shared_objectids)
fsck_progress ("\t%lu shared objectids\n", stat->shared_objectids);
if (stat->relocated)
fsck_progress ("\tFiles relocated because of key conflicts w/ a directory %lu\n",
fsck_progress ("\tFiles relocated because of key conflicts with a directory %lu\n",
stat->relocated);
if (stat->rewritten)
fsck_progress ("\tFiles rewritten %lu\n", stat->rewritten);
+25 -28
View File
@@ -1,5 +1,6 @@
/*
* Copyright 2000-2002 Hans Reiser
* Copyright 2000-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "fsck.h"
@@ -87,7 +88,7 @@ static __u64 _look_for_lost (reiserfs_filsys_t * fs, int link_lost_dirs)
}
lost_found_pass_stat (fs)->dir_recovered ++;
create_dir_sd (fs, &tmp, &sd, modify_item);
mark_objectid_really_used (proper_id_map (fs), get_key_objectid (&sd));
id_map_mark(proper_id_map (fs), get_key_objectid (&sd));
key = sd;
pathrelse (&path);
goto cont;
@@ -137,30 +138,28 @@ static __u64 _look_for_lost (reiserfs_filsys_t * fs, int link_lost_dirs)
struct key obj_key = {0, 0, {{0, 0},}};
char * lost_name;
struct item_head tmp_ih;
__u32 pos_in_map;
/* key to continue */
key = ih->ih_key;
set_key_objectid (&key, get_key_objectid (&key) + 1);
tmp_ih = *ih;
if (is_objectid_really_used (semantic_id_map (fs),
get_key_objectid (&ih->ih_key),
&pos_in_map)) {
if (id_map_test(semantic_id_map (fs), get_key_objectid (&ih->ih_key))) {
/* objectid is used, relocate an object */
lost_found_pass_stat (fs)->oid_sharing ++;
if (1/*fsck_adjust_file_size (fs)*/) {
if (is_it_dir) {
relocate_dir (&tmp_ih, 1);
lost_found_pass_stat (fs)->oid_sharing_dirs_relocated ++;
} else {
rewrite_file (&tmp_ih, 1, 1);
lost_found_pass_stat (fs)->oid_sharing_files_relocated ++;
}
}
if (is_it_dir) {
relocate_dir (&tmp_ih, 1);
lost_found_pass_stat (fs)->oid_sharing_dirs_relocated ++;
} else {
rewrite_file (&tmp_ih, 1, 1);
lost_found_pass_stat (fs)->oid_sharing_files_relocated ++;
}
linked_already(&tmp_ih.ih_key);
} else {
if (!is_it_dir)
mark_objectid_really_used (semantic_id_map (fs), get_key_objectid (&ih->ih_key));
id_map_mark(semantic_id_map (fs), get_key_objectid (&ih->ih_key));
}
asprintf (&lost_name, "%u_%u", get_key_dirid (&tmp_ih.ih_key),
@@ -172,11 +171,12 @@ static __u64 _look_for_lost (reiserfs_filsys_t * fs, int link_lost_dirs)
pathrelse (&path);
/* 0 does not mean anyting - item w/ "." and ".." already
/* 0 does not mean anyting - item with "." and ".." already
exists and reached, so only name will be added */
size += reiserfs_add_entry (fs, &lost_found_dir_key, lost_name,
name_length (lost_name, lost_found_dir_format), &obj_key, 0/*fsck_need*/);
if (is_it_dir) {
/* fixme: we hope that if we will try to pull all the
directory right now - then there will be less
@@ -238,10 +238,6 @@ static __u64 _look_for_lost (reiserfs_filsys_t * fs, int link_lost_dirs)
fsck_progress ("finished\n");
#endif
if (!link_lost_dirs && lost_files)
fsck_log ("look_for_lost: %d files seem to be left not linked to lost+found\n",
lost_files);
return size;
}
@@ -261,7 +257,6 @@ static void save_lost_found_result (reiserfs_filsys_t * fs)
reiserfs_end_stage_info_save (file);
close_file (file);
retval = unlink (state_dump_file (fs));
retval = rename ("temp_fsck_file.deleteme", state_dump_file (fs));
if (retval != 0)
fsck_progress ("pass 0: Could not rename the temporary file temp_fsck_file.deleteme to %s",
@@ -283,8 +278,10 @@ void load_lost_found_result (reiserfs_filsys_t * fs)
fs->block_deallocator = reiserfsck_reiserfs_free_block;
/* we need objectid map on semantic pass to be able to relocate files */
proper_id_map (fs) = init_id_map ();
proper_id_map (fs) = id_map_init();
/* Not implemented yet.
fetch_objectid_map (proper_id_map (fs), fs);
*/
}
void after_lost_found (reiserfs_filsys_t * fs)
@@ -295,7 +292,7 @@ void after_lost_found (reiserfs_filsys_t * fs)
/* write all dirty blocks */
fsck_progress ("Flushing..");
flush_objectid_map (proper_id_map (fs), fs);
id_map_flush(proper_id_map (fs), fs);
fs->fs_dirt = 1;
reiserfs_flush_to_ondisk_bitmap (fsck_new_bitmap(fs), fs);
reiserfs_flush (fs);
@@ -311,12 +308,12 @@ void after_lost_found (reiserfs_filsys_t * fs)
save_lost_found_result (fs);
free_id_map (proper_id_map (fs));
id_map_free(proper_id_map (fs));
proper_id_map (fs) = 0;
fs->fs_dirt = 1;
reiserfs_close (fs);
exit(0);
exit(EXIT_OK);
}
void pass_3a_look_for_lost (reiserfs_filsys_t * fs)
@@ -328,10 +325,10 @@ void pass_3a_look_for_lost (reiserfs_filsys_t * fs)
__u32 blocks;
__u16 mode;
__u32 objectid;
int gen_counter;
unsigned int gen_counter;
fsck_progress ("Pass 3a (looking for lost dir/files):\n");
/* when warnings go not to stderr - separate then in the log */
/* when warnings go not to stderr - separate them in the log */
if (fsck_log_file (fs) != stderr)
fsck_log ("####### Pass 3a (lost+found pass) #########\n");
+465 -258
View File
File diff suppressed because it is too large. Load diff
+152 -72
View File
@@ -1,5 +1,6 @@
/*
* Copyright 1996-2002 Hans Reiser
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "fsck.h"
@@ -31,7 +32,14 @@ reiserfs_bitmap_t * bad_unfm_bitmap;
#define pass0_mark_bad_unfm(block) __mark (bad_unfm, block)
#define pass0_unmark_bad_unfm(block) __unmark (bad_unfm, block)
static int correct_direct_item_offset (__u64 offset, int format) {
if (format == KEY_FORMAT_2) {
return (offset && ((offset - 1) % 8 == 0));
} else {
return (offset);
}
return 0;
}
/* bitmaps which are built on pass 0 and are used on pass 1 */
static void make_aux_bitmaps (reiserfs_filsys_t * fs)
@@ -110,7 +118,7 @@ static int lower_correct (struct buffer_head * bh, struct item_head * lower,
/* return 1 if something was changed */
static int correct_key_format (struct item_head * ih)
static int correct_key_format (struct item_head * ih, int symlink)
{
int dirty = 0;
@@ -139,6 +147,12 @@ static int correct_key_format (struct item_head * ih)
die ("stat_data item of the wrong length");
}
if (symlink && is_direct_ih(ih) && (key_format(&ih->ih_key) != KEY_FORMAT_1)) {
/* All symlinks are of 3.5 format */
/*fsck_log ("correct_key_format: Symlink keys should be of 3.5 format. %k - fixed.\n", &ih->ih_key); */
set_type_and_offset(KEY_FORMAT_1, &ih->ih_key, get_offset(&ih->ih_key), get_type(&ih->ih_key));
}
if (key_format (&ih->ih_key) != get_ih_key_format (ih)) {
/*fsck_log ("correct_key_format: ih_key_format of (%H) is set to format found in the key\n",
ih);*/
@@ -227,7 +241,7 @@ static int verify_directory_item (reiserfs_filsys_t * fs, struct buffer_head * b
struct reiserfs_de_head * deh;
char * name;
int name_len;
int bad;
int bad, lost_found;
int i, j;
char buf[4096];
int dirty;
@@ -471,7 +485,7 @@ static int verify_directory_item (reiserfs_filsys_t * fs, struct buffer_head * b
}
#endif
bad = 0;
bad = lost_found = 0;
tmp = *ih;
/* mark enries of /lost+found as bad */
@@ -491,6 +505,7 @@ static int verify_directory_item (reiserfs_filsys_t * fs, struct buffer_head * b
/* entry in lost+found */
// printf ("%s - will be deleted\n", buf);
lost_found++;
mark_de_bad_offset (deh);
}
@@ -509,9 +524,9 @@ static int verify_directory_item (reiserfs_filsys_t * fs, struct buffer_head * b
}
}
if (bad == get_ih_entry_count (&tmp)) {
if (bad == get_ih_entry_count (&tmp) && lost_found != bad) {
fsck_log ("%s: block %lu, item %H: All entries were deleted from the directory\n",
__FUNCTION__, bh->b_blocknr, &tmp);
__FUNCTION__, bh->b_blocknr, &tmp);
return -1;
}
@@ -523,29 +538,28 @@ static int verify_directory_item (reiserfs_filsys_t * fs, struct buffer_head * b
mark_buffer_dirty (bh);
}
if (bad)
if (bad > lost_found)
fsck_log ("pass0: block %lu, item %H: %d entries were deleted\n",
bh->b_blocknr, &tmp, bad);
bh->b_blocknr, &tmp, bad - lost_found);
return 0;
}
static int does_it_fit_into_dev (__u64 offset) {
static __inline__ int does_it_fit_into_dev (__u64 offset, __u64 fs_size) {
/*
Count of unformatted pointers - offset / blocksize
Count of blocks to store them - UNFM_P_SIZE * offset / blocksize / MAX_ITEM_LEN
Size to store it - blocksize * UNFM_P_SIZE * offset / blocksize / MAX_ITEM_LEN
*/
return ( UNFM_P_SIZE * offset / MAX_ITEM_LEN(fs->fs_blocksize) <
fs->fs_blocksize * get_sb_block_count (fs->fs_ondisk_sb)) ? 1 : 0;
return ( UNFM_P_SIZE * offset / MAX_ITEM_LEN(fs->fs_blocksize) < fs_size) ? 1 : 0;
}
static int is_wrong_short_key (struct key * key) {
if (get_key_dirid (key) == 0 || get_key_objectid (key) == 0 || get_key_objectid (key) == 1 ||
get_key_dirid (key) == -1 || get_key_objectid (key) == -1 ||
get_key_dirid (key) == ~0ul || get_key_objectid (key) == ~0ul ||
get_key_dirid (key) == get_key_objectid (key) ||
(get_key_dirid (key) == 1 && get_key_objectid (key) != 2) ||
(get_key_dirid (key) != 1 && get_key_objectid (key) == 2) )
@@ -554,6 +568,55 @@ static int is_wrong_short_key (struct key * key) {
return 0;
}
/* 1 if some of fields in the block head of bh look bad */
int leaf_structure_check (reiserfs_filsys_t * fs, struct buffer_head * bh) {
struct block_head * blkh;
int free_space, counted;
blkh = B_BLK_HEAD (bh);
if (!is_leaf_block_head(bh->b_data)) {
/* We should not get here on rebuild. */
fsck_log ("block %lu: The block does not look like a leaf.\n", bh->b_blocknr);
one_more_corruption (fs, FATAL);
return 1;
}
counted = leaf_count_ih(bh->b_data, bh->b_size);
if (counted < get_blkh_nr_items (blkh)) {
fsck_log ("block %lu: The number of items (%lu) is incorrect, should be (%lu)",
bh->b_blocknr, get_blkh_nr_items(blkh), counted);
if (fsck_mode(fs) == FSCK_REBUILD) {
set_blkh_nr_items(blkh, counted);
fsck_log (" - corrected\n");
mark_buffer_dirty (bh);
} else {
fsck_log ("\n");
one_more_corruption (fs, FATAL);
return 1;
}
}
free_space = leaf_free_space_estimate(bh->b_data, bh->b_size);
if (get_blkh_free_space (blkh) != free_space) {
fsck_log ("block %lu: The free space (%lu) is incorrect, should be (%lu)",
bh->b_blocknr, get_blkh_free_space (blkh), free_space);
if (fsck_mode(fs) != FSCK_CHECK && fsck_mode(fs) != FSCK_AUTO) {
set_blkh_free_space (blkh, free_space);
fsck_log (" - corrected\n");
mark_buffer_dirty (bh);
} else {
fsck_log ("\n");
one_more_corruption (fs, FIXABLE);
return 1;
}
}
return 0;
}
/* do this on pass 0 with every leaf marked used */
/* FIXME: we can improve fixing of broken keys: we can ssfe direct items which
@@ -561,25 +624,31 @@ static int is_wrong_short_key (struct key * key) {
static void pass0_correct_leaf (reiserfs_filsys_t * fs,
struct buffer_head * bh)
{
int i, j;
struct item_head * ih;
__u32 * ind_item;
__u64 offset;
unsigned long unfm_ptr;
int dirty = 0;
int nr_items;
int file_format = KEY_FORMAT_UNDEFINED;
struct item_head * ih;
__u32 * ind_item;
__u64 fs_size;
__u64 offset;
int symlnk = 0;
int bad_order;
unsigned long unfm_ptr;
// unsigned int nr_items;
int i, j, nr_items;
int dirty = 0;
leaf_structure_check(fs, bh);
/* Delete all safe links. */
for (i = get_blkh_nr_items (B_BLK_HEAD (bh)) - 1; i >= 0; i--) {
if (get_key_dirid (&B_N_PITEM_HEAD (bh, i)->ih_key) == -1) {
if (get_key_dirid (&B_N_PITEM_HEAD (bh, i)->ih_key) == ~0ul) {
delete_item (fs, bh, i);
}
}
fs_size = (__u64)fs->fs_blocksize * get_sb_block_count (fs->fs_ondisk_sb);
start_again:
ih = B_N_PITEM_HEAD (bh, 0);
@@ -605,7 +674,6 @@ static void pass0_correct_leaf (reiserfs_filsys_t * fs,
}
}
if (is_wrong_short_key (&ih->ih_key)) {
/* sometimes stat datas get k_objectid==0 or k_dir_id==0 */
@@ -685,7 +753,7 @@ static void pass0_correct_leaf (reiserfs_filsys_t * fs,
"change the type of the key %k to StatData\n", bh->b_blocknr, i + 1, &(ih + 1)->ih_key);
set_type_and_offset (KEY_FORMAT_1, &(ih + 1)->ih_key, SD_OFFSET, TYPE_STAT_DATA);
dirty = 1;
} else {
} else if (is_indirect_ih(ih)) {
fsck_log("pass0: vpf-10420: block %lu, item %d: Wrong order of items - "
"change the type of the key %k to Direct\n", bh->b_blocknr, i+1, &(ih + 1)->ih_key);
set_type (get_ih_key_format(ih+1), &(ih + 1)->ih_key, TYPE_DIRECT);
@@ -807,15 +875,15 @@ static void pass0_correct_leaf (reiserfs_filsys_t * fs,
int err = 0;
if (i > 1) {
if (comp_short_keys (&(ih - 2)->ih_key, &(ih - 1)->ih_key) != -1)
set_bit (1, &err);
misc_set_bit (1, &err);
if (comp_short_keys (&(ih - 2)->ih_key, &ih->ih_key) != -1)
set_bit (2, &err);
misc_set_bit (2, &err);
}
if (i + 1 < nr_items) {
if (comp_short_keys (&(ih - 1)->ih_key, &(ih + 1)->ih_key) != -1)
set_bit (3, &err);
misc_set_bit (3, &err);
if (comp_short_keys (&ih->ih_key, &(ih + 1)->ih_key) != -1)
set_bit (4, &err);
misc_set_bit (4, &err);
}
/*
if ((test_bit (1, err) || test_bit (3, err)) &&
@@ -826,8 +894,8 @@ static void pass0_correct_leaf (reiserfs_filsys_t * fs,
goto start_again;
}
*/
if (!test_bit (1, &err) && !test_bit (3, &err) &&
!test_bit (2, &err) && !test_bit (4, &err)) {
if (!misc_test_bit (1, &err) && !misc_test_bit (3, &err) &&
!misc_test_bit (2, &err) && !misc_test_bit (4, &err)) {
if (i <= 1) {
/* take bigger */
if (comp_short_keys (&(ih - 1)->ih_key, &ih->ih_key) == 1) {
@@ -856,14 +924,14 @@ static void pass0_correct_leaf (reiserfs_filsys_t * fs,
}
}
dirty = 1;
} else if (!test_bit (1, &err) && !test_bit (3, &err)) {
} else if (!misc_test_bit (1, &err) && !misc_test_bit (3, &err)) {
/* take i - 1 */
fsck_log("pass0: vpf-10590: block %lu, item %d: Wrong order of items - "
"change the object_id of the key %k to %lu\n",
bh->b_blocknr, i, &ih->ih_key, get_key_objectid (&(ih - 1)->ih_key));
set_key_objectid (&ih->ih_key, get_key_objectid (&(ih - 1)->ih_key));
dirty = 1;
} else if (!test_bit (2, &err) && !test_bit (4, &err)) {
} else if (!misc_test_bit (2, &err) && !misc_test_bit (4, &err)) {
/* take i */
fsck_log("pass0: vpf-10600: block %lu, item %d: Wrong order of items - "
"change the object_id of the key %k to %lu\n",
@@ -897,7 +965,7 @@ static void pass0_correct_leaf (reiserfs_filsys_t * fs,
if (get_ih_item_len (ih - 1) == SD_SIZE) {
/* stat data is new, therefore this item is new too */
set_offset (KEY_FORMAT_2, &(ih->ih_key), 1);
if (get_ih_entry_count (ih) != 0xffff)
if ((get_ih_entry_count (ih) != 0xffff) && (get_ih_item_len (ih) % 4 == 0))
set_type (KEY_FORMAT_2, &(ih->ih_key), TYPE_INDIRECT);
else
set_type (KEY_FORMAT_2, &(ih->ih_key), TYPE_DIRECT);
@@ -905,7 +973,7 @@ static void pass0_correct_leaf (reiserfs_filsys_t * fs,
} else {
/* stat data is old, therefore this item is old too */
set_offset (KEY_FORMAT_1, &(ih->ih_key), 1);
if (get_ih_entry_count (ih) != 0xffff && (get_ih_item_len (ih) % 4 == 0))
if ((get_ih_entry_count (ih) != 0xffff) && (get_ih_item_len (ih) % 4 == 0))
set_type (KEY_FORMAT_1, &(ih->ih_key), TYPE_INDIRECT);
else {
set_type (KEY_FORMAT_1, &(ih->ih_key), TYPE_DIRECT);
@@ -962,6 +1030,7 @@ static void pass0_correct_leaf (reiserfs_filsys_t * fs,
goto start_again;
}
/* Check the lenght of the direct item; offset should be ok already. */
if (is_direct_ih (ih)) {
if (STORE_TAIL_IN_UNFM (get_offset (&ih->ih_key) + get_ih_item_len (ih) - 1,
get_ih_item_len (ih), bh->b_size))
@@ -993,11 +1062,11 @@ static void pass0_correct_leaf (reiserfs_filsys_t * fs,
delete_item (fs, bh, i);
goto start_again;
}
}
if (is_direct_ih (ih)) {
} else if (is_direct_ih (ih)) {
if (!correct_direct_item_offset (get_offset (&ih->ih_key), key_format (&ih->ih_key)) ||
STORE_TAIL_IN_UNFM (offset + get_ih_item_len (ih) - 1, get_ih_item_len (ih), bh->b_size)) {
((get_offset (&ih->ih_key) % bh->b_size - 1) + get_ih_item_len (ih) > bh->b_size) ||
STORE_TAIL_IN_UNFM (offset + get_ih_item_len (ih) - 1, get_ih_item_len (ih), bh->b_size))
{
fsck_log("pass0: vpf-10210: block %lu, item %d: The item with wrong offset ",
bh->b_blocknr, i);
fsck_log("or length found %k, len % lu - deleted\n", &ih->ih_key, get_ih_item_len (ih));
@@ -1007,7 +1076,7 @@ static void pass0_correct_leaf (reiserfs_filsys_t * fs,
}
offset += get_bytes_number (ih, fs->fs_blocksize);
if (!does_it_fit_into_dev (offset)) {
if (!does_it_fit_into_dev (offset, fs_size)) {
fsck_log("pass0: vpf-10230: block %lu, item %d: The item offset is is too big %k - deleted\n",
bh->b_blocknr, i, &ih->ih_key);
delete_item (fs, bh, i);
@@ -1054,6 +1123,7 @@ static void pass0_correct_leaf (reiserfs_filsys_t * fs,
default:
/* upper item was the first item of a node */
/* to make gcc 3.2 do not sware here */;
}
retval = lower_correct (bh, ih, i);
@@ -1073,8 +1143,8 @@ static void pass0_correct_leaf (reiserfs_filsys_t * fs,
goto start_again;
default:
/* there were only two items in a node, so we could not
decide what to delete, go and ask user */
/* only 2 items in the node, how to decide what to delete, go and ask user */
/* to make gcc 3.2 do not sware here */;
}
fsck_log ("pass0: block %lu, items %d and %d: Which of these items looks better (the other will be deleted.)?\n"
"%k\n%k\n", bh->b_blocknr, i-1, i, &(ih - 1)->ih_key, &ih->ih_key);
@@ -1094,7 +1164,7 @@ static void pass0_correct_leaf (reiserfs_filsys_t * fs,
goto start_again;
}
dirty += correct_key_format (ih);
dirty += correct_key_format (ih, symlnk);
if (is_stat_data_ih (ih)) {
__u16 mode;
@@ -1112,9 +1182,11 @@ static void pass0_correct_leaf (reiserfs_filsys_t * fs,
fsck_log("pass0: vpf-10240: block %lu, item (%d): Item %k, which format (%d) is not equal to StatData "
"format (%d), is deleted\n", bh->b_blocknr, i, &ih->ih_key, get_ih_key_format(ih), file_format);
delete_item (fs, bh, i);
file_format = KEY_FORMAT_UNDEFINED;
goto start_again;
}
} else {
file_format = KEY_FORMAT_UNDEFINED;
symlnk = 0;
}
if (i && is_stat_data_ih (ih - 1) && !not_of_one_file (&ih->ih_key, &(ih - 1)->ih_key)) {
@@ -1208,7 +1280,7 @@ static void pass0_correct_leaf (reiserfs_filsys_t * fs,
}
*/
ind_item = (__u32 *)B_I_PITEM (bh, ih);
for (j = 0; j < I_UNFM_NUM (ih); j ++) {
for (j = 0; j < (int)I_UNFM_NUM (ih); j ++) {
unfm_ptr = le32_to_cpu (ind_item [j]);
if (!unfm_ptr)
continue;
@@ -1247,11 +1319,11 @@ static void pass0_correct_leaf (reiserfs_filsys_t * fs,
for (i = 0; i < get_blkh_nr_items (B_BLK_HEAD (bh)); i ++, ih ++) {
struct reiserfs_de_head * deh;
mark_objectid_really_used (proper_id_map (fs), get_key_dirid (&ih->ih_key));
mark_objectid_really_used (proper_id_map (fs), get_key_objectid (&ih->ih_key));
id_map_mark(proper_id_map (fs), get_key_dirid (&ih->ih_key));
id_map_mark(proper_id_map (fs), get_key_objectid (&ih->ih_key));
if (is_direntry_ih(ih)) {
for (j = 0, deh = B_I_DEH (bh, ih); j < get_ih_entry_count (ih); j ++, deh++)
mark_objectid_really_used(proper_id_map (fs), get_deh_objectid(deh));
id_map_mark(proper_id_map(fs), get_deh_objectid(deh));
}
}
@@ -1259,11 +1331,14 @@ static void pass0_correct_leaf (reiserfs_filsys_t * fs,
/* pass 1 will skip this */
pass_0_stat (fs)->all_contents_removed ++;
// fsck_log ("pass0: block %lu: All items were deleted.\n", bh->b_blocknr);
dirty = 0;
mark_buffer_clean (bh);
} else {
/* pass1 will use this bitmap */
pass0_mark_leaf (bh->b_blocknr);
/*fsck_data (fs)->rebuild.leaves ++;*/
}
if (dirty) {
pass_0_stat (fs)->leaves_corrected ++;
mark_buffer_dirty (bh);
@@ -1318,24 +1393,23 @@ int is_bad_directory (struct item_head * ih, char * item, int dev, int blocksize
for (i = 0; i < get_ih_entry_count (ih); i ++, deh ++) {
entrylen = entry_length(ih, deh, i);
if (entrylen > REISERFS_MAX_NAME_LEN (blocksize)) {
if (entrylen > (int)REISERFS_MAX_NAME_LEN (blocksize))
return 1;
}
if (get_deh_offset (deh) <= prev_offset) {
if (get_deh_offset (deh) <= prev_offset)
return 1;
}
prev_offset = get_deh_offset (deh);
if (get_deh_location(deh) + entrylen != prev_location) {
if (get_deh_location(deh) + entrylen != prev_location)
return 1;
}
prev_location = get_deh_location (deh);
namelen = name_in_entry_length (ih, deh, i);
name = name_in_entry (deh, i);
if (!is_properly_hashed (fs, name, namelen, get_deh_offset (deh))) {
if (!is_properly_hashed (fs, name, namelen, get_deh_offset (deh)))
return 1;
}
}
return 0;
}
@@ -1344,9 +1418,9 @@ int is_bad_directory (struct item_head * ih, char * item, int dev, int blocksize
/* change incorrect block adresses by 0. Do not consider such item as incorrect */
static int is_bad_indirect (struct item_head * ih, char * item, int dev, int blocksize)
{
int i;
int bad = 0;
unsigned long blocks;
unsigned int i;
int bad = 0;
if (get_ih_item_len(ih) % UNFM_P_SIZE) {
fsck_log ("is_bad_indirect: indirect item of %H of invalid length\n", ih);
@@ -1445,11 +1519,18 @@ static void do_pass_0 (reiserfs_filsys_t * fs)
/* just to test pass0_correct_leaf */
bh = bread (fs->fs_dev, fsck_data (fs)->rebuild.test, fs->fs_blocksize);
/*
if (!bh) {
/* we were reading one block at time, and failed, so mark block bad */
fsck_progress ("%s: Reading of the block %lu failed\n", __FUNCTION__,
fsck_data (fs)->rebuild.test);
reiserfs_free (fs);
exit(0);
}
if (is_leaf_bad (bh)) {
fsck_progress ("############### bad #################\n");
}
*/
pass0_correct_leaf (fs, bh);
print_block (stdout, fs, bh, 3, -1, -1);
@@ -1489,7 +1570,7 @@ static void do_pass_0 (reiserfs_filsys_t * fs)
pass_0_stat (fs)->dealt_with ++;
what_node = who_is_this (bh->b_data, bh->b_size);
if ( what_node != THE_LEAF ) {
if ( what_node != THE_LEAF && what_node != HAS_IH_ARRAY ) {
brelse (bh);
continue;
}
@@ -1502,7 +1583,7 @@ static void do_pass_0 (reiserfs_filsys_t * fs)
/* just in case */
mark_objectid_really_used (proper_id_map (fs), REISERFS_ROOT_OBJECTID);
id_map_mark(proper_id_map (fs), REISERFS_ROOT_OBJECTID);
}
@@ -1572,16 +1653,16 @@ int still_bad_unfm_ptr_2 (unsigned long block)
/* these are used to allocate blocks for tree building */
int are_there_allocable_blocks (int amout_needed)
{
int are_there_allocable_blocks (unsigned int amout_needed) {
if (reiserfs_bitmap_zeros (fsck_allocable_bitmap (fs)) < amout_needed) {
int zeros = 0, i;
unsigned int zeros = 0, i;
fsck_progress ("Not enough allocable blocks, checking bitmap...");
for (i = 0; i < fsck_allocable_bitmap (fs)->bm_bit_size; i ++)
for (i = 0; i < fsck_allocable_bitmap (fs)->bm_bit_size; i ++) {
if (!reiserfs_bitmap_test_bit (fsck_allocable_bitmap (fs), i))
zeros ++;
fsck_progress ("there are %d allocable blocks, btw\n", zeros);
}
fsck_progress ("there are %u allocable blocks, btw\n", zeros);
return 0;
}
return 1;
@@ -1609,7 +1690,7 @@ void make_allocable (unsigned long block)
static void choose_hash_function (reiserfs_filsys_t * fs)
{
unsigned long max;
int hash_code;
unsigned int hash_code;
int i;
if (fsck_hash_defined (fs))
@@ -1682,7 +1763,7 @@ static void init_source_bitmap (reiserfs_filsys_t * fs)
case EXTERN_BITMAP:
fp = fopen (fsck_data (fs)->rebuild.bitmap_file_name, "r");
if (!fp)
reiserfs_panic ("Could not load bitmap: %m\n");
reiserfs_panic ("Could not load bitmap: %s\n", strerror(errno));
fsck_source_bitmap (fs) = reiserfs_bitmap_load (fp);
if (!fsck_source_bitmap (fs))
reiserfs_panic ("Could not load fitmap from \"%s\"",
@@ -1778,7 +1859,7 @@ static void before_pass_0 (reiserfs_filsys_t * fs)
make_aux_bitmaps (fs);
/* on pass0 all objectids will be marked here as used */
proper_id_map (fs) = init_id_map ();
proper_id_map (fs) = id_map_init();
/* pass0 gathers statistics about hash hits */
hash_hits_init (fs);
@@ -1802,7 +1883,6 @@ static void save_pass_0_result (reiserfs_filsys_t * fs)
reiserfs_bitmap_save (file, bad_unfm_bitmap);
reiserfs_end_stage_info_save (file);
close_file (file);
retval = unlink (state_dump_file (fs));
retval = rename ("temp_fsck_file.deleteme", state_dump_file (fs));
if (retval != 0)
fsck_progress ("%s: Could not rename the temporary file temp_fsck_file.deleteme to %s",
@@ -1837,7 +1917,7 @@ static void after_pass_0 (reiserfs_filsys_t * fs)
/* update super block: hash, objectid map, fsck state */
choose_hash_function (fs);
flush_objectid_map (proper_id_map (fs), fs);
id_map_flush(proper_id_map (fs), fs);
set_sb_fs_state (fs->fs_ondisk_sb, PASS_0_DONE);
mark_buffer_dirty (fs->fs_super_bh);
@@ -1862,7 +1942,7 @@ static void after_pass_0 (reiserfs_filsys_t * fs)
} else
save_pass_0_result (fs);
free_id_map (proper_id_map (fs));
id_map_free(proper_id_map (fs));
proper_id_map (fs) = 0;
time (&t);
+22 -21
View File
@@ -1,6 +1,8 @@
/*
* Copyright 1996-2002 Hans Reiser
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "fsck.h"
#include <stdlib.h>
@@ -20,17 +22,16 @@ struct buffer_head * make_buffer (int dev, unsigned long blocknr, int size, char
return bh;
// die ("make_buffer: uptodate buffer found");
memcpy (bh->b_data, data, size);
set_bit (BH_Uptodate, (char *)&bh->b_state);
misc_set_bit (BH_Uptodate, (char *)&bh->b_state);
return bh;
}
int find_not_of_one_file(struct key * to_find, struct key * key)
{
if ((get_key_objectid (to_find) != -1) &&
int find_not_of_one_file(struct key * to_find, struct key * key) {
if ((get_key_objectid (to_find) != ~0ul) &&
(get_key_objectid (to_find) != get_key_objectid (key)))
return 1;
if ((get_key_dirid (to_find) != -1) &&
if ((get_key_dirid (to_find) != ~0ul) &&
(get_key_dirid (to_find) != get_key_dirid (key)))
return 1;
return 0;
@@ -97,9 +98,10 @@ static char *still_bad_unfm_ptr_to_string (int val) {
static void indirect_in_tree (struct buffer_head * bh,
struct item_head * ih)
{
int i, ret;
unsigned int i;
__u32 * unp;
__u32 unfm_ptr;
int ret;
unp = (__u32 *)B_I_PITEM (bh, ih);
@@ -244,7 +246,7 @@ static void get_max_buffer_key (struct buffer_head * bh, struct key * key)
int tree_is_empty (void)
{
return (get_sb_root_block (fs->fs_ondisk_sb) == ~0) ? 1 : 0;
return (get_sb_root_block (fs->fs_ondisk_sb) == ~0ul || get_sb_root_block (fs->fs_ondisk_sb) == 0) ? 1 : 0;
}
@@ -336,7 +338,7 @@ static void try_to_insert_pointer_to_leaf (struct buffer_head * new_bh)
static void pass1_correct_leaf (reiserfs_filsys_t * fs,
struct buffer_head * bh)
{
int i, j;
unsigned int i, j;
struct item_head * ih;
__u32 * ind_item;
__u32 unfm_ptr;
@@ -349,7 +351,7 @@ static void pass1_correct_leaf (reiserfs_filsys_t * fs,
struct reiserfs_de_head * deh;
char * name;
int name_len;
int hash_code;
unsigned int hash_code;
deh = B_I_DEH (bh, ih);
for (j = 0; j < get_ih_entry_count (ih); j ++) {
@@ -448,7 +450,7 @@ struct si * remove_saved_item (struct si * si)
on-disk bitmap */
static void init_new_bitmap (reiserfs_filsys_t * fs)
{
int i;
unsigned int i;
unsigned long block;
unsigned long reserved;
@@ -549,7 +551,7 @@ static void find_allocable_blocks (reiserfs_filsys_t * fs)
pass_1_stat (fs)->allocable_blocks ++;
}
}
fsck_progress ("fininshed\n");
fsck_progress ("finished\n");
fs->block_allocator = reiserfsck_reiserfs_new_blocknrs;
fs->block_deallocator = reiserfsck_reiserfs_free_block;
@@ -586,7 +588,7 @@ static void save_pass_1_result (reiserfs_filsys_t * fs)
return;
/* to be able to get a new bitmap on pass2 we should flush it on disk
new_bitmap should not be flushed on disk if run w/out -d option, as
new_bitmap should not be flushed on disk if run without -d option, as
if fsck fails on pass1 we get wrong bitmap on the next fsck start */
reiserfs_flush_to_ondisk_bitmap (fsck_new_bitmap (fs), fs);
@@ -597,7 +599,6 @@ static void save_pass_1_result (reiserfs_filsys_t * fs)
reiserfs_bitmap_save (file, fsck_allocable_bitmap(fs));
reiserfs_end_stage_info_save (file);
close_file (file);
retval = unlink (state_dump_file (fs));
retval = rename ("temp_fsck_file.deleteme", state_dump_file (fs));
if (retval != 0)
fsck_progress ("pass 1: Could not rename the temporary file temp_fsck_file.deleteme to %s",
@@ -622,8 +623,10 @@ void load_pass_1_result (FILE * fp, reiserfs_filsys_t * fs)
/* we need objectid map on pass 2 to be able to relocate files */
proper_id_map (fs) = init_id_map ();
proper_id_map (fs) = id_map_init();
/* Not implemented yet.
fetch_objectid_map (proper_id_map (fs), fs);
*/
fsck_progress ("Pass 1 result loaded. %d blocks used, %d allocable, "
"still to be inserted %d\n",
@@ -666,11 +669,9 @@ static void do_pass_1 (reiserfs_filsys_t * fs)
what_node = who_is_this (bh->b_data, bh->b_size);
if ( what_node != THE_LEAF ) {
fsck_progress ("build_the_tree: Nothing but leaves are expected. "
"Block %lu - %s\n", i,
(what_node == THE_INTERNAL) ? "internal" : "??");
brelse (bh);
continue;
check_memory_msg();
die ("build_the_tree: Nothing but leaves are expected. Block %lu - %s\n",
i, which_block(what_node));
}
if (is_block_used (i) && !(block_of_journal (fs, i) &&
@@ -770,7 +771,7 @@ static void after_pass_1 (reiserfs_filsys_t * fs)
if (proper_id_map (fs)) {
/* when we run pass 1 only - we do not have proper_id_map */
free_id_map (proper_id_map (fs));
id_map_free(proper_id_map (fs));
proper_id_map (fs) = 0;
}
+92 -61
View File
@@ -1,5 +1,6 @@
/*
* Copyright 1996-2002 Hans Reiser
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "fsck.h"
@@ -20,26 +21,22 @@
of directory */
/* in list of this structures we store what has been
relocated. */
/* in list of this structures we store what has been relocated. */
struct relocated {
unsigned long old_dir_id;
unsigned long old_objectid;
unsigned long new_objectid;
/*mode_t mode;*/
struct relocated * next;
};
/* all relocated files will be linked into lost+found directory at the
beginning of semantic pass */
struct relocated * relocated_list;
static struct relocated * relocated_list = NULL;
__u32 get_relocated_objectid_from_list (struct key * key) {
struct relocated * cur;
cur = relocated_list;
static __u32 get_relocated_objectid_from_list (struct key * key) {
struct relocated *cur = relocated_list;
while (cur) {
if (cur->old_dir_id == get_key_dirid (key) &&
@@ -63,7 +60,7 @@ __u32 objectid_for_relocation (struct key * key)
cur = getmem (sizeof (struct relocated));
cur->old_dir_id = get_key_dirid (key);
cur->old_objectid = get_key_objectid (key);
cur->new_objectid = get_unused_objectid (fs);
cur->new_objectid = id_map_alloc(proper_id_map(fs));
cur->next = relocated_list;
relocated_list = cur;
/* fsck_log ("relocation: (%K) is relocated to (%lu, %lu)\n",
@@ -71,6 +68,65 @@ __u32 objectid_for_relocation (struct key * key)
return cur->new_objectid;
}
/* relocated files get added into lost+found with slightly different names */
static __u64 link_one (struct relocated * file) {
char * name;
struct key obj_key;
__u64 len = 0;
asprintf (&name, "%lu,%lu", file->old_dir_id, file->new_objectid);
set_key_dirid (&obj_key, file->old_dir_id);
set_key_objectid (&obj_key, file->new_objectid);
/* 0 for fsck_need does not mean too much - it would make effect if there
* were no this directory yet. But /lost_found is there already */
len = reiserfs_add_entry (fs, &lost_found_dir_key, name,
name_length(name, lost_found_dir_format), &obj_key, 0/*fsck_need*/);
pass_2_stat (fs)->relocated ++;
free (name);
return len;
}
void linked_already(struct key *new_key /*, link_func_t link_func*/) {
struct relocated *cur = relocated_list;
struct relocated *prev = NULL;
while (cur) {
if (cur->old_dir_id == get_key_dirid(new_key) &&
cur->new_objectid == get_key_objectid(new_key))
break;
prev = cur;
cur = cur->next;
}
if (cur) {
/* len = link_func(cur); */
if (prev)
prev->next = cur->next;
else
relocated_list = cur->next;
freemem (cur);
}
}
void link_relocated_files (void)
{
struct relocated * tmp;
int count;
count = 0;
while (relocated_list) {
link_one (relocated_list);
tmp = relocated_list;
relocated_list = relocated_list->next;
freemem (tmp);
count ++;
}
}
/* this item is in tree. All unformatted pointer are correct. Do not
check them */
@@ -318,42 +374,6 @@ static void put_directory_item_into_tree (struct item_head * comingih, char * it
}
/* relocated files get added into lost+found with slightly different names */
static void link_one (struct relocated * file)
{
char * name;
struct key obj_key;
asprintf (&name, "%lu,%lu", file->old_dir_id, file->new_objectid);
set_key_dirid (&obj_key, file->old_dir_id);
set_key_objectid (&obj_key, file->new_objectid);
/* 0 for fsck_need does not mean too much - it would make effect
if there were no this directory yet. But /lost_found is there
already */
reiserfs_add_entry (fs, &lost_found_dir_key, name, name_length (name, lost_found_dir_format),
&obj_key, 0/*fsck_need*/);
pass_2_stat (fs)->relocated ++;
free (name);
}
void link_relocated_files (void)
{
struct relocated * tmp;
int count;
count = 0;
while (relocated_list) {
link_one (relocated_list);
tmp = relocated_list;
relocated_list = relocated_list->next;
freemem (tmp);
count ++;
}
}
void insert_item_separately (struct item_head * ih,
char * item, int was_in_tree)
@@ -424,7 +444,6 @@ static void save_pass_2_result (reiserfs_filsys_t * fs)
reiserfs_begin_stage_info_save(file, TREE_IS_BUILT);
reiserfs_end_stage_info_save (file);
close_file (file);
retval = unlink (state_dump_file (fs));
retval = rename ("temp_fsck_file.deleteme", state_dump_file (fs));
if (retval != 0)
fsck_progress ("%s: Could not rename the temporary file temp_fsck_file.deleteme to %s",
@@ -447,8 +466,10 @@ void load_pass_2_result (reiserfs_filsys_t * fs)
fs->block_deallocator = reiserfsck_reiserfs_free_block;
/* we need objectid map on semantic pass to be able to relocate files */
proper_id_map (fs) = init_id_map ();
proper_id_map (fs) = id_map_init();
/* Not implemented yet.
fetch_objectid_map (proper_id_map (fs), fs);
*/
}
@@ -475,21 +496,21 @@ static void do_pass_2 (reiserfs_filsys_t * fs) {
if (bh == 0) {
fsck_log ("pass_2: Reading of the block (%lu) failed on the device 0x%x\n",
j, fs->fs_dev);
goto next;
goto cont;
}
if (is_block_used (bh->b_blocknr) && !(block_of_journal (fs, bh->b_blocknr) &&
fsck_data(fs)->rebuild.use_journal_area)) {
fsck_log ("%s: The block (%lu) is in the tree already. Should not happen.\n",
fsck_log("%s: The block (%lu) is in the tree already. Should not happen.\n",
__FUNCTION__, bh->b_blocknr);
goto next;
goto cont;
}
/* this must be leaf */
what_node = who_is_this (bh->b_data, bh->b_size);
if (what_node != THE_LEAF) { // || B_IS_KEYS_LEVEL(bh)) {
fsck_log ("%s: The block (%b), marked as a leaf on the first two passes, is not a leaf! Will be skipped.\n",
__FUNCTION__, bh);
goto next;
goto cont;
}
/*
fsck_log ("block %lu is being inserted\n", bh->b_blocknr);
@@ -506,7 +527,7 @@ static void do_pass_2 (reiserfs_filsys_t * fs) {
put_stat_data_items (bh);
print_how_far (fsck_progress_file (fs), &done, total, 1, fsck_quiet (fs));
next:
cont:
brelse (bh);
j ++;
}
@@ -547,7 +568,7 @@ static void after_pass_2 (reiserfs_filsys_t * fs)
/* write all dirty blocks */
fsck_progress ("Flushing..");
flush_objectid_map (proper_id_map (fs), fs);
id_map_flush(proper_id_map (fs), fs);
fs->fs_dirt = 1;
reiserfs_flush_to_ondisk_bitmap (fs->fs_bitmap2, fs);
reiserfs_flush (fs);
@@ -571,7 +592,7 @@ static void after_pass_2 (reiserfs_filsys_t * fs)
save_pass_2_result (fs);
free_id_map (proper_id_map (fs));
id_map_free(proper_id_map (fs));
proper_id_map (fs) = 0;
reiserfs_delete_bitmap (fsck_new_bitmap (fs));
@@ -601,8 +622,18 @@ void pass_2 (reiserfs_filsys_t * fs)
after_pass_2 (fs);
if (get_sb_root_block (fs->fs_ondisk_sb) == -1)
die ("\n\nNo reiserfs metadata found");
if (get_sb_root_block (fs->fs_ondisk_sb) == ~0ul ||
get_sb_root_block (fs->fs_ondisk_sb) == 0)
die ( "\nNo reiserfs metadata found. If you are sure that you had the reiserfs\n"
"on this partition, then the start of the partition might be changed\n"
"or all data were wiped out. The start of the partition may get changed\n"
"by a partitioner if you have used one. Then you probably rebuilt the\n"
"superblock as there was no one. Zero the block at 64K offset from the\n"
"start of the partition (a new super block you have just built) and try\n"
"to move the start of the partition a few cylinders aside and check if\n"
"debugreiserfs /dev/xxx detects a reiserfs super block. If it does this\n"
"is likely to be the right super block version. \n"
"If this makes you nervous, try www.namesys.com/support.html, and for\n"
"$25 the author of fsck, or a colleague if he is out, will step you\n"
"through it all.\n");
}
+5 -2
View File
@@ -1,6 +1,8 @@
/*
* Copyright 1996-2002 Hans Reiser
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "fsck.h"
void pass_4_check_unaccessed_items (void)
@@ -58,6 +60,7 @@ void pass_4_check_unaccessed_items (void)
pathrelse (&path);
cont:
/* to make gcc 3.2 do not sware here */;
}
pathrelse (&path);
@@ -77,7 +80,7 @@ void pass_4_check_unaccessed_items (void)
/* write all dirty blocks */
fsck_progress ("Flushing..");
fs->fs_dirt = 1;
flush_objectid_map (proper_id_map (fs), fs);
id_map_flush(proper_id_map (fs), fs);
reiserfs_flush_to_ondisk_bitmap (fs->fs_bitmap2, fs);
reiserfs_flush (fs);
fsck_progress ("finished\n");
+50 -43
View File
@@ -1,25 +1,26 @@
.\" -*- nroff -*-
.\" Copyright 1996-2002 Hans Reiser.
.\" Copyright 1996-2003 Hans Reiser.
.\"
.TH REISERFSCK 8 "January 2002" "Reiserfsprogs-3.6.4"
.TH REISERFSCK 8 "April 2003" "Reiserfsprogs-3.6.9"
.SH NAME
reiserfsck \- check a Linux Reiserfs file system
.SH SYNOPSIS
.B reiserfsck
[ \fB-afprVy\fR ]
[ \fB--check\fR | \fB--fix-fixable\fR | \fB--rebuild-sb\fR
[ \fB--rebuild-sb\fR | \fB--check\fR | \fB--fix-fixable\fR
| \fB--rebuild-tree\fR | \fB--clean-attributes\fR ]
.\" [ \fB-i\fR | \fB--interactive\fR ]
[ \fB-j\fR | \fB--journal-device\fR \fIdevice\fR ]
[ \fB--no-journal-available\fR ]
[ \fB-z\fR | \fB--adjust-file-size\fR ]
[ \fB-S\fR | \fB--scan-whole-partition\fR ]
[ \fB-l\fR | \fB--logfile \fIfilename\fR ]
[ \fB-j\fR | \fB--journal\fR \fIdevice\fR ]
[ \fB-z\fR | \fB--adjust-size\fR ]
[ \fB-n\fR | \fB--nolog\fR ]
[ \fB-l\fR | \fB--logfile \fIfile\fR ]
[ \fB-q\fR | \fB--quiet\fR ]
[ \fB-y\fR | \fB--yes\fR ]
.\" [ \fB-b\fR | \fB--scan-marked-in-bitmap \fIbitmap-filename\fR ]
.\" [ \fB-h\fR | \fB--hash \fIhash-name\fR ]
.\" [ \fB-g\fR | \fB--background\fR ]
[ \fB-S\fR | \fB--scan-whole-partition\fR ]
[ \fB--no-journal-available\fR ]
.I device
.SH DESCRIPTION
\fBReiserfsck\fR searches for a Reiserfs filesystem on a device, replays
@@ -30,14 +31,16 @@ is the special file corresponding to the device or partition (e.g /dev/hdXX
for IDE disk partition or /dev/sdXX for SCSI disk partition).
.SH OPTIONS
.TP
.B --rebuild-sb
This option recovers the superblock on a Reiserfs partition. Normally you
only need this option if mount reports "read_super_block: can't find
a reiserfs file system" and you are sure that a Reiserfs file system is
there.
.TP
.B --check
This default action checks file system consistency and reports but
does not repair any corruption that it finds. This option may be
used on a read-only file system mount. The \fB--check\fR option exits
with status 0 to indicate that no corruption was found. Otherwise,
\fBreiserfsck\fR returns 1 to indicate corruption that can be fixed with
\fB--fix-fixable\fR and 2 to indicate corruption that requires
\fB--rebuild-tree\fR.
used on a read-only file system mount.
.TP
.B --fix-fixable
This option recovers certain kinds of corruption that do not require
@@ -47,12 +50,6 @@ you only need this option if the \fB--check\fR option reports
zeroing invalid data-block pointers, correcting st_size and st_blocks
for directories, and deleting invalid directory entries.
.TP
.B --rebuild-sb
This option recovers the superblock on a Reiserfs partition. Normally you
only need this option if mount reports "read_super_block: can't find
a reiserfs file system" and you are sure that a Reiserfs file system is
there.
.TP
.B --rebuild-tree
This option rebuilds the entire file system tree using leaf nodes found
on the device. Normally you only need this option if the \fB--check\fR
@@ -63,7 +60,7 @@ before attempting the \fB--rebuild-tree\fR option.
.B --clean-attributes
This option cleans reserved fields of Stat-Data items.
.TP
.B \fB--journal-device \fIdevice \fR, \fB-j \fIdevice \fR
.B \fB--journal \fIdevice \fR, \fB-j \fIdevice \fR
This option supplies the device name of the current file system journal.
This option is required when the journal resides on a separate device
from the main data device (although it can be avoided with the expert
@@ -72,14 +69,14 @@ option \fB--no-journal-available\fR).
.\" .B --interactive, -i
.\" This makes \fBreiserfsck\fR to stop after each pass completed.
.\" .TP
.B --adjust-file-size, -z
.B --adjust-size, -z
This option causes \fBreiserfsck\fR to correct file sizes that
are larger than the offset of the last discovered byte. This
implies that holes at the end of a file will be removed. File
sizes that are smaller than the offset of the last discovered
byte are corrected by --fix-fixable.
.TP
\fB--logfile \fIfilename\fR, \fB-l \fI filename\fR
\fB--logfile \fIfile\fR, \fB-l \fI file\fR
This option causes \fBreiserfsck\fR to report any corruption it finds
to the specified log file rather than stderr.
.TP
@@ -89,22 +86,26 @@ This option prevents \fBreiserfsck\fR from reporting any kinds of corruption.
.B --quiet, -q
This option prevents \fBreiserfsck\fR from reporting its rate of progress.
.TP
.B --yes, -y
This option inhibits \fBreiserfsck\fR from asking you for confirmation after
telling you what it is going to do, assuming yes. For safety, it does not
work with the --rebuild-tree option.
.TP
\fB-a\fR, \fB-p\fR
These options are usually passed by fsck -A during the automatic
checking of /etc/fstab partitions. For compatibility, these options
simply cause reiserfsck to print information about the specified file
system. No checks are performed.
When it is set - \fBreiserfsck\fR assumes that it is called by \fBfsck\fR -A,
provides some information about the specified filesystem and exits.
These options are usually passed by fsck -A during the automatic checking
of those partitions listed in /etc/fstab. These options cause \fBreiserfsck\fR
to print some information about the specified file system, check if error
flags in the superblock are set and do some light-weight checks. If these
checks reveal a corruption or the flag indicating a (possibly fixable)
corruption is found set in the superblock, then \fBreiserfsck\fR switches
to the fix-fixable mode. If the flag indicating a fatal corruption is found
set in the superblock, then \fBreiserfsck\fR finishes with an error.
.TP
.B -V
This option prints the reiserfsprogs version and exit.
.TP
\fB-r\fR, \fB-p\fR, \fB-y\fR
\fB-r\fR, \fB-f\fR
These options are ignored.
.TP
.B -V\fR, \fB-f\fR
prints version and exits
.SH EXPERT OPTIONS
DO NOT USE THESE OPTIONS UNLESS YOU KNOW WHAT YOU ARE DOING.
WE ARE NOT RESPONSIBLE IF YOU LOSE DATA AS A RESULT OF THESE
@@ -142,28 +143,34 @@ the whole partition before proceeding. Then run \fBreiserfsck --rebuild-tree
6. If the \fB--rebuild-tree\fR step fails or does not recover what you expected,
please submit this as a bug report. Try to provide as much information as
possible and we will try to help solve the problem.
SH EXIT CODES
\freiserfsck\fR uses the following exit codes:
.SH EXIT CODES
\fBreiserfsck\fR uses the following exit codes:
.br
\ 0\ \-\ No errors.
\ \fI0\fR \-\ No errors.
.br
\ 1\ \-\ Errors found, \fresierfsck\fR \fB--fix-fixable\fR needs to be launched.
\ \fI1\fR \-\ File system errors corrected.
.br
\ 2\ \-\ Errors found, \fresierfsck\fR \fB--rebuild-tree\fR needs to be launched.
\ \fI4\fR \-\ File system fatal errors left uncorrected,
.br
\ 8\ \-\ Operational error.
\ \fBreiserfsck --rebuild-tree\fR needs to be launched.
.br
\ 16\ \-\ Usage or syntax error.
\ \fI6\fR \-\ File system fixable errors left uncorrected,
.br
\ \fBreiserfsck --fix-fixable\fR needs to be launched.
.br
\ \fI8\fR \-\ Operational error.
.br
\ \fI16\fR \-\ Usage or syntax error.
.br
.SH AUTHOR
This version of \fBreiserfsck\fR has been written by Vitaly Fertman <vitaly@namesys.com>
and Vladimir Saveliev <vs@namesys.com>.
This version of \fBreiserfsck\fR has been written by Vitaly Fertman <vitaly@namesys.com>.
.SH BUGS
There are likely to be some bugs. Please report bugs to the ReiserFS mail-list
<reiserfs-list@namesys.com>.
.SH TODO
Faster recovering, signal handling, i/o error handling, return reasonable exit codes, etc.
Faster recovering, signal handling, i/o error handling, etc.
.SH SEE ALSO
.BR mkreiserfs (8),
.BR debugreiserfs (8),
.BR reiserfstune (8)
.BR resize_reiserfs (8),
.BR debugreiserfs (8),
+53 -38
View File
@@ -1,6 +1,7 @@
/*
* Copyright 1996-2002 Hans Reiser
* Copyright 1996-2003 by Hans Reiser, licensing governed by reiserfsprogs/README
*/
#include "fsck.h"
static struct key *trunc_links = NULL;
@@ -9,8 +10,8 @@ static __u32 links_num = 0;
int wrong_mode (struct key * key, __u16 * mode, __u64 real_size, int symlink);
int wrong_st_blocks(struct key * key, __u32 * blocks, __u32 sd_blocks, __u16 mode,
int new_format);
int wrong_st_size (struct key * key, loff_t max_file_size, int blocksize,
__u64 * size, __u64 sd_size, int is_dir);
int wrong_st_size (struct key * key, unsigned long long max_file_size, int blocksize,
__u64 * size, __u64 sd_size, int type);
int wrong_first_direct_byte (struct key * key, int blocksize, __u32 * first_direct_byte,
__u32 sd_first_direct_byte, __u32 size);
void get_object_key (struct reiserfs_de_head * deh, struct key * key,
@@ -97,7 +98,6 @@ static int check_check_regular_file (struct path * path, void * sd,
__u32 blocks, sd_blocks; /* proper values and value in stat data */
__u32 first_direct_byte, sd_first_direct_byte;
struct buffer_head * bh;
struct item_head * ih, sd_ih;
int fix_sd;
int symlnk = 0;
@@ -106,14 +106,14 @@ static int check_check_regular_file (struct path * path, void * sd,
ih = get_ih (path);
bh = get_bh (path);
if (new_ih) {
/* this objectid is used already */
*new_ih = *ih;
pathrelse (path);
rewrite_file (new_ih, 1, 1);
one_less_corruption (fs, fixable);
linked_already(&new_ih->ih_key);
one_less_corruption (fs, FIXABLE);
sem_pass_stat (fs)->oid_sharing_files_relocated ++;
retval = RELOCATED;
if (reiserfs_search_by_key_4 (fs, &(new_ih->ih_key), path) == ITEM_NOT_FOUND)
@@ -121,7 +121,6 @@ static int check_check_regular_file (struct path * path, void * sd,
"the relocated file %K", &new_ih->ih_key);
/* stat data is marked unreachable again due to relocation, fix that */
ih = get_ih (path);
bh = get_bh (path);
sd = get_item (path);
}
@@ -162,7 +161,7 @@ static int check_check_regular_file (struct path * path, void * sd,
if (are_file_items_correct (&sd_ih, sd, &real_size, &blocks, 0/* do not mark reachable */,
&symlnk) != 1)
{
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
fsck_log ("check_regular_file: The file %K with the corrupted structure found\n",
&sd_ih.ih_key);
} else {
@@ -177,7 +176,8 @@ static int check_check_regular_file (struct path * path, void * sd,
&tmp_position, comp_short_keys) != POSITION_FOUND)
{
fix_sd += wrong_st_size (&sd_ih.ih_key, is_new_file ? MAX_FILE_SIZE_V2 :
MAX_FILE_SIZE_V1, fs->fs_blocksize, &real_size, sd_size, 0/*not dir*/);
MAX_FILE_SIZE_V1, fs->fs_blocksize, &real_size, sd_size,
symlnk ? TYPE_SYMLINK : 0);
} else {
real_size = sd_size;
}
@@ -186,12 +186,13 @@ static int check_check_regular_file (struct path * path, void * sd,
if (fix_sd) {
if (fsck_mode (fs) == FSCK_FIX_FIXABLE) {
struct buffer_head * bh;
/* find stat data and correct it */
set_type_and_offset (KEY_FORMAT_1, &sd_ih.ih_key, SD_OFFSET, TYPE_STAT_DATA);
if (reiserfs_search_by_key_4 (fs, &sd_ih.ih_key, path) != ITEM_FOUND) {
fsck_log ("check_regular_file: A StatData of the file %K cannot be "
"found\n", &sd_ih.ih_key);
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
return STAT_DATA_NOT_FOUND;
}
@@ -209,7 +210,7 @@ static int check_check_regular_file (struct path * path, void * sd,
}
}
}
return OK;
return retval;
}
/* returns buffer, containing found directory item.*/
@@ -256,7 +257,7 @@ start_again:
fsck_log (" - entry was added\n");
goto start_again;
} else {
one_more_corruption (fs, fixable);
one_more_corruption (fs, FIXABLE);
fsck_log ("\n");
if (retval == DIRECTORY_NOT_FOUND)
return 0;
@@ -279,12 +280,12 @@ start_again:
/* mark hidden entries as visible, set "." and ".." correctly */
deh += *pos_in_item;
for (i = *pos_in_item; i < get_ih_entry_count (ih); i ++, deh ++) {
int namelen;
/* int namelen;
char * name;
name = name_in_entry (deh, i);
namelen = name_in_entry_length (ih, deh, i);
/* if (de_hidden (deh)) // handled in check_tree
if (de_hidden (deh)) // handled in check_tree
reiserfs_panic ("get_next_directory_item: item %k: hidden entry %d \'%.*s\'\n",
key, i, namelen, name);
*/
@@ -337,7 +338,7 @@ start_again:
set_key_objectid (key, 0);
}
if (fsck_mode (fs) != FSCK_CHECK && fsck_mode (fs) != FSCK_FIX_FIXABLE)
if (fsck_mode (fs) == FSCK_REBUILD)
mark_item_reachable (get_ih (&path), bh);
pathrelse (&path);
@@ -364,17 +365,17 @@ static int check_semantic_pass (struct key * key, struct key * parent, int dot_d
__u64 sd_size;
__u32 sd_blocks;
int fix_sd;
int relocate;
/*int relocate;*/
int dir_format = 0;
__u16 mode;
retval = OK;
start_again: /* when directory was relocated */
/* start_again: when directory was relocated */
if (!KEY_IS_STAT_DATA_KEY (key)) {
fsck_log ("check_semantic_pass: The key %k must be key of a StatData\n", key);
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
return STAT_DATA_NOT_FOUND;
}
@@ -389,27 +390,39 @@ static int check_semantic_pass (struct key * key, struct key * parent, int dot_d
sd = get_item(&path);
get_sd_nlink (ih, sd, &nlink);
relocate = should_be_relocated(&ih->ih_key);
/* It seems quite difficult to relocate objects on fix-fixable -
* rewrite_file calls reiserfs_file_write which can convert tails
* to unfm, plus unreachable, was_tail flags, etc. */
if ((/* relocate = */ should_be_relocated(&ih->ih_key))) {
/*
if (fsck_mode(fs) == FSCK_CHECK)
relocate = 0;
*/
one_more_corruption(fs, FATAL);
}
if (fix_obviously_wrong_sd_mode (&path)) {
one_more_corruption (fs, fixable);
one_more_corruption (fs, FIXABLE);
pathrelse (&path);
return OK;
}
if (nlink == 0) {
fsck_log ("%s: block %lu: The StatData %k has bad nlink number (%u)\n",
__FUNCTION__, get_bh(&path)->b_blocknr, &ih->ih_key, nlink);
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
}
if (not_a_directory (sd)) {
fsck_check_stat (fs)->files ++;
retval = check_check_regular_file (&path, sd, relocate ? new_ih : 0);
retval = check_check_regular_file (&path, sd, /* relocate ? new_ih : */ 0);
pathrelse (&path);
return retval;
}
/*
if (relocate) {
if (!new_ih)
reiserfs_panic ("check_semantic_pass: Memory is not prepared for relocation of "
@@ -418,12 +431,13 @@ static int check_semantic_pass (struct key * key, struct key * parent, int dot_d
pathrelse (&path);
sem_pass_stat (fs)->oid_sharing_dirs_relocated ++;
relocate_dir (new_ih, 1);
one_less_corruption (fs, fixable);
linked_already(&new_ih->ih_key);
one_less_corruption (fs, FIXABLE);
*key = new_ih->ih_key;
retval = RELOCATED;
goto start_again;
}
*/
/*
if (fsck_mode (fs) == FSCK_FIX_FIXABLE) {
@@ -489,6 +503,7 @@ static int check_semantic_pass (struct key * key, struct key * parent, int dot_d
for (i = pos_in_item; i < get_ih_entry_count (&tmp_ih); i ++, deh ++) {
struct item_head relocated_ih;
int ret = OK;
if (name) {
free (name);
@@ -515,7 +530,7 @@ static int check_semantic_pass (struct key * key, struct key * parent, int dot_d
fsck_log ("Entry %K (\"%.*s\") in the directory %K is not formated "
"properly.\n", (struct key *)&(deh->deh2_dir_id), namelen, name,
&tmp_ih.ih_key);
one_more_corruption (fs, fixable);
one_more_corruption (fs, FIXABLE);
}
}
@@ -523,17 +538,17 @@ static int check_semantic_pass (struct key * key, struct key * parent, int dot_d
print_name (name, namelen);
if (!is_properly_hashed (fs, name, namelen, get_deh_offset (deh))) {
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
fsck_log ("check_semantic_pass: Hash mismatch detected for (%.*s) in "
"directory %K\n", namelen, name, &tmp_ih.ih_key);
}
if (is_dot (name, namelen) || (is_dot_dot (name, namelen))) {
/* do not go through "." and ".." */
retval = OK;
ret = OK;
} else {
if ((retval = add_path_key (&object_key)) == 0) {
retval = check_semantic_pass (&object_key, key,
if ((ret = add_path_key (&object_key)) == 0) {
ret = check_semantic_pass (&object_key, key,
is_dot_dot(name, namelen), &relocated_ih);
del_path_key ();
}
@@ -542,7 +557,7 @@ static int check_semantic_pass (struct key * key, struct key * parent, int dot_d
erase_name (namelen);
/* check what check_semantic_tree returned */
switch (retval) {
switch (ret) {
case OK:
dir_size += DEH_SIZE + entry_len;
break;
@@ -555,7 +570,7 @@ static int check_semantic_pass (struct key * key, struct key * parent, int dot_d
reiserfs_remove_entry (fs, &entry_key);
fsck_log (" - removed");
} else {
one_more_corruption (fs, fixable);
one_more_corruption (fs, FIXABLE);
}
fsck_log ("\n");
break;
@@ -619,7 +634,7 @@ static int check_semantic_pass (struct key * key, struct key * parent, int dot_d
fix_sd = 0;
fix_sd += wrong_st_blocks (key, &blocks, sd_blocks, mode, is_new_dir);
fix_sd += wrong_st_size (key, is_new_dir ? MAX_FILE_SIZE_V2 : MAX_FILE_SIZE_V1,
fs->fs_blocksize, &dir_size, sd_size, 1/*dir*/);
fs->fs_blocksize, &dir_size, sd_size, TYPE_DIRENTRY);
if (fix_sd) {
if (fsck_mode (fs) == FSCK_FIX_FIXABLE) {
@@ -627,7 +642,7 @@ static int check_semantic_pass (struct key * key, struct key * parent, int dot_d
if (reiserfs_search_by_key_4 (fs, key, &path) != ITEM_FOUND) {
fsck_log ("check_semantic_tree: The StatData of the file %K was not found\n",
key);
one_more_corruption(fs, fatal);
one_more_corruption(fs, FATAL);
return STAT_DATA_NOT_FOUND;
}
@@ -692,7 +707,7 @@ int check_safe_links ()
if (fsck_mode(fs) == FSCK_CHECK) {
fsck_log ("Invalid safe link %k: cannot find the pointed object (%K)\n",
&tmp_ih->ih_key, &key);
one_more_corruption (fs, fixable);
one_more_corruption (fs, FIXABLE);
} else if (fsck_mode(fs) == FSCK_FIX_FIXABLE) {
fsck_log ("Invalid safe link %k: cannot find the pointed object (%K) - "
"safe link was deleted\n", &tmp_ih->ih_key, &key);
@@ -709,7 +724,7 @@ int check_safe_links ()
if (fsck_mode(fs) == FSCK_CHECK) {
fsck_log ("Invalid 'truncate' safe link %k, cannot happen for "
"directory (%K)\n", &tmp_ih->ih_key, &key);
one_more_corruption (fs, fixable);
one_more_corruption (fs, FIXABLE);
} else if (fsck_mode(fs) == FSCK_FIX_FIXABLE) {
fsck_log ("Invalid 'truncate' safe link %k, cannot happen for "
"a directory (%K) - safe link was deleted\n", &tmp_ih->ih_key, &key);
@@ -725,7 +740,7 @@ int check_safe_links ()
if (reiserfs_bin_search (&key, trunc_links, links_num, sizeof(key),
&position, comp_short_keys) != POSITION_FOUND)
{
blocklist__insert_in_position(&key, (void **)&trunc_links, &links_num,
blocklist__insert_in_position(&key, (void *)&trunc_links, &links_num,
sizeof(key), &position);
}
}
@@ -771,7 +786,7 @@ void semantic_check (void)
if (check_semantic_pass (&root_dir_key, &parent_root_dir_key, 0, 0) != OK) {
fsck_log ("check_semantic_tree: No root directory found");
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
}
release_safe_links ();
+52 -35
View File
@@ -1,6 +1,8 @@
/*
* Copyright 1996-2002 Hans Reiser
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "fsck.h"
int screen_width;
@@ -93,14 +95,14 @@ void erase_name (int len)
/* *size is "real" file size, sd_size - size from stat data */
int wrong_st_size (struct key * key, loff_t max_file_size, int blocksize,
__u64 * size, __u64 sd_size, int is_dir)
int wrong_st_size (struct key * key, unsigned long long max_file_size,
int blocksize, __u64 * size, __u64 sd_size, int type)
{
if (sd_size <= max_file_size) {
if (sd_size == *size)
return 0;
if (is_dir) {
if (type == TYPE_DIRENTRY) {
/* directory size must match to the sum of length of its entries */
fsck_log ("vpf-10650: The directory %K has the wrong size in the StatData "
"(%Ld)%s(%Ld)\n", key, sd_size, fsck_mode(fs) == FSCK_CHECK ?
@@ -110,10 +112,11 @@ int wrong_st_size (struct key * key, loff_t max_file_size, int blocksize,
if (sd_size > *size) {
/* size in stat data can be bigger than size calculated by items */
if (fsck_adjust_file_size (fs)) {
if (fsck_adjust_file_size (fs) || type == TYPE_SYMLINK) {
/* but it -o is given - fix that */
fsck_log ("vpf-10660: The file %K has too big size in the StatData (%Ld) "
"- corrected to (%Ld)\n", key, sd_size, *size);
fsck_log ("vpf-10660: The file %K has too big size in the StatData "
"(%Ld)%s(%Ld)\n", key, sd_size, fsck_mode(fs) == FSCK_CHECK ?
", should be " : " - corrected to ", *size);
sem_pass_stat (fs)->fixed_sizes ++;
return 1;
}
@@ -142,7 +145,7 @@ int wrong_st_size (struct key * key, loff_t max_file_size, int blocksize,
}
}
fsck_log ("vpf-10670: The file %K has wrong size in StatData (%Ld)%s(%Ld)\n", key,
fsck_log ("vpf-10670: The file %K has the wrong size in the StatData (%Ld)%s(%Ld)\n", key,
sd_size, fsck_mode(fs) == FSCK_CHECK ? ", should be " : " - corrected to ",
*size);
sem_pass_stat (fs)->fixed_sizes ++;
@@ -404,6 +407,7 @@ int rebuild_check_regular_file (struct path * path, void * sd,
*new_ih = *ih;
pathrelse (path);
rewrite_file (new_ih, 1, 1);
linked_already(&new_ih->ih_key);
sem_pass_stat (fs)->oid_sharing_files_relocated ++;
retval = RELOCATED;
if (reiserfs_search_by_key_4 (fs, &(new_ih->ih_key), path) == ITEM_NOT_FOUND)
@@ -414,7 +418,10 @@ int rebuild_check_regular_file (struct path * path, void * sd,
bh = get_bh (path);
mark_item_reachable (ih, bh);
sd = get_item (path);
}
id_map_mark(semantic_id_map(fs), get_key_objectid (&ih->ih_key));
/* check and set nlink first */
get_sd_nlink (ih, sd, &nlink);
@@ -423,7 +430,7 @@ int rebuild_check_regular_file (struct path * path, void * sd,
mark_buffer_dirty (bh);
if (nlink > 1)
return OK;
return retval;
/* firts name of a file found */
if (get_ih_item_len (ih) == SD_SIZE)
@@ -452,7 +459,9 @@ int rebuild_check_regular_file (struct path * path, void * sd,
// sd_key = sd_ih.ih_key;
pathrelse (path);
if (are_file_items_correct (&sd_ih, sd, &real_size, &blocks, 1/*mark items reachable*/, &symlnk) != 1) {
if (are_file_items_correct (&sd_ih, sd, &real_size, &blocks, 1/*mark items reachable*/,
&symlnk) != 1)
{
/* unpassed items will be deleted in pass 4 as they left unaccessed */
sem_pass_stat (fs)->broken_files ++;
}
@@ -463,10 +472,11 @@ int rebuild_check_regular_file (struct path * path, void * sd,
if (!is_new_file)
fix_sd += wrong_first_direct_byte (&sd_ih.ih_key, fs->fs_blocksize,
&first_direct_byte, saved_first_direct_byte, real_size);
&first_direct_byte, saved_first_direct_byte, real_size);
fix_sd += wrong_st_size (/*&sd_key,*/ &sd_ih.ih_key, is_new_file ? MAX_FILE_SIZE_V2 : MAX_FILE_SIZE_V1,
fs->fs_blocksize, &real_size, saved_size, 0/*not dir*/);
fix_sd += wrong_st_size (/*&sd_key,*/ &sd_ih.ih_key,
is_new_file ? MAX_FILE_SIZE_V2 : MAX_FILE_SIZE_V1,
fs->fs_blocksize, &real_size, saved_size, symlnk ? TYPE_SYMLINK : 0);
fix_sd += wrong_st_blocks (&sd_ih.ih_key, &blocks, saved_blocks, mode, is_new_file);
@@ -474,7 +484,8 @@ int rebuild_check_regular_file (struct path * path, void * sd,
/* find stat data and correct it */
set_type_and_offset (KEY_FORMAT_1, &sd_ih.ih_key, SD_OFFSET, TYPE_STAT_DATA);
if (reiserfs_search_by_key_4 (fs, &sd_ih.ih_key, path) != ITEM_FOUND)
reiserfs_panic ("%s: The StatData of the file %k could not be found", __FUNCTION__, &sd_ih.ih_key);
reiserfs_panic ("%s: The StatData of the file %k could not be found",
__FUNCTION__, &sd_ih.ih_key);
bh = get_bh (path);
ih = get_ih (path);
@@ -517,7 +528,8 @@ static char * get_next_directory_item (struct key * key, /* on return this will
if ((retval = reiserfs_search_by_entry_key (fs, key, &path)) != POSITION_FOUND)
reiserfs_panic ("get_next_directory_item: The current directory %k cannot be found", key);
reiserfs_panic ("get_next_directory_item: The current directory %k cannot be "
"found", key);
/* leaf containing directory item */
bh = PATH_PLAST_BUFFER (&path);
@@ -590,7 +602,7 @@ static char * get_next_directory_item (struct key * key, /* on return this will
set_key_objectid (key, 0);
}
if (fsck_mode (fs) != FSCK_CHECK && fsck_mode (fs) != FSCK_FIX_FIXABLE)
if (fsck_mode (fs) == FSCK_REBUILD)
mark_item_reachable (get_ih (&path), bh);
pathrelse (&path);
@@ -640,8 +652,8 @@ int fix_obviously_wrong_sd_mode (struct path * path) {
mark_buffer_dirty (get_bh(path));
} else {
fsck_log ("\n");
retval = 1;
}
retval = 1;
} else if (!not_a_directory (get_item (path)) && !is_direntry_key (next_key)) {
/* make SD mode SD of regular file */
get_sd_mode (get_ih (path), get_item (path), &mode);
@@ -654,9 +666,9 @@ int fix_obviously_wrong_sd_mode (struct path * path) {
mark_buffer_dirty (get_bh(path));
} else {
fsck_log ("\n");
retval = 1;
}
retval = 1;
}
return retval;
@@ -719,15 +731,14 @@ int rebuild_semantic_pass (struct key * key, struct key * parent, int dot_dot,
relocate = 0;
if (!nlink) {
/* we reached the stat data for the first time */
if (is_objectid_really_used (semantic_id_map (fs), get_key_objectid (&ih->ih_key), &pos_in_item)) {
if (id_map_mark(semantic_id_map(fs), get_key_objectid (&ih->ih_key))) {
/* calculate number of found files/dirs who are using objectid
which is used by another file */
sem_pass_stat (fs)->oid_sharing ++;
if (1/*fsck_adjust_file_size (fs)*/)
/* this works for files only */
relocate = 1;
} else
__mark_objectid_really_used (semantic_id_map (fs), get_key_objectid (&ih->ih_key), pos_in_item);
}
mark_item_reachable (ih, bh);
}
@@ -742,13 +753,16 @@ int rebuild_semantic_pass (struct key * key, struct key * parent, int dot_dot,
if (relocate) {
if (!new_ih)
reiserfs_panic ("rebuild_semantic_pass: Memory is not prepared for relocation of %K", &ih->ih_key);
reiserfs_panic ("rebuild_semantic_pass: Memory is not prepared for relocation of %K",
&ih->ih_key);
*new_ih = *ih;
pathrelse (&path);
sem_pass_stat (fs)->oid_sharing_dirs_relocated ++;
relocate_dir (new_ih, 1);
*key = new_ih->ih_key;
linked_already(&new_ih->ih_key);
*key = new_ih->ih_key;
retval = RELOCATED;
goto start_again;
}
@@ -859,7 +873,7 @@ int rebuild_semantic_pass (struct key * key, struct key * parent, int dot_dot,
if ((dir_format == KEY_FORMAT_2) && (entry_len % 8 != 0)) {
/* not alighed directory of new format - delete it */
fsck_log ("Entry %K (\"%.*s\") in the directory %K is not formated properly - deleted\n",
fsck_log ("Entry %K (\"%.*s\") in the directory %K is not formated properly - fixed.\n",
(struct key *)&(deh->deh2_dir_id), namelen, name, &tmp_ih.ih_key);
reiserfs_remove_entry (fs, &entry_key);
entry_len = name_length (name, dir_format);
@@ -957,7 +971,7 @@ int rebuild_semantic_pass (struct key * key, struct key * parent, int dot_dot,
fix_sd = 0;
fix_sd += wrong_st_blocks (key, &blocks, saved_blocks, mode, is_new_dir);
fix_sd += wrong_st_size (key, is_new_dir ? MAX_FILE_SIZE_V2 : MAX_FILE_SIZE_V1,
fs->fs_blocksize, &dir_size, saved_size, 1/*dir*/);
fs->fs_blocksize, &dir_size, saved_size, TYPE_DIRENTRY);
if (fix_sd) {
/* we have to fix either sd_size or sd_blocks, so look for stat data again */
@@ -1042,7 +1056,7 @@ static void make_sure_lost_found_exists (reiserfs_filsys_t * fs)
{
int retval;
INITIALIZE_PATH (path);
int gen_counter;
unsigned int gen_counter;
__u32 objectid;
__u64 sd_size;
__u32 sd_blocks;
@@ -1057,7 +1071,7 @@ static void make_sure_lost_found_exists (reiserfs_filsys_t * fs)
"lost+found", &gen_counter,
&lost_found_dir_key);
if (!retval) {
objectid = get_unused_objectid (fs);
objectid = id_map_alloc(proper_id_map(fs));
if (!objectid) {
fsck_progress ("Could not allocate an objectid for \"/lost+found\", \
lost files will not be linked\n");
@@ -1133,10 +1147,11 @@ static void save_rebuild_semantic_result (reiserfs_filsys_t * fs) {
return;
reiserfs_begin_stage_info_save (file, SEMANTIC_DONE);
/* Method not implemented yet.
reiserfs_objectid_map_save (file, semantic_id_map (fs));
*/
reiserfs_end_stage_info_save (file);
close_file (file);
retval = unlink (state_dump_file (fs));
retval = rename ("temp_fsck_file.deleteme", state_dump_file (fs));
if (retval != 0)
fsck_progress ("%s: Could not rename the temporary file temp_fsck_file.deleteme to %s",
@@ -1158,14 +1173,16 @@ void load_semantic_result (FILE * file, reiserfs_filsys_t * fs)
fs->block_deallocator = reiserfsck_reiserfs_free_block;
/* we need objectid map on semantic pass to be able to relocate files */
proper_id_map (fs) = init_id_map ();
proper_id_map (fs) = id_map_init();
/* Not implemented yet.
fetch_objectid_map (proper_id_map (fs), fs);
semantic_id_map (fs) = reiserfs_objectid_map_load (file);
*/
}
static void before_pass_3 (reiserfs_filsys_t * fs)
{
semantic_id_map (fs) = init_id_map ();
semantic_id_map (fs) = id_map_init();
}
static void after_pass_3 (reiserfs_filsys_t * fs)
@@ -1176,7 +1193,7 @@ static void after_pass_3 (reiserfs_filsys_t * fs)
/* write all dirty blocks */
fsck_progress ("Flushing..");
flush_objectid_map (proper_id_map (fs), fs);
id_map_flush(proper_id_map (fs), fs);
fs->fs_dirt = 1;
reiserfs_flush_to_ondisk_bitmap (fsck_new_bitmap(fs), fs);
reiserfs_flush (fs);
@@ -1192,7 +1209,7 @@ static void after_pass_3 (reiserfs_filsys_t * fs)
save_rebuild_semantic_result (fs);
free_id_map (proper_id_map (fs));
id_map_free(proper_id_map (fs));
proper_id_map (fs) = 0;
fs->fs_dirt = 1;
@@ -1207,7 +1224,7 @@ void pass_3_semantic (reiserfs_filsys_t * fs)
fsck_progress ("Pass 3 (semantic):\n");
/* when warnings go not to stderr - separate then in the log */
/* when warnings go not to stderr - separate them in the log */
if (fsck_log_file (fs) != stderr)
fsck_log ("####### Pass 3 #########\n");
@@ -1218,8 +1235,8 @@ void pass_3_semantic (reiserfs_filsys_t * fs)
make_sure_root_dir_exists (fs, modify_item, 1 << IH_Unreachable);
make_sure_lost_found_exists (fs);
mark_objectid_really_used (proper_id_map (fs), get_key_objectid (&root_dir_key));
mark_objectid_really_used (proper_id_map (fs), get_key_objectid (&lost_found_dir_key));
id_map_mark(proper_id_map(fs), get_key_objectid(&root_dir_key));
id_map_mark(proper_id_map(fs), get_key_objectid(&lost_found_dir_key));
/* link all relocated files into /lost+found directory */
link_relocated_files ();
+334 -171
View File
@@ -1,5 +1,11 @@
/*
* Copyright 2001-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "fsck.h"
#include <stdlib.h>
#include <errno.h>
#define fsck_conditional_log(sb_found, fmt, list...) { \
if (sb_found) \
@@ -11,7 +17,7 @@ int what_fs_version ()
size_t n = 0;
char * answer = 0;
int version;
printf("\nwhat is version of ReiserFS you use[1-4]\n"
printf("\nwhat the version of ReiserFS do you use[1-4]\n"
"\t(1) 3.6.x\n"
"\t(2) >=3.5.9 (introduced in the middle of 1999) (if you use linux 2.2, choose this one)\n"
"\t(3) < 3.5.9 converted to new format (don't choose if unsure)\n"
@@ -24,12 +30,12 @@ int what_fs_version ()
return version;
}
/*
#define super_error(exit_code, text) { \
fsck_log(text); \
return exit_code; \
}
/*
int check_sb (reiserfs_filsys_t * fs) {
int magic = 0, version = 0;
@@ -165,6 +171,7 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
int version = 0;
struct reiserfs_super_block * ondisk_sb = 0;
struct reiserfs_super_block * sb = 0;
struct reiserfs_journal_header *j_head;
int magic_was_found = 0;
unsigned long block_count = 0;
@@ -179,8 +186,8 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
char * answer = 0;
size_t n = 0;
struct stat stat_buf;
int retval;
struct stat64 stat_buf;
int retval, exit_code = EXIT_OK;
if (!no_reiserfs_found (fs)) {
sb = getmem (sizeof (*sb));
@@ -195,9 +202,10 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
if (strcmp(answer, "\n")) {
retval = (int) strtol (answer, &tmp, 0);
if ((*tmp && strcmp(tmp, "\n")) || retval < 0)
reiserfs_exit (16, "rebuild_sb: wrong block size specified\n");
reiserfs_exit (EXIT_USER, "rebuild_sb: wrong block size specified\n");
if (!is_blocksize_correct (retval))
reiserfs_exit (16, "rebuild_sb: wrong block size specified, only divisible by 1024 are supported currently\n");
reiserfs_exit (EXIT_USER, "rebuild_sb: wrong block size specified, "
"only power of 2 from 512-8192 interval are supported.\n");
} else
retval = 4096;
@@ -215,42 +223,57 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
/* 3_6 magic */
if (fsck_data (fs)->journal_dev_name)
/* journal dev must not be specified with standard journal */
reiserfs_exit (16, "Reiserfs with standard journal found, but there was specified a journal dev");
reiserfs_exit (EXIT_USER, "ReiserFS with default journal "
"is found, but there was specified a journal device.");
if (get_jp_journal_1st_block(sb_jp(sb)) == get_journal_new_start_must (fs))
if (fs->fs_super_bh->b_blocknr ==
REISERFS_DISK_OFFSET_IN_BYTES / fs->fs_blocksize)
version = 1;
else if (get_jp_journal_1st_block(sb_jp(sb)) == get_journal_old_start_must (fs))
else if (fs->fs_super_bh->b_blocknr ==
REISERFS_OLD_DISK_OFFSET_IN_BYTES / fs->fs_blocksize)
version = 3;
magic_was_found = 2;
} else if (is_reiserfs_3_5_magic_string (sb)) {
if (fsck_data (fs)->journal_dev_name)
/* journal dev must not be specified with standard journal */
reiserfs_exit (16, "Reiserfs with standard journal found, but there was specified a journal dev");
reiserfs_exit (EXIT_USER, "ReiserFS with default journal "
"is found, but there was specified a journal device.");
/* 3_5 magic */
if (get_jp_journal_1st_block(sb_jp(sb)) == get_journal_new_start_must (fs))
if (fs->fs_super_bh->b_blocknr ==
REISERFS_DISK_OFFSET_IN_BYTES / fs->fs_blocksize)
version = 2;
else if (get_jp_journal_1st_block(sb_jp(sb)) == get_journal_old_start_must (fs))
else if (fs->fs_super_bh->b_blocknr ==
REISERFS_OLD_DISK_OFFSET_IN_BYTES / fs->fs_blocksize)
version = 4;
magic_was_found = 1;
magic_was_found = 1;
} else if (is_reiserfs_jr_magic_string (sb)) {
if (!fsck_data (fs)->journal_dev_name)
if (!fsck_data (fs)->journal_dev_name && !fsck_skip_journal(fs))
/* journal dev must be specified with non standard journal */
reiserfs_exit (16, "Reiserfs with non standard journal found, but there was not specified any journal dev");
reiserfs_exit (EXIT_USER, "ReiserFS with non default journal "
"is found, but there was not specified any journal device.");
if (get_sb_version (sb) == REISERFS_FORMAT_3_6) {
/*non-standard magic + sb_format == 3_6*/
if (get_jp_journal_1st_block(sb_jp(sb)) == get_journal_new_start_must (fs))
if (fs->fs_super_bh->b_blocknr ==
REISERFS_DISK_OFFSET_IN_BYTES / fs->fs_blocksize)
version = 1;
else if (get_jp_journal_1st_block(sb_jp(sb)) == get_journal_old_start_must (fs))
else if (fs->fs_super_bh->b_blocknr ==
REISERFS_OLD_DISK_OFFSET_IN_BYTES / fs->fs_blocksize)
version = 3;
magic_was_found = 3;
} else if (get_sb_version (sb) == REISERFS_FORMAT_3_5) {
/* non-standard magic + sb_format == 3_5 */
if (get_jp_journal_1st_block(sb_jp(sb)) == get_journal_new_start_must (fs))
if (fs->fs_super_bh->b_blocknr ==
REISERFS_DISK_OFFSET_IN_BYTES / fs->fs_blocksize)
version = 2;
else if (get_jp_journal_1st_block(sb_jp(sb)) == get_journal_old_start_must (fs))
else if (fs->fs_super_bh->b_blocknr ==
REISERFS_OLD_DISK_OFFSET_IN_BYTES / fs->fs_blocksize)
version = 4;
magic_was_found = 3;
} else {
/* non-standard magic + bad sb_format */
@@ -258,7 +281,8 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
magic_was_found = 3;
}
} else
reiserfs_exit (16, "we opened device but there is no magic and there is no correct superbblock format found");
reiserfs_exit (EXIT_USER, "We opened device but there is no magic "
"and there is no correct superblock format found.");
if (magic_was_found == 1 || magic_was_found == 2)
standard_journal = 1;
@@ -272,7 +296,10 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
do {
printf("\nDid you use resizer(y/n)[n]: ");
getline (&answer, &n, stdin);
} while (strcmp ("y\n", answer) && strcmp ("n\n", answer) && strcmp ("\n", answer));
} while(strcmp ("y\n", answer) &&
strcmp ("n\n", answer) &&
strcmp ("\n", answer));
if (!strcmp ("y\n", answer)) {
printf("\nEnter partition size [%lu]: ", block_count);
getline (&answer, &n, stdin);
@@ -280,26 +307,31 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
block_count = atoi (answer);
set_sb_block_count (sb, block_count);
} else {
fsck_conditional_log (magic_was_found, "rebuild-sb: wrong block count occured (%lu), fixed (%lu)\n",
get_sb_block_count(sb), block_count);
fsck_conditional_log (magic_was_found, "rebuild-sb: wrong block count "
"occured (%lu), fixed (%lu)\n", get_sb_block_count(sb), block_count);
set_sb_block_count (sb, block_count);
}
}
if (get_sb_block_size (sb) != fs->fs_blocksize) {
fsck_log("rebuild-sb: wrong block size occured (%lu), fixed (%lu)\n", get_sb_block_size (sb), fs->fs_blocksize);
fsck_log("rebuild-sb: wrong block size occured (%lu), fixed (%lu)\n",
get_sb_block_size (sb), fs->fs_blocksize);
set_sb_block_size (sb, fs->fs_blocksize);
}
}
/* if no reiserfs_found or bad data found in that SB, what was checked in previous clause */
/* if no reiserfs_found or bad data found in that SB, what was checked in previous
* clause */
if (no_reiserfs_found (fs)) {
int fd;
fd = open (filename, O_RDWR | O_LARGEFILE);
if (fd == -1)
reiserfs_exit (8, "rebuils_sb: cannot open device %s", filename);
if (fd == -1) {
reiserfs_exit (EXIT_OPER, "rebuils_sb: cannot open device %s",
filename);
}
version = what_fs_version ();
@@ -311,9 +343,10 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
if (strcmp(answer, "\n")) {
retval = (int) strtol (answer, &tmp, 0);
if ((*tmp && strcmp(tmp, "\n")) || retval < 0)
reiserfs_exit (16, "rebuild_sb: wrong block size specified\n");
reiserfs_exit (EXIT_USER, "rebuild_sb: wrong block size specified\n");
if (!is_blocksize_correct (retval))
reiserfs_exit (16, "rebuild_sb: wrong block size specified, only divisible by 1024 are supported currently\n");
reiserfs_exit (EXIT_USER, "rebuild_sb: wrong block size specified, "
"only divisible by 1024 are supported currently\n");
} else
retval = 4096;
}
@@ -335,19 +368,27 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
break;
}
if (fs == NULL)
return;
sb = fs->fs_ondisk_sb;
fs->fs_vp = data;
if (!fsck_skip_journal (fs)) {
if (!fsck_data (fs)->journal_dev_name) {
do {
printf("\nNo journal device was specified. (If journal is not available, re-run with --no-journal-available).\n"\
"Is journal standard? (y/n)[y]: ");
printf("\nNo journal device was specified. (If journal is not "
"available, re-run with --no-journal-available option specified).\n"
"Is journal default? (y/n)[y]: ");
getline (&answer, &n, stdin);
} while (strcmp ("y\n", answer) && strcmp ("n\n", answer) && strcmp ("\n", answer));
} while(strcmp ("y\n", answer) &&
strcmp ("n\n", answer) &&
strcmp ("\n", answer));
if (!strcmp ("n\n", answer)) {
printf("\nSpecify journal device with -j option.\n");
exit(16);
exit(EXIT_USER);
}
standard_journal = 1;
} else {
@@ -358,7 +399,7 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
}
do {
printf("\nDid you use resiser(y/n)[n]: ");
printf("\nDid you use resizer(y/n)[n]: ");
getline (&answer, &n, stdin);
} while (strcmp ("y\n", answer) && strcmp ("n\n", answer) && strcmp ("\n", answer));
if (!strcmp ("y\n", answer)) {
@@ -369,64 +410,83 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
set_sb_block_count (sb, block_count);
}
set_sb_fs_state (sb, REISERFS_CORRUPTED);
set_sb_fs_state (sb, FS_ERROR);
}
if (version == 1 || version == 3) {
if (get_reiserfs_format (sb) != REISERFS_FORMAT_3_6) {
fsck_log("rebuild-sb: wrong reiserfs version occured (%lu), fixed (%lu)\n", get_reiserfs_format (sb), REISERFS_FORMAT_3_6);
fsck_log("rebuild-sb: wrong reiserfs version occured (%lu), fixed (%lu)\n",
get_reiserfs_format (sb), REISERFS_FORMAT_3_6);
set_sb_version (sb, REISERFS_FORMAT_3_6);
}
} else if (version == 2 || version == 4) {
if (get_reiserfs_format (sb) != REISERFS_FORMAT_3_5) {
fsck_log("rebuild-sb: wrong reiserfs version occured (%lu), fixed (%lu)\n", get_reiserfs_format (sb), REISERFS_FORMAT_3_5);
fsck_log("rebuild-sb: wrong reiserfs version occured (%lu), fixed (%lu)\n",
get_reiserfs_format (sb), REISERFS_FORMAT_3_5);
set_sb_version (sb, REISERFS_FORMAT_3_5);
}
}
p_oid_maxsize = (fs->fs_blocksize - reiserfs_super_block_size (sb)) / sizeof(__u32) / 2 * 2;
p_oid_maxsize = (fs->fs_blocksize - reiserfs_super_block_size (sb)) /
sizeof(__u32) / 2 * 2;
if (get_sb_oid_maxsize (sb) != p_oid_maxsize) {
fsck_log("rebuild-sb: wrong objectid map max size occured (%lu), fixed (%lu)\n", get_sb_oid_maxsize (sb), p_oid_maxsize);
fsck_log("rebuild-sb: wrong objectid map max size occured (%lu), fixed (%lu)\n",
get_sb_oid_maxsize (sb), p_oid_maxsize);
set_sb_oid_maxsize (sb, p_oid_maxsize);
}
p_bmap_nr = (block_count + (fs->fs_blocksize * 8 - 1)) / (fs->fs_blocksize * 8);
if (get_sb_bmap_nr (sb) != p_bmap_nr) {
fsck_log("rebuild-sb: wrong bitmap number occured (%lu), fixed (%lu)\n", get_sb_bmap_nr (sb), p_bmap_nr);
set_sb_bmap_nr (sb, (block_count + (fs->fs_blocksize * 8 - 1)) / (fs->fs_blocksize * 8));
fsck_log("rebuild-sb: wrong bitmap number occured (%lu), fixed (%lu)\n",
get_sb_bmap_nr (sb), p_bmap_nr);
set_sb_bmap_nr (sb,
(block_count + (fs->fs_blocksize * 8 - 1)) / (fs->fs_blocksize * 8));
}
if (get_sb_root_block (sb) > block_count) {
fsck_log("rebuild-sb: wrong root block occured (%lu), zeroed\n", get_sb_root_block (sb));
fsck_log("rebuild-sb: wrong root block occured (%lu), zeroed\n",
get_sb_root_block (sb));
set_sb_root_block (sb, 0);
}
if (get_sb_free_blocks (sb) > block_count) {
fsck_log ("rebuild-sb: wrong free block count occured (%lu), zeroed\n", get_sb_free_blocks (sb));
fsck_log ("rebuild-sb: wrong free block count occured (%lu), zeroed\n",
get_sb_free_blocks (sb));
set_sb_free_blocks (sb, 0);
}
if (get_sb_umount_state (sb) != REISERFS_CLEANLY_UMOUNTED && get_sb_umount_state (sb) != REISERFS_NOT_CLEANLY_UMOUNTED) {
fsck_conditional_log (magic_was_found, "rebuild-sb: wrong umount state, fixed to (REISERFS_NOT_CLEANLY_UMOUNTED)\n",
get_sb_umount_state (sb));
set_sb_umount_state (sb, REISERFS_NOT_CLEANLY_UMOUNTED);
if (get_sb_umount_state (sb) != FS_CLEANLY_UMOUNTED &&
get_sb_umount_state (sb) != FS_NOT_CLEANLY_UMOUNTED)
{
fsck_conditional_log (magic_was_found, "rebuild-sb: wrong umount state (%u), "
"fixed to (FS_NOT_CLEANLY_UMOUNTED)\n", get_sb_umount_state (sb));
set_sb_umount_state (sb, FS_NOT_CLEANLY_UMOUNTED);
}
if (get_sb_oid_cursize (sb) == 1 || get_sb_oid_cursize (sb) > get_sb_oid_maxsize (sb)) {
fsck_log("rebuild-sb: wrong objectid map occured (%lu), zeroed\n", get_sb_oid_cursize (sb));
if (get_sb_oid_cursize (sb) == 1 ||
get_sb_oid_cursize (sb) > get_sb_oid_maxsize (sb))
{
fsck_log("rebuild-sb: wrong objectid map occured (%lu), zeroed\n",
get_sb_oid_cursize (sb));
set_sb_oid_cursize (sb, 0);
}
if ( get_sb_tree_height (sb) &&
((get_sb_tree_height (sb) < DISK_LEAF_NODE_LEVEL + 1) ||
(get_sb_tree_height (sb) > MAX_HEIGHT)) ) {
fsck_log("rebuild-sb: wrong tree height occured, zeroed\n", get_sb_tree_height (sb));
fsck_log("rebuild-sb: wrong tree height occured (%u), zeroed\n",
get_sb_tree_height (sb));
set_sb_tree_height (sb, 0);
}
if (get_sb_hash_code (sb) && code2name (get_sb_hash_code (sb)) == 0) {
fsck_log("rebuild-sb: wrong hash occured (%lu), zeroed\n", get_sb_hash_code (sb));
fsck_log("rebuild-sb: wrong hash occured (%lu), zeroed\n",
get_sb_hash_code (sb));
set_sb_hash_code (sb, 0);
}
@@ -435,7 +495,8 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
if (generate_random_uuid (sb->s_uuid)) {
fsck_log ("rebuild-sb: no uuid found, failed to genetate UUID\n");
} else {
fsck_log ("rebuild-sb: no uuid found, a new uuid generated (%U)\n", sb->s_uuid);
fsck_log ("rebuild-sb: no uuid found, a new uuid generated (%U)\n",
sb->s_uuid);
}
}
if (sb->s_flags != 0 && sb->s_flags != 1) {
@@ -465,112 +526,87 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
p_jp_journal_1st_block = get_journal_start_must (fs);
if (!fsck_skip_journal (fs) && standard_journal == 1) {
if (get_jp_journal_dev (sb_jp(sb)) != 0) {
fsck_conditional_log (magic_was_found, "rebuild-sb: wrong journal device occured (%lu), fixed (0)\n",
get_jp_journal_dev (sb_jp(sb)));
if (standard_journal == 1) {
if (get_jp_journal_dev (sb_jp(sb)) != 0) {
fsck_conditional_log (magic_was_found, "rebuild-sb: wrong journal device "
"occured (%lu), fixed (0)\n", get_jp_journal_dev (sb_jp(sb)));
set_jp_journal_dev (sb_jp(sb), 0);
}
if (get_sb_reserved_for_journal (sb) != 0) {
fsck_log ("rebuild-sb: wrong size reserved for standard journal occured (%lu), fixed (0)\n",
get_sb_reserved_for_journal (sb));
fsck_log ("rebuild-sb: wrong size reserved for default journal occured "
"(%lu), fixed (0)\n", get_sb_reserved_for_journal (sb));
set_sb_reserved_for_journal (sb, 0);
}
if (get_jp_journal_1st_block (sb_jp(sb)) != p_jp_journal_1st_block) {
fsck_conditional_log (magic_was_found, "rebuild-sb: wrong journal first block occured (%lu), fixed (%lu)\n",
get_jp_journal_1st_block (sb_jp(sb)), p_jp_journal_1st_block);
fsck_conditional_log (magic_was_found, "rebuild-sb: wrong journal first "
"block occured (%lu), fixed (%lu)\n", get_jp_journal_1st_block (sb_jp(sb)),
p_jp_journal_1st_block);
set_jp_journal_1st_block (sb_jp(sb) , p_jp_journal_1st_block);
}
if (get_jp_journal_size (sb_jp(sb)) != journal_default_size(fs->fs_super_bh->b_blocknr, fs->fs_blocksize)) {
fsck_conditional_log (magic_was_found, "rebuild-sb: wrong journal size occured (%lu), fixed (%lu)\n",
get_jp_journal_size (sb_jp(sb)) + 1,
journal_default_size (fs->fs_super_bh->b_blocknr, fs->fs_blocksize) + 1);
set_jp_journal_size (sb_jp(sb), journal_default_size (fs->fs_super_bh->b_blocknr, fs->fs_blocksize));
}
if (get_jp_journal_max_trans_len (sb_jp(sb)) !=
advise_journal_max_trans_len( get_jp_journal_max_trans_len (sb_jp(sb)),
get_jp_journal_size (sb_jp(sb)),
fs->fs_blocksize))
if (get_jp_journal_size (sb_jp(sb)) !=
journal_default_size(fs->fs_super_bh->b_blocknr, fs->fs_blocksize))
{
fsck_conditional_log (magic_was_found, "rebuild-sb: wrong journal max transaction length occured (%lu), fixed (%d)\n",
get_jp_journal_max_trans_len (sb_jp(sb)),
advise_journal_max_trans_len ( get_jp_journal_max_trans_len (sb_jp(sb)),
get_jp_journal_size (sb_jp(sb)),
fs->fs_blocksize));
set_jp_journal_max_trans_len (sb_jp(sb),
advise_journal_max_trans_len( get_jp_journal_max_trans_len (sb_jp(sb)),
get_jp_journal_size (sb_jp(sb)),
fs->fs_blocksize));
}
/* if (get_jp_journal_magic (sb_jp(sb)) != 0) {
fsck_log ("rebuild-sb: wrong journal magic occured (%lu), fixed (0)\n", get_jp_journal_magic (sb_jp(sb)));
set_jp_journal_magic (sb_jp(sb), 0);
}*/
if (get_jp_journal_max_batch (sb_jp(sb)) != advise_journal_max_batch(get_jp_journal_max_trans_len (sb_jp(sb)))) {
fsck_conditional_log (magic_was_found, "rebuild-sb: wrong journal max batch size occured (%lu), fixed (%d)\n",
get_jp_journal_max_batch (sb_jp(sb)), advise_journal_max_batch(get_jp_journal_max_trans_len (sb_jp(sb))));
set_jp_journal_max_batch (sb_jp(sb), advise_journal_max_batch(get_jp_journal_max_trans_len (sb_jp(sb))));
}
if (get_jp_journal_max_commit_age (sb_jp(sb)) != advise_journal_max_commit_age()) {
fsck_conditional_log (magic_was_found, "rebuild-sb: wrong journal max commit age occured (%lu), fixed (%d)\n",
get_jp_journal_max_commit_age (sb_jp(sb)), advise_journal_max_commit_age());
set_jp_journal_max_commit_age (sb_jp(sb), advise_journal_max_commit_age());
}
if (get_jp_journal_max_trans_age (sb_jp(sb)) != advise_journal_max_trans_age()) {
fsck_log ("rebuild-sb: wrong journal max commit age occured (%lu), fixed (0)\n",
get_jp_journal_max_trans_age (sb_jp(sb)), advise_journal_max_trans_age());
set_jp_journal_max_trans_age (sb_jp(sb), advise_journal_max_trans_age());
fsck_conditional_log (magic_was_found, "rebuild-sb: wrong journal size "
"occured (%lu), fixed (%lu)\n", get_jp_journal_size (sb_jp(sb)) + 1,
journal_default_size (fs->fs_super_bh->b_blocknr,
fs->fs_blocksize) + 1);
set_jp_journal_size (sb_jp(sb),
journal_default_size (fs->fs_super_bh->b_blocknr, fs->fs_blocksize));
}
if ((retval = reiserfs_open_journal(fs, filename, O_RDWR | O_LARGEFILE))) {
fsck_log("\nrebuild-sb: Failed to open the journal device (%s).",
filename);
exit(retval == 1 ? EXIT_USER : EXIT_OPER);
}
} else if (!fsck_skip_journal(fs)) {
/* Check that specified non-standard journal device exists. */
journal_dev_name = fsck_data (fs)->journal_dev_name;
retval = stat64(journal_dev_name, &stat_buf);
if (retval == -1)
reiserfs_exit (EXIT_USER, "rebuild_sb: error while detecting the "
"specified journal device (%s): %s\n", journal_dev_name,
strerror(errno));
retval = 0;
if (magic_was_found) {
/* Super block was found. Try to open the journal on the base of its
* journal parameters. */
retval = reiserfs_open_journal(fs, journal_dev_name,
O_RDWR | O_LARGEFILE);
if (retval == 0) {
j_head = (struct reiserfs_journal_header *)(fs->fs_jh_bh->b_data);
retval = memcmp(&j_head->jh_journal, sb_jp(sb),
sizeof(struct journal_params));
if (retval) {
/* journal parameters from the SB and from the J_Header does not
* match. Close the jouranl, ask the user about correct journal
* parameters. */
reiserfs_close_journal(fs);
}
}
} else if (!fsck_skip_journal(fs) && standard_journal == 0) {
/* non standard journal */
struct reiserfs_journal_header * jh;
if (!reiserfs_journal_opened(fs)) {
fsck_log ("Journal cannot be opened, assuming specified journal device "
"is correct\n");
}
}
if (!reiserfs_journal_opened(fs)) {
__u64 default_value;
journal_dev_name = fsck_data (fs)->journal_dev_name;
retval = stat(journal_dev_name, &stat_buf);
if (retval == -1)
reiserfs_exit (16, "rebuild_sb: wrong journal device specified\n");
if (strcmp (fs->fs_file_name, journal_dev_name))
set_jp_journal_dev (sb_jp(sb), stat_buf.st_rdev);
else
set_jp_journal_dev (sb_jp(sb), 0);
/*
if (journal_dev_name == 0) {
// ask user about the dev
printf("\nEnter dev with journal[%s]: \n", fs->fs_file_name);
getline (&answer, &n, stdin);
if (strcmp(answer, "\n")) {
journal_dev_name = malloc (strlen(answer));
strncpy(journal_dev_name, answer, strlen(answer) - 1);
retval = stat(journal_dev_name, &stat_buf);
if (retval == -1)
die ("rebuild_sb: wrong device specified\n");
if (strcmp (fs->fs_file_name, journal_dev_name))
set_jp_journal_dev (sb_jp(sb), stat_buf.st_rdev);
else
set_jp_journal_dev (sb_jp(sb), 0);
} else {
set_jp_journal_dev (sb_jp(sb), 0);
journal_dev_name = fs->fs_file_name;
}
}
*/
retval = -1;
if (magic_was_found == 0 || (retval = reiserfs_open_journal (fs, journal_dev_name, O_RDONLY)) == 0) {
__u64 default_value;
/* journal header was not found or journal cannot be opened -> adjust journal size and offset */
/* default offset if magic was not found is 0 for relocated journal and get_journal_start_must
for any journal on the same device;
default offset if magic was found is found value */
if (retval == 0)
fsck_log ("Journal cannot be opened, assuming specified journal device is correct\n");
if (magic_was_found == 0)
default_value = (!strcmp(fs->fs_file_name, journal_dev_name)) ? p_jp_journal_1st_block : 0;
/* journal was not found or SB and J_Header parameters does not match. */
if (magic_was_found == 0)
default_value = (!strcmp(fs->fs_file_name, journal_dev_name)) ?
p_jp_journal_1st_block : 0;
else
default_value = get_jp_journal_1st_block (sb_jp(sb));
@@ -581,7 +617,8 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
if (strcmp(answer, "\n")) {
retval = (int) strtol (answer, &tmp, 0);
if ((*tmp && strcmp(tmp, "\n")) || retval < 0)
reiserfs_exit(16, "rebuild_sb: wrong offset specified\n");
reiserfs_exit(EXIT_USER, "rebuild_sb: wrong offset specified\n");
set_jp_journal_1st_block (sb_jp(sb), retval);
} else
set_jp_journal_1st_block (sb_jp(sb), default_value);
@@ -590,27 +627,31 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
/* some checks for journal offset */
if (strcmp(fs->fs_file_name, journal_dev_name) != 0) {
if (p_jp_dev_size < get_jp_journal_1st_block (sb_jp(sb)) + 1)
reiserfs_exit(16, "rebuild_sb: offset is much then device size\n");
reiserfs_exit(EXIT_USER, "rebuild_sb: offset is much than device size\n");
}
/* default size if magic was not found is device size - journal_1st_block;
default size if magic was found is found value + 1 block for journal header */
default size if magic was found is found value + 1 block for journal
header */
if (magic_was_found == 0)
default_value = (!strcmp(fs->fs_file_name, journal_dev_name)) ?
journal_default_size (fs->fs_super_bh->b_blocknr, fs->fs_blocksize) + 1 :
p_jp_dev_size - get_jp_journal_1st_block (sb_jp(sb));
journal_default_size (fs->fs_super_bh->b_blocknr,
fs->fs_blocksize) + 1 :
p_jp_dev_size - get_jp_journal_1st_block (sb_jp(sb));
else
default_value = get_jp_journal_size (sb_jp(sb)) + 1;
printf("\nEnter journal size (including 1 block for journal header) on %s in blocks [%Lu]: \n",
journal_dev_name, (unsigned long long)default_value);
printf("\nEnter journal size (including 1 block for journal header) on "
"%s in blocks [%Lu]: \n", journal_dev_name,
(unsigned long long)default_value);
getline (&answer, &n, stdin);
if (strcmp(answer, "\n")) {
retval = (int) strtol (answer, &tmp, 0);
if ((*tmp && strcmp(tmp, "\n")) || retval < 0)
reiserfs_exit(16, "rebuild_sb: wrong offset specified\n");
reiserfs_exit(EXIT_USER, "rebuild_sb: wrong offset specified\n");
set_jp_journal_size (sb_jp(sb), retval - 1);
} else {
set_jp_journal_size (sb_jp(sb), default_value - 1);
@@ -619,26 +660,143 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
/* some checks for journal size */
if (get_jp_journal_size (sb_jp(sb)) +
get_jp_journal_1st_block (sb_jp(sb)) + 1 > p_jp_dev_size)
reiserfs_exit(16, "rebuild_sb: journal offset + journal size is much then device size\n");
reiserfs_exit(EXIT_USER, "rebuild_sb: journal offset + journal size is "
"greater than device size\n");
/* some checks for journal size */
if (get_jp_journal_size (sb_jp(sb)) < JOURNAL_MIN_SIZE)
reiserfs_exit(EXIT_USER, "rebuild_sb: journal size cannot be less than "
"%lu blocks.\n", JOURNAL_MIN_SIZE + 1);
if (reiserfs_open_journal (fs, journal_dev_name, O_RDONLY) == 0)
reiserfs_exit(16, "rebuild-sb: journal header is not found, wrong dev/offset/size configuration\n");
}
if ((retval = reiserfs_open_journal(fs, journal_dev_name,
O_RDWR | O_LARGEFILE)))
{
fsck_log("\nrebuild-sb: Failed to open a journal device (%s).",
journal_dev_name);
exit(retval == 1 ? EXIT_USER : EXIT_OPER);
}
/* SB was found, but journal params were broken and have been recovered.
* Futher work goes as SB would not be found. */
magic_was_found = 0;
}
if (strcmp (fs->fs_file_name, journal_dev_name))
set_jp_journal_dev (sb_jp(sb), stat_buf.st_rdev);
else
set_jp_journal_dev (sb_jp(sb), 0);
jh = (struct reiserfs_journal_header *)fs->fs_jh_bh->b_data;
memcpy (sb_jp(sb), &jh->jh_journal, sizeof (struct journal_params));
} else {
fsck_log ("Journal was specified as not available, zeroing all journal fields in super block..");
set_jp_journal_dev (sb_jp(sb), 0);
set_sb_reserved_for_journal (sb, 0);
set_jp_journal_1st_block (sb_jp(sb) , 0);
set_jp_journal_size (sb_jp(sb), 0);
set_jp_journal_max_trans_len (sb_jp(sb), 0);
set_jp_journal_max_batch (sb_jp(sb), 0);
set_jp_journal_max_commit_age (sb_jp(sb), 0);
set_jp_journal_max_commit_age (sb_jp(sb), 0);
fsck_log ("\nJournal was specified as not available. reiserfstune is "
"needed.\n\n");
set_jp_journal_magic (sb_jp(sb), NEED_TUNE);
}
if (reiserfs_journal_opened(fs)) {
/* Journal was openned. Check/fix journal parameters and copy it the journal
* header. */
if (get_jp_journal_max_trans_len (sb_jp(sb)) !=
advise_journal_max_trans_len( get_jp_journal_max_trans_len (sb_jp(sb)),
get_jp_journal_size (sb_jp(sb)),
fs->fs_blocksize, 0))
{
fsck_conditional_log (magic_was_found, "rebuild-sb: wrong journal max "
"transaction length occured (%lu), fixed (%d)\n",
get_jp_journal_max_trans_len (sb_jp(sb)),
advise_journal_max_trans_len ( get_jp_journal_max_trans_len (sb_jp(sb)),
get_jp_journal_size (sb_jp(sb)),
fs->fs_blocksize, 0));
set_jp_journal_max_trans_len (sb_jp(sb),
advise_journal_max_trans_len ( get_jp_journal_max_trans_len (sb_jp(sb)),
get_jp_journal_size (sb_jp(sb)),
fs->fs_blocksize, 0));
}
if (get_jp_journal_max_batch (sb_jp(sb)) !=
advise_journal_max_batch(get_jp_journal_max_trans_len (sb_jp(sb))))
{
fsck_conditional_log (magic_was_found, "rebuild-sb: wrong journal max "
"batch size occured (%lu), fixed (%d)\n",
get_jp_journal_max_batch (sb_jp(sb)),
advise_journal_max_batch(get_jp_journal_max_trans_len (sb_jp(sb))));
set_jp_journal_max_batch (sb_jp(sb),
advise_journal_max_batch(get_jp_journal_max_trans_len (sb_jp(sb))));
}
if (get_jp_journal_max_commit_age (sb_jp(sb)) !=
advise_journal_max_commit_age())
{
fsck_conditional_log (magic_was_found, "rebuild-sb: wrong journal "
"max commit age occured (%lu), fixed (%d)\n",
get_jp_journal_max_commit_age (sb_jp(sb)), advise_journal_max_commit_age());
set_jp_journal_max_commit_age (sb_jp(sb), advise_journal_max_commit_age());
}
if (get_jp_journal_max_trans_age (sb_jp(sb)) != advise_journal_max_trans_age()) {
fsck_log ("rebuild-sb: wrong journal max commit age occured (%u), "
"fixed (%u)\n", get_jp_journal_max_trans_age (sb_jp(sb)),
advise_journal_max_trans_age());
set_jp_journal_max_trans_age (sb_jp(sb), advise_journal_max_trans_age());
}
j_head = (struct reiserfs_journal_header *)(fs->fs_jh_bh->b_data);
if (standard_journal == 0) {
if (get_jp_journal_magic (sb_jp(sb)) == 0 ||
get_jp_journal_magic (sb_jp(sb)) == NEED_TUNE)
{
int magic;
magic = random();
fsck_log ("rebuild-sb: genarate the new journal magic (%d)\n", magic);
set_jp_journal_magic (sb_jp(sb), magic);
set_jp_journal_magic (&j_head->jh_journal, magic);
}
} else {
set_jp_journal_magic (sb_jp(sb), 0);
}
retval = memcmp(&j_head->jh_journal, sb_jp(sb), sizeof(struct journal_params));
if (retval) {
if (standard_journal == 1) {
fsck_log("\nrebuild-sb: You either have a corrupted journal or have just "
"changed\nthe start of the partition with some partition table editor. "
"If you are\nsure that the start of the partition is ok, rebuild the "
"journal header.\n");
} else if (!magic_was_found) {
fsck_log("\nrebuild-sb: journal header is not found. You either have "
"a corrupted,\nbad configured(device/offset/size), not available "
"journal or have just changed\nthe start of the journal partition "
"with some partition table editor. In the \ncase of corrupted "
"journal you need to use --no-journal-available. If you are\n"
"sure that the start of the partition is ok and journal is "
"available, rebuild\nthe journal header.\n");
}
if (standard_journal || !magic_was_found) {
if (!user_confirmed (stdout, "Do you want to rebuild the journal header? "
"(y/n)[n]: ", "y\n"))
{
exit(EXIT_USER);
} else
exit_code = EXIT_FIXED;
}
memcpy(&j_head->jh_journal, sb_jp(sb), sizeof(struct journal_params));
mark_buffer_dirty(fs->fs_jh_bh);
bwrite (fs->fs_jh_bh);
}
}
/* whether journal header contains params with the same dev, offset, size will be
checked in open_journal */
@@ -647,11 +805,12 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
else
sb_size = SB_SIZE_V1;
if (!magic_was_found || memcmp(ondisk_sb, sb, sb_size -
((sb_size == SB_SIZE) ? sizeof(fs->fs_ondisk_sb->s_unused) : 0)) )
if (ondisk_sb == NULL ||
memcmp(ondisk_sb, sb, sb_size - ((sb_size == SB_SIZE) ?
sizeof(fs->fs_ondisk_sb->s_unused) : 0)))
{
/* smth was changed in SB or a new one has been built */
set_sb_fs_state (sb, get_sb_fs_state (sb) || REISERFS_CORRUPTED);
set_sb_fs_state (sb, get_sb_fs_state (sb) | FS_ERROR);
if (ondisk_sb) {
/* if super_block was found, we keep sb in ondisk_sb */
@@ -660,13 +819,15 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
freemem(sb);
}
fflush(stdout);
print_block (stderr, fs, fs->fs_super_bh);
if (user_confirmed (stderr, "Is this ok ? (y/n)[n]: ", "y\n")) {
mark_buffer_uptodate (fs->fs_super_bh, 1);
mark_buffer_dirty (fs->fs_super_bh);
bwrite (fs->fs_super_bh);
fsck_progress ("\nDo not forget to run reiserfsck --rebuild-tree\n\n");
fsck_progress ("The fs may still be unconsistent. Run reiserfsck --check.\n\n");
exit_code = EXIT_FIXED;
} else {
mark_buffer_clean (fs->fs_super_bh);
fsck_progress ("Super block was not written\n");
@@ -677,6 +838,8 @@ void rebuild_sb (reiserfs_filsys_t * fs, char * filename, struct fsck_data * dat
mark_buffer_clean (fs->fs_super_bh);
fsck_progress ("\nSuper block seems to be correct\n\n");
}
exit(exit_code);
}
/* if (version == 0) {
+2 -1
View File
@@ -1,5 +1,6 @@
/*
* Copyright 1996-2002 Hans Reiser
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "fsck.h"
+108 -217
View File
@@ -1,6 +1,8 @@
/*
* Copyright 1996-2002 Hans Reiser
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "fsck.h"
static int do_items_have_the_same_type (struct item_head * ih, struct key * key)
@@ -46,8 +48,9 @@ static unsigned long indirect_to_direct (struct path * path, __u64 len, int syml
}
set_key_dirid (&ins_ih.ih_key, get_key_dirid (&ih->ih_key));
set_key_objectid (&ins_ih.ih_key, get_key_objectid (&ih->ih_key));
set_type_and_offset (get_ih_key_format (ih), &ins_ih.ih_key,
get_offset (&ih->ih_key) + (I_UNFM_NUM (ih) - 1) * bh->b_size, TYPE_DIRECT);
set_type_and_offset (get_ih_key_format (&ins_ih), &ins_ih.ih_key,
get_offset (&ih->ih_key) + (I_UNFM_NUM (ih) - 1) * bh->b_size,
TYPE_DIRECT);
// we do not know what length this item should be
indirect = get_item (path);
@@ -96,24 +99,6 @@ static unsigned long indirect_to_direct (struct path * path, __u64 len, int syml
return get_offset (&ins_ih.ih_key); //offset;
}
/*
static __u64 get_min_bytes_number (struct item_head * ih, int blocksize)
{
switch (get_type (&ih->ih_key)) {
case TYPE_DIRECT:
if (fs->fs_format == REISERFS_FORMAT_3_6)
return ROUND_UP(get_ih_item_len (ih) - 8);
else
return get_ih_item_len (ih);
case TYPE_INDIRECT:
return (I_UNFM_NUM(ih) - 1) * blocksize;
}
fsck_log ("get_min_bytes_number: called for wrong type of item %H\n", ih);
return 0;
}
*/
/* start_key is the key after which N items need to be deleted
save_here is a pointer where deleted items need to be saved if save is set.
start_key is the first undeleted item.
@@ -194,7 +179,8 @@ int are_file_items_correct (struct item_head * sd_ih, void * sd, __u64 * size, _
struct key * next_key, * key;
__u32 sd_first_direct_byte = 0;
__u64 sd_size;
int retval, i, was_tail = 0;
unsigned int i;
int retval, was_tail = 0;
int had_direct = 0;
int key_version = get_ih_key_format (sd_ih);
int next_is_another_object = 0;
@@ -245,7 +231,7 @@ int are_file_items_correct (struct item_head * sd_ih, void * sd, __u64 * size, _
(!is_indirect_key (next_key) && !is_direct_key(next_key)))
{
next_is_another_object = 1;
will_convert = (is_indirect_ih (ih) && sd_size && I_UNFM_NUM (ih) > 0);
will_convert = (is_indirect_ih (ih) && sd_size && (I_UNFM_NUM (ih) > 0));
if (will_convert) {
last_unfm_offset = get_offset (key) + fs->fs_blocksize * (I_UNFM_NUM (ih) - 1);
/* if symlink or
@@ -269,18 +255,41 @@ int are_file_items_correct (struct item_head * sd_ih, void * sd, __u64 * size, _
fsck_log("are_file_items_correct: vpf-10250: block %lu, item (%d): The item format (%H)"\
" is not equal to SD format (%d)\n",
get_bh(&path)->b_blocknr, PATH_LAST_POSITION(&path), ih, key_version);
one_more_corruption (fs, fixable);
one_more_corruption (fs, FIXABLE);
} else {
fsck_log("are_file_items_correct: vpf-10280: block %lu, item (%d): The item format (%H)"\
" is not equal to SD format (%d) - item was deleted\n",
" is not equal to SD format (%d) - fixed.\n",
get_bh(&path)->b_blocknr, PATH_LAST_POSITION(&path), ih, key_version);
pathrelse (&path);
delete_N_items_after_key (key, NULL, 0 /* do not skip dir items */, 0);
return 1;
set_type_and_offset (key_version, &ih->ih_key, get_offset (&ih->ih_key), get_type (&ih->ih_key));
set_ih_key_format(ih, key_version);
mark_buffer_dirty(get_bh(&path));
}
}
if (*symlink && is_direct_key(&ih->ih_key)) {
/* symlink. Check that it is of KEY_FORMAT_1 */
if (fsck_mode(fs) == FSCK_CHECK) {
if ((get_ih_key_format(ih) != KEY_FORMAT_1) || (key_format(&ih->ih_key) != KEY_FORMAT_1)) {
fsck_log("are_file_items_correct: vpf-10732: block %lu, item (%d): The symlink format (%H)"\
" is not equal to 3.5 format (%d)\n", get_bh(&path)->b_blocknr, PATH_LAST_POSITION(&path),
ih, KEY_FORMAT_1);
one_more_corruption (fs, FIXABLE);
}
} else {
if ((get_ih_key_format(ih) != KEY_FORMAT_1) || (key_format(&ih->ih_key) != KEY_FORMAT_1)) {
fsck_log("are_file_items_correct: vpf-10732: block %lu, item (%d): The symlink format (%H)"\
" is not equal to 3.5 format (%d)\n", get_bh(&path)->b_blocknr, PATH_LAST_POSITION(&path),
ih, KEY_FORMAT_1);
set_type_and_offset(KEY_FORMAT_1, &ih->ih_key, get_offset(&ih->ih_key), get_type(&ih->ih_key));
set_ih_key_format(ih, KEY_FORMAT_1);
mark_buffer_dirty(get_bh(&path));
}
}
}
if (will_convert)
*size = sd_size;
else
@@ -316,7 +325,7 @@ int are_file_items_correct (struct item_head * sd_ih, void * sd, __u64 * size, _
/* here it can be symlink only */
fsck_log ("are_file_items_correct: The indirect item should be converted back"
" to direct %K\n", &ih->ih_key);
one_more_corruption (fs, fixable);
one_more_corruption (fs, FIXABLE);
pathrelse (&path);
} else {
__u32 * ind = (__u32 *)get_item(&path);
@@ -325,6 +334,8 @@ int are_file_items_correct (struct item_head * sd_ih, void * sd, __u64 * size, _
*/
if (ind [I_UNFM_NUM (ih) - 1] == 0)
*blocks += (fs->fs_blocksize >> 9);
/* path is released here. */
sd_first_direct_byte = indirect_to_direct (&path, sd_size - last_unfm_offset + 1, *symlink);
/* last item of the file is direct item */
set_offset (key_version, key, sd_first_direct_byte);
@@ -359,7 +370,7 @@ int are_file_items_correct (struct item_head * sd_ih, void * sd, __u64 * size, _
fsck_log ("are_file_items_correct: "
"item must be indirect and must have invalid free space (%H)", ih);
if (fsck_mode (fs) != FSCK_CHECK && fsck_mode (fs) != FSCK_FIX_FIXABLE)
if (fsck_mode (fs) == FSCK_REBUILD)
{
set_ih_free_space(ih, 0);
mark_buffer_dirty (PATH_PLAST_BUFFER (&path));
@@ -511,16 +522,17 @@ static int make_file_writeable (struct buffer_head * bh, int pos)
/* this inserts __first__ indirect item (having k_offset == 1 and only
one unfm pointer) into tree */
int create_first_item_of_file (struct item_head * ih, char * item, struct path * path, int was_in_tree)
static int create_first_item_of_file (struct item_head * ih, char * item, struct path * path, int was_in_tree)
{
__u32 unfm_ptr;
__u32 * ni = 0;
struct buffer_head * unbh;
struct item_head indih;
int retval, i;
__u32 free_sp = 0;
unsigned int i;
int retval;
mark_item_unreachable (&indih);
copy_key (&(indih.ih_key), &(ih->ih_key));
set_ih_item_len (&indih, UNFM_P_SIZE);
@@ -528,29 +540,21 @@ int create_first_item_of_file (struct item_head * ih, char * item, struct path *
/* insert indirect item containing 0 unfm pointer */
unfm_ptr = 0;
set_ih_free_space (&indih, 0);
free_sp = 0;
retval = 0;
} else {
if (is_direct_ih (ih)) {
/* copy direct item to new unformatted node. Save information about it */
//__u64 len = get_bytes_number(0, ih, item, CHECK_FREE_BYTES);
__u64 len = get_bytes_number (ih, fs->fs_blocksize);
int len = get_bytes_number (ih, fs->fs_blocksize);
unbh = reiserfsck_get_new_buffer (PATH_PLAST_BUFFER (path)->b_blocknr);
memset (unbh->b_data, 0, unbh->b_size);
unfm_ptr = cpu_to_le32 (unbh->b_blocknr);
/* this is for check only */
/*mark_block_unformatted (le32_to_cpu (unfm_ptr));*/
memcpy (unbh->b_data + get_offset (&ih->ih_key) - 1, item, len);
// save_unfm_overwriting (le32_to_cpu (unfm_ptr), ih);
set_ih_free_space (&indih, fs->fs_blocksize - len - (get_offset (&ih->ih_key) - 1));
mark_ih_was_tail (&indih);
free_sp = fs->fs_blocksize - len - (get_offset (&ih->ih_key) - 1);
mark_buffer_dirty (unbh);
// mark_buffer_uptodate (unbh, 0);
mark_buffer_uptodate (unbh, 1);
brelse (unbh);
@@ -558,11 +562,6 @@ int create_first_item_of_file (struct item_head * ih, char * item, struct path *
} else {
/* take first unformatted pointer from an indirect item */
//free_sp = ih_get_free_space(0, ih, item);
/* free_sp = 0;//get_ih_free_space (ih);
set_ih_free_space (&indih, ((get_ih_item_len(ih) == UNFM_P_SIZE) ? free_sp : 0));
if (get_ih_item_len (ih) != UNFM_P_SIZE)
free_sp = 0;
*/
set_ih_item_len (&indih, get_ih_item_len (ih));
ni = getmem (get_ih_item_len (ih));
@@ -593,46 +592,12 @@ int create_first_item_of_file (struct item_head * ih, char * item, struct path *
reiserfsck_insert_item (path, &indih, (const char *)&unfm_ptr);
}
/* update sd_first_direct_byte */
/*
if (get_ih_key_format (&indih) == KEY_FORMAT_1) {
struct key sd_key;
sd_key = indih.ih_key;
set_type_and_offset (KEY_FORMAT_1, &sd_key, SD_OFFSET, TYPE_STAT_DATA);
if (reiserfs_search_by_key_4 (fs, &sd_key, path) == ITEM_FOUND) {
struct buffer_head * bh;
struct stat_data_v1 * sd;
__u32 fdb;
bh = get_bh (path);
ih = get_ih (path);
if (get_ih_item_len (ih) != SD_V1_SIZE) {
// symlink?
if (get_ih_item_len (ih) != SD_SIZE)
die ("create_first_item_of_file: wrong stat data found");
} else {
sd = get_item (path);
get_sd_first_direct_byte (ih, sd, &fdb);
if (fdb != NO_BYTES_IN_DIRECT_ITEM) {
fdb = NO_BYTES_IN_DIRECT_ITEM;
set_sd_first_direct_byte (ih, sd, &fdb);
mark_buffer_dirty (bh);
}
}
pathrelse (path);
}
}
*/
return retval;
}
/* path points to first part of tail. Function copies file tail into unformatted node and returns
its block number. If we are going to overwrite direct item then keep free space (keep_free_space
== YES). Else (we will append file) set free space to 0 */
its block number. */
/* we convert direct item that is on the path to indirect. we need a number of free block for
unformatted node. reiserfs_new_blocknrs will start from block number returned by this function */
static unsigned long block_to_start (struct path * path)
@@ -650,7 +615,7 @@ static unsigned long block_to_start (struct path * path)
}
static void direct2indirect2 (unsigned long unfm, struct path * path, int keep_free_space)
static void direct2indirect2 (unsigned long unfm, struct path * path)
{
struct item_head * ih;
struct key key;
@@ -733,43 +698,6 @@ static void direct2indirect2 (unsigned long unfm, struct path * path, int keep_f
mark_buffer_uptodate (unbh, 1);
brelse (unbh);
/* update sd_first_direct_byte */
/*
while (file_format == KEY_FORMAT_1) {
struct key sd_key;
sd_key = key;
set_type_and_offset (KEY_FORMAT_1, &sd_key, SD_OFFSET, TYPE_STAT_DATA);
if (reiserfs_search_by_key_4 (fs, &sd_key, path) == ITEM_FOUND) {
struct buffer_head * bh;
struct stat_data_v1 * sd;
__u32 fdb;
__u16 mode;
bh = get_bh (path);
ih = get_ih (path);
get_sd_mode (ih, get_item(path), &mode);
// if (get_ih_item_len (ih) != SD_V1_SIZE)
if (get_ih_item_len (ih) != SD_V1_SIZE) {
if (S_ISLNK(mode)) {
pathrelse (path);
break;
} else
reiserfs_panic ("direct2indirect: wrong stat data found %H", ih);
}
sd = get_item (path);
fdb = NO_BYTES_IN_DIRECT_ITEM;
set_sd_first_direct_byte (ih, sd, &fdb);
mark_buffer_dirty (bh);
pathrelse (path);
}
break;
}
*/
if (usearch_by_position (fs, &key, file_format, path) != POSITION_FOUND ||
!is_indirect_ih (PATH_PITEM_HEAD (path)))
reiserfs_panic ("direct2indirect: The data %k, which are supposed to be converted, are not found", &key);
@@ -780,31 +708,32 @@ static void direct2indirect2 (unsigned long unfm, struct path * path, int keep_f
static int append_to_unformatted_node (struct item_head * comingih, struct item_head * ih, char * item,
struct path * path, __u16 * free_sp, __u64 coming_len)
struct path * path, unsigned int coming_len)
{
struct buffer_head * bh, * unbh;
__u64 end_of_data; //ih->u.ih_free_space;
__u64 offset = get_offset (&comingih->ih_key) % fs->fs_blocksize - 1;
int zero_number;
struct buffer_head * bh, * unbh = NULL;
__u64 end_of_data, free_space;
__u16 offset = get_offset (&comingih->ih_key) % fs->fs_blocksize - 1;
__u32 unfm_ptr;
int zero_number;
bh = PATH_PLAST_BUFFER (path);
unfm_ptr = le32_to_cpu (B_I_POS_UNFM_POINTER (bh, ih, I_UNFM_NUM (ih) - 1));
/* append to free space of the last unformatted node of indirect item ih */
if (*free_sp /*ih->u.ih_free_space*/ < coming_len)
{
*free_sp = get_offset (&ih->ih_key) + fs->fs_blocksize * I_UNFM_NUM (ih) - get_offset (&comingih->ih_key);
if (*free_sp < coming_len)
reiserfs_panic ("%s: block %lu: The unformatted node %u, pointed by the file %k, has not enough free space"
"for appending %llu bytes", __FUNCTION__, bh->b_blocknr, unfm_ptr, &ih->ih_key, coming_len);
}
end_of_data = fs->fs_blocksize - *free_sp;
free_space = get_offset (&ih->ih_key) + fs->fs_blocksize * I_UNFM_NUM (ih) - get_offset (&comingih->ih_key);
if (free_space < coming_len)
reiserfs_panic ("%s: block %lu: The unformatted node %u, pointed by the file %k, does not have enough free space"
"for appending %llu bytes", __FUNCTION__, bh->b_blocknr, unfm_ptr, &ih->ih_key, coming_len);
if (fs->fs_blocksize < free_space)
reiserfs_panic ("%s: block %lu: The unformatted node %u, pointed by the file %k, does not have enough free space"
"for appending %llu bytes", __FUNCTION__, bh->b_blocknr, &ih->ih_key, unfm_ptr, &ih->ih_key, coming_len);
end_of_data = fs->fs_blocksize - free_space;
zero_number = offset - end_of_data;
/*if (unfm_ptr != 0 && unfm_ptr < SB_BLOCK_COUNT (fs))*/
if (unfm_ptr && !not_data_block (fs, unfm_ptr))
{
if (unfm_ptr && !not_data_block (fs, unfm_ptr)) {
unbh = bread (fs->fs_dev, unfm_ptr, fs->fs_blocksize);
if (!is_block_used (unfm_ptr))
reiserfs_panic ("%s: block %lu: The unformatted node %u, pointed by the file %k, is marked as unused",
@@ -812,7 +741,9 @@ static int append_to_unformatted_node (struct item_head * comingih, struct item_
if (unbh == 0)
unfm_ptr = 0;
} else {
}
if (!unfm_ptr || not_data_block (fs, unfm_ptr)) {
/* indirect item points to block which can not be pointed or to 0, in
any case we have to allocate new node */
/*if (unfm_ptr == 0 || unfm_ptr >= SB_BLOCK_COUNT (fs)) {*/
@@ -827,9 +758,9 @@ static int append_to_unformatted_node (struct item_head * comingih, struct item_
// save_unfm_overwriting (unbh->b_blocknr, comingih);
*free_sp /*ih->u.ih_free_space*/ -= (zero_number + coming_len);
free_space -= (zero_number + coming_len);
set_ih_free_space(ih, get_ih_free_space(ih) - (zero_number + coming_len));
memset (unbh->b_data + offset + coming_len, 0, *free_sp);
memset (unbh->b_data + offset + coming_len, 0, free_space);
// mark_buffer_uptodate (unbh, 0);
mark_buffer_uptodate (unbh, 1);
mark_buffer_dirty (unbh);
@@ -838,31 +769,6 @@ static int append_to_unformatted_node (struct item_head * comingih, struct item_
return coming_len;
}
static void adjust_free_space (struct buffer_head * bh, struct item_head * ih, struct item_head * comingih, __u16 *free_sp)
{
// printf ("adjust_free_space does nothing\n");
return;
if (is_indirect_ih (comingih)) {
set_ih_free_space(ih, 0);//??
*free_sp = (__u16)0;
} else {
if (get_offset (&comingih->ih_key) < get_offset (&ih->ih_key) + fs->fs_blocksize * I_UNFM_NUM (ih))
{
/* append to the last unformatted node */
set_ih_free_space (ih, fs->fs_blocksize - get_offset(&ih->ih_key) % fs->fs_blocksize + 1);//??
*free_sp = (__u16)fs->fs_blocksize - get_offset(&ih->ih_key) % fs->fs_blocksize + 1;
}
else
{
set_ih_free_space(ih,0);//??
*free_sp =0;
}
}
mark_buffer_dirty (bh);
}
/* this appends file with one unformatted node pointer (since balancing
algorithm limitation). This pointer can be 0, or new allocated block or
pointer from indirect item that is being inserted into tree */
@@ -873,41 +779,26 @@ int reiserfsck_append_file (struct item_head * comingih, char * item, int pos, s
struct buffer_head * unbh;
int retval;
struct item_head * ih = PATH_PITEM_HEAD (path);
__u16 keep_free_space;
__u32 bytes_number;
int i, count = 0;
if (!is_indirect_ih (ih))
reiserfs_panic ("reiserfsck_append_file: Operation is not allowed for non-indirect item %k", &ih->ih_key);
//keep_free_space = ih_get_free_space(PATH_PLAST_BUFFER (path), PATH_PITEM_HEAD(path), 0);
keep_free_space = 0;//get_ih_free_space (ih);
if (get_offset (&ih->ih_key) + get_bytes_number (ih, fs->fs_blocksize)
//get_bytes_number (PATH_PLAST_BUFFER (path), PATH_PITEM_HEAD(path), 0, CHECK_FREE_BYTES)
!= get_offset (&comingih->ih_key)){
adjust_free_space (PATH_PLAST_BUFFER (path), ih, comingih, &keep_free_space);
}
if (is_direct_ih (comingih)) {
//__u64 coming_len = get_bytes_number (0,comingih, item, CHECK_FREE_BYTES);
__u64 coming_len = get_bytes_number (comingih, fs->fs_blocksize);
unsigned int coming_len = get_bytes_number (comingih, fs->fs_blocksize);
if (get_offset (&comingih->ih_key) < get_offset (&ih->ih_key) + fs->fs_blocksize * I_UNFM_NUM (ih)) {
/* direct item fits to free space of indirect item */
return append_to_unformatted_node (comingih, ih, item, path, &keep_free_space, coming_len);
return append_to_unformatted_node (comingih, ih, item, path, coming_len);
}
unbh = reiserfsck_get_new_buffer (PATH_PLAST_BUFFER (path)->b_blocknr);
memset (unbh->b_data, 0, unbh->b_size);
/* this is for check only */
/*mark_block_unformatted (unbh->b_blocknr);*/
memcpy (unbh->b_data + get_offset (&comingih->ih_key) % unbh->b_size - 1, item, coming_len);
// save_unfm_overwriting (unbh->b_blocknr, comingih);
mark_buffer_dirty (unbh);
// mark_buffer_uptodate (unbh, 0);
mark_buffer_uptodate (unbh, 1);
ni = getmem (UNFM_P_SIZE);
@@ -951,7 +842,7 @@ int must_there_be_a_hole (struct item_head * comingih, struct path * path)
struct item_head * ih = PATH_PITEM_HEAD (path);
if (is_direct_ih (ih)) {
direct2indirect2 (0, path, 1);
direct2indirect2 (0, path);
ih = PATH_PITEM_HEAD (path);
}
@@ -973,7 +864,7 @@ int reiserfs_append_zero_unfm_ptr (struct path * path, int p_count)
if (is_direct_ih (PATH_PITEM_HEAD (path)))
/* convert direct item to indirect */
direct2indirect2 (0, path, 0);
direct2indirect2 (0, path);
count = MAX_INDIRECT_ITEM_LEN (fs->fs_blocksize) / UNFM_P_SIZE;
@@ -1098,10 +989,7 @@ static int overwrite_by_indirect_item (struct item_head * comingih, __u32 * comi
struct item_head * ih = PATH_PITEM_HEAD (path);
int written;
__u32 * item_in_tree;
int src_unfm_ptrs, dest_unfm_ptrs, to_copy;
int i;
__u16 free_sp;
int dirty = 0;
int src_unfm_ptrs, dest_unfm_ptrs, to_copy, i, dirty = 0;
item_in_tree = (__u32 *)B_I_PITEM (bh, ih) + path->pos_in_item;
coming_item += *pos_in_coming_item;
@@ -1113,14 +1001,13 @@ static int overwrite_by_indirect_item (struct item_head * comingih, __u32 * comi
/* whole coming item (comingih) fits into item in tree (ih) starting with path->pos_in_item */
//free_sp = ih_get_free_space(0, comingih, (char *)coming_item);
free_sp = 0;//ih_free_space (comingih);
written = get_bytes_number (comingih, fs->fs_blocksize) -
free_sp - *pos_in_coming_item * fs->fs_blocksize;
/* free_sp - */ *pos_in_coming_item * fs->fs_blocksize;
*pos_in_coming_item = I_UNFM_NUM (comingih);
to_copy = src_unfm_ptrs;
if (dest_unfm_ptrs == src_unfm_ptrs)
set_ih_free_space(ih, free_sp); //comingih->u.ih_free_space;
set_ih_free_space(ih, 0 /* free_sp */ );
} else {
/* only part of coming item overlaps item in the tree */
*pos_in_coming_item += dest_unfm_ptrs;
@@ -1137,20 +1024,6 @@ static int overwrite_by_indirect_item (struct item_head * comingih, __u32 * comi
mark_block_used (le32_to_cpu (coming_item[i]), 0);
dirty ++;
}
#if 0
if (!is_block_used (coming_item[i]) && !is_block_uninsertable (coming_item[i])) {
if (item_in_tree[i]) {
/* do not overwrite unformatted pointer. We must save everything what is there already from
direct items */
overwrite_unfm_by_unfm (item_in_tree[i], coming_item[i], fs->fs_blocksize);
} else {
item_in_tree[i] = coming_item[i];
mark_block_used (coming_item[i]);
}
}
#endif
}
if (dirty)
mark_buffer_dirty (bh);
@@ -1164,7 +1037,6 @@ static int reiserfsck_overwrite_file (struct item_head * comingih, char * item,
{
__u32 unfm_ptr;
int written = 0;
int keep_free_space;
struct item_head * ih = PATH_PITEM_HEAD (path);
@@ -1187,7 +1059,7 @@ static int reiserfsck_overwrite_file (struct item_head * comingih, char * item,
}
}
/* */
direct2indirect2 (unfm_ptr, path, keep_free_space = 1);
direct2indirect2 (unfm_ptr, path);
}
if (is_direct_ih (comingih))
{
@@ -1205,14 +1077,12 @@ static int reiserfsck_overwrite_file (struct item_head * comingih, char * item,
/*
*/
int reiserfsck_file_write (struct item_head * ih, char * item, int was_in_tree)
{
int reiserfsck_file_write (struct item_head * ih, char * item, int was_in_tree) {
struct path path;
int count, pos_in_coming_item;
int retval, written;
struct key key;
int file_format = KEY_FORMAT_UNDEFINED;
int symlink = 0;
int relocated = 0;
if (!was_in_tree) {
@@ -1225,7 +1095,7 @@ check_again:
copy_short_key (&key, &(ih->ih_key));
if (reiserfs_search_by_key_4 (fs, &key, &path) != ITEM_FOUND) {
fsck_log ("vpf-10260: The file we are inserting the new item (%H) into has not"
fsck_log ("vpf-10260: The file we are inserting the new item (%H) into has no"
" StatData, insertion was skipped\n", ih);
pathrelse (&path);
return 0;
@@ -1234,20 +1104,27 @@ check_again:
/*SD found*/
file_format = get_ih_key_format (get_ih(&path));
get_sd_mode (get_ih(&path), get_item(&path), &mode);
symlink = S_ISLNK(mode);
if (!symlink && file_format != get_ih_key_format (ih)) {
fsck_log ("vpf-10270: The file we are inserting the new item into has the different"
" format then found StatData, insertion was skipped\n\tSD: (%H)\n\tNew:(%H)\n",
ih, get_ih(&path));
pathrelse (&path);
return 0;
if (file_format != get_ih_key_format (ih)) {
/* Not for symlinks and not for items which should be relocted. */
if (((S_ISDIR(mode) && is_direntry_ih(ih)) ||
(!S_ISDIR(mode) && !is_direntry_ih(ih))) &&
!S_ISLNK(mode))
{
set_type_and_offset (file_format, &ih->ih_key, get_offset (&ih->ih_key), get_type (&ih->ih_key));
set_ih_key_format(ih, file_format);
}
}
if (!relocated && should_relocate (ih)) {
rewrite_file (ih, 1, 1/*change new_ih*/);
pathrelse(&path);
relocated = 1;
/* object has been relocated but we should not mark it as used in semantic map,
as it does not exist at pass2 and we do not get here for relocation as
was_in_tree == 1 */
goto check_again;
}
@@ -1328,3 +1205,17 @@ check_again:
return get_bytes_number (ih, fs->fs_blocksize);
}
void one_more_corruption(reiserfs_filsys_t *fs, int kind) {
if (kind == FATAL)
fsck_check_stat (fs)->fatal_corruptions++;
else if (kind == FIXABLE)
fsck_check_stat (fs)->fixable_corruptions++;
}
void one_less_corruption(reiserfs_filsys_t *fs, int kind) {
if (kind == FATAL)
fsck_check_stat (fs)->fatal_corruptions--;
else if (kind == FIXABLE)
fsck_check_stat (fs)->fixable_corruptions--;
}
+240 -350
View File
@@ -1,380 +1,269 @@
/*
* Copyright 1996-2002 Hans Reiser
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "fsck.h"
/* when --check fsck builds a map of objectids of files it finds in the tree
when --rebuild-tree - fsck builds map of objectids it inserts into tree
FIXME: objectid gets into map when stat data item
*/
when --rebuild-tree - fsck builds map of objectids it inserts into tree */
#define ALLOC_SIZE 1024
#define MAX_ID (~0ul)
#if 0
/* is it marked used in super block's objectid map. fixme: binary search could
be used here */
int is_objectid_used (reiserfs_filsys_t * fs, __u32 objectid)
{
__u32 * objectid_map;
int i = 0;
/* 2 bytes for the counter */
#define BM_SIZE (ALLOC_SIZE - sizeof(__u16))
#define BM_INTERVAL (BM_SIZE * 8)
#define INDEX_COUNT (MAX_ID / BM_INTERVAL)
#define id_map_interval(map, id) (map->index + (id / BM_INTERVAL))
objectid_map = (__u32 *)((char *)(fs->fs_ondisk_sb) + (sb_size(fs)));
while (i < get_sb_oid_cursize (fs->fs_ondisk_sb)) {
if (objectid == le32_to_cpu (objectid_map[i])) {
return 1; /* objectid is used */
}
if (objectid > le32_to_cpu(objectid_map[i]) &&
objectid < le32_to_cpu(objectid_map[i+1])) {
return 1; /* objectid is used */
}
if (objectid < le32_to_cpu(objectid_map[i]))
break;
#define id_map_local_count(interval) (interval + BM_SIZE)
i += 2;
typedef struct sb_id_map {
__u32 * m_begin;
__u32 m_size, m_used_slot_count;
} sb_id_map_t;
id_map_t *id_map_init() {
id_map_t *map;
__u32 i;
map = getmem(sizeof(id_map_t));
map->index = mem_alloc(INDEX_COUNT * sizeof(void *));
for (i = 0; i < INDEX_COUNT; i++) {
if (map->index[i] != (void *)0)
map->index[i] = (void *)0;
}
id_map_mark(map, 0);
id_map_mark(map, 1);
/* id == 0 should not be there, just for convinient usage */
map->count--;
/* objectid is free */
return 0;
}
#endif
/* true objectid map */
/* increase area by MAP_SIZE bytes */
static void grow_id_map (struct id_map * map)
{
/*
if (map->m_page_count && ((map->m_page_count % 5) == 0)) {
fsck_log ("grow_id_map: objectid map expanded: used %lu, %d blocks\n",
map->m_used_slots_count, map->m_page_count);
}
*/
map->m_begin = expandmem (map->m_begin, map->m_page_count * MAP_SIZE, MAP_SIZE);
map->m_page_count ++;
}
static void try_to_shrink_id_map (struct id_map * map)
{
if (map->m_used_slots_count * sizeof(__u32) <= (map->m_page_count - 1) * MAP_SIZE) {
/*
if (map->m_page_count && ((map->m_page_count % 5) == 0))
fsck_log ("shrink_id_map: objectid map shrinked: used %lu, %d blocks\n",
map->m_used_slots_count, map->m_page_count);
*/
map->m_begin = expandmem (map->m_begin, map->m_page_count * MAP_SIZE,
-MAP_SIZE);
map->m_page_count--;
}
}
/* ubin_search_id is used to find id in the map (or proper place to
insert the new id). if smth goes wrong or ubin_search_id stops
working properly check_id_search_result should help to find raised
problems */
static void check_id_search_result(struct id_map * map, int res, __u32 pos,
__u32 id)
{
if (res != POSITION_FOUND && res != POSITION_NOT_FOUND)
die("check_id_search_result: get wrong result from ubin_search (%d)", res);
if (res == 1 && le32_to_cpu (map->m_begin[pos]) != id)
die("check_id_search_result: wrong id found %u %u", id, le32_to_cpu(map->m_begin[pos]));
if (res == 1)
{
if (pos > map->m_used_slots_count)
die("check_id_search_result: get bad position (%u), used %u",
pos, map->m_used_slots_count);
if (pos >= 0 && pos <= map->m_used_slots_count && le32_to_cpu(map->m_begin[pos - 1]) >= id)
die("check_id_search_result: previous id (%u) not less than (%u)",
le32_to_cpu(map->m_begin[pos - 1]), id);
if (pos >= 0 && pos < map->m_used_slots_count && le32_to_cpu(map->m_begin[pos]) < id)
die("check_id_search_result: found id (%u) not much than (%u)",
le32_to_cpu(map->m_begin[pos]), id);
}
}
/* */
struct id_map * init_id_map (void)
{
struct id_map * map;
map = getmem (sizeof (struct id_map));
map->m_begin = NULL;
map->m_used_slots_count = 0;
map->m_page_count = 0;
mark_objectid_really_used (map, 1);
return map;
}
/* free whole map */
void free_id_map (struct id_map * map)
{
freemem (map->m_begin);
freemem (map);
}
/* return 1 if id is marked used, 0 otherwise */
int is_objectid_really_used (struct id_map * map, __u32 id, __u32 * ppos)
{
int res;
__u32 le_id = cpu_to_le32 (id);
*ppos = 0;
if (map->m_begin == NULL)
return 0;
/* smth exists in the map, find proper place to insert or this id */
res = reiserfs_bin_search (&le_id, map->m_begin, map->m_used_slots_count,
sizeof (__u32), ppos, comp_ids);
#if 1
check_id_search_result (map, res, *ppos, id);
#endif
/* *ppos is position in objectid map of the element which is equal id
or position of an element which is smallest and greater than id */
if (res == POSITION_NOT_FOUND)
/* id is not found in the map. if returned position is odd -
id is marked used */
return (*ppos % 2);
/* if returned position is odd - id is marked free */
return !(*ppos % 2);
}
static void check_objectid_map (struct id_map * map, int pos)
{
/* check only previous id, current and 2 next ones,
if not specified to check evth */
int count = 3;
int i;
int first = pos;
if (first == 0) {
first = 1;
} else if (first == -1) {
count = map->m_used_slots_count - 1;
first = 1;
}
if (first + count > map->m_used_slots_count)
count = map->m_used_slots_count - first;
for (i = first; i < first + count; i ++)
if (le32_to_cpu(map->m_begin [i - 1]) >= le32_to_cpu(map->m_begin [i]))
die ("check_objectid_map: map corrupted");
}
int __mark_objectid_really_used(struct id_map *map, __u32 id, __u32 pos) {
map->objectids_marked ++;
if (pos % 2 == 0){
/* id not found in the map. why? is_id_used() knows */
if (map->m_begin == NULL)
/* map is empty */
grow_id_map (map);
/* id + 1 is used, change id + 1 to id and exit */
if ( id + 1 == le32_to_cpu (map->m_begin[pos]) ) {
/* we can mark id as used w/o expanding of id map */
map->m_begin[pos] = cpu_to_le32 (id);
check_objectid_map (map, pos);
return 0;
}
if (map->m_page_count * MAP_SIZE == map->m_used_slots_count * sizeof(__u32))
/* fixme: do not grow too much */
grow_id_map (map);
if (map->m_used_slots_count - pos > 0)
memmove (map->m_begin + pos + 2, map->m_begin + pos, (map->m_used_slots_count - pos) * sizeof (__u32));
map->m_used_slots_count += 2;
map->m_begin[pos] = cpu_to_le32 (id);
map->m_begin[pos+1] = cpu_to_le32 (id + 1);
check_objectid_map (map, pos);
return 0;
}
/* id found in the map. pos is odd position () */
map->m_begin[pos] = cpu_to_le32 (id + 1);
/* if end id of current interval == start id of next interval we
eliminated a sequence of unused objectids */
if (pos + 1 < map->m_used_slots_count &&
map->m_begin[pos + 1] == map->m_begin[pos]) { /* safe, both are le */
memmove (map->m_begin + pos, map->m_begin + pos + 2, (map->m_used_slots_count - pos - 2) * sizeof (__u32));
map->m_used_slots_count -= 2;
try_to_shrink_id_map (map);
}
check_objectid_map (map, pos);
return 0;
}
/* returns 1 objectid is marked used already, 0 otherwise */
int mark_objectid_really_used (struct id_map * map, __u32 id)
{
__u32 pos;
/* check whether id is used and get place if used or place to insert if not */
if (is_objectid_really_used (map, id, &pos) == 1)
return 1;
return __mark_objectid_really_used(map, id, pos) ;
}
static __u32 get_free_id (reiserfs_filsys_t * fs)
{
struct id_map * map;
map = proper_id_map (fs);
/* If map is not NULL return the second element (first position in
the map). This allocates the first unused objectid. That is to
say, the first entry on the objectid map is the first unused
objectid. */
if (map->m_begin == NULL) {
fprintf (stderr, "get_free_id: hmm, 1 is allocated as objectid\n");
return 1;
}
return (le32_to_cpu (map->m_begin[1]));
}
__u32 get_unused_objectid (reiserfs_filsys_t * fs)
{
__u32 objectid;
objectid = get_free_id (fs);
if (mark_objectid_really_used (proper_id_map (fs), objectid))
die ("get_unused_objectid: could not mark %lu used",
( long unsigned ) objectid);
return objectid;
}
#define objectid_map(fs) ((char *)((char *)((fs)->s_rs) + sb_size (fs)))
#if 0
/* returns 0 if on-disk objectid map matches to the correct one, 1
otherwise */
int compare_id_maps (reiserfs_filsys_t * fs)
{
struct id_map * map;
int disk_size;
map = proper_id_map (fs);
disk_size = rs_objectid_map_size (fs->s_rs);
if (disk_size != map->m_used_slots_count ||
memcmp ((char *)((char *)((fs)->s_rs) + sb_size (fs)), map->m_begin, sizeof(__u32) * disk_size)) {
fprintf (stderr, "Objectid maps mismatch\n");
return 1;
}
return 0;
}
/* copy objectid map into buffer containing super block */
void correct_objectid_map (reiserfs_filsys_t * fs)
{
struct id_map * map;
int size, disk_max;
void id_map_free(id_map_t *map) {
__u32 i;
map = proper_id_map (fs);
size = map->m_used_slots_count;
disk_max = rs_objectid_map_max_size (fs->s_rs);
if (disk_max < size) {
size = disk_max;
} else {
memset (fu_objectid_map (fs) + size, 0, (disk_max - size) * sizeof (__u32));
for (i = 0; i < INDEX_COUNT; i++) {
if (map->index[i] != (void *)0 && map->index[i] != (void *)1)
freemem(map->index[i]);
}
memcpy (fu_objectid_map (fs), map->m_begin, size * sizeof (__u32));
set_objectid_map_size (fs->s_rs, size);
mark_buffer_dirty (SB_BUFFER_WITH_SB (fs));
freemem(map->index);
freemem(map);
}
int id_map_test(id_map_t *map, __u32 id) {
void **interval = id_map_interval(map, id);
if (*interval == (void *)0)
return 0;
if (*interval == (void *)1)
return 1;
return misc_test_bit(id % BM_INTERVAL, *interval);
}
int id_map_mark(id_map_t *map, __u32 id) {
void **interval = id_map_interval(map, id);
if (*interval == (void *)0)
*interval = getmem(ALLOC_SIZE);
if (*interval == (void *)1)
return 1;
if (misc_test_bit(id % BM_INTERVAL, *interval))
return 1;
misc_set_bit(id % BM_INTERVAL, *interval);
(*(__u16 *)id_map_local_count(*interval))++;
map->count++;
if ((*(__u16 *)id_map_local_count(*interval)) == BM_INTERVAL) {
/* Dealloc fully used bitmap */
freemem(*interval);
*interval = (void *)1;
}
if (map->last_used < (id / BM_INTERVAL))
map->last_used = id / BM_INTERVAL;
return 0;
}
/* call this for proper_id_map only!! */
__u32 id_map_alloc(id_map_t *map) {
__u32 i, zero_count;
__u32 id = 0, first = ~0ul;
for (i = 0, zero_count = 0; zero_count < 10 && i < INDEX_COUNT - 1; i++) {
if (map->index[i] == (void *)0) {
if (zero_count == 0)
first = i;
zero_count++;
} else if (map->index[i] != (void *)1)
break;
}
if (map->index[i] != (void *)1 && map->index[i] != (void *)0) {
id = misc_find_first_zero_bit(map->index[i], BM_INTERVAL);
if (id >= BM_INTERVAL)
die ("Id is out of interval size, interval looks corrupted.");
id += i * BM_INTERVAL;
} else if (first != ~0ul) {
id = first * BM_INTERVAL;
if (id == 0)
id = 2;
} else
die ("%s: No more free objectid is available.", __FUNCTION__);
id_map_mark(map, id);
return id;
}
/* this could be used if some more sofisticated flushing will be needed. */
/*
if (fs->fu_job->verbose)
fprintf (stderr, "Objectid map corrected\n");
*/
}
#endif
static void sb_id_map_pack(sb_id_map_t *map) {
map->m_begin[1] = map->m_begin[map->m_used_slot_count - 1];
memset(map->m_begin + 2, 0, map->m_used_slot_count - 2);
map->m_used_slot_count = 2;
}*/
static __u32 id_map_next_bound(id_map_t *map, __u32 start) {
__u32 index = start / BM_INTERVAL;
__u32 offset = start % BM_INTERVAL;
int look_for;
if (map->index[index] == (void *)0)
look_for = 1;
else if (map->index[index] == (void *)1)
look_for = 0;
else
look_for = !misc_test_bit(offset, map->index[index]);
/* print the map of objectids */
void print_objectid_list (__u32 *map, int count)
{
int i;
for (i = 0; i < count ; i += 2)
printf ("\n[%u-%u]", le32_to_cpu(map[i]),le32_to_cpu(map[i+1]));
offset++;
start_again:
if (look_for) {
while (index < INDEX_COUNT && map->index[index] == (void *)0)
index++;
if (index == INDEX_COUNT)
return 0;
if (map->index[index] == (void *)1)
return index * BM_INTERVAL;
offset = misc_find_next_set_bit(map->index[index], BM_INTERVAL, offset);
if (offset >= BM_INTERVAL) {
offset = 0;
index++;
goto start_again;
}
return index * BM_INTERVAL + offset;
} else {
while (index < INDEX_COUNT && map->index[index] == (void *)1)
index++;
if (index == INDEX_COUNT)
return 0;
if (map->index[index] == (void *)0)
return index * BM_INTERVAL;
offset = misc_find_next_zero_bit(map->index[index], BM_INTERVAL, offset);
if (offset >= BM_INTERVAL) {
offset = 0;
index++;
goto start_again;
}
return index * BM_INTERVAL + offset;
}
}
#if 0
/* print on-disk map of objectids */
void print_disk_objectid_list (void)
{
int i;
__u32 * objectid_map = (__u32 *)((char *)SB_DISK_SUPER_BLOCK (&g_sb) + (sb_size(&g_sb)));
printf ("\n on-disk id map. used:%lu", SB_OBJECTID_MAP_SIZE(&g_sb));
for (i = 0; i < SB_OBJECTID_MAP_SIZE(&g_sb); i += 2)
printf ("\n[%u-%u]", objectid_map[i], objectid_map[i + 1] - 1);
}
#endif
void flush_objectid_map (struct id_map * map, reiserfs_filsys_t * fs)
{
int size, max;
int sb_size;
void id_map_flush(struct id_map * map, reiserfs_filsys_t * fs) {
int size, max, i;
__u32 id, prev_id;
__u32 * sb_objectid_map;
sb_size = reiserfs_super_block_size (fs->fs_ondisk_sb);
sb_objectid_map = (__u32 *)((char *)(fs->fs_ondisk_sb) + sb_size);
size = reiserfs_super_block_size (fs->fs_ondisk_sb);
sb_objectid_map = (__u32 *)((char *)(fs->fs_ondisk_sb) + size);
max = ((fs->fs_blocksize - sb_size) >> 3 << 1);
max = ((fs->fs_blocksize - size) >> 3 << 1);
set_sb_oid_maxsize (fs->fs_ondisk_sb, max);
if (map->m_used_slots_count > max)
size = max;
else
size = map->m_used_slots_count;
sb_objectid_map[0] = id = 1;
check_objectid_map (map, -1);
for (i = 1; i < max - 1; i++) {
sb_objectid_map[i] = id = id_map_next_bound(map, id);
if (id == 0) {
if (i % 2)
die ("%s: Used interval is not closed on flushing.", __FUNCTION__);
break;
}
}
memcpy (sb_objectid_map, map->m_begin, size * sizeof (__u32));
memset (sb_objectid_map + size, 0, (max - size) * sizeof (__u32));
if (map->index[map->last_used] == (void *)0)
die ("Object id map looks corrupted - last used interval cannot be zeroed.");
i++;
if (i == max) {
if (id == 0)
die ("Objectid interval does not contain any set bit what is expected.");
if (map->index[map->last_used] == (void *)1) {
prev_id = BM_INTERVAL - 1;
} else {
prev_id = ~0ul;
if (id < map->last_used * BM_INTERVAL)
id = 0;
else
id %= BM_INTERVAL;
if (misc_test_bit(id, map->index[map->last_used]))
prev_id = id;
while ((id = misc_find_next_set_bit(map->index[map->last_used],
BM_INTERVAL, (id + 1))) != BM_INTERVAL)
{
prev_id = id;
}
set_sb_oid_cursize (fs->fs_ondisk_sb, size);
if (size == max)
sb_objectid_map [max - 1] = map->m_begin [map->m_used_slots_count - 1];
if (prev_id == ~0ul)
die ("Objectid interval does not contain any set bit what is expected.");
// check_objectid_map (map);
prev_id++;
}
sb_objectid_map[max - 1] = prev_id + map->last_used * BM_INTERVAL;
} else {
i--;
memset(sb_objectid_map + i, 0, (max - i) * sizeof (__u32));
}
set_sb_oid_cursize (fs->fs_ondisk_sb, i);
}
/* FIXME: these 3 methods must be implemented also.
void fetch_objectid_map (struct id_map * map, reiserfs_filsys_t * fs)
{
@@ -386,9 +275,10 @@ void fetch_objectid_map (struct id_map * map, reiserfs_filsys_t * fs)
if (map->m_page_count != 1)
die ("fetch_objectid_map: can not fetch long map");
grow_id_map (map);
make_id_space(map, 0);
memcpy (map->m_begin, sb_objectid_map, get_sb_oid_cursize (fs->fs_ondisk_sb) * sizeof (__u32));
map->m_used_slots_count = get_sb_oid_cursize (fs->fs_ondisk_sb);
map->m_used_slot_count = get_sb_oid_cursize (fs->fs_ondisk_sb);
}
#define OBJMAP_START_MAGIC 375331
@@ -402,14 +292,14 @@ void reiserfs_objectid_map_save (FILE * fp, struct id_map * id_map)
v = OBJMAP_START_MAGIC;
fwrite (&v, 4, 1, fp);
v = id_map->m_used_slots_count;
v = id_map->m_used_slot_count;
fwrite (&v, 4, 1, fp);
for (i = 0; i < id_map->m_page_count - 1; i++) {
fwrite ((char *)id_map->m_begin + MAP_SIZE * i, 4, 1, fp);
}
for (i = 0; i < id_map->m_used_slots_count * sizeof(__u32) - (id_map->m_page_count - 1) * MAP_SIZE; i++) {
for (i = 0; i < id_map->m_used_slot_count * sizeof(__u32) - (id_map->m_page_count - 1) * MAP_SIZE; i++) {
fwrite ((char *)id_map->m_begin + MAP_SIZE * (id_map->m_page_count - 1) + i, 4, 1, fp);
}
@@ -429,12 +319,12 @@ struct id_map * reiserfs_objectid_map_load (FILE * fp)
return 0;
}
/* read bit size of objectid map */
// read bit size of objectid map
fread (&v, 4, 1, fp);
id_map = init_id_map ();
id_map = init_id_map (MAP_NOT_PACKED);
id_map->m_used_slots_count = v;
id_map->m_used_slot_count = v;
id_map->m_page_count = v / MAP_SIZE + 1;
id_map->m_begin = expandmem (id_map->m_begin, 0, id_map->m_page_count * MAP_SIZE);
@@ -443,7 +333,7 @@ struct id_map * reiserfs_objectid_map_load (FILE * fp)
fread ((char *)id_map->m_begin + MAP_SIZE * i, 4, 1, fp);
}
for (i = 0; i < id_map->m_used_slots_count * sizeof(__u32) - (id_map->m_page_count - 1) * MAP_SIZE; i++) {
for (i = 0; i < id_map->m_used_slot_count * sizeof(__u32) - (id_map->m_page_count - 1) * MAP_SIZE; i++) {
fread ((char *)id_map->m_begin + MAP_SIZE * (id_map->m_page_count - 1) + i, 4, 1, fp);
}
@@ -457,4 +347,4 @@ struct id_map * reiserfs_objectid_map_load (FILE * fp)
fflush (stderr);
return id_map;
}
*/
+10 -5
View File
@@ -1,6 +1,8 @@
/*
* Copyright 1996-2002 Hans Reiser
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "fsck.h"
@@ -50,7 +52,7 @@ void reiserfsck_insert_item (struct path * path, struct item_head * ih, const ch
static void free_unformatted_nodes (struct item_head * ih, struct buffer_head * bh)
{
__u32 * punfm = (__u32 *)B_I_PITEM (bh, ih);
int i;
unsigned int i;
for (i = 0; i < I_UNFM_NUM (ih); i ++, punfm ++)
if (*punfm != 0) {
@@ -67,7 +69,6 @@ static void free_unformatted_nodes (struct item_head * ih, struct buffer_head *
}
}
void reiserfsck_delete_item (struct path * path, int temporary)
{
struct tree_balance tb;
@@ -201,7 +202,7 @@ static void erase (void)
}
void pass_through_tree (reiserfs_filsys_t * fs, do_after_read_t action1,
do_on_full_path_t action2)
do_on_full_path_t action2, int depth)
{
struct buffer_head * path[MAX_HEIGHT] = {0,};
int total[MAX_HEIGHT] = {0,};
@@ -227,7 +228,7 @@ void pass_through_tree (reiserfs_filsys_t * fs, do_after_read_t action1,
fsck_log ("%s: block %lu specified in badblock list found in tree, whole subtree skipped\n",
__FUNCTION__, block);
fsck_data (fs)->check.bad_nodes++;
one_more_corruption (fs, fatal);
one_more_corruption (fs, FATAL);
if (h == 0) {
brelse (path[h]);
@@ -256,6 +257,10 @@ void pass_through_tree (reiserfs_filsys_t * fs, do_after_read_t action1,
}
}
/* Time to stop. */
if (h == depth)
problem ++;
if (problem || is_leaf_node (path[h])) {
if (!problem && action2)
action2 (fs, path, h);
+219 -136
View File
@@ -1,6 +1,8 @@
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -10,221 +12,302 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
noinst_HEADERS = io.h misc.h reiserfs_fs.h reiserfs_lib.h swab.h
subdir = include
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
HEADERS = $(noinst_HEADERS)
CONFIG_CLEAN_FILES =
DIST_SOURCES =
HEADERS = $(noinst_HEADERS)
DIST_COMMON = ./stamp-h.in Makefile.am Makefile.in config.h.in
DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in config.h.in
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps include/Makefile
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu include/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
config.h: stamp-h
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h; \
$(MAKE) stamp-h; \
rm -f stamp-h1; \
$(MAKE) stamp-h1; \
else :; fi
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES= CONFIG_HEADERS=include/config.h \
$(SHELL) ./config.status
@echo timestamp > stamp-h 2> /dev/null
$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
@if test ! -f $@; then \
rm -f $(srcdir)/stamp-h.in; \
$(MAKE) $(srcdir)/stamp-h.in; \
else :; fi
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status include/config.h
$(srcdir)/config.h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOHEADER)
@echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
mostlyclean-hdr:
clean-hdr:
touch $(srcdir)/config.h.in
distclean-hdr:
-rm -f config.h
-rm -f config.h stamp-h1
uninstall-info-am:
maintainer-clean-hdr:
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
mkid -fID $$unique
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
mostlyclean-tags:
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
clean-tags:
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = include
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
all-recursive-am: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
all-am: Makefile $(HEADERS) config.h
install-exec-am:
installdirs:
install: install-am
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am:
uninstall: uninstall-am
all-am: Makefile $(HEADERS) config.h
all-redirect: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-hdr clean-tags clean-generic mostlyclean-am
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
distclean-am: distclean-hdr distclean-tags distclean-generic clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am:
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
tags mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
distdir info-am info dvi-am dvi check check-am installcheck-am \
installcheck all-recursive-am install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic ctags \
distclean distclean-generic distclean-hdr distclean-tags \
distdir dvi dvi-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
+38 -26
View File
@@ -1,70 +1,67 @@
/* include/config.h.in. Generated automatically from configure.in by autoheader. */
/*
* Copyright 1996, 1997 Hans Reiser, see reiserfs/README for licensing and copyright details
*/
/* include/config.h.in. Generated from configure.in by autoheader. */
/* Define if you don't have `vprintf' but do have `_doprnt.' */
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
#undef HAVE_DOPRNT
/* Define if you have the <fcntl.h> header file. */
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <inttypes.h> header file. */
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have the <limits.h> header file. */
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have the <malloc.h> header file. */
/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define if you have the <memory.h> header file. */
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if you have the <stdint.h> header file. */
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define if you have the <stdlib.h> header file. */
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define if you have the `strerror' function. */
/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define if you have the `strftime' function. */
/* Define to 1 if you have the `strftime' function. */
#undef HAVE_STRFTIME
/* Define if you have the <strings.h> header file. */
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define if you have the <string.h> header file. */
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the `strstr' function. */
/* Define to 1 if you have the `strstr' function. */
#undef HAVE_STRSTR
/* Define if you have the `strtol' function. */
/* Define to 1 if you have the `strtol' function. */
#undef HAVE_STRTOL
/* Define if `st_rdev' is member of `struct stat'. */
/* Define to 1 if `st_rdev' is member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_RDEV
/* Define if your `struct stat' has `st_rdev'. Deprecated, use
/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use
`HAVE_STRUCT_STAT_ST_RDEV' instead. */
#undef HAVE_ST_RDEV
/* Define if you have the <sys/ioctl.h> header file. */
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define if you have the <sys/stat.h> header file. */
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define if you have the <sys/types.h> header file. */
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define if you have the <unistd.h> header file. */
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the `vprintf' function. */
/* Define to 1 if you have the `vprintf' function. */
#undef HAVE_VPRINTF
/* gets set when configure --enable-io-failure-emulation */
@@ -73,7 +70,22 @@
/* Name of package */
#undef PACKAGE
/* Define if you have the ANSI C header files. */
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
+16 -17
View File
@@ -1,11 +1,11 @@
/*
* Copyright 1996-2002 Hans Reiser
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
struct buffer_head {
unsigned long b_blocknr;
unsigned short b_dev;
int b_dev;
unsigned long b_size;
char * b_data;
unsigned long b_state;
@@ -26,16 +26,16 @@ struct buffer_head {
#define BH_Do_not_flush 3
#define buffer_uptodate(bh) test_bit(BH_Uptodate, &(bh)->b_state)
#define buffer_dirty(bh) test_bit(BH_Dirty, &(bh)->b_state)
#define buffer_locked(bh) test_bit(BH_Lock, &(bh)->b_state)
#define buffer_clean(bh) !test_bit(BH_Dirty, &(bh)->b_state)
#define buffer_do_not_flush(bh) test_bit(BH_Do_not_flush, &(bh)->b_state)
#define mark_buffer_dirty(bh) set_bit(BH_Dirty, &(bh)->b_state)
#define mark_buffer_uptodate(bh,i) set_bit(BH_Uptodate, &(bh)->b_state)
#define mark_buffer_clean(bh) clear_bit(BH_Dirty, &(bh)->b_state)
#define mark_buffer_do_not_flush(bh) set_bit(BH_Do_not_flush, &(bh)->b_state)
#define clear_buffer_do_not_flush(bh) clear_bit(BH_Do_not_flush, &(bh)->b_state)
#define buffer_uptodate(bh) misc_test_bit(BH_Uptodate, &(bh)->b_state)
#define buffer_dirty(bh) misc_test_bit(BH_Dirty, &(bh)->b_state)
#define buffer_locked(bh) misc_test_bit(BH_Lock, &(bh)->b_state)
#define buffer_clean(bh) !misc_test_bit(BH_Dirty, &(bh)->b_state)
#define buffer_do_not_flush(bh) misc_test_bit(BH_Do_not_flush, &(bh)->b_state)
#define mark_buffer_dirty(bh) misc_set_bit(BH_Dirty, &(bh)->b_state)
#define mark_buffer_uptodate(bh,i) misc_set_bit(BH_Uptodate, &(bh)->b_state)
#define mark_buffer_clean(bh) misc_clear_bit(BH_Dirty, &(bh)->b_state)
#define mark_buffer_do_not_flush(bh) misc_set_bit(BH_Do_not_flush, &(bh)->b_state)
#define clear_buffer_do_not_flush(bh) misc_clear_bit(BH_Do_not_flush, &(bh)->b_state)
/*
printf ("%s:%s:%u %p %p %p\n",
@@ -51,7 +51,7 @@ void __wait_on_buffer (struct buffer_head * bh);
struct buffer_head * getblk (int dev, unsigned long block, int size);
struct buffer_head * reiserfs_getblk (int dev, unsigned long block, int size, int *repeat);
struct buffer_head * find_buffer (int dev, unsigned long block, int size);
struct buffer_head * find_buffer (int dev, unsigned long block, unsigned long size);
struct buffer_head * get_hash_table(dev_t dev, unsigned long block, int size);
struct buffer_head * bread (int dev, unsigned long block, size_t size);
struct buffer_head * reiserfs_bread (int dev, unsigned long block, int size, int *repeat);
@@ -59,15 +59,14 @@ int valid_offset (int fd, loff_t offset);
int bwrite (struct buffer_head * bh);
void brelse (struct buffer_head * bh);
void bforget (struct buffer_head * bh);
void check_and_free_buffer_mem (void);
void init_rollback_file (char * rollback_file, int *bloksize, FILE * log);
int open_rollback_file (char * rollback_file, FILE * log);
void close_rollback_file ();
void do_fsck_rollback (int fd_device, int fd_journal_device, FILE * log);
void flush_buffers (dev_t);
void flush_buffers (int);
void free_buffers (void);
void invalidate_buffers (dev_t dev);
void invalidate_buffers (int);
int user_confirmed (FILE * fp, char * q, char * yes);
+26 -15
View File
@@ -1,5 +1,6 @@
/*
* Copyright 1996-2002 Hans Reiser
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
/* nothing abount reiserfs here */
@@ -19,15 +20,18 @@
void check_memory_msg(void);
void die (char * fmt, ...) __attribute__ ((format (printf, 1, 2)));
void * getmem (int size);
void *mem_alloc(int size);
void freemem (void * p);
void checkmem (char * p, int size);
void * expandmem (void * p, int size, int by);
int get_mem_size (char * p);
unsigned int get_mem_size (char * p);
int is_mounted (char * device_name);
int is_mounted_read_only (char * device_name);
void check_and_free_mem (void);
char * kdevname (int dev);
void misc_print_credit(FILE *out);
typedef struct dma_info {
int fd;
struct stat64 stat;
@@ -40,7 +44,7 @@ int prepare_dma_check(dma_info_t *dma_info);
int get_dma_info(dma_info_t *dma_info);
void clean_after_dma_check(int fd, dma_info_t *dma_info);
void print_how_far (FILE * fp, unsigned long * passed, unsigned long total, int inc, int quiet);
void print_how_far (FILE * fp, unsigned long *passed, unsigned long total, unsigned int inc, int quiet);
void print_how_fast (unsigned long total,
unsigned long passed, int cursor_pos, int reset_time);
__u32 get_random (void);
@@ -49,27 +53,34 @@ int generate_random_uuid (unsigned char * uuid);
int uuid_is_correct (unsigned char * uuid);
int set_uuid (const unsigned char * text, unsigned char * UUID);
#include <asm/bitops.h>
//#include <asm/bitops.h>
extern inline int misc_set_bit (unsigned long long nr, void * addr);
extern inline int misc_clear_bit (unsigned long long nr, void * addr);
extern inline int misc_test_bit(unsigned long long nr, const void * addr);
extern inline unsigned long long misc_find_first_zero_bit (const void *vaddr, unsigned long long size);
extern inline unsigned long long misc_find_next_zero_bit (const void *vaddr, unsigned long long size, unsigned long long offset);
extern inline unsigned long long misc_find_next_set_bit(const void *vaddr, unsigned long long size, unsigned long long offset);
extern inline unsigned long long misc_find_first_set_bit (const void *vaddr, unsigned long long size);
#if __BYTE_ORDER == __LITTLE_ENDIAN
int le_set_bit (int nr, void * addr);
int le_clear_bit (int nr, void * addr);
int le_test_bit(int nr, const void * addr);
int le_find_first_zero_bit (const void *vaddr, unsigned size);
int le_find_next_zero_bit (const void *vaddr, unsigned size, unsigned offset);
# define cpu_to_le16(val) (val)
# define le16_to_cpu(val) (val)
# define cpu_to_le32(val) (val)
# define le32_to_cpu(val) (val)
# define cpu_to_le64(val) (val)
# define le64_to_cpu(val) (val)
#elif __BYTE_ORDER == __BIG_ENDIAN
# define cpu_to_le16(val) swab16(val)
# define le16_to_cpu(val) swab16(val)
# define cpu_to_le32(val) swab32(val)
# define le32_to_cpu(val) swab32(val)
# define cpu_to_le64(val) swab64(val)
# define le64_to_cpu(val) swab64(val)
# define cpu_to_le16(val) __swab16(val)
# define le16_to_cpu(val) __swab16(val)
# define cpu_to_le32(val) __swab32(val)
# define le32_to_cpu(val) __swab32(val)
# define cpu_to_le64(val) __swab64(val)
# define le64_to_cpu(val) __swab64(val)
#else
# error "nuxi/pdp-endian archs are not supported"
#endif
+56 -52
View File
@@ -1,7 +1,8 @@
/*
* Copyright 1996-2002 by Hans Reiser, licensing governed by reiserfs/README
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
/*
* Reiser File System constants and structures
*/
@@ -167,8 +168,8 @@ struct reiserfs_super_block_v1
/* values for sb_mount_state field */
#define REISERFS_CLEANLY_UMOUNTED 1 /* this was REISERFS_VALID_FS */
#define REISERFS_NOT_CLEANLY_UMOUNTED 2 /* this was REISERFS_ERROR. It
#define FS_CLEANLY_UMOUNTED 1 /* this was REISERFS_VALID_FS */
#define FS_NOT_CLEANLY_UMOUNTED 2 /* this was REISERFS_ERROR. It
means that filesystem was not
cleanly unmounted */
@@ -244,9 +245,10 @@ typedef enum {
#define get_sb_v2_inode_generation(sb) get_le32 (sb, sb_inode_generation)
#define set_sb_v2_inode_generation(sb,val) set_le32 (sb, sb_inode_generation, val)
//#define get_sb_v2_flag(sb, flag) test_bit ((flag), &((struct reiserfs_super_block *)sb)->s_flags)
//#define set_sb_v2_flag(sb, flag) set_bit ((flag), &((struct reiserfs_super_block *)sb)->s_flags)
#define get_sb_v2_flag(sb, flag) (get_le32 (sb, s_flags) & flag)
#define get_sb_v2_flags(sb) get_le32 (sb, s_flags)
#define set_sb_v2_flags(sb, val) set_le32 (sb, s_flags, val)
#define get_sb_v2_flag(sb, flag) (get_le32 (sb, s_flags) & flag)
#define set_sb_v2_flag(sb, flag) set_le32 (sb, s_flags, get_le32 (sb, s_flags) | flag)
#define clear_sb_v2_flag(sb, flag) set_le32 (sb, s_flags, get_le32 (sb, s_flags) & ~(flag))
@@ -255,22 +257,20 @@ typedef enum {
*/
/* these are possible values for sb_fs_state */
#define REISERFS_CONSISTENT 0 /* this is set by mkreiserfs and by reiserfsck */
#define REISERFS_CORRUPTED 0x1 /* this will be set by kernel code when it
encounters suspicious metadata */
#define PASS_0_DONE 0xfaa1 /* set by fsck when pass-by-pass (-d),
REISERFS_CORRUPTED flag included */
#define PASS_1_DONE 0xfaa3 /* set by fsck when pass-by-pass (-d),
REISERFS_CORRUPTED flag included */
#define TREE_IS_BUILT 0xfaa5 /* set by fsck when pass-by-pass (-d),
REISERFS_CORRUPTED flag included */
#define SEMANTIC_DONE 0xfaa7 /* set by fsck when pass-by-pass (-d),
REISERFS_CORRUPTED flag included */
#define LOST_FOUND_DONE 0xfaa9 /* set by fsck when pass-by-pass (-d),
REISERFS_CORRUPTED flag included */
//#define FIX_FIXABLE_IS_ALLOWED 0xfaa7
#define FS_CONSISTENT 0x0 /* this is set by mkreiserfs and by reiserfsck */
#define FS_ERROR 0x1 /* this is set by the kernel when fsck is wanted. */
#define FS_FATAL 0x2 /* this is set by fsck when fatal corruption is found */
#define IO_ERROR 0x4 /* this is set by kernel when io error occures */
#define PASS_0_DONE 0xfa02 /* set by fsck when pass-by-pass (-d),
FS_FATAL flag included */
#define PASS_1_DONE 0xfb02 /* set by fsck when pass-by-pass (-d),
FS_FATAL flag included */
#define TREE_IS_BUILT 0xfc02 /* set by fsck when pass-by-pass (-d),
FS_FATAL flag included */
#define SEMANTIC_DONE 0xfd02 /* set by fsck when pass-by-pass (-d),
FS_FATAL flag included */
#define LOST_FOUND_DONE 0xfe02 /* set by fsck when pass-by-pass (-d),
FS_FATAL flag included */
/* struct stat_data* access macros */
/* v1 */
@@ -462,7 +462,7 @@ struct reiserfs_journal_header {
blocksize * 8 - (block_of_super_block + 1 + 1 + 1)
#define journal_default_size(block_of_super_block,blocksize) \
((8192 > journal_max_size (block_of_super_block,blocksize)) ? \
(unsigned long long)((8192 > journal_max_size (block_of_super_block,blocksize)) ? \
journal_max_size (block_of_super_block,blocksize) : 8192)
//#define JOURNAL_DEFAULT_SIZE 8192 number of blocks in the journal
@@ -555,6 +555,8 @@ struct key {
#define TYPE_UNKNOWN 15
/* special type for symlink not conflicting to any of item types. */
#define TYPE_SYMLINK 4
#define KEY_FORMAT_1 0
#define KEY_FORMAT_2 1
@@ -1062,12 +1064,12 @@ struct path_element {
};
#define MAX_HEIGHT 5 /* maximal height of a tree. don't change this without changing JOURNAL_PER_BALANCE_CNT */
#define EXTENDED_MAX_HEIGHT 7 /* Must be equals MAX_HEIGHT + FIRST_PATH_ELEMENT_OFFSET */
#define FIRST_PATH_ELEMENT_OFFSET 2 /* Must be equal to at least 2. */
#define MAX_HEIGHT 6
#define FIRST_PATH_ELEMENT_OFFSET 2
#define EXTENDED_MAX_HEIGHT (MAX_HEIGHT + FIRST_PATH_ELEMENT_OFFSET)
#define ILLEGAL_PATH_ELEMENT_OFFSET 1 /* Must be equal to FIRST_PATH_ELEMENT_OFFSET - 1 */
#define MAX_FEB_SIZE 6 /* this MUST be MAX_HEIGHT + 1. See about FEB below */
#define ILLEGAL_PATH_ELEMENT_OFFSET 1
#define MAX_FEB_SIZE (MAX_HEIGHT + 1)
@@ -1081,9 +1083,9 @@ struct path_element {
in it, especially about decrement_counters_in_path(), to understand
this structure. */
struct path {
int path_length; /* Length of the array above. */
unsigned int path_length; /* Length of the array above. */
struct path_element path_elements[EXTENDED_MAX_HEIGHT]; /* Array of the path elements. */
int pos_in_item;
unsigned int pos_in_item;
};
#define INITIALIZE_PATH(var) \
@@ -1136,21 +1138,21 @@ struct path var = {ILLEGAL_PATH_ELEMENT_OFFSET, }
// search_by_key (and clones) and fix_nodes error code
#define CARRY_ON 0
#define IO_ERROR 3
#define CARRY_ON 0
#define NO_DISK_SPACE 4
#define NO_BALANCING_NEEDED 5
#define ITEM_FOUND 6
#define ITEM_NOT_FOUND 7
#define GOTO_PREVIOUS_ITEM 10
#define POSITION_FOUND_INVISIBLE 11
#define FILE_NOT_FOUND 12
#define NO_DISK_SPACE 3
/* #define IO_ERROR 0x4 - defined above as 0x4 */
#define NO_BALANCING_NEEDED 5
#define ITEM_FOUND 6
#define ITEM_NOT_FOUND 7
#define GOTO_PREVIOUS_ITEM 10
#define POSITION_FOUND_INVISIBLE 11
#define FILE_NOT_FOUND 12
// used by fsck
#define DIRECTORY_NOT_FOUND 13
#define REGULAR_FILE_FOUND 14
#define DIRECTORY_FOUND 15
#define DIRECTORY_NOT_FOUND 13
#define REGULAR_FILE_FOUND 14
#define DIRECTORY_FOUND 15
struct unfm_nodeinfo {
@@ -1167,17 +1169,19 @@ struct unfm_nodeinfo {
#define MAX_KEY2_OFFSET 0xfffffffffffffffLL
/* this is aggressive tail suppression policy taken from the kernel */
/* It should be MAX_DIRECT_ITEM_LEN used here, but sometimes it is not enough,
* and items got deleted. */
#define STORE_TAIL_IN_UNFM(n_file_size,n_tail_size,n_block_size) \
(\
(!(n_tail_size)) || \
(((n_tail_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) || \
(((n_tail_size) > MAX_ITEM_LEN(n_block_size)) || \
( (n_file_size) >= (n_block_size) * 4 ) || \
( ( (n_file_size) >= (n_block_size) * 3 ) && \
( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size))/4) ) || \
( (n_tail_size) >= (MAX_ITEM_LEN(n_block_size))/4) ) || \
( ( (n_file_size) >= (n_block_size) * 2 ) && \
( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size))/2) ) || \
( (n_tail_size) >= (MAX_ITEM_LEN(n_block_size))/2) ) || \
( ( (n_file_size) >= (n_block_size) ) && \
( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size) * 3)/4) ) ) \
( (n_tail_size) >= (MAX_ITEM_LEN(n_block_size) * 3)/4) ) ) \
)
@@ -1434,7 +1438,7 @@ struct buffer_info {
#define B_I_STAT_DATA(bh, ih) ( (struct stat_data * )B_I_PITEM(bh,ih) )
#define MAX_DIRECT_ITEM_LEN(size) ((size) - BLKH_SIZE - 2*IH_SIZE - SD_SIZE - UNFM_P_SIZE)
#define MAX_INDIRECT_ITEM_LEN(size) ((size) - BLKH_SIZE - IH_SIZE)
#define MAX_INDIRECT_ITEM_LEN(size) MAX_ITEM_LEN(size)
/* indirect items consist of entries which contain blocknrs, pos
indicates which entry, and B_I_POS_UNFM_POINTER resolves to the
@@ -1532,7 +1536,7 @@ void make_empty_leaf (struct buffer_head *);
struct buffer_head * get_FEB (struct tree_balance *);
__u64 get_bytes_number (struct item_head * ih, int blocksize);
__u32 get_bytes_number (struct item_head * ih, int blocksize);
@@ -1545,9 +1549,9 @@ __u32 r5_hash (const char *msg, int len);
/* node_format.c */
int get_journal_old_start_must (reiserfs_filsys_t * fs);
int get_journal_new_start_must (reiserfs_filsys_t * fs);
int get_journal_start_must (reiserfs_filsys_t * fs);
extern unsigned int get_journal_old_start_must (reiserfs_filsys_t * fs);
extern unsigned int get_journal_new_start_must (reiserfs_filsys_t * fs);
extern unsigned int get_journal_start_must (reiserfs_filsys_t * fs);
/*extern hashf_t hashes [];*/
+23 -20
View File
@@ -1,5 +1,6 @@
/*
* Copyright 2000-2002 by Hans Reiser, licensing governed by reiserfs/README
* Copyright 2000-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#ifndef REISERFS_LIB_H
@@ -24,7 +25,7 @@ typedef struct _bitmap reiserfs_bitmap_t;
typedef __u32 (*hashf_t) (const char *, int);
struct reiserfs_filsys {
int fs_blocksize;
unsigned int fs_blocksize;
int fs_format; /* on-disk format version */
hashf_t fs_hash_function; /* pointer to function which is used to sort
names in directory. It is set by
@@ -76,7 +77,7 @@ typedef struct _transaction reiserfs_trans_t;
void init_tb_struct (struct tree_balance * tb, reiserfs_filsys_t *, struct path * path, int size);
reiserfs_filsys_t * reiserfs_open (char * filename, int flags, int * error, void * vp);
reiserfs_filsys_t * reiserfs_open (char * filename, int flags, int * error, void * vp, int skip_check);
reiserfs_filsys_t * reiserfs_create (char * filename, int version, unsigned long block_count,
int block_size, int default_journal, int new_format);
void reiserfs_flush (reiserfs_filsys_t *);
@@ -92,7 +93,7 @@ void reiserfs_read_bitmap_blocks (reiserfs_filsys_t *);
void reiserfs_free_bitmap_blocks (reiserfs_filsys_t *);
*/
int no_reiserfs_found (reiserfs_filsys_t *);
int is_block_count_correct (unsigned long block_of_super_block, int block_size,
int is_block_count_correct (unsigned long block_of_super_block, unsigned int block_size,
unsigned long block_count, unsigned long journal_size);
//unsigned long min_block_amount (int block_size, unsigned long journal_size);
unsigned long get_size_of_journal_or_reserved_area (struct reiserfs_super_block * sb);
@@ -113,9 +114,9 @@ void reiserfs_insert_item (reiserfs_filsys_t *, struct path * path,
int reiserfs_locate_entry (reiserfs_filsys_t *, struct key * dir, char * name,
struct path * path);
int reiserfs_find_entry (reiserfs_filsys_t *, struct key * dir, char * name,
int * min_gen_counter, struct key * key);
unsigned int * min_gen_counter, struct key * key);
int reiserfs_add_entry (reiserfs_filsys_t *, struct key * dir, char * name, int name_len,
struct key * key, int fsck_need);
struct key * key, __u16 fsck_need);
/*int reiserfs_bin_search (void * key, void * base, int num, int width,
@@ -180,8 +181,8 @@ int reiserfs_bitmap_find_zero_bit (reiserfs_bitmap_t * bm, unsigned long * start
/*int reiserfs_flush_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys_t *);*/
void reiserfs_bitmap_zero (reiserfs_bitmap_t * bm);
void reiserfs_bitmap_fill (reiserfs_bitmap_t * bm);
int reiserfs_bitmap_ones (reiserfs_bitmap_t * bm);
int reiserfs_bitmap_zeros (reiserfs_bitmap_t * bm);
unsigned int reiserfs_bitmap_ones (reiserfs_bitmap_t * bm);
unsigned int reiserfs_bitmap_zeros (reiserfs_bitmap_t * bm);
FILE * open_file(char * filename, char * option);
void close_file(FILE * fp);
@@ -210,8 +211,7 @@ int reiserfs_remove_entry (reiserfs_filsys_t *, struct key * key);
#define HAS_IH_ARRAY 5
#define THE_UNKNOWN 6
int correct_direct_item_offset (__u64 offset, int format);
int is_blocksize_correct (int blocksize);
int is_blocksize_correct (unsigned int blocksize);
int is_reiserfs_3_5_magic_string (struct reiserfs_super_block * rs);
int is_reiserfs_3_6_magic_string (struct reiserfs_super_block * rs);
int is_reiserfs_jr_magic_string (struct reiserfs_super_block * rs);
@@ -222,6 +222,12 @@ int reiserfs_super_block_size (struct reiserfs_super_block * rs);
/*int magic_2_version (struct reiserfs_super_block * rs);*/
int is_prejournaled_reiserfs (struct reiserfs_super_block * rs);
int who_is_this (char * buf, int blocksize);
int leaf_count_ih(char * buf, int blocksize);
int leaf_free_space_estimate(char * buf, int blocksize);
int is_a_leaf(char * buf, int blocksize);
int leaf_item_number_estimate(struct buffer_head * bh);
char * which_block (int code);
int get_journal_size (reiserfs_filsys_t *);
int not_data_block (reiserfs_filsys_t *, unsigned long block);
@@ -249,7 +255,7 @@ typedef void (*item_head_action_t) (struct item_head * ih);
void for_every_item (struct buffer_head * bh, item_head_action_t action,
item_action_t * actions);
int key_format (const struct key * key);
loff_t get_offset (const struct key * key);
unsigned long long get_offset (const struct key * key);
int uniqueness2type (__u32 uniqueness);
__u32 type2uniqueness (int type);
int get_type (const struct key * key);
@@ -263,19 +269,16 @@ void set_type_and_offset (int format, struct key * key, loff_t offset, int type)
typedef int (*check_unfm_func_t) (reiserfs_filsys_t *, __u32);
int is_it_bad_item (reiserfs_filsys_t *, struct item_head *, char *,
check_unfm_func_t, int bad_dir);
int does_node_have_ih_array (char * buf, int blocksize);
#define hash_func_is_unknown(fs) ((fs)->fs_hash_function == 0)
#define reiserfs_hash(fs) ((fs)->fs_hash_function)
int known_hashes (void);
char * code2name (int code);
char *code2name (unsigned int code);
int func2code (hashf_t func);
hashf_t code2func (int code);
hashf_t code2func (unsigned int code);
hashf_t name2func (char * hash);
int find_hash_in_use (char * name, int namelen, __u32 hash_value_masked, int code_to_try_first);
int find_hash_in_use (char * name, int namelen, __u32 hash_value_masked, unsigned int code_to_try_first);
int entry_length (struct item_head * ih, struct reiserfs_de_head * deh,
int pos_in_item);
@@ -330,14 +333,14 @@ typedef void (*action_on_trans_t) (reiserfs_filsys_t *, reiserfs_trans_t *);
void for_each_transaction (reiserfs_filsys_t *, action_on_trans_t);
typedef void (*action_on_block_t) (reiserfs_filsys_t *, reiserfs_trans_t *,
int index,
unsigned int index,
unsigned long in_journal,
unsigned long in_place);
void for_each_block (reiserfs_filsys_t * fs, reiserfs_trans_t * trans,
action_on_block_t action);
void reiserfs_only_reopen (reiserfs_filsys_t * fs, int flag);
int reiserfs_open_journal (reiserfs_filsys_t *, char *, int flags);
int reiserfs_journal_params_check(reiserfs_filsys_t *fs);
int reiserfs_create_journal (reiserfs_filsys_t * fs, char * j_filename,
unsigned long offset, unsigned long len,
int transaction_max_size);
@@ -349,7 +352,7 @@ void reiserfs_reopen_journal (reiserfs_filsys_t * fs, int flag);
__u32 advise_journal_max_trans_age (void);
__u32 advise_journal_max_commit_age (void);
__u32 advise_journal_max_batch (unsigned long journal_trans_max);
__u32 advise_journal_max_trans_len (__u32 desired, __u32 journal_size, int blocksize);
__u32 advise_journal_max_trans_len (__u32 desired, __u32 journal_size, int blocksize, int verbose);
-1
View File
@@ -1 +0,0 @@
timestamp
+17 -1
View File
@@ -1,8 +1,24 @@
/*
* Copyright 2002 by Hans Reiser, licensing governed by reiserfs/README
* Copyright 2002-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#ifndef _REISERFS_SWAB_H_
#define _REISERFS_SWAB_H_
#include <endian.h>
#if __BYTE_ORDER == __BIG_ENDIAN
#define extern static
#define __BYTEORDER_HAS_U64__
#include <linux/byteorder/swab.h>
#undef extern
#else
#include <linux/byteorder/swab.h>
#endif
#endif /* _REISERFS_SWAB_H_ */
+258 -159
View File
@@ -1,6 +1,8 @@
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -10,251 +12,348 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
noinst_LIBRARIES = libmisc.a
libmisc_a_SOURCES = io.c misc.c
subdir = lib
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../include/config.h
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
libmisc_a_AR = $(AR) cru
libmisc_a_LIBADD =
am_libmisc_a_OBJECTS = io.$(OBJEXT) misc.$(OBJEXT)
libmisc_a_OBJECTS = $(am_libmisc_a_OBJECTS)
DEFS = @DEFS@ -I. -I$(srcdir) -I../include
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
libmisc_a_LIBADD =
libmisc_a_OBJECTS = io.o misc.o
AR = ar
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/io.Po ./$(DEPDIR)/misc.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libmisc_a_SOURCES)
DIST_COMMON = Makefile.am Makefile.in
SOURCES = $(libmisc_a_SOURCES)
OBJECTS = $(libmisc_a_OBJECTS)
all: all-redirect
all: all-am
.SUFFIXES:
.SUFFIXES: .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps lib/Makefile
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu lib/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-noinstLIBRARIES:
AR = ar
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
distclean-noinstLIBRARIES:
maintainer-clean-noinstLIBRARIES:
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
libmisc.a: $(libmisc_a_OBJECTS) $(libmisc_a_DEPENDENCIES)
-rm -f libmisc.a
$(libmisc_a_AR) libmisc.a $(libmisc_a_OBJECTS) $(libmisc_a_LIBADD)
$(RANLIB) libmisc.a
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
-rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/io.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Po@am__quote@
libmisc.a: $(libmisc_a_OBJECTS) $(libmisc_a_DEPENDENCIES)
-rm -f libmisc.a
$(AR) cru libmisc.a $(libmisc_a_OBJECTS) $(libmisc_a_LIBADD)
$(RANLIB) libmisc.a
distclean-depend:
-rm -rf ./$(DEPDIR)
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am:
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
mkid -fID $$unique
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
mostlyclean-tags:
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
clean-tags:
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = lib
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
io.o: io.c ../include/io.h ../include/misc.h ../include/swab.h \
../include/config.h
misc.o: misc.c ../include/swab.h ../include/io.h ../include/misc.h
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am:
install-exec: install-exec-am
all-am: Makefile $(LIBRARIES)
install-data-am:
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am:
uninstall: uninstall-am
all-am: Makefile $(LIBRARIES)
all-redirect: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \
mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-noinstLIBRARIES clean-compile clean-tags clean-generic \
mostlyclean-am
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
distclean-am: distclean-noinstLIBRARIES distclean-compile \
distclean-tags distclean-generic clean-am
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-noinstLIBRARIES \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am:
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
check-am installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES ctags distclean distclean-compile \
distclean-depend distclean-generic distclean-tags distdir dvi \
dvi-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
+111 -81
View File
@@ -1,6 +1,8 @@
/*
* Copyright 1996-2002 Hans Reiser, see reiserfs/README for licensing and copyright details
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#define _GNU_SOURCE
#include <stdio.h>
@@ -20,15 +22,28 @@
void check_memory_msg (void) {
fprintf(stderr,
"\nThe problem has occurred looks like a hardware problem. Send us the bug\n"
"report only if the second run dies at the same place with the same block\n"
"number.\n");
"\nThe problem has occurred looks like a hardware problem (perhaps memory).\n"
"Send us the bug report only if the second run dies at the same place with\n"
"the same block number.\n");
}
void check_hd_msg (void) {
fprintf(stderr,
"\nThe problem has occurred looks like a hardware problem.\n"
"Check your hard drive for badblocks.\n");
"If you have bad blocks, we advise you to get a new hard\n"
"drive, because once you get one bad block that the disk\n"
"drive internals cannot hide from your sight, the chances\n"
"of getting more are generally said to become much higher\n"
"(precise statistics are unknown to us), and this disk drive\n"
"is probably not expensive enough for you to risk your time\n"
"and data on it. If you don't want to follow that advice,\n"
"then if you have just a few bad blocks, try writing to the\n"
"bad blocks and see if the drive remaps the bad blocks (that\n"
"means it takes a block it has in reserve and allocates it\n"
"for use for requests of that block number). If it cannot\n"
"remap the block, this could be quite bad, as it may mean\n"
"that so many blocks have gone bad that none remain in \n"
"reserve to allocate.\n");
}
static int is_bad_block (unsigned long block)
@@ -74,7 +89,7 @@ static unsigned long buffers_memory;
**
*/
#define BUFFER_SOFT_LIMIT (500 * 1024)
static int buffer_soft_limit = BUFFER_SOFT_LIMIT;
static unsigned long buffer_soft_limit = BUFFER_SOFT_LIMIT;
#define NR_HASH_QUEUES 4096
@@ -89,8 +104,7 @@ static int buffer_writes = 0 ;
static void _show_buffers(struct buffer_head **list, int dev, int size)
{
static void _show_buffers(struct buffer_head **list, int dev, unsigned long size) {
int all = 0;
int dirty = 0;
int in_use = 0; /* count != 0 */
@@ -119,8 +133,8 @@ static void _show_buffers(struct buffer_head **list, int dev, int size)
break;
}
printf ("show_buffers (dev %d, size %d): free %d, count != 0 %d, dirty %d, all %d\n",
dev, size, free, in_use, dirty, all);
printf("show_buffers (dev %d, size %lu): free %d, count != 0 %d, dirty %d, "
"all %d\n", dev, size, free, in_use, dirty, all);
}
@@ -149,7 +163,7 @@ static void insert_into_hash_queue (struct buffer_head * bh)
static void remove_from_hash_queue (struct buffer_head * bh)
{
if (bh->b_hash_next == 0 && bh->b_hash_prev == 0 && bh != g_a_hash_queues[bh->b_blocknr % NR_HASH_QUEUES])
/* (b_dev == 0) ? */
/* (b_dev == -1) ? */
return;
if (bh == g_a_hash_queues[bh->b_blocknr % NR_HASH_QUEUES]) {
@@ -226,7 +240,7 @@ static size_t estimate_memory_amount (void)
addr = mmap (0, len, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (addr == MAP_FAILED) {
if (errno != ENOMEM)
die ("mmap failed: %m\n");
die ("mmap failed: %s\n", strerror(errno));
break;
}
if (mlock (addr, len) != 0) {
@@ -278,7 +292,7 @@ static int grow_buffers (int size)
tmp->b_data = getmem (size);
if (tmp->b_data == 0)
die ("grow_buffers: no memory for new buffer data");
tmp->b_dev = 0;
tmp->b_dev = -1;
tmp->b_size = size;
put_buffer_list_head (&g_free_buffers, tmp);
}
@@ -288,7 +302,7 @@ static int grow_buffers (int size)
}
struct buffer_head * find_buffer (int dev, unsigned long block, int size)
struct buffer_head *find_buffer(int dev, unsigned long block, unsigned long size)
{
struct buffer_head * next;
@@ -308,7 +322,7 @@ struct buffer_head * find_buffer (int dev, unsigned long block, int size)
static struct buffer_head * get_free_buffer (struct buffer_head **list,
int size)
unsigned long size)
{
struct buffer_head * next;
@@ -334,8 +348,7 @@ static struct buffer_head * get_free_buffer (struct buffer_head **list,
/* to_write == 0 when all blocks have to be flushed. Otherwise - write only
buffers with b_count == 0 */
static int sync_buffers (struct buffer_head **list, dev_t dev, int to_write)
{
static int sync_buffers (struct buffer_head **list, int dev, int to_write) {
struct buffer_head * next;
int written = 0;
@@ -376,10 +389,11 @@ restart:
}
void flush_buffers (dev_t dev)
void flush_buffers (int dev)
{
if (!dev)
die ("flush_buffers: device is not specifed");
if (dev == -1)
die ("flush_buffers: device is not specified");
sync_buffers (&Buffer_list_head, dev, 0/*all*/);
buffer_soft_limit = BUFFER_SOFT_LIMIT;
}
@@ -428,8 +442,8 @@ struct buffer_head * getblk (int dev, unsigned long block, int size)
bh->b_blocknr = block;
bh->b_end_io = NULL ;
memset (bh->b_data, 0, size);
clear_bit(BH_Dirty, &bh->b_state);
clear_bit(BH_Uptodate, &bh->b_state);
misc_clear_bit(BH_Dirty, &bh->b_state);
misc_clear_bit(BH_Uptodate, &bh->b_state);
put_buffer_list_end (&Buffer_list_head, bh);
insert_into_hash_queue (bh);
@@ -443,9 +457,9 @@ void brelse (struct buffer_head * bh)
{
if (bh == 0)
return;
if (bh->b_count == 0) {
if (bh->b_count == 0)
die ("brelse: can not free a free buffer %lu", bh->b_blocknr);
}
/*checkmem (bh->b_data, get_mem_size (bh->b_data));*/
@@ -460,36 +474,32 @@ void bforget (struct buffer_head * bh)
brelse (bh);
remove_from_hash_queue (bh);
remove_from_buffer_list(&Buffer_list_head, bh);
if (bh->b_count == 0)
put_buffer_list_head(&g_free_buffers, bh);
else
put_buffer_list_head(&Buffer_list_head, bh);
put_buffer_list_head(&Buffer_list_head, bh);
}
}
/* Returns 0 on success; 1 - end of file; 0 - OK. */
static int f_read(struct buffer_head * bh)
{
loff_t offset;
unsigned long long offset;
ssize_t bytes;
buffer_reads++ ;
offset = (loff_t)bh->b_size * (loff_t)bh->b_blocknr;
if (lseek64 (bh->b_dev, offset, SEEK_SET) == (loff_t)-1)
return 0;
offset = (unsigned long long)bh->b_size * bh->b_blocknr;
if (lseek64 (bh->b_dev, offset, SEEK_SET) < 0)
return -1;
bytes = read (bh->b_dev, bh->b_data, bh->b_size);
if (bytes != (ssize_t)bh->b_size)
return 0;
return 1;
return bytes < 0 ? -1 : (bytes != (ssize_t)bh->b_size ? 1 : 0);
}
struct buffer_head * bread (int dev, unsigned long block, size_t size)
{
struct buffer_head * bh;
int ret;
if (is_bad_block (block))
return 0;
@@ -501,13 +511,25 @@ struct buffer_head * bread (int dev, unsigned long block, size_t size)
if (buffer_uptodate (bh))
return bh;
if (f_read(bh) == 0 || is_bad_block (block)) {
/* BAD BLOCK LIST SUPPORT
die ("%s: Cannot read a block # %lu. Specify list of badblocks\n",*/
check_hd_msg();
die ("%s: Cannot read the block (%lu).\n", __FUNCTION__, bh->b_blocknr);
}
ret = f_read(bh);
if (ret > 0)
die ("%s: End of file, cannot read the block (%lu).\n", __FUNCTION__, bh->b_blocknr);
else if (ret < 0) {
/* BAD BLOCK LIST SUPPORT
* die ("%s: Cannot read a block # %lu. Specify list of badblocks\n",*/
if (errno == EIO) {
check_hd_msg();
die ("%s: Cannot read the block (%lu): (%s).\n", __FUNCTION__,
bh->b_blocknr, strerror(errno));
} else {
fprintf (stderr, "%s: Cannot read the block (%lu): (%s).\n", __FUNCTION__,
bh->b_blocknr, strerror(errno));
return NULL;
}
}
mark_buffer_uptodate (bh, 0);
return bh;
}
@@ -554,7 +576,7 @@ void init_rollback_file (char * rollback_file, int *blocksize, FILE * log) {
s_rollback_file = fopen (rollback_file, "w+");
if (s_rollback_file == NULL) {
fprintf (stderr, "Cannot create file %s, work w/out a rollback file\n", rollback_file);
fprintf (stderr, "Cannot create file %s, work without a rollback file\n", rollback_file);
return;
}
@@ -738,8 +760,9 @@ void do_fsck_rollback (int fd_device, int fd_journal_device, FILE * progress) {
}
if (write (descriptor, rollback_data, rollback_blocksize) == -1) {
fprintf (stderr, "rollback: write %d bytes returned error (block=%Ld, dev=%Ld): %s\n",
rollback_blocksize, (long long)offset/rollback_blocksize, (long long)b_dev, strerror (errno));
fprintf (stderr, "rollback: write %d bytes returned error "
"(block=%lld, dev=%lld): %s\n", rollback_blocksize,
offset/rollback_blocksize, b_dev, strerror (errno));
count_failed ++;
} else {
count_rollbacked ++;
@@ -781,9 +804,8 @@ static void rollback__mark_block_saved (struct block_handler * rb_e) {
/* for now - just make sure that bad blocks did not get here */
int bwrite (struct buffer_head * bh)
{
loff_t offset;
ssize_t bytes;
size_t size;
unsigned long long offset;
long long bytes, size;
if (is_bad_block (bh->b_blocknr)) {
fprintf (stderr, "bwrite: bad block is going to be written: %lu\n",
@@ -803,12 +825,12 @@ int bwrite (struct buffer_head * bh)
offset = (loff_t)size * (loff_t)bh->b_blocknr;
if (lseek64 (bh->b_dev, offset, SEEK_SET) == (loff_t)-1){
fprintf (stderr, "bwrite: lseek to position %Ld (block=%lu, dev=%d): %s\n",
(long long)offset, bh->b_blocknr, bh->b_dev, strerror (errno));
fprintf (stderr, "bwrite: lseek to position %llu (block=%lu, dev=%d): %s\n",
offset, bh->b_blocknr, bh->b_dev, strerror(errno));
exit(8); /* File system errors left uncorrected */
}
if (s_rollback_file != NULL && bh->b_size == rollback_blocksize) {
if (s_rollback_file != NULL && bh->b_size == (unsigned long)rollback_blocksize) {
struct stat64 buf;
__u32 position;
struct block_handler block_h;
@@ -817,47 +839,54 @@ int bwrite (struct buffer_head * bh)
if (!fstat64 (bh->b_dev, &buf)) {
block_h.blocknr = bh->b_blocknr;
block_h.device = buf.st_rdev;
if (reiserfs_bin_search (&block_h, rollback_blocks_array, rollback_blocks_number,
sizeof (block_h), &position, blockdev_list_compare) != POSITION_FOUND) {
if (reiserfs_bin_search(&block_h, rollback_blocks_array,
rollback_blocks_number, sizeof (block_h),
&position, blockdev_list_compare)
!= POSITION_FOUND)
{
/*read initial data from the disk*/
if (read (bh->b_dev, rollback_data, bh->b_size) == bh->b_size) {
fwrite (&buf.st_rdev, sizeof (buf.st_rdev), 1, s_rollback_file);
fwrite (&offset, sizeof (offset), 1, s_rollback_file);
fwrite (rollback_data, rollback_blocksize, 1, s_rollback_file);
if (read(bh->b_dev, rollback_data, bh->b_size) == (long long)bh->b_size) {
fwrite(&buf.st_rdev, sizeof (buf.st_rdev), 1, s_rollback_file);
fwrite(&offset, sizeof (offset), 1, s_rollback_file);
fwrite(rollback_data, rollback_blocksize, 1, s_rollback_file);
fflush(s_rollback_file);
blocklist__insert_in_position(&block_h, (void **)&rollback_blocks_array,
blocklist__insert_in_position(&block_h, (void *)(&rollback_blocks_array),
&rollback_blocks_number, sizeof(block_h), &position);
/*if you want to know what gets saved, uncomment it*/
/* if (log_file != 0 && log_file != stdout) {
fprintf (log_file, "rollback: block %lu of device %Lu was backed up\n",
bh->b_blocknr, buf.st_rdev);
fprintf (log_file, "rollback: block %lu of device %Lu was "
"backed up\n", bh->b_blocknr, buf.st_rdev);
}
*/
} else {
fprintf (stderr, "bwrite: read (block=%lu, dev=%d): %s\n", bh->b_blocknr,
bh->b_dev, strerror (errno));
fprintf (stderr, "bwrite: read (block=%lu, dev=%d): %s\n",
bh->b_blocknr, bh->b_dev, strerror (errno));
exit(8);
}
if (lseek64 (bh->b_dev, offset, SEEK_SET) == (loff_t)-1) {
fprintf (stderr, "bwrite: lseek to position %Ld (block=%lu, dev=%d): %s\n",
(long long)offset, bh->b_blocknr, bh->b_dev, strerror (errno));
fprintf (stderr, "bwrite: lseek to position %llu (block=%lu, "
"dev=%d): %s\n", offset, bh->b_blocknr, bh->b_dev,
strerror(errno));
exit(8);
}
}
} else {
fprintf (stderr, "bwrite: fstat of (%d) returned -1: %s\n", bh->b_dev,
strerror(errno));
fprintf (stderr, "bwrite: fstat of (%d) returned -1: %s\n",
bh->b_dev, strerror(errno));
}
} else if (s_rollback_file != NULL) {
fprintf (stderr, "rollback: block (%lu) has the size different from the fs uses, "
"block skipped\n", bh->b_blocknr);
fprintf (stderr, "rollback: block (%lu) has the size different from "
"the fs uses, block skipped\n", bh->b_blocknr);
}
bytes = write (bh->b_dev, bh->b_data, size);
if (bytes != (ssize_t)size) {
fprintf (stderr, "bwrite: write %ld bytes returned %ld (block=%ld, dev=%d): %s\n",
(long)size, (long)bytes, bh->b_blocknr, bh->b_dev, strerror (errno));
bytes = write(bh->b_dev, bh->b_data, size);
if (bytes != size) {
fprintf (stderr, "bwrite: write %lld bytes returned %lld (block=%ld, "
"dev=%d): %s\n", size, bytes, bh->b_blocknr, bh->b_dev,
strerror(errno));
exit(8);
}
@@ -879,12 +908,13 @@ static int _check_and_free_buffer_list(struct buffer_head *list) {
for(;;) {
if (next->b_count != 0)
fprintf (stderr, "check_and_free_buffer_mem: not free buffer (%x, %ld, %ld, %d)\n",
next->b_dev, next->b_blocknr, next->b_size, next->b_count);
fprintf (stderr, "check_and_free_buffer_mem: not free buffer "
"(%d, %ld, %ld, %d)\n", next->b_dev, next->b_blocknr,
next->b_size, next->b_count);
if (buffer_dirty (next) && buffer_uptodate (next))
fprintf (stderr, "check_and_free_buffer_mem: dirty buffer (%x %lu) found\n",
next->b_dev, next->b_blocknr);
fprintf (stderr, "check_and_free_buffer_mem: dirty buffer "
"(%d %lu) found\n", next->b_dev, next->b_blocknr);
freemem (next->b_data);
count++;
@@ -895,7 +925,7 @@ static int _check_and_free_buffer_list(struct buffer_head *list) {
return count;
}
void check_and_free_buffer_mem (void)
static void check_and_free_buffer_mem (void)
{
int count = 0;
struct buffer_head * next ;
@@ -927,7 +957,7 @@ void free_buffers (void)
}
static void _invalidate_buffer_list(struct buffer_head *list, dev_t dev)
static void _invalidate_buffer_list(struct buffer_head *list, int dev)
{
struct buffer_head * next;
@@ -951,7 +981,7 @@ static void _invalidate_buffer_list(struct buffer_head *list, dev_t dev)
}
/* forget all buffers of the given device */
void invalidate_buffers (dev_t dev)
void invalidate_buffers (int dev)
{
_invalidate_buffer_list(Buffer_list_head, dev) ;
_invalidate_buffer_list(g_free_buffers, dev) ;
@@ -964,7 +994,7 @@ int user_confirmed (FILE * fp, char * q, char * yes)
size_t n = 0;
fprintf (fp, "%s", q);
if (getline (&answer, &n, stdin) != strlen (yes) || strcmp (yes, answer))
if (getline (&answer, &n, stdin) != (ssize_t)strlen (yes) || strcmp (yes, answer))
return 0;
return 1;
+189 -30
View File
@@ -1,5 +1,6 @@
/*
* Copyright 1996-2002 Hans Reiser
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
/* for stat64() */
@@ -22,14 +23,12 @@
#include <linux/hdreg.h>
#include <dirent.h>
#include <asm/ioctl.h>
#include <unistd.h>
//#include <linux/unistd.h>
//#include <sys/stat.h>
#if defined(__linux__) && defined(_IOR) && !defined(BLKGETSIZE64)
# define BLKGETSIZE64 _IOR(0x12, 114, sizeof(__u64))
#endif
#include "swab.h"
@@ -61,11 +60,10 @@ void die (char * fmt, ...)
#define CONTROL_SIZE (strlen (MEM_BEGIN) + 1 + sizeof (int) + strlen (MEM_END) + 1)
int get_mem_size (char * p)
{
char * begin;
begin = p - strlen (MEM_BEGIN) - 1 - sizeof (int);
unsigned int get_mem_size(char *p) {
char *begin;
begin = p - strlen (MEM_BEGIN) - 1 - sizeof(int);
return *(int *)(begin + strlen (MEM_BEGIN) + 1);
}
@@ -88,8 +86,20 @@ void checkmem (char * p, int size)
}
void * getmem (int size)
void *getmem (int size)
{
char * mem;
if ((mem = mem_alloc(size)) == NULL)
die ("getmem: no more memory (%d)", size);
memset (mem, 0, size);
// checkmem (mem, size);
return mem;
}
void *mem_alloc(int size) {
char * p;
char * mem;
@@ -97,21 +107,19 @@ void * getmem (int size)
if (!p)
die ("getmem: no more memory (%d)", size);
/* Write the MEM_BEGIN magic in the beginning of allocated memory. */
strcpy (p, MEM_BEGIN);
p += strlen (MEM_BEGIN) + 1;
/* Write the size after the magic. */
*(int *)p = size;
p += sizeof (int);
mem = p;
memset (mem, 0, size);
p += size;
strcpy (p, MEM_END);
// checkmem (mem, size);
return mem;
}
void * expandmem (void * vp, int size, int by)
{
int allocated;
@@ -250,7 +258,7 @@ static int _is_mounted (char * device_name, func_t f)
mode_t mode;
if (stat ("/", &root_st) == -1)
die ("is_mounted: could not stat \"/\": %m\n");
die ("is_mounted: could not stat \"/\": %s\n", strerror(errno));
mode = get_st_mode (device_name);
@@ -272,11 +280,12 @@ static int _is_mounted (char * device_name, func_t f)
/* proc filesystem is not mounted, or /proc/mounts does not
exist */
if (f)
return (user_confirmed (stderr, " (could not figure out) Is filesystem mounted read-only? (Yes)",
"Yes\n"));
return (user_confirmed (stderr,
" (could not figure out) Is filesystem mounted read-only? (Yes)",
"Yes\n"));
else
return (user_confirmed (stderr, " (could not figure out) Is filesystem mounted? (Yes)",
"Yes\n"));
return (user_confirmed (stderr,
" (could not figure out) Is filesystem mounted? (Yes)", "Yes\n"));
}
retval = 0;
@@ -366,7 +375,7 @@ static void str_to_be (char * buf, int prosents)
void print_how_far (FILE * fp,
unsigned long * passed, unsigned long total,
int inc, int quiet)
unsigned int inc, int quiet)
{
int percent;
@@ -390,9 +399,10 @@ void print_how_far (FILE * fp,
strcat (current_progress, progress_to_be + strlen (current_progress));
if (!quiet)
print_how_fast (*passed/* - inc*/, total, strlen (progress_to_be),
(*passed == inc) ? 1 : 0);
if (!quiet) {
print_how_fast(*passed /* - inc*/, total, strlen (progress_to_be),
(*passed == inc) ? 1 : 0);
}
fflush (fp);
}
@@ -419,10 +429,11 @@ unsigned long count_blocks (char * filename, int blocksize)
#ifdef BLKGETSIZE64
{
if (ioctl (fd, BLKGETSIZE64, &size) >= 0) {
size = (size / 4096) * 4096 / blocksize;
sz = size;
if ((__u64)sz != size)
die ("count_blocks: block device too large");
return (size / 4096) * 4096 / blocksize;
return sz;
}
}
#endif
@@ -580,8 +591,8 @@ int blocklist__is_block_saved (struct block_handler ** base, __u32 * count,
return 0;
}
*/
void blocklist__insert_in_position (void *elem, void **base, __u32 *count, int elem_size,
__u32 * position)
void blocklist__insert_in_position (void *elem, void **base, __u32 *count,
int elem_size, __u32 *position)
{
if (elem_size == 0)
return;
@@ -589,7 +600,7 @@ void blocklist__insert_in_position (void *elem, void **base, __u32 *count, int e
if (*base == NULL)
*base = getmem (BLOCKLIST__ELEMENT_NUMBER * elem_size);
if (*count == get_mem_size ((void *)*base) / elem_size)
if (*count == get_mem_size((void *)*base) / elem_size)
*base = expandmem (*base, get_mem_size((void *)*base),
BLOCKLIST__ELEMENT_NUMBER * elem_size);
@@ -643,11 +654,11 @@ int uuid_is_correct (unsigned char * uuid)
if (i == 16)
return 0;
if (!test_bit(7, &uuid[8]) || test_bit(6, &uuid[8]))
if (!misc_test_bit(7, &uuid[8]) || misc_test_bit(6, &uuid[8]))
return 0;
if (test_bit(7, &uuid[6]) || !test_bit(6, &uuid[6]) ||
test_bit(5, &uuid[6]) || test_bit(4, &uuid[6]))
if (misc_test_bit(7, &uuid[6]) || !misc_test_bit(6, &uuid[6]) ||
misc_test_bit(5, &uuid[6]) || misc_test_bit(4, &uuid[6]))
return 0;
return 1;
@@ -822,3 +833,151 @@ void clean_after_dma_check(int fd, dma_info_t *dma_info) {
if (dma_info->fd && fd != dma_info->fd)
close(dma_info->fd);
}
/* Only le bitops operations are used. */
inline int misc_set_bit (unsigned long long nr, void * addr) {
__u8 * p, mask;
int retval;
p = (__u8 *)addr;
p += nr >> 3;
mask = 1 << (nr & 0x7);
/*cli();*/
retval = (mask & *p) != 0;
*p |= mask;
/*sti();*/
return retval;
}
inline int misc_clear_bit (unsigned long long nr, void * addr) {
__u8 * p, mask;
int retval;
p = (__u8 *)addr;
p += nr >> 3;
mask = 1 << (nr & 0x7);
/*cli();*/
retval = (mask & *p) != 0;
*p &= ~mask;
/*sti();*/
return retval;
}
inline int misc_test_bit(unsigned long long nr, const void * addr) {
__u8 * p, mask;
p = (__u8 *)addr;
p += nr >> 3;
mask = 1 << (nr & 0x7);
return ((mask & *p) != 0);
}
inline unsigned long long misc_find_first_zero_bit (const void *vaddr,
unsigned long long size)
{
const __u8 *p = vaddr, *addr = vaddr;
unsigned long long res;
if (!size)
return 0;
size = (size >> 3) + ((size & 0x7) > 0);
while (*p++ == 255) {
if (--size == 0)
return (unsigned long long)(p - addr) << 3;
}
--p;
for (res = 0; res < 8; res++)
if (!misc_test_bit (res, p))
break;
return res + (p - addr) * 8;
}
inline unsigned long long misc_find_next_zero_bit (const void *vaddr,
unsigned long long size, unsigned long long offset)
{
const __u8 *addr = vaddr;
const __u8 *p = addr + (offset >> 3);
int bit = offset & 7;
unsigned long long res;
if (offset >= size)
return size;
if (bit) {
/* Look for zero in first char */
for (res = bit; res < 8; res++)
if (!misc_test_bit (res, p))
return res + (p - addr) * 8;
p++;
}
/* No zero yet, search remaining full bytes for a zero */
res = misc_find_first_zero_bit (p, size - 8 * (p - addr));
return res + (p - addr) * 8;
}
inline unsigned long long misc_find_first_set_bit (const void *vaddr,
unsigned long long size)
{
const __u8 *p = vaddr, *addr = vaddr;
unsigned long long res;
if (!size)
return 0;
size = (size >> 3) + ((size & 0x7) > 0);
while (*p++ == 0) {
if (--size == 0)
return (unsigned long long)(p - addr) << 3;
}
--p;
for (res = 0; res < 8; res++)
if (misc_test_bit (res, p))
break;
return res + (p - addr) * 8;
}
inline unsigned long long misc_find_next_set_bit(const void *vaddr,
unsigned long long size, unsigned long long offset)
{
const __u8 *addr = vaddr;
const __u8 *p = addr + (offset >> 3);
int bit = offset & 7;
unsigned long long res;
if (offset >= size)
return size;
if (bit) {
/* Look for zero in first char */
for (res = bit; res < 8; res++)
if (misc_test_bit (res, p))
return res + (p - addr) * 8;
p++;
}
/* No set bit yet, search remaining full bytes for a 1 */
res = misc_find_first_set_bit (p, size - 8 * (p - addr));
return res + (p - addr) * 8;
}
#include "credits.h"
/* Reads the "CREDITS" file and prints one paragraph from it. */
void misc_print_credit(FILE *out) {
char *line;
fprintf(out, "\nA pair of credits:\n");
line = credits[(random() % CREDITS_COUNT)];
fprintf(out, "%s", line);
line = credits[(random() % CREDITS_COUNT)];
fprintf(out, "%s", line);
}
+156 -10
View File
@@ -1,7 +1,7 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
# Copyright (C) 1996, 1997, 1999, 2000, 2002 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
# it under the terms of the GNU General Public License as published by
@@ -18,11 +18,37 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
-h|--h|--he|--hel|--help)
@@ -35,6 +61,7 @@ error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
@@ -43,13 +70,15 @@ Supported PROGRAM values:
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing - GNU libit 0.0"
echo "missing 0.4 - GNU automake"
;;
-*)
@@ -58,31 +87,46 @@ Supported PROGRAM values:
exit 1
;;
aclocal)
aclocal*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acinclude.m4' or \`configure.in'. You might want
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`configure.in'. You might want to install the
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acconfig.h' or \`configure.in'. You might want
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in`
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
@@ -95,10 +139,15 @@ WARNING: \`$1' is missing on your system. You should only need it if
touch $touch_files
;;
automake)
automake*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
@@ -106,6 +155,34 @@ WARNING: \`$1' is missing on your system. You should only need it if
while read f; do touch "$f"; done
;;
autom4te)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them.
You can get \`$1Help2man' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
@@ -159,7 +236,37 @@ WARNING: \`$1' is missing on your system. You should only need it if
fi
;;
help2man)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
# We have makeinfo, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
@@ -175,6 +282,45 @@ WARNING: \`$1' is missing on your system. You should only need it if
touch $file
;;
tar)
shift
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
fi
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
+296 -185
View File
@@ -1,6 +1,8 @@
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -10,60 +12,98 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
sbin_PROGRAMS = mkreiserfs
mkreiserfs_SOURCES = mkreiserfs.c
@@ -71,102 +111,113 @@ man_MANS = mkreiserfs.8
EXTRA_DIST = $(man_MANS)
LDADD = $(top_srcdir)/lib/libmisc.a $(top_srcdir)/reiserfscore/libcore.a
subdir = mkreiserfs
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../include/config.h
CONFIG_CLEAN_FILES =
PROGRAMS = $(sbin_PROGRAMS)
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
sbin_PROGRAMS = mkreiserfs$(EXEEXT)
PROGRAMS = $(sbin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir) -I../include
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
mkreiserfs_OBJECTS = mkreiserfs.o
am_mkreiserfs_OBJECTS = mkreiserfs.$(OBJEXT)
mkreiserfs_OBJECTS = $(am_mkreiserfs_OBJECTS)
mkreiserfs_LDADD = $(LDADD)
mkreiserfs_DEPENDENCIES = $(top_srcdir)/lib/libmisc.a \
$(top_srcdir)/reiserfscore/libcore.a
mkreiserfs_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
mkreiserfs_DEPENDENCIES = $(top_srcdir)/lib/libmisc.a \
$(top_srcdir)/reiserfscore/libcore.a
mkreiserfs_LDFLAGS =
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/mkreiserfs.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
man8dir = $(mandir)/man8
MANS = $(man_MANS)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(mkreiserfs_SOURCES)
NROFF = nroff
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
MANS = $(man_MANS)
DIST_COMMON = Makefile.am Makefile.in
SOURCES = $(mkreiserfs_SOURCES)
OBJECTS = $(mkreiserfs_OBJECTS)
all: all-redirect
all: all-am
.SUFFIXES:
.SUFFIXES: .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps mkreiserfs/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-sbinPROGRAMS:
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
distclean-sbinPROGRAMS:
maintainer-clean-sbinPROGRAMS:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu mkreiserfs/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
install-sbinPROGRAMS: $(sbin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(sbindir)
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f"; \
$(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f || exit 1; \
else :; fi; \
done
uninstall-sbinPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(sbin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f $(DESTDIR)$(sbindir)/$$f"; \
rm -f $(DESTDIR)$(sbindir)/$$f; \
done
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
mkreiserfs$(EXEEXT): $(mkreiserfs_OBJECTS) $(mkreiserfs_DEPENDENCIES)
@rm -f mkreiserfs$(EXEEXT)
$(LINK) $(mkreiserfs_LDFLAGS) $(mkreiserfs_OBJECTS) $(mkreiserfs_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
-rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkreiserfs.Po@am__quote@
mkreiserfs: $(mkreiserfs_OBJECTS) $(mkreiserfs_DEPENDENCIES)
@rm -f mkreiserfs
$(LINK) $(mkreiserfs_LDFLAGS) $(mkreiserfs_OBJECTS) $(mkreiserfs_LDADD) $(LIBS)
distclean-depend:
-rm -rf ./$(DEPDIR)
install-man8:
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am:
man8dir = $(mandir)/man8
install-man8: $(man8_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(man8dir)
@list='$(man8_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.8*) list="$$list $$i" ;; \
esac; \
@@ -175,152 +226,212 @@ install-man8:
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
8*) ;; \
*) ext='8' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \
done
uninstall-man8:
@list='$(man8_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
@$(NORMAL_UNINSTALL)
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.8*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
8*) ;; \
*) ext='8' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \
rm -f $(DESTDIR)$(man8dir)/$$inst; \
done
install-man: $(MANS)
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-man8
uninstall-man:
@$(NORMAL_UNINSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-man8
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
mkid -fID $$unique
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
mostlyclean-tags:
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
clean-tags:
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = mkreiserfs
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
mkreiserfs.o: mkreiserfs.c ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h ../include/config.h ../version.h
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-sbinPROGRAMS
install-exec: install-exec-am
all-am: Makefile $(PROGRAMS) $(MANS)
install-data-am: install-man
installdirs:
$(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-sbinPROGRAMS uninstall-man
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS) $(MANS)
all-redirect: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-sbinPROGRAMS mostlyclean-compile \
mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-sbinPROGRAMS clean-compile clean-tags clean-generic \
mostlyclean-am
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
distclean-am: distclean-sbinPROGRAMS distclean-compile distclean-tags \
distclean-generic clean-am
clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-sbinPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am: install-man
install-exec-am: install-sbinPROGRAMS
install-info: install-info-am
install-man: install-man8
installcheck-am:
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS \
clean-sbinPROGRAMS maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \
install-sbinPROGRAMS mostlyclean-compile distclean-compile \
clean-compile maintainer-clean-compile install-man8 uninstall-man8 \
install-man uninstall-man tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
check-am installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-man uninstall-sbinPROGRAMS
uninstall-man: uninstall-man8
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-sbinPROGRAMS ctags distclean distclean-compile \
distclean-depend distclean-generic distclean-tags distdir dvi \
dvi-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-man8 install-sbinPROGRAMS \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am uninstall-man \
uninstall-man8 uninstall-sbinPROGRAMS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
+12 -7
View File
@@ -1,7 +1,7 @@
.\" -*- nroff -*-
.\" Copyright 1996-2002 Hans Reiser.
.\" Copyright 1996-2003 Hans Reiser.
.\"
.TH MKREISERFS 8 "January 2002" "Reiserfsprogs-3.6.4"
.TH MKREISERFS 8 "April 2003" "Reiserfsprogs-3.6.9"
.SH NAME
mkreiserfs \- create a Linux ReiserFS file system
.SH SYNOPSIS
@@ -12,6 +12,7 @@ mkreiserfs \- create a Linux ReiserFS file system
[ \fB-u\fR | \fB--uuid \fIUUID\fR ]
[ \fB-l\fR | \fB--label \fILABEL\fR ]
[ \fB--format \fIFORMAT\fR ]
[ \fB-q\fR | \fB--quiet\fR ]
[ \fB-j\fR | \fB--journal-device \fIFILE\fR ]
[ \fB-s\fR | \fB--journal-size \fIN\fR ]
[ \fB-o\fR | \fB--journal-offset \fIN\fR ]
@@ -41,7 +42,7 @@ will be sorted with. Choose one of r5, rupasov, tea. r5 is default
.TP
\fB--format \fIFORMAT\fR
\fIFORMAT\fR specifies a format new filsystem has to be of. Choose one
of 3.5 and 3.6. If none is specified mkreiserfs will create format 3.6
of 3.5 and 3.6. If none is specified \fBmkreiserfs\fR will create format 3.6
if running kernel is 2.4, 3.5 if 2.2 is running, and will refuse
creation under other kernels.
.TP
@@ -50,11 +51,15 @@ Set the universally unique identifier (\fB UUID \fR) of the filesystem to
\fIUUID\fR (see also \fBuuidgen(8)\fR). The format of the UUID is a
series of hex digits separated by hypthens, like this:
"c1b9d5a2-f162-11cf-9ece-0020afc76f16". If the option skipped,
mkreiserfs generates a new one.
\fBmkreiserfs\fR generates a new one.
.TP
\fB-l\fR | \fB--label \fILABEL\fR
Set the volume label of the filesystem. \fILABEL\fR can be at most 16
characters long; if it is longer than 16 characters, mkreiserfs will truncate it.
characters long; if it is longer than 16 characters, \fBmkreiserfs\fR will truncate it.
.TP
\fB-q\fR | \fB--quiet \fR
Make \fBmkreiserfs\fR to work quiet without producing any message, progress and question.
It is useful if you run \fBmkreiserfs\fR in a script. For use by end users only.
.TP
\fB-j\fR | \fB--journal-device \fIFILE\fR
\fIFILE\fR is name of block device where the file system is to have
@@ -79,12 +84,12 @@ than half the size of the journal. If specifed incorrectly, it will be
adjusted.
.TP
\fB-f\fR
This forces mkreiserfs to continue even if device is either whole
This forces \fBmkreiserfs\fR to continue even if device is either whole
disk, or looks mounted or is not a block device. Specified more than
once allows to avoid asking for confirmation.
.TP
\fB-d\fR
This makes mkreiserfs to print debugging information during mkreiserfs.
This makes \fBmkreiserfs\fR to print debugging information during \fBmkreiserfs\fR.
.TP
\fB-V\fR
This prints version and exits.
+148 -149
View File
@@ -1,5 +1,6 @@
/*
* Copyright 1996-2002 Hans Reiser, licensing governed by ../README
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
/* mkreiserfs is very simple. It supports only 4k blocks. It skips
@@ -26,7 +27,6 @@
#include <errno.h>
#include <sys/vfs.h>
#include <time.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <linux/kdev_t.h>
@@ -46,8 +46,7 @@ char *program_name;
static void message( const char * fmt, ... )
__attribute__ ((format (printf, 1, 2)));
static void message( const char * fmt, ... )
{
static void message( const char * fmt, ... ) {
char *buf;
va_list args;
@@ -64,34 +63,36 @@ static void message( const char * fmt, ... )
static void print_usage_and_exit(void)
{
fprintf(stderr, "Usage: %s [options] "
" device [block-count]\n"
"\n"
"Options:\n\n"
" -b | --block-size N size of file-system block, in bytes\n"
" -j | --journal-device FILE path to separate device to hold journal\n"
" -s | --journal-size N size of the journal in blocks\n"
" -o | --journal-offset N offset of the journal from the start of\n"
" the separate device, in blocks\n"
" -t | --transaction-max-size N maximal size of transaction, in blocks\n"
" -h | --hash rupasov|tea|r5 hash function to use by default\n"
" -u | --uuid UUID store UUID in the superblock\n"
" -l | --label LABEL store LABEL in the superblock\n"
" --format 3.5|3.6 old 3.5 format or newer 3.6\n"
" -f | --force specified once, make mkreiserfs the whole\n"
" disk, not block device or mounted partition;\n"
" specified twice, do not ask for confirmation\n"
" -d | --debug print debugging information during mkreiser\n"
" -V print version and exit\n",
program_name);
exit (1);
fprintf(stderr, "Usage: %s [options] "
" device [block-count]\n"
"\n"
"Options:\n\n"
" -b | --block-size N size of file-system block, in bytes\n"
" -j | --journal-device FILE path to separate device to hold journal\n"
" -s | --journal-size N size of the journal in blocks\n"
" -o | --journal-offset N offset of the journal from the start of\n"
" the separate device, in blocks\n"
" -t | --transaction-max-size N maximal size of transaction, in blocks\n"
" -h | --hash rupasov|tea|r5 hash function to use by default\n"
" -u | --uuid UUID store UUID in the superblock\n"
" -l | --label LABEL store LABEL in the superblock\n"
" --format 3.5|3.6 old 3.5 format or newer 3.6\n"
" -f | --force specified once, make mkreiserfs the whole\n"
" disk, not block device or mounted partition;\n"
" specified twice, do not ask for confirmation\n"
" -q | --quiet quiet work without messages, progress and\n"
" questions. Useful if run in a script. For use\n"
" by end users only.\n"
" -d | --debug print debugging information during mkreiser\n"
" -V print version and exit\n",
program_name);
exit (1);
}
// " -B badblocks-file list of all bad blocks on the fs\n"
// " -B badblocks-file list of all bad blocks on the fs\n"
int Create_default_journal = 1;
int Block_size = 4096;
int DEBUG_MODE = 0;
/* size of journal + 1 block for journal header */
unsigned long Journal_size = 0;
@@ -103,21 +104,28 @@ unsigned char UUID[16];
unsigned char * LABEL = NULL;
char * badblocks_file;
enum mkfs_mode {
DEBUG_MODE = 1 << 0,
QUIET_MODE = 1 << 1
};
int mode;
/* form super block (old one) */
static void make_super_block (reiserfs_filsys_t * fs)
{
set_sb_umount_state (fs->fs_ondisk_sb, REISERFS_CLEANLY_UMOUNTED);
set_sb_umount_state (fs->fs_ondisk_sb, FS_CLEANLY_UMOUNTED);
set_sb_tree_height (fs->fs_ondisk_sb, 2);
set_sb_hash_code (fs->fs_ondisk_sb, Hash);
if (fs->fs_format == REISERFS_FORMAT_3_6) {
if (!uuid_is_correct (UUID) && generate_random_uuid (UUID))
reiserfs_warning (stdout, "failed to genetate UUID\n");
reiserfs_warning (stderr, "failed to genetate UUID\n");
memcpy (fs->fs_ondisk_sb->s_uuid, UUID, 16);
if (LABEL != NULL) {
if (strlen (LABEL) > 16)
reiserfs_warning (stderr, "\nSpecified LABEL is longer then 16 characters, will be truncated\n\n");
reiserfs_warning (stderr, "\nSpecified LABEL is longer then 16 "
"characters, will be truncated\n\n");
strncpy (fs->fs_ondisk_sb->s_label, LABEL, 16);
}
set_sb_v2_flag (fs->fs_ondisk_sb, reiserfs_attrs_cleared);
@@ -157,20 +165,18 @@ static void invalidate_other_formats (int dev)
void zero_journal (reiserfs_filsys_t * fs)
{
int i;
unsigned long start, len, done;
struct buffer_head * bh;
unsigned long done;
unsigned long start, len;
unsigned int i;
fprintf (stderr, "Initializing journal - ");
fprintf (stdout, "Initializing journal - ");
start = get_jp_journal_1st_block (sb_jp (fs->fs_ondisk_sb));
len = get_jp_journal_size (sb_jp (fs->fs_ondisk_sb));
done = 0;
for (i = 0; i < len; i ++) {
print_how_far (stderr, &done, len, 1, 1/*be quiet*/);
print_how_far (stdout, &done, len, 1, 1/*be quiet*/);
bh = getblk (fs->fs_journal_dev, start + i, fs->fs_blocksize);
if (!bh)
die ("zero_journal: getblk failed");
@@ -181,8 +187,8 @@ void zero_journal (reiserfs_filsys_t * fs)
brelse (bh);
}
fprintf (stderr, "\n");
fflush (stderr);
fprintf (stdout, "\n");
fflush (stdout);
}
@@ -191,20 +197,18 @@ void zero_journal (reiserfs_filsys_t * fs)
static void make_bitmap (reiserfs_filsys_t * fs)
{
struct reiserfs_super_block * sb = fs->fs_ondisk_sb;
int i;
unsigned int i;
unsigned long block;
int marked;
marked = 0;
/* mark skipped area and super block */
for (i = 0; i <= fs->fs_super_bh->b_blocknr; i ++) {
reiserfs_bitmap_set_bit (fs->fs_bitmap2, i);
marked ++;
reiserfs_bitmap_set_bit (fs->fs_bitmap2, i);
marked ++;
}
if (fs->fs_badblocks_bm) {
for (i = 0; i < get_sb_block_count (sb); i ++) {
if (reiserfs_bitmap_test_bit (fs->fs_badblocks_bm, i)) {
@@ -221,7 +225,8 @@ static void make_bitmap (reiserfs_filsys_t * fs)
reiserfs_bitmap_set_bit (fs->fs_bitmap2, block);
marked ++;
if (spread_bitmaps (fs))
block = (block / (fs->fs_blocksize * 8) + 1) * (fs->fs_blocksize * 8);
block = (block / (fs->fs_blocksize * 8) + 1) *
(fs->fs_blocksize * 8);
else
block ++;
}
@@ -233,7 +238,7 @@ static void make_bitmap (reiserfs_filsys_t * fs)
/* makr journal blocks as used */
for (i = 0; i <= get_jp_journal_size (sb_jp (sb)); i ++) {
reiserfs_bitmap_set_bit (fs->fs_bitmap2,
i + get_jp_journal_1st_block (sb_jp (sb)));
i + get_jp_journal_1st_block (sb_jp (sb)));
marked ++;
}
block = get_jp_journal_1st_block (sb_jp (sb)) + i;
@@ -244,7 +249,9 @@ static void make_bitmap (reiserfs_filsys_t * fs)
block++;
}
while ((block < get_sb_block_count (sb)) && reiserfs_bitmap_test_bit (fs->fs_bitmap2, block)) {
while ((block < get_sb_block_count (sb)) &&
reiserfs_bitmap_test_bit (fs->fs_bitmap2, block))
{
block++;
}
@@ -300,7 +307,9 @@ static void make_root_block (reiserfs_filsys_t * fs)
static void report (reiserfs_filsys_t * fs, char * j_filename)
{
// print_block (stdout, fs, fs->fs_super_bh);
struct reiserfs_super_block * sb = (struct reiserfs_super_block *)(fs->fs_super_bh->b_data);
struct reiserfs_super_block * sb =
(struct reiserfs_super_block *)(fs->fs_super_bh->b_data);
struct stat st;
dev_t rdev;
@@ -308,12 +317,12 @@ static void report (reiserfs_filsys_t * fs, char * j_filename)
return;
if (fstat (fs->fs_super_bh->b_dev, &st) == -1) {
/*reiserfs_warning (stderr, "fstat failed: %m\n");*/
/*reiserfs_warning (stderr, "fstat failed: %s\n", strerror(errno));*/
rdev = 0;
} else
rdev = st.st_rdev;
if (DEBUG_MODE) {
if (mode & DEBUG_MODE) {
reiserfs_warning (stdout, "Block %lu (0x%x) contains super block. ",
fs->fs_super_bh->b_blocknr, rdev);
}
@@ -328,44 +337,48 @@ static void report (reiserfs_filsys_t * fs, char * j_filename)
if (is_reiserfs_jr_magic_string (sb))
reiserfs_warning (stdout, "non-");
reiserfs_warning (stdout, "standard journal\n");
reiserfs_warning (stdout, "Count of blocks on the device: %u\n", get_sb_block_count (sb));
reiserfs_warning (stdout, "Number of blocks consumed by mkreiserfs formatting process: %u\n",
get_sb_block_count (sb) - get_sb_free_blocks (sb));
if (DEBUG_MODE)
reiserfs_warning (stdout, "Count of blocks on the device: %u\n",
get_sb_block_count (sb));
reiserfs_warning (stdout, "Number of blocks consumed by mkreiserfs "
"formatting process: %u\n", get_sb_block_count (sb) - get_sb_free_blocks (sb));
if (mode & DEBUG_MODE)
reiserfs_warning (stdout, "Free blocks: %u\n", get_sb_free_blocks (sb));
reiserfs_warning (stdout, "Blocksize: %d\n", get_sb_block_size (sb));
reiserfs_warning (stdout, "Hash function used to sort names: %s\n",
code2name (get_sb_hash_code (sb)));
if (DEBUG_MODE) {
if (mode & DEBUG_MODE) {
reiserfs_warning (stdout, "Number of bitmaps: %u\n", get_sb_bmap_nr (sb));
reiserfs_warning (stdout, "Root block: %u\n", get_sb_root_block (sb));
reiserfs_warning (stdout, "Tree height: %d\n", get_sb_tree_height (sb));
reiserfs_warning (stdout, "Objectid map size %d, max %d\n", get_sb_oid_cursize (sb),
get_sb_oid_maxsize (sb));
reiserfs_warning (stdout, "Objectid map size %d, max %d\n",
get_sb_oid_cursize (sb), get_sb_oid_maxsize (sb));
reiserfs_warning (stdout, "Journal parameters:\n");
print_journal_params (stdout, sb_jp (sb));
} else {
if (j_filename && strcmp (j_filename, fs->fs_file_name))
reiserfs_warning (stdout, "Journal Device [0x%x]\n", get_jp_journal_dev (sb_jp (sb)));
reiserfs_warning (stdout, "Journal Device [0x%x]\n",
get_jp_journal_dev (sb_jp (sb)));
reiserfs_warning (stdout, "Journal Size %u blocks (first block %u)\n",
get_jp_journal_size (sb_jp (sb)) + 1,
get_jp_journal_1st_block (sb_jp (sb)));
get_jp_journal_size (sb_jp (sb)) + 1,
get_jp_journal_1st_block (sb_jp (sb)));
reiserfs_warning (stdout, "Journal Max transaction length %u\n",
get_jp_journal_max_trans_len (sb_jp (sb)));
get_jp_journal_max_trans_len (sb_jp (sb)));
}
if (j_filename && strcmp (j_filename, fs->fs_file_name)) {
reiserfs_warning (stdout, "Space on this device reserved by journal: %u\n",
get_sb_reserved_for_journal (sb));
get_sb_reserved_for_journal (sb));
}
if (DEBUG_MODE) {
reiserfs_warning (stdout, "Filesystem state 0x%x\n", get_sb_fs_state (sb));
reiserfs_warning (stdout, "sb_version %u\n", get_sb_version (sb));
if (mode & DEBUG_MODE) {
reiserfs_warning (stdout, "Filesystem state 0x%x\n", get_sb_fs_state (sb));
reiserfs_warning (stdout, "sb_version %u\n", get_sb_version (sb));
}
if (get_reiserfs_format (sb) == REISERFS_FORMAT_3_6) {
reiserfs_warning (stdout, "inode generation number: %u\n", get_sb_v2_inode_generation (sb));
reiserfs_warning (stdout, "inode generation number: %u\n",
get_sb_v2_inode_generation (sb));
reiserfs_warning (stdout, "UUID: %U\n", sb->s_uuid);
if (strcmp (sb->s_label, ""))
reiserfs_warning (stdout, "LABEL: %s\n", sb->s_label);
@@ -393,11 +406,11 @@ static void set_hash_function (char * str)
static void set_reiserfs_version (char * str)
{
if (!strcmp (str, "3.5"))
Format = "3.5";
Format = "3.5";
else {
Format = "3.6";
if (strcmp (str, "3.6"))
message("wrong reiserfs version specified. Using default 3.6 format");
Format = "3.6";
if (strcmp (str, "3.6"))
message("wrong reiserfs version specified. Using default 3.6 format");
}
}
@@ -408,7 +421,7 @@ static int str2int (char * str)
val = (int) strtol (str, &tmp, 0);
if (*tmp)
die ("%s: strtol is unable to make an integer of %s\n", program_name, str);
die ("%s: strtol is unable to make an integer of %s\n", program_name, str);
return val;
}
@@ -418,8 +431,8 @@ static void set_block_size (char * str, int *b_size)
*b_size = str2int (str);
if (!is_blocksize_correct (*b_size))
die ("%s: wrong blocksize %s specified, only divisible by 1024 are supported currently",
program_name, str);
die ("%s: wrong blocksize %s specified, only power of 2 from 512-8192 "
"interval are supported", program_name, str);
}
@@ -451,15 +464,18 @@ static void set_offset_in_journal_device (char * str)
static int is_journal_default (char * name, char * jname, int blocksize)
{
if (jname && strcmp (name, jname))
return 0;
if (Journal_size &&
Journal_size != journal_default_size (REISERFS_DISK_OFFSET_IN_BYTES / blocksize, blocksize) + 1)
/* journal size is set and it is not default size */
return 0;
if (Max_trans_size != JOURNAL_TRANS_MAX)
return 0;
return 1;
if (jname && strcmp (name, jname))
return 0;
if (Journal_size && Journal_size !=
journal_default_size(REISERFS_DISK_OFFSET_IN_BYTES / blocksize, blocksize) + 1)
/* journal size is set and it is not default size */
return 0;
if (Max_trans_size && Max_trans_size != JOURNAL_TRANS_MAX)
return 0;
return 1;
}
@@ -482,14 +498,17 @@ static int select_format (void)
return REISERFS_FORMAT_3_6;
}
message ("Guessing about desired format.. ");
reiserfs_warning (stdout, "Guessing about desired format.. ");
if (uname (&sysinfo) == -1) {
message ("could not get system info: %m");
message ("could not get system info: %s", strerror(errno));
exit (1);
}
message ("Kernel %s is running.", sysinfo.release);
reiserfs_warning(stdout, "Kernel %s is running.\n", sysinfo.release);
if (!strncmp (sysinfo.release, "2.6", 3))
return REISERFS_FORMAT_3_6;
if (!strncmp (sysinfo.release, "2.5", 3))
return REISERFS_FORMAT_3_6;
@@ -497,12 +516,12 @@ static int select_format (void)
return REISERFS_FORMAT_3_6;
if (strncmp (sysinfo.release, "2.2", 3)) {
message( "You should run either 2.4 or 2.2 to be able "
"to create reiserfs filesystem or specify desired format with -v");
message( "You should run either 2.2 or 2.4 or higher to be able "
"to create reiserfs filesystem or specify desired format with --format");
exit (1);
}
message ("Creating filesystem of format 3.5");
reiserfs_warning(stdout, "Creating filesystem of format 3.5\n");
return REISERFS_FORMAT_3_5;
}
@@ -510,28 +529,27 @@ static int select_format (void)
int main (int argc, char **argv)
{
reiserfs_filsys_t * fs;
int force;
char * device_name;
char * jdevice_name;
unsigned long fs_size;
int force = 0;
char * device_name = NULL;
char * jdevice_name = NULL;
unsigned long fs_size = 0;
int c;
static int flag;
program_name = strrchr( argv[ 0 ], '/' );
program_name = program_name ? ++ program_name : argv[ 0 ];
print_banner (program_name);
if (argc < 2)
print_usage_and_exit ();
if (program_name)
program_name++;
else
program_name = argv[ 0 ];
force = 0;
fs_size = 0;
device_name = 0;
jdevice_name = 0;
if (argc < 2) {
print_banner (program_name);
print_usage_and_exit ();
}
while (1) {
static struct option options[] = {
{"block-size", required_argument, 0, 'b'},
@@ -547,7 +565,7 @@ int main (int argc, char **argv)
};
int option_index;
c = getopt_long (argc, argv, "b:j:s:t:o:h:u:l:Vfd",
c = getopt_long (argc, argv, "b:j:s:t:o:h:u:l:VfdB:q",
options, &option_index);
if (c == -1)
break;
@@ -596,19 +614,19 @@ int main (int argc, char **argv)
break;
case 'V':
exit (1);
print_usage_and_exit ();
case 'f':
force ++;
break;
case 'd':
DEBUG_MODE = 1;
mode |= DEBUG_MODE;
break;
case 'u':
if (set_uuid (optarg, UUID)) {
reiserfs_warning(stdout, "wrong UUID specified\n");
reiserfs_warning(stderr, "wrong UUID specified\n");
return 1;
}
@@ -617,7 +635,10 @@ int main (int argc, char **argv)
case 'l':
LABEL = optarg;
break;
case 'q':
mode |= QUIET_MODE;
fclose(stdout);
break;
default:
print_usage_and_exit();
}
@@ -640,28 +661,23 @@ int main (int argc, char **argv)
if (is_journal_default (device_name, jdevice_name, Block_size))
Create_default_journal = 1;
if (!Max_trans_size) {
/* max transaction size has not been specified,
for blocksize >= 4096 - max transaction size is 1024. For block size < 4096
- trans max size is decreased proportionally */
Max_trans_size = JOURNAL_TRANS_MAX;
if (Block_size < 4096)
Max_trans_size = JOURNAL_TRANS_MAX / (4096 / Block_size);
}
if (!can_we_format_it (device_name, force))
if (!(mode & QUIET_MODE) && !can_we_format_it (device_name, force))
return 1;
if (jdevice_name)
if (!can_we_format_it (jdevice_name, force))
if (!(mode & QUIET_MODE) && !can_we_format_it (jdevice_name, force))
return 1;
fs = reiserfs_create (device_name, select_format (), fs_size, Block_size, Create_default_journal, 1);
fs = reiserfs_create (device_name, select_format(), fs_size, Block_size,
Create_default_journal, 1);
if (!fs) {
return 1;
}
if (!reiserfs_create_journal (fs, jdevice_name, Offset, Journal_size, Max_trans_size)) {
if (!reiserfs_create_journal (fs, jdevice_name, Offset, Journal_size,
Max_trans_size))
{
return 1;
}
@@ -672,7 +688,7 @@ int main (int argc, char **argv)
/* these fill buffers (super block, first bitmap, root block) with
reiserfs structures */
if (uuid_is_correct (UUID) && fs->fs_format != REISERFS_FORMAT_3_6) {
reiserfs_warning(stdout, "UUID can be specified only with 3.6 format\n");
reiserfs_warning(stderr, "UUID can be specified only with 3.6 format\n");
return 1;
}
@@ -683,11 +699,11 @@ int main (int argc, char **argv)
make_super_block (fs);
make_bitmap (fs);
make_root_block (fs);
add_badblock_list (fs, 1);
// add_badblock_list (fs, 1);
report (fs, jdevice_name);
if (!force) {
if (!force && !(mode & QUIET_MODE)) {
fprintf (stderr, "ATTENTION: YOU SHOULD REBOOT AFTER FDISK!\n"
"\tALL DATA WILL BE LOST ON '%s'", device_name);
if (jdevice_name && strcmp (jdevice_name, device_name))
@@ -709,32 +725,15 @@ int main (int argc, char **argv)
sync ();
printf ("ok\n");
if (DEBUG_MODE)
return 0;
printf ("\nThe Defense Advanced Research Projects Agency (DARPA) is the primary sponsor of"
"\nReiser4. DARPA does not endorse this project; it merely sponsors it."
"\n"
"\nContinuing core development of version 3 is mostly paid for by Hans Reiser from"
"\nmoney made selling licenses in addition to the GPL to companies who don't want"
"\nit known that they use ReiserFS as a foundation for their proprietary product."
"\nAnd my lawyer asked 'People pay you money for this?'. Yup. Hee Hee. Life is"
"\ngood. If you buy ReiserFS, you can focus on your value add rather than"
"\nreinventing an entire FS. You should buy some free software too...."
"\n"
"\nSuSE pays for continuing work on journaling for version 3, and paid for much of"
"\nthe previous version 3 work. Reiserfs integration in their distro is"
"\nconsistently solid."
"\n"
"\nMP3.com paid for initial journaling development."
"\n"
"\nBigstorage.com contributes to our general fund every month, and has done so for"
"\nquite a long time."
"\n"
"\nThanks to all of those sponsors, including the secret ones. Without you, Hans"
"\nwould still have that day job, and the merry band of hackers would be missing"
"\nquite a few...."
"\n"
"\nHave fun.\n");
if (mode & DEBUG_MODE)
return 0;
misc_print_credit(stdout);
printf("\nTell your friends to use the kernel based on 2.4.18 or later "
"when you use\nreiserFS. Have fun.\n\n");
printf("ReiserFS is successfully created on %s.\n", device_name);
return 0;
}
+277 -190
View File
@@ -1,6 +1,8 @@
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -10,282 +12,367 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
noinst_LIBRARIES = libcore.a
libcore_a_SOURCES = do_balan.c fix_node.c hashes.c ibalance.c lbalance.c prints.c stree.c node_formats.c reiserfslib.c bitmap.c journal.c includes.h
libcore_a_SOURCES = do_balan.c fix_node.c hashes.c ibalance.c lbalance.c prints.c \
stree.c node_formats.c reiserfslib.c bitmap.c journal.c includes.h
subdir = reiserfscore
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../include/config.h
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
libcore_a_AR = $(AR) cru
libcore_a_LIBADD =
am_libcore_a_OBJECTS = do_balan.$(OBJEXT) fix_node.$(OBJEXT) \
hashes.$(OBJEXT) ibalance.$(OBJEXT) lbalance.$(OBJEXT) \
prints.$(OBJEXT) stree.$(OBJEXT) node_formats.$(OBJEXT) \
reiserfslib.$(OBJEXT) bitmap.$(OBJEXT) journal.$(OBJEXT)
libcore_a_OBJECTS = $(am_libcore_a_OBJECTS)
DEFS = @DEFS@ -I. -I$(srcdir) -I../include
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
libcore_a_LIBADD =
libcore_a_OBJECTS = do_balan.o fix_node.o hashes.o ibalance.o \
lbalance.o prints.o stree.o node_formats.o reiserfslib.o bitmap.o \
journal.o
AR = ar
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/bitmap.Po ./$(DEPDIR)/do_balan.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/fix_node.Po ./$(DEPDIR)/hashes.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/ibalance.Po ./$(DEPDIR)/journal.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/lbalance.Po ./$(DEPDIR)/node_formats.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/prints.Po ./$(DEPDIR)/reiserfslib.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/stree.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libcore_a_SOURCES)
DIST_COMMON = Makefile.am Makefile.in
SOURCES = $(libcore_a_SOURCES)
OBJECTS = $(libcore_a_OBJECTS)
all: all-redirect
all: all-am
.SUFFIXES:
.SUFFIXES: .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps reiserfscore/Makefile
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu reiserfscore/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-noinstLIBRARIES:
AR = ar
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
distclean-noinstLIBRARIES:
maintainer-clean-noinstLIBRARIES:
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
libcore.a: $(libcore_a_OBJECTS) $(libcore_a_DEPENDENCIES)
-rm -f libcore.a
$(libcore_a_AR) libcore.a $(libcore_a_OBJECTS) $(libcore_a_LIBADD)
$(RANLIB) libcore.a
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
-rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitmap.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/do_balan.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fix_node.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hashes.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ibalance.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/journal.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lbalance.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/node_formats.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prints.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reiserfslib.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stree.Po@am__quote@
libcore.a: $(libcore_a_OBJECTS) $(libcore_a_DEPENDENCIES)
-rm -f libcore.a
$(AR) cru libcore.a $(libcore_a_OBJECTS) $(libcore_a_LIBADD)
$(RANLIB) libcore.a
distclean-depend:
-rm -rf ./$(DEPDIR)
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am:
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
mkid -fID $$unique
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
mostlyclean-tags:
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
clean-tags:
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = reiserfscore
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
bitmap.o: bitmap.c includes.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
do_balan.o: do_balan.c includes.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
fix_node.o: fix_node.c includes.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
hashes.o: hashes.c
ibalance.o: ibalance.c includes.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
journal.o: journal.c includes.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
lbalance.o: lbalance.c includes.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
node_formats.o: node_formats.c includes.h ../include/io.h \
../include/misc.h ../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
prints.o: prints.c includes.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
reiserfslib.o: reiserfslib.c includes.h ../include/io.h \
../include/misc.h ../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
stree.o: stree.c includes.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am:
install-exec: install-exec-am
all-am: Makefile $(LIBRARIES)
install-data-am:
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am:
uninstall: uninstall-am
all-am: Makefile $(LIBRARIES)
all-redirect: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \
mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-noinstLIBRARIES clean-compile clean-tags clean-generic \
mostlyclean-am
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
distclean-am: distclean-noinstLIBRARIES distclean-compile \
distclean-tags distclean-generic clean-am
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-noinstLIBRARIES \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am:
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
check-am installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES ctags distclean distclean-compile \
distclean-depend distclean-generic distclean-tags distdir dvi \
dvi-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
+79 -73
View File
@@ -1,7 +1,8 @@
/*
* Copyright 2000-2002 by Hans Reiser, licensing governed by reiserfs/README
* Copyright 2000-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
/*
* 2000/10/26 - Initial version.
*/
@@ -47,6 +48,9 @@ int reiserfs_expand_bitmap (reiserfs_bitmap_t * bm, unsigned int bit_count)
bm->bm_map = new_map;
bm->bm_byte_size = byte_count;
bm->bm_bit_size = bit_count;
bm->bm_dirty = 1;
return 0;
}
@@ -56,6 +60,8 @@ void reiserfs_shrink_bitmap (reiserfs_bitmap_t * bm, unsigned int bit_count)
bm->bm_byte_size = (bit_count + 7) / 8;
bm->bm_bit_size = bit_count;
bm->bm_dirty = 1;
}
/* bitmap destructor */
@@ -80,8 +86,8 @@ void reiserfs_bitmap_copy (reiserfs_bitmap_t * to, reiserfs_bitmap_t * from)
int reiserfs_bitmap_compare (reiserfs_bitmap_t * bm1, reiserfs_bitmap_t * bm2)
{
int bytes, bits;
long unsigned i, diff;
unsigned long i, diff;
unsigned long int bytes, bits;
assert (bm1->bm_byte_size == bm2->bm_byte_size &&
bm1->bm_bit_size == bm2->bm_bit_size);
@@ -119,16 +125,17 @@ int reiserfs_bitmap_compare (reiserfs_bitmap_t * bm1, reiserfs_bitmap_t * bm2)
Y - `from` bitmap.
Save result in the `to` bitmap.
*/
void reiserfs_bitmap_disjunction (reiserfs_bitmap_t * to, reiserfs_bitmap_t * from)
void reiserfs_bitmap_disjunction (reiserfs_bitmap_t * to,
reiserfs_bitmap_t * from)
{
int i;
unsigned int i;
assert (to->bm_byte_size == from->bm_byte_size &&
to->bm_bit_size == from->bm_bit_size);
for (i = 0; i < to->bm_bit_size; i++) {
if (test_bit(i, from->bm_map) && !test_bit(i, to->bm_map)) {
set_bit(i, to->bm_map);
if (misc_test_bit(i, from->bm_map) && !misc_test_bit(i, to->bm_map)) {
misc_set_bit(i, to->bm_map);
to->bm_set_bits ++;
to->bm_dirty = 1;
}
@@ -142,14 +149,14 @@ void reiserfs_bitmap_disjunction (reiserfs_bitmap_t * to, reiserfs_bitmap_t * fr
Save result in the `base` bitmap.
*/
void reiserfs_bitmap_delta (reiserfs_bitmap_t * base, reiserfs_bitmap_t * exclude) {
int i;
unsigned int i;
assert (base->bm_byte_size == exclude->bm_byte_size &&
base->bm_bit_size == exclude->bm_bit_size);
for (i = 0; i < base->bm_bit_size; i++) {
if (test_bit(i, exclude->bm_map) && test_bit(i, base->bm_map)) {
clear_bit(i, base->bm_map);
if (misc_test_bit(i, exclude->bm_map) && misc_test_bit(i, base->bm_map)) {
misc_clear_bit(i, base->bm_map);
base->bm_set_bits --;
base->bm_dirty = 1;
}
@@ -159,9 +166,9 @@ void reiserfs_bitmap_delta (reiserfs_bitmap_t * base, reiserfs_bitmap_t * exclud
void reiserfs_bitmap_set_bit (reiserfs_bitmap_t * bm, unsigned int bit_number)
{
assert(bit_number < bm->bm_bit_size);
if (test_bit (bit_number, bm->bm_map))
if (misc_test_bit (bit_number, bm->bm_map))
return;
set_bit(bit_number, bm->bm_map);
misc_set_bit(bit_number, bm->bm_map);
bm->bm_set_bits ++;
bm->bm_dirty = 1;
}
@@ -170,9 +177,9 @@ void reiserfs_bitmap_set_bit (reiserfs_bitmap_t * bm, unsigned int bit_number)
void reiserfs_bitmap_clear_bit (reiserfs_bitmap_t * bm, unsigned int bit_number)
{
assert(bit_number < bm->bm_bit_size);
if (!test_bit (bit_number, bm->bm_map))
if (!misc_test_bit (bit_number, bm->bm_map))
return;
clear_bit (bit_number, bm->bm_map);
misc_clear_bit (bit_number, bm->bm_map);
bm->bm_set_bits --;
bm->bm_dirty = 1;
}
@@ -183,34 +190,32 @@ int reiserfs_bitmap_test_bit (reiserfs_bitmap_t * bm, unsigned int bit_number)
if (bit_number >= bm->bm_bit_size)
printf ("bit %u, bitsize %lu\n", bit_number, bm->bm_bit_size);
assert(bit_number < bm->bm_bit_size);
return test_bit(bit_number, bm->bm_map);
return misc_test_bit(bit_number, bm->bm_map);
}
int reiserfs_bitmap_zeros (reiserfs_bitmap_t * bm)
{
unsigned int reiserfs_bitmap_zeros (reiserfs_bitmap_t * bm) {
return bm->bm_bit_size - bm->bm_set_bits;
}
int reiserfs_bitmap_ones (reiserfs_bitmap_t * bm)
{
unsigned int reiserfs_bitmap_ones (reiserfs_bitmap_t * bm) {
return bm->bm_set_bits;
}
int reiserfs_bitmap_find_zero_bit (reiserfs_bitmap_t * bm, unsigned long * start)
int reiserfs_bitmap_find_zero_bit (reiserfs_bitmap_t * bm, unsigned long * first)
{
unsigned int bit_nr = *start;
assert(*start < bm->bm_bit_size);
unsigned long bit_nr = *first;
assert(*first < bm->bm_bit_size);
bit_nr = find_next_zero_bit(bm->bm_map, bm->bm_bit_size, *start);
bit_nr = misc_find_next_zero_bit(bm->bm_map, bm->bm_bit_size, *first);
if (bit_nr >= bm->bm_bit_size) { /* search failed */
return 1;
}
*start = bit_nr;
*first = bit_nr;
return 0;
}
@@ -218,14 +223,13 @@ int reiserfs_bitmap_find_zero_bit (reiserfs_bitmap_t * bm, unsigned long * start
/* read every bitmap block and copy their content into bitmap 'bm' */
static int reiserfs_fetch_ondisk_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys_t * fs)
{
unsigned long to_copy;
int copied;
int i;
char * p;
int last_byte_unused_bits;
unsigned long block;
unsigned int last_byte_unused_bits;
unsigned long block, to_copy;
struct buffer_head * bh;
unsigned int i;
int copied;
int ret = 0;
char * p;
to_copy = (get_sb_block_count (fs->fs_ondisk_sb) + 7) / 8;
@@ -248,8 +252,16 @@ static int reiserfs_fetch_ondisk_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys
mark_buffer_uptodate (bh, 1);
}
if (to_copy < fs->fs_blocksize)
if (to_copy < fs->fs_blocksize) {
for (i = to_copy; i < fs->fs_blocksize; i++) {
if (bh->b_data[i] != (char)0xff) {
ret = 1;
break;
}
}
copied = to_copy;
}
memcpy (p, bh->b_data, copied);
brelse (bh);
p += copied;
@@ -265,8 +277,13 @@ static int reiserfs_fetch_ondisk_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys
/* on disk bitmap has bits out of SB_BLOCK_COUNT set to 1, where as
reiserfs_bitmap_t has those bits set to 0 */
last_byte_unused_bits = bm->bm_byte_size * 8 - bm->bm_bit_size;
for (i = 0; i < last_byte_unused_bits; i ++)
clear_bit (bm->bm_bit_size + i, bm->bm_map);
for (i = 0; i < last_byte_unused_bits; i ++) {
if (misc_test_bit (bm->bm_bit_size + i, bm->bm_map) == 0)
ret = 1;
else
misc_clear_bit (bm->bm_bit_size + i, bm->bm_map);
}
bm->bm_set_bits = 0;
/* FIXME: optimize that */
@@ -275,7 +292,8 @@ static int reiserfs_fetch_ondisk_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys
bm->bm_set_bits ++;
bm->bm_dirty = 0;
return 0;
return ret;
}
@@ -283,14 +301,10 @@ static int reiserfs_fetch_ondisk_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys
changed and return 1. Otherwise - return 0 */
int reiserfs_flush_to_ondisk_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys_t * fs)
{
unsigned long to_copy;
int copied;
int i;
char * p;
int last_byte_unused_bits;
unsigned long block;
unsigned int last_byte_unused_bits, i;
unsigned long to_copy, copied, block;
struct buffer_head * bh;
char * p;
/* make sure that the device is big enough */
bh = bread (fs->fs_dev, bm->bm_bit_size - 1, fs->fs_blocksize);
@@ -331,8 +345,9 @@ int reiserfs_flush_to_ondisk_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys_t *
if (copied == to_copy) {
/* set unused bits of last byte of a bitmap to 1 */
last_byte_unused_bits = bm->bm_byte_size * 8 - bm->bm_bit_size;
for (i = 0; i < last_byte_unused_bits; i ++)
set_bit ((bm->bm_bit_size % (fs->fs_blocksize * 8)) + i, bh->b_data);
misc_set_bit ((bm->bm_bit_size % (fs->fs_blocksize * 8)) + i, bh->b_data);
}
mark_buffer_dirty (bh);
brelse (bh);
@@ -403,14 +418,14 @@ void reiserfs_bitmap_save (FILE * fp, reiserfs_bitmap_t * bm)
__u32 v;
int zeros;
int count;
int i;
unsigned int i;
int extents;
long position;
/* fp = fopen (filename, "w+");
if (!fp) {
reiserfs_warning (stderr, "reiserfs_bitmap_save: could not save bitmap in %s: %m",
filename);
reiserfs_warning (stderr, "reiserfs_bitmap_save: could not save bitmap in %s: %s",
filename, strerror(errno));
return;
}*/
@@ -430,7 +445,7 @@ void reiserfs_bitmap_save (FILE * fp, reiserfs_bitmap_t * bm)
position = ftell(fp);
if (fseek (fp, 4, SEEK_CUR)) {
reiserfs_warning (stderr, "reiserfs_bitmap_save: fseek failed: %m\n");
reiserfs_warning (stderr, "reiserfs_bitmap_save: fseek failed: %s\n", strerror(errno));
// fclose (fp);
return;
}
@@ -481,14 +496,14 @@ void reiserfs_bitmap_save (FILE * fp, reiserfs_bitmap_t * bm)
fwrite (&v, 4, 1, fp);
if (fseek (fp, position, SEEK_SET)) {
reiserfs_warning (stderr, "reiserfs_bitmap_save: fseek failed: %m");
reiserfs_warning (stderr, "reiserfs_bitmap_save: fseek failed: %s", strerror(errno));
return;
}
fwrite (&extents, 4, 1, fp);
if (fseek (fp, 0, SEEK_END)) {
reiserfs_warning (stderr, "reiserfs_bitmap_save: fseek failed: %m");
reiserfs_warning (stderr, "reiserfs_bitmap_save: fseek failed: %s", strerror(errno));
return;
}
}
@@ -528,7 +543,8 @@ int is_stage_magic_correct (FILE * fp)
__u32 v;
if (fseek (fp, -4, SEEK_END)) {
reiserfs_warning (stderr, "is_stage_magic_correct: fseek failed: %m\n");
reiserfs_warning (stderr, "is_stage_magic_correct: fseek failed: %s\n",
strerror(errno));
return -1;
}
@@ -539,7 +555,8 @@ int is_stage_magic_correct (FILE * fp)
}
if (fseek (fp, 0, SEEK_SET)) {
reiserfs_warning (stderr, "is_stage_magic_correct: fseek failed: %m\n");
reiserfs_warning (stderr, "is_stage_magic_correct: fseek failed: %s\n",
strerror(errno));
return -1;
}
@@ -571,7 +588,7 @@ reiserfs_bitmap_t * reiserfs_bitmap_load (FILE * fp)
/* fp = fopen (filename, "r");
if (!fp) {
reiserfs_warning (stderr, "reiserfs_bitmap_load: fopen failed: %m\n");
reiserfs_warning (stderr, "reiserfs_bitmap_load: fopen failed: %s\n", strerror(errno));
return 0;
}*/
@@ -633,7 +650,7 @@ reiserfs_bitmap_t * reiserfs_bitmap_load (FILE * fp)
void reiserfs_bitmap_invert (reiserfs_bitmap_t * bm)
{
int i;
unsigned int i;
/*reiserfs_warning (stderr, "Bitmap inverting..");fflush (stderr);*/
for (i = 0; i < bm->bm_bit_size; i ++) {
@@ -659,33 +676,22 @@ void reiserfs_free_ondisk_bitmap (reiserfs_filsys_t * fs)
/* read bitmap blocks */
int reiserfs_open_ondisk_bitmap (reiserfs_filsys_t * fs)
{
struct buffer_head * bh;
if (fs->fs_bitmap2)
reiserfs_panic ("%s: bitmap is initiaized already", __FUNCTION__);
fs->fs_bitmap2 = reiserfs_create_bitmap (get_sb_block_count (fs->fs_ondisk_sb));
if (!fs->fs_bitmap2)
return 0;
return -1;
if ( (get_sb_block_count (fs->fs_ondisk_sb) + fs->fs_blocksize * 8 - 1) / (fs->fs_blocksize * 8) !=
get_sb_bmap_nr (fs->fs_ondisk_sb)) {
if ((get_sb_block_count (fs->fs_ondisk_sb) + fs->fs_blocksize * 8 - 1) /
(fs->fs_blocksize * 8) != get_sb_bmap_nr (fs->fs_ondisk_sb))
{
reiserfs_warning (stderr, "%s: wrong either bitmaps number,\n", __FUNCTION__);
reiserfs_warning (stderr, "count of blocks or blocksize, run with --rebuild-sb to fix it\n");
return 0;
reiserfs_warning (stderr, "count of blocks or blocksize, run with --rebuild-sb "
"to fix it\n");
return -1;
}
bh = bread (fs->fs_dev, fs->fs_bitmap2->bm_bit_size - 1, fs->fs_blocksize);
if (!bh) {
reiserfs_warning (stderr, "%s: bread failed for block %lu\n", __FUNCTION__, fs->fs_bitmap2->bm_bit_size - 1);
reiserfs_warning (stderr, "\tYour partition is not big enough. Enlarge your partition or\n");
reiserfs_warning (stderr, "\trun reiserfsck with --rebuild-sb to fix super block.\n");
return 0;
}
brelse (bh);
reiserfs_fetch_ondisk_bitmap (fs->fs_bitmap2, fs);
return 1;
return reiserfs_fetch_ondisk_bitmap (fs->fs_bitmap2, fs);
}
int reiserfs_create_ondisk_bitmap (reiserfs_filsys_t * fs)
+7 -8
View File
@@ -1,6 +1,6 @@
/*
* Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Hans Reiser, see
* reiserfs/README for licensing and copyright details
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
/* Now we have all buffers that must be used in balancing of the tree */
@@ -344,8 +344,8 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
/* 0-th item in S0 can be only of DIRECT type when l_n != 0*/
//B_N_PKEY (tbS0, 0)->k_offset += l_n;z
key = B_N_PKEY (tbS0, 0);
temp_n = (is_indirect_ih(B_N_PITEM_HEAD (tb->L[0], n + item_pos - ret_val))) ?
(l_n / UNFM_P_SIZE) * tb->tb_fs->fs_blocksize : l_n;
temp_n = is_indirect_ih(B_N_PITEM_HEAD (tb->L[0], n + item_pos - ret_val)) ?
(int)((l_n / UNFM_P_SIZE) * tb->tb_fs->fs_blocksize) : l_n;
set_offset (key_format (key), key, get_offset (key) + temp_n);
@@ -848,10 +848,9 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
else
/* item falls wholly into S_new[i] */
{
int ret_val;
struct item_head * pasted;
ret_val = leaf_move_items (LEAF_FROM_S_TO_SNEW, tb, snum[i], sbytes[i], S_new[i]);
leaf_move_items (LEAF_FROM_S_TO_SNEW, tb, snum[i], sbytes[i], S_new[i]);
/* paste into item */
bi.bi_bh = S_new[i];
bi.bi_parent = 0;
@@ -983,7 +982,7 @@ struct buffer_head * get_FEB (struct tree_balance * tb)
bi.bi_parent = 0;
bi.bi_position = 0;
make_empty_node (&bi);
set_bit(BH_Uptodate, &first_b->b_state);
misc_set_bit(BH_Uptodate, &first_b->b_state);
tb->FEB[i] = 0;
tb->used[i] = first_b;
@@ -1012,7 +1011,7 @@ void replace_key (reiserfs_filsys_t * fs,
void reiserfs_invalidate_buffer (struct tree_balance * tb, struct buffer_head * bh, int do_free_block)
{
set_blkh_level (B_BLK_HEAD (bh), FREE_LEVEL);
clear_bit(BH_Dirty, &bh->b_state);
misc_clear_bit(BH_Dirty, &bh->b_state);
if (do_free_block) {
struct buffer_head * to_be_forgotten;
+9 -24
View File
@@ -1,6 +1,6 @@
/*
* Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Hans Reiser, see
* reiserfs/README for licensing and copyright details
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
/**
@@ -138,12 +138,8 @@ static void create_virtual_node (struct tree_balance * tb, int h)
int new_num;
struct buffer_head * Sh; /* this comes from tb->S[h] */
struct item_head * temp_ih;
Sh = PATH_H_PBUFFER (tb->tb_path, h);
temp_ih = B_N_PITEM_HEAD (PATH_PLAST_BUFFER (tb->tb_path), B_NR_ITEMS (PATH_PLAST_BUFFER (tb->tb_path)) - 1);
/* size of changed node */
vn->vn_size = MAX_CHILD_SIZE (Sh->b_size) - get_blkh_free_space (B_BLK_HEAD (Sh)) + tb->insert_size[h];
@@ -1030,7 +1026,7 @@ static int are_leaves_removable (struct tree_balance * tb, int lfree, int rfree)
}
if (MAX_CHILD_SIZE (S0->b_size) + vn->vn_size <= rfree + lfree + ih_size) {
if ((int)MAX_CHILD_SIZE(S0->b_size) + vn->vn_size <= rfree + lfree + ih_size) {
set_parameters (tb, 0, -1, -1, -1, NULL, -1, -1);
return 1;
}
@@ -1422,19 +1418,16 @@ static inline int can_node_be_removed (int mode, int lfree, int sfree, int rfree
{
struct buffer_head * Sh = PATH_H_PBUFFER (tb->tb_path, h);
int levbytes = tb->insert_size[h];
struct item_head * ih;
struct item_head * r_ih = NULL;
ih = B_N_PITEM_HEAD (Sh, 0);
if ( tb->CFR[h] )
r_ih = (struct item_head *)B_N_PDELIM_KEY(tb->CFR[h],tb->rkey[h]);
if (
lfree + rfree + sfree < MAX_CHILD_SIZE(Sh->b_size) + levbytes
if (lfree + rfree + sfree < (int)(MAX_CHILD_SIZE(Sh->b_size) + levbytes
/* shifting may merge items which might save space */
- (( ! h && is_left_mergeable (tb->tb_fs, tb->tb_path) == 1 ) ? IH_SIZE : 0)
- (( ! h && r_ih && is_right_mergeable (tb->tb_fs, tb->tb_path) == 1 ) ? IH_SIZE : 0)
+ (( h ) ? KEY_SIZE : 0))
+ (( h ) ? KEY_SIZE : 0)))
{
/* node can not be removed */
if (sfree >= levbytes ) /* new item fits into node S[h] without any shifting */
@@ -1777,15 +1770,12 @@ static int dc_check_balance_internal (struct tree_balance * tb, int h)
/* Sh is the node whose balance is currently being checked,
and Fh is its father. */
struct buffer_head * Sh, * Fh;
int maxsize,
n_ret_value;
int n_ret_value;
int lfree, rfree /* free space in L and R */;
Sh = PATH_H_PBUFFER (tb->tb_path, h);
Fh = PATH_H_PPARENT (tb->tb_path, h);
maxsize = MAX_CHILD_SIZE(Sh->b_size);
/* using tb->insert_size[h], which is negative in this case,
create_virtual_node calculates: new_nr_item = number of items node
would have if operation is performed without balancing (new_nr_item); */
@@ -1934,20 +1924,15 @@ static int dc_check_balance_leaf (struct tree_balance * tb, int h)
bytes. */
int levbytes;
/* the maximal item size */
int maxsize,
n_ret_value;
/* S0 is the node whose balance is currently being checked, and F0 is its
father. */
struct buffer_head * S0, * F0;
int n_ret_value;
/* F0 is the parent of the node whose balance is currently being checked */
struct buffer_head * F0;
int lfree, rfree /* free space in L and R */;
S0 = PATH_H_PBUFFER (tb->tb_path, 0);
F0 = PATH_H_PPARENT (tb->tb_path, 0);
levbytes = tb->insert_size[h];
maxsize = MAX_CHILD_SIZE(S0->b_size); /* maximal possible size of an item */
if ( ! F0 ) {
/* S[0] is the root now. */
set_parameters (tb, h, 0, 0, 1, NULL, -1, -1);
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Hans Reiser, see
* reiserfs/README for licensing and copyright details
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
/*
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Hans Reiser, see
* reiserfs/README for licensing and copyright details
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "includes.h"
+5 -2
View File
@@ -1,7 +1,8 @@
/*
* Copyright 2000, 2001, 2002 by Hans Reiser, licensing governed by
* reiserfs/README
* Copyright 2000-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
@@ -18,3 +19,5 @@
#include "io.h"
#include "misc.h"
#include "reiserfs_lib.h"
#include "swab.h"
+297 -185
View File
@@ -1,5 +1,6 @@
/*
* Copyright 2002 Hans Reiser
* Copyright 2002-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "includes.h"
@@ -53,12 +54,57 @@ unsigned long next_desc_expected (reiserfs_filsys_t * fs, struct buffer_head * d
((offset + get_desc_trans_len (d_bh) + 2) % get_jp_journal_size (sb_jp));
}
/* common checks for validness of a transaction */
int transaction_check_content (reiserfs_filsys_t * fs, reiserfs_trans_t * trans) {
struct buffer_head *d_bh, *c_bh;
struct reiserfs_journal_desc * desc;
struct reiserfs_journal_commit * commit;
unsigned long block;
unsigned int trans_half, i;
/**/
int is_valid_transaction (reiserfs_filsys_t * fs, struct buffer_head * d_bh)
{
struct buffer_head * c_bh;
d_bh = bread (fs->fs_journal_dev, trans->desc_blocknr, fs->fs_blocksize);
if (!d_bh || who_is_this (d_bh->b_data, d_bh->b_size) != THE_JDESC)
goto error_desc_brelse;
/* read expected commit block and compare with descriptor block */
c_bh = bread (fs->fs_journal_dev, commit_expected (fs, d_bh), fs->fs_blocksize);
if (!c_bh)
goto error_desc_brelse;
if (!does_desc_match_commit (d_bh, c_bh))
goto error_commit_brelse;
/* Check that all target blocks are journalable */
desc = (struct reiserfs_journal_desc *)(d_bh->b_data);
commit = (struct reiserfs_journal_commit *)(c_bh->b_data);
trans_half = journal_trans_half (d_bh->b_size);
for (i = 0; i < get_desc_trans_len(d_bh); i++) {
if (i < trans_half)
block = le32_to_cpu (desc->j2_realblock[i]);
else
block = le32_to_cpu (commit->j3_realblock[i - trans_half]);
if (not_journalable(fs, block))
goto error_commit_brelse;
}
brelse (d_bh);
brelse (c_bh);
return 1;
error_commit_brelse:
brelse (c_bh);
error_desc_brelse:
brelse(d_bh);
return 0;
}
/* common checks for validness of a transaction */
int transaction_check_desc(reiserfs_filsys_t * fs, struct buffer_head * d_bh) {
struct buffer_head * c_bh;
int ret = 1;
if (!d_bh || who_is_this (d_bh->b_data, d_bh->b_size) != THE_JDESC)
return 0;
@@ -67,13 +113,12 @@ int is_valid_transaction (reiserfs_filsys_t * fs, struct buffer_head * d_bh)
c_bh = bread (fs->fs_journal_dev, commit_expected (fs, d_bh), fs->fs_blocksize);
if (!c_bh)
return 0;
if (does_desc_match_commit (d_bh, c_bh)) {
brelse (c_bh);
return 1;
}
if (!does_desc_match_commit (d_bh, c_bh))
ret = 0;
brelse (c_bh);
return 0;
return ret;
}
@@ -102,7 +147,7 @@ int get_boundary_transactions (reiserfs_filsys_t * fs,
trans_nr = 0;
for (j_cur = 0; j_cur < j_size; j_cur ++) {
d_bh = bread (fs->fs_journal_dev, j_start + j_cur, fs->fs_blocksize);
if (!is_valid_transaction (fs, d_bh)) {
if (!transaction_check_desc (fs, d_bh)) {
brelse (d_bh);
continue;
}
@@ -158,9 +203,12 @@ int next_transaction (reiserfs_filsys_t * fs, reiserfs_trans_t * trans, reiserfs
found = TRANS_NOT_FOUND;
if (trans->trans_id == break_trans.trans_id)
return found;
/* make sure that 'trans' is a valid transaction */
d_bh = bread (fs->fs_journal_dev, trans->desc_blocknr, fs->fs_blocksize);
if (!is_valid_transaction (fs, d_bh))
if (!transaction_check_desc (fs, d_bh))
die ("next_transaction: valid transaction is expected");
block = next_desc_expected (fs, d_bh);
@@ -168,7 +216,7 @@ int next_transaction (reiserfs_filsys_t * fs, reiserfs_trans_t * trans, reiserfs
while (1) {
next_d_bh = bread (fs->fs_journal_dev, block, fs->fs_blocksize);
if (is_valid_transaction (fs, next_d_bh))
if (transaction_check_desc (fs, next_d_bh))
break;
brelse (next_d_bh);
@@ -196,7 +244,7 @@ int next_transaction (reiserfs_filsys_t * fs, reiserfs_trans_t * trans, reiserfs
return found;
}
static void read_journal_write_in_place (reiserfs_filsys_t * fs, reiserfs_trans_t * trans, int index,
static void read_journal_write_in_place (reiserfs_filsys_t * fs, reiserfs_trans_t * trans, unsigned int index,
unsigned long in_journal, unsigned long in_place)
{
struct buffer_head * j_bh, * bh;
@@ -234,11 +282,9 @@ void for_each_block (reiserfs_filsys_t * fs, reiserfs_trans_t * trans,
struct reiserfs_journal_desc * desc;
struct reiserfs_journal_commit * commit;
unsigned long j_start, j_offset, j_size;
int i;
unsigned int i, trans_half;
unsigned long block;
int trans_half;
d_bh = bread (fs->fs_journal_dev, trans->desc_blocknr, fs->fs_blocksize);
if (!d_bh) {
reiserfs_warning (stdout, "reading descriptor block %lu failed\n", trans->desc_blocknr);
@@ -295,31 +341,16 @@ void for_each_transaction (reiserfs_filsys_t * fs, action_on_trans_t action)
while (1) {
action (fs, &oldest);
if ((ret == TRANS_LAST) || ((ret = next_transaction (fs, &oldest, newest)) == TRANS_NOT_FOUND) )
if (ret == TRANS_LAST)
break;
ret = next_transaction (fs, &oldest, newest);
if (ret == TRANS_NOT_FOUND)
break;
}
}
/* user is allowed to specify journal size and ratio between journal size and
max trans len. Max batch is calculated as 9/10 of max trans len. Max commit
and trans ages are not tunable so far */
static __u32 advise_journal_length (reiserfs_filsys_t * fs, __u32 desired)
{
if (!desired)
return journal_default_size (fs->fs_super_bh->b_blocknr, fs->fs_blocksize);
if (desired < JOURNAL_MIN_SIZE + 1) {
reiserfs_warning (stderr, "WARNING: Journal length is too small %u, resetting to minimal possible %u\n",
desired, JOURNAL_MIN_SIZE + 1);
return JOURNAL_MIN_SIZE;
}
return desired;
}
unsigned long get_size_of_journal_or_reserved_area (struct reiserfs_super_block * sb)
unsigned long get_size_of_journal_or_reserved_area(
struct reiserfs_super_block * sb)
{
if (is_reiserfs_jr_magic_string (sb))
return get_sb_reserved_for_journal (sb);
@@ -329,13 +360,14 @@ unsigned long get_size_of_journal_or_reserved_area (struct reiserfs_super_block
}
__u32 advise_journal_max_trans_len (__u32 desired, __u32 journal_size, int blocksize)
__u32 advise_journal_max_trans_len (__u32 desired, __u32 journal_size /* no j_header */,
int blocksize, int verbose)
{
__u32 saved;
__u32 ratio = 1;
__u32 ratio = 1;
if (blocksize < 4096)
ratio = 4096/blocksize;
if (blocksize < 4096)
ratio = 4096/blocksize;
saved = desired;
if (!desired)
@@ -350,10 +382,13 @@ __u32 advise_journal_max_trans_len (__u32 desired, __u32 journal_size, int block
if (desired < JOURNAL_TRANS_MIN/ratio)
desired = JOURNAL_TRANS_MIN/ratio;
if (saved && saved != desired)
if (verbose) {
if (saved && saved != desired)
reiserfs_warning (stderr,
"WARNING: wrong transaction "
"max size (%u). Changed to %u\n", saved, desired);
"WARNING: wrong transaction max size (%u). Changed to %u\n",
saved, desired);
}
return desired;
}
#if 0
@@ -391,21 +426,64 @@ __u32 advise_journal_max_trans_age (void)
}
int reiserfs_journal_params_check (reiserfs_filsys_t * fs) {
struct reiserfs_journal_header * j_head;
struct reiserfs_super_block * sb = fs->fs_ondisk_sb;
j_head = (struct reiserfs_journal_header *)(fs->fs_jh_bh->b_data);
/* Check the superblock's journal parameters. */
if (!is_reiserfs_jr_magic_string (sb)) {
if (get_jp_journal_dev (sb_jp(sb)) != 0 ||
get_jp_journal_1st_block (sb_jp(sb)) != get_journal_start_must (fs) ||
get_jp_journal_size (sb_jp(sb)) !=
journal_default_size(fs->fs_super_bh->b_blocknr, fs->fs_blocksize))
{
reiserfs_warning (stderr,
"\nreiserfs_open_journal: wrong journal parameters found in the "
"super block. \nYou should run reiserfsck with --rebuild-sb to "
"check your superblock consistency.\n\n");
return 1;
}
}
if (memcmp(&j_head->jh_journal, sb_jp (sb), sizeof(struct journal_params))) {
if (!is_reiserfs_jr_magic_string (sb)) {
reiserfs_warning (stderr,
"\nreiserfs_open_journal: journal parameters from the superblock "
"does not match \nto the journal headers ones. It looks like that "
"you created your fs with old\nreiserfsprogs. Journal header is "
"fixed.\n\n", fs->fs_j_file_name);
memcpy(&j_head->jh_journal, sb_jp(sb), sizeof(struct journal_params));
mark_buffer_dirty(fs->fs_jh_bh);
bwrite(fs->fs_jh_bh);
} else {
reiserfs_warning (stderr,
"\nreiserfs_open_journal: journal parameters from the super block "
"does not match \nto journal parameters from the journal. You should "
"run reiserfsck with --rebuild-sb to check your superblock consistency.\n\n");
return 1;
}
}
return 0;
}
/* read journal header and make sure that it matches with the filesystem
opened */
int reiserfs_open_journal (reiserfs_filsys_t * fs, char * j_filename, int flags)
{
struct buffer_head * bh;
struct reiserfs_journal_header * j_head;
int reiserfs_open_journal (reiserfs_filsys_t * fs, char * j_filename, int flags) {
struct reiserfs_super_block * sb;
__u64 count;
sb = fs->fs_ondisk_sb;
if (!j_filename) {
if (is_reiserfs_jr_magic_string (sb)) {
/* create a special file to access journal */
return 0;
return 1;
}
j_filename = fs->fs_file_name;
@@ -414,58 +492,55 @@ int reiserfs_open_journal (reiserfs_filsys_t * fs, char * j_filename, int flags)
if (strcmp (j_filename, fs->fs_file_name)) {
reiserfs_warning (stderr, "Filesystem with standard journal found, "
"wrong name of specified journal device %s \n", j_filename);
return 0;
return 1;
}
}
fs->fs_journal_dev = open (j_filename, flags | O_LARGEFILE);
if (fs->fs_journal_dev == -1)
return 0;
return -1;
asprintf (&fs->fs_j_file_name, "%s", j_filename);
/* read journal header */
bh = bread (fs->fs_journal_dev, get_jp_journal_1st_block (sb_jp (sb)) +
get_jp_journal_size (sb_jp (sb)), fs->fs_blocksize);
if (!bh) {
reiserfs_warning (stderr, "reiserfs_open_journal: bread failed reading "
"journal header\n");
return 0;
if (get_jp_journal_size(sb_jp(sb)) < JOURNAL_MIN_SIZE) {
reiserfs_warning (stderr, "Journal of (%lu) block size found on specified journal "
"device %s.\nMust be not less than (%lu).\nRun --rebuild-sb to rebuild journal "
"parameters.\n", get_jp_journal_size (sb_jp (sb)) + 1, j_filename,
JOURNAL_MIN_SIZE + 1);
return 1;
}
j_head = (struct reiserfs_journal_header *)(bh->b_data);
if (is_reiserfs_jr_magic_string (sb)) {
if (get_jp_journal_1st_block (&j_head->jh_journal) != get_jp_journal_1st_block (sb_jp (sb)) ||
get_jp_journal_dev (&j_head->jh_journal) != get_jp_journal_dev (sb_jp (sb)) ||
get_jp_journal_size (&j_head->jh_journal) != get_jp_journal_size (sb_jp (sb)))
{
reiserfs_warning (stderr, "reiserfs_open_journal: no journal found on %s\n", j_filename);
brelse (bh);
return 0;
}
} else {
if (get_jp_journal_dev (sb_jp(sb)) != 0 ||
get_jp_journal_1st_block (sb_jp(sb)) != get_journal_start_must (fs) ||
get_jp_journal_size (sb_jp(sb)) != journal_default_size(fs->fs_super_bh->b_blocknr, fs->fs_blocksize))
{
reiserfs_warning (stderr, "reiserfs_open_journal: wrong journal parameters found in the super block.\n");
brelse (bh);
return 0;
}
count = count_blocks (j_filename, fs->fs_blocksize);
if (get_jp_journal_1st_block (sb_jp (sb)) + get_jp_journal_size (sb_jp (sb)) + 1 > count) {
reiserfs_warning (stderr, "Detected journal on specified device %s does not fit to "
"the device.\nStart block (%lu) + size (%lu) less than device size (%lu).\n"
"Run --rebuild-sb to rebuild journal parameters.\n",
get_jp_journal_1st_block(sb_jp (sb)), get_jp_journal_size(sb_jp (sb)) + 1,
count);
return 1;
}
/* read journal header */
fs->fs_jh_bh = bread (fs->fs_journal_dev, get_jp_journal_1st_block (sb_jp (sb))
+ get_jp_journal_size (sb_jp (sb)), fs->fs_blocksize);
if (!fs->fs_jh_bh) {
reiserfs_warning (stderr, "reiserfs_open_journal: bread failed reading "
"journal header.\n");
return -1;
}
fs->fs_jh_bh = bh;
return 1;
return 0;
}
/* initialize super block's journal related fields and journal header fields. If
len is 0 - make journal of default size */
int reiserfs_create_journal (reiserfs_filsys_t * fs, char * j_filename,
unsigned long offset,
unsigned long len, /* journal size including journal header */
int transaction_max_size)
/* initialize super block's journal related fields and journal header fields.
* If len is 0 - make journal of default size */
int reiserfs_create_journal(
reiserfs_filsys_t * fs,
char * j_device, /* journal device name */
unsigned long offset, /* journal offset on the j_device */
unsigned long len, /* including journal header */
int transaction_max_size)
{
struct stat st;
struct buffer_head * bh;
@@ -473,113 +548,126 @@ int reiserfs_create_journal (reiserfs_filsys_t * fs, char * j_filename,
struct reiserfs_super_block * sb;
unsigned long blocks;
sb = fs->fs_ondisk_sb;
if (!j_filename || !strcmp (j_filename, fs->fs_file_name)) {
/* journal is to be on a host device, make sure that there is enough
space for it */
if (!len)
len = journal_default_size (fs->fs_super_bh->b_blocknr, fs->fs_blocksize) + 1;
if (!is_block_count_correct (
fs->fs_super_bh->b_blocknr, fs->fs_blocksize, get_sb_block_count (sb), len - 1)) {
// if (get_sb_block_count (sb) < min_block_amount (fs->fs_blocksize, len)) {
/* host device does not contain enough blocks */
reiserfs_warning (stderr, "reiserfs_create_journal: "
"cannot create filesystem on %d blocks\n",
get_sb_block_count (sb));
if (!j_device || !strcmp (j_device, fs->fs_file_name)) {
/* Journal is to be on the host device, check the amount space for the
* journal on it. */
len = len ? len : journal_default_size(fs->fs_super_bh->b_blocknr,
fs->fs_blocksize) + 1;
offset = offset ? offset : get_journal_start_must(fs);
if (offset < get_journal_start_must(fs)) {
reiserfs_warning (stderr, "reiserfs_create_journal: offset is "
"%lu, but it cannot be less then %llu on the device %s\n",
offset, get_journal_start_must(fs), j_device);
return 0;
}
if (!is_block_count_correct(offset, fs->fs_blocksize,
get_sb_block_count(sb), len))
{
/* host device does not contain enough blocks */
reiserfs_warning (stderr, "reiserfs_create_journal: cannot create "
"a journal of %lu blocks with %lu offset on %d blocks\n",
len, offset, get_sb_block_count(sb));
return 0;
}
j_filename = fs->fs_file_name;
/* journal is not on a separate device starts after super block and first
bitmap. offset is ignored */
offset = get_journal_start_must (fs);
j_device = fs->fs_file_name;
st.st_rdev = 0;
} else {
/* journal is to be on separate device */
blocks = count_blocks (j_filename, fs->fs_blocksize);
blocks = count_blocks (j_device, fs->fs_blocksize);
if (!len) {
/* default size of a journal on a separate device is whole device */
if (blocks < offset) {
reiserfs_warning (stderr,
"reiserfs_create_journal: "
"offset is %lu, blocks on device %lu\n",
offset, blocks);
return 0;
}
len = blocks - offset;
/* default size of a journal on a separate device is whole device */
if (blocks < offset) {
reiserfs_warning (stderr, "reiserfs_create_journal: offset is "
"%lu, blocks on device %lu\n", offset, blocks);
return 0;
}
len = blocks - offset;
}
if (len > journal_default_size (fs->fs_super_bh->b_blocknr, fs->fs_blocksize) + 1)
reiserfs_warning (stderr,
"NOTE: journal new size %lu is greater than default size %lu:\n"
"this may slow down journal initializing and mounting. Hope it is ok.\n\n",
len, journal_default_size (fs->fs_super_bh->b_blocknr, fs->fs_blocksize) + 1);
if (len > journal_default_size (fs->fs_super_bh->b_blocknr,
fs->fs_blocksize) + 1)
{
fflush(stderr);
reiserfs_warning (stdout, "NOTE: journal new size %lu is greater "
"than default size %lu:\nthis may slow down initializing and "
"mounting of the journal. Hope it is ok.\n\n", len,
journal_default_size(fs->fs_super_bh->b_blocknr,
fs->fs_blocksize) + 1);
}
if (blocks < offset + len) {
reiserfs_warning (stderr,
"reiserfs_create_journal: "
"no enough blocks on device %lu, needed %lu\n",
blocks, offset + len);
return 0;
reiserfs_warning (stderr, "reiserfs_create_journal: no enough "
"blocks on device %lu, needed %lu\n", blocks, offset + len);
return 0;
}
if (stat (j_filename, &st) == -1) {
reiserfs_warning (stderr, "reiserfs_create_journal: "
"stat %s failed: %m\n", j_filename);
return 0;
if (stat (j_device, &st) == -1) {
reiserfs_warning (stderr, "reiserfs_create_journal: stat %s failed"
": %s\n", j_device, strerror(errno));
return 0;
}
/*
if (!S_ISBLK (st.st_mode)) {
reiserfs_warning (stderr, "reiserfs_create_journal: "
"%s is not a block device (%x)\n", j_filename, st.st_rdev);
"%s is not a block device (%x)\n", j_device, st.st_rdev);
return 0;
}
*/
}
fs->fs_journal_dev = open (j_filename, O_RDWR | O_LARGEFILE);
fs->fs_journal_dev = open (j_device, O_RDWR | O_LARGEFILE);
if (fs->fs_journal_dev == -1) {
reiserfs_warning (stderr, "reiserfs_create_journal: could not open %s: %m\n",
j_filename);
reiserfs_warning (stderr, "reiserfs_create_journal: could not open "
"%s: %s\n", j_device, strerror(errno));
return 0;
}
asprintf (&fs->fs_j_file_name, "%s", j_filename);
len = advise_journal_length (fs, len - 1) + 1;
asprintf (&fs->fs_j_file_name, "%s", j_device);
if (len < JOURNAL_MIN_SIZE) {
reiserfs_warning (stderr, "WARNING: Journal size (%u) is less, than "
"minimal supported journal size (%u).", len, JOURNAL_MIN_SIZE + 1);
return 0;
}
/* get journal header */
bh = getblk (fs->fs_journal_dev, offset + len - 1, fs->fs_blocksize);
if (!bh) {
reiserfs_warning (stderr, "reiserfs_create_journal: "
"getblk failed\n");
reiserfs_warning (stderr, "reiserfs_create_journal: getblk failed\n");
return 0;
}
/* fill journal header */
jh = (struct reiserfs_journal_header *)bh->b_data;
set_jp_journal_1st_block (&jh->jh_journal, offset);
set_jp_journal_dev (&jh->jh_journal, st.st_rdev);
set_jp_journal_magic (&jh->jh_journal, get_random ());
set_jp_journal_1st_block(&jh->jh_journal, offset);
set_jp_journal_dev(&jh->jh_journal, st.st_rdev);
set_jp_journal_magic(&jh->jh_journal, get_random());
set_jp_journal_size (&jh->jh_journal, len - 1);
set_jp_journal_max_trans_len (&jh->jh_journal,
advise_journal_max_trans_len(transaction_max_size, len - 1, fs->fs_blocksize));
set_jp_journal_max_batch (&jh->jh_journal,
advise_journal_max_batch (get_jp_journal_max_trans_len (&jh->jh_journal) ));
set_jp_journal_max_commit_age (&jh->jh_journal, advise_journal_max_commit_age ());
set_jp_journal_max_trans_age (&jh->jh_journal, advise_journal_max_trans_age ());
set_jp_journal_size(&jh->jh_journal, len - 1);
set_jp_journal_max_trans_len(&jh->jh_journal, advise_journal_max_trans_len(
transaction_max_size, len - 1, fs->fs_blocksize, 1));
set_jp_journal_max_batch(&jh->jh_journal, advise_journal_max_batch(
get_jp_journal_max_trans_len(&jh->jh_journal)));
set_jp_journal_max_commit_age(&jh->jh_journal,
advise_journal_max_commit_age());
set_jp_journal_max_trans_age(&jh->jh_journal,
advise_journal_max_trans_age ());
mark_buffer_uptodate (bh, 1);
mark_buffer_dirty (bh);
fs->fs_jh_bh = bh;
/* make a copy of journal header in the super block */
memcpy (sb_jp (sb), &jh->jh_journal, sizeof (struct journal_params));
mark_buffer_dirty (fs->fs_super_bh);
return 1;
@@ -601,7 +689,7 @@ void reiserfs_reopen_journal (reiserfs_filsys_t * fs, int flag)
flush_buffers (fs->fs_journal_dev);
invalidate_buffers (fs->fs_journal_dev);
if (close (fs->fs_journal_dev))
die ("reiserfs_reopen_journal: closed failed: %m");
die ("reiserfs_reopen_journal: closed failed: %s", strerror(errno));
fs->fs_journal_dev = open (fs->fs_j_file_name, flag | O_LARGEFILE);
if (fs->fs_journal_dev == -1)
@@ -665,7 +753,7 @@ int replay_journal (reiserfs_filsys_t * fs)
struct buffer_head * bh;
struct reiserfs_journal_header * j_head;
reiserfs_trans_t cur, newest, control;
int replayed, ret = 0;
int replayed, ret;
if (!reiserfs_journal_opened (fs))
reiserfs_panic ("replay_journal: journal is not opened");
@@ -686,29 +774,53 @@ int replay_journal (reiserfs_filsys_t * fs)
return 0;
}
if (control.mount_id != newest.mount_id) {
reiserfs_warning (stderr, "Journal header's mountid: %lu\n"
"latest transaction found is of mountid %lu\n", control.mount_id, newest.mount_id);
if (user_confirmed (stderr, "Should those transactions be replayed?(Y/n)[n]", "Y\n")) {
control.mount_id = newest.mount_id;
// control.trans_id = 0;
}
}
/* Smth strange with journal header or journal. We cannot say for sure what was the last
replaied transaction, but relying on JH data is preferable. */
replayed = 0;
while (1) {
if (cur.mount_id == control.mount_id && cur.trans_id > control.trans_id) {
reiserfs_warning (stderr, "trans replayed: mountid %lu, transid %lu, desc %lu, "
"len %lu, commit %lu, next trans offset %lu\n",
cur.mount_id, cur.trans_id, cur.desc_blocknr, cur.trans_len,
cur.commit_blocknr, cur.next_trans_offset);
replay_one_transaction (fs, &cur);
update_journal_header (bh, cur);
replayed ++;
}
if ((ret == TRANS_LAST) || ((ret = next_transaction (fs, &cur, newest)) == TRANS_NOT_FOUND) )
ret = TRANS_FOUND;
while (cur.mount_id != control.mount_id || cur.trans_id != control.trans_id) {
if (control.mount_id == cur.mount_id && control.trans_id == 0 &&
control.desc_blocknr == 0)
break;
ret = next_transaction (fs, &cur, newest);
if (ret != TRANS_FOUND)
break;
}
while (ret == TRANS_FOUND) {
if (control.mount_id != cur.mount_id || control.trans_id != 0 ||
control.desc_blocknr != 0)
{
ret = next_transaction (fs, &cur, newest);
if (ret == TRANS_NOT_FOUND)
break;
if (cur.mount_id != control.mount_id || cur.trans_id != control.trans_id + 1)
break;
}
if (!transaction_check_content(fs, &cur)) {
reiserfs_warning (stderr, "Trans broken: mountid %lu, transid %lu, desc %lu, "
"len %lu, commit %lu, next trans offset %lu\n", cur.mount_id, cur.trans_id,
cur.desc_blocknr, cur.trans_len, cur.commit_blocknr, cur.next_trans_offset);
break;
}
reiserfs_warning (stderr, "Trans replayed: mountid %lu, transid %lu, desc %lu, "
"len %lu, commit %lu, next trans offset %lu\n",
cur.mount_id, cur.trans_id, cur.desc_blocknr, cur.trans_len,
cur.commit_blocknr, cur.next_trans_offset);
replay_one_transaction (fs, &cur);
update_journal_header (bh, cur);
control = cur;
replayed ++;
}
reiserfs_warning (stderr, "%d transactions replayed\n", replayed);
mark_buffer_dirty (fs->fs_super_bh);
+11 -14
View File
@@ -1,6 +1,6 @@
/*
* Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Hans Reiser, see
* reiserfs/README for licensing and copyright details
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "includes.h"
@@ -704,9 +704,8 @@ void leaf_insert_into_buf (reiserfs_filsys_t * s,
mark_buffer_dirty(bi->bi_parent) ;
}
if (who_is_this (bh->b_data, bh->b_size) != THE_LEAF)
reiserfs_panic ("leaf_insert_into_buf: bad leaf %lu: %b",
bh->b_blocknr, bh);
if (is_a_leaf(bh->b_data, bh->b_size) != THE_LEAF)
reiserfs_panic ("leaf_insert_into_buf: bad leaf %lu: %b", bh->b_blocknr, bh);
}
@@ -784,9 +783,8 @@ void leaf_paste_in_buffer (reiserfs_filsys_t * fs,
set_dc_child_size (dc, get_dc_child_size (dc) + paste_size);
mark_buffer_dirty(bi->bi_parent);
}
if (who_is_this (bh->b_data, bh->b_size) != THE_LEAF)
reiserfs_panic ("leaf_paste_in_buffer: bad leaf %lu: %b",
bh->b_blocknr, bh);
if (is_a_leaf(bh->b_data, bh->b_size) != THE_LEAF)
reiserfs_panic ("leaf_paste_in_buffer: bad leaf %lu: %b", bh->b_blocknr, bh);
}
@@ -951,7 +949,7 @@ void leaf_cut_from_buffer (reiserfs_filsys_t * fs,
set_dc_child_size (dc, get_dc_child_size (dc) - cut_size);
mark_buffer_dirty(bi->bi_parent);
}
if (who_is_this (bh->b_data, bh->b_size) != THE_LEAF)
if (is_a_leaf(bh->b_data, bh->b_size) != THE_LEAF)
reiserfs_panic ("leaf_cut_from_buffer: bad leaf %lu: %b",
bh->b_blocknr, bh);
}
@@ -1013,12 +1011,12 @@ static void leaf_delete_items_entirely (reiserfs_filsys_t * fs,
struct disk_child * dc;
dc = B_N_CHILD (bi->bi_parent, bi->bi_position);
set_dc_child_size (dc, get_dc_child_size (dc) - (j - last_removed_loc + IH_SIZE * del_num));
set_dc_child_size (dc, get_dc_child_size (dc) -
(j - last_removed_loc + IH_SIZE * del_num));
mark_buffer_dirty(bi->bi_parent);
}
if (who_is_this (bh->b_data, bh->b_size) != THE_LEAF)
reiserfs_panic ("leaf_delete_items_entirely: bad leaf %lu: %b",
bh->b_blocknr, bh);
if (is_a_leaf(bh->b_data, bh->b_size) != THE_LEAF)
reiserfs_panic ("leaf_delete_items_entirely: bad leaf %lu: %b", bh->b_blocknr, bh);
}
@@ -1075,7 +1073,6 @@ void leaf_paste_entries (struct buffer_head * bh,
memmove ((char *)(deh + new_entry_count), deh, insert_point - (char *)deh);
/* copy new entry heads */
deh = (struct reiserfs_de_head *)((char *)deh);
memcpy (deh, new_dehs, DEH_SIZE * new_entry_count);
/* set locations of new records */
+120 -174
View File
@@ -1,23 +1,94 @@
/*
* Copyright 2000, 2001, 2002 by Hans Reiser, licensing governed by
* reiserfs/README
* Copyright 2000-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "includes.h"
int correct_direct_item_offset (__u64 offset, int format) {
if (format == KEY_FORMAT_2) {
return (offset && ((offset - 1) % 8 == 0));
} else {
return (offset);
int leaf_count_ih(char * buf, int blocksize) {
struct item_head * ih;
int prev_location;
int nr;
/* look at the table of item head */
prev_location = blocksize;
ih = (struct item_head *)(buf + BLKH_SIZE);
nr = 0;
while (1) {
if (get_ih_location (ih) + get_ih_item_len (ih) != prev_location)
break;
if (get_ih_location (ih) < IH_SIZE * (nr + 1) + BLKH_SIZE)
break;
if (get_ih_item_len (ih) > MAX_ITEM_LEN (blocksize))
break;
prev_location = get_ih_location (ih);
ih ++;
nr ++;
}
return 0;
return nr;
}
int leaf_free_space_estimate(char * buf, int blocksize) {
struct block_head * blkh;
struct item_head * ih;
int nr;
blkh = (struct block_head *)buf;
nr = get_blkh_nr_items(blkh);
ih = (struct item_head *)(buf + BLKH_SIZE) + nr - 1;
return (nr ? get_ih_location (ih) : blocksize) - BLKH_SIZE - IH_SIZE * nr;
}
static int leaf_blkh_correct(char * buf, int blocksize) {
struct block_head * blkh;
unsigned int nr;
blkh = (struct block_head *)buf;
if (!is_leaf_block_head (buf))
return 0;
nr = get_blkh_nr_items(blkh);
if (nr > ((blocksize - BLKH_SIZE) / (IH_SIZE + MIN_ITEM_LEN)))
/* item number is too big or too small */
return 0;
return leaf_free_space_estimate(buf, blocksize) == get_blkh_free_space (blkh);
}
int is_a_leaf(char * buf, int blocksize) {
struct block_head * blkh;
int counted;
blkh = (struct block_head *)buf;
if (!is_leaf_block_head (buf))
return 0;
counted = leaf_count_ih(buf, blocksize);
/* if leaf block header is ok, check item count also. */
if (leaf_blkh_correct(buf, blocksize))
return counted >= get_blkh_nr_items (blkh) ? THE_LEAF : HAS_IH_ARRAY;
/* leaf block header is corrupted, it is ih_array if some items were detected.*/
return counted ? HAS_IH_ARRAY : 0;
}
int leaf_item_number_estimate(struct buffer_head * bh) {
struct block_head * blkh;
int nr;
nr = leaf_count_ih(bh->b_data, bh->b_size);
blkh = (struct block_head *)bh->b_data;
return nr >= get_blkh_nr_items (blkh) ? get_blkh_nr_items (blkh) : nr;
}
#if 0
/* this only checks block header and item head array (ih_location-s
and ih_item_len-s). Item internals are not checked */
static int does_node_look_like_a_leaf (char * buf, int blocksize)
int does_node_look_like_a_leaf (char * buf, int blocksize)
{
struct block_head * blkh;
struct item_head * ih;
@@ -37,6 +108,7 @@ static int does_node_look_like_a_leaf (char * buf, int blocksize)
ih = (struct item_head *)(buf + BLKH_SIZE) + nr - 1;
used_space = BLKH_SIZE + IH_SIZE * nr + (blocksize - (nr ? get_ih_location (ih) : blocksize));
if (used_space != blocksize - get_blkh_free_space (blkh))
/* free space does not match to calculated amount of use space */
return 0;
@@ -63,10 +135,9 @@ static int does_node_look_like_a_leaf (char * buf, int blocksize)
return 1;
}
/* check ih_item_len and ih_location. Should be useful when block head is
corrupted */
int does_node_have_ih_array (char * buf, int blocksize)
static int does_node_have_ih_array (char * buf, int blocksize)
{
struct item_head * ih;
int prev_location;
@@ -88,13 +159,13 @@ int does_node_have_ih_array (char * buf, int blocksize)
return 0;
return nr;
}
#endif
/* returns 1 if buf looks like an internal node, 0 otherwise */
static int is_correct_internal (char * buf, int blocksize)
{
struct block_head * blkh;
int nr;
unsigned int nr;
int used_space;
blkh = (struct block_head *)buf;
@@ -123,7 +194,7 @@ int is_tree_node (struct buffer_head * bh, int level)
if (B_LEVEL (bh) != level)
return 0;
if (is_leaf_node (bh))
return does_node_look_like_a_leaf (bh->b_data, bh->b_size);
return is_a_leaf(bh->b_data, bh->b_size);
return is_correct_internal (bh->b_data, bh->b_size);
}
@@ -203,30 +274,6 @@ int reiserfs_super_block_size (struct reiserfs_super_block * sb)
return 0;
}
#if 0
/* returns code of 0 - here means 3.5 format,
2 - either pure 3.6 or converted 3.5
3 - journal-relocated 3.6*/
int magic_2_version (struct reiserfs_super_block * rs)
{
int ret;
ret = 0;
if (is_reiser2fs_magic_string (rs))
ret = REISERFS_VERSION_2 ;
else if (is_reiser2fs_jr_magic_string (rs))
ret = REISERFS_VERSION_3;
else if (is_reiserfs_magic_string (rs))
ret = REISERFS_VERSION_1;
else
reiserfs_panic ("magic_2_version: unknown magic string found");
return ret;
}
#endif
/* this one had signature in different place of the super_block
structure */
int is_prejournaled_reiserfs (struct reiserfs_super_block * rs)
@@ -251,19 +298,17 @@ int does_look_like_super_block (struct reiserfs_super_block * sb) {
block, journal descriptor), unformatted */
int who_is_this (char * buf, int blocksize)
{
int res;
/* super block? */
if (does_look_like_super_block ((void *)buf))
return THE_SUPER;
if (does_node_look_like_a_leaf (buf, blocksize))
/* block head and item head array seem matching (node level, free
space, item number, item locations and length) */
return THE_LEAF;
if (does_node_have_ih_array (buf, blocksize)) {
/* item header array found */
return HAS_IH_ARRAY;
}
if ((res = is_a_leaf(buf, blocksize)))
/* if block head and item head array seem matching (node level, free
space, item number, item locations and length), then it is THE_LEAF,
otherwise, it is HAS_IH_ARRAY */
return res;
if (is_correct_internal (buf, blocksize))
return THE_INTERNAL;
@@ -282,7 +327,7 @@ int who_is_this (char * buf, int blocksize)
char * which_block (int code)
{
static char * leaf = "leaf";
static char * broken_leaf = "leaf w/o block head";
static char * broken_leaf = "broken leaf";
static char * internal = "internal";
static char * other = "unknown";
@@ -299,8 +344,7 @@ char * which_block (int code)
/** */
int block_of_journal (reiserfs_filsys_t * fs, unsigned long block)
{
int block_of_journal (reiserfs_filsys_t * fs, unsigned long block) {
if (!is_reiserfs_jr_magic_string (fs->fs_ondisk_sb)) {
/* standard journal */
if (block >= get_journal_start_must (fs) &&
@@ -328,9 +372,7 @@ int block_of_bitmap (reiserfs_filsys_t * fs, unsigned long block)
return (block == (REISERFS_DISK_OFFSET_IN_BYTES / fs->fs_blocksize + 1)) ;
} else {
/* bitmap in */
if (block > 2 && block < 3 + get_sb_bmap_nr (fs->fs_ondisk_sb))
return 1;
return 0;
return (block > 2ul && block < 3ul + get_sb_bmap_nr(fs->fs_ondisk_sb)) ? 1 : 0;
}
return 0;
}
@@ -343,9 +385,6 @@ int not_data_block (reiserfs_filsys_t * fs, unsigned long block)
/* it is one of bitmap blocks */
return 1;
if (block > 32768)
return 0;
if (block_of_journal (fs, block))
/* block of journal area */
return 1;
@@ -377,26 +416,24 @@ int not_journalable (reiserfs_filsys_t * fs, unsigned long block)
// in reiserfs version 0 (undistributed bitmap)
// FIXME: what if number of bitmaps is 15?
int get_journal_old_start_must (reiserfs_filsys_t * fs)
{
return (REISERFS_OLD_DISK_OFFSET_IN_BYTES / fs->fs_blocksize) + 1 + get_sb_bmap_nr (fs->fs_ondisk_sb);
unsigned int get_journal_old_start_must (reiserfs_filsys_t * fs) {
return (REISERFS_OLD_DISK_OFFSET_IN_BYTES / fs->fs_blocksize) + 1 +
get_sb_bmap_nr (fs->fs_ondisk_sb);
}
int get_journal_new_start_must (reiserfs_filsys_t * fs)
unsigned int get_journal_new_start_must (reiserfs_filsys_t * fs)
{
return (REISERFS_DISK_OFFSET_IN_BYTES / fs->fs_blocksize) + 2;
}
int get_journal_start_must (reiserfs_filsys_t * fs) {
// if (fs->fs_super_bh->b_size == 4096 && fs->fs_super_bh->b_blocknr == 2)
if (is_old_sb_location (fs->fs_super_bh->b_blocknr, fs->fs_blocksize))
unsigned int get_journal_start_must(reiserfs_filsys_t * fs) {
if (is_old_sb_location(fs->fs_super_bh->b_blocknr, fs->fs_blocksize))
return get_journal_old_start_must (fs);
return get_journal_new_start_must (fs);
return get_journal_new_start_must(fs);
}
__u64 get_bytes_number (struct item_head * ih, int blocksize)
{
__u32 get_bytes_number (struct item_head * ih, int blocksize) {
switch (get_type (&ih->ih_key)) {
case TYPE_DIRECT:
return get_ih_item_len (ih);
@@ -413,79 +450,6 @@ __u64 get_bytes_number (struct item_head * ih, int blocksize)
int check_item_f (reiserfs_filsys_t * fs, struct item_head * ih, char * item);
#if 0
/* look at the 16 byte and try to find: does it look like a reiserfs
key. Returns 0 if something looks broken in the key, 1 otherwise */
static int does_key_look_correct (reiserfs_filsys_t * fs, struct key * key)
{
int type;
if (key->k_dir_id == key->k_objectid ||
!key->k_dir_id || key->k_objectid < 2)
/* k_dir_id and k_objectid must be different, and > 0 */
return 0;
if (key->u.k_offset_v1.k_offset == 0 &&
key->u.k_offset_v1.k_uniqueness == 0)
/* looks like a stat data */
return 1;
if (!key->u.k_offset_v1.k_offset ||
!key->u.k_offset_v1.k_uniqueness)
/* these should be either both 0 or both !0 */
return 0;
type = key->u.k_offset_v2.k_type;
if (key->u.k_offset_v1.k_uniqueness == 500)
/* looks like a key of directory entry */
return (type == 0) ? 1 : 0;
if (type == 15) {
/* looks like old key of */
if (key->u.k_offset_v1.k_uniqueness == 0xffffffff) {
/* direct item. Check offset */
if (key->u.k_offset_v1.k_offset >= fs->s_blocksize * 4 + 1)
/* fixme: this could be more accurate */
return 0;
return 1;
}
if (key->u.k_offset_v1.k_uniqueness == 0xfffffffe) {
/* indirect item. Check offset */
if (key->u.k_offset_v1.k_offset % fs->s_blocksize != 1)
return 0;
return 1;
}
return 0;
}
/* there should be a new key of indirect or direct item */
if (type == TYPE_DIRECT) {
/* check offset */
if (key->u.k_offset_v2.k_offset >= fs->s_blocksize * 4 + 1) /* fixme*/
/* fixme: this could be more accurate */
return 0;
if ((key->u.k_offset_v2.k_offset - 1) % 8 != 0)
/* "new" direct items get split on the boundary of 8 byte */
return 0;
return 1;
}
if (type == TYPE_INDIRECT) {
/* check offset */
if ((key->u.k_offset_v2.k_offset % fs->s_blocksize) != 1)
return 0;
return 1;
}
return 0;
}
#endif
/* ih_key, ih_location and ih_item_len seem correct, check other fields */
static int does_ih_look_correct (struct item_head * ih)
{
@@ -522,7 +486,7 @@ static int does_ih_look_correct (struct item_head * ih)
static int is_bad_indirect (reiserfs_filsys_t * fs, struct item_head * ih, char * item,
check_unfm_func_t check_unfm_func)
{
int i;
unsigned int i;
__u32 * ind = (__u32 *)item;
if (get_ih_item_len (ih) % UNFM_P_SIZE)
@@ -571,7 +535,7 @@ int known_hashes (void)
int is_properly_hashed (reiserfs_filsys_t * fs,
char * name, int namelen, __u32 offset)
{
int i;
unsigned int i;
if (namelen == 1 && name[0] == '.') {
if (offset == DOT_OFFSET)
@@ -610,30 +574,14 @@ int is_properly_hashed (reiserfs_filsys_t * fs,
if (good_name (reiserfs_hash(fs), name, namelen, offset))
return 1;
#if 0
fprintf (stderr, "is_properly_hashed: namelen %d, name \"%s\", offset %u, hash %u\n",
namelen, name_from_entry (name, namelen), GET_HASH_VALUE (offset),
GET_HASH_VALUE (reiserfs_hash(fs) (name, namelen)));
/* we could also check whether more than one hash function match on the
name */
for (i = 1; i < sizeof (hashes) / sizeof (hashes [0]); i ++) {
if (i == g_real_hash)
continue;
if (good_name (hashes[i], name, namelen, deh_offset)) {
die ("bad_hash: at least two hashes got screwed up with this name: \"%s\"",
bad_name (name, namelen));
}
}
#endif
return 0;
}
int find_hash_in_use (char * name, int namelen, __u32 hash_value_masked, int code_to_try_first)
int find_hash_in_use (char * name, int namelen, __u32 hash_value_masked, unsigned int code_to_try_first)
{
int i;
unsigned int i;
if (!namelen || !name[0])
return UNSET_HASH;
@@ -642,6 +590,7 @@ int find_hash_in_use (char * name, int namelen, __u32 hash_value_masked, int cod
if (hash_value_masked == GET_HASH_VALUE (hashes [code_to_try_first].func (name, namelen)))
return code_to_try_first;
}
for (i = 1; i < HASH_AMOUNT; i ++) {
if (i == code_to_try_first)
continue;
@@ -654,8 +603,7 @@ int find_hash_in_use (char * name, int namelen, __u32 hash_value_masked, int cod
}
char * code2name (int code)
{
char * code2name(unsigned int code) {
if (code >= HASH_AMOUNT || code < 0)
return 0;
return hashes [code].name;
@@ -664,7 +612,7 @@ char * code2name (int code)
int func2code (hashf_t func)
{
int i;
unsigned int i;
for (i = 0; i < HASH_AMOUNT; i ++)
if (func == hashes [i].func)
@@ -675,8 +623,7 @@ int func2code (hashf_t func)
}
hashf_t code2func (int code)
{
hashf_t code2func(unsigned int code) {
if (code >= HASH_AMOUNT) {
reiserfs_warning (stderr, "code2func: wrong hash code %d.\n"
"Using default %s hash function\n", code,
@@ -687,9 +634,8 @@ hashf_t code2func (int code)
}
hashf_t name2func (char * hash)
{
int i;
hashf_t name2func (char * hash) {
unsigned int i;
for (i = 0; i < HASH_AMOUNT; i ++)
if (!strcmp (hash, hashes [i].name))
@@ -730,9 +676,9 @@ static int is_bad_directory (reiserfs_filsys_t * fs, struct item_head * ih, char
prev_location = get_deh_location (deh);
namelen = name_in_entry_length (ih, deh, i);
if (namelen > REISERFS_MAX_NAME_LEN (fs->fs_blocksize)) {
if (namelen > (int)REISERFS_MAX_NAME_LEN(fs->fs_blocksize))
return 1;
}
if (get_deh_offset (deh) <= prev_offset)
return 1;
prev_offset = get_deh_offset (deh);
@@ -980,8 +926,7 @@ int key_format (const struct key * key)
}
loff_t get_offset (const struct key * key)
{
unsigned long long get_offset (const struct key * key) {
if (key_format (key) == KEY_FORMAT_1)
return get_key_offset_v1 (key);
@@ -1352,8 +1297,9 @@ void mark_objectid_used (reiserfs_filsys_t * fs, __u32 objectid)
}
int is_blocksize_correct (int blocksize)
int is_blocksize_correct (unsigned int blocksize)
{
return ((blocksize == 0) || (blocksize % 1024) ? 0 : 1);
return ((blocksize == 0) || (((blocksize & -blocksize) == blocksize)
&& (blocksize >=512) && (blocksize <= 8192)));
}
+53 -42
View File
@@ -1,6 +1,6 @@
/*
* Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Hans Reiser, see
* reiserfs/README for licensing and copyright details
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "includes.h"
@@ -376,7 +376,7 @@ static void print_sequence (FILE * fp, __u32 start, int len)
void print_indirect_item (FILE * fp, struct buffer_head * bh, int item_num)
{
struct item_head * ih;
int j;
unsigned int j;
__u32 * unp, prev = INT_MAX;
int num;
@@ -403,7 +403,7 @@ char timebuf[256];
char * timestamp (time_t t)
{
strftime (timebuf, 256, "%m/%d/%Y %T", localtime (&t));
strftime (timebuf, 256, "%d/%Y %T", localtime (&t));
return timebuf;
}
@@ -517,8 +517,8 @@ static int print_leaf (FILE * fp, reiserfs_filsys_t * fs, struct buffer_head * b
blkh = B_BLK_HEAD (bh);
ih = B_N_PITEM_HEAD (bh,0);
nr = get_blkh_nr_items (blkh);
nr = leaf_count_ih(bh->b_data, bh->b_size);
reiserfs_warning (fp,
"\n===================================================================\n");
reiserfs_warning (fp, "LEAF NODE (%ld) contains %b (real items %d)\n",
@@ -526,7 +526,7 @@ static int print_leaf (FILE * fp, reiserfs_filsys_t * fs, struct buffer_head * b
if (!(print_mode & PRINT_TREE_DETAILS)) {
reiserfs_warning (fp, "FIRST ITEM_KEY: %k, LAST ITEM KEY: %k\n",
&(ih->ih_key), &((ih + get_blkh_nr_items (blkh) - 1)->ih_key));
&(ih->ih_key), &((ih + nr - 1)->ih_key));
return 0;
}
@@ -607,6 +607,7 @@ int print_super_block (FILE * fp, reiserfs_filsys_t * fs, char * file_name,
struct reiserfs_super_block * sb = (struct reiserfs_super_block *)(bh->b_data);
dev_t rdev;
int format = 0;
__u16 state;
if (!does_look_like_super_block (sb))
return 1;
@@ -643,7 +644,7 @@ int print_super_block (FILE * fp, reiserfs_filsys_t * fs, char * file_name,
reiserfs_warning (fp, "Root block: %u\n", get_sb_root_block (sb));
}
reiserfs_warning (fp, "Filesystem is %scleanly umounted\n",
(get_sb_umount_state (sb) == REISERFS_CLEANLY_UMOUNTED) ? "" : "NOT ");
(get_sb_umount_state (sb) == FS_CLEANLY_UMOUNTED) ? "" : "NOT ");
if (short_print)
return 0;
@@ -656,14 +657,23 @@ int print_super_block (FILE * fp, reiserfs_filsys_t * fs, char * file_name,
print_journal_params (fp, sb_jp (sb));
reiserfs_warning (fp, "Blocks reserved by journal: %u\n",
get_sb_reserved_for_journal (sb));
reiserfs_warning (fp, "Fs state field: 0x%x\n", get_sb_fs_state (sb));
state = get_sb_fs_state (sb);
reiserfs_warning (fp, "Fs state field: 0x%x:\n", state);
if ((state & FS_FATAL) == FS_FATAL)
reiserfs_warning (fp, "\tFATAL corruptions exist.\n");
if ((state & FS_ERROR) == FS_ERROR)
reiserfs_warning (fp, "\t some corruptions exist.\n");
if ((state & IO_ERROR) == IO_ERROR)
reiserfs_warning (fp, "\tI/O corruptions exist.\n");
reiserfs_warning (fp, "sb_version: %u\n", get_sb_version (sb));
if (format == 2) {
reiserfs_warning (fp, "inode generation number: %u\n", get_sb_v2_inode_generation (sb));
reiserfs_warning (fp, "UUID: %U\n", sb->s_uuid);
reiserfs_warning (fp, "LABEL: %.16s\n", sb->s_label);
reiserfs_warning (fp, "Set flags in SB:\n");
reiserfs_warning (fp, "\t%s\n", ((get_sb_v2_flag (sb, reiserfs_attrs_cleared)) ? "ATTRIBUTES CLEAN" : ""));
if ((get_sb_v2_flag (sb, reiserfs_attrs_cleared)))
reiserfs_warning (fp, "\tATTRIBUTES CLEAN\n");
}
return 0;
@@ -722,8 +732,7 @@ void print_block (FILE * fp, reiserfs_filsys_t * fs,
void print_tb (int mode, int item_pos, int pos_in_item, struct tree_balance * tb, char * mes)
{
int h = 0;
int i;
unsigned int h = 0;
struct buffer_head * tbSh, * tbFh;
@@ -753,19 +762,19 @@ void print_tb (int mode, int item_pos, int pos_in_item, struct tree_balance * tb
tbSh = 0;
tbFh = 0;
}
printf ("* %d * %3ld(%2d) * %3ld(%2d) * %3ld(%2d) * %5ld * %5ld * %5ld * %5ld * %5ld *\n",
printf ("* %u * %3lu(%2lu) * %3lu(%2lu) * %3lu(%2lu) * %5ld * %5ld * %5ld * %5ld * %5ld *\n",
h,
(tbSh) ? (tbSh->b_blocknr):(-1),
(tbSh) ? tbSh->b_count : -1,
(tb->L[h]) ? (tb->L[h]->b_blocknr):(-1),
(tb->L[h]) ? tb->L[h]->b_count : -1,
(tb->R[h]) ? (tb->R[h]->b_blocknr):(-1),
(tb->R[h]) ? tb->R[h]->b_count : -1,
(tbFh) ? (tbFh->b_blocknr):(-1),
(tb->FL[h]) ? (tb->FL[h]->b_blocknr):(-1),
(tb->FR[h]) ? (tb->FR[h]->b_blocknr):(-1),
(tb->CFL[h]) ? (tb->CFL[h]->b_blocknr):(-1),
(tb->CFR[h]) ? (tb->CFR[h]->b_blocknr):(-1));
tbSh ? tbSh->b_blocknr : ~0ul,
tbSh ? tbSh->b_count : ~0ul,
tb->L[h] ? tb->L[h]->b_blocknr : ~0ul,
tb->L[h] ? tb->L[h]->b_count : ~0ul,
tb->R[h] ? tb->R[h]->b_blocknr : ~0ul,
tb->R[h] ? tb->R[h]->b_count : ~0ul,
tbFh ? tbFh->b_blocknr : ~0ul,
tb->FL[h] ? tb->FL[h]->b_blocknr : ~0ul,
tb->FR[h] ? tb->FR[h]->b_blocknr : ~0ul,
tb->CFL[h] ? tb->CFL[h]->b_blocknr : ~0ul,
tb->CFR[h] ? tb->CFR[h]->b_blocknr : ~0ul);
}
printf ("*********************************************************************\n");
@@ -790,14 +799,12 @@ void print_tb (int mode, int item_pos, int pos_in_item, struct tree_balance * tb
/* print FEB list (list of buffers in form (bh (b_blocknr, b_count), that will be used for new nodes) */
h = 0;
for (i = 0; i < sizeof (tb->FEB) / sizeof (tb->FEB[0]); i ++)
printf ("%s%p (%lu %d)", i == 0 ? "FEB list: " : ", ", tb->FEB[i], tb->FEB[i] ? tb->FEB[i]->b_blocknr : 0,
tb->FEB[i] ? tb->FEB[i]->b_count : 0);
for (h = 0; h < sizeof (tb->FEB) / sizeof (tb->FEB[0]); h++)
printf("%s%p (%lu %d)", h == 0 ? "FEB list: " : ", ", tb->FEB[h], tb->FEB[h] ? tb->FEB[h]->b_blocknr : 0,
tb->FEB[h] ? tb->FEB[h]->b_count : 0);
printf ("\n");
printf ("********************** END OF PRINT_TB *******************\n\n");
}
@@ -812,13 +819,13 @@ static void print_bmap_block (FILE * fp, int i, unsigned long block, char * map,
blocks = blocksize * 8;
if (test_bit (0, map)) {
if (misc_test_bit (0, map)) {
/* first block addressed by this bitmap block is used */
ones ++;
if (!silent)
reiserfs_warning (fp, "Busy (%d-", i * bits);
for (j = 1; j < blocks; j ++) {
while (test_bit (j, map)) {
while (misc_test_bit (j, map)) {
ones ++;
if (j == blocks - 1) {
if (!silent)
@@ -830,7 +837,7 @@ static void print_bmap_block (FILE * fp, int i, unsigned long block, char * map,
if (!silent)
reiserfs_warning (fp, "%d) Free(%d-", j - 1 + i * bits, j + i * bits);
while (!test_bit (j, map)) {
while (!misc_test_bit (j, map)) {
zeros ++;
if (j == blocks - 1) {
if (!silent)
@@ -844,6 +851,7 @@ static void print_bmap_block (FILE * fp, int i, unsigned long block, char * map,
j --;
end:
/* to make gcc 3.2 do not sware here */;
}
} else {
/* first block addressed by this bitmap is free */
@@ -852,7 +860,7 @@ static void print_bmap_block (FILE * fp, int i, unsigned long block, char * map,
reiserfs_warning (fp, "Free (%d-", i * bits);
for (j = 1; j < blocks; j ++) {
k = 0;
while (!test_bit (j, map)) {
while (!misc_test_bit (j, map)) {
k ++;
if (j == blocks - 1) {
if (!silent)
@@ -867,7 +875,7 @@ static void print_bmap_block (FILE * fp, int i, unsigned long block, char * map,
reiserfs_warning (fp, "%d) Busy(%d-", j - 1 + i * bits, j + i * bits);
k = 0;
while (test_bit (j, map)) {
while (misc_test_bit (j, map)) {
ones ++;
if (j == blocks - 1) {
if (!silent)
@@ -883,6 +891,7 @@ static void print_bmap_block (FILE * fp, int i, unsigned long block, char * map,
j --;
end2:
/* to make gcc 3.2 do not sware here */;
}
}
@@ -952,13 +961,14 @@ void print_objectid_map (FILE * fp, reiserfs_filsys_t * fs)
(char *)omap - (char *)sb);
for (i = 0; i < get_sb_oid_cursize (sb); i ++) {
if (i % 2 == 0)
reiserfs_warning (fp, "busy(%u-%u) ", le32_to_cpu (omap[i]),
le32_to_cpu (omap[i+1]) - 1);
else
reiserfs_warning (fp, "free(%u-%u) ",
le32_to_cpu (omap[i]),
((i+1) == get_sb_oid_cursize (sb)) ? -1 : (le32_to_cpu (omap[i+1]) - 1));
if (i % 2 == 0) {
reiserfs_warning(fp, "busy(%u-%u) ", le32_to_cpu (omap[i]),
le32_to_cpu (omap[i+1]) - 1);
} else {
reiserfs_warning(fp, "free(%u-%u) ", le32_to_cpu (omap[i]),
((i+1) == get_sb_oid_cursize (sb)) ?
~0ul : (le32_to_cpu (omap[i+1]) - 1));
}
}
reiserfs_warning (fp, "\nObject id array has size %d (max %d):",
@@ -990,7 +1000,8 @@ void print_journal_header (reiserfs_filsys_t * fs)
static void print_trans_element (reiserfs_filsys_t * fs, reiserfs_trans_t * trans,
int index, unsigned long in_journal, unsigned long in_place)
unsigned int index, unsigned long in_journal,
unsigned long in_place)
{
if (index % 8 == 0)
reiserfs_warning (stdout, "#%d\t", index);
+78 -44
View File
@@ -1,5 +1,6 @@
/*
* Copyright 2000-2002 by Hans Reiser, licensing governed by reiserfs/README
* Copyright 2000-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "includes.h"
@@ -26,13 +27,13 @@ static void make_const_keys (void)
/* reiserfs needs at least: enough blocks for journal, 64 k at the beginning,
one block for super block, bitmap block and root block. Note that first
bitmap block must point to all of them */
int is_block_count_correct (unsigned long block_of_super_block, int block_size,
unsigned long block_count, unsigned long journal_size)
int is_block_count_correct (unsigned long journal_offset, unsigned int block_size,
unsigned long block_count, unsigned long journal_size)
{
unsigned long blocks;
/* RESERVED, MD RAID SBs, super block, bitmap, root, journal size w/ journal header */
blocks = block_of_super_block + 1 + 1 + 1 + journal_size;
/* RESERVED, MD RAID SBs, super block, bitmap, root, journal size with journal header */
blocks = journal_offset + journal_size;
/* we have a limit: skipped area, super block, journal and root block
all have to be addressed by one first bitmap */
@@ -46,15 +47,15 @@ int is_block_count_correct (unsigned long block_of_super_block, int block_size,
}
/* read super block. fixme: only 4k blocks, pre-journaled format
is refused. Journal and bitmap are to be opened separately */
reiserfs_filsys_t * reiserfs_open (char * filename, int flags, int *error, void * vp)
is refused. Journal and bitmap are to be opened separately.
skip_check is set to 1 if checks of openned SB should be omitted.*/
reiserfs_filsys_t * reiserfs_open (char * filename, int flags, int *error, void * vp, int check)
{
reiserfs_filsys_t * fs;
struct buffer_head * bh;
struct reiserfs_super_block * sb;
int fd, i;
/* convert root dir key and parent root dir key to little endian format */
make_const_keys ();
@@ -80,7 +81,7 @@ reiserfs_filsys_t * reiserfs_open (char * filename, int flags, int *error, void
} else {
sb = (struct reiserfs_super_block *)bh->b_data;
if (does_look_like_super_block (sb))
if (is_any_reiserfs_magic_string(sb))
goto found;
/* reiserfs signature is not found at the i-th 4k block */
@@ -88,9 +89,9 @@ reiserfs_filsys_t * reiserfs_open (char * filename, int flags, int *error, void
}
}
reiserfs_warning (stderr, "reiserfs_open: neither new nor old reiserfs format "
"found on %s\n", filename);
reiserfs_warning(stderr,
"\nreiserfs_open: the reiserfs superblock cannot be found on %s.\n", filename);
if (error)
*error = 0;
freemem (fs);
@@ -99,6 +100,35 @@ reiserfs_filsys_t * reiserfs_open (char * filename, int flags, int *error, void
return fs;
found:
if (check) {
/* A few checks of found super block. */
struct buffer_head *tmp_bh;
if (!is_blocksize_correct(get_sb_block_size(sb))) {
reiserfs_warning(stderr, "reiserfs_open: a superblock with wrong parameters "
"was found in the block (%d).\n", i);
freemem (fs);
close (fd);
brelse(bh);
return NULL;
}
tmp_bh = bread (fd, get_sb_block_count(sb) - 1, get_sb_block_size(sb));
if (!tmp_bh) {
reiserfs_warning (stderr, "\n%s: Your partition is not big enough to contain the \n"
"filesystem of (%lu) blocks as was specified in the found super block.\n",
__FUNCTION__, get_sb_block_count(sb) - 1);
freemem (fs);
close (fd);
brelse(bh);
return NULL;
}
brelse(tmp_bh);
}
fs->fs_blocksize = get_sb_block_size (sb);
@@ -137,7 +167,10 @@ reiserfs_filsys_t * reiserfs_open (char * filename, int flags, int *error, void
constant for given size and version of a filesystem */
reiserfs_filsys_t * reiserfs_create (char * filename,
int version,
unsigned long block_count, int block_size, int default_journal, int new_format)
unsigned long block_count,
int block_size,
int default_journal,
int new_format)
{
reiserfs_filsys_t * fs;
@@ -151,11 +184,11 @@ reiserfs_filsys_t * reiserfs_create (char * filename,
return 0;
}
if (!is_block_count_correct (REISERFS_DISK_OFFSET_IN_BYTES / block_size, block_size, block_count, 0)) {
// if (block_count < min_block_amount (block_size, 0)) {
reiserfs_warning (stderr, "reiserfs_create: "
"can not create that small (%d blocks) filesystem\n",
block_count);
if (!is_block_count_correct (REISERFS_DISK_OFFSET_IN_BYTES / block_size,
block_size, block_count, 0))
{
reiserfs_warning (stderr, "reiserfs_create: can not create that small "
"(%d blocks) filesystem\n", block_count);
return 0;
}
@@ -167,8 +200,8 @@ reiserfs_filsys_t * reiserfs_create (char * filename,
fs->fs_dev = open (filename, O_RDWR | O_LARGEFILE);
if (fs->fs_dev == -1) {
reiserfs_warning (stderr, "reiserfs_create: could not open %s: %m\n",
filename);
reiserfs_warning (stderr, "reiserfs_create: could not open %s: %s\n",
filename, strerror(errno));
freemem (fs);
return 0;
}
@@ -178,9 +211,11 @@ reiserfs_filsys_t * reiserfs_create (char * filename,
fs->fs_format = version;
if (new_format)
fs->fs_super_bh = getblk (fs->fs_dev, REISERFS_DISK_OFFSET_IN_BYTES / block_size, block_size);
fs->fs_super_bh = getblk (fs->fs_dev,
REISERFS_DISK_OFFSET_IN_BYTES / block_size, block_size);
else
fs->fs_super_bh = getblk (fs->fs_dev, REISERFS_OLD_DISK_OFFSET_IN_BYTES / block_size, block_size);
fs->fs_super_bh = getblk (fs->fs_dev,
REISERFS_OLD_DISK_OFFSET_IN_BYTES / block_size, block_size);
if (!fs->fs_super_bh) {
reiserfs_warning (stderr, "reiserfs_create: getblk failed\n");
@@ -207,7 +242,8 @@ reiserfs_filsys_t * reiserfs_create (char * filename,
set_sb_block_size (fs->fs_ondisk_sb, block_size);
switch (version) {
case REISERFS_FORMAT_3_5:
set_sb_oid_maxsize (fs->fs_ondisk_sb, (block_size - SB_SIZE_V1) / sizeof(__u32) / 2 * 2);
set_sb_oid_maxsize (fs->fs_ondisk_sb,
(block_size - SB_SIZE_V1) / sizeof(__u32) / 2 * 2);
/* sb_oid_cursize */
/* sb_state */
memcpy (fs->fs_ondisk_sb->s_v1.s_magic, REISERFS_3_5_SUPER_MAGIC_STRING,
@@ -215,7 +251,8 @@ reiserfs_filsys_t * reiserfs_create (char * filename,
break;
case REISERFS_FORMAT_3_6:
set_sb_oid_maxsize (fs->fs_ondisk_sb, (block_size - SB_SIZE) / sizeof(__u32) / 2 * 2);
set_sb_oid_maxsize (fs->fs_ondisk_sb,
(block_size - SB_SIZE) / sizeof(__u32) / 2 * 2);
/* sb_oid_cursize */
/* sb_state */
memcpy (fs->fs_ondisk_sb->s_v1.s_magic, REISERFS_3_6_SUPER_MAGIC_STRING,
@@ -262,24 +299,15 @@ int spread_bitmaps (reiserfs_filsys_t * fs)
/* 0 means: do not guarantee that fs is consistent */
int reiserfs_is_fs_consistent (reiserfs_filsys_t * fs)
{
if (get_sb_umount_state (fs->fs_ondisk_sb) == REISERFS_CLEANLY_UMOUNTED &&
get_sb_fs_state (fs->fs_ondisk_sb) == REISERFS_CONSISTENT)
if (get_sb_umount_state (fs->fs_ondisk_sb) == FS_CLEANLY_UMOUNTED &&
get_sb_fs_state (fs->fs_ondisk_sb) == FS_CONSISTENT)
return 1;
return 0;
}
void reiserfs_reopen (reiserfs_filsys_t * fs, int flag)
{
reiserfs_only_reopen (fs, flag);
reiserfs_reopen_journal (fs, flag);
}
/* flush bitmap, brelse super block, flush all dirty buffers, close and open
again the device, read super block */
void reiserfs_only_reopen (reiserfs_filsys_t * fs, int flag)
static void reiserfs_only_reopen (reiserfs_filsys_t * fs, int flag)
{
unsigned long super_block;
@@ -291,11 +319,11 @@ void reiserfs_only_reopen (reiserfs_filsys_t * fs, int flag)
invalidate_buffers (fs->fs_dev);
if (close (fs->fs_dev))
die ("reiserfs_reopen: closed failed: %m");
die ("reiserfs_reopen: closed failed: %s", strerror(errno));
fs->fs_dev = open (fs->fs_file_name, flag | O_LARGEFILE);
if (fs->fs_dev == -1)
die ("reiserfs_reopen: could not reopen device: %m");
die ("reiserfs_reopen: could not reopen device: %s", strerror(errno));
fs->fs_super_bh = bread (fs->fs_dev, super_block, fs->fs_blocksize);
if (!fs->fs_super_bh)
@@ -309,6 +337,11 @@ void reiserfs_only_reopen (reiserfs_filsys_t * fs, int flag)
fs->fs_dirt = 0;
}
void reiserfs_reopen (reiserfs_filsys_t * fs, int flag)
{
reiserfs_only_reopen (fs, flag);
reiserfs_reopen_journal (fs, flag);
}
int is_opened_rw (reiserfs_filsys_t * fs)
{
@@ -858,7 +891,7 @@ int reiserfs_locate_entry (reiserfs_filsys_t * fs, struct key * dir, char * name
}
/* the name in directory has the same hash as the given name */
if ((name_in_entry_length (ih, deh, i) == strlen (name)) &&
if ((name_in_entry_length (ih, deh, i) == (int)strlen (name)) &&
!memcmp (name_in_entry (deh, i), name, strlen (name))) {
path->pos_in_item = i;
return 1;
@@ -900,7 +933,7 @@ int reiserfs_locate_entry (reiserfs_filsys_t * fs, struct key * dir, char * name
generation counter in 'min_gen_counter'. dies if found object is not a
directory. */
int reiserfs_find_entry (reiserfs_filsys_t * fs, struct key * dir, char * name,
int * min_gen_counter, struct key * key)
unsigned int * min_gen_counter, struct key * key)
{
struct key entry_key;
int retval;
@@ -938,7 +971,7 @@ int reiserfs_find_entry (reiserfs_filsys_t * fs, struct key * dir, char * name,
if (GET_GENERATION_NUMBER (get_deh_offset (deh)) == *min_gen_counter)
(*min_gen_counter) ++;
if ((name_in_entry_length (ih, deh, i) == strlen (name)) &&
if ((name_in_entry_length (ih, deh, i) == (int)strlen (name)) &&
(!memcmp (name_in_entry (deh, i), name, strlen (name)))) {
/* entry found in the directory */
if (key) {
@@ -1009,13 +1042,13 @@ char * make_entry (char * entry, char * name, struct key * key, __u32 offset)
/* add new name into a directory. If it exists in a directory - do
nothing */
int reiserfs_add_entry (reiserfs_filsys_t * fs, struct key * dir, char * name, int name_len,
struct key * key, int fsck_need)
struct key * key, __u16 fsck_need)
{
struct item_head entry_ih = {{0,}, };
char * entry;
int retval;
INITIALIZE_PATH(path);
int gen_counter;
unsigned int gen_counter;
int item_len;
__u32 hash;
@@ -1217,7 +1250,8 @@ int create_badblock_bitmap (reiserfs_filsys_t * fs, char * badblocks_file) {
if (blocknr < get_sb_block_count (fs->fs_ondisk_sb) && !not_data_block (fs, blocknr)) {
reiserfs_bitmap_set_bit (fs->fs_badblocks_bm, blocknr);
} else {
fprintf (stderr, "%s: bad block number %u in badblocks file\n", __FUNCTION__, blocknr);
fprintf (stderr, "%s: block number %u belongs to internal reiserfs structures.\n",
__FUNCTION__, blocknr);
}
}
+2 -1
View File
@@ -1,5 +1,6 @@
/*
* Copyright 1996-2002 Hans Reiser, see reiserfs/README for licensing and copyright details
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
/*
+4 -3
View File
@@ -1,10 +1,10 @@
%define reiserfsprogsversion 3.6.4
%define reiserfsprogsversion 3.6.9
Vendor: Hans Reiser
Distribution: Hans Reiser
Name: reiserfsprogs
Release: 1
Copyright: 2002 Hans Reiser
Copyright: 2003 Hans Reiser
Group: Unsorted
Packager: anthon@mnt.org
@@ -22,7 +22,7 @@ checking and correcting any inconsistencies (reiserfsck) and resizing
Authors:
--------
Hans Reiser <reiser@namesys.com>
Vitaly Fertman <vetalf@inbox.ru>
Vitaly Fertman <vitaly@namesys.com>
Alexander Zarochentcev <zam@namesys.com>
Vladimir Saveliev <monstr@namesys.com>
@@ -81,4 +81,5 @@ fi
%clean
%{__rm} -rf $RPM_BUILD_ROOT
%files -f %{buildroot}/rpm-filelist
%defattr(-,root,root)
%doc README
+300 -191
View File
@@ -1,6 +1,8 @@
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -10,60 +12,98 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
sbin_PROGRAMS = resize_reiserfs
resize_reiserfs_SOURCES = fe.c resize_reiserfs.c do_shrink.c resize.h
@@ -71,102 +111,117 @@ man_MANS = resize_reiserfs.8
EXTRA_DIST = $(man_MANS)
LDADD = $(top_srcdir)/lib/libmisc.a $(top_srcdir)/reiserfscore/libcore.a
subdir = resize_reiserfs
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../include/config.h
CONFIG_CLEAN_FILES =
PROGRAMS = $(sbin_PROGRAMS)
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
sbin_PROGRAMS = resize_reiserfs$(EXEEXT)
PROGRAMS = $(sbin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir) -I../include
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
resize_reiserfs_OBJECTS = fe.o resize_reiserfs.o do_shrink.o
am_resize_reiserfs_OBJECTS = fe.$(OBJEXT) resize_reiserfs.$(OBJEXT) \
do_shrink.$(OBJEXT)
resize_reiserfs_OBJECTS = $(am_resize_reiserfs_OBJECTS)
resize_reiserfs_LDADD = $(LDADD)
resize_reiserfs_DEPENDENCIES = $(top_srcdir)/lib/libmisc.a \
$(top_srcdir)/reiserfscore/libcore.a
resize_reiserfs_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
resize_reiserfs_DEPENDENCIES = $(top_srcdir)/lib/libmisc.a \
$(top_srcdir)/reiserfscore/libcore.a
resize_reiserfs_LDFLAGS =
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/do_shrink.Po ./$(DEPDIR)/fe.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/resize_reiserfs.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
man8dir = $(mandir)/man8
MANS = $(man_MANS)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(resize_reiserfs_SOURCES)
NROFF = nroff
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
MANS = $(man_MANS)
DIST_COMMON = Makefile.am Makefile.in
SOURCES = $(resize_reiserfs_SOURCES)
OBJECTS = $(resize_reiserfs_OBJECTS)
all: all-redirect
all: all-am
.SUFFIXES:
.SUFFIXES: .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps resize_reiserfs/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-sbinPROGRAMS:
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
distclean-sbinPROGRAMS:
maintainer-clean-sbinPROGRAMS:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu resize_reiserfs/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
install-sbinPROGRAMS: $(sbin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(sbindir)
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f"; \
$(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f || exit 1; \
else :; fi; \
done
uninstall-sbinPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(sbin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f $(DESTDIR)$(sbindir)/$$f"; \
rm -f $(DESTDIR)$(sbindir)/$$f; \
done
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
resize_reiserfs$(EXEEXT): $(resize_reiserfs_OBJECTS) $(resize_reiserfs_DEPENDENCIES)
@rm -f resize_reiserfs$(EXEEXT)
$(LINK) $(resize_reiserfs_LDFLAGS) $(resize_reiserfs_OBJECTS) $(resize_reiserfs_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
-rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/do_shrink.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fe.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resize_reiserfs.Po@am__quote@
resize_reiserfs: $(resize_reiserfs_OBJECTS) $(resize_reiserfs_DEPENDENCIES)
@rm -f resize_reiserfs
$(LINK) $(resize_reiserfs_LDFLAGS) $(resize_reiserfs_OBJECTS) $(resize_reiserfs_LDADD) $(LIBS)
distclean-depend:
-rm -rf ./$(DEPDIR)
install-man8:
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am:
man8dir = $(mandir)/man8
install-man8: $(man8_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(man8dir)
@list='$(man8_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.8*) list="$$list $$i" ;; \
esac; \
@@ -175,158 +230,212 @@ install-man8:
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
8*) ;; \
*) ext='8' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \
done
uninstall-man8:
@list='$(man8_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
@$(NORMAL_UNINSTALL)
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.8*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
8*) ;; \
*) ext='8' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \
rm -f $(DESTDIR)$(man8dir)/$$inst; \
done
install-man: $(MANS)
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-man8
uninstall-man:
@$(NORMAL_UNINSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-man8
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
mkid -fID $$unique
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
mostlyclean-tags:
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
clean-tags:
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = resize_reiserfs
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
do_shrink.o: do_shrink.c resize.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h ../include/config.h ../version.h
fe.o: fe.c resize.h ../include/io.h ../include/misc.h ../include/swab.h \
../include/reiserfs_lib.h ../include/reiserfs_fs.h \
../include/config.h ../version.h
resize_reiserfs.o: resize_reiserfs.c resize.h ../include/io.h \
../include/misc.h ../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h ../include/config.h ../version.h
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-sbinPROGRAMS
install-exec: install-exec-am
all-am: Makefile $(PROGRAMS) $(MANS)
install-data-am: install-man
installdirs:
$(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-sbinPROGRAMS uninstall-man
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS) $(MANS)
all-redirect: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-sbinPROGRAMS mostlyclean-compile \
mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-sbinPROGRAMS clean-compile clean-tags clean-generic \
mostlyclean-am
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
distclean-am: distclean-sbinPROGRAMS distclean-compile distclean-tags \
distclean-generic clean-am
clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-sbinPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am: install-man
install-exec-am: install-sbinPROGRAMS
install-info: install-info-am
install-man: install-man8
installcheck-am:
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS \
clean-sbinPROGRAMS maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \
install-sbinPROGRAMS mostlyclean-compile distclean-compile \
clean-compile maintainer-clean-compile install-man8 uninstall-man8 \
install-man uninstall-man tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
check-am installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-man uninstall-sbinPROGRAMS
uninstall-man: uninstall-man8
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-sbinPROGRAMS ctags distclean distclean-compile \
distclean-depend distclean-generic distclean-tags distdir dvi \
dvi-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-man8 install-sbinPROGRAMS \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am uninstall-man \
uninstall-man8 uninstall-sbinPROGRAMS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
+26 -17
View File
@@ -1,10 +1,11 @@
/*
* Copyright 2000-2002 by Hans Reiser, licensing governed by reiserfs/README
* Copyright 2000-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "resize.h"
#include <time.h>
static unsigned long int_node_cnt = 0, int_moved_cnt = 0;
static unsigned long leaf_node_cnt = 0, leaf_moved_cnt = 0;
static unsigned long unfm_node_cnt = 0, unfm_moved_cnt = 0;
@@ -55,6 +56,9 @@ static unsigned long move_generic_block(reiserfs_filsys_t * fs, unsigned long bl
/* move wrong block */
bh = bread(fs->fs_dev, block, fs->fs_blocksize);
if (!bh)
reiserfs_panic ("move_generic_block: bread failed.\n");
reiserfs_bitmap_find_zero_bit(bmp, &unused_block);
if (unused_block == 0 || unused_block >= bnd) {
fputs ("resize_reiserfs: can\'t find free block\n", stderr);
@@ -95,7 +99,7 @@ static unsigned long move_formatted_block(reiserfs_filsys_t * fs, unsigned long
struct item_head *ih;
unsigned long new_blocknr = 0;
int node_is_internal = 0;
int i, j;
unsigned int i, j;
bh = bread(fs->fs_dev, block, fs->fs_blocksize);
if (!bh)
@@ -105,7 +109,7 @@ static unsigned long move_formatted_block(reiserfs_filsys_t * fs, unsigned long
leaf_node_cnt++;
for (i=0; i < B_NR_ITEMS(bh); i++) {
for (i = 0; i < B_NR_ITEMS(bh); i++) {
ih = B_N_PITEM_HEAD(bh, i);
if (is_indirect_ih(ih)) {
__u32 * indirect;
@@ -172,11 +176,11 @@ int shrink_fs(reiserfs_filsys_t * fs, unsigned long blocks)
int c;
printf(
"You are running BETA version of reiserfs shrinker.\n"
"This version is only for testing or VERY CAREFUL use.\n"
"Backup of you data is recommended.\n\n"
"Do you want to continue? [y/N]:"
);
"You are running BETA version of reiserfs shrinker.\n"
"This version is only for testing or VERY CAREFUL use.\n"
"Backup of you data is recommended.\n\n"
"Do you want to continue? [y/N]:"
);
fflush(stdout);
c = getchar();
if (c != 'y' && c != 'Y')
@@ -186,18 +190,22 @@ int shrink_fs(reiserfs_filsys_t * fs, unsigned long blocks)
bmap_nr_new = (blocks - 1) / (8 * fs->fs_blocksize) + 1;
/* is shrinking possible ? */
if (get_sb_block_count(ondisk_sb) - blocks > get_sb_free_blocks(ondisk_sb) + get_sb_bmap_nr(ondisk_sb) - bmap_nr_new) {
fprintf(stderr, "resize_reiserfs: can\'t shrink fs; too many blocks already allocated\n");
if (get_sb_block_count(ondisk_sb) - blocks >
get_sb_free_blocks(ondisk_sb) + get_sb_bmap_nr(ondisk_sb) -
bmap_nr_new)
{
fprintf(stderr, "resize_reiserfs: can\'t shrink fs; too many "
"blocks already allocated\n");
return -1;
}
reiserfs_reopen(fs, O_RDWR);
if (!reiserfs_open_ondisk_bitmap (fs))
if (reiserfs_open_ondisk_bitmap (fs))
DIE("cannot open ondisk bitmap");
bmp = fs->fs_bitmap2;
ondisk_sb = fs->fs_ondisk_sb;
set_sb_fs_state (fs->fs_ondisk_sb, REISERFS_CORRUPTED);
set_sb_fs_state (fs->fs_ondisk_sb, FS_ERROR);
mark_buffer_uptodate(fs->fs_super_bh, 1);
mark_buffer_dirty(fs->fs_super_bh);
bwrite(fs->fs_super_bh);
@@ -218,10 +226,11 @@ int shrink_fs(reiserfs_filsys_t * fs, unsigned long blocks)
fflush(stdout);
}
n_root_block = move_formatted_block(fs, get_sb_root_block(ondisk_sb), blocks, 0);
if (n_root_block) {
set_sb_root_block (ondisk_sb, n_root_block);
}
n_root_block = move_formatted_block(fs, get_sb_root_block(ondisk_sb),
blocks, 0);
if (n_root_block)
set_sb_root_block (ondisk_sb, n_root_block);
if (opt_verbose)
printf ("\n\nnodes processed (moved):\n"
+2 -2
View File
@@ -1,10 +1,10 @@
/*
* Copyright 2000-2002 by Hans Reiser, licensing governed by reiserfs/README
* Copyright 2000-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "resize.h"
/* the front-end for kernel on-line resizer */
int resize_fs_online(char * devname, unsigned long blocks)
{
+3 -1
View File
@@ -1,6 +1,8 @@
/*
* Copyright 2000-2002 by Hans Reiser, licensing governed by reiserfs/README
* Copyright 2000-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#define _GNU_SOURCE
#include <sys/types.h>
+2 -2
View File
@@ -1,7 +1,7 @@
.\" -*- nroff -*-
.\" Copyright 1996-2002 Hans Reiser.
.\" Copyright 1996-2003 Hans Reiser.
.\"
.TH RESIZE_REISERFS 8 "January 2002" "Reiserfsprogs-3.6.4"
.TH RESIZE_REISERFS 8 "April 2003" "Reiserfsprogs-3.6.9"
.SH NAME
resize_reiserfs \- Reiserfs filesystem resizer
.SH SYNOPSIS
+50 -23
View File
@@ -1,7 +1,8 @@
/*
* Copyright 2000-2002 by Hans Reiser, licensing governed by reiserfs/README
* Copyright 2000-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
/*
* Written by Alexander Zarochentcev.
*
@@ -83,17 +84,17 @@ static int bwrite_cond (struct buffer_head * bh)
/* the first one of the most important functions */
static int expand_fs (reiserfs_filsys_t * fs, unsigned long block_count_new) {
unsigned int bmap_nr_new, bmap_nr_old;
int i;
struct reiserfs_super_block * sb;
unsigned int i;
reiserfs_reopen(fs, O_RDWR);
if (!reiserfs_open_ondisk_bitmap (fs))
if (reiserfs_open_ondisk_bitmap (fs))
DIE("cannot open ondisk bitmap");
sb = fs->fs_ondisk_sb;
set_sb_fs_state (fs->fs_ondisk_sb, REISERFS_CORRUPTED);
set_sb_fs_state (fs->fs_ondisk_sb, FS_ERROR);
bwrite_cond(fs->fs_super_bh);
@@ -187,12 +188,18 @@ int main(int argc, char *argv[]) {
print_usage_and_exit();
devname = argv[optind];
fs = reiserfs_open(devname, O_RDONLY, &error, 0);
fs = reiserfs_open(devname, O_RDONLY, &error, 0, 1);
if (!fs)
DIE ("cannot open '%s': %s", devname, strerror(error));
if (!reiserfs_open_journal (fs, jdevice_name, O_RDONLY)) {
if (reiserfs_open_journal (fs, jdevice_name, O_RDWR | O_LARGEFILE))
DIE ("Failed to open the journal device (%s).", jdevice_name);
if (reiserfs_journal_params_check(fs)) {
if (!opt_skipj)
DIE ("can not open journal of '%s'", devname);
DIE ("Wrong journal parameters detected on (%s)", jdevice_name);
else
reiserfs_close_journal(fs);
}
/* forced to continue without journal available/specified */
@@ -205,61 +212,78 @@ int main(int argc, char *argv[]) {
}
sb = fs->fs_ondisk_sb;
if(bytes_count_str) { /* new fs size is specified by user */
block_count_new = calc_new_fs_size(get_sb_block_count(sb), fs->fs_blocksize, bytes_count_str);
block_count_new = calc_new_fs_size(get_sb_block_count(sb),
fs->fs_blocksize, bytes_count_str);
} else { /* use whole device */
block_count_new = count_blocks(devname, fs->fs_blocksize);
}
if (is_mounted (devname)) {
reiserfs_close(fs);
return resize_fs_online(devname, block_count_new);
if ((error = resize_fs_online(devname, block_count_new)))
reiserfs_warning(stderr, "\n\nresize_reiserfs: On-line resizing "
"failed.\n\n ");
else
reiserfs_warning(stderr, "\n\nresize_reiserfs: On-line resizing "
"finished successfully.\n\n ");
return error;
}
if (!reiserfs_is_fs_consistent (fs)) {
reiserfs_warning (stderr, "\n\nresize_reiserfs: run reiserfsck --check first\n\n");
reiserfs_warning (stderr, "\n\nresize_reiserfs: run reiserfsck --check "
"first\n\n");
reiserfs_close (fs);
return 1;
}
if (get_sb_umount_state(sb) != REISERFS_CLEANLY_UMOUNTED)
if (get_sb_umount_state(sb) != FS_CLEANLY_UMOUNTED)
/* fixme: shouldn't we check for something like: fsck guarantees: fs is ok */
DIE ("the file system isn't in valid state.");
if (block_count_new >= get_sb_block_count(sb)) {
if (block_count_new == get_sb_block_count(sb)) {
reiserfs_warning (stderr, "%s already is of the needed size. Nothing to be done\n\n", devname);
reiserfs_warning (stderr, "%s already is of the needed size. "
"Nothing to be done\n\n", devname);
exit (1);
}
if(!valid_offset(fs->fs_dev, (loff_t) block_count_new * fs->fs_blocksize - 1)) {
reiserfs_warning (stderr, "%s is of %lu blocks size only with reiserfs of %d blocks\nsize on it. "\
"You are trying to expant reiserfs up to %lu blocks size.\nYou probably forgot to expand your "\
"partition size.\n\n", devname, count_blocks (devname, fs->fs_blocksize),
if(!valid_offset(fs->fs_dev,
(loff_t)block_count_new * fs->fs_blocksize - 1))
{
reiserfs_warning (stderr, "%s is of %lu blocks size only with "
"reiserfs of %d blocks\nsize on it. You are trying to expand "
"reiserfs up to %lu blocks size.\nYou probably forgot to "
"expand your partition size.\n\n", devname,
count_blocks(devname, fs->fs_blocksize),
get_sb_block_count(sb), block_count_new);
exit (1);
}
}
sb_old = 0; /* Needed to keep idiot compiler from issuing false warning */
/* Needed to keep idiot compiler from issuing false warning */
sb_old = 0;
/* save SB for reporting */
if(opt_verbose) {
sb_old = getmem(SB_SIZE);
memcpy(sb_old, fs->fs_ondisk_sb, SB_SIZE);
}
error = (block_count_new > get_sb_block_count(fs->fs_ondisk_sb)) ? expand_fs(fs, block_count_new) : shrink_fs(fs, block_count_new);
if (error)
error = (block_count_new > get_sb_block_count(fs->fs_ondisk_sb)) ?
expand_fs(fs, block_count_new) : shrink_fs(fs, block_count_new);
if (error) {
reiserfs_warning(stderr, "\n\nresize_reiserfs: Resizing failed.\n\n ");
return error;
}
if(opt_verbose) {
sb_report(fs->fs_ondisk_sb, sb_old);
freemem(sb_old);
}
set_sb_fs_state (fs->fs_ondisk_sb, REISERFS_CONSISTENT);
set_sb_fs_state (fs->fs_ondisk_sb, FS_CONSISTENT);
bwrite_cond(fs->fs_super_bh);
if (opt_verbose) {
@@ -270,5 +294,8 @@ int main(int argc, char *argv[]) {
if (opt_verbose)
printf("done\n");
reiserfs_warning(stderr, "\n\nresize_reiserfs: Resizing finished "
"successfully.\n\n ");
return 0;
}
+4
View File
@@ -0,0 +1,4 @@
SUBDIRS = PROGS
sbin_PROGRAMS =
+418
View File
@@ -0,0 +1,418 @@
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
SUBDIRS = PROGS
sbin_PROGRAMS =
subdir = tests
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
sbin_PROGRAMS =
PROGRAMS = $(sbin_PROGRAMS)
DIST_SOURCES =
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
ps-recursive install-info-recursive uninstall-info-recursive \
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive
DIST_COMMON = Makefile.am Makefile.in
DIST_SUBDIRS = $(SUBDIRS)
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu tests/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
install-sbinPROGRAMS: $(sbin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(sbindir)
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f"; \
$(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f || exit 1; \
else :; fi; \
done
uninstall-sbinPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f $(DESTDIR)$(sbindir)/$$f"; \
rm -f $(DESTDIR)$(sbindir)/$$f; \
done
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" \
distdir=../$(distdir)/$$subdir \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile $(PROGRAMS)
installdirs: installdirs-recursive
installdirs-am:
$(mkinstalldirs) $(DESTDIR)$(sbindir)
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am
distclean: distclean-recursive
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
info: info-recursive
info-am:
install-data-am:
install-exec-am: install-sbinPROGRAMS
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am uninstall-sbinPROGRAMS
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
clean-generic clean-recursive clean-sbinPROGRAMS ctags \
ctags-recursive distclean distclean-generic distclean-recursive \
distclean-tags distdir dvi dvi-am dvi-recursive info info-am \
info-recursive install install-am install-data install-data-am \
install-data-recursive install-exec install-exec-am \
install-exec-recursive install-info install-info-am \
install-info-recursive install-man install-recursive \
install-sbinPROGRAMS install-strip installcheck installcheck-am \
installdirs installdirs-am installdirs-recursive \
maintainer-clean maintainer-clean-generic \
maintainer-clean-recursive mostlyclean mostlyclean-generic \
mostlyclean-recursive pdf pdf-am pdf-recursive ps ps-am \
ps-recursive tags tags-recursive uninstall uninstall-am \
uninstall-info-am uninstall-info-recursive uninstall-recursive \
uninstall-sbinPROGRAMS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
+5
View File
@@ -0,0 +1,5 @@
sbin_PROGRAMS = reiserfs_corrupter
SOURCES = corrupter.c
LDADD = $(top_srcdir)/lib/libmisc.a $(top_srcdir)/reiserfscore/libcore.a
+382
View File
@@ -0,0 +1,382 @@
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
sbin_PROGRAMS = reiserfs_corrupter
SOURCES = corrupter.c
LDADD = $(top_srcdir)/lib/libmisc.a $(top_srcdir)/reiserfscore/libcore.a
subdir = tests/PROGS
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
sbin_PROGRAMS = reiserfs_corrupter$(EXEEXT)
PROGRAMS = $(sbin_PROGRAMS)
reiserfs_corrupter_SOURCES = reiserfs_corrupter.c
reiserfs_corrupter_OBJECTS = reiserfs_corrupter.$(OBJEXT)
reiserfs_corrupter_LDADD = $(LDADD)
reiserfs_corrupter_DEPENDENCIES = $(top_srcdir)/lib/libmisc.a \
$(top_srcdir)/reiserfscore/libcore.a
reiserfs_corrupter_LDFLAGS =
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/reiserfs_corrupter.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = reiserfs_corrupter.c
DIST_COMMON = Makefile.am Makefile.in
SOURCES = corrupter.c
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu tests/PROGS/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
install-sbinPROGRAMS: $(sbin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(sbindir)
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f"; \
$(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f || exit 1; \
else :; fi; \
done
uninstall-sbinPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f $(DESTDIR)$(sbindir)/$$f"; \
rm -f $(DESTDIR)$(sbindir)/$$f; \
done
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
reiserfs_corrupter$(EXEEXT): $(reiserfs_corrupter_OBJECTS) $(reiserfs_corrupter_DEPENDENCIES)
@rm -f reiserfs_corrupter$(EXEEXT)
$(LINK) $(reiserfs_corrupter_LDFLAGS) $(reiserfs_corrupter_OBJECTS) $(reiserfs_corrupter_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reiserfs_corrupter.Po@am__quote@
distclean-depend:
-rm -rf ./$(DEPDIR)
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am:
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(sbindir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am
distclean: distclean-am
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am:
install-exec-am: install-sbinPROGRAMS
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-sbinPROGRAMS
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-sbinPROGRAMS ctags distclean distclean-compile \
distclean-depend distclean-generic distclean-tags distdir dvi \
dvi-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-sbinPROGRAMS install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-info-am uninstall-sbinPROGRAMS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
+198
View File
@@ -0,0 +1,198 @@
#define _GNU_SOURCE
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <asm/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/resource.h>
#include <sys/vfs.h>
#include "io.h"
#include "misc.h"
#include "reiserfs_lib.h"
enum {
USED_BLOCKS,
ALL_BLOCKS,
EXTERN_BITMAP
};
typedef struct corrupter_options {
int bitmap_kind;
char * bm_name;
reiserfs_bitmap_t * bm;
int block_size;
int offset;
} corrupter_options_t;
#define print_usage_and_exit() {\
printf ("\nUsage: %s [options] device\n"\
"Options:\n"\
" -b bitmap\t\tscan blocks marked in bitmap\n"\
" -S\t\t\tscan-whole-partition\n"\
" -s blocksize\t\tfs blocksize\n"\
" -o bitmap\t\tskip offset blocks\n\n"\
, argv[0]);\
exit (16);\
}
static char * parse_options (corrupter_options_t * options, int argc, char * argv [])
{
int c;
options->bitmap_kind = USED_BLOCKS;
options->block_size = 4096;
options->offset = 0;
options->bm_name = NULL;
options->bm = NULL;
while (1) {
int option_index;
c = getopt_long (argc, argv, "Sb:s:o:",
NULL, &option_index);
if (c == -1)
break;
switch (c) {
case 0:
/* long-only options */
break;
case 'b': /* --scan-marked-in-bitmap */
options->bitmap_kind = EXTERN_BITMAP;
options->bm_name = optarg;
break;
case 'S': /* --scan-whole-partition */
options->bitmap_kind = ALL_BLOCKS;
break;
case 'o': /* --scan-marked-in-bitmap */
options->offset = atoi (optarg);
break;
case 's': /* --scan-marked-in-bitmap */
options->block_size = atoi (optarg);
break;
default:
print_usage_and_exit();
}
}
if (optind != argc - 1)
print_usage_and_exit();
return argv[optind];
}
void load_bitmap_from_file (corrupter_options_t * options) {
FILE * fd;
fd = fopen (options->bm_name, "r");
if (!fd)
reiserfs_panic ("%s: could not load bitmap: %s\n", __FUNCTION__, strerror(errno));
options->bm = reiserfs_bitmap_load (fd);
if (!options->bm)
reiserfs_panic ("could not load fitmap from \"%s\"", options->bm_name);
fclose (fd);
}
void warn_what_will_be_done (corrupter_options_t * options, char * file_name, int bl_count) {
printf ("====================\n");
printf ("\tprogram will corrupt %s\n", file_name);
printf ("\tblock size is %d\n", options->block_size);
printf ("\toffset is %d blocks\n", options->offset);
if (options->bitmap_kind == ALL_BLOCKS) {
printf ("\tall formatted blocks, bitmap and journal blocks will be corrupted\n");
} else if (options->bitmap_kind == USED_BLOCKS) {
printf ("\tall formatted blocks, bitmap and journal blocks which are used in fs bitmap will be corrupted\n");
} else if (options->bitmap_kind == EXTERN_BITMAP) {
printf ("\tall formatted blocks, bitmap and journal blocks from bitmap %s will be corrupted\n", options->bm_name);
}
printf ("\tblocks count %d\n", bl_count);
printf ("====================\n");
}
int main (int argc, char * argv []) {
corrupter_options_t options;
char * file_name;
unsigned int block_count, i;
reiserfs_filsys_t * fs;
file_name = parse_options (&options, argc, argv);
fs = reiserfs_open (file_name, O_RDONLY, 0, &options, 1);
if (no_reiserfs_found (fs))
die ("could not open filesystem on \"%s\"", file_name);
/* keep SB to separate memory */
fs->fs_ondisk_sb = getmem(fs->fs_blocksize);
memcpy (fs->fs_ondisk_sb, fs->fs_super_bh->b_data, fs->fs_blocksize);
block_count = get_sb_block_count (fs->fs_ondisk_sb);
if (options.bm_name) {
load_bitmap_from_file (&options);
} else {
if (reiserfs_open_ondisk_bitmap (fs))
die ("could not open bitmap\n");
options.bm = reiserfs_create_bitmap (fs->fs_bitmap2->bm_bit_size);
reiserfs_bitmap_copy (options.bm, fs->fs_bitmap2);
}
if (options.bm && block_count > options.bm->bm_bit_size) {
printf ("fs is larger (%d blocks) then bitmap (%ld blocks), work with %ld blocks only\n",
block_count, options.bm->bm_bit_size, options.bm->bm_bit_size);
block_count = options.bm->bm_bit_size;
}
warn_what_will_be_done (&options, file_name, block_count);
for (i = options.offset; i < block_count; i++) {
int who;
struct buffer_head * bh;
/* read every block and corrupt all formatted blocks */
if (!reiserfs_bitmap_test_bit (options.bm, i))
continue;
bh = bread (fs->fs_dev, i, fs->fs_blocksize);
who = who_is_this (bh->b_data, bh->b_size);
/*
if (block of bitmap || block of journal || leaf || internal)
take N random bytes and write them into N random place
within the block
*/
if (who != THE_SUPER && who != THE_LEAF && who != THE_INTERNAL && who != THE_JDESC &&
!block_of_bitmap (fs, i) && !block_of_journal (fs, i))
continue;
printf ("\ncorrupt %d ", i);
}
freemem(fs->fs_ondisk_sb);
reiserfs_close (fs);
printf ("\nDone\n");
return 0;
}
+296 -185
View File
@@ -1,6 +1,8 @@
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -10,60 +12,98 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
sbin_PROGRAMS = reiserfstune
reiserfstune_SOURCES = tune.c tune.h
@@ -72,102 +112,113 @@ man_MANS = reiserfstune.8
EXTRA_DIST = $(man_MANS)
LDADD = $(top_srcdir)/lib/libmisc.a $(top_srcdir)/reiserfscore/libcore.a
subdir = tune
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../include/config.h
CONFIG_CLEAN_FILES =
PROGRAMS = $(sbin_PROGRAMS)
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
sbin_PROGRAMS = reiserfstune$(EXEEXT)
PROGRAMS = $(sbin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir) -I../include
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
reiserfstune_OBJECTS = tune.o
am_reiserfstune_OBJECTS = tune.$(OBJEXT)
reiserfstune_OBJECTS = $(am_reiserfstune_OBJECTS)
reiserfstune_LDADD = $(LDADD)
reiserfstune_DEPENDENCIES = $(top_srcdir)/lib/libmisc.a \
$(top_srcdir)/reiserfscore/libcore.a
reiserfstune_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
reiserfstune_DEPENDENCIES = $(top_srcdir)/lib/libmisc.a \
$(top_srcdir)/reiserfscore/libcore.a
reiserfstune_LDFLAGS =
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/tune.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
man8dir = $(mandir)/man8
MANS = $(man_MANS)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(reiserfstune_SOURCES)
NROFF = nroff
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
MANS = $(man_MANS)
DIST_COMMON = Makefile.am Makefile.in
SOURCES = $(reiserfstune_SOURCES)
OBJECTS = $(reiserfstune_OBJECTS)
all: all-redirect
all: all-am
.SUFFIXES:
.SUFFIXES: .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps tune/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-sbinPROGRAMS:
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
distclean-sbinPROGRAMS:
maintainer-clean-sbinPROGRAMS:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu tune/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
install-sbinPROGRAMS: $(sbin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(sbindir)
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f"; \
$(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f || exit 1; \
else :; fi; \
done
uninstall-sbinPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(sbin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f $(DESTDIR)$(sbindir)/$$f"; \
rm -f $(DESTDIR)$(sbindir)/$$f; \
done
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
reiserfstune$(EXEEXT): $(reiserfstune_OBJECTS) $(reiserfstune_DEPENDENCIES)
@rm -f reiserfstune$(EXEEXT)
$(LINK) $(reiserfstune_LDFLAGS) $(reiserfstune_OBJECTS) $(reiserfstune_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
-rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tune.Po@am__quote@
reiserfstune: $(reiserfstune_OBJECTS) $(reiserfstune_DEPENDENCIES)
@rm -f reiserfstune
$(LINK) $(reiserfstune_LDFLAGS) $(reiserfstune_OBJECTS) $(reiserfstune_LDADD) $(LIBS)
distclean-depend:
-rm -rf ./$(DEPDIR)
install-man8:
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am:
man8dir = $(mandir)/man8
install-man8: $(man8_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(man8dir)
@list='$(man8_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.8*) list="$$list $$i" ;; \
esac; \
@@ -176,152 +227,212 @@ install-man8:
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
8*) ;; \
*) ext='8' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \
done
uninstall-man8:
@list='$(man8_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
@$(NORMAL_UNINSTALL)
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.8*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
8*) ;; \
*) ext='8' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \
rm -f $(DESTDIR)$(man8dir)/$$inst; \
done
install-man: $(MANS)
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-man8
uninstall-man:
@$(NORMAL_UNINSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-man8
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
mkid -fID $$unique
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
mostlyclean-tags:
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
clean-tags:
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tune
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
tune.o: tune.c tune.h ../include/io.h ../include/misc.h \
../include/swab.h ../include/reiserfs_lib.h \
../include/reiserfs_fs.h ../include/config.h ../version.h
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-sbinPROGRAMS
install-exec: install-exec-am
all-am: Makefile $(PROGRAMS) $(MANS)
install-data-am: install-man
installdirs:
$(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-sbinPROGRAMS uninstall-man
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS) $(MANS)
all-redirect: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-sbinPROGRAMS mostlyclean-compile \
mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-sbinPROGRAMS clean-compile clean-tags clean-generic \
mostlyclean-am
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
distclean-am: distclean-sbinPROGRAMS distclean-compile distclean-tags \
distclean-generic clean-am
clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-sbinPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am: install-man
install-exec-am: install-sbinPROGRAMS
install-info: install-info-am
install-man: install-man8
installcheck-am:
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS \
clean-sbinPROGRAMS maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \
install-sbinPROGRAMS mostlyclean-compile distclean-compile \
clean-compile maintainer-clean-compile install-man8 uninstall-man8 \
install-man uninstall-man tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
check-am installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-man uninstall-sbinPROGRAMS
uninstall-man: uninstall-man8
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-sbinPROGRAMS ctags distclean distclean-compile \
distclean-depend distclean-generic distclean-tags distdir dvi \
dvi-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-man8 install-sbinPROGRAMS \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am uninstall-man \
uninstall-man8 uninstall-sbinPROGRAMS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
+3 -3
View File
@@ -1,7 +1,7 @@
.\" -*- nroff -*-
.\" Copyright 1996-2002 Hans Reiser.
.\" Copyright 1996-2003 Hans Reiser.
.\"
.TH REISERFSTUNE 8 "January 2002" "Reiserfsprogs-3.6.4"
.TH REISERFSTUNE 8 "April 2003" "Reiserfsprogs-3.6.9"
.SH NAME
reiserfstune
.SH SYNOPSIS
@@ -9,7 +9,7 @@ reiserfstune
[ \fB-f\fR ]
[ \fB-j\fR | \fB--journal-device\fR \fIFILE\fR ]
[ \fB--no-journal-available\fR ]
[ \fB--journal-new-device\fR \fIFILE\fR ]
[ \fB--journal-new-device\fR \fIFILE\fR ] [ \fB--make-journal-standard\fR ]
[ \fB-s\fR | \fB--journal-new-size\fR \fIN\fR ]
[ \fB-o\fR | \fB--journal-new-offset\fR \fIN\fR ]
[ \fB-t\fR | \fB--max-transaction-size\fR \fIN\fR ]
+183 -87
View File
@@ -1,6 +1,8 @@
/*
* Copyright 2002 Hans Reiser
* Copyright 2002-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "tune.h"
char *program_name;
@@ -47,6 +49,11 @@ static void print_usage_and_exit(void)
exit (1);
}
/*
Undocumented options:
-B badblock_file
*/
unsigned long Journal_size = 0;
int Max_trans_size = JOURNAL_TRANS_MAX;
int Offset = 0;
@@ -54,62 +61,52 @@ __u16 Options = 0;
int Force = 0;
char * LABEL;
unsigned char UUID[16];
char * badblocks_file;
static int should_make_journal_non_standard (int force)
{
message ("ATTENTION! Filesystem with standard journal found. ");
check_forcing_ask_confirmation (force);
return 1;
}
/* If specified paramenters defines the standard journal, make it standard. */
static int should_make_journal_standard (reiserfs_filsys_t * fs, char * j_new_dev_name)
{
if (!is_reiserfs_jr_magic_string (fs->fs_ondisk_sb))
return 0;
/*
if (!user_confirmed (stderr, "ATTENTION! Filesystem with non-standard journal "
"found. Continue? (y/n):", "y\n")) {
exit(1);
}
*/
/* make sure journal is on main device, it has default size
and the file system has non-standard magic */
if (j_new_dev_name) {
/* new journal was specified - check if it is available */
if (strcmp (j_new_dev_name, fs->fs_file_name)) {
message ("Can not create standard journal on separated device %s",
j_new_dev_name);
if (strcmp (j_new_dev_name, fs->fs_file_name))
return 0;
}
if (Journal_size && (Journal_size != journal_default_size (fs->fs_super_bh->b_blocknr, fs->fs_blocksize))) {
message ("Can not create standard journal of the size %lu",
Journal_size);
if (Journal_size && Journal_size !=
journal_default_size(fs->fs_super_bh->b_blocknr, fs->fs_blocksize) + 1)
return 0;
}
if (Max_trans_size && (Max_trans_size != JOURNAL_TRANS_MAX)) {
message ("Can not create standard journal with the transaction "
"max size %u", Max_trans_size);
return 0;
}
}
else {
if (Max_trans_size && (Max_trans_size != JOURNAL_TRANS_MAX))
return 0;
} else {
/* new journal was not specified - check ondisk journal params */
if (get_jp_journal_dev(sb_jp(fs->fs_ondisk_sb))) {
message ("Can not create standard journal on separated device [0x%x]",
get_jp_journal_dev(sb_jp(fs->fs_ondisk_sb)));
return 0;
}
if(get_jp_journal_size(sb_jp(fs->fs_ondisk_sb))!= journal_default_size (fs->fs_super_bh->b_blocknr, fs->fs_blocksize)){
message ("Can not create standard journal of the size %u",
get_jp_journal_size(sb_jp(fs->fs_ondisk_sb)));
if (get_sb_reserved_for_journal(fs->fs_ondisk_sb) <
journal_default_size (fs->fs_super_bh->b_blocknr, fs->fs_blocksize) + 1)
{
message ("Can not create standard journal of the size %llu",
journal_default_size(fs->fs_super_bh->b_blocknr, fs->fs_blocksize) + 1);
return 0;
}
}
return 1;
}
static int set_standard_journal_params (reiserfs_filsys_t * fs)
{
struct buffer_head * bh;
/* ondisk superblock update */
if (get_sb_version(fs->fs_ondisk_sb) == 0)
@@ -123,6 +120,11 @@ static int set_standard_journal_params (reiserfs_filsys_t * fs)
" try reiserfsck first", get_sb_version(fs->fs_ondisk_sb));
return 0;
}
set_jp_journal_1st_block (sb_jp(fs->fs_ondisk_sb), get_journal_start_must (fs));
set_jp_journal_dev (sb_jp(fs->fs_ondisk_sb), 0);
set_jp_journal_size (sb_jp(fs->fs_ondisk_sb), journal_default_size(fs->fs_super_bh->b_blocknr, fs->fs_blocksize));
if (get_jp_journal_max_trans_len(sb_jp(fs->fs_ondisk_sb)) != JOURNAL_TRANS_MAX)
set_jp_journal_max_trans_len(sb_jp(fs->fs_ondisk_sb), JOURNAL_TRANS_MAX);
if (get_jp_journal_max_batch(sb_jp(fs->fs_ondisk_sb)) != JOURNAL_MAX_BATCH)
@@ -134,15 +136,26 @@ static int set_standard_journal_params (reiserfs_filsys_t * fs)
set_sb_reserved_for_journal (fs->fs_ondisk_sb, 0);
/* journal_header update */
bh = getblk(fs->fs_journal_dev,
get_jp_journal_1st_block(sb_jp(fs->fs_ondisk_sb)) +
get_jp_journal_size(sb_jp(fs->fs_ondisk_sb)), fs->fs_blocksize);
((struct reiserfs_journal_header *)(fs->fs_jh_bh->b_data)) -> jh_journal =
*(sb_jp(fs->fs_ondisk_sb));
if (!bh) {
message ("Cannot get the journal header block. getblk failed.\n");
return 0;
}
((struct reiserfs_journal_header *)(bh->b_data))->jh_journal = *(sb_jp(fs->fs_ondisk_sb));
mark_buffer_uptodate (bh, 1);
mark_buffer_dirty (bh);
bwrite(bh);
brelse(bh);
return 1;
}
void zero_journal (reiserfs_filsys_t * fs)
{
int i;
unsigned int i;
struct buffer_head * bh;
unsigned long done;
unsigned long start, len;
@@ -214,7 +227,11 @@ int main (int argc, char **argv)
int Is_journal_or_maxtrans_size_specified = 0;
program_name = strrchr( argv[ 0 ], '/' );
program_name = program_name ? ++ program_name : argv[ 0 ];
if (program_name)
program_name++;
else
program_name = argv[ 0 ];
print_banner (program_name);
@@ -243,7 +260,7 @@ int main (int argc, char **argv)
};
int option_index;
c = getopt_long (argc, argv, "j:s:t:o:fu:l:",
c = getopt_long (argc, argv, "j:s:t:o:fu:l:B:",
options, &option_index);
if (c == -1)
break;
@@ -289,6 +306,9 @@ int main (int argc, char **argv)
confirmation */
Force ++;
break;
case 'B': /* --badblock-list */
asprintf (&badblocks_file, "%s", optarg);
break;
case 'u':
/* UUID */
if (!strcmp(optarg, "random")) {
@@ -331,50 +351,108 @@ int main (int argc, char **argv)
/* device to be formatted */
device_name = argv [optind];
if (!jdevice_name && !(Options & OPT_SKIP_J))
jdevice_name = device_name;
if (jdevice_name && (Options & OPT_SKIP_J)) {
message ("either specify journal device, "
"or choose the option --no-journal-awailable");
return 1;
}
fs = reiserfs_open (device_name, O_RDONLY, 0, NULL);
fs = reiserfs_open (device_name, O_RDONLY, 0, NULL, 1);
if (no_reiserfs_found(fs)) {
message ("Cannot open reiserfs on %s", device_name);
return 1;
}
/* now we try to open journal, it makes sence if there is no the flag
NEED_TUNE in ondisk superblock */
if (get_jp_journal_magic(sb_jp(fs->fs_ondisk_sb)) != NEED_TUNE) {
if (!reiserfs_open_journal (fs, jdevice_name, O_RDONLY)) {
if (!(Options & OPT_SKIP_J)) {
message ("Unable to open old journal.");
reiserfs_close (fs);
return 1;
}
else
if (!reiserfs_is_fs_consistent (fs)) {
message ("Check filesystem consistency first");
reiserfs_close (fs);
return 1;
}
/* forced to continue without journal available/specifed */
}
}
/* journal was opened or it wasn't opened but the option
--no-journal-available has been specified by user */
/* make sure filesystem is not mounted */
if (is_mounted (fs->fs_file_name)) {
/* fixme: it can not be mounted, btw */
message ("can not rebuild journal of mounted filesystem");
message ("Reiserfstune is not allowed to be run on mounted filesystem.");
reiserfs_close (fs);
return 1;
}
if (!reiserfs_is_fs_consistent (fs)) {
message ("Filesystem looks not cleanly umounted, check the consistency first.\n");
reiserfs_close (fs);
return 1;
}
reiserfs_reopen (fs, O_RDWR);
if (badblocks_file) {
unsigned long i, marked = 0;
if (reiserfs_open_ondisk_bitmap (fs) < 0) {
message("Failed to open reiserfs ondisk bitmap.\n");
reiserfs_close(fs);
exit(1);
}
if (create_badblock_bitmap (fs, badblocks_file)) {
message("Failed to initialize the bad block bitmap.\n");
reiserfs_close(fs);
exit(1);
}
for (i = 0; i < get_sb_block_count (fs->fs_ondisk_sb); i ++) {
if (reiserfs_bitmap_test_bit (fs->fs_badblocks_bm, i)) {
if (!reiserfs_bitmap_test_bit (fs->fs_bitmap2, i)) {
reiserfs_bitmap_set_bit (fs->fs_bitmap2, i);
marked++;
} else {
/* Check that this is a block */
if (not_data_block(fs, i)) {
message("Block %lu belongs to the internal reiserfs area "
"and cannot be reloacted.\n", i);
exit(1);
} else {
message("Block %lu is used already in reiserfs tree.\n", i);
}
}
}
}
message("%lu bad blocks were marked as used.\n", marked);
reiserfs_close(fs);
exit(0);
}
if (!jdevice_name && !(Options & OPT_SKIP_J)) {
message ("Journal device has not been specified. Assuming journal is on the main "
"device (%s).\n", device_name);
jdevice_name = device_name;
}
if (jdevice_name && (Options & OPT_SKIP_J)) {
message ("Either specify journal device, "
"or choose the option --no-journal-available");
return 1;
}
if (j_new_device_name && (Options & OPT_STANDARD)) {
/* New device was specified and --make-journal-standard was also. */
message ("Either specify new journal device, "
"or choose the option --make-journal-standard");
return 1;
}
/* now we try to open journal, it makes sence if there is no the flag
NEED_TUNE in ondisk superblock and --no-journal available is not
specified. */
if (get_jp_journal_magic(sb_jp(fs->fs_ondisk_sb)) != NEED_TUNE &&
!(Options & OPT_SKIP_J))
{
if (reiserfs_open_journal (fs, jdevice_name, O_RDWR | O_LARGEFILE)) {
message ("Failed to open the journal device (%s).", jdevice_name);
return 1;
}
if (reiserfs_journal_params_check(fs)) {
message ("Unable to open old journal. Wrong journal parameters.");
reiserfs_close (fs);
return 1;
}
}
/* in spite of journal was opened, the file system can be non-consistent or
there are non-replayed transaction in journal,
make sure it isn't (if there is no the flag NEED_TUNE in ondisk superblock */
@@ -398,13 +476,12 @@ int main (int argc, char **argv)
}
}
reiserfs_reopen (fs, O_RDWR);
/* set UUID and LABEL if specified */
if (fs->fs_format == REISERFS_FORMAT_3_6) {
if (uuid_is_correct (UUID)) {
memcpy (fs->fs_ondisk_sb->s_uuid, UUID, 16);
mark_buffer_dirty (fs->fs_super_bh);
fs->fs_dirt = 1;
}
if (LABEL != NULL) {
@@ -412,8 +489,8 @@ int main (int argc, char **argv)
message ("Specified LABEL is longer then 16 characters, will be truncated\n");
strncpy (fs->fs_ondisk_sb->s_label, LABEL, 16);
mark_buffer_dirty (fs->fs_super_bh);
fs->fs_dirt = 1;
}
fs->fs_dirt = 1;
} else {
if (uuid_is_correct (UUID))
reiserfs_panic ("UUID cannot be specified for 3.5 format\n");
@@ -422,15 +499,22 @@ int main (int argc, char **argv)
}
if (!j_new_device_name) {
/* new journal device hasn't been specify */
/* new journal device hasn't been specified */
printf ("Current parameters:\n");
print_filesystem_state (stdout, fs);
print_block (stdout, fs, fs->fs_super_bh);
printf ("Current journal parameters:\n");
print_journal_params (stdout, sb_jp (fs->fs_ondisk_sb));
if ((Options & OPT_STANDARD)
&& should_make_journal_standard(fs, j_new_device_name)) {
&& should_make_journal_standard(fs, j_new_device_name))
{
if (!user_confirmed (stderr, "ATTENTION! Filesystem with "
"non-standard journal found. Continue? (y/n):", "y\n"))
{
exit(1);
}
fs->fs_journal_dev = fs->fs_dev;
if (set_standard_journal_params (fs)) {
printf ("\nNew parameters:\n");
print_filesystem_state (stdout, fs);
@@ -439,8 +523,6 @@ int main (int argc, char **argv)
print_journal_params (stdout, sb_jp (fs->fs_ondisk_sb));
mark_buffer_dirty (fs->fs_super_bh);
mark_buffer_uptodate (fs->fs_super_bh, 1);
mark_buffer_dirty (fs->fs_jh_bh);
mark_buffer_uptodate (fs->fs_jh_bh, 1);
reiserfs_close (fs);
printf ("Syncing.."); fflush (stdout);
sync ();
@@ -448,12 +530,18 @@ int main (int argc, char **argv)
return 0;
}
}
if (Is_journal_or_maxtrans_size_specified)
if (Is_journal_or_maxtrans_size_specified) {
/* new journal device hasn't been specified, but
journal size or max transaction size have been, so we suppose
that journal device remains the same */
if (!reiserfs_journal_opened (fs)) {
message("Cannot set up new paramenters for not specified journal.");
return 1;
}
j_new_device_name = jdevice_name;
else {
} else {
/* the only parameter has been specified is device_name, so
there is nothing to do */
reiserfs_close (fs);
@@ -479,17 +567,23 @@ int main (int argc, char **argv)
else
/* non-standard journal */
reserved = get_sb_reserved_for_journal (fs->fs_ondisk_sb);
journal_size = Journal_size;
journal_size = (Journal_size ? Journal_size : journal_default_size(fs->fs_super_bh->b_blocknr, fs->fs_blocksize));
if (!journal_size) {
journal_size = journal_default_size(fs->fs_super_bh->b_blocknr, fs->fs_blocksize) + 1;
message("Journal size has not been specified. Assuming it is the default size (%lu)",
journal_size);
}
/* journal_size = (Journal_size ? Journal_size : // specified
(fs->fs_blocksize == 1024 ? (fs->fs_blocksize) * 8 - 3 -
REISERFS_DISK_OFFSET_IN_BYTES / fs->fs_blocksize :
JOURNAL_DEFAULT_SIZE + 1)); // default
*/
if (journal_size > reserved) {
if (journal_size + Offset > get_journal_start_must (fs) + reserved) {
message ("There is no enough space reserved for journal on main "
"device (journal_size=%lu, reserved=%lu\n", journal_size,
"device (journal_size=%lu, reserved=%lu)\n", journal_size,
reserved);
reiserfs_close (fs);
return 1;
@@ -502,11 +596,14 @@ int main (int argc, char **argv)
if (!is_reiserfs_jr_magic_string (fs->fs_ondisk_sb)) {
/* we have standard journal, so check if we can convert it
to non-standard one */
/*
if (!should_make_journal_non_standard (Force)) {
reiserfs_close (fs);
return 1;
}
*/
if (is_reiserfs_3_6_magic_string (fs->fs_ondisk_sb))
set_sb_version (fs->fs_ondisk_sb, REISERFS_FORMAT_3_6);
else if (is_reiserfs_3_5_magic_string (fs->fs_ondisk_sb))
@@ -520,7 +617,7 @@ int main (int argc, char **argv)
memcpy (fs->fs_ondisk_sb->s_v1.s_magic, REISERFS_JR_SUPER_MAGIC_STRING,
strlen (REISERFS_JR_SUPER_MAGIC_STRING));
set_sb_reserved_for_journal (fs->fs_ondisk_sb,
get_jp_journal_size (sb_jp(fs->fs_ondisk_sb)) + 1);
get_jp_journal_size (sb_jp(fs->fs_ondisk_sb)) + 1);
}
/* now we are going to close old journal and to create a new one */
@@ -533,10 +630,9 @@ int main (int argc, char **argv)
return 1;
}
if (Options & OPT_STANDARD)
if (should_make_journal_standard (fs, j_new_device_name))
set_standard_journal_params (fs);
if (should_make_journal_standard (fs, j_new_device_name))
set_standard_journal_params (fs);
message ("New journal parameters:");
print_journal_params (stdout, sb_jp (fs->fs_ondisk_sb));
+3 -1
View File
@@ -1,6 +1,8 @@
/*
* Copyright 2002 Hans Reiser, licensing governed by ../README
* Copyright 2002-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#define _GNU_SOURCE
#include <stdio.h>
+2 -2
View File
@@ -1,7 +1,7 @@
/*
* Copyright 2002 Hans Reiser
* Copyright 2002-2003 Hans Reiser, licensing governed by reiserfsprogs/README
*/
#define print_banner(prog) \
fprintf (stderr, "\n<-------------%s, 2002------------->\nreiserfsprogs %s\n\n", \
fprintf (stderr, "\n<-------------%s, 2003------------->\nreiserfsprogs %s\n\n", \
prog, VERSION)