Imported reiserfsprogs-3.6.20
This commit is contained in:
1 parent
0ed773997f
commit
dac518d099
189 files changed
+42986
-29420
No files matched your search
@@ -45,11 +45,11 @@ Alexander Lyamin keeps our hardware running, and was very generous to our
|
|||||||
project in many little ways.
|
project in many little ways.
|
||||||
|
|
||||||
Vitaly Fertman wrote fsck for V3 and maintains the reiserfsprogs package now.
|
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
|
He worked on libreiser4 and userspace plugins; developped librepair, userspace
|
||||||
developing libreiser4 and userspace plugins with Umka.
|
plugins repair code, fsck & debugfs for V4.
|
||||||
|
|
||||||
Yury Umanets (aka Umka) developed libreiser4, userspace plugins, and all
|
Yury Umanets (aka Umka) developed libreiser4, userspace plugins, and all
|
||||||
userspace tools (reiser4progs) except of fsck.
|
userspace tools (reiser4progs) except of fsck & debugfs.
|
||||||
|
|
||||||
Joshua Macdonald wrote the first draft of the transaction manager. Yuri Rupasov
|
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
|
did testing and benchmarking, plus he invented the r5 hash (also used by the
|
||||||
@@ -79,10 +79,6 @@ 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
|
V3 maintenance. Reiserfs integration in their distro is consistently solid, and
|
||||||
they were key to our becoming widely used.
|
they were key to our becoming widely used.
|
||||||
|
|
||||||
Lycos Europe (www.lycos-europe.com) had a support contract with us that
|
|
||||||
consistently came in just when we would otherwise have missed payroll, and that
|
|
||||||
they kept doubling every year. Much thanks to them.
|
|
||||||
|
|
||||||
Many persons came to www.namesys.com/support.html, and got a question answered
|
Many persons came to www.namesys.com/support.html, and got a question answered
|
||||||
for $25, or just gave us a small donation there.
|
for $25, or just gave us a small donation there.
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ Installation Names
|
|||||||
==================
|
==================
|
||||||
|
|
||||||
By default, `make install' will install the package's files in
|
By default, `make install' will install the package's files in
|
||||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
`/usr/local/sbin', `/usr/local/man', etc. You can specify an
|
||||||
installation prefix other than `/usr/local' by giving `configure' the
|
installation prefix other than `/usr/local' by giving `configure' the
|
||||||
option `--prefix=PATH'.
|
option `--prefix=PATH'.
|
||||||
|
|
||||||
|
|||||||
+15
-5
@@ -1,8 +1,18 @@
|
|||||||
SUBDIRS = include lib reiserfscore fsck debugreiserfs resize_reiserfs mkreiserfs tune
|
SUBDIRS = include libmisc libreiserfs libutil utils
|
||||||
|
|
||||||
noinst_DATA = reiserfsprogs.spec
|
EXTRA_DIST = AUTHORS COPYING NEWS README CREDITS \
|
||||||
|
reiserfsprogs.spec reiserfsprogs.spec.in depcomp
|
||||||
|
# libreiserfs.m4
|
||||||
|
|
||||||
EXTRA_DIST = CREDITS version.h
|
aclocaldir = $(datadir)/aclocal
|
||||||
|
#aclocal_DATA = libreiserfs.m4
|
||||||
|
|
||||||
dist-hook:
|
define all-sources
|
||||||
cp -f reiserfsprogs.spec $(distdir)
|
( find ./ -name '*.[ch]' | grep -v SCCS | grep -v "Attic" | grep -v "reiserfsprogs" )
|
||||||
|
endef
|
||||||
|
|
||||||
|
TAGS:
|
||||||
|
$(all-sources) | etags -
|
||||||
|
|
||||||
|
tags:
|
||||||
|
$(all-sources) | xargs -- ctags -w -o TAGS
|
||||||
+194
-132
@@ -1,8 +1,8 @@
|
|||||||
# Makefile.in generated by automake 1.7.6 from Makefile.am.
|
# Makefile.in generated by automake 1.9.5 from Makefile.am.
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
|
||||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||||
# Free Software Foundation, Inc.
|
# 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||||
# This Makefile.in is free software; the Free Software Foundation
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
# with or without modifications, as long as this notice is preserved.
|
# with or without modifications, as long as this notice is preserved.
|
||||||
@@ -13,7 +13,6 @@
|
|||||||
# PARTICULAR PURPOSE.
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
@SET_MAKE@
|
@SET_MAKE@
|
||||||
|
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
top_srcdir = @top_srcdir@
|
top_srcdir = @top_srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
@@ -21,7 +20,6 @@ pkgdatadir = $(datadir)/@PACKAGE@
|
|||||||
pkglibdir = $(libdir)/@PACKAGE@
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
pkgincludedir = $(includedir)/@PACKAGE@
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
top_builddir = .
|
top_builddir = .
|
||||||
|
|
||||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||||
INSTALL = @INSTALL@
|
INSTALL = @INSTALL@
|
||||||
install_sh_DATA = $(install_sh) -c -m 644
|
install_sh_DATA = $(install_sh) -c -m 644
|
||||||
@@ -35,7 +33,45 @@ POST_INSTALL = :
|
|||||||
NORMAL_UNINSTALL = :
|
NORMAL_UNINSTALL = :
|
||||||
PRE_UNINSTALL = :
|
PRE_UNINSTALL = :
|
||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
|
build_triplet = @build@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
|
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
|
||||||
|
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
|
||||||
|
$(srcdir)/reiserfsprogs.spec.in $(top_srcdir)/configure \
|
||||||
|
AUTHORS COPYING ChangeLog INSTALL NEWS compile config.guess \
|
||||||
|
config.sub depcomp install-sh missing mkinstalldirs
|
||||||
|
subdir = .
|
||||||
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
|
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||||
|
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||||
|
$(ACLOCAL_M4)
|
||||||
|
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||||
|
configure.lineno configure.status.lineno
|
||||||
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
|
CONFIG_HEADER = config.h
|
||||||
|
CONFIG_CLEAN_FILES = reiserfsprogs.spec
|
||||||
|
SOURCES =
|
||||||
|
DIST_SOURCES =
|
||||||
|
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||||
|
html-recursive info-recursive install-data-recursive \
|
||||||
|
install-exec-recursive install-info-recursive \
|
||||||
|
install-recursive installcheck-recursive installdirs-recursive \
|
||||||
|
pdf-recursive ps-recursive uninstall-info-recursive \
|
||||||
|
uninstall-recursive
|
||||||
|
ETAGS = etags
|
||||||
|
CTAGS = ctags
|
||||||
|
DIST_SUBDIRS = $(SUBDIRS)
|
||||||
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
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); }; }
|
||||||
|
DIST_ARCHIVES = $(distdir).tar.gz
|
||||||
|
GZIP_ENV = --best
|
||||||
|
distuninstallcheck_listfiles = find . -type f -print
|
||||||
|
distcleancheck_listfiles = find . -type f -print
|
||||||
ACLOCAL = @ACLOCAL@
|
ACLOCAL = @ACLOCAL@
|
||||||
AMDEP_FALSE = @AMDEP_FALSE@
|
AMDEP_FALSE = @AMDEP_FALSE@
|
||||||
AMDEP_TRUE = @AMDEP_TRUE@
|
AMDEP_TRUE = @AMDEP_TRUE@
|
||||||
@@ -78,6 +114,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
|
|||||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||||
|
PROGS_LDFLAGS = @PROGS_LDFLAGS@
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
SET_MAKE = @SET_MAKE@
|
SET_MAKE = @SET_MAKE@
|
||||||
SHELL = @SHELL@
|
SHELL = @SHELL@
|
||||||
@@ -92,6 +129,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
|||||||
am__include = @am__include@
|
am__include = @am__include@
|
||||||
am__leading_dot = @am__leading_dot@
|
am__leading_dot = @am__leading_dot@
|
||||||
am__quote = @am__quote@
|
am__quote = @am__quote@
|
||||||
|
am__tar = @am__tar@
|
||||||
|
am__untar = @am__untar@
|
||||||
bindir = @bindir@
|
bindir = @bindir@
|
||||||
build = @build@
|
build = @build@
|
||||||
build_alias = @build_alias@
|
build_alias = @build_alias@
|
||||||
@@ -112,6 +151,7 @@ libdir = @libdir@
|
|||||||
libexecdir = @libexecdir@
|
libexecdir = @libexecdir@
|
||||||
localstatedir = @localstatedir@
|
localstatedir = @localstatedir@
|
||||||
mandir = @mandir@
|
mandir = @mandir@
|
||||||
|
mkdir_p = @mkdir_p@
|
||||||
oldincludedir = @oldincludedir@
|
oldincludedir = @oldincludedir@
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
program_transform_name = @program_transform_name@
|
program_transform_name = @program_transform_name@
|
||||||
@@ -119,48 +159,68 @@ sbindir = @sbindir@
|
|||||||
sharedstatedir = @sharedstatedir@
|
sharedstatedir = @sharedstatedir@
|
||||||
sysconfdir = @sysconfdir@
|
sysconfdir = @sysconfdir@
|
||||||
target_alias = @target_alias@
|
target_alias = @target_alias@
|
||||||
SUBDIRS = include lib reiserfscore fsck debugreiserfs resize_reiserfs mkreiserfs tune
|
SUBDIRS = include libmisc libreiserfs libutil utils
|
||||||
|
EXTRA_DIST = AUTHORS COPYING NEWS README CREDITS \
|
||||||
|
reiserfsprogs.spec reiserfsprogs.spec.in depcomp
|
||||||
|
|
||||||
noinst_DATA = reiserfsprogs.spec
|
# libreiserfs.m4
|
||||||
|
aclocaldir = $(datadir)/aclocal
|
||||||
EXTRA_DIST = CREDITS version.h
|
all: config.h
|
||||||
subdir = .
|
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
|
||||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
|
||||||
CONFIG_HEADER = $(top_builddir)/include/config.h
|
|
||||||
CONFIG_CLEAN_FILES =
|
|
||||||
DIST_SOURCES =
|
|
||||||
DATA = $(noinst_DATA)
|
|
||||||
|
|
||||||
|
|
||||||
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 config.guess config.sub configure \
|
|
||||||
configure.in depcomp install-sh missing mkinstalldirs
|
|
||||||
DIST_SUBDIRS = $(SUBDIRS)
|
|
||||||
all: all-recursive
|
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
am--refresh:
|
||||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
@:
|
||||||
configure.lineno
|
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
@for dep in $?; do \
|
||||||
|
case '$(am__configure_deps)' in \
|
||||||
|
*$$dep*) \
|
||||||
|
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
|
||||||
|
cd $(srcdir) && $(AUTOMAKE) --gnu \
|
||||||
|
&& exit 0; \
|
||||||
|
exit 1;; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
|
||||||
cd $(top_srcdir) && \
|
cd $(top_srcdir) && \
|
||||||
$(AUTOMAKE) --gnu Makefile
|
$(AUTOMAKE) --gnu Makefile
|
||||||
Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status
|
.PRECIOUS: Makefile
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
|
@case '$?' in \
|
||||||
|
*config.status*) \
|
||||||
|
echo ' $(SHELL) ./config.status'; \
|
||||||
|
$(SHELL) ./config.status;; \
|
||||||
|
*) \
|
||||||
|
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||||
|
esac;
|
||||||
|
|
||||||
$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||||
$(SHELL) ./config.status --recheck
|
$(SHELL) ./config.status --recheck
|
||||||
$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
|
||||||
cd $(srcdir) && $(AUTOCONF)
|
|
||||||
|
|
||||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in
|
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||||
|
cd $(srcdir) && $(AUTOCONF)
|
||||||
|
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||||
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||||
|
|
||||||
|
config.h: stamp-h1
|
||||||
|
@if test ! -f $@; then \
|
||||||
|
rm -f stamp-h1; \
|
||||||
|
$(MAKE) stamp-h1; \
|
||||||
|
else :; fi
|
||||||
|
|
||||||
|
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||||
|
@rm -f stamp-h1
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status config.h
|
||||||
|
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||||
|
cd $(top_srcdir) && $(AUTOHEADER)
|
||||||
|
rm -f stamp-h1
|
||||||
|
touch $@
|
||||||
|
|
||||||
|
distclean-hdr:
|
||||||
|
-rm -f config.h stamp-h1
|
||||||
|
reiserfsprogs.spec: $(top_builddir)/config.status $(srcdir)/reiserfsprogs.spec.in
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||||
uninstall-info-am:
|
uninstall-info-am:
|
||||||
|
|
||||||
# This directory's subdirectories are mostly independent; you can cd
|
# This directory's subdirectories are mostly independent; you can cd
|
||||||
@@ -170,7 +230,13 @@ uninstall-info-am:
|
|||||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||||
# (2) otherwise, pass the desired values on the `make' command line.
|
# (2) otherwise, pass the desired values on the `make' command line.
|
||||||
$(RECURSIVE_TARGETS):
|
$(RECURSIVE_TARGETS):
|
||||||
@set fnord $$MAKEFLAGS; amf=$$2; \
|
@failcom='exit 1'; \
|
||||||
|
for f in x $$MAKEFLAGS; do \
|
||||||
|
case $$f in \
|
||||||
|
*=* | --[!k]*);; \
|
||||||
|
*k*) failcom='fail=yes';; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
dot_seen=no; \
|
dot_seen=no; \
|
||||||
target=`echo $@ | sed s/-recursive//`; \
|
target=`echo $@ | sed s/-recursive//`; \
|
||||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||||
@@ -182,7 +248,7 @@ $(RECURSIVE_TARGETS):
|
|||||||
local_target="$$target"; \
|
local_target="$$target"; \
|
||||||
fi; \
|
fi; \
|
||||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
|| eval $$failcom; \
|
||||||
done; \
|
done; \
|
||||||
if test "$$dot_seen" = "no"; then \
|
if test "$$dot_seen" = "no"; then \
|
||||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||||
@@ -190,7 +256,13 @@ $(RECURSIVE_TARGETS):
|
|||||||
|
|
||||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||||
maintainer-clean-recursive:
|
maintainer-clean-recursive:
|
||||||
@set fnord $$MAKEFLAGS; amf=$$2; \
|
@failcom='exit 1'; \
|
||||||
|
for f in x $$MAKEFLAGS; do \
|
||||||
|
case $$f in \
|
||||||
|
*=* | --[!k]*);; \
|
||||||
|
*k*) failcom='fail=yes';; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
dot_seen=no; \
|
dot_seen=no; \
|
||||||
case "$@" in \
|
case "$@" in \
|
||||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||||
@@ -211,7 +283,7 @@ maintainer-clean-recursive:
|
|||||||
local_target="$$target"; \
|
local_target="$$target"; \
|
||||||
fi; \
|
fi; \
|
||||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
|| eval $$failcom; \
|
||||||
done && test -z "$$fail"
|
done && test -z "$$fail"
|
||||||
tags-recursive:
|
tags-recursive:
|
||||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||||
@@ -222,14 +294,6 @@ ctags-recursive:
|
|||||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||||
done
|
done
|
||||||
|
|
||||||
ETAGS = etags
|
|
||||||
ETAGSFLAGS =
|
|
||||||
|
|
||||||
CTAGS = ctags
|
|
||||||
CTAGSFLAGS =
|
|
||||||
|
|
||||||
tags: TAGS
|
|
||||||
|
|
||||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||||
unique=`for i in $$list; do \
|
unique=`for i in $$list; do \
|
||||||
@@ -238,38 +302,12 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
|||||||
$(AWK) ' { files[$$0] = 1; } \
|
$(AWK) ' { files[$$0] = 1; } \
|
||||||
END { for (i in files) print i; }'`; \
|
END { for (i in files) print i; }'`; \
|
||||||
mkid -fID $$unique
|
mkid -fID $$unique
|
||||||
|
|
||||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
|
||||||
$(TAGS_FILES) $(LISP)
|
|
||||||
tags=; \
|
|
||||||
here=`pwd`; \
|
|
||||||
if (etags --etags-include --version) >/dev/null 2>&1; then \
|
|
||||||
include_option=--etags-include; \
|
|
||||||
else \
|
|
||||||
include_option=--include; \
|
|
||||||
fi; \
|
|
||||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
|
||||||
if test "$$subdir" = .; then :; else \
|
|
||||||
test -f $$subdir/TAGS && \
|
|
||||||
tags="$$tags $$include_option=$$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
|
||||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
||||||
$(TAGS_FILES) $(LISP)
|
$(TAGS_FILES) $(LISP)
|
||||||
tags=; \
|
tags=; \
|
||||||
here=`pwd`; \
|
here=`pwd`; \
|
||||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
|
||||||
unique=`for i in $$list; do \
|
unique=`for i in $$list; do \
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
done | \
|
done | \
|
||||||
@@ -286,23 +324,11 @@ GTAGS:
|
|||||||
|
|
||||||
distclean-tags:
|
distclean-tags:
|
||||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
|
||||||
|
|
||||||
top_distdir = .
|
|
||||||
distdir = $(PACKAGE)-$(VERSION)
|
|
||||||
|
|
||||||
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)
|
distdir: $(DISTFILES)
|
||||||
$(am__remove_distdir)
|
$(am__remove_distdir)
|
||||||
mkdir $(distdir)
|
mkdir $(distdir)
|
||||||
|
$(mkdir_p) $(distdir)/.
|
||||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||||
list='$(DISTFILES)'; for file in $$list; do \
|
list='$(DISTFILES)'; for file in $$list; do \
|
||||||
@@ -314,7 +340,7 @@ distdir: $(DISTFILES)
|
|||||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||||
dir="/$$dir"; \
|
dir="/$$dir"; \
|
||||||
$(mkinstalldirs) "$(distdir)$$dir"; \
|
$(mkdir_p) "$(distdir)$$dir"; \
|
||||||
else \
|
else \
|
||||||
dir=''; \
|
dir=''; \
|
||||||
fi; \
|
fi; \
|
||||||
@@ -329,41 +355,67 @@ distdir: $(DISTFILES)
|
|||||||
|| exit 1; \
|
|| exit 1; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||||
if test "$$subdir" = .; then :; else \
|
if test "$$subdir" = .; then :; else \
|
||||||
test -d $(distdir)/$$subdir \
|
test -d "$(distdir)/$$subdir" \
|
||||||
|| mkdir $(distdir)/$$subdir \
|
|| $(mkdir_p) "$(distdir)/$$subdir" \
|
||||||
|| exit 1; \
|
|| exit 1; \
|
||||||
|
distdir=`$(am__cd) $(distdir) && pwd`; \
|
||||||
|
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
|
||||||
(cd $$subdir && \
|
(cd $$subdir && \
|
||||||
$(MAKE) $(AM_MAKEFLAGS) \
|
$(MAKE) $(AM_MAKEFLAGS) \
|
||||||
top_distdir="$(top_distdir)" \
|
top_distdir="$$top_distdir" \
|
||||||
distdir=../$(distdir)/$$subdir \
|
distdir="$$distdir/$$subdir" \
|
||||||
distdir) \
|
distdir) \
|
||||||
|| exit 1; \
|
|| exit 1; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
$(MAKE) $(AM_MAKEFLAGS) \
|
|
||||||
top_distdir="$(top_distdir)" distdir="$(distdir)" \
|
|
||||||
dist-hook
|
|
||||||
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
|
-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 -444 -links 1 -exec chmod a+r {} \; -o \
|
||||||
! -type d ! -perm -400 -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 {} {} \; \
|
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|
||||||
|| chmod -R a+r $(distdir)
|
|| chmod -R a+r $(distdir)
|
||||||
dist-gzip: distdir
|
dist-gzip: distdir
|
||||||
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||||
|
$(am__remove_distdir)
|
||||||
|
|
||||||
|
dist-bzip2: distdir
|
||||||
|
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
|
||||||
|
$(am__remove_distdir)
|
||||||
|
|
||||||
|
dist-tarZ: distdir
|
||||||
|
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||||
|
$(am__remove_distdir)
|
||||||
|
|
||||||
|
dist-shar: distdir
|
||||||
|
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||||
|
$(am__remove_distdir)
|
||||||
|
|
||||||
|
dist-zip: distdir
|
||||||
|
-rm -f $(distdir).zip
|
||||||
|
zip -rq $(distdir).zip $(distdir)
|
||||||
$(am__remove_distdir)
|
$(am__remove_distdir)
|
||||||
|
|
||||||
dist dist-all: distdir
|
dist dist-all: distdir
|
||||||
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||||
$(am__remove_distdir)
|
$(am__remove_distdir)
|
||||||
|
|
||||||
# This target untars the dist file and tries a VPATH configuration. Then
|
# This target untars the dist file and tries a VPATH configuration. Then
|
||||||
# it guarantees that the distribution is self-contained by making another
|
# it guarantees that the distribution is self-contained by making another
|
||||||
# tarfile.
|
# tarfile.
|
||||||
distcheck: dist
|
distcheck: dist
|
||||||
$(am__remove_distdir)
|
case '$(DIST_ARCHIVES)' in \
|
||||||
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
|
*.tar.gz*) \
|
||||||
|
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
|
||||||
|
*.tar.bz2*) \
|
||||||
|
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||||
|
*.tar.Z*) \
|
||||||
|
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||||
|
*.shar.gz*) \
|
||||||
|
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
|
||||||
|
*.zip*) \
|
||||||
|
unzip $(distdir).zip ;;\
|
||||||
|
esac
|
||||||
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||||
mkdir $(distdir)/_build
|
mkdir $(distdir)/_build
|
||||||
mkdir $(distdir)/_inst
|
mkdir $(distdir)/_inst
|
||||||
@@ -383,19 +435,20 @@ distcheck: dist
|
|||||||
distuninstallcheck \
|
distuninstallcheck \
|
||||||
&& chmod -R a-w "$$dc_install_base" \
|
&& chmod -R a-w "$$dc_install_base" \
|
||||||
&& ({ \
|
&& ({ \
|
||||||
(cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
|
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||||
&& rm -rf "$$dc_destdir" \
|
&& rm -rf "$$dc_destdir" \
|
||||||
&& $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
|
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||||
&& rm -f $(distdir).tar.gz \
|
&& rm -rf $(DIST_ARCHIVES) \
|
||||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
|
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
|
||||||
$(am__remove_distdir)
|
$(am__remove_distdir)
|
||||||
@echo "$(distdir).tar.gz is ready for distribution" | \
|
@(echo "$(distdir) archives ready for distribution: "; \
|
||||||
sed 'h;s/./=/g;p;x;p;x'
|
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||||
|
sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
|
||||||
distuninstallcheck:
|
distuninstallcheck:
|
||||||
@cd $(distuninstallcheck_dir) \
|
@cd $(distuninstallcheck_dir) \
|
||||||
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|
||||||
@@ -416,10 +469,9 @@ distcleancheck: distclean
|
|||||||
exit 1; } >&2
|
exit 1; } >&2
|
||||||
check-am: all-am
|
check-am: all-am
|
||||||
check: check-recursive
|
check: check-recursive
|
||||||
all-am: Makefile $(DATA)
|
all-am: Makefile config.h
|
||||||
installdirs: installdirs-recursive
|
installdirs: installdirs-recursive
|
||||||
installdirs-am:
|
installdirs-am:
|
||||||
|
|
||||||
install: install-recursive
|
install: install-recursive
|
||||||
install-exec: install-exec-recursive
|
install-exec: install-exec-recursive
|
||||||
install-data: install-data-recursive
|
install-data: install-data-recursive
|
||||||
@@ -431,7 +483,7 @@ install-am: all-am
|
|||||||
installcheck: installcheck-recursive
|
installcheck: installcheck-recursive
|
||||||
install-strip:
|
install-strip:
|
||||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
INSTALL_STRIP_FLAG=-s \
|
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||||
`test -z '$(STRIP)' || \
|
`test -z '$(STRIP)' || \
|
||||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||||
mostlyclean-generic:
|
mostlyclean-generic:
|
||||||
@@ -439,7 +491,7 @@ mostlyclean-generic:
|
|||||||
clean-generic:
|
clean-generic:
|
||||||
|
|
||||||
distclean-generic:
|
distclean-generic:
|
||||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||||
|
|
||||||
maintainer-clean-generic:
|
maintainer-clean-generic:
|
||||||
@echo "This command is intended for maintainers to use"
|
@echo "This command is intended for maintainers to use"
|
||||||
@@ -450,12 +502,15 @@ clean-am: clean-generic mostlyclean-am
|
|||||||
|
|
||||||
distclean: distclean-recursive
|
distclean: distclean-recursive
|
||||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||||
distclean-am: clean-am distclean-generic distclean-tags
|
-rm -f Makefile
|
||||||
|
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
|
||||||
|
|
||||||
dvi: dvi-recursive
|
dvi: dvi-recursive
|
||||||
|
|
||||||
dvi-am:
|
dvi-am:
|
||||||
|
|
||||||
|
html: html-recursive
|
||||||
|
|
||||||
info: info-recursive
|
info: info-recursive
|
||||||
|
|
||||||
info-am:
|
info-am:
|
||||||
@@ -473,6 +528,7 @@ installcheck-am:
|
|||||||
maintainer-clean: maintainer-clean-recursive
|
maintainer-clean: maintainer-clean-recursive
|
||||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||||
-rm -rf $(top_srcdir)/autom4te.cache
|
-rm -rf $(top_srcdir)/autom4te.cache
|
||||||
|
-rm -f Makefile
|
||||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||||
|
|
||||||
mostlyclean: mostlyclean-recursive
|
mostlyclean: mostlyclean-recursive
|
||||||
@@ -491,26 +547,32 @@ uninstall-am: uninstall-info-am
|
|||||||
|
|
||||||
uninstall-info: uninstall-info-recursive
|
uninstall-info: uninstall-info-recursive
|
||||||
|
|
||||||
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
|
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
|
||||||
clean-generic clean-recursive ctags ctags-recursive dist \
|
check-am clean clean-generic clean-recursive ctags \
|
||||||
dist-all dist-gzip distcheck distclean distclean-generic \
|
ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \
|
||||||
distclean-recursive distclean-tags distcleancheck distdir \
|
dist-tarZ dist-zip distcheck distclean distclean-generic \
|
||||||
distuninstallcheck dvi dvi-am dvi-recursive info info-am \
|
distclean-hdr distclean-recursive distclean-tags \
|
||||||
info-recursive install install-am install-data install-data-am \
|
distcleancheck distdir distuninstallcheck dvi dvi-am html \
|
||||||
install-data-recursive install-exec install-exec-am \
|
html-am info info-am install install-am install-data \
|
||||||
install-exec-recursive install-info install-info-am \
|
install-data-am install-exec install-exec-am install-info \
|
||||||
install-info-recursive install-man install-recursive \
|
install-info-am install-man install-strip installcheck \
|
||||||
install-strip installcheck installcheck-am installdirs \
|
installcheck-am installdirs installdirs-am maintainer-clean \
|
||||||
installdirs-am installdirs-recursive maintainer-clean \
|
maintainer-clean-generic maintainer-clean-recursive \
|
||||||
maintainer-clean-generic maintainer-clean-recursive mostlyclean \
|
mostlyclean mostlyclean-generic mostlyclean-recursive pdf \
|
||||||
mostlyclean-generic mostlyclean-recursive pdf pdf-am \
|
pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
|
||||||
pdf-recursive ps ps-am ps-recursive tags tags-recursive \
|
uninstall-info-am
|
||||||
uninstall uninstall-am uninstall-info-am \
|
|
||||||
uninstall-info-recursive uninstall-recursive
|
|
||||||
|
|
||||||
|
#aclocal_DATA = libreiserfs.m4
|
||||||
|
|
||||||
dist-hook:
|
define all-sources
|
||||||
cp -f reiserfsprogs.spec $(distdir)
|
( find ./ -name '*.[ch]' | grep -v SCCS | grep -v "Attic" | grep -v "reiserfsprogs" )
|
||||||
|
endef
|
||||||
|
|
||||||
|
TAGS:
|
||||||
|
$(all-sources) | etags -
|
||||||
|
|
||||||
|
tags:
|
||||||
|
$(all-sources) | xargs -- ctags -w -o TAGS
|
||||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
# 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.
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
.NOEXPORT:
|
.NOEXPORT:
|
||||||
Vendored
+6571
-549
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,142 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
# Wrapper for compilers which do not understand `-c -o'.
|
||||||
|
|
||||||
|
scriptversion=2005-02-03.08
|
||||||
|
|
||||||
|
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||||
|
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# This file is maintained in Automake, please report
|
||||||
|
# bugs to <bug-automake@gnu.org> or send patches to
|
||||||
|
# <automake-patches@gnu.org>.
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
'')
|
||||||
|
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||||
|
exit 1;
|
||||||
|
;;
|
||||||
|
-h | --h*)
|
||||||
|
cat <<\EOF
|
||||||
|
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||||
|
|
||||||
|
Wrapper for compilers which do not understand `-c -o'.
|
||||||
|
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||||
|
arguments, and rename the output as expected.
|
||||||
|
|
||||||
|
If you are trying to build a whole package this is not the
|
||||||
|
right script to run: please start by reading the file `INSTALL'.
|
||||||
|
|
||||||
|
Report bugs to <bug-automake@gnu.org>.
|
||||||
|
EOF
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
-v | --v*)
|
||||||
|
echo "compile $scriptversion"
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
ofile=
|
||||||
|
cfile=
|
||||||
|
eat=
|
||||||
|
|
||||||
|
for arg
|
||||||
|
do
|
||||||
|
if test -n "$eat"; then
|
||||||
|
eat=
|
||||||
|
else
|
||||||
|
case $1 in
|
||||||
|
-o)
|
||||||
|
# configure might choose to run compile as `compile cc -o foo foo.c'.
|
||||||
|
# So we strip `-o arg' only if arg is an object.
|
||||||
|
eat=1
|
||||||
|
case $2 in
|
||||||
|
*.o | *.obj)
|
||||||
|
ofile=$2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
set x "$@" -o "$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*.c)
|
||||||
|
cfile=$1
|
||||||
|
set x "$@" "$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
set x "$@" "$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if test -z "$ofile" || test -z "$cfile"; then
|
||||||
|
# If no `-o' option was seen then we might have been invoked from a
|
||||||
|
# pattern rule where we don't need one. That is ok -- this is a
|
||||||
|
# normal compilation that the losing compiler can handle. If no
|
||||||
|
# `.c' file was seen then we are probably linking. That is also
|
||||||
|
# ok.
|
||||||
|
exec "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Name of file we expect compiler to create.
|
||||||
|
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
|
||||||
|
|
||||||
|
# Create the lock directory.
|
||||||
|
# Note: use `[/.-]' here to ensure that we don't use the same name
|
||||||
|
# that we are using for the .o file. Also, base the name on the expected
|
||||||
|
# object file name, since that is what matters with a parallel build.
|
||||||
|
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
|
||||||
|
while true; do
|
||||||
|
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
# FIXME: race condition here if user kills between mkdir and trap.
|
||||||
|
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||||
|
|
||||||
|
# Run the compile.
|
||||||
|
"$@"
|
||||||
|
ret=$?
|
||||||
|
|
||||||
|
if test -f "$cofile"; then
|
||||||
|
mv "$cofile" "$ofile"
|
||||||
|
elif test -f "${cofile}bj"; then
|
||||||
|
mv "${cofile}bj" "$ofile"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rmdir "$lockdir"
|
||||||
|
exit $ret
|
||||||
|
|
||||||
|
# Local Variables:
|
||||||
|
# mode: shell-script
|
||||||
|
# sh-indentation: 2
|
||||||
|
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||||
|
# time-stamp-start: "scriptversion="
|
||||||
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||||
|
# time-stamp-end: "$"
|
||||||
|
# End:
|
||||||
Vendored
+93
-41
@@ -1,9 +1,9 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Attempt to guess a canonical system name.
|
# Attempt to guess a canonical system name.
|
||||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||||
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||||
|
|
||||||
timestamp='2003-07-02'
|
timestamp='2005-02-10'
|
||||||
|
|
||||||
# This file is free software; you can redistribute it and/or modify it
|
# This file is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public License as published by
|
# under the terms of the GNU General Public License as published by
|
||||||
@@ -53,7 +53,7 @@ version="\
|
|||||||
GNU config.guess ($timestamp)
|
GNU config.guess ($timestamp)
|
||||||
|
|
||||||
Originally written by Per Bothner.
|
Originally written by Per Bothner.
|
||||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This is free software; see the source for copying conditions. There is NO
|
This is free software; see the source for copying conditions. There is NO
|
||||||
@@ -207,15 +207,21 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
|
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
|
||||||
echo "${machine}-${os}${release}"
|
echo "${machine}-${os}${release}"
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
amd64:OpenBSD:*:*)
|
||||||
|
echo x86_64-unknown-openbsd${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
amiga:OpenBSD:*:*)
|
amiga:OpenBSD:*:*)
|
||||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
arc:OpenBSD:*:*)
|
cats:OpenBSD:*:*)
|
||||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
echo arm-unknown-openbsd${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
hp300:OpenBSD:*:*)
|
hp300:OpenBSD:*:*)
|
||||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
luna88k:OpenBSD:*:*)
|
||||||
|
echo m88k-unknown-openbsd${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
mac68k:OpenBSD:*:*)
|
mac68k:OpenBSD:*:*)
|
||||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
@@ -231,25 +237,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
mvmeppc:OpenBSD:*:*)
|
mvmeppc:OpenBSD:*:*)
|
||||||
echo powerpc-unknown-openbsd${UNAME_RELEASE}
|
echo powerpc-unknown-openbsd${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
pmax:OpenBSD:*:*)
|
|
||||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
|
||||||
exit 0 ;;
|
|
||||||
sgi:OpenBSD:*:*)
|
sgi:OpenBSD:*:*)
|
||||||
echo mipseb-unknown-openbsd${UNAME_RELEASE}
|
echo mips64-unknown-openbsd${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
sun3:OpenBSD:*:*)
|
sun3:OpenBSD:*:*)
|
||||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
wgrisc:OpenBSD:*:*)
|
|
||||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
|
||||||
exit 0 ;;
|
|
||||||
*:OpenBSD:*:*)
|
*:OpenBSD:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
|
echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
*:ekkoBSD:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
macppc:MirBSD:*:*)
|
||||||
|
echo powerppc-unknown-mirbsd${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
*:MirBSD:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
alpha:OSF1:*:*)
|
alpha:OSF1:*:*)
|
||||||
if test $UNAME_RELEASE = "V4.0"; then
|
case $UNAME_RELEASE in
|
||||||
|
*4.0)
|
||||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
||||||
fi
|
;;
|
||||||
|
*5.*)
|
||||||
|
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
||||||
|
;;
|
||||||
|
esac
|
||||||
# According to Compaq, /usr/sbin/psrinfo has been available on
|
# According to Compaq, /usr/sbin/psrinfo has been available on
|
||||||
# OSF/1 and Tru64 systems produced since 1995. I hope that
|
# OSF/1 and Tru64 systems produced since 1995. I hope that
|
||||||
# covers most systems running today. This code pipes the CPU
|
# covers most systems running today. This code pipes the CPU
|
||||||
@@ -287,14 +301,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
"EV7.9 (21364A)")
|
"EV7.9 (21364A)")
|
||||||
UNAME_MACHINE="alphaev79" ;;
|
UNAME_MACHINE="alphaev79" ;;
|
||||||
esac
|
esac
|
||||||
|
# A Pn.n version is a patched version.
|
||||||
# A Vn.n version is a released version.
|
# A Vn.n version is a released version.
|
||||||
# A Tn.n version is a released field test version.
|
# A Tn.n version is a released field test version.
|
||||||
# A Xn.n version is an unreleased experimental baselevel.
|
# A Xn.n version is an unreleased experimental baselevel.
|
||||||
# 1.2 uses "1.2" for uname -r.
|
# 1.2 uses "1.2" for uname -r.
|
||||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||||
exit 0 ;;
|
|
||||||
Alpha*:OpenVMS:*:*)
|
|
||||||
echo alpha-hp-vms
|
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
Alpha\ *:Windows_NT*:*)
|
Alpha\ *:Windows_NT*:*)
|
||||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||||
@@ -317,6 +329,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
*:OS/390:*:*)
|
*:OS/390:*:*)
|
||||||
echo i370-ibm-openedition
|
echo i370-ibm-openedition
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
*:z/VM:*:*)
|
||||||
|
echo s390-ibm-zvmoe
|
||||||
|
exit 0 ;;
|
||||||
|
*:OS400:*:*)
|
||||||
|
echo powerpc-ibm-os400
|
||||||
|
exit 0 ;;
|
||||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||||
exit 0;;
|
exit 0;;
|
||||||
@@ -337,7 +355,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
DRS?6000:unix:4.0:6*)
|
DRS?6000:unix:4.0:6*)
|
||||||
echo sparc-icl-nx6
|
echo sparc-icl-nx6
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
DRS?6000:UNIX_SV:4.2*:7*)
|
DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
|
||||||
case `/usr/bin/uname -p` in
|
case `/usr/bin/uname -p` in
|
||||||
sparc) echo sparc-icl-nx7 && exit 0 ;;
|
sparc) echo sparc-icl-nx7 && exit 0 ;;
|
||||||
esac ;;
|
esac ;;
|
||||||
@@ -409,6 +427,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
||||||
echo m68k-unknown-mint${UNAME_RELEASE}
|
echo m68k-unknown-mint${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
m68k:machten:*:*)
|
||||||
|
echo m68k-apple-machten${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
powerpc:machten:*:*)
|
powerpc:machten:*:*)
|
||||||
echo powerpc-apple-machten${UNAME_RELEASE}
|
echo powerpc-apple-machten${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
@@ -744,7 +765,7 @@ EOF
|
|||||||
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*:UNICOS/mp:*:*)
|
*:UNICOS/mp:*:*)
|
||||||
echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
||||||
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||||
@@ -752,6 +773,11 @@ EOF
|
|||||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||||
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
5000:UNIX_System_V:4.*:*)
|
||||||
|
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||||
|
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
||||||
|
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||||
|
exit 0 ;;
|
||||||
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
@@ -761,22 +787,8 @@ EOF
|
|||||||
*:BSD/OS:*:*)
|
*:BSD/OS:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*:FreeBSD:*:*|*:GNU/FreeBSD:*:*)
|
*:FreeBSD:*:*)
|
||||||
# Determine whether the default compiler uses glibc.
|
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||||
eval $set_cc_for_build
|
|
||||||
sed 's/^ //' << EOF >$dummy.c
|
|
||||||
#include <features.h>
|
|
||||||
#if __GLIBC__ >= 2
|
|
||||||
LIBC=gnu
|
|
||||||
#else
|
|
||||||
LIBC=
|
|
||||||
#endif
|
|
||||||
EOF
|
|
||||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
|
|
||||||
# GNU/FreeBSD systems have a "k" prefix to indicate we are using
|
|
||||||
# FreeBSD's kernel, but not the complete OS.
|
|
||||||
case ${LIBC} in gnu) kernel_only='k' ;; esac
|
|
||||||
echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
|
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
i*:CYGWIN*:*)
|
i*:CYGWIN*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-cygwin
|
echo ${UNAME_MACHINE}-pc-cygwin
|
||||||
@@ -802,6 +814,9 @@ EOF
|
|||||||
i*:UWIN*:*)
|
i*:UWIN*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-uwin
|
echo ${UNAME_MACHINE}-pc-uwin
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
amd64:CYGWIN*:*:*)
|
||||||
|
echo x86_64-unknown-cygwin
|
||||||
|
exit 0 ;;
|
||||||
p*:CYGWIN*:*)
|
p*:CYGWIN*:*)
|
||||||
echo powerpcle-unknown-cygwin
|
echo powerpcle-unknown-cygwin
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
@@ -809,8 +824,13 @@ EOF
|
|||||||
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*:GNU:*:*)
|
*:GNU:*:*)
|
||||||
|
# the GNU system
|
||||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
*:GNU/*:*:*)
|
||||||
|
# other systems with GNU libc and userland
|
||||||
|
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
|
||||||
|
exit 0 ;;
|
||||||
i*86:Minix:*:*)
|
i*86:Minix:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-minix
|
echo ${UNAME_MACHINE}-pc-minix
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
@@ -820,9 +840,18 @@ EOF
|
|||||||
cris:Linux:*:*)
|
cris:Linux:*:*)
|
||||||
echo cris-axis-linux
|
echo cris-axis-linux
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
crisv32:Linux:*:*)
|
||||||
|
echo crisv32-axis-linux
|
||||||
|
exit 0 ;;
|
||||||
|
frv:Linux:*:*)
|
||||||
|
echo frv-${VENDOR}-linux
|
||||||
|
exit 0 ;;
|
||||||
ia64:Linux:*:*)
|
ia64:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-${VENDOR}-linux
|
echo ${UNAME_MACHINE}-${VENDOR}-linux
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
m32r*:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-${VENDOR}-linux
|
||||||
|
exit 0 ;;
|
||||||
m68*:Linux:*:*)
|
m68*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-${VENDOR}-linux
|
echo ${UNAME_MACHINE}-${VENDOR}-linux
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
@@ -958,6 +987,9 @@ EOF
|
|||||||
LIBC=gnuaout
|
LIBC=gnuaout
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __dietlibc__
|
||||||
|
LIBC=dietlibc
|
||||||
|
#endif
|
||||||
EOF
|
EOF
|
||||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
|
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
|
||||||
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0
|
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0
|
||||||
@@ -988,6 +1020,9 @@ EOF
|
|||||||
i*86:atheos:*:*)
|
i*86:atheos:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-atheos
|
echo ${UNAME_MACHINE}-unknown-atheos
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
i*86:syllable:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-pc-syllable
|
||||||
|
exit 0 ;;
|
||||||
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
|
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
|
||||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
@@ -1057,9 +1092,9 @@ EOF
|
|||||||
M680?0:D-NIX:5.3:*)
|
M680?0:D-NIX:5.3:*)
|
||||||
echo m68k-diab-dnix
|
echo m68k-diab-dnix
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
M68*:*:R3V[567]*:*)
|
M68*:*:R3V[5678]*:*)
|
||||||
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
|
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
|
||||||
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
|
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
|
||||||
OS_REL=''
|
OS_REL=''
|
||||||
test -r /etc/.relid \
|
test -r /etc/.relid \
|
||||||
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
|
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
|
||||||
@@ -1157,9 +1192,10 @@ EOF
|
|||||||
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
|
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*:Darwin:*:*)
|
*:Darwin:*:*)
|
||||||
case `uname -p` in
|
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
||||||
|
case $UNAME_PROCESSOR in
|
||||||
*86) UNAME_PROCESSOR=i686 ;;
|
*86) UNAME_PROCESSOR=i686 ;;
|
||||||
powerpc) UNAME_PROCESSOR=powerpc ;;
|
unknown) UNAME_PROCESSOR=powerpc ;;
|
||||||
esac
|
esac
|
||||||
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
@@ -1174,7 +1210,10 @@ EOF
|
|||||||
*:QNX:*:4*)
|
*:QNX:*:4*)
|
||||||
echo i386-pc-qnx
|
echo i386-pc-qnx
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
|
NSE-?:NONSTOP_KERNEL:*:*)
|
||||||
|
echo nse-tandem-nsk${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
NSR-?:NONSTOP_KERNEL:*:*)
|
||||||
echo nsr-tandem-nsk${UNAME_RELEASE}
|
echo nsr-tandem-nsk${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*:NonStop-UX:*:*)
|
*:NonStop-UX:*:*)
|
||||||
@@ -1218,6 +1257,19 @@ EOF
|
|||||||
SEI:*:*:SEIUX)
|
SEI:*:*:SEIUX)
|
||||||
echo mips-sei-seiux${UNAME_RELEASE}
|
echo mips-sei-seiux${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
*:DragonFly:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||||
|
exit 0 ;;
|
||||||
|
*:*VMS:*:*)
|
||||||
|
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
||||||
|
case "${UNAME_MACHINE}" in
|
||||||
|
A*) echo alpha-dec-vms && exit 0 ;;
|
||||||
|
I*) echo ia64-dec-vms && exit 0 ;;
|
||||||
|
V*) echo vax-dec-vms && exit 0 ;;
|
||||||
|
esac ;;
|
||||||
|
*:XENIX:*:SysV)
|
||||||
|
echo i386-pc-xenix
|
||||||
|
exit 0 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||||
|
|||||||
@@ -1,11 +1,21 @@
|
|||||||
/* include/config.h.in. Generated from configure.in by autoheader. */
|
/* config.h.in. Generated from configure.in by autoheader. */
|
||||||
|
|
||||||
/* Define for enable debug info. */
|
/* Define for enable debug info. */
|
||||||
#undef ENABLE_DEBUG
|
#undef ENABLE_DEBUG
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <asm/unaligned.h> header file. */
|
||||||
|
#undef HAVE_ASM_UNALIGNED_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
|
||||||
|
*/
|
||||||
|
#undef HAVE_DIRENT_H
|
||||||
|
|
||||||
/* Define to 1 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
|
#undef HAVE_DOPRNT
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <errno.h> header file. */
|
||||||
|
#undef HAVE_ERRNO_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||||
#undef HAVE_FCNTL_H
|
#undef HAVE_FCNTL_H
|
||||||
|
|
||||||
@@ -33,12 +43,22 @@
|
|||||||
/* Define to 1 if you have the `memset' function. */
|
/* Define to 1 if you have the `memset' function. */
|
||||||
#undef HAVE_MEMSET
|
#undef HAVE_MEMSET
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
|
||||||
|
#undef HAVE_NDIR_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <print.h> header file. */
|
||||||
|
#undef HAVE_PRINT_H
|
||||||
|
|
||||||
/* Define to 1 if you have the `register_printf_function' function. */
|
/* Define to 1 if you have the `register_printf_function' function. */
|
||||||
#undef HAVE_REGISTER_PRINTF_FUNCTION
|
#undef HAVE_REGISTER_PRINTF_FUNCTION
|
||||||
|
|
||||||
/* Define to 1 if you have the `statfs' function. */
|
/* Define to 1 if you have the `statfs' function. */
|
||||||
#undef HAVE_STATFS
|
#undef HAVE_STATFS
|
||||||
|
|
||||||
|
/* Define to 1 if `stat' has the bug that it succeeds when given the
|
||||||
|
zero-length file name argument. */
|
||||||
|
#undef HAVE_STAT_EMPTY_STRING_BUG
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdint.h> header file. */
|
/* Define to 1 if you have the <stdint.h> header file. */
|
||||||
#undef HAVE_STDINT_H
|
#undef HAVE_STDINT_H
|
||||||
|
|
||||||
@@ -70,9 +90,17 @@
|
|||||||
`HAVE_STRUCT_STAT_ST_RDEV' instead. */
|
`HAVE_STRUCT_STAT_ST_RDEV' instead. */
|
||||||
#undef HAVE_ST_RDEV
|
#undef HAVE_ST_RDEV
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
|
||||||
|
*/
|
||||||
|
#undef HAVE_SYS_DIR_H
|
||||||
|
|
||||||
/* Define to 1 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
|
#undef HAVE_SYS_IOCTL_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
|
||||||
|
*/
|
||||||
|
#undef HAVE_SYS_NDIR_H
|
||||||
|
|
||||||
/* Define to 1 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
|
#undef HAVE_SYS_STAT_H
|
||||||
|
|
||||||
@@ -97,6 +125,10 @@
|
|||||||
/* gets set when configure --enable-io-failure-emulation */
|
/* gets set when configure --enable-io-failure-emulation */
|
||||||
#undef IO_FAILURE_EMULATION
|
#undef IO_FAILURE_EMULATION
|
||||||
|
|
||||||
|
/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
|
||||||
|
slash. */
|
||||||
|
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
|
||||||
|
|
||||||
/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
|
/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
|
||||||
*/
|
*/
|
||||||
#undef MAJOR_IN_MKDEV
|
#undef MAJOR_IN_MKDEV
|
||||||
@@ -135,6 +167,10 @@
|
|||||||
/* Version number of package */
|
/* Version number of package */
|
||||||
#undef VERSION
|
#undef VERSION
|
||||||
|
|
||||||
|
/* Define to 1 if your processor stores words with the most significant byte
|
||||||
|
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||||
|
#undef WORDS_BIGENDIAN
|
||||||
|
|
||||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||||
#undef _FILE_OFFSET_BITS
|
#undef _FILE_OFFSET_BITS
|
||||||
|
|
||||||
@@ -144,9 +180,11 @@
|
|||||||
/* Define to empty if `const' does not conform to ANSI C. */
|
/* Define to empty if `const' does not conform to ANSI C. */
|
||||||
#undef const
|
#undef const
|
||||||
|
|
||||||
/* Define as `__inline' if that's what the C compiler calls it, or to nothing
|
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||||
if it is not supported. */
|
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||||
|
#ifndef __cplusplus
|
||||||
#undef inline
|
#undef inline
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||||
#undef size_t
|
#undef size_t
|
||||||
Vendored
+92
-30
@@ -1,9 +1,9 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Configuration validation subroutine script.
|
# Configuration validation subroutine script.
|
||||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||||
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||||
|
|
||||||
timestamp='2003-07-04'
|
timestamp='2005-02-10'
|
||||||
|
|
||||||
# This file is (in principle) common to ALL GNU software.
|
# This file is (in principle) common to ALL GNU software.
|
||||||
# The presence of a machine in this file suggests that SOME GNU software
|
# The presence of a machine in this file suggests that SOME GNU software
|
||||||
@@ -70,7 +70,7 @@ Report bugs and patches to <config-patches@gnu.org>."
|
|||||||
version="\
|
version="\
|
||||||
GNU config.sub ($timestamp)
|
GNU config.sub ($timestamp)
|
||||||
|
|
||||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This is free software; see the source for copying conditions. There is NO
|
This is free software; see the source for copying conditions. There is NO
|
||||||
@@ -118,7 +118,8 @@ esac
|
|||||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||||
case $maybe_os in
|
case $maybe_os in
|
||||||
nto-qnx* | linux-gnu* | kfreebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
|
nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
|
||||||
|
kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
|
||||||
os=-$maybe_os
|
os=-$maybe_os
|
||||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||||
;;
|
;;
|
||||||
@@ -144,7 +145,7 @@ case $os in
|
|||||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||||
-apple | -axis)
|
-apple | -axis | -knuth | -cray)
|
||||||
os=
|
os=
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
;;
|
;;
|
||||||
@@ -228,14 +229,15 @@ case $basic_machine in
|
|||||||
| a29k \
|
| a29k \
|
||||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||||
|
| am33_2.0 \
|
||||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
|
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
|
||||||
| c4x | clipper \
|
| c4x | clipper \
|
||||||
| d10v | d30v | dlx | dsp16xx \
|
| d10v | d30v | dlx | dsp16xx \
|
||||||
| fr30 | frv \
|
| fr30 | frv \
|
||||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||||
| i370 | i860 | i960 | ia64 \
|
| i370 | i860 | i960 | ia64 \
|
||||||
| ip2k \
|
| ip2k | iq2000 \
|
||||||
| m32r | m68000 | m68k | m88k | mcore \
|
| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
|
||||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||||
| mips16 \
|
| mips16 \
|
||||||
| mips64 | mips64el \
|
| mips64 | mips64el \
|
||||||
@@ -247,6 +249,7 @@ case $basic_machine in
|
|||||||
| mipsisa32 | mipsisa32el \
|
| mipsisa32 | mipsisa32el \
|
||||||
| mipsisa32r2 | mipsisa32r2el \
|
| mipsisa32r2 | mipsisa32r2el \
|
||||||
| mipsisa64 | mipsisa64el \
|
| mipsisa64 | mipsisa64el \
|
||||||
|
| mipsisa64r2 | mipsisa64r2el \
|
||||||
| mipsisa64sb1 | mipsisa64sb1el \
|
| mipsisa64sb1 | mipsisa64sb1el \
|
||||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||||
| mipstx39 | mipstx39el \
|
| mipstx39 | mipstx39el \
|
||||||
@@ -259,12 +262,12 @@ case $basic_machine in
|
|||||||
| pyramid \
|
| pyramid \
|
||||||
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
|
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
|
||||||
| sh64 | sh64le \
|
| sh64 | sh64le \
|
||||||
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
|
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
|
||||||
| strongarm \
|
| strongarm \
|
||||||
| tahoe | thumb | tic4x | tic80 | tron \
|
| tahoe | thumb | tic4x | tic80 | tron \
|
||||||
| v850 | v850e \
|
| v850 | v850e \
|
||||||
| we32k \
|
| we32k \
|
||||||
| x86 | xscale | xstormy16 | xtensa \
|
| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
|
||||||
| z8k)
|
| z8k)
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
;;
|
;;
|
||||||
@@ -297,17 +300,17 @@ case $basic_machine in
|
|||||||
| avr-* \
|
| avr-* \
|
||||||
| bs2000-* \
|
| bs2000-* \
|
||||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
||||||
| clipper-* | cydra-* \
|
| clipper-* | craynv-* | cydra-* \
|
||||||
| d10v-* | d30v-* | dlx-* \
|
| d10v-* | d30v-* | dlx-* \
|
||||||
| elxsi-* \
|
| elxsi-* \
|
||||||
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
|
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
|
||||||
| h8300-* | h8500-* \
|
| h8300-* | h8500-* \
|
||||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||||
| i*86-* | i860-* | i960-* | ia64-* \
|
| i*86-* | i860-* | i960-* | ia64-* \
|
||||||
| ip2k-* \
|
| ip2k-* | iq2000-* \
|
||||||
| m32r-* \
|
| m32r-* | m32rle-* \
|
||||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||||
| m88110-* | m88k-* | mcore-* \
|
| m88110-* | m88k-* | maxq-* | mcore-* \
|
||||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||||
| mips16-* \
|
| mips16-* \
|
||||||
| mips64-* | mips64el-* \
|
| mips64-* | mips64el-* \
|
||||||
@@ -319,11 +322,13 @@ case $basic_machine in
|
|||||||
| mipsisa32-* | mipsisa32el-* \
|
| mipsisa32-* | mipsisa32el-* \
|
||||||
| mipsisa32r2-* | mipsisa32r2el-* \
|
| mipsisa32r2-* | mipsisa32r2el-* \
|
||||||
| mipsisa64-* | mipsisa64el-* \
|
| mipsisa64-* | mipsisa64el-* \
|
||||||
|
| mipsisa64r2-* | mipsisa64r2el-* \
|
||||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||||
| mipstx39-* | mipstx39el-* \
|
| mipstx39-* | mipstx39el-* \
|
||||||
|
| mmix-* \
|
||||||
| msp430-* \
|
| msp430-* \
|
||||||
| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
|
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||||
| orion-* \
|
| orion-* \
|
||||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||||
@@ -332,14 +337,14 @@ case $basic_machine in
|
|||||||
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
|
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
|
||||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||||
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
|
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
|
||||||
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
|
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
|
||||||
| tahoe-* | thumb-* \
|
| tahoe-* | thumb-* \
|
||||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||||
| tron-* \
|
| tron-* \
|
||||||
| v850-* | v850e-* | vax-* \
|
| v850-* | v850e-* | vax-* \
|
||||||
| we32k-* \
|
| we32k-* \
|
||||||
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
|
| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
|
||||||
| xtensa-* \
|
| xstormy16-* | xtensa-* \
|
||||||
| ymp-* \
|
| ymp-* \
|
||||||
| z8k-*)
|
| z8k-*)
|
||||||
;;
|
;;
|
||||||
@@ -359,6 +364,9 @@ case $basic_machine in
|
|||||||
basic_machine=a29k-amd
|
basic_machine=a29k-amd
|
||||||
os=-udi
|
os=-udi
|
||||||
;;
|
;;
|
||||||
|
abacus)
|
||||||
|
basic_machine=abacus-unknown
|
||||||
|
;;
|
||||||
adobe68k)
|
adobe68k)
|
||||||
basic_machine=m68010-adobe
|
basic_machine=m68010-adobe
|
||||||
os=-scout
|
os=-scout
|
||||||
@@ -376,6 +384,9 @@ case $basic_machine in
|
|||||||
amd64)
|
amd64)
|
||||||
basic_machine=x86_64-pc
|
basic_machine=x86_64-pc
|
||||||
;;
|
;;
|
||||||
|
amd64-*)
|
||||||
|
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
amdahl)
|
amdahl)
|
||||||
basic_machine=580-amdahl
|
basic_machine=580-amdahl
|
||||||
os=-sysv
|
os=-sysv
|
||||||
@@ -435,12 +446,27 @@ case $basic_machine in
|
|||||||
basic_machine=j90-cray
|
basic_machine=j90-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
;;
|
;;
|
||||||
|
craynv)
|
||||||
|
basic_machine=craynv-cray
|
||||||
|
os=-unicosmp
|
||||||
|
;;
|
||||||
|
cr16c)
|
||||||
|
basic_machine=cr16c-unknown
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
crds | unos)
|
crds | unos)
|
||||||
basic_machine=m68k-crds
|
basic_machine=m68k-crds
|
||||||
;;
|
;;
|
||||||
|
crisv32 | crisv32-* | etraxfs*)
|
||||||
|
basic_machine=crisv32-axis
|
||||||
|
;;
|
||||||
cris | cris-* | etrax*)
|
cris | cris-* | etrax*)
|
||||||
basic_machine=cris-axis
|
basic_machine=cris-axis
|
||||||
;;
|
;;
|
||||||
|
crx)
|
||||||
|
basic_machine=crx-unknown
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
da30 | da30-*)
|
da30 | da30-*)
|
||||||
basic_machine=m68k-da30
|
basic_machine=m68k-da30
|
||||||
;;
|
;;
|
||||||
@@ -463,6 +489,10 @@ case $basic_machine in
|
|||||||
basic_machine=m88k-motorola
|
basic_machine=m88k-motorola
|
||||||
os=-sysv3
|
os=-sysv3
|
||||||
;;
|
;;
|
||||||
|
djgpp)
|
||||||
|
basic_machine=i586-pc
|
||||||
|
os=-msdosdjgpp
|
||||||
|
;;
|
||||||
dpx20 | dpx20-*)
|
dpx20 | dpx20-*)
|
||||||
basic_machine=rs6000-bull
|
basic_machine=rs6000-bull
|
||||||
os=-bosx
|
os=-bosx
|
||||||
@@ -641,10 +671,6 @@ case $basic_machine in
|
|||||||
mips3*)
|
mips3*)
|
||||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||||
;;
|
;;
|
||||||
mmix*)
|
|
||||||
basic_machine=mmix-knuth
|
|
||||||
os=-mmixware
|
|
||||||
;;
|
|
||||||
monitor)
|
monitor)
|
||||||
basic_machine=m68k-rom68k
|
basic_machine=m68k-rom68k
|
||||||
os=-coff
|
os=-coff
|
||||||
@@ -725,10 +751,6 @@ case $basic_machine in
|
|||||||
np1)
|
np1)
|
||||||
basic_machine=np1-gould
|
basic_machine=np1-gould
|
||||||
;;
|
;;
|
||||||
nv1)
|
|
||||||
basic_machine=nv1-cray
|
|
||||||
os=-unicosmp
|
|
||||||
;;
|
|
||||||
nsr-tandem)
|
nsr-tandem)
|
||||||
basic_machine=nsr-tandem
|
basic_machine=nsr-tandem
|
||||||
;;
|
;;
|
||||||
@@ -740,6 +762,10 @@ case $basic_machine in
|
|||||||
basic_machine=or32-unknown
|
basic_machine=or32-unknown
|
||||||
os=-coff
|
os=-coff
|
||||||
;;
|
;;
|
||||||
|
os400)
|
||||||
|
basic_machine=powerpc-ibm
|
||||||
|
os=-os400
|
||||||
|
;;
|
||||||
OSE68000 | ose68000)
|
OSE68000 | ose68000)
|
||||||
basic_machine=m68000-ericsson
|
basic_machine=m68000-ericsson
|
||||||
os=-ose
|
os=-ose
|
||||||
@@ -960,6 +986,10 @@ case $basic_machine in
|
|||||||
tower | tower-32)
|
tower | tower-32)
|
||||||
basic_machine=m68k-ncr
|
basic_machine=m68k-ncr
|
||||||
;;
|
;;
|
||||||
|
tpf)
|
||||||
|
basic_machine=s390x-ibm
|
||||||
|
os=-tpf
|
||||||
|
;;
|
||||||
udi29k)
|
udi29k)
|
||||||
basic_machine=a29k-amd
|
basic_machine=a29k-amd
|
||||||
os=-udi
|
os=-udi
|
||||||
@@ -1003,6 +1033,10 @@ case $basic_machine in
|
|||||||
basic_machine=hppa1.1-winbond
|
basic_machine=hppa1.1-winbond
|
||||||
os=-proelf
|
os=-proelf
|
||||||
;;
|
;;
|
||||||
|
xbox)
|
||||||
|
basic_machine=i686-pc
|
||||||
|
os=-mingw32
|
||||||
|
;;
|
||||||
xps | xps100)
|
xps | xps100)
|
||||||
basic_machine=xps100-honeywell
|
basic_machine=xps100-honeywell
|
||||||
;;
|
;;
|
||||||
@@ -1033,6 +1067,9 @@ case $basic_machine in
|
|||||||
romp)
|
romp)
|
||||||
basic_machine=romp-ibm
|
basic_machine=romp-ibm
|
||||||
;;
|
;;
|
||||||
|
mmix)
|
||||||
|
basic_machine=mmix-knuth
|
||||||
|
;;
|
||||||
rs6000)
|
rs6000)
|
||||||
basic_machine=rs6000-ibm
|
basic_machine=rs6000-ibm
|
||||||
;;
|
;;
|
||||||
@@ -1055,7 +1092,7 @@ case $basic_machine in
|
|||||||
sh64)
|
sh64)
|
||||||
basic_machine=sh64-unknown
|
basic_machine=sh64-unknown
|
||||||
;;
|
;;
|
||||||
sparc | sparcv9 | sparcv9b)
|
sparc | sparcv8 | sparcv9 | sparcv9b)
|
||||||
basic_machine=sparc-sun
|
basic_machine=sparc-sun
|
||||||
;;
|
;;
|
||||||
cydra)
|
cydra)
|
||||||
@@ -1128,19 +1165,20 @@ case $os in
|
|||||||
| -aos* \
|
| -aos* \
|
||||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \
|
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
|
||||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||||
|
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||||
| -chorusos* | -chorusrdb* \
|
| -chorusos* | -chorusrdb* \
|
||||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||||
| -mingw32* | -linux* | -uxpv* | -beos* | -mpeix* | -udk* \
|
| -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei*)
|
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
|
||||||
# Remember, each alternative MUST END IN *, to match a version number.
|
# Remember, each alternative MUST END IN *, to match a version number.
|
||||||
;;
|
;;
|
||||||
-qnx*)
|
-qnx*)
|
||||||
@@ -1164,6 +1202,9 @@ case $os in
|
|||||||
-mac*)
|
-mac*)
|
||||||
os=`echo $os | sed -e 's|mac|macos|'`
|
os=`echo $os | sed -e 's|mac|macos|'`
|
||||||
;;
|
;;
|
||||||
|
-linux-dietlibc)
|
||||||
|
os=-linux-dietlibc
|
||||||
|
;;
|
||||||
-sunos5*)
|
-sunos5*)
|
||||||
os=`echo $os | sed -e 's|sunos5|solaris2|'`
|
os=`echo $os | sed -e 's|sunos5|solaris2|'`
|
||||||
;;
|
;;
|
||||||
@@ -1173,6 +1214,9 @@ case $os in
|
|||||||
-opened*)
|
-opened*)
|
||||||
os=-openedition
|
os=-openedition
|
||||||
;;
|
;;
|
||||||
|
-os400*)
|
||||||
|
os=-os400
|
||||||
|
;;
|
||||||
-wince*)
|
-wince*)
|
||||||
os=-wince
|
os=-wince
|
||||||
;;
|
;;
|
||||||
@@ -1194,6 +1238,9 @@ case $os in
|
|||||||
-atheos*)
|
-atheos*)
|
||||||
os=-atheos
|
os=-atheos
|
||||||
;;
|
;;
|
||||||
|
-syllable*)
|
||||||
|
os=-syllable
|
||||||
|
;;
|
||||||
-386bsd)
|
-386bsd)
|
||||||
os=-bsd
|
os=-bsd
|
||||||
;;
|
;;
|
||||||
@@ -1216,6 +1263,9 @@ case $os in
|
|||||||
-sinix*)
|
-sinix*)
|
||||||
os=-sysv4
|
os=-sysv4
|
||||||
;;
|
;;
|
||||||
|
-tpf*)
|
||||||
|
os=-tpf
|
||||||
|
;;
|
||||||
-triton*)
|
-triton*)
|
||||||
os=-sysv3
|
os=-sysv3
|
||||||
;;
|
;;
|
||||||
@@ -1252,6 +1302,9 @@ case $os in
|
|||||||
-kaos*)
|
-kaos*)
|
||||||
os=-kaos
|
os=-kaos
|
||||||
;;
|
;;
|
||||||
|
-zvmoe)
|
||||||
|
os=-zvmoe
|
||||||
|
;;
|
||||||
-none)
|
-none)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -1332,6 +1385,9 @@ case $basic_machine in
|
|||||||
*-ibm)
|
*-ibm)
|
||||||
os=-aix
|
os=-aix
|
||||||
;;
|
;;
|
||||||
|
*-knuth)
|
||||||
|
os=-mmixware
|
||||||
|
;;
|
||||||
*-wec)
|
*-wec)
|
||||||
os=-proelf
|
os=-proelf
|
||||||
;;
|
;;
|
||||||
@@ -1464,9 +1520,15 @@ case $basic_machine in
|
|||||||
-mvs* | -opened*)
|
-mvs* | -opened*)
|
||||||
vendor=ibm
|
vendor=ibm
|
||||||
;;
|
;;
|
||||||
|
-os400*)
|
||||||
|
vendor=ibm
|
||||||
|
;;
|
||||||
-ptx*)
|
-ptx*)
|
||||||
vendor=sequent
|
vendor=sequent
|
||||||
;;
|
;;
|
||||||
|
-tpf*)
|
||||||
|
vendor=ibm
|
||||||
|
;;
|
||||||
-vxsim* | -vxworks* | -windiss*)
|
-vxsim* | -vxworks* | -windiss*)
|
||||||
vendor=wrs
|
vendor=wrs
|
||||||
;;
|
;;
|
||||||
|
|||||||
+84
-27
@@ -1,41 +1,87 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
AC_INIT(version.h)
|
AC_INIT(include/reiserfs/libreiserfs.h)
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
AC_PREREQ(2.50)
|
AC_PREREQ(2.50)
|
||||||
|
|
||||||
|
AH_TEMPLATE([PACKAGE], [Define this to be the name of the package.])
|
||||||
|
AH_TEMPLATE([VERSION], [Define to the version of the package.])
|
||||||
AH_TEMPLATE([HAVE_LIBUUID], [Define for enable libuuid using.])
|
AH_TEMPLATE([HAVE_LIBUUID], [Define for enable libuuid using.])
|
||||||
AH_TEMPLATE([ENABLE_DEBUG], [Define for enable debug info.])
|
AH_TEMPLATE([ENABLE_DEBUG], [Define for enable debug info.])
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE(reiserfsprogs, 3.6.19)
|
dnl AH_TEMPLATE([LIBREISERFS_MAX_INTERFACE_VERSION], [Define to the max interface version.])
|
||||||
|
dnl AH_TEMPLATE([LIBREISERFS_MIN_INTERFACE_VERSION], [Define to the min interface version.])
|
||||||
|
|
||||||
|
LIBREISERFS_MAJOR_VERSION=3
|
||||||
|
LIBREISERFS_MINOR_VERSION=6
|
||||||
|
LIBREISERFS_MICRO_VERSION=20
|
||||||
|
LIBREISERFS_VERSION=$LIBREISERFS_MAJOR_VERSION.$LIBREISERFS_MINOR_VERSION.$LIBREISERFS_MICRO_VERSION
|
||||||
|
|
||||||
|
dnl LIBREISERFS_INTERFACE_AGE=0
|
||||||
|
dnl LIBREISERFS_BINARY_AGE=0
|
||||||
|
|
||||||
|
dnl LT_RELEASE=$LIBREISERFS_MAJOR_VERSION.$LIBREISERFS_MINOR_VERSION
|
||||||
|
|
||||||
|
dnl LT_CURRENT=`expr $LIBREISERFS_MICRO_VERSION - $LIBREISERFS_INTERFACE_AGE`
|
||||||
|
dnl LT_REVISION=$LIBREISERFS_INTERFACE_AGE
|
||||||
|
dnl LT_AGE=`expr $LIBREISERFS_BINARY_AGE - $LIBREISERFS_INTERFACE_AGE`
|
||||||
|
|
||||||
|
PACKAGE=reiserfsprogs
|
||||||
|
VERSION=$LIBREISERFS_VERSION
|
||||||
|
|
||||||
|
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
|
||||||
|
AM_CONFIG_HEADER(config.h)
|
||||||
AM_MAINTAINER_MODE
|
AM_MAINTAINER_MODE
|
||||||
|
|
||||||
|
dnl AC_DEFINE_UNQUOTED(LIBREISERFS_MAX_INTERFACE_VERSION, $LIBREISERFS_BINARY_AGE)
|
||||||
|
dnl AC_DEFINE_UNQUOTED(LIBREISERFS_MIN_INTERFACE_VERSION, $LIBREISERFS_INTERFACE_AGE)
|
||||||
|
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(debug,
|
||||||
|
[ --enable-debug enable extra checks], ,
|
||||||
|
enable_debug=no
|
||||||
|
)
|
||||||
|
|
||||||
|
PROGS_LDFLAGS=""
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(static,
|
||||||
|
[ --enable-static build all static], ,
|
||||||
|
enable_static=no
|
||||||
|
)
|
||||||
|
|
||||||
|
if test x$enable_static = xyes; then
|
||||||
|
PROGS_LDFLAGS=-static
|
||||||
|
fi
|
||||||
|
|
||||||
dnl We install in /sbin, the utils are to be available on boot
|
dnl We install in /sbin, the utils are to be available on boot
|
||||||
dnl AC_PREFIX(/)
|
dnl AC_PREFIX(/)
|
||||||
|
|
||||||
AM_CONFIG_HEADER(include/config.h)
|
|
||||||
|
|
||||||
AC_SUBST(sbindir)
|
|
||||||
|
|
||||||
PRESET_CFLAGS=$CFLAGS
|
PRESET_CFLAGS=$CFLAGS
|
||||||
|
|
||||||
dnl Checks for programs.
|
dnl Checks for programs.
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
AC_PROG_CPP
|
||||||
AC_PROG_AWK
|
AC_PROG_AWK
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
|
|
||||||
|
AM_ENABLE_SHARED
|
||||||
|
dnl AM_PROG_LIBTOOL
|
||||||
|
|
||||||
dnl Checks for libraries.
|
dnl Checks for libraries.
|
||||||
|
|
||||||
# Check for LIBUUID
|
# Check for LIBUUID
|
||||||
|
LIBS=""
|
||||||
AC_CHECK_LIB(uuid, uuid_generate, , AC_MSG_WARN(libuuid could not be found))
|
AC_CHECK_LIB(uuid, uuid_generate, , AC_MSG_WARN(libuuid could not be found))
|
||||||
UUID_LIBS="$LIBS"
|
UUID_LIBS="$LIBS"
|
||||||
AC_SUBST(UUID_LIBS)
|
|
||||||
|
|
||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/ioctl.h unistd.h uuid/uuid.h)
|
AC_HEADER_DIRENT
|
||||||
|
AC_CHECK_HEADERS(print.h errno.h fcntl.h limits.h malloc.h sys/ioctl.h unistd.h uuid/uuid.h)
|
||||||
|
AC_CHECK_HEADERS([asm/unaligned.h])
|
||||||
|
|
||||||
AC_HEADER_MAJOR
|
AC_HEADER_MAJOR
|
||||||
|
|
||||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||||
@@ -43,11 +89,7 @@ AC_C_CONST
|
|||||||
AC_C_INLINE
|
AC_C_INLINE
|
||||||
AC_TYPE_SIZE_T
|
AC_TYPE_SIZE_T
|
||||||
AC_STRUCT_ST_RDEV
|
AC_STRUCT_ST_RDEV
|
||||||
|
AC_C_BIGENDIAN
|
||||||
AC_ARG_ENABLE(debug, [ --enable-debug enable extra checks],
|
|
||||||
enable_debug=yes,
|
|
||||||
enable_debug=no
|
|
||||||
)
|
|
||||||
|
|
||||||
dnl Check for the compiler pic option.
|
dnl Check for the compiler pic option.
|
||||||
AC_CACHE_CHECK([whether -fPIC works], [pic], [
|
AC_CACHE_CHECK([whether -fPIC works], [pic], [
|
||||||
@@ -82,7 +124,7 @@ AC_CACHE_CHECK([whether -Wredundant-decls works], [redundant_decls], [
|
|||||||
# Check for large file
|
# Check for large file
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
|
|
||||||
if test -z "${ac_cv_sys_file_offset_bits}"; then
|
if test x${ac_cv_sys_file_offset_bits} = xno; then
|
||||||
AC_MSG_WARN(Can't detect right _FILE_OFFSET_BITS. Will be forced to 64bit.)
|
AC_MSG_WARN(Can't detect right _FILE_OFFSET_BITS. Will be forced to 64bit.)
|
||||||
ac_cv_sys_file_offset_bits=64
|
ac_cv_sys_file_offset_bits=64
|
||||||
fi
|
fi
|
||||||
@@ -101,6 +143,7 @@ AC_CHECK_SIZEOF(blkcnt_t, 64, [
|
|||||||
|
|
||||||
dnl Checks for library functions.
|
dnl Checks for library functions.
|
||||||
AC_PROG_GCC_TRADITIONAL
|
AC_PROG_GCC_TRADITIONAL
|
||||||
|
AC_FUNC_STAT
|
||||||
AC_FUNC_MEMCMP
|
AC_FUNC_MEMCMP
|
||||||
AC_FUNC_STRFTIME
|
AC_FUNC_STRFTIME
|
||||||
AC_FUNC_VPRINTF
|
AC_FUNC_VPRINTF
|
||||||
@@ -117,7 +160,7 @@ AC_ARG_ENABLE(io-failure-emulation,
|
|||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
credits="./CREDITS"
|
credits="$srcdir/CREDITS"
|
||||||
AC_MSG_CHECKING(for $credits)
|
AC_MSG_CHECKING(for $credits)
|
||||||
if test -r $credits ; then
|
if test -r $credits ; then
|
||||||
AC_MSG_RESULT(yes)
|
AC_MSG_RESULT(yes)
|
||||||
@@ -150,7 +193,7 @@ BEGIN {in_header = 1; start = 2; count = 0}
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
END { print "\n};\n#define CREDITS_COUNT " count }
|
END { print "\n};\n#define CREDITS_COUNT " count }
|
||||||
'] $credits > include/credits.h
|
'] $credits > "$srcdir/include/util/credits.h"
|
||||||
|
|
||||||
if test x$enable_debug = xyes; then
|
if test x$enable_debug = xyes; then
|
||||||
if test "x" = "x$PRESET_CFLAGS"; then
|
if test "x" = "x$PRESET_CFLAGS"; then
|
||||||
@@ -170,11 +213,11 @@ if test x$enable_debug = xyes; then
|
|||||||
if test x$uninitialized = xyes; then
|
if test x$uninitialized = xyes; then
|
||||||
CFLAGS="$CFLAGS -Wuninitialized -O1"
|
CFLAGS="$CFLAGS -Wuninitialized -O1"
|
||||||
else
|
else
|
||||||
CFLAGS="$CFLAGS -O2"
|
CFLAGS="$CFLAGS -O0"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if test "x" = "x$PRESET_CFLAGS"; then
|
if test "x" = "x$PRESET_CFLAGS"; then
|
||||||
CFLAGS="-g -Wall -O2"
|
CFLAGS="-Wall -O2"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -182,16 +225,30 @@ if test x$pic = xyes; then
|
|||||||
CFLAGS="$CFLAGS -fPIC -DPIC"
|
CFLAGS="$CFLAGS -fPIC -DPIC"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl AC_SUBST(LT_RELEASE)
|
||||||
|
dnl AC_SUBST(LT_CURRENT)
|
||||||
|
dnl AC_SUBST(LT_REVISION)
|
||||||
|
dnl AC_SUBST(LT_AGE)
|
||||||
|
|
||||||
|
AC_SUBST(UUID_LIBS)
|
||||||
|
AC_SUBST(PROGS_LDFLAGS)
|
||||||
|
|
||||||
AC_OUTPUT(
|
AC_OUTPUT(
|
||||||
include/Makefile
|
|
||||||
mkreiserfs/Makefile
|
|
||||||
resize_reiserfs/Makefile
|
|
||||||
fsck/Makefile
|
|
||||||
lib/Makefile
|
|
||||||
Makefile
|
Makefile
|
||||||
reiserfscore/Makefile
|
include/Makefile
|
||||||
debugreiserfs/Makefile
|
include/misc/Makefile
|
||||||
tune/Makefile)
|
include/reiserfs/Makefile
|
||||||
|
include/util/Makefile
|
||||||
|
libmisc/Makefile
|
||||||
|
libreiserfs/Makefile
|
||||||
|
libutil/Makefile
|
||||||
|
utils/Makefile
|
||||||
|
utils/mkfs/Makefile
|
||||||
|
utils/resizer/Makefile
|
||||||
|
utils/fsck/Makefile
|
||||||
|
utils/debugfs/Makefile
|
||||||
|
utils/tune/Makefile
|
||||||
|
reiserfsprogs.spec)
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo Type \'make\' to compile reiserfsprogs
|
echo Type \'make\' to compile reiserfsprogs and \'make install\' to install it.
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
sbin_PROGRAMS = debugreiserfs
|
|
||||||
|
|
||||||
debugreiserfs_SOURCES = debugreiserfs.c pack.c unpack.c stat.c corruption.c scan.c recover.c debugreiserfs.h
|
|
||||||
man_MANS = debugreiserfs.8
|
|
||||||
EXTRA_DIST = $(man_MANS)
|
|
||||||
|
|
||||||
LDADD = $(top_srcdir)/lib/libmisc.a $(top_srcdir)/reiserfscore/libcore.a
|
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,7 +1,9 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# depcomp - compile a program generating dependencies as side-effects
|
# depcomp - compile a program generating dependencies as side-effects
|
||||||
# Copyright 1999, 2000 Free Software Foundation, Inc.
|
|
||||||
|
scriptversion=2005-02-09.22
|
||||||
|
|
||||||
|
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -25,22 +27,45 @@
|
|||||||
|
|
||||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
'')
|
||||||
|
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||||
|
exit 1;
|
||||||
|
;;
|
||||||
|
-h | --h*)
|
||||||
|
cat <<\EOF
|
||||||
|
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||||
|
|
||||||
|
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||||
|
as side-effects.
|
||||||
|
|
||||||
|
Environment variables:
|
||||||
|
depmode Dependency tracking mode.
|
||||||
|
source Source file read by `PROGRAMS ARGS'.
|
||||||
|
object Object file output by `PROGRAMS ARGS'.
|
||||||
|
DEPDIR directory where to store dependencies.
|
||||||
|
depfile Dependency file to output.
|
||||||
|
tmpdepfile Temporary file to use when outputing dependencies.
|
||||||
|
libtool Whether libtool is used (yes/no).
|
||||||
|
|
||||||
|
Report bugs to <bug-automake@gnu.org>.
|
||||||
|
EOF
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
-v | --v*)
|
||||||
|
echo "depcomp $scriptversion"
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
|
||||||
|
|
||||||
|
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||||
|
depfile=${depfile-`echo "$object" |
|
||||||
|
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||||
|
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
@@ -172,19 +197,25 @@ sgi)
|
|||||||
|
|
||||||
aix)
|
aix)
|
||||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||||
# in a .u file. This file always lives in the current directory.
|
# in a .u file. In older versions, this file always lives in the
|
||||||
# Also, the AIX compiler puts `$object:' at the start of each line;
|
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||||
# $object doesn't have directory information.
|
# start of each line; $object doesn't have directory information.
|
||||||
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
|
# Version 6 uses the directory in both cases.
|
||||||
|
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
|
||||||
tmpdepfile="$stripped.u"
|
tmpdepfile="$stripped.u"
|
||||||
outname="$stripped.o"
|
|
||||||
if test "$libtool" = yes; then
|
if test "$libtool" = yes; then
|
||||||
"$@" -Wc,-M
|
"$@" -Wc,-M
|
||||||
else
|
else
|
||||||
"$@" -M
|
"$@" -M
|
||||||
fi
|
fi
|
||||||
|
|
||||||
stat=$?
|
stat=$?
|
||||||
|
|
||||||
|
if test -f "$tmpdepfile"; then :
|
||||||
|
else
|
||||||
|
stripped=`echo "$stripped" | sed 's,^.*/,,'`
|
||||||
|
tmpdepfile="$stripped.u"
|
||||||
|
fi
|
||||||
|
|
||||||
if test $stat -eq 0; then :
|
if test $stat -eq 0; then :
|
||||||
else
|
else
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
@@ -192,6 +223,7 @@ aix)
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if test -f "$tmpdepfile"; then
|
if test -f "$tmpdepfile"; then
|
||||||
|
outname="$stripped.o"
|
||||||
# Each line is of the form `foo.o: dependent.h'.
|
# Each line is of the form `foo.o: dependent.h'.
|
||||||
# Do two passes, one to just change these to
|
# Do two passes, one to just change these to
|
||||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||||
@@ -255,30 +287,46 @@ tru64)
|
|||||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||||
|
|
||||||
if test "$libtool" = yes; then
|
if test "$libtool" = yes; then
|
||||||
tmpdepfile1="$dir.libs/$base.lo.d"
|
# With Tru64 cc, shared objects can also be used to make a
|
||||||
tmpdepfile2="$dir.libs/$base.d"
|
# static library. This mecanism is used in libtool 1.4 series to
|
||||||
|
# handle both shared and static libraries in a single compilation.
|
||||||
|
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||||
|
#
|
||||||
|
# With libtool 1.5 this exception was removed, and libtool now
|
||||||
|
# generates 2 separate objects for the 2 libraries. These two
|
||||||
|
# compilations output dependencies in in $dir.libs/$base.o.d and
|
||||||
|
# in $dir$base.o.d. We have to check for both files, because
|
||||||
|
# one of the two compilations can be disabled. We should prefer
|
||||||
|
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||||
|
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||||
|
# the former would cause a distcleancheck panic.
|
||||||
|
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||||
|
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||||
|
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||||
|
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||||
"$@" -Wc,-MD
|
"$@" -Wc,-MD
|
||||||
else
|
else
|
||||||
tmpdepfile1="$dir$base.o.d"
|
tmpdepfile1=$dir$base.o.d
|
||||||
tmpdepfile2="$dir$base.d"
|
tmpdepfile2=$dir$base.d
|
||||||
|
tmpdepfile3=$dir$base.d
|
||||||
|
tmpdepfile4=$dir$base.d
|
||||||
"$@" -MD
|
"$@" -MD
|
||||||
fi
|
fi
|
||||||
|
|
||||||
stat=$?
|
stat=$?
|
||||||
if test $stat -eq 0; then :
|
if test $stat -eq 0; then :
|
||||||
else
|
else
|
||||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||||
exit $stat
|
exit $stat
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -f "$tmpdepfile1"; then
|
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||||
tmpdepfile="$tmpdepfile1"
|
do
|
||||||
else
|
test -f "$tmpdepfile" && break
|
||||||
tmpdepfile="$tmpdepfile2"
|
done
|
||||||
fi
|
|
||||||
if test -f "$tmpdepfile"; then
|
if test -f "$tmpdepfile"; then
|
||||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||||
# That's a space and a tab in the [].
|
# That's a tab and a space in the [].
|
||||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||||
else
|
else
|
||||||
echo "#dummy" > "$depfile"
|
echo "#dummy" > "$depfile"
|
||||||
@@ -292,7 +340,7 @@ tru64)
|
|||||||
|
|
||||||
dashmstdout)
|
dashmstdout)
|
||||||
# Important note: in order to support this mode, a compiler *must*
|
# Important note: in order to support this mode, a compiler *must*
|
||||||
# always write the proprocessed file to stdout, regardless of -o.
|
# always write the preprocessed file to stdout, regardless of -o.
|
||||||
"$@" || exit $?
|
"$@" || exit $?
|
||||||
|
|
||||||
# Remove the call to Libtool.
|
# Remove the call to Libtool.
|
||||||
@@ -388,7 +436,7 @@ makedepend)
|
|||||||
|
|
||||||
cpp)
|
cpp)
|
||||||
# Important note: in order to support this mode, a compiler *must*
|
# Important note: in order to support this mode, a compiler *must*
|
||||||
# always write the proprocessed file to stdout.
|
# always write the preprocessed file to stdout.
|
||||||
"$@" || exit $?
|
"$@" || exit $?
|
||||||
|
|
||||||
# Remove the call to Libtool.
|
# Remove the call to Libtool.
|
||||||
@@ -430,7 +478,7 @@ cpp)
|
|||||||
|
|
||||||
msvisualcpp)
|
msvisualcpp)
|
||||||
# Important note: in order to support this mode, a compiler *must*
|
# Important note: in order to support this mode, a compiler *must*
|
||||||
# always write the proprocessed file to stdout, regardless of -o,
|
# always write the preprocessed file to stdout, regardless of -o,
|
||||||
# because we must use -o when running libtool.
|
# because we must use -o when running libtool.
|
||||||
"$@" || exit $?
|
"$@" || exit $?
|
||||||
IFS=" "
|
IFS=" "
|
||||||
@@ -470,3 +518,12 @@ none)
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
# Local Variables:
|
||||||
|
# mode: shell-script
|
||||||
|
# sh-indentation: 2
|
||||||
|
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||||
|
# time-stamp-start: "scriptversion="
|
||||||
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||||
|
# time-stamp-end: "$"
|
||||||
|
# End:
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
||||||
man_MANS = reiserfsck.8
|
|
||||||
EXTRA_DIST = $(man_MANS)
|
|
||||||
|
|
||||||
reiserfsck_LDADD = $(top_srcdir)/lib/libmisc.a $(top_srcdir)/reiserfscore/libcore.a
|
|
||||||
|
|
||||||
@@ -1,483 +0,0 @@
|
|||||||
# Makefile.in generated by automake 1.7.6 from Makefile.am.
|
|
||||||
# @configure_input@
|
|
||||||
|
|
||||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
|
||||||
# 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 = :
|
|
||||||
host_triplet = @host@
|
|
||||||
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@
|
|
||||||
LN_S = @LN_S@
|
|
||||||
LTLIBOBJS = @LTLIBOBJS@
|
|
||||||
MAINT = @MAINT@
|
|
||||||
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
|
||||||
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
|
||||||
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@
|
|
||||||
UUID_LIBS = @UUID_LIBS@
|
|
||||||
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__leading_dot = @am__leading_dot@
|
|
||||||
am__quote = @am__quote@
|
|
||||||
bindir = @bindir@
|
|
||||||
build = @build@
|
|
||||||
build_alias = @build_alias@
|
|
||||||
build_cpu = @build_cpu@
|
|
||||||
build_os = @build_os@
|
|
||||||
build_vendor = @build_vendor@
|
|
||||||
datadir = @datadir@
|
|
||||||
exec_prefix = @exec_prefix@
|
|
||||||
host = @host@
|
|
||||||
host_alias = @host_alias@
|
|
||||||
host_cpu = @host_cpu@
|
|
||||||
host_os = @host_os@
|
|
||||||
host_vendor = @host_vendor@
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
man_MANS = reiserfsck.8
|
|
||||||
EXTRA_DIST = $(man_MANS)
|
|
||||||
|
|
||||||
reiserfsck_LDADD = $(top_srcdir)/lib/libmisc.a $(top_srcdir)/reiserfscore/libcore.a
|
|
||||||
subdir = fsck
|
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
|
||||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
|
||||||
CONFIG_HEADER = $(top_builddir)/include/config.h
|
|
||||||
CONFIG_CLEAN_FILES =
|
|
||||||
sbin_PROGRAMS = reiserfsck$(EXEEXT)
|
|
||||||
PROGRAMS = $(sbin_PROGRAMS)
|
|
||||||
|
|
||||||
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_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) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
|
||||||
DIST_SOURCES = $(reiserfsck_SOURCES)
|
|
||||||
|
|
||||||
NROFF = nroff
|
|
||||||
MANS = $(man_MANS)
|
|
||||||
DIST_COMMON = Makefile.am Makefile.in
|
|
||||||
SOURCES = $(reiserfsck_SOURCES)
|
|
||||||
|
|
||||||
all: all-am
|
|
||||||
|
|
||||||
.SUFFIXES:
|
|
||||||
.SUFFIXES: .c .o .obj
|
|
||||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
|
||||||
cd $(top_srcdir) && \
|
|
||||||
$(AUTOMAKE) --gnu fsck/Makefile
|
|
||||||
Makefile: @MAINTAINER_MODE_TRUE@ $(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)
|
|
||||||
reiserfsck$(EXEEXT): $(reiserfsck_OBJECTS) $(reiserfsck_DEPENDENCIES)
|
|
||||||
@rm -f reiserfsck$(EXEEXT)
|
|
||||||
$(LINK) $(reiserfsck_LDFLAGS) $(reiserfsck_OBJECTS) $(reiserfsck_LDADD) $(LIBS)
|
|
||||||
|
|
||||||
mostlyclean-compile:
|
|
||||||
-rm -f *.$(OBJEXT) core *.core
|
|
||||||
|
|
||||||
distclean-compile:
|
|
||||||
-rm -f *.tab.c
|
|
||||||
|
|
||||||
@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@
|
|
||||||
|
|
||||||
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 -f "$(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 -f "$(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) $(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 \
|
|
||||||
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:
|
|
||||||
@$(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
|
|
||||||
|
|
||||||
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) $(MANS)
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
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-man
|
|
||||||
|
|
||||||
install-exec-am: install-sbinPROGRAMS
|
|
||||||
|
|
||||||
install-info: install-info-am
|
|
||||||
|
|
||||||
install-man: install-man8
|
|
||||||
|
|
||||||
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-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.
|
|
||||||
.NOEXPORT:
|
|
||||||
-1177
File diff suppressed because it is too large.
Load diff
-176
@@ -1,176 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
|
||||||
* reiserfsprogs/README
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "fsck.h"
|
|
||||||
|
|
||||||
|
|
||||||
int fsck_user_confirmed (reiserfs_filsys_t * fs, char * q, char * a, int default_answer)
|
|
||||||
{
|
|
||||||
if (!fsck_interactive (fs))
|
|
||||||
return default_answer;
|
|
||||||
|
|
||||||
return user_confirmed (fsck_progress_file (fs), q, a);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void stage_report (int pass, reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
switch (pass) {
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
struct pass0_stat * stat;
|
|
||||||
|
|
||||||
/* what has been done on pass 0 */
|
|
||||||
stat = pass_0_stat (fs);
|
|
||||||
fsck_progress ("\tRead blocks (but not data blocks) %lu\n", stat->dealt_with);
|
|
||||||
fsck_progress ("\t\tLeaves among those %lu\n", stat->leaves);
|
|
||||||
if (stat->leaves_corrected)
|
|
||||||
fsck_progress ("\t\t\t- corrected leaves %lu\n", stat->leaves_corrected);
|
|
||||||
if (stat->all_contents_removed)
|
|
||||||
fsck_progress ("\t\t\t- leaves all contents of which could not be saved and deleted %lu\n",
|
|
||||||
stat->all_contents_removed);
|
|
||||||
if (stat->too_old_leaves)
|
|
||||||
fsck_progress ("\t\t\t- too old leaves %lu (skipped)\n", stat->too_old_leaves);
|
|
||||||
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)->count);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
struct pass1_stat * stat;
|
|
||||||
|
|
||||||
/* what has been done on pass 1 */
|
|
||||||
stat = pass_1_stat (fs);
|
|
||||||
fsck_progress ("\t%lu leaves read\n", stat->leaves);
|
|
||||||
fsck_progress ("\t\t%lu inserted\n", stat->inserted_leaves);
|
|
||||||
if (stat->pointed_leaves)
|
|
||||||
fsck_progress ("\t\t\t- pointers in indirect items pointing to metadata %lu (zeroed)\n",
|
|
||||||
stat->pointed_leaves);
|
|
||||||
if (stat->saved_items)
|
|
||||||
fsck_progress ("\tSaved %lu items\n", stat->saved_items);
|
|
||||||
if (stat->uninsertable_leaves)
|
|
||||||
fsck_progress ("\t\t%lu not inserted\n", stat->uninsertable_leaves);
|
|
||||||
if (stat->non_unique_pointers)
|
|
||||||
fsck_progress ("\tnon-unique pointers in indirect items (zeroed) %lu\n",
|
|
||||||
stat->non_unique_pointers);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
struct pass2_stat * stat;
|
|
||||||
|
|
||||||
/* what has been done on pass 2 */
|
|
||||||
stat = pass_2_stat (fs);
|
|
||||||
if (stat->leaves)
|
|
||||||
fsck_progress ("\tLeaves inserted item by item %lu\n", stat->leaves);
|
|
||||||
if (stat->safe_non_unique_pointers)
|
|
||||||
fsck_progress ("\t%lu \n",
|
|
||||||
stat->safe_non_unique_pointers);
|
|
||||||
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 with a directory %lu\n",
|
|
||||||
stat->relocated);
|
|
||||||
if (stat->rewritten)
|
|
||||||
fsck_progress ("\tFiles rewritten %lu\n", stat->rewritten);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3: /* semantic */
|
|
||||||
{
|
|
||||||
struct semantic_stat * stat;
|
|
||||||
|
|
||||||
/* what has been done on the semantic pass */
|
|
||||||
stat = sem_pass_stat (fs);
|
|
||||||
fsck_progress ("\tFiles found: %ld\n", stat->regular_files);
|
|
||||||
fsck_progress ("\tDirectories found: %ld\n", stat->directories);
|
|
||||||
if (stat->symlinks)
|
|
||||||
fsck_progress ("\tSymlinks found: %ld\n", stat->symlinks);
|
|
||||||
if (stat->others)
|
|
||||||
fsck_progress ("\tOthers: %ld\n", stat->others);
|
|
||||||
if (stat->broken_files)
|
|
||||||
fsck_progress ("\tBroken (of files/symlinks/others): %ld\n", stat->broken_files);
|
|
||||||
if (stat->fixed_sizes)
|
|
||||||
fsck_progress ("\tFiles with fixed size: %ld\n", stat->fixed_sizes);
|
|
||||||
if (stat->deleted_entries)
|
|
||||||
fsck_progress ("\tNames pointing to nowhere (removed): %ld\n", stat->deleted_entries);
|
|
||||||
if (stat->oid_sharing)
|
|
||||||
fsck_progress ("\tObjects having used objectids: %lu\n", stat->oid_sharing);
|
|
||||||
if (stat->oid_sharing_files_relocated)
|
|
||||||
fsck_progress ("\t\tfiles fixed %lu\n", stat->oid_sharing_files_relocated);
|
|
||||||
if (stat->oid_sharing_dirs_relocated)
|
|
||||||
fsck_progress ("\t\tdirs fixed %lu\n", stat->oid_sharing_dirs_relocated);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x3a: /* lost+found pass */
|
|
||||||
{
|
|
||||||
struct lost_found_stat * stat;
|
|
||||||
|
|
||||||
/* what has been done on the semantic pass */
|
|
||||||
stat = lost_found_pass_stat (fs);
|
|
||||||
if (stat->lost_found)
|
|
||||||
fsck_progress ("\tObjects without names %lu\n",
|
|
||||||
stat->lost_found);
|
|
||||||
if (stat->empty_lost_dirs)
|
|
||||||
fsck_progress ("\tEmpty lost dirs removed %lu\n",
|
|
||||||
stat->empty_lost_dirs);
|
|
||||||
if (stat->lost_found_dirs)
|
|
||||||
fsck_progress ("\tDirs linked to /lost+found: %lu\n",
|
|
||||||
stat->lost_found_dirs);
|
|
||||||
if (stat->dir_recovered)
|
|
||||||
fsck_progress ("\t\tDirs without stat data found %lu\n",
|
|
||||||
stat->dir_recovered);
|
|
||||||
|
|
||||||
if (stat->lost_found_files)
|
|
||||||
fsck_progress ("\tFiles linked to /lost+found %lu\n",
|
|
||||||
stat->lost_found_files);
|
|
||||||
if (stat->oid_sharing)
|
|
||||||
fsck_progress ("\tObjects having used objectids: %lu\n", stat->oid_sharing);
|
|
||||||
if (stat->oid_sharing_files_relocated)
|
|
||||||
fsck_progress ("\t\tfiles fixed %lu\n", stat->oid_sharing_files_relocated);
|
|
||||||
if (stat->oid_sharing_dirs_relocated)
|
|
||||||
fsck_progress ("\t\tdirs fixed %lu\n", stat->oid_sharing_dirs_relocated);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 4: /* removing of unreachable */
|
|
||||||
{
|
|
||||||
struct pass_4_stat * stat;
|
|
||||||
|
|
||||||
/* what has been done on the semantic pass */
|
|
||||||
stat = pass_4_stat (fs);
|
|
||||||
if (stat->deleted_items)
|
|
||||||
fsck_progress ("\tDeleted unreachable items %lu\n",
|
|
||||||
stat->deleted_items);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 5:
|
|
||||||
fsck_progress ("There are on the filesystem:\n"
|
|
||||||
"\tLeaves %lu\n\tInternal nodes %lu\n"
|
|
||||||
"\tDirectories %lu\n\tOther files %lu\n"
|
|
||||||
"\tData block pointers %lu (%lu of them are zero)\n"
|
|
||||||
"\tSafe links %lu\n",
|
|
||||||
fsck_check_stat (fs)->leaves,
|
|
||||||
fsck_check_stat (fs)->internals,
|
|
||||||
fsck_check_stat (fs)->dirs,
|
|
||||||
fsck_check_stat (fs)->files,
|
|
||||||
fsck_check_stat (fs)->unfm_pointers,
|
|
||||||
fsck_check_stat (fs)->zero_unfm_pointers,
|
|
||||||
fsck_check_stat (fs)->safe);
|
|
||||||
|
|
||||||
|
|
||||||
} /* switch */
|
|
||||||
|
|
||||||
memset (&fsck_data (fs)->rebuild.pass_u, 0, sizeof (fsck_data (fs)->rebuild.pass_u));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,372 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
|
||||||
* reiserfsprogs/README
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "fsck.h"
|
|
||||||
|
|
||||||
|
|
||||||
void erase_name (int len);
|
|
||||||
void print_name (char * name, int len);
|
|
||||||
|
|
||||||
void modify_item (struct item_head * ih, void * item);
|
|
||||||
|
|
||||||
/* fixme: search_by_key is not needed after any add_entry */
|
|
||||||
static __u64 _look_for_lost (reiserfs_filsys_t * fs, int link_lost_dirs)
|
|
||||||
{
|
|
||||||
struct key key, prev_key, * rdkey;
|
|
||||||
INITIALIZE_PATH (path);
|
|
||||||
int item_pos;
|
|
||||||
struct buffer_head * bh;
|
|
||||||
struct item_head * ih;
|
|
||||||
unsigned long leaves;
|
|
||||||
int is_it_dir;
|
|
||||||
static int lost_files = 0; /* looking for lost dirs we calculate amount of
|
|
||||||
lost files, so that when we will look for
|
|
||||||
lost files we will be able to stop when
|
|
||||||
there are no lost files anymore */
|
|
||||||
int retval;
|
|
||||||
__u64 size;
|
|
||||||
|
|
||||||
key = root_dir_key;
|
|
||||||
|
|
||||||
if (!link_lost_dirs && !lost_files) {
|
|
||||||
/* we have to look for lost files but we know already that there are
|
|
||||||
no any */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
fsck_progress ("Looking for lost %s:\n", link_lost_dirs ? "directories" : "files");
|
|
||||||
leaves = 0;
|
|
||||||
|
|
||||||
/* total size of added entries */
|
|
||||||
size = 0;
|
|
||||||
while (1) {
|
|
||||||
retval = reiserfs_search_by_key_4 (fs, &key, &path);
|
|
||||||
/* fixme: we assume path ends up with a leaf */
|
|
||||||
bh = get_bh (&path);
|
|
||||||
item_pos = get_item_pos (&path);
|
|
||||||
if (retval != ITEM_FOUND) {
|
|
||||||
if (item_pos == get_blkh_nr_items (B_BLK_HEAD (bh))) {
|
|
||||||
rdkey = uget_rkey (&path);
|
|
||||||
if (!rdkey) {
|
|
||||||
pathrelse (&path);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
key = *rdkey;
|
|
||||||
pathrelse (&path);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* we are on the item in the buffer */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* print ~ how many leaves were scanned and how fast it was */
|
|
||||||
if (!fsck_quiet (fs))
|
|
||||||
print_how_fast (leaves++, 0, 50, 0);
|
|
||||||
|
|
||||||
for (ih = get_ih (&path); item_pos < get_blkh_nr_items (B_BLK_HEAD (bh)); item_pos ++, ih ++, PATH_LAST_POSITION(&path)++) {
|
|
||||||
if (is_item_reachable (ih))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* found item which can not be reached */
|
|
||||||
if (!is_direntry_ih (ih) && !is_stat_data_ih (ih)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_direntry_ih (ih)) {
|
|
||||||
/* if this directory has no stat data - try to recover it */
|
|
||||||
struct key sd;
|
|
||||||
struct path tmp;
|
|
||||||
|
|
||||||
sd = ih->ih_key;
|
|
||||||
set_type_and_offset (KEY_FORMAT_1, &sd, SD_OFFSET, TYPE_STAT_DATA);
|
|
||||||
if (reiserfs_search_by_key_4 (fs, &sd, &tmp) == ITEM_FOUND) {
|
|
||||||
/* should not happen - because if there were a stat data -
|
|
||||||
we would have done with the whole directory */
|
|
||||||
pathrelse (&tmp);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
lost_found_pass_stat (fs)->dir_recovered ++;
|
|
||||||
create_dir_sd (fs, &tmp, &sd, modify_item);
|
|
||||||
id_map_mark(proper_id_map (fs), get_key_objectid (&sd));
|
|
||||||
key = sd;
|
|
||||||
pathrelse (&path);
|
|
||||||
goto cont;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* stat data marked "not having name" found */
|
|
||||||
if (is_stat_data_ih (get_ih(&path)))
|
|
||||||
fix_obviously_wrong_sd_mode (&path);
|
|
||||||
|
|
||||||
is_it_dir = ((not_a_directory (B_I_PITEM (bh,ih))) ? 0 : 1);
|
|
||||||
|
|
||||||
if (is_it_dir) {
|
|
||||||
struct key tmp_key;
|
|
||||||
INITIALIZE_PATH (tmp_path);
|
|
||||||
struct item_head * tmp_ih;
|
|
||||||
|
|
||||||
/* there is no need to link empty lost directories into /lost+found */
|
|
||||||
tmp_key = ih->ih_key;
|
|
||||||
set_type_and_offset (KEY_FORMAT_1, &tmp_key, 0xffffffff, TYPE_DIRENTRY);
|
|
||||||
reiserfs_search_by_key_4 (fs, &tmp_key, &tmp_path);
|
|
||||||
tmp_ih = get_ih (&tmp_path);
|
|
||||||
tmp_ih --;
|
|
||||||
if (not_of_one_file (&tmp_key, tmp_ih))
|
|
||||||
reiserfs_panic ("not directory found");
|
|
||||||
if (!is_direntry_ih (tmp_ih) ||
|
|
||||||
(get_deh_offset (B_I_DEH (get_bh (&tmp_path), tmp_ih) +
|
|
||||||
get_ih_entry_count (tmp_ih) - 1) == DOT_DOT_OFFSET)) {
|
|
||||||
/* last directory item is either stat data or empty
|
|
||||||
directory item - do not link this dir into lost+found */
|
|
||||||
lost_found_pass_stat (fs)->empty_lost_dirs ++;
|
|
||||||
pathrelse (&tmp_path);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
pathrelse (&tmp_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (link_lost_dirs && !is_it_dir) {
|
|
||||||
/* we are looking for directories and it is not a dir */
|
|
||||||
lost_files ++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
lost_found_pass_stat (fs)->lost_found ++;
|
|
||||||
|
|
||||||
{
|
|
||||||
struct key obj_key = {0, 0, {{0, 0},}};
|
|
||||||
char * lost_name;
|
|
||||||
struct item_head tmp_ih;
|
|
||||||
|
|
||||||
/* key to continue */
|
|
||||||
key = ih->ih_key;
|
|
||||||
set_key_objectid (&key, get_key_objectid (&key) + 1);
|
|
||||||
|
|
||||||
tmp_ih = *ih;
|
|
||||||
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 (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)
|
|
||||||
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),
|
|
||||||
get_key_objectid (&tmp_ih.ih_key));
|
|
||||||
|
|
||||||
/* entry in lost+found directory will point to this key */
|
|
||||||
set_key_dirid (&obj_key, get_key_dirid (&tmp_ih.ih_key));
|
|
||||||
set_key_objectid (&obj_key, get_key_objectid (&tmp_ih.ih_key));
|
|
||||||
|
|
||||||
pathrelse (&path);
|
|
||||||
|
|
||||||
/* 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
|
|
||||||
lost_found things */
|
|
||||||
print_name (lost_name, strlen (lost_name));
|
|
||||||
/*fsck_progress ("\tChecking lost dir \"%s\":", lost_name);*/
|
|
||||||
rebuild_semantic_pass (&obj_key, &lost_found_dir_key, /*dot_dot*/0, /*reloc_ih*/0);
|
|
||||||
erase_name (strlen (lost_name));
|
|
||||||
/*fsck_progress ("finished\n");*/
|
|
||||||
|
|
||||||
lost_found_pass_stat (fs)->lost_found_dirs ++;
|
|
||||||
} else {
|
|
||||||
if (reiserfs_search_by_key_4 (fs, &obj_key, &path) != ITEM_FOUND)
|
|
||||||
reiserfs_panic ("look_for_lost: lost file stat data %K not found",
|
|
||||||
&obj_key);
|
|
||||||
|
|
||||||
/* check_regular_file does not mark stat data reachable */
|
|
||||||
mark_item_reachable (get_ih (&path), get_bh (&path));
|
|
||||||
|
|
||||||
rebuild_check_regular_file (&path, get_item (&path), 0/*reloc_ih*/);
|
|
||||||
pathrelse (&path);
|
|
||||||
|
|
||||||
lost_found_pass_stat (fs)->lost_found_files ++;
|
|
||||||
lost_files --;
|
|
||||||
}
|
|
||||||
|
|
||||||
free (lost_name);
|
|
||||||
goto cont;
|
|
||||||
}
|
|
||||||
} /* for */
|
|
||||||
|
|
||||||
prev_key = key;
|
|
||||||
|
|
||||||
PATH_LAST_POSITION(&path) = item_pos - 1;
|
|
||||||
rdkey = reiserfs_next_key (&path);
|
|
||||||
if (rdkey)
|
|
||||||
key = *rdkey;
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (comp_keys (&prev_key, &key) != -1)
|
|
||||||
reiserfs_panic ("pass_3a: key must grow 2: prev=%k next=%k",
|
|
||||||
&prev_key, &key);
|
|
||||||
pathrelse (&path);
|
|
||||||
|
|
||||||
cont:
|
|
||||||
if (!link_lost_dirs && !lost_files) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pathrelse (&path);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* check names added we just have added to/lost+found. Those names are
|
|
||||||
marked DEH_Lost_found flag */
|
|
||||||
fsck_progress ("Checking lost+found directory.."); fflush (stdout);
|
|
||||||
check_semantic_tree (&lost_found_dir_key, &root_dir_key, 0, 1/* lost+found*/);
|
|
||||||
fsck_progress ("finished\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return size;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static void save_lost_found_result (reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
FILE * file;
|
|
||||||
int retval;
|
|
||||||
|
|
||||||
/* save bitmaps with which we will be able start reiserfs from
|
|
||||||
pass 1 */
|
|
||||||
file = open_file ("temp_fsck_file.deleteme", "w+");
|
|
||||||
if (!file)
|
|
||||||
return;
|
|
||||||
|
|
||||||
reiserfs_begin_stage_info_save (file, LOST_FOUND_DONE);
|
|
||||||
reiserfs_end_stage_info_save (file);
|
|
||||||
close_file (file);
|
|
||||||
|
|
||||||
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",
|
|
||||||
state_dump_file (fs));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* we have nothing to load from a state file, but we have to fetch
|
|
||||||
on-disk bitmap, copy it to allocable bitmap, and fetch objectid
|
|
||||||
map */
|
|
||||||
void load_lost_found_result (reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
fsck_new_bitmap (fs) = reiserfs_create_bitmap (get_sb_block_count (fs->fs_ondisk_sb));
|
|
||||||
reiserfs_bitmap_copy (fsck_new_bitmap (fs), fs->fs_bitmap2);
|
|
||||||
|
|
||||||
fsck_allocable_bitmap (fs) = reiserfs_create_bitmap (get_sb_block_count (fs->fs_ondisk_sb));
|
|
||||||
reiserfs_bitmap_copy (fsck_allocable_bitmap (fs), fs->fs_bitmap2);
|
|
||||||
|
|
||||||
fs->block_allocator = reiserfsck_reiserfs_new_blocknrs;
|
|
||||||
fs->block_deallocator = reiserfsck_reiserfs_free_block;
|
|
||||||
|
|
||||||
/* we need objectid map on semantic pass to be able to relocate files */
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
/* update super block: objectid map, fsck state */
|
|
||||||
set_sb_fs_state (fs->fs_ondisk_sb, LOST_FOUND_DONE);
|
|
||||||
mark_buffer_dirty (fs->fs_super_bh);
|
|
||||||
|
|
||||||
/* write all dirty blocks */
|
|
||||||
fsck_progress ("Flushing..");
|
|
||||||
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);
|
|
||||||
fsck_progress ("finished\n");
|
|
||||||
|
|
||||||
stage_report (0x3a, fs);
|
|
||||||
|
|
||||||
if (!fsck_run_one_step (fs)) {
|
|
||||||
if (fsck_user_confirmed (fs, "Continue? (Yes):", "Yes\n", 1))
|
|
||||||
/* reiserfsck continues */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
save_lost_found_result (fs);
|
|
||||||
|
|
||||||
id_map_free(proper_id_map (fs));
|
|
||||||
proper_id_map (fs) = 0;
|
|
||||||
|
|
||||||
fs->fs_dirt = 1;
|
|
||||||
reiserfs_close (fs);
|
|
||||||
exit(EXIT_OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
void pass_3a_look_for_lost (reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
INITIALIZE_PATH (path);
|
|
||||||
struct item_head * ih;
|
|
||||||
void * sd;
|
|
||||||
__u64 size, sd_size;
|
|
||||||
__u32 blocks;
|
|
||||||
__u16 mode;
|
|
||||||
__u32 objectid;
|
|
||||||
unsigned int gen_counter;
|
|
||||||
fsck_progress ("Pass 3a (looking for lost dir/files):\n");
|
|
||||||
|
|
||||||
/* 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");
|
|
||||||
|
|
||||||
|
|
||||||
/* look for lost dirs first */
|
|
||||||
size = _look_for_lost (fs, 1);
|
|
||||||
|
|
||||||
/* link files which are still lost */
|
|
||||||
size += _look_for_lost (fs, 0);
|
|
||||||
|
|
||||||
/* update /lost+found sd_size and sd_blocks (nlink is correct already) */
|
|
||||||
|
|
||||||
objectid = reiserfs_find_entry (fs, &root_dir_key, "lost+found",
|
|
||||||
&gen_counter, &lost_found_dir_key);
|
|
||||||
|
|
||||||
if (!objectid) {
|
|
||||||
reiserfs_panic ("look_for_lost: The entry 'lost+found' could not be found in the root directory.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reiserfs_search_by_key_4 (fs, &lost_found_dir_key, &path) != ITEM_FOUND)
|
|
||||||
reiserfs_panic ("look_for_lost: The StatData of the 'lost+found' directory %K could not be found",
|
|
||||||
&lost_found_dir_key);
|
|
||||||
ih = get_ih (&path);
|
|
||||||
sd = get_item (&path);
|
|
||||||
get_sd_size (ih, sd, &sd_size);
|
|
||||||
size += sd_size;
|
|
||||||
blocks = dir_size2st_blocks (size);
|
|
||||||
|
|
||||||
set_sd_size (ih, sd, &size);
|
|
||||||
set_sd_blocks (ih, sd, &blocks);
|
|
||||||
|
|
||||||
/* make lost+found to be drwx------ */
|
|
||||||
mode = S_IFDIR | S_IRUSR | S_IWUSR | S_IXUSR;
|
|
||||||
set_sd_mode (ih, sd, &mode);
|
|
||||||
|
|
||||||
mark_buffer_dirty (get_bh (&path));
|
|
||||||
pathrelse (&path);
|
|
||||||
|
|
||||||
after_lost_found (fs);
|
|
||||||
}
|
|
||||||
|
|
||||||
-1999
File diff suppressed because it is too large.
Load diff
-821
@@ -1,821 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
|
||||||
* reiserfsprogs/README
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "fsck.h"
|
|
||||||
|
|
||||||
reiserfs_bitmap_t * bad_unfm_in_tree_once_bitmap;
|
|
||||||
|
|
||||||
|
|
||||||
//int step = 0; // 0 - find stat_data or any item ; 1 - find item ; 2 - already found
|
|
||||||
|
|
||||||
|
|
||||||
/* allocates buffer head and copy buffer content */
|
|
||||||
struct buffer_head * make_buffer (int dev, unsigned long blocknr, int size, char * data)
|
|
||||||
{
|
|
||||||
struct buffer_head * bh;
|
|
||||||
|
|
||||||
bh = getblk (dev, blocknr, size);
|
|
||||||
if (buffer_uptodate (bh))
|
|
||||||
return bh;
|
|
||||||
// die ("make_buffer: uptodate buffer found");
|
|
||||||
memcpy (bh->b_data, data, size);
|
|
||||||
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) != ~(__u32)0) &&
|
|
||||||
(get_key_objectid (to_find) != get_key_objectid (key)))
|
|
||||||
return 1;
|
|
||||||
if ((get_key_dirid (to_find) != ~(__u32)0) &&
|
|
||||||
(get_key_dirid (to_find) != get_key_dirid (key)))
|
|
||||||
return 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int is_item_reachable (struct item_head * ih)
|
|
||||||
{
|
|
||||||
return ih_reachable (ih) ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void mark_item_unreachable (struct item_head * ih)
|
|
||||||
{
|
|
||||||
clean_ih_flags (ih);
|
|
||||||
mark_ih_unreachable (ih);
|
|
||||||
|
|
||||||
if (is_indirect_ih (ih))
|
|
||||||
set_ih_free_space (ih, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void mark_item_reachable (struct item_head * ih, struct buffer_head * bh)
|
|
||||||
{
|
|
||||||
mark_ih_reachable (ih);
|
|
||||||
mark_buffer_dirty (bh);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void stat_data_in_tree (struct buffer_head *bh,
|
|
||||||
struct item_head * ih)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
__u32 objectid;
|
|
||||||
|
|
||||||
objectid = get_key_objectid (&ih->ih_key);
|
|
||||||
|
|
||||||
if (mark_objectid_really_used (proper_id_map (fs), objectid)) {
|
|
||||||
stat_shared_objectid_found (fs);
|
|
||||||
mark_objectid_really_used (shared_id_map (fs), objectid);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
zero_nlink (ih, B_I_PITEM (bh, ih));
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *still_bad_unfm_ptr_to_string (int val) {
|
|
||||||
switch (val) {
|
|
||||||
case 1:
|
|
||||||
return "a leaf";
|
|
||||||
case 2:
|
|
||||||
return "shared between a few files";
|
|
||||||
case 3:
|
|
||||||
return "not a data block";
|
|
||||||
case 4:
|
|
||||||
return "not used in on-disk bitmap";
|
|
||||||
case 5:
|
|
||||||
return "out of partition boundary";
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/* this just marks blocks pointed by an indirect item as used in the
|
|
||||||
new bitmap */
|
|
||||||
static void indirect_in_tree (struct buffer_head * bh,
|
|
||||||
struct item_head * ih)
|
|
||||||
{
|
|
||||||
unsigned int i;
|
|
||||||
__u32 * unp;
|
|
||||||
__u32 unfm_ptr;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
unp = (__u32 *)B_I_PITEM (bh, ih);
|
|
||||||
|
|
||||||
for (i = 0; i < I_UNFM_NUM (ih); i ++) {
|
|
||||||
unfm_ptr = d32_get (unp, i);
|
|
||||||
if (unfm_ptr == 0)
|
|
||||||
continue;
|
|
||||||
if ((ret = still_bad_unfm_ptr_1 (unfm_ptr)))
|
|
||||||
reiserfs_panic ("%s: block %lu: The file %k points to the block (%u) which is %s",
|
|
||||||
__FUNCTION__, bh->b_blocknr, &ih->ih_key, unfm_ptr, still_bad_unfm_ptr_to_string(ret));
|
|
||||||
|
|
||||||
mark_block_used (unfm_ptr, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void leaf_is_in_tree_now (struct buffer_head * bh)
|
|
||||||
{
|
|
||||||
item_action_t actions[] = {stat_data_in_tree, indirect_in_tree, 0, 0};
|
|
||||||
|
|
||||||
mark_block_used ((bh)->b_blocknr, 1);
|
|
||||||
|
|
||||||
for_every_item (bh, mark_item_unreachable, actions);
|
|
||||||
|
|
||||||
pass_1_stat (fs)->inserted_leaves ++;
|
|
||||||
|
|
||||||
mark_buffer_dirty (bh);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void insert_pointer (struct buffer_head * bh, struct path * path)
|
|
||||||
{
|
|
||||||
struct item_head * ih;
|
|
||||||
char * body;
|
|
||||||
int retval;
|
|
||||||
struct tree_balance tb;
|
|
||||||
|
|
||||||
init_tb_struct (&tb, fs, path, 0x7fff);
|
|
||||||
|
|
||||||
/* fix_nodes & do_balance must work for internal nodes only */
|
|
||||||
ih = 0;
|
|
||||||
|
|
||||||
retval = fix_nodes (/*tb.transaction_handle,*/ M_INTERNAL, &tb, ih);
|
|
||||||
if (retval != CARRY_ON)
|
|
||||||
die ("insert_pointer: fix_nodes failed with retval == %d", retval);
|
|
||||||
|
|
||||||
/* child_pos: we insert after position child_pos: this feature of the insert_child */
|
|
||||||
/* there is special case: we insert pointer after
|
|
||||||
(-1)-st key (before 0-th key) in the parent */
|
|
||||||
if (PATH_LAST_POSITION (path) == 0 && path->pos_in_item == 0)
|
|
||||||
PATH_H_B_ITEM_ORDER (path, 0) = -1;
|
|
||||||
else {
|
|
||||||
if (PATH_H_PPARENT (path, 0) == 0)
|
|
||||||
PATH_H_B_ITEM_ORDER (path, 0) = 0;
|
|
||||||
/* PATH_H_B_ITEM_ORDER (path, 0) = PATH_H_PPARENT (path, 0) ? PATH_H_B_ITEM_ORDER (path, 0) : 0;*/
|
|
||||||
}
|
|
||||||
|
|
||||||
ih = 0;
|
|
||||||
body = (char *)bh;
|
|
||||||
//memmode = 0;
|
|
||||||
|
|
||||||
do_balance (&tb, ih, body, M_INTERNAL, 0);
|
|
||||||
|
|
||||||
leaf_is_in_tree_now (bh);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* return 1 if left and right can be joined. 0 otherwise */
|
|
||||||
int balance_condition_fails (struct buffer_head * left, struct buffer_head * right)
|
|
||||||
{
|
|
||||||
if (B_FREE_SPACE (left) >= B_CHILD_SIZE (right) -
|
|
||||||
(are_items_mergeable (B_N_PITEM_HEAD (left, B_NR_ITEMS (left) - 1), B_N_PITEM_HEAD (right, 0), left->b_size) ? IH_SIZE : 0))
|
|
||||||
return 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* return 1 if new can be joined with last node on the path or with
|
|
||||||
its right neighbor, 0 otherwise */
|
|
||||||
int balance_condition_2_fails (struct buffer_head * new, struct path * path)
|
|
||||||
{
|
|
||||||
struct buffer_head * bh;
|
|
||||||
struct key * right_dkey;
|
|
||||||
int pos, used_space;
|
|
||||||
|
|
||||||
bh = PATH_PLAST_BUFFER (path);
|
|
||||||
|
|
||||||
|
|
||||||
if (balance_condition_fails (bh, new))
|
|
||||||
/* new node can be joined with last buffer on the path */
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
/* new node can not be joined with its left neighbor */
|
|
||||||
|
|
||||||
right_dkey = uget_rkey (path);
|
|
||||||
if (right_dkey == 0)
|
|
||||||
/* there is no right neighbor */
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
pos = PATH_H_POSITION (path, 1);
|
|
||||||
if (pos == B_NR_ITEMS (bh = PATH_H_PBUFFER (path, 1))) {
|
|
||||||
/* we have to read parent of right neighbor. For simplicity we
|
|
||||||
call search_by_key, which will read right neighbor as well */
|
|
||||||
INITIALIZE_PATH(path_to_right_neighbor);
|
|
||||||
|
|
||||||
if (reiserfs_search_by_key_4 (fs, right_dkey, &path_to_right_neighbor) != ITEM_FOUND)
|
|
||||||
reiserfs_panic ("%s: block %lu, pointer %d: The left delimiting key %k of the block (%lu) is wrong,"
|
|
||||||
"the item cannot be found", __FUNCTION__, PATH_H_PBUFFER(path, 1)->b_blocknr, pos,
|
|
||||||
right_dkey, get_dc_child_blocknr(B_N_CHILD (bh, pos + 1)));
|
|
||||||
|
|
||||||
used_space = B_CHILD_SIZE (PATH_PLAST_BUFFER (&path_to_right_neighbor));
|
|
||||||
pathrelse (&path_to_right_neighbor);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
used_space = get_dc_child_size (B_N_CHILD (bh, pos + 1));
|
|
||||||
|
|
||||||
if (B_FREE_SPACE (new) >= used_space -
|
|
||||||
(are_items_mergeable (B_N_PITEM_HEAD (new, B_NR_ITEMS (new) - 1), (struct item_head *)right_dkey, new->b_size) ? IH_SIZE : 0))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void get_max_buffer_key (struct buffer_head * bh, struct key * key)
|
|
||||||
{
|
|
||||||
struct item_head * ih;
|
|
||||||
|
|
||||||
ih = B_N_PITEM_HEAD (bh, B_NR_ITEMS (bh) - 1);
|
|
||||||
copy_key (key, &(ih->ih_key));
|
|
||||||
|
|
||||||
if (is_direntry_key (key)) {
|
|
||||||
/* copy deh_offset 3-rd and 4-th key components of the last entry */
|
|
||||||
set_offset (KEY_FORMAT_1, key,
|
|
||||||
get_deh_offset (B_I_DEH (bh, ih) + get_ih_entry_count (ih) - 1));
|
|
||||||
|
|
||||||
} else if (!is_stat_data_key (key))
|
|
||||||
/* get key of the last byte, which is contained in the item */
|
|
||||||
set_offset (key_format (key), key, get_offset (key) + get_bytes_number (ih, bh->b_size) - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int tree_is_empty (void)
|
|
||||||
{
|
|
||||||
return (get_sb_root_block (fs->fs_ondisk_sb) == ~(__u32)0 ||
|
|
||||||
get_sb_root_block (fs->fs_ondisk_sb) == 0) ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void make_single_leaf_tree (struct buffer_head * bh)
|
|
||||||
{
|
|
||||||
/* tree is empty, make tree root */
|
|
||||||
set_sb_root_block (fs->fs_ondisk_sb, bh->b_blocknr);
|
|
||||||
set_sb_tree_height (fs->fs_ondisk_sb, 2);
|
|
||||||
mark_buffer_dirty (fs->fs_super_bh);
|
|
||||||
leaf_is_in_tree_now (bh);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* inserts pointer to leaf into tree if possible. If not, marks node as
|
|
||||||
uninsertable in special bitmap */
|
|
||||||
static void try_to_insert_pointer_to_leaf (struct buffer_head * new_bh)
|
|
||||||
{
|
|
||||||
INITIALIZE_PATH (path);
|
|
||||||
struct buffer_head * bh; /* last path buffer */
|
|
||||||
struct key * first_bh_key, last_bh_key; /* first and last keys of new buffer */
|
|
||||||
struct key last_path_buffer_last_key, * right_dkey;
|
|
||||||
int ret_value;
|
|
||||||
|
|
||||||
if (tree_is_empty () == 1) {
|
|
||||||
make_single_leaf_tree (new_bh);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
first_bh_key = B_N_PKEY (new_bh, 0);
|
|
||||||
|
|
||||||
/* try to find place in the tree for the first key of the coming node */
|
|
||||||
ret_value = reiserfs_search_by_key_4 (fs, first_bh_key, &path);
|
|
||||||
if (ret_value == ITEM_FOUND)
|
|
||||||
goto cannot_insert;
|
|
||||||
|
|
||||||
/* get max key in the new node */
|
|
||||||
get_max_buffer_key (new_bh, &last_bh_key);
|
|
||||||
|
|
||||||
bh = PATH_PLAST_BUFFER (&path);
|
|
||||||
if (comp_keys (B_N_PKEY (bh, 0), &last_bh_key) == 1/* first is greater*/) {
|
|
||||||
/* new buffer falls before the leftmost leaf */
|
|
||||||
if (balance_condition_fails (new_bh, bh))
|
|
||||||
goto cannot_insert;
|
|
||||||
|
|
||||||
if (uget_lkey (&path) != 0 || PATH_LAST_POSITION (&path) != 0)
|
|
||||||
die ("try_to_insert_pointer_to_leaf: bad search result");
|
|
||||||
|
|
||||||
path.pos_in_item = 0;
|
|
||||||
goto insert;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get max key of buffer, that is in tree */
|
|
||||||
get_max_buffer_key (bh, &last_path_buffer_last_key);
|
|
||||||
if (comp_keys (&last_path_buffer_last_key, first_bh_key) != -1/* second is greater */)
|
|
||||||
/* first key of new buffer falls in the middle of node that is in tree */
|
|
||||||
goto cannot_insert;
|
|
||||||
|
|
||||||
right_dkey = uget_rkey (&path);
|
|
||||||
if (right_dkey && comp_keys (right_dkey, &last_bh_key) != 1 /* first is greater */)
|
|
||||||
goto cannot_insert;
|
|
||||||
|
|
||||||
if (balance_condition_2_fails (new_bh, &path))
|
|
||||||
goto cannot_insert;
|
|
||||||
|
|
||||||
|
|
||||||
insert:
|
|
||||||
insert_pointer (new_bh, &path);
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
cannot_insert:
|
|
||||||
/* statistic */
|
|
||||||
|
|
||||||
mark_block_uninsertable (new_bh->b_blocknr);
|
|
||||||
|
|
||||||
out:
|
|
||||||
pathrelse (&path);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* everything should be correct already in the leaf but contents of indirect
|
|
||||||
items. So we only
|
|
||||||
1. zero slots pointing to a leaf
|
|
||||||
2. zero pointers to blocks which are pointed already
|
|
||||||
3. what we should do with directory entries hashed by another hash?
|
|
||||||
they are deleted for now
|
|
||||||
*/
|
|
||||||
static void pass1_correct_leaf (reiserfs_filsys_t * fs,
|
|
||||||
struct buffer_head * bh)
|
|
||||||
{
|
|
||||||
unsigned int i, j;
|
|
||||||
struct item_head * ih;
|
|
||||||
__u32 * ind_item;
|
|
||||||
__u32 unfm_ptr;
|
|
||||||
int dirty = 0;
|
|
||||||
|
|
||||||
|
|
||||||
ih = B_N_PITEM_HEAD (bh, 0);
|
|
||||||
for (i = 0; i < B_NR_ITEMS (bh); i ++, ih ++) {
|
|
||||||
if (is_direntry_ih (ih)) {
|
|
||||||
struct reiserfs_de_head * deh;
|
|
||||||
__u32 offset;
|
|
||||||
char * name;
|
|
||||||
int name_len;
|
|
||||||
unsigned int hash_code;
|
|
||||||
|
|
||||||
deh = B_I_DEH (bh, ih);
|
|
||||||
offset = 0;
|
|
||||||
for (j = 0; j < get_ih_entry_count (ih); j ++) {
|
|
||||||
name = name_in_entry (deh + j, j);
|
|
||||||
name_len = name_in_entry_length (ih, deh + j, j);
|
|
||||||
|
|
||||||
if ((j == 0 && is_dot (name, name_len)) ||
|
|
||||||
(j == 1 && is_dot_dot (name, name_len))) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
hash_code = find_hash_in_use (name, name_len, get_deh_offset (deh + j),
|
|
||||||
get_sb_hash_code (fs->fs_ondisk_sb));
|
|
||||||
if (hash_code != get_sb_hash_code (fs->fs_ondisk_sb)) {
|
|
||||||
fsck_log ("pass1: block %lu, item %d, entry %d: The entry \"%.*s\" of the %k is hashed with %s "
|
|
||||||
"whereas proper hash is %s", bh->b_blocknr, i, j, name_len, name, &ih->ih_key,
|
|
||||||
code2name (hash_code), code2name (get_sb_hash_code (fs->fs_ondisk_sb)));
|
|
||||||
if (get_ih_entry_count (ih) == 1) {
|
|
||||||
delete_item (fs, bh, i);
|
|
||||||
fsck_log(" - the only entry - item was deleted\n");
|
|
||||||
i --;
|
|
||||||
ih --;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
cut_entry (fs, bh, i, j, 1);
|
|
||||||
fsck_log(" - deleted\n");
|
|
||||||
j --;
|
|
||||||
deh = B_I_DEH (bh, ih);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (j && offset >= get_deh_offset (deh + j)) {
|
|
||||||
fsck_log ("pass1: block %lu, item %d, entry %d: The entry "
|
|
||||||
"\"%.*s\" of the %k has hash offset %lu not "
|
|
||||||
"larger smaller than the previous one %lu. The "
|
|
||||||
"entry is deleted.\n", bh->b_blocknr,
|
|
||||||
i, j, name_len, name, &ih->ih_key,
|
|
||||||
get_deh_offset(deh + j), offset);
|
|
||||||
cut_entry (fs, bh, i, j, 1);
|
|
||||||
j --;
|
|
||||||
deh = B_I_DEH (bh, ih);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
offset = get_deh_offset (deh + j);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!is_indirect_ih (ih))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* correct indirect items */
|
|
||||||
ind_item = (__u32 *)B_I_PITEM (bh, ih);
|
|
||||||
|
|
||||||
for (j = 0; j < I_UNFM_NUM (ih); j ++) {
|
|
||||||
unfm_ptr = d32_get (ind_item, j);
|
|
||||||
|
|
||||||
if (!unfm_ptr)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* this corruption of indirect item had to be fixed in pass0 */
|
|
||||||
if (not_data_block (fs, unfm_ptr) || unfm_ptr >= get_sb_block_count (fs->fs_ondisk_sb))
|
|
||||||
/*!was_block_used (unfm_ptr))*/
|
|
||||||
reiserfs_panic ("%s: block %lu, item %d, pointer %d: The wrong pointer (%u) in the file %K. "
|
|
||||||
"Must be fixed on pass0.", __FUNCTION__, bh->b_blocknr, i, j, unfm_ptr, &ih->ih_key);
|
|
||||||
|
|
||||||
/* 1. zero slots pointing to a leaf */
|
|
||||||
if (is_used_leaf (unfm_ptr)) {
|
|
||||||
dirty ++;
|
|
||||||
d32_put (ind_item, j, 0);
|
|
||||||
pass_1_stat (fs)->pointed_leaves ++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 2. zero pointers to blocks which are pointed already */
|
|
||||||
if (is_bad_unformatted (unfm_ptr)) {
|
|
||||||
/* this unformatted pointed more than once. Did we see it already? */
|
|
||||||
if (!is_bad_unfm_in_tree_once (unfm_ptr))
|
|
||||||
/* keep first reference to it and mark about that in
|
|
||||||
special bitmap */
|
|
||||||
mark_bad_unfm_in_tree_once (unfm_ptr);
|
|
||||||
else {
|
|
||||||
/* Yes, we have seen this pointer already, zero other pointers to it. */
|
|
||||||
dirty ++;
|
|
||||||
d32_put (ind_item, j, 0);
|
|
||||||
pass_1_stat (fs)->non_unique_pointers ++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
pass_1_stat (fs)->correct_pointers ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dirty)
|
|
||||||
mark_buffer_dirty (bh);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct si * remove_saved_item (struct si * si)
|
|
||||||
{
|
|
||||||
struct si * tmp = si->si_next;
|
|
||||||
|
|
||||||
freemem (si->si_dnm_data);
|
|
||||||
freemem (si);
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* fsck starts creating of this bitmap on pass 1. It will then become
|
|
||||||
on-disk bitmap */
|
|
||||||
static void init_new_bitmap (reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
unsigned int i;
|
|
||||||
unsigned long block;
|
|
||||||
unsigned long reserved;
|
|
||||||
|
|
||||||
|
|
||||||
fsck_new_bitmap (fs) = reiserfs_create_bitmap (get_sb_block_count (fs->fs_ondisk_sb));
|
|
||||||
|
|
||||||
/* mark_block_used skips 0, set the bit explicitly */
|
|
||||||
reiserfs_bitmap_set_bit (fsck_new_bitmap (fs), 0);
|
|
||||||
|
|
||||||
/* mark other skipped blocks and super block used */
|
|
||||||
for (i = 1; i <= fs->fs_super_bh->b_blocknr; i ++)
|
|
||||||
mark_block_used (i, 1);
|
|
||||||
|
|
||||||
/* mark bitmap blocks as used */
|
|
||||||
block = fs->fs_super_bh->b_blocknr + 1;
|
|
||||||
for (i = 0; i < get_sb_bmap_nr (fs->fs_ondisk_sb); i ++) {
|
|
||||||
mark_block_used (block, 1);
|
|
||||||
if (spread_bitmaps (fs))
|
|
||||||
block = (block / (fs->fs_blocksize * 8) + 1) * (fs->fs_blocksize * 8);
|
|
||||||
else
|
|
||||||
block ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
reserved = get_size_of_journal_or_reserved_area (fs->fs_ondisk_sb);
|
|
||||||
/* where does journal area (or reserved journal area) start from */
|
|
||||||
|
|
||||||
if (!is_new_sb_location (fs->fs_super_bh->b_blocknr, fs->fs_blocksize) &&
|
|
||||||
!is_old_sb_location (fs->fs_super_bh->b_blocknr, fs->fs_blocksize))
|
|
||||||
die ("init_new_bitmap: Wrong super block location, you must run --rebuild-sb.");
|
|
||||||
|
|
||||||
block = get_journal_start_must (fs);
|
|
||||||
|
|
||||||
for (i = block; i < reserved + block; i ++)
|
|
||||||
mark_block_used (i, 1);
|
|
||||||
|
|
||||||
|
|
||||||
if (fs->fs_badblocks_bm)
|
|
||||||
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 (fsck_new_bitmap (fs), i))
|
|
||||||
reiserfs_panic ("%s: The block pointer to not data area, must be fixed on the pass0.\n",
|
|
||||||
__FUNCTION__);
|
|
||||||
reiserfs_bitmap_set_bit (fsck_new_bitmap (fs), i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* mark journal area as used if journal is standard or it is non standard
|
|
||||||
and initialy has been created on a main device */
|
|
||||||
reserved = 0;
|
|
||||||
if (!is_reiserfs_jr_magic_string (fs->fs_ondisk_sb))
|
|
||||||
reserved = get_jp_journal_size (sb_jp (fs->fs_ondisk_sb));
|
|
||||||
if (get_sb_reserved_for_journal (fs->fs_ondisk_sb))
|
|
||||||
reserved = get_sb_reserved_for_journal (fs->fs_ondisk_sb);
|
|
||||||
if (reserved) {
|
|
||||||
for (i = 0; i <= reserved; i ++)
|
|
||||||
mark_block_used (i + get_jp_journal_1st_block (sb_jp
|
|
||||||
(fs->fs_ondisk_sb)));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* this makes a map of blocks which can be allocated when fsck will
|
|
||||||
continue */
|
|
||||||
static void find_allocable_blocks (reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
unsigned long i;
|
|
||||||
|
|
||||||
fsck_progress ("Looking for allocable blocks .. ");
|
|
||||||
|
|
||||||
fsck_allocable_bitmap (fs) = reiserfs_create_bitmap (get_sb_block_count (fs->fs_ondisk_sb));
|
|
||||||
reiserfs_bitmap_fill (fsck_allocable_bitmap (fs));
|
|
||||||
|
|
||||||
|
|
||||||
/* find how many leaves are not pointed by any indirect items */
|
|
||||||
for (i = 0; i < get_sb_block_count (fs->fs_ondisk_sb); i ++) {
|
|
||||||
if (not_data_block (fs, i))
|
|
||||||
/* journal (or reserved for it area), bitmaps, super block and
|
|
||||||
blocks before it */
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (is_good_unformatted (i) && is_bad_unformatted (i))
|
|
||||||
die ("find_allocable_blocks: The block (%lu) is masr as good and as bad at once.", i);
|
|
||||||
|
|
||||||
if (is_good_unformatted (i) || is_bad_unformatted (i)) {
|
|
||||||
/* blocks which were pointed once or more thn onec from indirect
|
|
||||||
items - they will not be allocated */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* make allocable not leaves, not bad blocks */
|
|
||||||
if (!is_used_leaf (i) && (!fs->fs_badblocks_bm ||
|
|
||||||
!reiserfs_bitmap_test_bit (fs->fs_badblocks_bm, i)))
|
|
||||||
{
|
|
||||||
/* this is not leaf and it is not pointed by found indirect items,
|
|
||||||
so it does not contains anything valuable */
|
|
||||||
make_allocable (i);
|
|
||||||
pass_1_stat (fs)->allocable_blocks ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fsck_progress ("finished\n");
|
|
||||||
|
|
||||||
fs->block_allocator = reiserfsck_reiserfs_new_blocknrs;
|
|
||||||
fs->block_deallocator = reiserfsck_reiserfs_free_block;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void before_pass_1 (reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
/* this will become an on-disk bitmap */
|
|
||||||
init_new_bitmap (fs);
|
|
||||||
|
|
||||||
/* bitmap of leaves which could not be inserted on pass 1. FIXME:
|
|
||||||
no need to have 1 bit per block */
|
|
||||||
fsck_uninsertables (fs) = reiserfs_create_bitmap (get_sb_block_count (fs->fs_ondisk_sb));
|
|
||||||
reiserfs_bitmap_fill (fsck_uninsertables (fs));
|
|
||||||
|
|
||||||
/* find blocks which can be allocated */
|
|
||||||
find_allocable_blocks (fs);
|
|
||||||
|
|
||||||
/* bitmap of bad unformatted nodes which are in the tree already */
|
|
||||||
bad_unfm_in_tree_once_bitmap = reiserfs_create_bitmap (get_sb_block_count (fs->fs_ondisk_sb));
|
|
||||||
|
|
||||||
/* pass 1 does not deal with objectid */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void save_pass_1_result (reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
FILE * file;
|
|
||||||
int retval;
|
|
||||||
|
|
||||||
file = open_file("temp_fsck_file.deleteme", "w+");
|
|
||||||
if (!file)
|
|
||||||
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 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);
|
|
||||||
|
|
||||||
/* to be able to restart with pass 2 we need bitmap of
|
|
||||||
uninsertable blocks and bitmap of alocable blocks */
|
|
||||||
reiserfs_begin_stage_info_save(file, PASS_1_DONE);
|
|
||||||
reiserfs_bitmap_save (file, fsck_uninsertables (fs));
|
|
||||||
reiserfs_bitmap_save (file, fsck_allocable_bitmap(fs));
|
|
||||||
reiserfs_end_stage_info_save (file);
|
|
||||||
close_file (file);
|
|
||||||
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",
|
|
||||||
state_dump_file (fs));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void load_pass_1_result (FILE * fp, reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
fsck_new_bitmap (fs) = reiserfs_create_bitmap (get_sb_block_count (fs->fs_ondisk_sb));
|
|
||||||
reiserfs_bitmap_copy (fsck_new_bitmap (fs), fs->fs_bitmap2);
|
|
||||||
|
|
||||||
fsck_uninsertables (fs) = reiserfs_bitmap_load (fp);
|
|
||||||
fsck_allocable_bitmap (fs) = reiserfs_bitmap_load (fp);
|
|
||||||
|
|
||||||
fs->block_allocator = reiserfsck_reiserfs_new_blocknrs;
|
|
||||||
fs->block_deallocator = reiserfsck_reiserfs_free_block;
|
|
||||||
|
|
||||||
if (!fsck_new_bitmap (fs) || !fsck_allocable_bitmap (fs) ||
|
|
||||||
!fsck_allocable_bitmap (fs))
|
|
||||||
fsck_exit ("State dump file seems corrupted. Run without -d");
|
|
||||||
|
|
||||||
|
|
||||||
/* we need objectid map on pass 2 to be able to relocate files */
|
|
||||||
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",
|
|
||||||
reiserfs_bitmap_ones (fsck_new_bitmap (fs)),
|
|
||||||
reiserfs_bitmap_zeros (fsck_allocable_bitmap (fs)),
|
|
||||||
reiserfs_bitmap_zeros (fsck_uninsertables (fs)));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern reiserfs_bitmap_t * leaves_bitmap;
|
|
||||||
|
|
||||||
/* reads blocks marked in leaves_bitmap and tries to insert them into
|
|
||||||
tree */
|
|
||||||
static void do_pass_1 (reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
struct buffer_head * bh;
|
|
||||||
unsigned long i;
|
|
||||||
int what_node;
|
|
||||||
unsigned long done = 0, total;
|
|
||||||
|
|
||||||
|
|
||||||
/* on pass0 we have found that amount of leaves */
|
|
||||||
total = reiserfs_bitmap_ones (leaves_bitmap);
|
|
||||||
|
|
||||||
/* read all leaves found on the pass 0 */
|
|
||||||
for (i = 0; i < get_sb_block_count (fs->fs_ondisk_sb); i ++) {
|
|
||||||
if (!is_used_leaf (i))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
print_how_far (fsck_progress_file (fs), &done, total, 1, fsck_quiet (fs));
|
|
||||||
|
|
||||||
/* at least one of nr_to_read blocks is to be checked */
|
|
||||||
bh = bread (fs->fs_dev, i, fs->fs_blocksize);
|
|
||||||
if (!bh) {
|
|
||||||
/* we were reading one block at time, and failed, so mark
|
|
||||||
block bad */
|
|
||||||
fsck_progress ("pass1: Reading of the block %lu failed\n", i);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
what_node = who_is_this (bh->b_data, bh->b_size);
|
|
||||||
if ( what_node != THE_LEAF ) {
|
|
||||||
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) &&
|
|
||||||
fsck_data(fs)->rebuild.use_journal_area))
|
|
||||||
/* block is in new tree already */
|
|
||||||
die ("build_the_tree: The leaf (%lu) is in the tree already\n", i);
|
|
||||||
|
|
||||||
/* fprintf (block_list, "leaf %d\n", i + j);*/
|
|
||||||
pass_1_stat (fs)->leaves ++;
|
|
||||||
|
|
||||||
/* the leaf may still contain indirect items with wrong
|
|
||||||
slots. Fix that */
|
|
||||||
pass1_correct_leaf (fs, bh);
|
|
||||||
|
|
||||||
if (get_blkh_nr_items (B_BLK_HEAD (bh)) == 0) {
|
|
||||||
/* all items were deleted on pass 0 or pass 1 */
|
|
||||||
mark_buffer_clean (bh);
|
|
||||||
brelse (bh);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_leaf_bad (bh)) {
|
|
||||||
/* FIXME: will die */
|
|
||||||
fsck_log ("is_leaf_bad: WARNING: The leaf (%lu) is formatted badly. Will be handled on the the pass2.\n",
|
|
||||||
bh->b_blocknr);
|
|
||||||
mark_block_uninsertable (bh->b_blocknr);
|
|
||||||
brelse (bh);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (block_of_journal (fs, i) && fsck_data(fs)->rebuild.use_journal_area) {
|
|
||||||
/* FIXME: temporary thing */
|
|
||||||
if (tree_is_empty ()) {
|
|
||||||
/* we insert inot tree only first leaf of journal */
|
|
||||||
unsigned long block;
|
|
||||||
struct buffer_head * new_bh;
|
|
||||||
|
|
||||||
block = alloc_block ();
|
|
||||||
if (!block)
|
|
||||||
die ("could not allocate block");
|
|
||||||
new_bh = getblk (bh->b_dev, block, bh->b_size);
|
|
||||||
memcpy (new_bh->b_data, bh->b_data, bh->b_size);
|
|
||||||
mark_buffer_uptodate (new_bh, 1);
|
|
||||||
mark_buffer_dirty (new_bh);
|
|
||||||
make_single_leaf_tree (new_bh);
|
|
||||||
brelse (new_bh);
|
|
||||||
brelse (bh);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* other blocks of journal will be inserted in pass 2 */
|
|
||||||
mark_block_uninsertable (bh->b_blocknr);
|
|
||||||
brelse (bh);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
try_to_insert_pointer_to_leaf (bh);
|
|
||||||
brelse (bh);
|
|
||||||
}
|
|
||||||
|
|
||||||
fsck_progress ("\n");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void after_pass_1 (reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
time_t t;
|
|
||||||
|
|
||||||
/* update fsck_state */
|
|
||||||
|
|
||||||
/* we should not flush bitmaps on disk after pass1, because
|
|
||||||
new_bitmap contains only those blocks which are good leaves or
|
|
||||||
just allocated internal blocks. */
|
|
||||||
|
|
||||||
set_sb_fs_state (fs->fs_ondisk_sb, PASS_1_DONE);
|
|
||||||
mark_buffer_dirty (fs->fs_super_bh);
|
|
||||||
|
|
||||||
/* write all dirty blocks */
|
|
||||||
fsck_progress ("Flushing..");
|
|
||||||
fs->fs_dirt = 1;
|
|
||||||
reiserfs_flush (fs);
|
|
||||||
fsck_progress ("finished\n");
|
|
||||||
|
|
||||||
stage_report (1, fs);
|
|
||||||
|
|
||||||
/* we do not need this anymore */
|
|
||||||
delete_aux_bitmaps ();
|
|
||||||
reiserfs_delete_bitmap (bad_unfm_in_tree_once_bitmap);
|
|
||||||
|
|
||||||
if (!fsck_run_one_step (fs)) {
|
|
||||||
if (fsck_user_confirmed (fs, "Continue? (Yes):", "Yes\n", 1))
|
|
||||||
/* reiserfsck continues */
|
|
||||||
return;
|
|
||||||
} else
|
|
||||||
save_pass_1_result (fs);
|
|
||||||
|
|
||||||
if (proper_id_map (fs)) {
|
|
||||||
/* when we run pass 1 only - we do not have proper_id_map */
|
|
||||||
id_map_free(proper_id_map (fs));
|
|
||||||
proper_id_map (fs) = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
time (&t);
|
|
||||||
fsck_progress ("###########\n"
|
|
||||||
"reiserfsck finished pass 1 at %s"
|
|
||||||
"###########\n", ctime (&t));
|
|
||||||
fs->fs_dirt = 1;
|
|
||||||
reiserfs_close (fs);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pass_1 (reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
fsck_progress ("\nPass 1 (will try to insert %lu leaves):\n",
|
|
||||||
reiserfs_bitmap_ones (fsck_source_bitmap (fs)));
|
|
||||||
if (fsck_log_file (fs) != stderr)
|
|
||||||
fsck_log ("####### Pass 1 #######\n");
|
|
||||||
|
|
||||||
|
|
||||||
before_pass_1 (fs);
|
|
||||||
|
|
||||||
/* try to insert leaves found during pass 0 */
|
|
||||||
do_pass_1 (fs);
|
|
||||||
|
|
||||||
after_pass_1 (fs);
|
|
||||||
}
|
|
||||||
|
|
||||||
-641
@@ -1,641 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
|
||||||
* reiserfsprogs/README
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "fsck.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* on pass2 we take leaves which could not be inserted into tree
|
|
||||||
during pass1 and insert each item separately. It is possible that
|
|
||||||
items of different objects with the same key can be found. We treat
|
|
||||||
that in the following way: we put it into tree with new key and
|
|
||||||
link it into /lost+found directory with name made of dir,oid. When
|
|
||||||
coming item is a directory - we delete object from the tree, put it
|
|
||||||
back with different key, link it to /lost+found directory and
|
|
||||||
insert directory as it is */
|
|
||||||
|
|
||||||
/* relocation rules: we have an item (it is taken from "non-insertable"
|
|
||||||
leaf). It has original key yet. We check to see if object with this
|
|
||||||
key is remapped. Object can be only remapped if it is not a piece
|
|
||||||
of directory */
|
|
||||||
|
|
||||||
|
|
||||||
/* 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;
|
|
||||||
|
|
||||||
struct relocated * next;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* all relocated files will be linked into lost+found directory at the
|
|
||||||
beginning of semantic pass */
|
|
||||||
static struct relocated * relocated_list = NULL;
|
|
||||||
|
|
||||||
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) &&
|
|
||||||
cur->old_objectid == get_key_objectid (key))
|
|
||||||
/* object is relocated already */
|
|
||||||
return cur->new_objectid;
|
|
||||||
cur = cur->next;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* return objectid the object has to be remapped with */
|
|
||||||
__u32 objectid_for_relocation (struct key * key)
|
|
||||||
{
|
|
||||||
struct relocated * cur;
|
|
||||||
__u32 cur_id;
|
|
||||||
|
|
||||||
if ((cur_id = get_relocated_objectid_from_list (key)) != 0)
|
|
||||||
return cur_id;
|
|
||||||
|
|
||||||
cur = getmem (sizeof (struct relocated));
|
|
||||||
cur->old_dir_id = get_key_dirid (key);
|
|
||||||
cur->old_objectid = get_key_objectid (key);
|
|
||||||
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",
|
|
||||||
key, get_key_dirid (key), cur->new_objectid);*/
|
|
||||||
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 */
|
|
||||||
void save_item (struct si ** head, struct item_head * ih, char * item, __u32 blocknr)
|
|
||||||
{
|
|
||||||
struct si * si, * cur;
|
|
||||||
|
|
||||||
si = getmem (sizeof (*si));
|
|
||||||
si->si_dnm_data = getmem (get_ih_item_len(ih));
|
|
||||||
/*si->si_blocknr = blocknr;*/
|
|
||||||
memcpy (&(si->si_ih), ih, IH_SIZE);
|
|
||||||
memcpy (si->si_dnm_data, item, get_ih_item_len(ih));
|
|
||||||
|
|
||||||
if (*head == 0)
|
|
||||||
*head = si;
|
|
||||||
else {
|
|
||||||
cur = *head;
|
|
||||||
while (cur->si_next)
|
|
||||||
cur = cur->si_next;
|
|
||||||
cur->si_next = si;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
struct si * save_and_delete_file_item (struct si * si, struct path * path)
|
|
||||||
{
|
|
||||||
struct buffer_head * bh = PATH_PLAST_BUFFER (path);
|
|
||||||
struct item_head * ih = PATH_PITEM_HEAD (path);
|
|
||||||
|
|
||||||
save_item (&si, ih, B_I_PITEM (bh, ih), bh->b_blocknr);
|
|
||||||
|
|
||||||
/* delete item temporary - do not free unformatted nodes */
|
|
||||||
reiserfsck_delete_item (path, 1/*temporary*/);
|
|
||||||
return si;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* check whether there are any directory items with this key */
|
|
||||||
int should_relocate (struct item_head * ih)
|
|
||||||
{
|
|
||||||
struct key key;
|
|
||||||
struct key * rkey;
|
|
||||||
struct path path;
|
|
||||||
struct item_head * path_ih;
|
|
||||||
|
|
||||||
|
|
||||||
/* starting with the leftmost item with this key */
|
|
||||||
key = ih->ih_key;
|
|
||||||
set_type_and_offset (KEY_FORMAT_1, &key, SD_OFFSET, TYPE_STAT_DATA);
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
reiserfs_search_by_key_4 (fs, &key, &path);
|
|
||||||
|
|
||||||
if (get_item_pos (&path) == B_NR_ITEMS (get_bh (&path))) {
|
|
||||||
rkey = uget_rkey (&path);
|
|
||||||
if (rkey && !not_of_one_file (&key, rkey)) {
|
|
||||||
/* file continues in the right neighbor */
|
|
||||||
key = *rkey;
|
|
||||||
pathrelse (&path);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* there is no more items with this key */
|
|
||||||
pathrelse (&path);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
path_ih = get_ih (&path);
|
|
||||||
if (not_of_one_file (&key, &(path_ih->ih_key))) {
|
|
||||||
/* there are no more item with this key */
|
|
||||||
pathrelse (&path);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_stat_data_ih (path_ih)) {
|
|
||||||
fix_obviously_wrong_sd_mode (&path);
|
|
||||||
if (ih_checked (path_ih)) {
|
|
||||||
/* we have checked it already */
|
|
||||||
pathrelse (&path);
|
|
||||||
|
|
||||||
if (get_relocated_objectid_from_list (&path_ih->ih_key))
|
|
||||||
return 1; /* it was relocated */
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
mark_ih_checked (path_ih);
|
|
||||||
mark_buffer_dirty (get_bh(&path));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ok, item found, but make sure that it is not a directory one */
|
|
||||||
if ((is_stat_data_ih (path_ih) && !not_a_directory (get_item (&path))) ||
|
|
||||||
(is_direntry_ih (path_ih))) {
|
|
||||||
/* item of directory found. so, we have to relocate the file */
|
|
||||||
pathrelse (&path);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
key = path_ih->ih_key;
|
|
||||||
set_offset (KEY_FORMAT_1, &key, get_offset (&key) + 1);
|
|
||||||
pathrelse (&path);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* this works for both new and old stat data */
|
|
||||||
#define st_mode(sd) le16_to_cpu(((struct stat_data *)(sd))->sd_mode)
|
|
||||||
|
|
||||||
#define st_mtime_v1(sd) le32_to_cpu(((struct stat_data_v1 *)(sd))->sd_mtime)
|
|
||||||
#define st_mtime_v2(sd) le32_to_cpu(((struct stat_data *)(sd))->sd_mtime)
|
|
||||||
|
|
||||||
|
|
||||||
/* either both sd-s are new of both are old */
|
|
||||||
static void overwrite_stat_data (struct item_head * new_ih,
|
|
||||||
void * new_item, struct path * path)
|
|
||||||
{
|
|
||||||
__u16 new_mode, old_mode;
|
|
||||||
|
|
||||||
get_sd_mode (new_ih, new_item, &new_mode);
|
|
||||||
get_sd_mode (get_ih (path), get_item (path), &old_mode);
|
|
||||||
|
|
||||||
|
|
||||||
if (S_ISREG (new_mode) && !S_ISREG (old_mode)) {
|
|
||||||
/* in tree we have not regular file - overwrite its stat data
|
|
||||||
with stat data of regular file */
|
|
||||||
memcpy (get_item (path), new_item, get_ih_item_len (get_ih (path)));
|
|
||||||
mark_buffer_dirty (get_bh (path));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (S_ISREG (old_mode) && !S_ISREG (new_mode)) {
|
|
||||||
/* new stat data is not a stat data of regular file, keep
|
|
||||||
regular file stat data in tree */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if coming stat data has newer mtime - use that */
|
|
||||||
if (stat_data_v1 (new_ih)) {
|
|
||||||
if (st_mtime_v1 (new_item) > st_mtime_v1 (get_item (path))) {
|
|
||||||
memcpy (get_item (path), new_item, SD_V1_SIZE);
|
|
||||||
mark_buffer_dirty (get_bh (path));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (st_mtime_v2 (new_item) > st_mtime_v2 (get_item (path))) {
|
|
||||||
memcpy (get_item (path), new_item, SD_SIZE);
|
|
||||||
mark_buffer_dirty (get_bh (path));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* insert sd item if it does not exist, overwrite it otherwise */
|
|
||||||
static void put_sd_into_tree (struct item_head * new_ih, char * new_item)
|
|
||||||
{
|
|
||||||
struct path path;
|
|
||||||
|
|
||||||
if (!not_a_directory (new_item)) {
|
|
||||||
/* new item is a stat data of a directory. So we have to
|
|
||||||
relocate all items which have the same short key and are of
|
|
||||||
not a directory */
|
|
||||||
rewrite_file (new_ih, 1, 0/*do not change new_ih*/);
|
|
||||||
} else {
|
|
||||||
/* new item is a stat data of something else but directory. If
|
|
||||||
there are items of directory - we have to relocate the file */
|
|
||||||
if (should_relocate (new_ih))
|
|
||||||
rewrite_file (new_ih, 1, 1/*change new_ih*/);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if we will have to insert item into tree - it is ready */
|
|
||||||
zero_nlink (new_ih, new_item);
|
|
||||||
mark_item_unreachable (new_ih);
|
|
||||||
|
|
||||||
/* we are sure now that if we are inserting stat data of a
|
|
||||||
directory - there are no items with the same key which are not
|
|
||||||
items of a directory, and that if we are inserting stat data is
|
|
||||||
of not a directory - it either has new key already or there are
|
|
||||||
no items with this key which are items of a directory */
|
|
||||||
if (reiserfs_search_by_key_4 (fs, &(new_ih->ih_key), &path) == ITEM_FOUND) {
|
|
||||||
/* this stat data is found */
|
|
||||||
if (get_ih_key_format (get_ih(&path)) != get_ih_key_format (new_ih)) {
|
|
||||||
/* in tree stat data and a new one are of different
|
|
||||||
formats */
|
|
||||||
fsck_log ("put_sd_into_tree: Inserting the StatData %K, mode (%M)...",
|
|
||||||
&(new_ih->ih_key), st_mode (new_item));
|
|
||||||
if (stat_data_v1 (new_ih)) {
|
|
||||||
/* sd to be inserted is of V1, where as sd in the tree
|
|
||||||
is of V2 */
|
|
||||||
fsck_log ("found newer in the tree, mode (%M), insersion was skipped.\n",
|
|
||||||
st_mode (get_item (&path)));
|
|
||||||
pathrelse (&path);
|
|
||||||
} else {
|
|
||||||
/* the stat data in the tree is sd_v1 */
|
|
||||||
fsck_log ("older sd, mode (%M), is replaced with it.\n",
|
|
||||||
st_mode (get_item (&path)));
|
|
||||||
reiserfsck_delete_item (&path, 0/*not temporary*/);
|
|
||||||
|
|
||||||
reiserfs_search_by_key_4 (fs, &new_ih->ih_key, &path);
|
|
||||||
reiserfsck_insert_item (&path, new_ih, new_item);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* both stat data are of the same version */
|
|
||||||
overwrite_stat_data (new_ih, new_item, &path);
|
|
||||||
pathrelse (&path);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* item not found, insert a new one */
|
|
||||||
reiserfsck_insert_item (&path, new_ih, new_item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* this tries to put each item entry to the tree, if there is no items
|
|
||||||
of the directory, insert item containing 1 entry */
|
|
||||||
static void put_directory_item_into_tree (struct item_head * comingih, char * item)
|
|
||||||
{
|
|
||||||
struct reiserfs_de_head * deh;
|
|
||||||
int i;
|
|
||||||
char * buf;
|
|
||||||
char * name;
|
|
||||||
int namelen;
|
|
||||||
|
|
||||||
/* if there are anything with this key but a directory - move it
|
|
||||||
somewhere else */
|
|
||||||
rewrite_file (comingih, 1, 0/* do not change ih */);
|
|
||||||
|
|
||||||
deh = (struct reiserfs_de_head *)item;
|
|
||||||
|
|
||||||
for (i = 0; i < get_ih_entry_count (comingih); i ++, deh ++) {
|
|
||||||
name = name_in_entry (deh, i);
|
|
||||||
namelen = name_in_entry_length (comingih, deh, i);
|
|
||||||
|
|
||||||
if (!is_properly_hashed (fs, name, namelen, get_deh_offset (deh)))
|
|
||||||
reiserfs_panic ("put_directory_item_into_tree: The entry (%d) \"%.*s\" of the directory %k has"
|
|
||||||
" badly hashed entry", i, namelen, name, &comingih->ih_key);
|
|
||||||
|
|
||||||
asprintf (&buf, "%.*s", namelen, name);
|
|
||||||
/* 1 for fsck is important: if there is no any items of this
|
|
||||||
directory in the tree yet - new item will be inserted
|
|
||||||
marked not reached */
|
|
||||||
reiserfs_add_entry (fs, &(comingih->ih_key), buf, entry_length (comingih, deh, i),
|
|
||||||
(struct key *)&(deh->deh2_dir_id), 1 << IH_Unreachable);
|
|
||||||
free (buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void insert_item_separately (struct item_head * ih,
|
|
||||||
char * item, int was_in_tree)
|
|
||||||
{
|
|
||||||
if (get_key_dirid (&ih->ih_key) == get_key_objectid (&ih->ih_key))
|
|
||||||
reiserfs_panic ("insert_item_separately: The item being inserted has the bad key %H", ih);
|
|
||||||
|
|
||||||
if (is_stat_data_ih (ih)) {
|
|
||||||
put_sd_into_tree (ih, item);
|
|
||||||
} else if (is_direntry_ih (ih)) {
|
|
||||||
put_directory_item_into_tree (ih, item);
|
|
||||||
} else {
|
|
||||||
reiserfsck_file_write (ih, item, was_in_tree);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void put_stat_data_items (struct buffer_head * bh)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
struct item_head * ih;
|
|
||||||
|
|
||||||
|
|
||||||
ih = B_N_PITEM_HEAD (bh, 0);
|
|
||||||
for (i = 0; i < B_NR_ITEMS (bh); i ++, ih ++) {
|
|
||||||
|
|
||||||
/* this check instead of saved_items */
|
|
||||||
if (!is_stat_data_ih (ih) || is_bad_item (bh, ih, B_I_PITEM (bh, ih))) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
insert_item_separately (ih, B_I_PITEM (bh, ih), 0/*was in tree*/);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void put_not_stat_data_items (struct buffer_head * bh)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
struct item_head * ih;
|
|
||||||
|
|
||||||
ih = B_N_PITEM_HEAD (bh, 0);
|
|
||||||
for (i = 0; i < B_NR_ITEMS (bh); i ++, ih ++) {
|
|
||||||
|
|
||||||
if (is_stat_data_ih (ih) || is_bad_item (bh, ih, B_I_PITEM (bh, ih))) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
insert_item_separately (ih, B_I_PITEM (bh, ih), 0/*was in tree*/);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void before_pass_2 (reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
/* anything specific for pass 2 ? */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void save_pass_2_result (reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
FILE * file;
|
|
||||||
int retval;
|
|
||||||
|
|
||||||
file = open_file("temp_fsck_file.deleteme", "w+");
|
|
||||||
if (!file)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* to be able to restart from semantic we do not need to save
|
|
||||||
anything here, but two magic values */
|
|
||||||
reiserfs_begin_stage_info_save(file, TREE_IS_BUILT);
|
|
||||||
reiserfs_end_stage_info_save (file);
|
|
||||||
close_file (file);
|
|
||||||
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",
|
|
||||||
__FUNCTION__, state_dump_file (fs));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* we have nothing to load from a state file, but we have to fetch
|
|
||||||
on-disk bitmap, copy it to allocable bitmap, and fetch objectid
|
|
||||||
map */
|
|
||||||
void load_pass_2_result (reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
fsck_new_bitmap (fs) = reiserfs_create_bitmap (get_sb_block_count (fs->fs_ondisk_sb));
|
|
||||||
reiserfs_bitmap_copy (fsck_new_bitmap (fs), fs->fs_bitmap2);
|
|
||||||
|
|
||||||
fsck_allocable_bitmap (fs) = reiserfs_create_bitmap (get_sb_block_count (fs->fs_ondisk_sb));
|
|
||||||
reiserfs_bitmap_copy (fsck_allocable_bitmap (fs), fs->fs_bitmap2);
|
|
||||||
|
|
||||||
fs->block_allocator = reiserfsck_reiserfs_new_blocknrs;
|
|
||||||
fs->block_deallocator = reiserfsck_reiserfs_free_block;
|
|
||||||
|
|
||||||
/* we need objectid map on semantic pass to be able to relocate files */
|
|
||||||
proper_id_map (fs) = id_map_init();
|
|
||||||
/* Not implemented yet.
|
|
||||||
fetch_objectid_map (proper_id_map (fs), fs);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* uninsertable blocks are marked by 0s in uninsertable_leaf_bitmap
|
|
||||||
during the pass 1. They must be not in the tree */
|
|
||||||
static void do_pass_2 (reiserfs_filsys_t * fs) {
|
|
||||||
|
|
||||||
struct buffer_head * bh;
|
|
||||||
unsigned long j;
|
|
||||||
int i, what_node;
|
|
||||||
unsigned long done = 0, total;
|
|
||||||
|
|
||||||
|
|
||||||
total = reiserfs_bitmap_zeros(fsck_uninsertables(fs)) * 2;
|
|
||||||
if (!total)
|
|
||||||
return;
|
|
||||||
|
|
||||||
fsck_progress ("\nPass 2:\n");
|
|
||||||
|
|
||||||
for (i = 0; i < 2; i++) {
|
|
||||||
j = 0;
|
|
||||||
while ((j < fsck_uninsertables(fs)->bm_bit_size) &&
|
|
||||||
reiserfs_bitmap_find_zero_bit(fsck_uninsertables(fs), &j) == 0)
|
|
||||||
{
|
|
||||||
bh = bread (fs->fs_dev, j, fs->fs_blocksize);
|
|
||||||
if (bh == 0) {
|
|
||||||
fsck_log ("pass_2: Reading of the block (%lu) failed on the device 0x%x\n",
|
|
||||||
j, fs->fs_dev);
|
|
||||||
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",
|
|
||||||
__FUNCTION__, bh->b_blocknr);
|
|
||||||
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 cont;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
fsck_log ("block %lu is being inserted\n", bh->b_blocknr);
|
|
||||||
check_buffers_mem(fsck_log_file (fs));
|
|
||||||
fflush(fsck_log_file (fs));
|
|
||||||
*/
|
|
||||||
if (i) {
|
|
||||||
/* insert all not SD items */
|
|
||||||
put_not_stat_data_items (bh);
|
|
||||||
pass_2_stat (fs)->leaves ++;
|
|
||||||
make_allocable (j);
|
|
||||||
} else
|
|
||||||
/* insert SD items only */
|
|
||||||
put_stat_data_items (bh);
|
|
||||||
|
|
||||||
print_how_far (fsck_progress_file (fs), &done, total, 1, fsck_quiet (fs));
|
|
||||||
cont:
|
|
||||||
brelse (bh);
|
|
||||||
j ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fsck_progress ("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void after_pass_2 (reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
time_t t;
|
|
||||||
|
|
||||||
/* we can now flush new_bitmap on disk as tree is built and
|
|
||||||
contains all data, which were found on dik at start in
|
|
||||||
used bitmaps */
|
|
||||||
reiserfs_bitmap_copy (fs->fs_bitmap2, fsck_new_bitmap (fs));
|
|
||||||
|
|
||||||
/* we should copy new_bitmap to allocable bitmap, becuase evth what is used
|
|
||||||
for now (marked as used in new_bitmap) should not be allocablel;
|
|
||||||
and what is not in tree for now should be allocable.
|
|
||||||
these bitmaps differ because on pass2 we skip those blocks, whose SD's
|
|
||||||
are not in the tree, and therefore indirect items of such bad leaves points
|
|
||||||
to not used and not allocable blocks.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* DEBUG only */
|
|
||||||
/* if (reiserfs_bitmap_compare (fsck_allocable_bitmap (fs), fsck_new_bitmap(fs))) {
|
|
||||||
fsck_log ("Allocable bitmap differs from the new bitmap after pass2\n");
|
|
||||||
reiserfs_bitmap_copy (fsck_allocable_bitmap(fs), fsck_new_bitmap (fs));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* update super block: objectid map, fsck state */
|
|
||||||
set_sb_fs_state (fs->fs_ondisk_sb, TREE_IS_BUILT);
|
|
||||||
mark_buffer_dirty (fs->fs_super_bh);
|
|
||||||
|
|
||||||
/* write all dirty blocks */
|
|
||||||
fsck_progress ("Flushing..");
|
|
||||||
id_map_flush(proper_id_map (fs), fs);
|
|
||||||
fs->fs_dirt = 1;
|
|
||||||
reiserfs_flush_to_ondisk_bitmap (fs->fs_bitmap2, fs);
|
|
||||||
reiserfs_flush (fs);
|
|
||||||
fsck_progress ("finished\n");
|
|
||||||
|
|
||||||
/* fixme: should be optional */
|
|
||||||
/* fsck_progress ("Tree is built. Checking it - ");
|
|
||||||
reiserfsck_check_pass1 ();
|
|
||||||
fsck_progress ("finished\n");*/
|
|
||||||
|
|
||||||
stage_report (2, fs);
|
|
||||||
|
|
||||||
/* free what we do not need anymore */
|
|
||||||
reiserfs_delete_bitmap (fsck_uninsertables (fs));
|
|
||||||
|
|
||||||
if (!fsck_run_one_step (fs)) {
|
|
||||||
if (fsck_user_confirmed (fs, "Continue? (Yes):", "Yes\n", 1))
|
|
||||||
/* reiserfsck continues */
|
|
||||||
return;
|
|
||||||
} else
|
|
||||||
save_pass_2_result (fs);
|
|
||||||
|
|
||||||
|
|
||||||
id_map_free(proper_id_map (fs));
|
|
||||||
proper_id_map (fs) = 0;
|
|
||||||
|
|
||||||
reiserfs_delete_bitmap (fsck_new_bitmap (fs));
|
|
||||||
reiserfs_delete_bitmap (fsck_allocable_bitmap (fs));
|
|
||||||
|
|
||||||
time (&t);
|
|
||||||
fsck_progress ("###########\n"
|
|
||||||
"reiserfsck finished pass 2 at %s"
|
|
||||||
"###########\n", ctime (&t));
|
|
||||||
fs->fs_dirt = 1;
|
|
||||||
reiserfs_close (fs);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void pass_2 (reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
if (fsck_log_file (fs) != stderr)
|
|
||||||
fsck_log ("####### Pass 2 #######\n");
|
|
||||||
|
|
||||||
before_pass_2 (fs);
|
|
||||||
|
|
||||||
/* take blocks which were not inserted into tree yet and put each
|
|
||||||
item separately */
|
|
||||||
do_pass_2 (fs);
|
|
||||||
|
|
||||||
after_pass_2 (fs);
|
|
||||||
|
|
||||||
if (get_sb_root_block (fs->fs_ondisk_sb) == ~(__u32)0 ||
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
|
||||||
* reiserfsprogs/README
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "fsck.h"
|
|
||||||
|
|
||||||
void pass_4_check_unaccessed_items (void)
|
|
||||||
{
|
|
||||||
struct key key;
|
|
||||||
struct path path;
|
|
||||||
int i;
|
|
||||||
struct buffer_head * bh;
|
|
||||||
struct item_head * ih;
|
|
||||||
unsigned long items;
|
|
||||||
struct key * rdkey;
|
|
||||||
|
|
||||||
path.path_length = ILLEGAL_PATH_ELEMENT_OFFSET;
|
|
||||||
key = root_dir_key;
|
|
||||||
|
|
||||||
fsck_progress ("Pass 4 - ");
|
|
||||||
items = 0;
|
|
||||||
|
|
||||||
while (reiserfs_search_by_key_4 (fs, &key, &path) == ITEM_FOUND) {
|
|
||||||
bh = PATH_PLAST_BUFFER (&path);
|
|
||||||
|
|
||||||
/* print ~ how many leaves were scanned and how fast it was */
|
|
||||||
if (!fsck_quiet (fs))
|
|
||||||
print_how_fast (items++, 0, 50, 0);
|
|
||||||
|
|
||||||
for (i = get_item_pos (&path), ih = get_ih (&path); i < B_NR_ITEMS (bh); i ++, ih ++) {
|
|
||||||
if (!is_item_reachable (ih)) {
|
|
||||||
PATH_LAST_POSITION (&path) = i;
|
|
||||||
rdkey = reiserfs_next_key(&path);
|
|
||||||
if (rdkey)
|
|
||||||
key = *rdkey;
|
|
||||||
else
|
|
||||||
memset (&key, 0xff, KEY_SIZE);
|
|
||||||
|
|
||||||
pass_4_stat (fs)->deleted_items ++;
|
|
||||||
|
|
||||||
reiserfsck_delete_item (&path, 0);
|
|
||||||
|
|
||||||
goto cont;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (get_ih_flags(ih) != 0) {
|
|
||||||
clean_ih_flags(ih);
|
|
||||||
mark_buffer_dirty(bh);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
PATH_LAST_POSITION(&path) = i - 1;
|
|
||||||
rdkey = reiserfs_next_key (&path);
|
|
||||||
if (rdkey)
|
|
||||||
key = *rdkey;
|
|
||||||
else
|
|
||||||
memset (&key, 0xff, KEY_SIZE);
|
|
||||||
|
|
||||||
pathrelse (&path);
|
|
||||||
|
|
||||||
cont:
|
|
||||||
/* to make gcc 3.2 do not sware here */;
|
|
||||||
}
|
|
||||||
|
|
||||||
pathrelse (&path);
|
|
||||||
|
|
||||||
fsck_progress ("finished\n");
|
|
||||||
stage_report (4, fs);
|
|
||||||
|
|
||||||
/* after pass 4 */
|
|
||||||
|
|
||||||
/* put bitmap on place */
|
|
||||||
reiserfs_bitmap_copy (fs->fs_bitmap2, fsck_new_bitmap (fs));
|
|
||||||
|
|
||||||
/* update super block */
|
|
||||||
set_sb_free_blocks (fs->fs_ondisk_sb, reiserfs_bitmap_zeros (fsck_new_bitmap (fs)));
|
|
||||||
mark_buffer_dirty (fs->fs_super_bh);
|
|
||||||
|
|
||||||
/* write all dirty blocks */
|
|
||||||
fsck_progress ("Flushing..");
|
|
||||||
fs->fs_dirt = 1;
|
|
||||||
id_map_flush(proper_id_map (fs), fs);
|
|
||||||
reiserfs_flush_to_ondisk_bitmap (fs->fs_bitmap2, fs);
|
|
||||||
reiserfs_flush (fs);
|
|
||||||
fsck_progress ("finished\n");
|
|
||||||
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
@@ -1,816 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1996-2004 by Hans Reiser, licensing governed by reiserfsprogs/README
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "fsck.h"
|
|
||||||
|
|
||||||
static struct key *trunc_links = NULL;
|
|
||||||
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, 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,
|
|
||||||
struct key * entry_key, struct item_head * ih);
|
|
||||||
void print_name (char * name, int len);
|
|
||||||
void erase_name (int len);
|
|
||||||
|
|
||||||
|
|
||||||
struct path_key
|
|
||||||
{
|
|
||||||
struct short_key
|
|
||||||
{
|
|
||||||
__u32 k_dir_id;
|
|
||||||
__u32 k_objectid;
|
|
||||||
} key;
|
|
||||||
struct path_key * next, * prev;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct path_key * head_key = NULL;
|
|
||||||
struct path_key * tail_key = NULL;
|
|
||||||
|
|
||||||
static int check_path_key(struct key * key)
|
|
||||||
{
|
|
||||||
struct path_key * cur = head_key;
|
|
||||||
|
|
||||||
while(cur != NULL)
|
|
||||||
{
|
|
||||||
if (!comp_short_keys(&cur->key, key)) {
|
|
||||||
fsck_log("\nsemantic check: The directory %k has 2 names.", key);
|
|
||||||
return LOOP_FOUND;
|
|
||||||
}
|
|
||||||
cur = cur->next;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int add_path_key(struct key * key)
|
|
||||||
{
|
|
||||||
if (check_path_key(key))
|
|
||||||
return LOOP_FOUND;
|
|
||||||
|
|
||||||
if (tail_key == NULL)
|
|
||||||
{
|
|
||||||
tail_key = getmem(sizeof(struct path_key));
|
|
||||||
head_key = tail_key;
|
|
||||||
tail_key->prev = NULL;
|
|
||||||
}else{
|
|
||||||
tail_key->next = getmem(sizeof(struct path_key));
|
|
||||||
tail_key->next->prev = tail_key;
|
|
||||||
tail_key = tail_key->next;
|
|
||||||
}
|
|
||||||
copy_short_key (&tail_key->key, key);
|
|
||||||
tail_key->next = NULL;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void del_path_key()
|
|
||||||
{
|
|
||||||
if (tail_key == NULL)
|
|
||||||
die("Wrong path_key structure");
|
|
||||||
|
|
||||||
if (tail_key->prev == NULL)
|
|
||||||
{
|
|
||||||
freemem(tail_key);
|
|
||||||
tail_key = head_key = NULL;
|
|
||||||
}else{
|
|
||||||
tail_key = tail_key->prev;
|
|
||||||
freemem(tail_key->next);
|
|
||||||
tail_key->next = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* path is path to stat data. If file will be relocated - new_ih will contain
|
|
||||||
a key file was relocated with */
|
|
||||||
static int check_check_regular_file (struct path * path, void * sd,
|
|
||||||
struct item_head * new_ih)
|
|
||||||
{
|
|
||||||
int is_new_file;
|
|
||||||
// struct key key, sd_key;
|
|
||||||
__u16 mode;
|
|
||||||
__u32 nlink;
|
|
||||||
__u64 real_size, sd_size;
|
|
||||||
__u32 blocks, sd_blocks; /* proper values and value in stat data */
|
|
||||||
__u32 first_direct_byte, sd_first_direct_byte;
|
|
||||||
|
|
||||||
struct item_head * ih, sd_ih;
|
|
||||||
int fix_sd;
|
|
||||||
int symlnk = 0;
|
|
||||||
int retval = OK;
|
|
||||||
__u32 tmp_position;
|
|
||||||
|
|
||||||
|
|
||||||
ih = get_ih (path);
|
|
||||||
|
|
||||||
if (new_ih) {
|
|
||||||
/* this objectid is used already */
|
|
||||||
*new_ih = *ih;
|
|
||||||
pathrelse (path);
|
|
||||||
rewrite_file (new_ih, 1, 1);
|
|
||||||
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)
|
|
||||||
reiserfs_panic ("check_check_regular_file: Could not find a StatData of "
|
|
||||||
"the relocated file %K", &new_ih->ih_key);
|
|
||||||
/* stat data is marked unreachable again due to relocation, fix that */
|
|
||||||
ih = get_ih (path);
|
|
||||||
sd = get_item (path);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (get_ih_item_len (ih) == SD_SIZE)
|
|
||||||
is_new_file = 1;
|
|
||||||
else
|
|
||||||
is_new_file = 0;
|
|
||||||
|
|
||||||
|
|
||||||
get_sd_nlink (ih, sd, &nlink);
|
|
||||||
get_sd_mode (ih, sd, &mode);
|
|
||||||
get_sd_size (ih, sd, &sd_size);
|
|
||||||
get_sd_blocks (ih, sd, &sd_blocks);
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (fsck_mode (fs) == FSCK_FIX_FIXABLE) {
|
|
||||||
// check and set nlink first
|
|
||||||
nlink ++;
|
|
||||||
set_sd_nlink (ih, sd, &nlink);
|
|
||||||
mark_buffer_dirty (bh);
|
|
||||||
|
|
||||||
if (nlink > 1)
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!is_new_file)
|
|
||||||
get_sd_first_direct_byte (ih, sd, &sd_first_direct_byte);
|
|
||||||
|
|
||||||
if (S_ISLNK (mode))
|
|
||||||
symlnk = 1;
|
|
||||||
|
|
||||||
sd_ih = *ih;
|
|
||||||
// sd_key = sd_ih.ih_key;
|
|
||||||
pathrelse (path);
|
|
||||||
|
|
||||||
if (are_file_items_correct (&sd_ih, sd, &real_size, &blocks, 0/* do not mark reachable */,
|
|
||||||
&symlnk) != 1)
|
|
||||||
{
|
|
||||||
one_more_corruption (fs, FATAL);
|
|
||||||
fsck_log ("check_regular_file: The file %K with the corrupted structure found\n",
|
|
||||||
&sd_ih.ih_key);
|
|
||||||
} else {
|
|
||||||
fix_sd = 0;
|
|
||||||
|
|
||||||
fix_sd += wrong_mode (&sd_ih.ih_key, &mode, real_size, symlnk);
|
|
||||||
if (!is_new_file)
|
|
||||||
fix_sd += wrong_first_direct_byte (&sd_ih.ih_key, fs->fs_blocksize,
|
|
||||||
&first_direct_byte, sd_first_direct_byte, real_size);
|
|
||||||
|
|
||||||
if (reiserfs_bin_search(&sd_ih.ih_key, trunc_links, links_num, sizeof(sd_ih.ih_key),
|
|
||||||
&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,
|
|
||||||
symlnk ? TYPE_SYMLINK : 0);
|
|
||||||
} else {
|
|
||||||
real_size = sd_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
fix_sd += wrong_st_blocks (&sd_ih.ih_key, &blocks, sd_blocks, mode, is_new_file);
|
|
||||||
|
|
||||||
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);
|
|
||||||
return STAT_DATA_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
bh = get_bh (path);
|
|
||||||
ih = get_ih (path);
|
|
||||||
sd = get_item (path);
|
|
||||||
set_sd_size (ih, sd, &real_size);
|
|
||||||
set_sd_blocks (ih, sd, &blocks);
|
|
||||||
set_sd_mode (ih, sd, &mode);
|
|
||||||
if (!is_new_file)
|
|
||||||
set_sd_first_direct_byte (ih, sd, &first_direct_byte);
|
|
||||||
mark_buffer_dirty (bh);
|
|
||||||
} else {
|
|
||||||
fsck_check_stat (fs)->fixable_corruptions += fix_sd;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* returns buffer, containing found directory item.*/
|
|
||||||
static char * get_next_directory_item (
|
|
||||||
struct key * key, /* on return this will contain key of next item in the tree */
|
|
||||||
struct key * parent, struct item_head * ih, __u32 * pos_in_item, int dir_format)
|
|
||||||
{
|
|
||||||
INITIALIZE_PATH (path);
|
|
||||||
char * dir_item;
|
|
||||||
struct key * rdkey;
|
|
||||||
struct buffer_head * bh;
|
|
||||||
struct reiserfs_de_head * deh;
|
|
||||||
int i;
|
|
||||||
int retval;
|
|
||||||
|
|
||||||
|
|
||||||
start_again:
|
|
||||||
|
|
||||||
retval = reiserfs_search_by_entry_key (fs, key, &path);
|
|
||||||
|
|
||||||
if (retval != POSITION_FOUND && get_offset (key) != DOT_OFFSET)
|
|
||||||
reiserfs_panic ("get_next_directory_item: The current directory %k cannot be found",
|
|
||||||
key);
|
|
||||||
|
|
||||||
/* leaf containing directory item */
|
|
||||||
bh = PATH_PLAST_BUFFER (&path);
|
|
||||||
*pos_in_item = path.pos_in_item;
|
|
||||||
*ih = *get_ih (&path);
|
|
||||||
deh = B_I_DEH (bh, ih);
|
|
||||||
|
|
||||||
/* position was not found for '.' or there is no '..' */
|
|
||||||
if (retval != POSITION_FOUND || ((get_offset (key) == DOT_OFFSET) &&
|
|
||||||
(get_ih_entry_count (ih) < 2 || name_in_entry_length (ih, deh + 1, 1) != 2 ||
|
|
||||||
strncmp (name_in_entry (deh + 1, 1), "..", 2)))) {
|
|
||||||
|
|
||||||
fsck_log ("get_next_directory_item: The %s %k cannot be found in %k",
|
|
||||||
(retval == POSITION_NOT_FOUND) ? "entry" : "directory", key, &ih->ih_key);
|
|
||||||
|
|
||||||
if (fsck_mode (fs) == FSCK_FIX_FIXABLE) {
|
|
||||||
/* add "." and ".." exist */
|
|
||||||
pathrelse (&path);
|
|
||||||
reiserfs_add_entry (fs, key, ".", name_length (".", dir_format), key, 0);
|
|
||||||
reiserfs_add_entry (fs, key, "..", name_length ("..", dir_format), parent, 0);
|
|
||||||
fsck_log (" - entry was added\n");
|
|
||||||
goto start_again;
|
|
||||||
} else {
|
|
||||||
one_more_corruption (fs, FIXABLE);
|
|
||||||
fsck_log ("\n");
|
|
||||||
if (retval == DIRECTORY_NOT_FOUND)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* make sure, that ".." exists as well */
|
|
||||||
/*
|
|
||||||
if (get_offset (key) == DOT_OFFSET) {
|
|
||||||
if (get_ih_entry_count (ih) < 2 ||
|
|
||||||
name_in_entry_length (ih, deh + 1, 1) != 2 ||
|
|
||||||
strncmp (name_in_entry (deh + 1, 1), "..", 2))
|
|
||||||
{
|
|
||||||
fsck_log ("get_next_directory_item: \"..\" not found in %H\n", ih);
|
|
||||||
pathrelse (&path);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/* 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;
|
|
||||||
char * name;
|
|
||||||
|
|
||||||
name = name_in_entry (deh, i);
|
|
||||||
namelen = name_in_entry_length (ih, deh, i);
|
|
||||||
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);
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (get_deh_offset (deh) == DOT_OFFSET) {
|
|
||||||
if (not_of_one_file (&(deh->deh2_dir_id), key)) {
|
|
||||||
/* "." must point to the directory it is in */
|
|
||||||
|
|
||||||
//deh->deh_objectid != REISERFS_ROOT_PARENT_OBJECTID)/*????*/ {
|
|
||||||
fsck_log ("get_next_directory_item: The entry \".\" of the directory %K "
|
|
||||||
"pointes to %K, instead of %K", key, (struct key *)(&(deh->deh2_dir_id)),
|
|
||||||
key);
|
|
||||||
if (fsck_mode (fs) == FSCK_FIX_FIXABLE) {
|
|
||||||
set_deh_dirid (deh, get_key_dirid (key));
|
|
||||||
set_deh_objectid (deh, get_key_objectid (key));
|
|
||||||
mark_buffer_dirty (bh);
|
|
||||||
fsck_log (" - corrected\n");
|
|
||||||
} else {
|
|
||||||
one_more_corruption (fs, FIXABLE);
|
|
||||||
fsck_log ("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (get_deh_offset (deh) == DOT_DOT_OFFSET) {
|
|
||||||
/* set ".." so that it points to the correct parent directory */
|
|
||||||
if (comp_short_keys (&(deh->deh2_dir_id), parent)) {
|
|
||||||
fsck_log ("get_next_directory_item: The entry \"..\" of the directory %K "
|
|
||||||
"pointes to %K, instead of %K", key, (struct key *)(&(deh->deh2_dir_id)));
|
|
||||||
if (fsck_mode (fs) == FSCK_FIX_FIXABLE) {
|
|
||||||
set_deh_dirid (deh, get_key_dirid (parent));
|
|
||||||
set_deh_objectid (deh, get_key_objectid (parent));
|
|
||||||
mark_buffer_dirty (bh);
|
|
||||||
fsck_log (" - corrected\n");
|
|
||||||
} else {
|
|
||||||
one_more_corruption (fs, FIXABLE);
|
|
||||||
fsck_log ("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* copy directory item to the temporary buffer */
|
|
||||||
dir_item = getmem (get_ih_item_len (ih));
|
|
||||||
memcpy (dir_item, B_I_PITEM (bh, ih), get_ih_item_len (ih));
|
|
||||||
|
|
||||||
|
|
||||||
/* next item key */
|
|
||||||
if (PATH_LAST_POSITION (&path) == (B_NR_ITEMS (bh) - 1) &&
|
|
||||||
(rdkey = uget_rkey (&path)))
|
|
||||||
copy_key (key, rdkey);
|
|
||||||
else {
|
|
||||||
set_key_dirid (key, 0);
|
|
||||||
set_key_objectid (key, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fsck_mode (fs) == FSCK_REBUILD)
|
|
||||||
mark_item_reachable (get_ih (&path), bh);
|
|
||||||
pathrelse (&path);
|
|
||||||
|
|
||||||
return dir_item;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* semantic pass of --check */
|
|
||||||
static int check_semantic_pass (struct key * key, struct key * parent, int dot_dot,
|
|
||||||
struct item_head * new_ih)
|
|
||||||
{
|
|
||||||
struct path path;
|
|
||||||
void * sd;
|
|
||||||
__u32 nlink;
|
|
||||||
int is_new_dir;
|
|
||||||
struct buffer_head * bh;
|
|
||||||
struct item_head * ih;
|
|
||||||
int retval;
|
|
||||||
char * dir_item;
|
|
||||||
__u32 pos_in_item;
|
|
||||||
struct item_head tmp_ih;
|
|
||||||
struct key next_item_key, entry_key, object_key;
|
|
||||||
__u64 dir_size = 0;
|
|
||||||
__u32 blocks;
|
|
||||||
__u64 sd_size;
|
|
||||||
__u32 sd_blocks;
|
|
||||||
int fix_sd;
|
|
||||||
/*int relocate;*/
|
|
||||||
int dir_format = 0;
|
|
||||||
__u16 mode;
|
|
||||||
|
|
||||||
retval = OK;
|
|
||||||
|
|
||||||
/* 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);
|
|
||||||
return STAT_DATA_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* look for stat data of an object */
|
|
||||||
if (reiserfs_search_by_key_4 (fs, key, &path) == ITEM_NOT_FOUND) {
|
|
||||||
pathrelse (&path);
|
|
||||||
return STAT_DATA_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* stat data has been found */
|
|
||||||
ih = get_ih (&path);
|
|
||||||
sd = get_item(&path);
|
|
||||||
|
|
||||||
get_sd_nlink (ih, sd, &nlink);
|
|
||||||
|
|
||||||
/* 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 0
|
|
||||||
if ((/* relocate = */ should_be_relocated(&ih->ih_key))) {
|
|
||||||
/*
|
|
||||||
if (fsck_mode(fs) == FSCK_CHECK)
|
|
||||||
relocate = 0;
|
|
||||||
*/
|
|
||||||
one_more_corruption(fs, FATAL);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fix_obviously_wrong_sd_mode (&path)) {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (not_a_directory (sd)) {
|
|
||||||
fsck_check_stat (fs)->files ++;
|
|
||||||
|
|
||||||
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 "
|
|
||||||
"%K", &ih->ih_key);
|
|
||||||
*new_ih = *ih;
|
|
||||||
pathrelse (&path);
|
|
||||||
sem_pass_stat (fs)->oid_sharing_dirs_relocated ++;
|
|
||||||
relocate_dir (new_ih, 1);
|
|
||||||
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) {
|
|
||||||
// it looks like stat data of a directory found
|
|
||||||
if (nlink) {
|
|
||||||
// we saw this directory already
|
|
||||||
if (!dot_dot) {
|
|
||||||
// this name is not ".." - and hard links are not allowed on directories
|
|
||||||
pathrelse (&path);
|
|
||||||
return STAT_DATA_NOT_FOUND;
|
|
||||||
} else {
|
|
||||||
// ".." found
|
|
||||||
nlink ++;
|
|
||||||
set_sd_nlink (ih, sd, &nlink);
|
|
||||||
mark_buffer_dirty (get_bh (&path));
|
|
||||||
pathrelse (&path);
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
} // do not run it for dot_dot on check at all
|
|
||||||
|
|
||||||
nlink = 2;
|
|
||||||
if (get_key_objectid (key) == REISERFS_ROOT_OBJECTID)
|
|
||||||
nlink ++;
|
|
||||||
set_sd_nlink (ih, sd, &nlink);
|
|
||||||
mark_buffer_dirty (get_bh (&path));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* directory stat data found */
|
|
||||||
if (get_ih_item_len (ih) == SD_SIZE)
|
|
||||||
is_new_dir = 1;
|
|
||||||
else
|
|
||||||
is_new_dir = 0;
|
|
||||||
|
|
||||||
/* save stat data's size and st_blocks */
|
|
||||||
get_sd_size (ih, sd, &sd_size);
|
|
||||||
get_sd_blocks (ih, sd, &sd_blocks);
|
|
||||||
get_sd_mode (ih, sd, &mode);
|
|
||||||
|
|
||||||
dir_format = (get_ih_item_len (get_ih (&path)) == SD_SIZE) ? KEY_FORMAT_2 : KEY_FORMAT_1;
|
|
||||||
|
|
||||||
/* release path pointing to stat data */
|
|
||||||
pathrelse (&path);
|
|
||||||
|
|
||||||
fsck_check_stat (fs)->dirs ++;
|
|
||||||
|
|
||||||
set_key_dirid (&next_item_key, get_key_dirid (key));
|
|
||||||
set_key_objectid (&next_item_key, get_key_objectid (key));
|
|
||||||
set_key_offset_v1 (&next_item_key, DOT_OFFSET);
|
|
||||||
set_key_uniqueness (&next_item_key, DIRENTRY_UNIQUENESS);
|
|
||||||
|
|
||||||
dir_size = 0;
|
|
||||||
while ((dir_item = get_next_directory_item (&next_item_key, parent, &tmp_ih,
|
|
||||||
&pos_in_item, dir_format)) != 0)
|
|
||||||
{
|
|
||||||
/* dir_item is copy of the item in separately allocated memory,
|
|
||||||
item_key is a key of next item in the tree */
|
|
||||||
int i;
|
|
||||||
char * name = 0;
|
|
||||||
int namelen, entry_len;
|
|
||||||
struct reiserfs_de_head * deh = (struct reiserfs_de_head *)dir_item + pos_in_item;
|
|
||||||
|
|
||||||
|
|
||||||
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);
|
|
||||||
name = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
namelen = name_in_entry_length (&tmp_ih, deh, i);
|
|
||||||
asprintf (&name, "%.*s", namelen, name_in_entry (deh, i));
|
|
||||||
entry_len = entry_length (&tmp_ih, deh, i);
|
|
||||||
|
|
||||||
get_object_key (deh, &object_key, &entry_key, &tmp_ih);
|
|
||||||
|
|
||||||
if ((dir_format == KEY_FORMAT_2) && (entry_len % 8 != 0)) {
|
|
||||||
/* not alighed directory of new format - delete it */
|
|
||||||
if (fsck_mode (fs) == FSCK_FIX_FIXABLE) {
|
|
||||||
fsck_log ("Entry %K (\"%.*s\") in the directory %K is not formated "
|
|
||||||
"properly - deleted\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);
|
|
||||||
reiserfs_add_entry (fs, key, name, entry_len,
|
|
||||||
(struct key *)&(deh->deh2_dir_id), 0);
|
|
||||||
} else {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
print_name (name, namelen);
|
|
||||||
|
|
||||||
if (!is_properly_hashed (fs, name, namelen, get_deh_offset (deh))) {
|
|
||||||
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 ".." */
|
|
||||||
ret = OK;
|
|
||||||
} else {
|
|
||||||
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 ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
erase_name (namelen);
|
|
||||||
|
|
||||||
/* check what check_semantic_tree returned */
|
|
||||||
switch (ret) {
|
|
||||||
case OK:
|
|
||||||
dir_size += DEH_SIZE + entry_len;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case STAT_DATA_NOT_FOUND:
|
|
||||||
fsck_log ("check_semantic_pass: Name \"%.*s\" in directory %K points to "
|
|
||||||
"nowhere\n", namelen, name, &tmp_ih.ih_key);
|
|
||||||
case LOOP_FOUND:
|
|
||||||
if (fsck_mode (fs) == FSCK_FIX_FIXABLE) {
|
|
||||||
reiserfs_remove_entry (fs, &entry_key);
|
|
||||||
fsck_log (" - removed");
|
|
||||||
} else {
|
|
||||||
one_more_corruption (fs, FIXABLE);
|
|
||||||
}
|
|
||||||
fsck_log ("\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DIRECTORY_HAS_NO_ITEMS:
|
|
||||||
fsck_log ("check_semantic_pass: Name \"%.*s\" in directory %K points a "
|
|
||||||
"directory without body\n", namelen, name, &tmp_ih.ih_key);
|
|
||||||
|
|
||||||
/* fixme: stat data should be deleted as well */
|
|
||||||
/*
|
|
||||||
if (fsck_fix_fixable (fs)) {
|
|
||||||
reiserfs_remove_entry (fs, &entry_key);
|
|
||||||
fsck_data(fs)->deleted_entries ++;
|
|
||||||
fsck_log (" - removed");
|
|
||||||
}
|
|
||||||
fsck_log ("\n");*/
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RELOCATED:
|
|
||||||
/* file was relocated, update key in corresponding directory entry */
|
|
||||||
if (reiserfs_search_by_entry_key (fs, &entry_key, &path) != POSITION_FOUND) {
|
|
||||||
fsck_log("Cannot find a name of the relocated file %K in the directory "
|
|
||||||
"%K\n", &entry_key, &tmp_ih.ih_key);
|
|
||||||
} else {
|
|
||||||
/* update key dir entry points to */
|
|
||||||
struct reiserfs_de_head * tmp_deh;
|
|
||||||
|
|
||||||
tmp_deh = B_I_DEH (get_bh (&path), get_ih (&path)) + path.pos_in_item;
|
|
||||||
fsck_log ("The directory %K pointing to %K (\"%.*s\") updated to point "
|
|
||||||
"to ", &tmp_ih.ih_key, &tmp_deh->deh2_dir_id, namelen, name);
|
|
||||||
set_deh_dirid (tmp_deh, get_key_dirid (&relocated_ih.ih_key));
|
|
||||||
set_deh_objectid (tmp_deh, get_key_objectid (&relocated_ih.ih_key));
|
|
||||||
|
|
||||||
fsck_log ("%K (\"%.*s\")\n", &tmp_deh->deh2_dir_id, namelen, name);
|
|
||||||
mark_buffer_dirty (get_bh (&path));
|
|
||||||
}
|
|
||||||
dir_size += DEH_SIZE + entry_len;
|
|
||||||
pathrelse (&path);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} /* for */
|
|
||||||
|
|
||||||
freemem (dir_item);
|
|
||||||
free (name);
|
|
||||||
name = 0;
|
|
||||||
|
|
||||||
if (not_of_one_file (&next_item_key, key))
|
|
||||||
/* next key is not of this directory */
|
|
||||||
break;
|
|
||||||
|
|
||||||
} /* while (dir_item) */
|
|
||||||
|
|
||||||
|
|
||||||
if (dir_size == 0)
|
|
||||||
/* FIXME: is it possible? */
|
|
||||||
return DIRECTORY_HAS_NO_ITEMS;
|
|
||||||
|
|
||||||
/* calc correct value of sd_blocks field of stat data */
|
|
||||||
blocks = dir_size2st_blocks (dir_size);
|
|
||||||
|
|
||||||
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, TYPE_DIRENTRY);
|
|
||||||
|
|
||||||
if (fix_sd) {
|
|
||||||
if (fsck_mode (fs) == FSCK_FIX_FIXABLE) {
|
|
||||||
/* we have to fix either sd_size or sd_blocks, so look for stat data again */
|
|
||||||
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);
|
|
||||||
return STAT_DATA_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
bh = get_bh (&path);
|
|
||||||
ih = get_ih (&path);
|
|
||||||
sd = get_item (&path);
|
|
||||||
|
|
||||||
set_sd_size (ih, sd, &dir_size);
|
|
||||||
set_sd_blocks (ih, sd, &blocks);
|
|
||||||
mark_buffer_dirty (bh);
|
|
||||||
pathrelse (&path);
|
|
||||||
} else {
|
|
||||||
fsck_check_stat (fs)->fixable_corruptions += fix_sd;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
int check_safe_links ()
|
|
||||||
{
|
|
||||||
struct path safe_link_path, path;
|
|
||||||
struct key safe_link_key = {-1, 0, {{0, 0}}};
|
|
||||||
struct key key = {0, 0, {{0, 0}}};
|
|
||||||
struct key * rkey;
|
|
||||||
struct item_head * tmp_ih;
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
if (get_key_dirid (&safe_link_key) == 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
reiserfs_search_by_key_4 (fs, &safe_link_key, &safe_link_path);
|
|
||||||
|
|
||||||
if (get_blkh_nr_items ( B_BLK_HEAD (get_bh(&safe_link_path))) <=
|
|
||||||
PATH_LAST_POSITION (&safe_link_path))
|
|
||||||
{
|
|
||||||
pathrelse (&safe_link_path);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp_ih = get_ih(&safe_link_path);
|
|
||||||
|
|
||||||
if (get_key_dirid(&tmp_ih->ih_key) != (__u32)-1 ||
|
|
||||||
get_key_objectid(&tmp_ih->ih_key) == (__u32)-1) {
|
|
||||||
pathrelse (&safe_link_path);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (get_ih_item_len (tmp_ih) != 4)
|
|
||||||
reiserfs_panic ("Safe Link %k cannot be of the size %d",
|
|
||||||
&tmp_ih->ih_key, get_ih_item_len (tmp_ih));
|
|
||||||
|
|
||||||
set_key_dirid(&key, d32_get((__u32 *)get_item(&safe_link_path), 0));
|
|
||||||
set_key_objectid(&key, get_key_objectid(&tmp_ih->ih_key));
|
|
||||||
if ((rkey = reiserfs_next_key(&safe_link_path)) == NULL)
|
|
||||||
set_key_dirid (&safe_link_key, 0);
|
|
||||||
else
|
|
||||||
safe_link_key = *rkey;
|
|
||||||
|
|
||||||
if (reiserfs_search_by_key_4 (fs, &key, &path) == ITEM_NOT_FOUND) {
|
|
||||||
/*sware on check, delete on fix-fixable*/
|
|
||||||
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);
|
|
||||||
} 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);
|
|
||||||
d32_put((__u32 *)get_item(&safe_link_path), 0, 0);
|
|
||||||
pathrelse (&path);
|
|
||||||
reiserfsck_delete_item (&safe_link_path, 0);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} else if (get_offset(&tmp_ih->ih_key) == 0x1) {
|
|
||||||
/* Truncate */
|
|
||||||
if (!not_a_directory (get_item(&path))) {
|
|
||||||
/*truncate on directory should not happen*/
|
|
||||||
/*sware on check, delete on fix-fixable*/
|
|
||||||
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);
|
|
||||||
} 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);
|
|
||||||
d32_put((__u32 *)get_item(&safe_link_path), 0, 0);
|
|
||||||
pathrelse (&path);
|
|
||||||
reiserfsck_delete_item (&safe_link_path, 0);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* save 'safe truncate links' to avoid swaring on wrong sizes. */
|
|
||||||
__u32 position;
|
|
||||||
|
|
||||||
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,
|
|
||||||
sizeof(key), &position);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pathrelse (&path);
|
|
||||||
pathrelse (&safe_link_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void release_safe_links () {
|
|
||||||
freemem(trunc_links);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* called when --check is given */
|
|
||||||
void semantic_check (void)
|
|
||||||
{
|
|
||||||
if (fsck_data (fs)->check.bad_nodes) {
|
|
||||||
fsck_progress ("Bad nodes were found, Semantic pass skipped\n");
|
|
||||||
goto clean;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fsck_data (fs)->check.fatal_corruptions) {
|
|
||||||
fsck_progress ("Fatal corruptions were found, Semantic pass skipped\n");
|
|
||||||
goto clean;
|
|
||||||
}
|
|
||||||
|
|
||||||
fsck_progress ("Checking Semantic tree:\n");
|
|
||||||
|
|
||||||
if (fsck_mode(fs) == FSCK_FIX_FIXABLE) {
|
|
||||||
/*create new_bitmap, and initialize new_bitmap & allocable bitmap*/
|
|
||||||
fsck_new_bitmap (fs) = reiserfs_create_bitmap(get_sb_block_count(fs->fs_ondisk_sb));
|
|
||||||
reiserfs_bitmap_copy (fsck_new_bitmap (fs), fs->fs_bitmap2);
|
|
||||||
fsck_allocable_bitmap (fs) = reiserfs_create_bitmap(get_sb_block_count
|
|
||||||
(fs->fs_ondisk_sb));
|
|
||||||
reiserfs_bitmap_copy (fsck_allocable_bitmap (fs), fs->fs_bitmap2);
|
|
||||||
fs->block_allocator = reiserfsck_reiserfs_new_blocknrs;
|
|
||||||
fs->block_deallocator = reiserfsck_reiserfs_free_block;
|
|
||||||
}
|
|
||||||
|
|
||||||
check_safe_links ();
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
release_safe_links ();
|
|
||||||
|
|
||||||
if (fsck_mode(fs) == FSCK_FIX_FIXABLE) {
|
|
||||||
reiserfs_delete_bitmap (fs->fs_bitmap2);
|
|
||||||
reiserfs_bitmap_delta (fsck_new_bitmap (fs), fsck_deallocate_bitmap (fs));
|
|
||||||
fs->fs_bitmap2 = fsck_new_bitmap (fs);
|
|
||||||
reiserfs_delete_bitmap (fsck_allocable_bitmap (fs));
|
|
||||||
fsck_allocable_bitmap (fs) = NULL;
|
|
||||||
set_sb_free_blocks (fs->fs_ondisk_sb, reiserfs_bitmap_zeros (fs->fs_bitmap2));
|
|
||||||
mark_buffer_dirty (fs->fs_super_bh);
|
|
||||||
add_badblock_list(fs, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
fsck_progress ("finished\n");
|
|
||||||
|
|
||||||
clean:
|
|
||||||
if (fsck_deallocate_bitmap (fs))
|
|
||||||
reiserfs_delete_bitmap (fsck_deallocate_bitmap (fs));
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large.
Load diff
-1222
File diff suppressed because it is too large.
Load diff
-282
@@ -1,282 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
|
||||||
* reiserfsprogs/README
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "fsck.h"
|
|
||||||
|
|
||||||
struct tree_balance * cur_tb = 0;
|
|
||||||
|
|
||||||
void reiserfsck_paste_into_item (struct path * path, const char * body, int size)
|
|
||||||
{
|
|
||||||
struct tree_balance tb;
|
|
||||||
|
|
||||||
init_tb_struct (&tb, fs, path, size);
|
|
||||||
if (fix_nodes (/*tb.transaction_handle,*/ M_PASTE, &tb, 0/*ih*/) != CARRY_ON)
|
|
||||||
//fix_nodes(options, tree_balance, ih_to_option, body_to_option)
|
|
||||||
|
|
||||||
die ("reiserfsck_paste_into_item: fix_nodes failed");
|
|
||||||
|
|
||||||
do_balance (/*tb.transaction_handle,*/ &tb, 0, body, M_PASTE, 0/*zero num*/);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void reiserfsck_insert_item (struct path * path, struct item_head * ih, const char * body)
|
|
||||||
{
|
|
||||||
struct tree_balance tb;
|
|
||||||
|
|
||||||
init_tb_struct (&tb, fs, path, IH_SIZE + get_ih_item_len(ih));
|
|
||||||
if (fix_nodes (/*tb.transaction_handle,*/ M_INSERT, &tb, ih/*, body*/) != CARRY_ON)
|
|
||||||
die ("reiserfsck_insert_item: fix_nodes failed");
|
|
||||||
do_balance (/*tb.transaction_handle,*/ &tb, ih, body, M_INSERT, 0/*zero num*/);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void free_unformatted_nodes (struct item_head * ih, struct buffer_head * bh)
|
|
||||||
{
|
|
||||||
__u32 * punfm = (__u32 *)B_I_PITEM (bh, ih);
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i = 0; i < I_UNFM_NUM (ih); i ++) {
|
|
||||||
__u32 unfm = d32_get (punfm, i);
|
|
||||||
if (unfm != 0) {
|
|
||||||
struct buffer_head * to_be_forgotten;
|
|
||||||
|
|
||||||
to_be_forgotten = find_buffer (fs->fs_dev, unfm, fs->fs_blocksize);
|
|
||||||
if (to_be_forgotten) {
|
|
||||||
//atomic_inc(&to_be_forgotten->b_count);
|
|
||||||
to_be_forgotten->b_count ++;
|
|
||||||
bforget (to_be_forgotten);
|
|
||||||
}
|
|
||||||
|
|
||||||
reiserfs_free_block (fs, unfm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void reiserfsck_delete_item (struct path * path, int temporary)
|
|
||||||
{
|
|
||||||
struct tree_balance tb;
|
|
||||||
struct item_head * ih = PATH_PITEM_HEAD (path);
|
|
||||||
|
|
||||||
if (is_indirect_ih (ih) && !temporary)
|
|
||||||
free_unformatted_nodes (ih, PATH_PLAST_BUFFER (path));
|
|
||||||
|
|
||||||
init_tb_struct (&tb, fs, path, -(IH_SIZE + get_ih_item_len(ih)));
|
|
||||||
|
|
||||||
if (fix_nodes (/*tb.transaction_handle,*/ M_DELETE, &tb, 0/*ih*/) != CARRY_ON)
|
|
||||||
die ("reiserfsck_delete_item: fix_nodes failed");
|
|
||||||
|
|
||||||
do_balance (/*tb.transaction_handle,*/ &tb, 0, 0, M_DELETE, 0/*zero num*/);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void reiserfsck_cut_from_item (struct path * path, int cut_size)
|
|
||||||
{
|
|
||||||
struct tree_balance tb;
|
|
||||||
struct item_head * ih;
|
|
||||||
|
|
||||||
if (cut_size >= 0)
|
|
||||||
die ("reiserfsck_cut_from_item: cut size == %d", cut_size);
|
|
||||||
|
|
||||||
if (is_indirect_ih (ih = PATH_PITEM_HEAD (path))) {
|
|
||||||
struct buffer_head *bh = PATH_PLAST_BUFFER (path);
|
|
||||||
__u32 unfm_ptr = d32_get ((__u32 *)B_I_PITEM(bh, ih), I_UNFM_NUM (ih) - 1);
|
|
||||||
if (unfm_ptr != 0) {
|
|
||||||
struct buffer_head * to_be_forgotten;
|
|
||||||
|
|
||||||
to_be_forgotten = find_buffer (fs->fs_dev, unfm_ptr, fs->fs_blocksize);
|
|
||||||
if (to_be_forgotten) {
|
|
||||||
//atomic_inc(&to_be_forgotten->b_count);
|
|
||||||
to_be_forgotten->b_count ++;
|
|
||||||
bforget (to_be_forgotten);
|
|
||||||
}
|
|
||||||
reiserfs_free_block (fs, unfm_ptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
init_tb_struct (&tb, fs, path, cut_size);
|
|
||||||
|
|
||||||
if (fix_nodes (/*tb.transaction_handle,*/ M_CUT, &tb, 0) != CARRY_ON)
|
|
||||||
die ("reiserfsck_cut_from_item: fix_nodes failed");
|
|
||||||
|
|
||||||
do_balance (/*tb.transaction_handle,*/ &tb, 0, 0, M_CUT, 0/*zero num*/);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* uget_rkey is utils clone of stree.c/get_rkey */
|
|
||||||
/*
|
|
||||||
struct key * uget_rkey (struct path * path)
|
|
||||||
{
|
|
||||||
int pos, offset = path->path_length;
|
|
||||||
struct buffer_head * bh;
|
|
||||||
|
|
||||||
if (offset < FIRST_PATH_ELEMENT_OFFSET)
|
|
||||||
die ("uget_rkey: illegal offset in the path (%d)", offset);
|
|
||||||
|
|
||||||
while (offset-- > FIRST_PATH_ELEMENT_OFFSET) {
|
|
||||||
if (! buffer_uptodate (PATH_OFFSET_PBUFFER (path, offset)))
|
|
||||||
die ("uget_rkey: parent is not uptodate");
|
|
||||||
|
|
||||||
// Parent at the path is not in the tree now.
|
|
||||||
if (! B_IS_IN_TREE (bh = PATH_OFFSET_PBUFFER (path, offset)))
|
|
||||||
die ("uget_rkey: buffer on the path is not in tree");
|
|
||||||
|
|
||||||
// Check whether position in the parrent is correct.
|
|
||||||
if ((pos = PATH_OFFSET_POSITION (path, offset)) > B_NR_ITEMS (bh))
|
|
||||||
die ("uget_rkey: invalid position (%d) in the path", pos);
|
|
||||||
|
|
||||||
// Check whether parent at the path really points to the child.
|
|
||||||
if (get_dc_child_blocknr (B_N_CHILD (bh, pos)) != PATH_OFFSET_PBUFFER (path, offset + 1)->b_blocknr)
|
|
||||||
die ("uget_rkey: invalid block number (%d). Must be %ld",
|
|
||||||
get_dc_child_blocknr (B_N_CHILD (bh, pos)), PATH_OFFSET_PBUFFER (path, offset + 1)->b_blocknr);
|
|
||||||
|
|
||||||
// Return delimiting key if position in the parent is not the last one.
|
|
||||||
if (pos != B_NR_ITEMS (bh))
|
|
||||||
return B_N_PDELIM_KEY(bh, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
// there is no right delimiting key
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned long first_child (struct buffer_head * bh)
|
|
||||||
{
|
|
||||||
return get_dc_child_blocknr (B_N_CHILD (bh, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static unsigned long last_child (struct buffer_head * bh)
|
|
||||||
{
|
|
||||||
return child_block_number (bh, node_item_number (bh));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned long get_child (int pos, struct buffer_head * parent)
|
|
||||||
{
|
|
||||||
if (pos == -1)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (pos > B_NR_ITEMS (parent))
|
|
||||||
die ("get_child: no child found, should not happen: %d of %d", pos, B_NR_ITEMS (parent));
|
|
||||||
return get_dc_child_blocknr (B_N_CHILD (parent, pos));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void print (int cur, int total)
|
|
||||||
{
|
|
||||||
if (fsck_quiet (fs))
|
|
||||||
return;
|
|
||||||
printf ("/%3d (of %3d)", cur, total);fflush (stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* erase /XXX(of XXX) */
|
|
||||||
static void erase (void)
|
|
||||||
{
|
|
||||||
if (fsck_quiet (fs))
|
|
||||||
return;
|
|
||||||
printf ("\b\b\b\b\b\b\b\b\b\b\b\b\b");
|
|
||||||
printf (" ");
|
|
||||||
printf ("\b\b\b\b\b\b\b\b\b\b\b\b\b");
|
|
||||||
fflush (stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
void pass_through_tree (reiserfs_filsys_t * fs, do_after_read_t action1,
|
|
||||||
do_on_full_path_t action2, int depth)
|
|
||||||
{
|
|
||||||
struct buffer_head * path[MAX_HEIGHT] = {0,};
|
|
||||||
int total[MAX_HEIGHT] = {0,};
|
|
||||||
int cur[MAX_HEIGHT] = {0,};
|
|
||||||
int h = 0;
|
|
||||||
unsigned long block = get_sb_root_block (fs->fs_ondisk_sb);
|
|
||||||
int problem;
|
|
||||||
|
|
||||||
|
|
||||||
if (block >= get_sb_block_count (fs->fs_ondisk_sb) || not_data_block (fs, block)) {
|
|
||||||
die ("\nBad root block %lu. (--rebuild-tree did not complete)\n", block);
|
|
||||||
}
|
|
||||||
|
|
||||||
while ( 1 ) {
|
|
||||||
problem = 0;
|
|
||||||
|
|
||||||
if (path[h])
|
|
||||||
die ("pass_through_tree: empty slot expected");
|
|
||||||
if (h)
|
|
||||||
print (cur[h - 1], total[h - 1]);
|
|
||||||
|
|
||||||
if (fs->fs_badblocks_bm && reiserfs_bitmap_test_bit (fs->fs_badblocks_bm, block)) {
|
|
||||||
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);
|
|
||||||
|
|
||||||
if (h == 0) {
|
|
||||||
brelse (path[h]);
|
|
||||||
path[h] = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
problem = 1;
|
|
||||||
} else {
|
|
||||||
path[h] = bread (fs->fs_dev, block, fs->fs_blocksize);
|
|
||||||
if (path[h] == 0)
|
|
||||||
/* FIXME: handle case when read failed */
|
|
||||||
die ("pass_through_tree: unable to read %lu block on device 0x%x\n",
|
|
||||||
block, fs->fs_dev);
|
|
||||||
|
|
||||||
if (action1)
|
|
||||||
if ((problem = action1 (fs, path, h))) {
|
|
||||||
fsck_log (" the problem in the internal node occured (%lu), whole subtree is skipped\n",
|
|
||||||
path[h]->b_blocknr);
|
|
||||||
fsck_data (fs)->check.bad_nodes++;
|
|
||||||
|
|
||||||
if (h == 0) {
|
|
||||||
brelse (path[h]);
|
|
||||||
path[h] = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Time to stop. */
|
|
||||||
if (h == depth)
|
|
||||||
problem ++;
|
|
||||||
|
|
||||||
if (problem || is_leaf_node (path[h])) {
|
|
||||||
if (!problem && action2)
|
|
||||||
action2 (fs, path, h);
|
|
||||||
|
|
||||||
brelse (path[h]);
|
|
||||||
if (h)
|
|
||||||
erase ();
|
|
||||||
|
|
||||||
while (h && (cur[h-1] == total[h-1] || problem)) {
|
|
||||||
problem = 0;
|
|
||||||
path[h] = 0;
|
|
||||||
h --;
|
|
||||||
brelse (path[h]);
|
|
||||||
if (h)
|
|
||||||
erase ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (h == 0) {
|
|
||||||
path[h] = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
block = get_child (cur[h - 1], path[h-1]);
|
|
||||||
cur[h - 1] ++;
|
|
||||||
path[h] = 0;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
total[h] = B_NR_ITEMS (path[h]) + 1;
|
|
||||||
cur[h] = 1;
|
|
||||||
block = first_child (path[h]);
|
|
||||||
h ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
noinst_HEADERS = io.h misc.h reiserfs_fs.h reiserfs_lib.h swab.h
|
SUBDIRS = misc reiserfs util
|
||||||
+202
-85
@@ -1,8 +1,8 @@
|
|||||||
# Makefile.in generated by automake 1.7.6 from Makefile.am.
|
# Makefile.in generated by automake 1.9.5 from Makefile.am.
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
|
||||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||||
# Free Software Foundation, Inc.
|
# 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||||
# This Makefile.in is free software; the Free Software Foundation
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
# with or without modifications, as long as this notice is preserved.
|
# with or without modifications, as long as this notice is preserved.
|
||||||
@@ -13,7 +13,6 @@
|
|||||||
# PARTICULAR PURPOSE.
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
@SET_MAKE@
|
@SET_MAKE@
|
||||||
|
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
top_srcdir = @top_srcdir@
|
top_srcdir = @top_srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
@@ -21,7 +20,6 @@ pkgdatadir = $(datadir)/@PACKAGE@
|
|||||||
pkglibdir = $(libdir)/@PACKAGE@
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
pkgincludedir = $(includedir)/@PACKAGE@
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
top_builddir = ..
|
top_builddir = ..
|
||||||
|
|
||||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||||
INSTALL = @INSTALL@
|
INSTALL = @INSTALL@
|
||||||
install_sh_DATA = $(install_sh) -c -m 644
|
install_sh_DATA = $(install_sh) -c -m 644
|
||||||
@@ -35,7 +33,29 @@ POST_INSTALL = :
|
|||||||
NORMAL_UNINSTALL = :
|
NORMAL_UNINSTALL = :
|
||||||
PRE_UNINSTALL = :
|
PRE_UNINSTALL = :
|
||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
|
build_triplet = @build@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
|
subdir = include
|
||||||
|
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||||
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
|
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||||
|
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||||
|
$(ACLOCAL_M4)
|
||||||
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
|
CONFIG_HEADER = $(top_builddir)/config.h
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
SOURCES =
|
||||||
|
DIST_SOURCES =
|
||||||
|
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||||
|
html-recursive info-recursive install-data-recursive \
|
||||||
|
install-exec-recursive install-info-recursive \
|
||||||
|
install-recursive installcheck-recursive installdirs-recursive \
|
||||||
|
pdf-recursive ps-recursive uninstall-info-recursive \
|
||||||
|
uninstall-recursive
|
||||||
|
ETAGS = etags
|
||||||
|
CTAGS = ctags
|
||||||
|
DIST_SUBDIRS = $(SUBDIRS)
|
||||||
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
ACLOCAL = @ACLOCAL@
|
ACLOCAL = @ACLOCAL@
|
||||||
AMDEP_FALSE = @AMDEP_FALSE@
|
AMDEP_FALSE = @AMDEP_FALSE@
|
||||||
AMDEP_TRUE = @AMDEP_TRUE@
|
AMDEP_TRUE = @AMDEP_TRUE@
|
||||||
@@ -78,6 +98,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
|
|||||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||||
|
PROGS_LDFLAGS = @PROGS_LDFLAGS@
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
SET_MAKE = @SET_MAKE@
|
SET_MAKE = @SET_MAKE@
|
||||||
SHELL = @SHELL@
|
SHELL = @SHELL@
|
||||||
@@ -92,6 +113,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
|||||||
am__include = @am__include@
|
am__include = @am__include@
|
||||||
am__leading_dot = @am__leading_dot@
|
am__leading_dot = @am__leading_dot@
|
||||||
am__quote = @am__quote@
|
am__quote = @am__quote@
|
||||||
|
am__tar = @am__tar@
|
||||||
|
am__untar = @am__untar@
|
||||||
bindir = @bindir@
|
bindir = @bindir@
|
||||||
build = @build@
|
build = @build@
|
||||||
build_alias = @build_alias@
|
build_alias = @build_alias@
|
||||||
@@ -112,6 +135,7 @@ libdir = @libdir@
|
|||||||
libexecdir = @libexecdir@
|
libexecdir = @libexecdir@
|
||||||
localstatedir = @localstatedir@
|
localstatedir = @localstatedir@
|
||||||
mandir = @mandir@
|
mandir = @mandir@
|
||||||
|
mkdir_p = @mkdir_p@
|
||||||
oldincludedir = @oldincludedir@
|
oldincludedir = @oldincludedir@
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
program_transform_name = @program_transform_name@
|
program_transform_name = @program_transform_name@
|
||||||
@@ -119,51 +143,111 @@ sbindir = @sbindir@
|
|||||||
sharedstatedir = @sharedstatedir@
|
sharedstatedir = @sharedstatedir@
|
||||||
sysconfdir = @sysconfdir@
|
sysconfdir = @sysconfdir@
|
||||||
target_alias = @target_alias@
|
target_alias = @target_alias@
|
||||||
noinst_HEADERS = io.h misc.h reiserfs_fs.h reiserfs_lib.h swab.h
|
SUBDIRS = misc reiserfs util
|
||||||
subdir = include
|
all: all-recursive
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
|
||||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
|
||||||
CONFIG_HEADER = config.h
|
|
||||||
CONFIG_CLEAN_FILES =
|
|
||||||
DIST_SOURCES =
|
|
||||||
HEADERS = $(noinst_HEADERS)
|
|
||||||
|
|
||||||
DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in config.h.in
|
|
||||||
all: config.h
|
|
||||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||||
|
@for dep in $?; do \
|
||||||
|
case '$(am__configure_deps)' in \
|
||||||
|
*$$dep*) \
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||||
|
&& exit 0; \
|
||||||
|
exit 1;; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \
|
||||||
cd $(top_srcdir) && \
|
cd $(top_srcdir) && \
|
||||||
$(AUTOMAKE) --gnu include/Makefile
|
$(AUTOMAKE) --gnu include/Makefile
|
||||||
Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status
|
.PRECIOUS: Makefile
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
|
@case '$?' in \
|
||||||
|
*config.status*) \
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||||
|
*) \
|
||||||
|
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||||
|
esac;
|
||||||
|
|
||||||
config.h: stamp-h1
|
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||||
@if test ! -f $@; then \
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
rm -f stamp-h1; \
|
|
||||||
$(MAKE) stamp-h1; \
|
|
||||||
else :; fi
|
|
||||||
|
|
||||||
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||||
@rm -f stamp-h1
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status include/config.h
|
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
|
||||||
cd $(top_srcdir) && $(AUTOHEADER)
|
|
||||||
touch $(srcdir)/config.h.in
|
|
||||||
|
|
||||||
distclean-hdr:
|
|
||||||
-rm -f config.h stamp-h1
|
|
||||||
uninstall-info-am:
|
uninstall-info-am:
|
||||||
|
|
||||||
ETAGS = etags
|
# This directory's subdirectories are mostly independent; you can cd
|
||||||
ETAGSFLAGS =
|
# 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):
|
||||||
|
@failcom='exit 1'; \
|
||||||
|
for f in x $$MAKEFLAGS; do \
|
||||||
|
case $$f in \
|
||||||
|
*=* | --[!k]*);; \
|
||||||
|
*k*) failcom='fail=yes';; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
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) \
|
||||||
|
|| eval $$failcom; \
|
||||||
|
done; \
|
||||||
|
if test "$$dot_seen" = "no"; then \
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||||
|
fi; test -z "$$fail"
|
||||||
|
|
||||||
CTAGS = ctags
|
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||||
CTAGSFLAGS =
|
maintainer-clean-recursive:
|
||||||
|
@failcom='exit 1'; \
|
||||||
tags: TAGS
|
for f in x $$MAKEFLAGS; do \
|
||||||
|
case $$f in \
|
||||||
|
*=* | --[!k]*);; \
|
||||||
|
*k*) failcom='fail=yes';; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
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) \
|
||||||
|
|| eval $$failcom; \
|
||||||
|
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
|
||||||
|
|
||||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||||
@@ -173,27 +257,42 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
|||||||
$(AWK) ' { files[$$0] = 1; } \
|
$(AWK) ' { files[$$0] = 1; } \
|
||||||
END { for (i in files) print i; }'`; \
|
END { for (i in files) print i; }'`; \
|
||||||
mkid -fID $$unique
|
mkid -fID $$unique
|
||||||
|
tags: TAGS
|
||||||
|
|
||||||
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||||
$(TAGS_FILES) $(LISP)
|
$(TAGS_FILES) $(LISP)
|
||||||
tags=; \
|
tags=; \
|
||||||
here=`pwd`; \
|
here=`pwd`; \
|
||||||
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
|
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||||
|
include_option=--etags-include; \
|
||||||
|
empty_fix=.; \
|
||||||
|
else \
|
||||||
|
include_option=--include; \
|
||||||
|
empty_fix=; \
|
||||||
|
fi; \
|
||||||
|
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||||
|
if test "$$subdir" = .; then :; else \
|
||||||
|
test ! -f $$subdir/TAGS || \
|
||||||
|
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
|
||||||
|
fi; \
|
||||||
|
done; \
|
||||||
|
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||||
unique=`for i in $$list; do \
|
unique=`for i in $$list; do \
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
done | \
|
done | \
|
||||||
$(AWK) ' { files[$$0] = 1; } \
|
$(AWK) ' { files[$$0] = 1; } \
|
||||||
END { for (i in files) print i; }'`; \
|
END { for (i in files) print i; }'`; \
|
||||||
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||||
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
test -n "$$unique" || unique=$$empty_fix; \
|
||||||
$$tags $$unique
|
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||||
|
$$tags $$unique; \
|
||||||
|
fi
|
||||||
ctags: CTAGS
|
ctags: CTAGS
|
||||||
CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||||
$(TAGS_FILES) $(LISP)
|
$(TAGS_FILES) $(LISP)
|
||||||
tags=; \
|
tags=; \
|
||||||
here=`pwd`; \
|
here=`pwd`; \
|
||||||
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
|
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||||
unique=`for i in $$list; do \
|
unique=`for i in $$list; do \
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
done | \
|
done | \
|
||||||
@@ -210,10 +309,6 @@ GTAGS:
|
|||||||
|
|
||||||
distclean-tags:
|
distclean-tags:
|
||||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH 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)
|
distdir: $(DISTFILES)
|
||||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||||
@@ -227,7 +322,7 @@ distdir: $(DISTFILES)
|
|||||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||||
dir="/$$dir"; \
|
dir="/$$dir"; \
|
||||||
$(mkinstalldirs) "$(distdir)$$dir"; \
|
$(mkdir_p) "$(distdir)$$dir"; \
|
||||||
else \
|
else \
|
||||||
dir=''; \
|
dir=''; \
|
||||||
fi; \
|
fi; \
|
||||||
@@ -242,23 +337,38 @@ distdir: $(DISTFILES)
|
|||||||
|| exit 1; \
|
|| exit 1; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||||
|
if test "$$subdir" = .; then :; else \
|
||||||
|
test -d "$(distdir)/$$subdir" \
|
||||||
|
|| $(mkdir_p) "$(distdir)/$$subdir" \
|
||||||
|
|| exit 1; \
|
||||||
|
distdir=`$(am__cd) $(distdir) && pwd`; \
|
||||||
|
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
|
||||||
|
(cd $$subdir && \
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) \
|
||||||
|
top_distdir="$$top_distdir" \
|
||||||
|
distdir="$$distdir/$$subdir" \
|
||||||
|
distdir) \
|
||||||
|
|| exit 1; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
check-am: all-am
|
check-am: all-am
|
||||||
check: check-am
|
check: check-recursive
|
||||||
all-am: Makefile $(HEADERS) config.h
|
all-am: Makefile
|
||||||
|
installdirs: installdirs-recursive
|
||||||
installdirs:
|
installdirs-am:
|
||||||
install: install-am
|
install: install-recursive
|
||||||
install-exec: install-exec-am
|
install-exec: install-exec-recursive
|
||||||
install-data: install-data-am
|
install-data: install-data-recursive
|
||||||
uninstall: uninstall-am
|
uninstall: uninstall-recursive
|
||||||
|
|
||||||
install-am: all-am
|
install-am: all-am
|
||||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||||
|
|
||||||
installcheck: installcheck-am
|
installcheck: installcheck-recursive
|
||||||
install-strip:
|
install-strip:
|
||||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
INSTALL_STRIP_FLAG=-s \
|
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||||
`test -z '$(STRIP)' || \
|
`test -z '$(STRIP)' || \
|
||||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||||
mostlyclean-generic:
|
mostlyclean-generic:
|
||||||
@@ -266,24 +376,26 @@ mostlyclean-generic:
|
|||||||
clean-generic:
|
clean-generic:
|
||||||
|
|
||||||
distclean-generic:
|
distclean-generic:
|
||||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||||
|
|
||||||
maintainer-clean-generic:
|
maintainer-clean-generic:
|
||||||
@echo "This command is intended for maintainers to use"
|
@echo "This command is intended for maintainers to use"
|
||||||
@echo "it deletes files that may require special tools to rebuild."
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
clean: clean-am
|
clean: clean-recursive
|
||||||
|
|
||||||
clean-am: clean-generic mostlyclean-am
|
clean-am: clean-generic mostlyclean-am
|
||||||
|
|
||||||
distclean: distclean-am
|
distclean: distclean-recursive
|
||||||
|
-rm -f Makefile
|
||||||
|
distclean-am: clean-am distclean-generic distclean-tags
|
||||||
|
|
||||||
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
|
dvi: dvi-recursive
|
||||||
|
|
||||||
dvi: dvi-am
|
|
||||||
|
|
||||||
dvi-am:
|
dvi-am:
|
||||||
|
|
||||||
info: info-am
|
html: html-recursive
|
||||||
|
|
||||||
|
info: info-recursive
|
||||||
|
|
||||||
info-am:
|
info-am:
|
||||||
|
|
||||||
@@ -291,38 +403,43 @@ install-data-am:
|
|||||||
|
|
||||||
install-exec-am:
|
install-exec-am:
|
||||||
|
|
||||||
install-info: install-info-am
|
install-info: install-info-recursive
|
||||||
|
|
||||||
install-man:
|
install-man:
|
||||||
|
|
||||||
installcheck-am:
|
installcheck-am:
|
||||||
|
|
||||||
maintainer-clean: maintainer-clean-am
|
maintainer-clean: maintainer-clean-recursive
|
||||||
|
-rm -f Makefile
|
||||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||||
|
|
||||||
mostlyclean: mostlyclean-am
|
mostlyclean: mostlyclean-recursive
|
||||||
|
|
||||||
mostlyclean-am: mostlyclean-generic
|
mostlyclean-am: mostlyclean-generic
|
||||||
|
|
||||||
pdf: pdf-am
|
pdf: pdf-recursive
|
||||||
|
|
||||||
pdf-am:
|
pdf-am:
|
||||||
|
|
||||||
ps: ps-am
|
ps: ps-recursive
|
||||||
|
|
||||||
ps-am:
|
ps-am:
|
||||||
|
|
||||||
uninstall-am: uninstall-info-am
|
uninstall-am: uninstall-info-am
|
||||||
|
|
||||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic ctags \
|
uninstall-info: uninstall-info-recursive
|
||||||
distclean distclean-generic distclean-hdr distclean-tags \
|
|
||||||
distdir dvi dvi-am info info-am install install-am install-data \
|
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
|
||||||
install-data-am install-exec install-exec-am install-info \
|
clean clean-generic clean-recursive ctags ctags-recursive \
|
||||||
install-info-am install-man install-strip installcheck \
|
distclean distclean-generic distclean-recursive distclean-tags \
|
||||||
installcheck-am installdirs maintainer-clean \
|
distdir dvi dvi-am html html-am info info-am install \
|
||||||
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
|
install-am install-data install-data-am install-exec \
|
||||||
pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
|
install-exec-am install-info install-info-am install-man \
|
||||||
|
install-strip installcheck installcheck-am installdirs \
|
||||||
|
installdirs-am maintainer-clean maintainer-clean-generic \
|
||||||
|
maintainer-clean-recursive mostlyclean mostlyclean-generic \
|
||||||
|
mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
|
||||||
|
uninstall uninstall-am uninstall-info-am
|
||||||
|
|
||||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
# 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.
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
|
||||||
* reiserfsprogs/README
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef REISERFSPROGS_IO_H
|
|
||||||
#define REISERFSPROGS_IO_H
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include "misc.h"
|
|
||||||
|
|
||||||
struct buffer_head {
|
|
||||||
unsigned long b_blocknr;
|
|
||||||
int b_dev;
|
|
||||||
unsigned long b_size;
|
|
||||||
char * b_data;
|
|
||||||
unsigned long b_state;
|
|
||||||
unsigned int b_count;
|
|
||||||
unsigned int b_list ;
|
|
||||||
void (*b_start_io) (unsigned long);
|
|
||||||
void (*b_end_io)(struct buffer_head *bh, int uptodate);
|
|
||||||
|
|
||||||
struct buffer_head * b_next;
|
|
||||||
struct buffer_head * b_prev;
|
|
||||||
struct buffer_head * b_hash_next;
|
|
||||||
struct buffer_head * b_hash_prev;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define BH_Uptodate 0
|
|
||||||
#define BH_Dirty 1
|
|
||||||
#define BH_Lock 2
|
|
||||||
#define BH_Do_not_flush 3
|
|
||||||
|
|
||||||
|
|
||||||
#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",
|
|
||||||
__FILE__, __FUNCTION__, __LINE__,
|
|
||||||
__builtin_return_address (0),
|
|
||||||
__builtin_return_address (1),
|
|
||||||
__builtin_return_address (2));
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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, 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);
|
|
||||||
int bwrite (struct buffer_head * bh);
|
|
||||||
void brelse (struct buffer_head * bh);
|
|
||||||
void bforget (struct buffer_head * bh);
|
|
||||||
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 (int);
|
|
||||||
void free_buffers (void);
|
|
||||||
void invalidate_buffers (int);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
-189
@@ -1,189 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
|
||||||
* reiserfsprogs/README
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* nothing abount reiserfs here */
|
|
||||||
|
|
||||||
#ifndef REISERFSPROGS_MISC_H
|
|
||||||
#define REISERFSPROGS_MISC_H
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <linux/major.h>
|
|
||||||
|
|
||||||
#if MAJOR_IN_MKDEV
|
|
||||||
# include <sys/mkdev.h>
|
|
||||||
#elif MAJOR_IN_SYSMACROS
|
|
||||||
# include <sys/sysmacros.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "swab.h"
|
|
||||||
|
|
||||||
#define POSITION_FOUND 8
|
|
||||||
#define POSITION_NOT_FOUND 9
|
|
||||||
|
|
||||||
#define INVAL_PTR (void *)-1
|
|
||||||
|
|
||||||
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);
|
|
||||||
unsigned int get_mem_size (char * p);
|
|
||||||
void check_and_free_mem (void);
|
|
||||||
char * kdevname (int dev);
|
|
||||||
|
|
||||||
typedef enum mount_flags {
|
|
||||||
MF_NOT_MOUNTED = 0x0,
|
|
||||||
MF_RO = 0x1,
|
|
||||||
MF_RW = 0x2
|
|
||||||
} mount_flags_t;
|
|
||||||
|
|
||||||
typedef struct mount_hint {
|
|
||||||
char *point; /* Mount point. */
|
|
||||||
__u32 psize; /* Mount point buffer size. */
|
|
||||||
__u32 flags; /* Mount flags. */
|
|
||||||
} mount_hint_t;
|
|
||||||
|
|
||||||
struct mntent *misc_mntent(char *device);
|
|
||||||
int misc_device_mounted(char *device);
|
|
||||||
|
|
||||||
void misc_print_credit(FILE *out);
|
|
||||||
|
|
||||||
typedef struct dma_info {
|
|
||||||
int fd;
|
|
||||||
struct stat st;
|
|
||||||
int support_type;
|
|
||||||
int dma;
|
|
||||||
__u64 speed;
|
|
||||||
} dma_info_t;
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
int valid_offset( int fd, loff_t offset);
|
|
||||||
unsigned long count_blocks (char * filename, int blocksize);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
int user_confirmed (FILE * fp, char * q, char * yes);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
#define STAT_FIELD_H(Field, Type) \
|
|
||||||
inline Type misc_device_##Field(char *device);
|
|
||||||
|
|
||||||
STAT_FIELD_H(mode, mode_t);
|
|
||||||
STAT_FIELD_H(rdev, dev_t);
|
|
||||||
STAT_FIELD_H(size, off_t);
|
|
||||||
STAT_FIELD_H(blocks, blkcnt_t);
|
|
||||||
|
|
||||||
__u16 mask16 (int from, int count);
|
|
||||||
__u32 mask32 (int from, int count);
|
|
||||||
__u64 mask64 (int from, int count);
|
|
||||||
|
|
||||||
int reiserfs_bin_search (void * key, void * base, __u32 num, int width,
|
|
||||||
__u32 *ppos, __compar_fn_t comp_func);
|
|
||||||
|
|
||||||
struct block_handler {
|
|
||||||
__u32 blocknr;
|
|
||||||
dev_t device;
|
|
||||||
};
|
|
||||||
|
|
||||||
int blocklist__is_block_saved (struct block_handler ** base, __u32 * count, __u32 blocknr,
|
|
||||||
dev_t device, __u32 * position);
|
|
||||||
void blocklist__insert_in_position (void * block_h, void ** base, __u32 * count,
|
|
||||||
int elem_size, __u32 * position);
|
|
||||||
int blockdev_list_compare (const void * block1, const void * block2);
|
|
||||||
|
|
||||||
|
|
||||||
#define set_bit_field_XX(XX,vp,val,from,count) \
|
|
||||||
{\
|
|
||||||
__u##XX * p, tmp;\
|
|
||||||
\
|
|
||||||
/* make sure that given value can be put in 'count' bits */\
|
|
||||||
if (val > (1 << count))\
|
|
||||||
die ("set_bit_field: val %d is too big for %d bits", val, count);\
|
|
||||||
\
|
|
||||||
p = (__u##XX *)vp;\
|
|
||||||
tmp = le##XX##_to_cpu (*p);\
|
|
||||||
\
|
|
||||||
/* clear 'count' bits starting from 'from'-th one */\
|
|
||||||
tmp &= ~mask##XX (from, count);\
|
|
||||||
\
|
|
||||||
/* put given value in proper bits */\
|
|
||||||
tmp |= (val << from);\
|
|
||||||
\
|
|
||||||
*p = cpu_to_le##XX (tmp);\
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define get_bit_field_XX(XX,vp,from,count) \
|
|
||||||
\
|
|
||||||
__u##XX * p, tmp;\
|
|
||||||
\
|
|
||||||
p = (__u##XX *)vp;\
|
|
||||||
tmp = le##XX##_to_cpu (*p);\
|
|
||||||
\
|
|
||||||
/* clear all bits but 'count' bits starting from 'from'-th one */\
|
|
||||||
tmp &= mask##XX (from, count);\
|
|
||||||
\
|
|
||||||
/* get value written in specified bits */\
|
|
||||||
tmp >>= from;\
|
|
||||||
return tmp;
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef major
|
|
||||||
#define major(rdev) ((rdev)>>8)
|
|
||||||
#define minor(rdev) ((rdev) & 0xff)
|
|
||||||
#endif /* major */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef SCSI_DISK_MAJOR
|
|
||||||
#define SCSI_DISK_MAJOR(maj) ((maj) == SCSI_DISK0_MAJOR || \
|
|
||||||
((maj) >= SCSI_DISK1_MAJOR && (maj) <= SCSI_DISK7_MAJOR))
|
|
||||||
#endif /* SCSI_DISK_MAJOR */
|
|
||||||
|
|
||||||
#ifndef SCSI_BLK_MAJOR
|
|
||||||
#define SCSI_BLK_MAJOR(maj) (SCSI_DISK_MAJOR(maj) || (maj) == SCSI_CDROM_MAJOR)
|
|
||||||
#endif /* SCSI_BLK_MAJOR */
|
|
||||||
|
|
||||||
#ifndef IDE_DISK_MAJOR
|
|
||||||
#ifdef IDE9_MAJOR
|
|
||||||
#define IDE_DISK_MAJOR(maj) ((maj) == IDE0_MAJOR || (maj) == IDE1_MAJOR || \
|
|
||||||
(maj) == IDE2_MAJOR || (maj) == IDE3_MAJOR || \
|
|
||||||
(maj) == IDE4_MAJOR || (maj) == IDE5_MAJOR || \
|
|
||||||
(maj) == IDE6_MAJOR || (maj) == IDE7_MAJOR || \
|
|
||||||
(maj) == IDE8_MAJOR || (maj) == IDE9_MAJOR)
|
|
||||||
#else
|
|
||||||
#define IDE_DISK_MAJOR(maj) ((maj) == IDE0_MAJOR || (maj) == IDE1_MAJOR || \
|
|
||||||
(maj) == IDE2_MAJOR || (maj) == IDE3_MAJOR || \
|
|
||||||
(maj) == IDE4_MAJOR || (maj) == IDE5_MAJOR)
|
|
||||||
#endif /* IDE9_MAJOR */
|
|
||||||
#endif /* IDE_DISK_MAJOR */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* REISERFS_MISC_H */
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
noinst_HEADERS = types.h bitops.h malloc.h swab.h device.h misc.h unaligned.h
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
# Makefile.in generated by automake 1.7.6 from Makefile.am.
|
# Makefile.in generated by automake 1.9.5 from Makefile.am.
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
|
||||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||||
# Free Software Foundation, Inc.
|
# 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||||
# This Makefile.in is free software; the Free Software Foundation
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
# with or without modifications, as long as this notice is preserved.
|
# with or without modifications, as long as this notice is preserved.
|
||||||
@@ -20,8 +20,7 @@ VPATH = @srcdir@
|
|||||||
pkgdatadir = $(datadir)/@PACKAGE@
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
pkglibdir = $(libdir)/@PACKAGE@
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
pkgincludedir = $(includedir)/@PACKAGE@
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
top_builddir = ..
|
top_builddir = ../..
|
||||||
|
|
||||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||||
INSTALL = @INSTALL@
|
INSTALL = @INSTALL@
|
||||||
install_sh_DATA = $(install_sh) -c -m 644
|
install_sh_DATA = $(install_sh) -c -m 644
|
||||||
@@ -35,7 +34,24 @@ POST_INSTALL = :
|
|||||||
NORMAL_UNINSTALL = :
|
NORMAL_UNINSTALL = :
|
||||||
PRE_UNINSTALL = :
|
PRE_UNINSTALL = :
|
||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
|
build_triplet = @build@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
|
subdir = include/misc
|
||||||
|
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
|
||||||
|
$(srcdir)/Makefile.in
|
||||||
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
|
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||||
|
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||||
|
$(ACLOCAL_M4)
|
||||||
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
|
CONFIG_HEADER = $(top_builddir)/config.h
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
SOURCES =
|
||||||
|
DIST_SOURCES =
|
||||||
|
HEADERS = $(noinst_HEADERS)
|
||||||
|
ETAGS = etags
|
||||||
|
CTAGS = ctags
|
||||||
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
ACLOCAL = @ACLOCAL@
|
ACLOCAL = @ACLOCAL@
|
||||||
AMDEP_FALSE = @AMDEP_FALSE@
|
AMDEP_FALSE = @AMDEP_FALSE@
|
||||||
AMDEP_TRUE = @AMDEP_TRUE@
|
AMDEP_TRUE = @AMDEP_TRUE@
|
||||||
@@ -78,6 +94,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
|
|||||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||||
|
PROGS_LDFLAGS = @PROGS_LDFLAGS@
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
SET_MAKE = @SET_MAKE@
|
SET_MAKE = @SET_MAKE@
|
||||||
SHELL = @SHELL@
|
SHELL = @SHELL@
|
||||||
@@ -92,6 +109,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
|||||||
am__include = @am__include@
|
am__include = @am__include@
|
||||||
am__leading_dot = @am__leading_dot@
|
am__leading_dot = @am__leading_dot@
|
||||||
am__quote = @am__quote@
|
am__quote = @am__quote@
|
||||||
|
am__tar = @am__tar@
|
||||||
|
am__untar = @am__untar@
|
||||||
bindir = @bindir@
|
bindir = @bindir@
|
||||||
build = @build@
|
build = @build@
|
||||||
build_alias = @build_alias@
|
build_alias = @build_alias@
|
||||||
@@ -112,6 +131,7 @@ libdir = @libdir@
|
|||||||
libexecdir = @libexecdir@
|
libexecdir = @libexecdir@
|
||||||
localstatedir = @localstatedir@
|
localstatedir = @localstatedir@
|
||||||
mandir = @mandir@
|
mandir = @mandir@
|
||||||
|
mkdir_p = @mkdir_p@
|
||||||
oldincludedir = @oldincludedir@
|
oldincludedir = @oldincludedir@
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
program_transform_name = @program_transform_name@
|
program_transform_name = @program_transform_name@
|
||||||
@@ -119,114 +139,41 @@ sbindir = @sbindir@
|
|||||||
sharedstatedir = @sharedstatedir@
|
sharedstatedir = @sharedstatedir@
|
||||||
sysconfdir = @sysconfdir@
|
sysconfdir = @sysconfdir@
|
||||||
target_alias = @target_alias@
|
target_alias = @target_alias@
|
||||||
noinst_LIBRARIES = libcore.a
|
noinst_HEADERS = types.h bitops.h malloc.h swab.h device.h misc.h unaligned.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
|
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
|
||||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
|
||||||
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)
|
|
||||||
|
|
||||||
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) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
|
||||||
DIST_SOURCES = $(libcore_a_SOURCES)
|
|
||||||
DIST_COMMON = Makefile.am Makefile.in
|
|
||||||
SOURCES = $(libcore_a_SOURCES)
|
|
||||||
|
|
||||||
all: all-am
|
all: all-am
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.SUFFIXES: .c .o .obj
|
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
@for dep in $?; do \
|
||||||
|
case '$(am__configure_deps)' in \
|
||||||
|
*$$dep*) \
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||||
|
&& exit 0; \
|
||||||
|
exit 1;; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/misc/Makefile'; \
|
||||||
cd $(top_srcdir) && \
|
cd $(top_srcdir) && \
|
||||||
$(AUTOMAKE) --gnu reiserfscore/Makefile
|
$(AUTOMAKE) --gnu include/misc/Makefile
|
||||||
Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status
|
.PRECIOUS: Makefile
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
|
@case '$?' in \
|
||||||
|
*config.status*) \
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||||
|
*) \
|
||||||
|
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||||
|
esac;
|
||||||
|
|
||||||
AR = ar
|
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
|
||||||
clean-noinstLIBRARIES:
|
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||||
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
libcore.a: $(libcore_a_OBJECTS) $(libcore_a_DEPENDENCIES)
|
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||||
-rm -f libcore.a
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
$(libcore_a_AR) libcore.a $(libcore_a_OBJECTS) $(libcore_a_LIBADD)
|
|
||||||
$(RANLIB) libcore.a
|
|
||||||
|
|
||||||
mostlyclean-compile:
|
|
||||||
-rm -f *.$(OBJEXT) core *.core
|
|
||||||
|
|
||||||
distclean-compile:
|
|
||||||
-rm -f *.tab.c
|
|
||||||
|
|
||||||
@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@
|
|
||||||
|
|
||||||
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 -f "$(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 -f "$(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:
|
uninstall-info-am:
|
||||||
|
|
||||||
ETAGS = etags
|
|
||||||
ETAGSFLAGS =
|
|
||||||
|
|
||||||
CTAGS = ctags
|
|
||||||
CTAGSFLAGS =
|
|
||||||
|
|
||||||
tags: TAGS
|
|
||||||
|
|
||||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||||
unique=`for i in $$list; do \
|
unique=`for i in $$list; do \
|
||||||
@@ -235,6 +182,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
|||||||
$(AWK) ' { files[$$0] = 1; } \
|
$(AWK) ' { files[$$0] = 1; } \
|
||||||
END { for (i in files) print i; }'`; \
|
END { for (i in files) print i; }'`; \
|
||||||
mkid -fID $$unique
|
mkid -fID $$unique
|
||||||
|
tags: TAGS
|
||||||
|
|
||||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||||
$(TAGS_FILES) $(LISP)
|
$(TAGS_FILES) $(LISP)
|
||||||
@@ -246,10 +194,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
|||||||
done | \
|
done | \
|
||||||
$(AWK) ' { files[$$0] = 1; } \
|
$(AWK) ' { files[$$0] = 1; } \
|
||||||
END { for (i in files) print i; }'`; \
|
END { for (i in files) print i; }'`; \
|
||||||
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||||
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
test -n "$$unique" || unique=$$empty_fix; \
|
||||||
$$tags $$unique
|
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||||
|
$$tags $$unique; \
|
||||||
|
fi
|
||||||
ctags: CTAGS
|
ctags: CTAGS
|
||||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||||
$(TAGS_FILES) $(LISP)
|
$(TAGS_FILES) $(LISP)
|
||||||
@@ -272,10 +221,6 @@ GTAGS:
|
|||||||
|
|
||||||
distclean-tags:
|
distclean-tags:
|
||||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH 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)
|
distdir: $(DISTFILES)
|
||||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||||
@@ -289,7 +234,7 @@ distdir: $(DISTFILES)
|
|||||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||||
dir="/$$dir"; \
|
dir="/$$dir"; \
|
||||||
$(mkinstalldirs) "$(distdir)$$dir"; \
|
$(mkdir_p) "$(distdir)$$dir"; \
|
||||||
else \
|
else \
|
||||||
dir=''; \
|
dir=''; \
|
||||||
fi; \
|
fi; \
|
||||||
@@ -306,8 +251,7 @@ distdir: $(DISTFILES)
|
|||||||
done
|
done
|
||||||
check-am: all-am
|
check-am: all-am
|
||||||
check: check-am
|
check: check-am
|
||||||
all-am: Makefile $(LIBRARIES)
|
all-am: Makefile $(HEADERS)
|
||||||
|
|
||||||
installdirs:
|
installdirs:
|
||||||
install: install-am
|
install: install-am
|
||||||
install-exec: install-exec-am
|
install-exec: install-exec-am
|
||||||
@@ -320,7 +264,7 @@ install-am: all-am
|
|||||||
installcheck: installcheck-am
|
installcheck: installcheck-am
|
||||||
install-strip:
|
install-strip:
|
||||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
INSTALL_STRIP_FLAG=-s \
|
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||||
`test -z '$(STRIP)' || \
|
`test -z '$(STRIP)' || \
|
||||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||||
mostlyclean-generic:
|
mostlyclean-generic:
|
||||||
@@ -328,24 +272,25 @@ mostlyclean-generic:
|
|||||||
clean-generic:
|
clean-generic:
|
||||||
|
|
||||||
distclean-generic:
|
distclean-generic:
|
||||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||||
|
|
||||||
maintainer-clean-generic:
|
maintainer-clean-generic:
|
||||||
@echo "This command is intended for maintainers to use"
|
@echo "This command is intended for maintainers to use"
|
||||||
@echo "it deletes files that may require special tools to rebuild."
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
clean: clean-am
|
clean: clean-am
|
||||||
|
|
||||||
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
|
clean-am: clean-generic mostlyclean-am
|
||||||
|
|
||||||
distclean: distclean-am
|
distclean: distclean-am
|
||||||
|
-rm -f Makefile
|
||||||
distclean-am: clean-am distclean-compile distclean-depend \
|
distclean-am: clean-am distclean-generic distclean-tags
|
||||||
distclean-generic distclean-tags
|
|
||||||
|
|
||||||
dvi: dvi-am
|
dvi: dvi-am
|
||||||
|
|
||||||
dvi-am:
|
dvi-am:
|
||||||
|
|
||||||
|
html: html-am
|
||||||
|
|
||||||
info: info-am
|
info: info-am
|
||||||
|
|
||||||
info-am:
|
info-am:
|
||||||
@@ -361,12 +306,12 @@ install-man:
|
|||||||
installcheck-am:
|
installcheck-am:
|
||||||
|
|
||||||
maintainer-clean: maintainer-clean-am
|
maintainer-clean: maintainer-clean-am
|
||||||
|
-rm -f Makefile
|
||||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||||
|
|
||||||
mostlyclean: mostlyclean-am
|
mostlyclean: mostlyclean-am
|
||||||
|
|
||||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
mostlyclean-am: mostlyclean-generic
|
||||||
|
|
||||||
pdf: pdf-am
|
pdf: pdf-am
|
||||||
|
|
||||||
@@ -379,15 +324,13 @@ ps-am:
|
|||||||
uninstall-am: uninstall-info-am
|
uninstall-am: uninstall-info-am
|
||||||
|
|
||||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||||
clean-noinstLIBRARIES ctags distclean distclean-compile \
|
ctags distclean distclean-generic distclean-tags distdir dvi \
|
||||||
distclean-depend distclean-generic distclean-tags distdir dvi \
|
dvi-am html html-am info info-am install install-am \
|
||||||
dvi-am info info-am install install-am install-data \
|
install-data install-data-am install-exec install-exec-am \
|
||||||
install-data-am install-exec install-exec-am install-info \
|
install-info install-info-am install-man install-strip \
|
||||||
install-info-am install-man install-strip installcheck \
|
installcheck installcheck-am installdirs maintainer-clean \
|
||||||
installcheck-am installdirs maintainer-clean \
|
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
|
||||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
|
||||||
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.
|
# 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.
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MISC_BITOPS_H
|
||||||
|
#define MISC_BITOPS_H
|
||||||
|
|
||||||
|
#include "misc/types.h"
|
||||||
|
#include "misc/misc.h"
|
||||||
|
|
||||||
|
extern __u16 mask16 (int from, int count);
|
||||||
|
extern __u32 mask32 (int from, int count);
|
||||||
|
extern __u64 mask64 (int from, int count);
|
||||||
|
|
||||||
|
#define misc_set_bitfield_XX(XX,vp,val,from,count) \
|
||||||
|
({ \
|
||||||
|
__u##XX * p, tmp; \
|
||||||
|
\
|
||||||
|
/* make sure that given value can be put in 'count' bits */ \
|
||||||
|
if (val > (1 << count)) \
|
||||||
|
misc_die ("misc_set_bitfield: val %d is too big for %d bits", val, count); \
|
||||||
|
\
|
||||||
|
p = (__u##XX *)vp; \
|
||||||
|
tmp = le##XX##_to_cpu (*p); \
|
||||||
|
\
|
||||||
|
/* clear 'count' bits starting from 'from'-th one */ \
|
||||||
|
tmp &= ~mask##XX (from, count); \
|
||||||
|
\
|
||||||
|
/* put given value in proper bits */ \
|
||||||
|
tmp |= (val << from); \
|
||||||
|
\
|
||||||
|
*p = cpu_to_le##XX (tmp); \
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
#define misc_get_bitfield_XX(XX,vp,from,count) \
|
||||||
|
({ \
|
||||||
|
__u##XX * p, tmp; \
|
||||||
|
\
|
||||||
|
p = (__u##XX *)vp; \
|
||||||
|
tmp = le##XX##_to_cpu (*p); \
|
||||||
|
\
|
||||||
|
/* clear all bits but 'count' bits starting from 'from'-th one */ \
|
||||||
|
tmp &= mask##XX (from, count); \
|
||||||
|
\
|
||||||
|
/* get value written in specified bits */ \
|
||||||
|
tmp >>= from; \
|
||||||
|
tmp; \
|
||||||
|
})
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MISC_DEVICE_H
|
||||||
|
#define MISC_DEVICE_H
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
extern int misc_device_valid_offset(int fd, long long int offset);
|
||||||
|
|
||||||
|
extern unsigned long misc_device_count_blocks (char * filename,
|
||||||
|
int blocksize);
|
||||||
|
|
||||||
|
extern char misc_device_typec (unsigned short mode);
|
||||||
|
|
||||||
|
#define STAT_FIELD_H(Field, Type) \
|
||||||
|
Type misc_device_##Field(char *device);
|
||||||
|
|
||||||
|
STAT_FIELD_H(mode, mode_t);
|
||||||
|
STAT_FIELD_H(rdev, dev_t);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MISC_MALLOC_H
|
||||||
|
#define MISC_MALLOC_H
|
||||||
|
|
||||||
|
extern void *misc_getmem (int size);
|
||||||
|
|
||||||
|
extern void *misc_malloc(int size);
|
||||||
|
|
||||||
|
extern void misc_freemem (void * p);
|
||||||
|
|
||||||
|
extern void misc_checkmem (char * p, int size);
|
||||||
|
|
||||||
|
extern void *misc_expandmem (void * p, int size, int by);
|
||||||
|
|
||||||
|
extern unsigned int misc_memsize (char * p);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* nothing abount reiserfs here */
|
||||||
|
|
||||||
|
#ifndef MISC_H
|
||||||
|
#define MISC_H
|
||||||
|
|
||||||
|
#include "misc/types.h"
|
||||||
|
|
||||||
|
/* n must be power of 2 */
|
||||||
|
#define MISC_UP(x,n) (((x)+(n)-1u) / (n) * (n))
|
||||||
|
#define MISC_DOWN(x,n) ((x) / (n) * (n))
|
||||||
|
|
||||||
|
/* to be ok for alpha etc we have to align structures to 8 byte boundary. */
|
||||||
|
#define MISC_ROUND_UP(x) MISC_UP(x,8LL)
|
||||||
|
|
||||||
|
extern void misc_die (char * fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
|
|
||||||
|
typedef int (*dir_walk_func_t) (char *path, void *data);
|
||||||
|
extern int misc_dir_walk(char *path, dir_walk_func_t func, void *data);
|
||||||
|
|
||||||
|
extern __u32 misc_random (void);
|
||||||
|
|
||||||
|
typedef int (*misc_comp_func_t) (const void *, const void *);
|
||||||
|
|
||||||
|
extern int misc_device_rdev_match(char *path, void *data);
|
||||||
|
|
||||||
|
extern int misc_bin_search (const void * key, void * base,
|
||||||
|
__u32 num, int width, int *ppos,
|
||||||
|
misc_comp_func_t comp_func);
|
||||||
|
|
||||||
|
extern void blocklist__insert_in_position (void * block_h, void ** base,
|
||||||
|
__u32 * count, int elem_size,
|
||||||
|
int * position);
|
||||||
|
|
||||||
|
extern int blockdev_list_compare (const void * block1, const void * block2);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -3,11 +3,8 @@
|
|||||||
* reiserfsprogs/README
|
* reiserfsprogs/README
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef REISERFSPROGS_SWAB_H
|
#ifndef MISC_SWAB_H
|
||||||
#define REISERFSPROGS_SWAB_H
|
#define MISC_SWAB_H
|
||||||
|
|
||||||
#include <endian.h>
|
|
||||||
#include <asm/types.h>
|
|
||||||
|
|
||||||
#define __swab16(x) \
|
#define __swab16(x) \
|
||||||
({ \
|
({ \
|
||||||
@@ -42,7 +39,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
#ifndef WORDS_BIGENDIAN
|
||||||
|
|
||||||
# define cpu_to_le16(val) (val)
|
# define cpu_to_le16(val) (val)
|
||||||
# define le16_to_cpu(val) (val)
|
# define le16_to_cpu(val) (val)
|
||||||
@@ -51,7 +48,7 @@
|
|||||||
# define cpu_to_le64(val) (val)
|
# define cpu_to_le64(val) (val)
|
||||||
# define le64_to_cpu(val) (val)
|
# define le64_to_cpu(val) (val)
|
||||||
|
|
||||||
#elif __BYTE_ORDER == __BIG_ENDIAN
|
#elif defined(WORDS_BIGENDIAN)
|
||||||
|
|
||||||
# define cpu_to_le16(val) __swab16(val)
|
# define cpu_to_le16(val) __swab16(val)
|
||||||
# define le16_to_cpu(val) __swab16(val)
|
# define le16_to_cpu(val) __swab16(val)
|
||||||
@@ -64,4 +61,16 @@
|
|||||||
# error "nuxi/pdp-endian archs are not supported"
|
# error "nuxi/pdp-endian archs are not supported"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* REISERFS_SWAB_H */
|
#define get_leXX(xx,p,field) (le##xx##_to_cpu ((p)->field))
|
||||||
|
#define set_leXX(xx,p,field,val) do { (p)->field = cpu_to_le##xx(val); } while (0)
|
||||||
|
|
||||||
|
#define get_le16(p,field) get_leXX (16, p, field)
|
||||||
|
#define set_le16(p,field,val) set_leXX (16, p, field, val)
|
||||||
|
|
||||||
|
#define get_le32(p,field) get_leXX (32, p, field)
|
||||||
|
#define set_le32(p,field,val) set_leXX (32, p, field, val)
|
||||||
|
|
||||||
|
#define get_le64(p,field) get_leXX (64, p, field)
|
||||||
|
#define set_le64(p,field,val) set_leXX (64, p, field, val)
|
||||||
|
|
||||||
|
#endif /* MISC_SWAB_H */
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MISC_TYPES_H
|
||||||
|
#define MISC_TYPES_H
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
typedef unsigned char __u8;
|
||||||
|
typedef unsigned short int __u16;
|
||||||
|
typedef unsigned int __u32;
|
||||||
|
typedef unsigned long long int __u64;
|
||||||
|
|
||||||
|
#define INVAL_PTR (void *)-1
|
||||||
|
#define MAX_INT 2147483647
|
||||||
|
#define LONG_LONG_MAX 9223372036854775807LL
|
||||||
|
#define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MISC_UNALIGNED_H
|
||||||
|
#define MISC_UNALIGNED_H
|
||||||
|
|
||||||
|
#ifdef HAVE_ASM_UNALIGNED_H
|
||||||
|
# include <asm/unaligned.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef get_unaligned
|
||||||
|
#define get_unaligned(ptr) \
|
||||||
|
({ \
|
||||||
|
__typeof__(*(ptr)) __tmp; \
|
||||||
|
memcpy(&__tmp, (ptr), sizeof(*(ptr))); \
|
||||||
|
__tmp; \
|
||||||
|
})
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef put_unaligned
|
||||||
|
#define put_unaligned(val, ptr) \
|
||||||
|
({ \
|
||||||
|
__typeof__(*(ptr)) __tmp = (val); \
|
||||||
|
memcpy((ptr), &__tmp, sizeof(*(ptr))); \
|
||||||
|
(void)0; \
|
||||||
|
})
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* these operate on extent items, where you've got an array of ints
|
||||||
|
** at a possibly unaligned location. These are a noop on ia32
|
||||||
|
**
|
||||||
|
** p is the array of __u32, i is the index into the array, v is the value
|
||||||
|
** to store there.
|
||||||
|
*/
|
||||||
|
#define d32_get(p, i) le32_to_cpu(get_unaligned((__u32 *)(p) + (i)))
|
||||||
|
#define d32_put(p, i, v) put_unaligned(cpu_to_le32(v), (__u32 *)(p) + (i))
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
noinst_HEADERS = badblock.h bitmap.h buffer.h direntry.h extent.h \
|
||||||
|
filesystem.h fix_node.h hash.h internal.h \
|
||||||
|
internal_balance.h journal.h key.h leaf.h \
|
||||||
|
leaf_balance.h node.h objmap.h policy.h print.h \
|
||||||
|
stat.h super.h tree.h tree_balance.h libreiserfs.h \
|
||||||
|
types.h
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
# Makefile.in generated by automake 1.7.6 from Makefile.am.
|
# Makefile.in generated by automake 1.9.5 from Makefile.am.
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
|
||||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||||
# Free Software Foundation, Inc.
|
# 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||||
# This Makefile.in is free software; the Free Software Foundation
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
# with or without modifications, as long as this notice is preserved.
|
# with or without modifications, as long as this notice is preserved.
|
||||||
@@ -20,8 +20,7 @@ VPATH = @srcdir@
|
|||||||
pkgdatadir = $(datadir)/@PACKAGE@
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
pkglibdir = $(libdir)/@PACKAGE@
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
pkgincludedir = $(includedir)/@PACKAGE@
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
top_builddir = ..
|
top_builddir = ../..
|
||||||
|
|
||||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||||
INSTALL = @INSTALL@
|
INSTALL = @INSTALL@
|
||||||
install_sh_DATA = $(install_sh) -c -m 644
|
install_sh_DATA = $(install_sh) -c -m 644
|
||||||
@@ -35,7 +34,24 @@ POST_INSTALL = :
|
|||||||
NORMAL_UNINSTALL = :
|
NORMAL_UNINSTALL = :
|
||||||
PRE_UNINSTALL = :
|
PRE_UNINSTALL = :
|
||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
|
build_triplet = @build@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
|
subdir = include/reiserfs
|
||||||
|
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
|
||||||
|
$(srcdir)/Makefile.in
|
||||||
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
|
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||||
|
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||||
|
$(ACLOCAL_M4)
|
||||||
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
|
CONFIG_HEADER = $(top_builddir)/config.h
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
SOURCES =
|
||||||
|
DIST_SOURCES =
|
||||||
|
HEADERS = $(noinst_HEADERS)
|
||||||
|
ETAGS = etags
|
||||||
|
CTAGS = ctags
|
||||||
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
ACLOCAL = @ACLOCAL@
|
ACLOCAL = @ACLOCAL@
|
||||||
AMDEP_FALSE = @AMDEP_FALSE@
|
AMDEP_FALSE = @AMDEP_FALSE@
|
||||||
AMDEP_TRUE = @AMDEP_TRUE@
|
AMDEP_TRUE = @AMDEP_TRUE@
|
||||||
@@ -78,6 +94,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
|
|||||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||||
|
PROGS_LDFLAGS = @PROGS_LDFLAGS@
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
SET_MAKE = @SET_MAKE@
|
SET_MAKE = @SET_MAKE@
|
||||||
SHELL = @SHELL@
|
SHELL = @SHELL@
|
||||||
@@ -92,6 +109,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
|||||||
am__include = @am__include@
|
am__include = @am__include@
|
||||||
am__leading_dot = @am__leading_dot@
|
am__leading_dot = @am__leading_dot@
|
||||||
am__quote = @am__quote@
|
am__quote = @am__quote@
|
||||||
|
am__tar = @am__tar@
|
||||||
|
am__untar = @am__untar@
|
||||||
bindir = @bindir@
|
bindir = @bindir@
|
||||||
build = @build@
|
build = @build@
|
||||||
build_alias = @build_alias@
|
build_alias = @build_alias@
|
||||||
@@ -112,6 +131,7 @@ libdir = @libdir@
|
|||||||
libexecdir = @libexecdir@
|
libexecdir = @libexecdir@
|
||||||
localstatedir = @localstatedir@
|
localstatedir = @localstatedir@
|
||||||
mandir = @mandir@
|
mandir = @mandir@
|
||||||
|
mkdir_p = @mkdir_p@
|
||||||
oldincludedir = @oldincludedir@
|
oldincludedir = @oldincludedir@
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
program_transform_name = @program_transform_name@
|
program_transform_name = @program_transform_name@
|
||||||
@@ -119,95 +139,47 @@ sbindir = @sbindir@
|
|||||||
sharedstatedir = @sharedstatedir@
|
sharedstatedir = @sharedstatedir@
|
||||||
sysconfdir = @sysconfdir@
|
sysconfdir = @sysconfdir@
|
||||||
target_alias = @target_alias@
|
target_alias = @target_alias@
|
||||||
noinst_LIBRARIES = libmisc.a
|
noinst_HEADERS = badblock.h bitmap.h buffer.h direntry.h extent.h \
|
||||||
|
filesystem.h fix_node.h hash.h internal.h \
|
||||||
libmisc_a_SOURCES = io.c misc.c
|
internal_balance.h journal.h key.h leaf.h \
|
||||||
subdir = lib
|
leaf_balance.h node.h objmap.h policy.h print.h \
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
stat.h super.h tree.h tree_balance.h libreiserfs.h \
|
||||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
types.h
|
||||||
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)
|
|
||||||
|
|
||||||
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) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
|
||||||
DIST_SOURCES = $(libmisc_a_SOURCES)
|
|
||||||
DIST_COMMON = Makefile.am Makefile.in
|
|
||||||
SOURCES = $(libmisc_a_SOURCES)
|
|
||||||
|
|
||||||
all: all-am
|
all: all-am
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.SUFFIXES: .c .o .obj
|
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
@for dep in $?; do \
|
||||||
|
case '$(am__configure_deps)' in \
|
||||||
|
*$$dep*) \
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||||
|
&& exit 0; \
|
||||||
|
exit 1;; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/reiserfs/Makefile'; \
|
||||||
cd $(top_srcdir) && \
|
cd $(top_srcdir) && \
|
||||||
$(AUTOMAKE) --gnu lib/Makefile
|
$(AUTOMAKE) --gnu include/reiserfs/Makefile
|
||||||
Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status
|
.PRECIOUS: Makefile
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
|
@case '$?' in \
|
||||||
|
*config.status*) \
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||||
|
*) \
|
||||||
|
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||||
|
esac;
|
||||||
|
|
||||||
AR = ar
|
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
|
||||||
clean-noinstLIBRARIES:
|
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||||
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
libmisc.a: $(libmisc_a_OBJECTS) $(libmisc_a_DEPENDENCIES)
|
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||||
-rm -f libmisc.a
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
$(libmisc_a_AR) libmisc.a $(libmisc_a_OBJECTS) $(libmisc_a_LIBADD)
|
|
||||||
$(RANLIB) libmisc.a
|
|
||||||
|
|
||||||
mostlyclean-compile:
|
|
||||||
-rm -f *.$(OBJEXT) core *.core
|
|
||||||
|
|
||||||
distclean-compile:
|
|
||||||
-rm -f *.tab.c
|
|
||||||
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/io.Po@am__quote@
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.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 -f "$(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 -f "$(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:
|
uninstall-info-am:
|
||||||
|
|
||||||
ETAGS = etags
|
|
||||||
ETAGSFLAGS =
|
|
||||||
|
|
||||||
CTAGS = ctags
|
|
||||||
CTAGSFLAGS =
|
|
||||||
|
|
||||||
tags: TAGS
|
|
||||||
|
|
||||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||||
unique=`for i in $$list; do \
|
unique=`for i in $$list; do \
|
||||||
@@ -216,6 +188,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
|||||||
$(AWK) ' { files[$$0] = 1; } \
|
$(AWK) ' { files[$$0] = 1; } \
|
||||||
END { for (i in files) print i; }'`; \
|
END { for (i in files) print i; }'`; \
|
||||||
mkid -fID $$unique
|
mkid -fID $$unique
|
||||||
|
tags: TAGS
|
||||||
|
|
||||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||||
$(TAGS_FILES) $(LISP)
|
$(TAGS_FILES) $(LISP)
|
||||||
@@ -227,10 +200,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
|||||||
done | \
|
done | \
|
||||||
$(AWK) ' { files[$$0] = 1; } \
|
$(AWK) ' { files[$$0] = 1; } \
|
||||||
END { for (i in files) print i; }'`; \
|
END { for (i in files) print i; }'`; \
|
||||||
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||||
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
test -n "$$unique" || unique=$$empty_fix; \
|
||||||
$$tags $$unique
|
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||||
|
$$tags $$unique; \
|
||||||
|
fi
|
||||||
ctags: CTAGS
|
ctags: CTAGS
|
||||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||||
$(TAGS_FILES) $(LISP)
|
$(TAGS_FILES) $(LISP)
|
||||||
@@ -253,10 +227,6 @@ GTAGS:
|
|||||||
|
|
||||||
distclean-tags:
|
distclean-tags:
|
||||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH 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)
|
distdir: $(DISTFILES)
|
||||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||||
@@ -270,7 +240,7 @@ distdir: $(DISTFILES)
|
|||||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||||
dir="/$$dir"; \
|
dir="/$$dir"; \
|
||||||
$(mkinstalldirs) "$(distdir)$$dir"; \
|
$(mkdir_p) "$(distdir)$$dir"; \
|
||||||
else \
|
else \
|
||||||
dir=''; \
|
dir=''; \
|
||||||
fi; \
|
fi; \
|
||||||
@@ -287,8 +257,7 @@ distdir: $(DISTFILES)
|
|||||||
done
|
done
|
||||||
check-am: all-am
|
check-am: all-am
|
||||||
check: check-am
|
check: check-am
|
||||||
all-am: Makefile $(LIBRARIES)
|
all-am: Makefile $(HEADERS)
|
||||||
|
|
||||||
installdirs:
|
installdirs:
|
||||||
install: install-am
|
install: install-am
|
||||||
install-exec: install-exec-am
|
install-exec: install-exec-am
|
||||||
@@ -301,7 +270,7 @@ install-am: all-am
|
|||||||
installcheck: installcheck-am
|
installcheck: installcheck-am
|
||||||
install-strip:
|
install-strip:
|
||||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
INSTALL_STRIP_FLAG=-s \
|
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||||
`test -z '$(STRIP)' || \
|
`test -z '$(STRIP)' || \
|
||||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||||
mostlyclean-generic:
|
mostlyclean-generic:
|
||||||
@@ -309,24 +278,25 @@ mostlyclean-generic:
|
|||||||
clean-generic:
|
clean-generic:
|
||||||
|
|
||||||
distclean-generic:
|
distclean-generic:
|
||||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||||
|
|
||||||
maintainer-clean-generic:
|
maintainer-clean-generic:
|
||||||
@echo "This command is intended for maintainers to use"
|
@echo "This command is intended for maintainers to use"
|
||||||
@echo "it deletes files that may require special tools to rebuild."
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
clean: clean-am
|
clean: clean-am
|
||||||
|
|
||||||
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
|
clean-am: clean-generic mostlyclean-am
|
||||||
|
|
||||||
distclean: distclean-am
|
distclean: distclean-am
|
||||||
|
-rm -f Makefile
|
||||||
distclean-am: clean-am distclean-compile distclean-depend \
|
distclean-am: clean-am distclean-generic distclean-tags
|
||||||
distclean-generic distclean-tags
|
|
||||||
|
|
||||||
dvi: dvi-am
|
dvi: dvi-am
|
||||||
|
|
||||||
dvi-am:
|
dvi-am:
|
||||||
|
|
||||||
|
html: html-am
|
||||||
|
|
||||||
info: info-am
|
info: info-am
|
||||||
|
|
||||||
info-am:
|
info-am:
|
||||||
@@ -342,12 +312,12 @@ install-man:
|
|||||||
installcheck-am:
|
installcheck-am:
|
||||||
|
|
||||||
maintainer-clean: maintainer-clean-am
|
maintainer-clean: maintainer-clean-am
|
||||||
|
-rm -f Makefile
|
||||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||||
|
|
||||||
mostlyclean: mostlyclean-am
|
mostlyclean: mostlyclean-am
|
||||||
|
|
||||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
mostlyclean-am: mostlyclean-generic
|
||||||
|
|
||||||
pdf: pdf-am
|
pdf: pdf-am
|
||||||
|
|
||||||
@@ -360,15 +330,13 @@ ps-am:
|
|||||||
uninstall-am: uninstall-info-am
|
uninstall-am: uninstall-info-am
|
||||||
|
|
||||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||||
clean-noinstLIBRARIES ctags distclean distclean-compile \
|
ctags distclean distclean-generic distclean-tags distdir dvi \
|
||||||
distclean-depend distclean-generic distclean-tags distdir dvi \
|
dvi-am html html-am info info-am install install-am \
|
||||||
dvi-am info info-am install install-am install-data \
|
install-data install-data-am install-exec install-exec-am \
|
||||||
install-data-am install-exec install-exec-am install-info \
|
install-info install-info-am install-man install-strip \
|
||||||
install-info-am install-man install-strip installcheck \
|
installcheck installcheck-am installdirs maintainer-clean \
|
||||||
installcheck-am installdirs maintainer-clean \
|
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
|
||||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
|
||||||
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.
|
# 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.
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_BADBLOCK_H
|
||||||
|
#define REISERFS_BADBLOCK_H
|
||||||
|
|
||||||
|
#include "reiserfs/types.h"
|
||||||
|
|
||||||
|
#define REISERFS_BAD_DID 1
|
||||||
|
#define REISERFS_BAD_OID (__u32)-1
|
||||||
|
|
||||||
|
typedef void (*badblock_func_t) (reiserfs_filsys_t *fs,
|
||||||
|
reiserfs_path_t *badblock_path,
|
||||||
|
void *data);
|
||||||
|
|
||||||
|
extern void reiserfs_badblock_extract(reiserfs_filsys_t *fs,
|
||||||
|
reiserfs_path_t *badblock_path,
|
||||||
|
void *data);
|
||||||
|
|
||||||
|
extern void reiserfs_badblock_flush (reiserfs_filsys_t * fs,
|
||||||
|
int no_badblock_in_tree_yet);
|
||||||
|
|
||||||
|
extern void reiserfs_badblock_traverse(reiserfs_filsys_t * fs,
|
||||||
|
badblock_func_t action,
|
||||||
|
void *data);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_BITMAP_H
|
||||||
|
#define REISERFS_BITMAP_H
|
||||||
|
|
||||||
|
#include "reiserfs/types.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define reiserfs_bmap_nr(count, blk_size) \
|
||||||
|
((count - 1) / (blk_size * 8) + 1)
|
||||||
|
|
||||||
|
#define reiserfs_bmap_over(nr) (nr > ((1ll << 16) - 1))
|
||||||
|
|
||||||
|
extern reiserfs_bitmap_t *reiserfs_bitmap_create (unsigned int bit_count);
|
||||||
|
|
||||||
|
extern int reiserfs_bitmap_open(reiserfs_filsys_t *);
|
||||||
|
|
||||||
|
extern void reiserfs_bitmap_delete (reiserfs_bitmap_t * bm);
|
||||||
|
|
||||||
|
extern void reiserfs_bitmap_free (reiserfs_filsys_t *);
|
||||||
|
|
||||||
|
extern void reiserfs_bitmap_close (reiserfs_filsys_t *);
|
||||||
|
|
||||||
|
extern int reiserfs_bitmap_flush (reiserfs_bitmap_t * bm,
|
||||||
|
reiserfs_filsys_t * fs);
|
||||||
|
|
||||||
|
extern int reiserfs_bitmap_expand (reiserfs_bitmap_t * bm,
|
||||||
|
unsigned int bit_count);
|
||||||
|
|
||||||
|
extern void reiserfs_bitmap_shrink (reiserfs_bitmap_t * bm,
|
||||||
|
unsigned int bit_count);
|
||||||
|
|
||||||
|
extern void reiserfs_bitmap_copy (reiserfs_bitmap_t * to,
|
||||||
|
reiserfs_bitmap_t * from);
|
||||||
|
|
||||||
|
extern int reiserfs_bitmap_compare (reiserfs_bitmap_t * bm1,
|
||||||
|
reiserfs_bitmap_t * bm2);
|
||||||
|
|
||||||
|
extern void reiserfs_bitmap_disjunction (reiserfs_bitmap_t * disk,
|
||||||
|
reiserfs_bitmap_t * cont);
|
||||||
|
|
||||||
|
extern void reiserfs_bitmap_delta (reiserfs_bitmap_t * base,
|
||||||
|
reiserfs_bitmap_t * exclude);
|
||||||
|
|
||||||
|
extern void reiserfs_bitmap_set_bit (reiserfs_bitmap_t * bm,
|
||||||
|
unsigned int bit_number);
|
||||||
|
|
||||||
|
extern void reiserfs_bitmap_clear_bit (reiserfs_bitmap_t * bm,
|
||||||
|
unsigned int bit_number);
|
||||||
|
|
||||||
|
extern int reiserfs_bitmap_test_bit (reiserfs_bitmap_t * bm,
|
||||||
|
unsigned int bit_number);
|
||||||
|
|
||||||
|
extern int reiserfs_bitmap_find_zero_bit (reiserfs_bitmap_t * bm,
|
||||||
|
unsigned long * start);
|
||||||
|
|
||||||
|
extern void reiserfs_bitmap_zero (reiserfs_bitmap_t * bm);
|
||||||
|
|
||||||
|
extern void reiserfs_bitmap_fill (reiserfs_bitmap_t * bm);
|
||||||
|
|
||||||
|
extern void reiserfs_bitmap_invert (reiserfs_bitmap_t * bm);
|
||||||
|
|
||||||
|
extern unsigned int reiserfs_bitmap_ones (reiserfs_bitmap_t * bm);
|
||||||
|
|
||||||
|
extern unsigned int reiserfs_bitmap_zeros (reiserfs_bitmap_t * bm);
|
||||||
|
|
||||||
|
extern int reiserfs_bitmap_spread (reiserfs_filsys_t *);
|
||||||
|
|
||||||
|
extern int reiserfs_bitmap_block (reiserfs_filsys_t *,
|
||||||
|
unsigned long block);
|
||||||
|
|
||||||
|
/* Backup copies. */
|
||||||
|
extern void reiserfs_bitmap_save (FILE * fp,
|
||||||
|
reiserfs_bitmap_t *bm);
|
||||||
|
|
||||||
|
extern reiserfs_bitmap_t * reiserfs_bitmap_load (FILE * fp);
|
||||||
|
|
||||||
|
extern void reiserfs_bitmap_print (FILE * fp, reiserfs_filsys_t * fs,
|
||||||
|
int silent);
|
||||||
|
|
||||||
|
extern void reiserfs_print_bmap_block (FILE * fp, int i,
|
||||||
|
unsigned long block,
|
||||||
|
char * map, int blocks,
|
||||||
|
int silent, int blocksize);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_BUFFER_H
|
||||||
|
#define REISERFS_BUFFER_H
|
||||||
|
|
||||||
|
#include "reiserfs/types.h"
|
||||||
|
|
||||||
|
#define BH_Uptodate 0
|
||||||
|
#define BH_Dirty 1
|
||||||
|
#define BH_Lock 2
|
||||||
|
#define BH_Do_not_flush 3
|
||||||
|
|
||||||
|
#define reiserfs_buffer_uptodate(bh) misc_test_bit(BH_Uptodate, &(bh)->b_state)
|
||||||
|
#define reiserfs_buffer_mkuptodate(bh,i) misc_set_bit(BH_Uptodate, &(bh)->b_state)
|
||||||
|
|
||||||
|
#define reiserfs_buffer_isdirty(bh) misc_test_bit(BH_Dirty, &(bh)->b_state)
|
||||||
|
#define reiserfs_buffer_isclean(bh) !misc_test_bit(BH_Dirty, &(bh)->b_state)
|
||||||
|
#define reiserfs_buffer_mkdirty(bh) misc_set_bit(BH_Dirty, &(bh)->b_state)
|
||||||
|
#define reiserfs_buffer_mkclean(bh) misc_clear_bit(BH_Dirty, &(bh)->b_state)
|
||||||
|
|
||||||
|
#define reiserfs_buffer_noflush(bh) misc_test_bit(BH_Do_not_flush, &(bh)->b_state)
|
||||||
|
#define reiserfs_buffer_mknoflush(bh) misc_set_bit(BH_Do_not_flush, &(bh)->b_state)
|
||||||
|
#define reiserfs_buffer_clnoflush(bh) misc_clear_bit(BH_Do_not_flush, &(bh)->b_state)
|
||||||
|
|
||||||
|
extern reiserfs_bh_t * reiserfs_buffer_open (int, unsigned long, unsigned long);
|
||||||
|
extern reiserfs_bh_t * reiserfs_buffer_find (int, unsigned long, unsigned long);
|
||||||
|
extern reiserfs_bh_t * reiserfs_buffer_read (int, unsigned long, unsigned long);
|
||||||
|
|
||||||
|
extern int reiserfs_buffer_write (reiserfs_bh_t *);
|
||||||
|
|
||||||
|
extern void reiserfs_buffer_close (reiserfs_bh_t *);
|
||||||
|
|
||||||
|
extern void reiserfs_buffer_forget (reiserfs_bh_t *);
|
||||||
|
|
||||||
|
extern void reiserfs_buffer_flush_all(int);
|
||||||
|
|
||||||
|
extern void reiserfs_buffer_free_all (void);
|
||||||
|
|
||||||
|
extern void reiserfs_buffer_invalidate_all (int);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_DIRENTRY_H
|
||||||
|
#define REISERFS_DIRENTRY_H
|
||||||
|
|
||||||
|
#include "reiserfs/types.h"
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
/* DIRECTORY STRUCTURE */
|
||||||
|
/***************************************************************************/
|
||||||
|
/*
|
||||||
|
Picture represents the structure of directory items
|
||||||
|
________________________________________________
|
||||||
|
| Array of | | | | | |
|
||||||
|
| directory |N-1| N-2 | .... | 1st |0th|
|
||||||
|
| entry headers | | | | | |
|
||||||
|
|_______________|___|_____|________|_______|___|
|
||||||
|
<---- directory entries ------>
|
||||||
|
|
||||||
|
First directory item has k_offset component 1. We store "." and ".."
|
||||||
|
in one item, always, we never split "." and ".." into differing
|
||||||
|
items. This makes, among other things, the code for removing
|
||||||
|
directories simpler. */
|
||||||
|
|
||||||
|
/* Each directory entry has its header. This header has deh_dir_id and
|
||||||
|
deh_objectid fields, those are key of object, entry points to */
|
||||||
|
|
||||||
|
/* NOT IMPLEMENTED:
|
||||||
|
Directory will someday contain stat data of object */
|
||||||
|
struct reiserfs_de_head
|
||||||
|
{
|
||||||
|
__u32 deh2_offset; /* third component of the directory entry key */
|
||||||
|
__u32 deh2_dir_id; /* objectid of the parent directory of the object,
|
||||||
|
that is referenced by directory entry */
|
||||||
|
__u32 deh2_objectid;/* objectid of the object, that is referenced by
|
||||||
|
directory entry */
|
||||||
|
__u16 deh2_location;/* offset of name in the whole item */
|
||||||
|
__u16 deh2_state; /* whether 1) entry contains stat data (for future),
|
||||||
|
and 2) whether entry is hidden (unlinked) */
|
||||||
|
} __attribute__ ((__packed__));
|
||||||
|
|
||||||
|
typedef struct reiserfs_de_head reiserfs_deh_t;
|
||||||
|
|
||||||
|
#define REISERFS_DEH_SIZE sizeof(reiserfs_deh_t)
|
||||||
|
|
||||||
|
/* set/get fields of dir entry head these defines */
|
||||||
|
#define reiserfs_deh_get_off(deh) get_le32 (deh, deh2_offset)
|
||||||
|
#define reiserfs_deh_set_off(deh,val) set_le32 (deh, deh2_offset, val)
|
||||||
|
|
||||||
|
#define reiserfs_deh_get_did(deh) get_le32 (deh, deh2_dir_id)
|
||||||
|
#define reiserfs_deh_set_did(deh,val) set_le32 (deh, deh2_dir_id, val)
|
||||||
|
|
||||||
|
#define reiserfs_deh_get_obid(deh) get_le32 (deh, deh2_objectid)
|
||||||
|
#define reiserfs_deh_set_obid(deh,val) set_le32 (deh, deh2_objectid, val)
|
||||||
|
|
||||||
|
#define reiserfs_deh_get_loc(deh) get_le16 (deh, deh2_location)
|
||||||
|
#define reiserfs_deh_set_loc(deh,val) set_le16 (deh, deh2_location, val)
|
||||||
|
|
||||||
|
#define reiserfs_deh_get_state(deh) get_le16 (deh, deh2_state)
|
||||||
|
#define reiserfs_deh_set_state(deh,val) set_le16 (deh, deh2_state, val)
|
||||||
|
|
||||||
|
#define reiserfs_deh_name(deh, pos) \
|
||||||
|
((char *)(deh - pos) + reiserfs_deh_get_loc(deh))
|
||||||
|
|
||||||
|
/* empty directory contains two entries "." and ".." and their headers */
|
||||||
|
#define REISERFS_DIR_MIN \
|
||||||
|
(REISERFS_DEH_SIZE * 2 + \
|
||||||
|
MISC_ROUND_UP (strlen (".")) + \
|
||||||
|
MISC_ROUND_UP (strlen ("..")))
|
||||||
|
|
||||||
|
/* old format directories have this size when empty */
|
||||||
|
#define REISERFS_DIR_MIN_V1 (REISERFS_DEH_SIZE * 2 + 3)
|
||||||
|
|
||||||
|
#define DEH_Statdata 0 /* not used now */
|
||||||
|
#define DEH_Visible2 2
|
||||||
|
|
||||||
|
#define DEH_Bad_offset 4 /* fsck marks entries to be deleted with this flag */
|
||||||
|
#define DEH_Bad_location 5
|
||||||
|
|
||||||
|
#define reiserfs_deh_state_bit(deh,bit) \
|
||||||
|
(reiserfs_deh_get_state (deh) & (1 << bit))
|
||||||
|
|
||||||
|
#define reiserfs_deh_state_set_bit(deh,bit) \
|
||||||
|
{ \
|
||||||
|
__u16 state; \
|
||||||
|
state = reiserfs_deh_get_state (deh); \
|
||||||
|
state |= (1 << bit); \
|
||||||
|
reiserfs_deh_set_state(deh, state); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define reiserfs_deh_state_clear_bit(deh,bit) \
|
||||||
|
{ \
|
||||||
|
__u16 state; \
|
||||||
|
state = reiserfs_deh_get_state (deh); \
|
||||||
|
state &= ~(1 << bit); \
|
||||||
|
reiserfs_deh_set_state(deh, state); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Bad means "hashed unproperly or/and invalid location" */
|
||||||
|
#define reiserfs_deh_locbad(deh) \
|
||||||
|
reiserfs_deh_state_bit (deh, DEH_Bad_location)
|
||||||
|
#define reiserfs_deh_set_locbad(deh) \
|
||||||
|
reiserfs_deh_state_set_bit (deh, DEH_Bad_location)
|
||||||
|
#define reiserfs_deh_set_locok(deh) \
|
||||||
|
reiserfs_deh_state_clear_bit (deh, DEH_Bad_location)
|
||||||
|
|
||||||
|
#define reiserfs_deh_offbad(deh) \
|
||||||
|
reiserfs_deh_state_bit (deh, DEH_Bad_offset)
|
||||||
|
#define reiserfs_deh_set_offbad(deh) \
|
||||||
|
reiserfs_deh_state_set_bit (deh, DEH_Bad_offset)
|
||||||
|
|
||||||
|
#define reiserfs_deh_bad(deh) \
|
||||||
|
(reiserfs_deh_locbad(deh) || reiserfs_deh_offbad(deh))
|
||||||
|
|
||||||
|
|
||||||
|
/* for directories st_blocks is number of 512 byte units which fit into dir
|
||||||
|
size round up to blocksize */
|
||||||
|
#define REISERFS_DIR_BLOCKS(size) ((size + 511) / 512)
|
||||||
|
|
||||||
|
/* array of the entry headers */
|
||||||
|
#define reiserfs_deh(bh,ih) ((reiserfs_deh_t *)(reiserfs_item_by_ih(bh,ih)))
|
||||||
|
|
||||||
|
#define REISERFS_NAME_MAX 256
|
||||||
|
/* #define REISERFS_NAME_MAX(block_size) \
|
||||||
|
(block_size - REISERFS_NODEH_SIZE - \
|
||||||
|
REISERFS_IH_SIZE - REISERFS_DEH_SIZE)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* -REISERFS_SD_SIZE when entry will contain stat data */
|
||||||
|
|
||||||
|
extern int reiserfs_direntry_loc_check (reiserfs_deh_t * deh,
|
||||||
|
reiserfs_ih_t * ih,
|
||||||
|
int first);
|
||||||
|
|
||||||
|
extern int reiserfs_direntry_entry_len (reiserfs_ih_t * ih,
|
||||||
|
reiserfs_deh_t * deh,
|
||||||
|
int pos_in_item);
|
||||||
|
|
||||||
|
extern int reiserfs_direntry_name_len (reiserfs_ih_t * ih,
|
||||||
|
reiserfs_deh_t * deh,
|
||||||
|
int pos_in_item);
|
||||||
|
|
||||||
|
extern int reiserfs_direntry_entry_estimate (char * name,
|
||||||
|
int key_format);
|
||||||
|
|
||||||
|
extern int reiserfs_direntry_check (reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_ih_t * ih,
|
||||||
|
char * item,
|
||||||
|
int bad_dir);
|
||||||
|
|
||||||
|
extern void reiserfs_direntry_print (FILE * fp,
|
||||||
|
reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_bh_t * bh,
|
||||||
|
reiserfs_ih_t * ih);
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_EXTENT_H
|
||||||
|
#define REISERFS_EXTENT_H
|
||||||
|
|
||||||
|
#include "reiserfs/types.h"
|
||||||
|
|
||||||
|
/* Size of pointer to the unformatted node. */
|
||||||
|
#define REISERFS_EXT_SIZE (sizeof(__u32))
|
||||||
|
|
||||||
|
/* number of blocks pointed to by the extent item */
|
||||||
|
#define reiserfs_ext_count(p_s_ih) \
|
||||||
|
(reiserfs_ih_get_len(p_s_ih) / REISERFS_EXT_SIZE)
|
||||||
|
|
||||||
|
extern int reiserfs_ext_check (reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_ih_t * ih, char * item,
|
||||||
|
unfm_func_t func);
|
||||||
|
|
||||||
|
extern void reiserfs_ext_print(FILE * fp,
|
||||||
|
reiserfs_bh_t * bh,
|
||||||
|
int item_num);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_FS_H
|
||||||
|
#define REISERFS_FS_H
|
||||||
|
|
||||||
|
#include <reiserfs/types.h>
|
||||||
|
|
||||||
|
/* ReiserFS leaves the first 64k unused, so that partition labels have enough
|
||||||
|
space. If someone wants to write a fancy bootloader that needs more than
|
||||||
|
64k, let us know, and this will be increased in size. This number must be
|
||||||
|
larger than than the largest block size on any platform, or code will
|
||||||
|
break. -Hans */
|
||||||
|
#define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024)
|
||||||
|
|
||||||
|
/*#define MD_RAID_SUPERBLOCKS_IN_BYTES (128 * 1024)*/
|
||||||
|
|
||||||
|
/* the spot for the super in versions 3.5 - 3.5.11 (inclusive) */
|
||||||
|
#define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024)
|
||||||
|
|
||||||
|
#define reiserfs_ondisk_offset(block_of_super_block, block_size) \
|
||||||
|
(block_of_super_block * block_size)
|
||||||
|
|
||||||
|
#define reiserfs_new_location(block_of_super_block, block_size) \
|
||||||
|
((reiserfs_ondisk_offset(block_of_super_block, block_size) == \
|
||||||
|
REISERFS_DISK_OFFSET_IN_BYTES) ? 1 : 0)
|
||||||
|
|
||||||
|
/*only 4k blocks for old location*/
|
||||||
|
#define reiserfs_old_location(block_of_super_block, block_size) \
|
||||||
|
((reiserfs_ondisk_offset(block_of_super_block, 4096) == \
|
||||||
|
REISERFS_OLD_DISK_OFFSET_IN_BYTES) ? 1 : 0)
|
||||||
|
|
||||||
|
enum reiserfs_blktype {
|
||||||
|
BT_INVAL = 0x1,
|
||||||
|
BT_SUPER = 0x2,
|
||||||
|
BT_JOURNAL = 0x3,
|
||||||
|
BT_BITMAP = 0x4,
|
||||||
|
BT_UNKNOWN
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum reiserfs_blktype reiserfs_blktype_t;
|
||||||
|
|
||||||
|
extern reiserfs_filsys_t * reiserfs_fs_open (char * filename,
|
||||||
|
int flags,
|
||||||
|
int * error,
|
||||||
|
void * vp,
|
||||||
|
int skip_check);
|
||||||
|
|
||||||
|
extern reiserfs_filsys_t * reiserfs_fs_create (char * filename,
|
||||||
|
int version,
|
||||||
|
unsigned long block_count,
|
||||||
|
int block_size,
|
||||||
|
int default_journal,
|
||||||
|
int new_format);
|
||||||
|
|
||||||
|
extern void reiserfs_fs_flush (reiserfs_filsys_t *);
|
||||||
|
|
||||||
|
extern void reiserfs_fs_free (reiserfs_filsys_t *);
|
||||||
|
|
||||||
|
extern void reiserfs_fs_close (reiserfs_filsys_t *);
|
||||||
|
|
||||||
|
extern void reiserfs_fs_reopen (reiserfs_filsys_t *, int flags);
|
||||||
|
|
||||||
|
extern int reiserfs_fs_rw (reiserfs_filsys_t * fs);
|
||||||
|
|
||||||
|
extern int reiserfs_fs_blksize_check (unsigned int blocksize);
|
||||||
|
|
||||||
|
extern reiserfs_blktype_t reiserfs_fs_block(reiserfs_filsys_t *fs,
|
||||||
|
unsigned long block);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_FIX_NODE_H
|
||||||
|
#define REISERFS_FIX_NODE_H
|
||||||
|
|
||||||
|
#include <reiserfs/types.h>
|
||||||
|
#include <reiserfs/tree_balance.h>
|
||||||
|
|
||||||
|
/* maximum number of FEB blocknrs on a single level */
|
||||||
|
#define FN_AMOUNT_MAX 2
|
||||||
|
|
||||||
|
/* To make any changes in the tree we always first find node, that contains
|
||||||
|
item to be changed/deleted or place to insert a new item. We call this node
|
||||||
|
S. To do balancing we need to decide what we will shift to left/right
|
||||||
|
neighbor, or to a new node, where new item will be etc. To make this
|
||||||
|
analysis simpler we build virtual node. Virtual node is an array of items,
|
||||||
|
that will replace items of node S. (For instance if we are going to delete
|
||||||
|
an item, virtual node does not contain it). Virtual node keeps information
|
||||||
|
about item sizes and types, mergeability of first and last items, sizes of
|
||||||
|
all entries in directory item. We use this array of items when calculating
|
||||||
|
what we can shift to neighbors and how many nodes we have to have if we do
|
||||||
|
not any shiftings, if we shift to left/right neighbor or to both. */
|
||||||
|
struct reiserfs_virtual_item
|
||||||
|
{
|
||||||
|
/* item type, mergeability */
|
||||||
|
unsigned short vi_type;
|
||||||
|
/* length of item that it will have after balancing */
|
||||||
|
unsigned short vi_item_len;
|
||||||
|
/* offset of item that it have before balancing */
|
||||||
|
__u64 vi_item_offset;
|
||||||
|
|
||||||
|
/* number of entries in directory item (including the new one if any,
|
||||||
|
or excluding entry if it must be cut) */
|
||||||
|
short vi_entry_count;
|
||||||
|
/* array of entry lengths for directory item */
|
||||||
|
unsigned short * vi_entry_sizes;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct reiserfs_virtual_node
|
||||||
|
{
|
||||||
|
/* this is a pointer to the free space in the buffer */
|
||||||
|
char * vn_free_ptr;
|
||||||
|
/* number of items in virtual node */
|
||||||
|
unsigned short vn_nr_item;
|
||||||
|
/* size of node , that node would have if it has unlimited size and no
|
||||||
|
balancing is performed */
|
||||||
|
short vn_size;
|
||||||
|
/* mode of balancing (paste, insert, delete, cut) */
|
||||||
|
short vn_mode;
|
||||||
|
short vn_affected_item_num;
|
||||||
|
short vn_pos_in_item;
|
||||||
|
/* item header of inserted item, 0 for other modes */
|
||||||
|
reiserfs_ih_t * vn_ins_ih;
|
||||||
|
/* array of items (including a new one, excluding item to be deleted) */
|
||||||
|
struct reiserfs_virtual_item * vn_vi;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern int reiserfs_fix_nodes (int n_op_mode,
|
||||||
|
reiserfs_tb_t * p_s_tb,
|
||||||
|
reiserfs_ih_t * p_s_ins_ih);
|
||||||
|
|
||||||
|
extern void reiserfs_unfix_nodes (reiserfs_tb_t *);
|
||||||
|
|
||||||
|
/* FIXME: move these 2 into tree.h when get rid of search_by_key */
|
||||||
|
extern reiserfs_bh_t * reiserfs_tree_right_neighbor (reiserfs_filsys_t * s,
|
||||||
|
reiserfs_path_t * path);
|
||||||
|
|
||||||
|
extern reiserfs_bh_t * reiserfs_tree_left_neighbor (reiserfs_filsys_t * s,
|
||||||
|
reiserfs_path_t * path);
|
||||||
|
|
||||||
|
extern void reiserfs_fix_node_print(struct reiserfs_virtual_node * vn);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_HASH_H
|
||||||
|
#define REISERFS_HASH_H
|
||||||
|
|
||||||
|
#include "misc/types.h"
|
||||||
|
|
||||||
|
#define UNSET_HASH 0 // read_super will guess about, what hash names
|
||||||
|
// in directories were sorted with
|
||||||
|
|
||||||
|
enum {
|
||||||
|
REISERFS_HASH_TEA = 0x1,
|
||||||
|
REISERFS_HASH_YURA = 0x2,
|
||||||
|
REISERFS_HASH_R5 = 0x3,
|
||||||
|
REISERFS_HASH_LAST
|
||||||
|
};
|
||||||
|
|
||||||
|
#define DEFAULT_HASH REISERFS_HASH_R5
|
||||||
|
|
||||||
|
/* hashes.c */
|
||||||
|
extern __u32 reiserfs_hash_keyed (const char *msg, int len);
|
||||||
|
|
||||||
|
extern __u32 reiserfs_hash_yura (const char *msg, int len);
|
||||||
|
|
||||||
|
extern __u32 reiserfs_hash_r5 (const char *msg, int len);
|
||||||
|
|
||||||
|
extern int reiserfs_hash_count (void);
|
||||||
|
|
||||||
|
extern int reiserfs_hash_correct (hashf_t *func,
|
||||||
|
char * name,
|
||||||
|
int namelen,
|
||||||
|
__u32 offset);
|
||||||
|
|
||||||
|
extern int reiserfs_hash_find (char * name,
|
||||||
|
int namelen,
|
||||||
|
__u32 deh_offset,
|
||||||
|
unsigned int code_to_try_first);
|
||||||
|
|
||||||
|
extern char *reiserfs_hash_name (unsigned int code);
|
||||||
|
|
||||||
|
extern int reiserfs_hash_code (hashf_t func);
|
||||||
|
|
||||||
|
extern hashf_t reiserfs_hash_func (unsigned int code);
|
||||||
|
|
||||||
|
extern hashf_t reiserfs_hash_get (char * hash);
|
||||||
|
|
||||||
|
extern __u32 reiserfs_hash_value (hashf_t func, char * name, int namelen);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_INTERNAL_H
|
||||||
|
#define REISERFS_INTERNAL_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Picture represents an internal node of the reiserfs tree
|
||||||
|
* ______________________________________________________
|
||||||
|
* | | Array of | Array of | Free |
|
||||||
|
* |block | keys | pointers | space |
|
||||||
|
* | head | N | N+1 | |
|
||||||
|
* |______|_______________|___________________|___________|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Disk child pointer: The pointer from an internal node of the tree
|
||||||
|
to a node that is on disk. */
|
||||||
|
struct reiserfs_dc {
|
||||||
|
__u32 dc2_block_number; /* Disk child's block number. */
|
||||||
|
__u16 dc2_size; /* Disk child's used space. */
|
||||||
|
__u16 dc2_reserved;
|
||||||
|
} __attribute__ ((__packed__));
|
||||||
|
|
||||||
|
typedef struct reiserfs_dc reiserfs_dc_t;
|
||||||
|
|
||||||
|
#define REISERFS_DC_SIZE (sizeof(reiserfs_dc_t))
|
||||||
|
|
||||||
|
/* set/get fields of disk_child with these defines */
|
||||||
|
#define reiserfs_dc_get_nr(dc) get_le32 (dc, dc2_block_number)
|
||||||
|
#define reiserfs_dc_set_nr(dc,val) set_le32 (dc, dc2_block_number, val)
|
||||||
|
|
||||||
|
#define reiserfs_dc_get_size(dc) get_le16 (dc, dc2_size)
|
||||||
|
#define reiserfs_dc_set_size(dc,val) set_le16 (dc, dc2_size, val)
|
||||||
|
|
||||||
|
#define reiserfs_dc_init(dc, size, blocknr) \
|
||||||
|
({ \
|
||||||
|
reiserfs_dc_set_nr(dc, blocknr); \
|
||||||
|
reiserfs_dc_set_size(dc, size); \
|
||||||
|
set_le16(dc, dc2_reserved, 0); \
|
||||||
|
})
|
||||||
|
|
||||||
|
/* max and min number of keys in internal node */
|
||||||
|
#define REISERFS_INT_MAX(bh) \
|
||||||
|
((REISERFS_NODE_SPACE(bh->b_size) - REISERFS_DC_SIZE) / \
|
||||||
|
(REISERFS_KEY_SIZE+REISERFS_DC_SIZE))
|
||||||
|
|
||||||
|
#define REISERFS_INT_MIN(bh) (REISERFS_INT_MAX(bh) / 2)
|
||||||
|
|
||||||
|
/* get key */
|
||||||
|
#define reiserfs_int_key_at(bh,item_num) \
|
||||||
|
((reiserfs_key_t * )((bh)->b_data + REISERFS_NODEH_SIZE) + \
|
||||||
|
(item_num) )
|
||||||
|
|
||||||
|
/* Get disk child by buffer header and position in the tree node. */
|
||||||
|
#define reiserfs_int_at(p_s_bh,n_pos) \
|
||||||
|
((reiserfs_dc_t *) ((p_s_bh)->b_data + REISERFS_NODEH_SIZE + \
|
||||||
|
reiserfs_node_items(p_s_bh) * REISERFS_KEY_SIZE +\
|
||||||
|
REISERFS_DC_SIZE * (n_pos)))
|
||||||
|
|
||||||
|
#define reiserfs_int_head(bh) \
|
||||||
|
((reiserfs_nh_get_level (((reiserfs_node_head_t *)((bh)->b_data))) > \
|
||||||
|
LEAF_LEVEL) && \
|
||||||
|
(reiserfs_nh_get_level (((reiserfs_node_head_t *)((bh)->b_data))) <= \
|
||||||
|
REISERFS_TREE_HEIGHT_MAX))
|
||||||
|
|
||||||
|
extern int reiserfs_internal_correct (reiserfs_bh_t *bh);
|
||||||
|
|
||||||
|
extern int reiserfs_internal_print (FILE * fp,
|
||||||
|
reiserfs_bh_t * bh,
|
||||||
|
int first, int last);
|
||||||
|
|
||||||
|
extern int reiserfs_internal_get_pos (reiserfs_bh_t * bh,
|
||||||
|
unsigned long block);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_IB_H
|
||||||
|
#define REISERFS_IB_H
|
||||||
|
|
||||||
|
extern int reiserfs_ib_balance (reiserfs_tb_t * tb,
|
||||||
|
int h, int child_pos,
|
||||||
|
reiserfs_ih_t * insert_key,
|
||||||
|
reiserfs_bh_t ** insert_ptr);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,211 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_JOURNAL_H
|
||||||
|
#define REISERFS_JOURNAL_H
|
||||||
|
|
||||||
|
#define reiserfs_jp_get_start(jp) get_le32(jp, jp_start)
|
||||||
|
#define reiserfs_jp_set_start(jp,val) set_le32(jp, jp_start, val)
|
||||||
|
|
||||||
|
#define reiserfs_jp_get_dev(jp) get_le32 (jp, jp_dev)
|
||||||
|
#define reiserfs_jp_set_dev(jp,val) set_le32 (jp, jp_dev, val)
|
||||||
|
|
||||||
|
#define reiserfs_jp_get_size(jp) get_le32 (jp, jp_size)
|
||||||
|
#define reiserfs_jp_set_size(jp,val) set_le32 (jp, jp_size, val)
|
||||||
|
|
||||||
|
#define reiserfs_jp_get_tlen(jp) get_le32 (jp, jp_tlen)
|
||||||
|
#define reiserfs_jp_set_tlen(jp,val) set_le32 (jp, jp_tlen, val)
|
||||||
|
|
||||||
|
#define reiserfs_jp_get_magic(jp) get_le32 (jp, jp_magic)
|
||||||
|
#define reiserfs_jp_set_magic(jp,val) set_le32 (jp, jp_magic, val)
|
||||||
|
|
||||||
|
#define NEED_TUNE 0xffffffff
|
||||||
|
|
||||||
|
#define reiserfs_jp_get_max_batch(jp) get_le32 (jp, jp_max_batch)
|
||||||
|
#define reiserfs_jp_set_max_batch(jp,val) set_le32 (jp, jp_max_batch, val)
|
||||||
|
|
||||||
|
#define reiserfs_jp_get_commit_age(jp) get_le32 (jp, jp_commit_age)
|
||||||
|
#define reiserfs_jp_set_commit_age(jp,val) set_le32 (jp, jp_commit_age, val)
|
||||||
|
|
||||||
|
#define reiserfs_jp_get_trans_age(jp) get_le32 (jp, jp_trans_age)
|
||||||
|
#define reiserfs_jp_set_trans_age(jp,val) set_le32 (jp, jp_trans_age, val)
|
||||||
|
|
||||||
|
/* must be correct to keep the desc and commit structs at 4k */
|
||||||
|
/* first block written in a commit. BUG, not 64bit safe */
|
||||||
|
struct reiserfs_journal_desc {
|
||||||
|
/* id of commit */
|
||||||
|
__u32 j2_trans_id ;
|
||||||
|
/* length of commit. len +1 is the commit block */
|
||||||
|
__u32 j2_len ;
|
||||||
|
/* mount id of this trans*/
|
||||||
|
__u32 j2_mount_id ;
|
||||||
|
/* real locations for each block */
|
||||||
|
__u32 j2_realblock[1] ;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define reiserfs_jd_magic(bh) (bh->b_data + bh->b_size - 12)
|
||||||
|
|
||||||
|
#define reiserfs_jd_head(bh) ((struct reiserfs_journal_desc *)bh->b_data)
|
||||||
|
|
||||||
|
#define reiserfs_jd_get_trans(bh) get_le32 (reiserfs_jd_head (bh), j2_trans_id)
|
||||||
|
#define reiserfs_jd_set_trans(bh,val) set_le32 (reiserfs_jd_head (bh), j2_trans_id, val)
|
||||||
|
|
||||||
|
#define reiserfs_jd_get_len(bh) get_le32 (reiserfs_jd_head (bh), j2_len)
|
||||||
|
#define reiserfs_jd_set_len(bh,val) set_le32 (reiserfs_jd_head (bh), j2_len, val)
|
||||||
|
|
||||||
|
#define reiserfs_jd_get_mount(bh) get_le32 (reiserfs_jd_head (bh), j2_mount_id)
|
||||||
|
#define reiserfs_jd_set_mount(bh,val) set_le32 (reiserfs_jd_head (bh), j2_mount_id, val)
|
||||||
|
|
||||||
|
|
||||||
|
/* last block written in a commit BUG, not 64bit safe */
|
||||||
|
struct reiserfs_journal_commit {
|
||||||
|
__u32 j3_trans_id ; /* must match j_trans_id from the desc block */
|
||||||
|
__u32 j3_len ; /* ditto */
|
||||||
|
__u32 j3_realblock[1] ; /* real locations for each block */
|
||||||
|
} ;
|
||||||
|
|
||||||
|
#define reiserfs_jc_head(bh) ((struct reiserfs_journal_commit *)bh->b_data)
|
||||||
|
|
||||||
|
#define reiserfs_jc_get_trans(bh) get_le32 (reiserfs_jc_head(bh), j3_trans_id)
|
||||||
|
#define reiserfs_jc_set_trans(bh,val) set_le32 (reiserfs_jc_head(bh), j3_trans_id, val)
|
||||||
|
|
||||||
|
#define reiserfs_jc_get_len(bh) get_le32 (reiserfs_jc_head(bh), j3_len)
|
||||||
|
#define reiserfs_jc_set_len(bh,val) set_le32 (reiserfs_jc_head(bh), j3_len, val)
|
||||||
|
|
||||||
|
|
||||||
|
/* set/get fields of journal header with these defines */
|
||||||
|
#define reiserfs_jh_get_mount(jh) get_le32 (jh, jh_mount_id)
|
||||||
|
#define reiserfs_jh_set_mount(jh,val) set_le32 (jh, jh_mount_id, val)
|
||||||
|
|
||||||
|
#define reiserfs_jh_get_flushed(jh) get_le32 (jh, jh_last_flush_trans_id)
|
||||||
|
#define reiserfs_jh_set_flushed(jh,val) set_le32 (jh, jh_last_flush_trans_id, val)
|
||||||
|
|
||||||
|
#define reiserfs_jh_get_start(jh) get_le32 (jh, jh_flush_offset)
|
||||||
|
#define reiserfs_jh_set_start(jh,val) set_le32 (jh, jh_flush_offset, val)
|
||||||
|
|
||||||
|
|
||||||
|
/* Journal Transaction Half */
|
||||||
|
#define reiserfs_jt_half(blocksize) \
|
||||||
|
((blocksize - sizeof (struct reiserfs_journal_desc) + \
|
||||||
|
sizeof (__u32) - 12) / sizeof (__u32))
|
||||||
|
|
||||||
|
|
||||||
|
/* journal default settings */
|
||||||
|
#define JOURNAL_MIN_SIZE 512
|
||||||
|
|
||||||
|
/* biggest possible single transaction, don't change for now (8/3/99) */
|
||||||
|
#define JOURNAL_TRANS_MAX 1024
|
||||||
|
|
||||||
|
/* need to check whether it works */
|
||||||
|
#define JOURNAL_TRANS_MIN 256
|
||||||
|
/* default journal size / max trans length */
|
||||||
|
#define JOURNAL_DEFAULT_RATIO 8
|
||||||
|
#define JOURNAL_MIN_RATIO 2
|
||||||
|
/* max blocks to batch into one transaction, don't make this
|
||||||
|
any bigger than 900 */
|
||||||
|
#define JOURNAL_MAX_BATCH 900
|
||||||
|
|
||||||
|
#define JOURNAL_MAX_COMMIT_AGE 30
|
||||||
|
#define JOURNAL_MAX_TRANS_AGE 30
|
||||||
|
|
||||||
|
/* journal max size is a maximum number of blocks pointed by first bitmap -
|
||||||
|
REISERFS_DISK_OFFSET - superblock - first bitmap - journal herader */
|
||||||
|
#define reiserfs_journal_max(sb_nr,blocksize) \
|
||||||
|
blocksize * 8 - (sb_nr + 1 + 1 + 1)
|
||||||
|
|
||||||
|
#define reiserfs_journal_default(sb_nr,blocksize) \
|
||||||
|
(unsigned long long) \
|
||||||
|
((8192 > reiserfs_journal_max (sb_nr,blocksize)) ? \
|
||||||
|
reiserfs_journal_max (sb_nr,blocksize) : 8192)
|
||||||
|
|
||||||
|
struct reiserfs_trans {
|
||||||
|
unsigned long mount_id;
|
||||||
|
unsigned long trans_id;
|
||||||
|
unsigned long desc_blocknr;
|
||||||
|
unsigned long trans_len;
|
||||||
|
unsigned long commit_blocknr;
|
||||||
|
unsigned long next_trans_offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct reiserfs_trans reiserfs_trans_t;
|
||||||
|
|
||||||
|
extern unsigned long reiserfs_journal_hostsize (reiserfs_sb_t *sb);
|
||||||
|
|
||||||
|
extern int reiserfs_journal_block (reiserfs_filsys_t *,
|
||||||
|
unsigned long block);
|
||||||
|
|
||||||
|
extern int reiserfs_journal_desc_valid (reiserfs_bh_t *);
|
||||||
|
|
||||||
|
extern int reiserfs_journal_get_transactions (reiserfs_filsys_t *,
|
||||||
|
reiserfs_trans_t *,
|
||||||
|
reiserfs_trans_t *);
|
||||||
|
|
||||||
|
typedef void (*action_on_trans_t) (reiserfs_filsys_t *,
|
||||||
|
reiserfs_trans_t *);
|
||||||
|
|
||||||
|
extern void reiserfs_journal_by_transaction (reiserfs_filsys_t *,
|
||||||
|
action_on_trans_t);
|
||||||
|
|
||||||
|
typedef void (*action_on_block_t) (reiserfs_filsys_t *,
|
||||||
|
reiserfs_trans_t *,
|
||||||
|
unsigned int index,
|
||||||
|
unsigned long in_journal,
|
||||||
|
unsigned long in_place);
|
||||||
|
|
||||||
|
extern void reiserfs_journal_foreach (reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_trans_t * trans,
|
||||||
|
action_on_block_t action);
|
||||||
|
|
||||||
|
extern int reiserfs_journal_open (reiserfs_filsys_t *,
|
||||||
|
char *, int flags);
|
||||||
|
|
||||||
|
extern int reiserfs_journal_params_check(reiserfs_filsys_t *fs);
|
||||||
|
|
||||||
|
extern int reiserfs_journal_create (reiserfs_filsys_t * fs,
|
||||||
|
char * j_filename,
|
||||||
|
unsigned long offset,
|
||||||
|
unsigned long len,
|
||||||
|
int transaction_max_size);
|
||||||
|
|
||||||
|
extern int reiserfs_journal_opened (reiserfs_filsys_t *);
|
||||||
|
|
||||||
|
extern void reiserfs_journal_flush (reiserfs_filsys_t * fs);
|
||||||
|
|
||||||
|
extern void reiserfs_journal_free (reiserfs_filsys_t * fs);
|
||||||
|
|
||||||
|
extern void reiserfs_journal_close (reiserfs_filsys_t *);
|
||||||
|
|
||||||
|
extern void reiserfs_journal_reopen (reiserfs_filsys_t * fs, int flag);
|
||||||
|
|
||||||
|
extern int reiserfs_journal_replay (reiserfs_filsys_t * fs);
|
||||||
|
|
||||||
|
extern __u32 reiserfs_journal_trans_age (void);
|
||||||
|
|
||||||
|
extern __u32 reiserfs_journal_commit_age (void);
|
||||||
|
|
||||||
|
extern __u32 reiserfs_journal_batch (unsigned long journal_trans_max);
|
||||||
|
|
||||||
|
extern __u32 reiserfs_journal_tlen (__u32 desired,
|
||||||
|
__u32 journal_size,
|
||||||
|
int blocksize,
|
||||||
|
int verbose);
|
||||||
|
|
||||||
|
extern unsigned int reiserfs_journal_start_must (reiserfs_filsys_t * fs);
|
||||||
|
|
||||||
|
extern int reiserfs_journal_fits (unsigned long sb_nr,
|
||||||
|
unsigned int block_size,
|
||||||
|
unsigned long block_count,
|
||||||
|
unsigned long journal_size);
|
||||||
|
|
||||||
|
extern void reiserfs_journal_print_params (FILE * fp,
|
||||||
|
reiserfs_journal_param_t * jp);
|
||||||
|
|
||||||
|
extern void reiserfs_journal_print_header (reiserfs_filsys_t * fs);
|
||||||
|
|
||||||
|
extern void reiserfs_journal_print (reiserfs_filsys_t *);
|
||||||
|
|
||||||
|
extern int reiserfs_print_jdesc (FILE * fp, reiserfs_bh_t * bh);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_KEY_H
|
||||||
|
#define REISERFS_KEY_H
|
||||||
|
|
||||||
|
/* set/get fields of keys on disk with these defines */
|
||||||
|
#define reiserfs_key_get_did(k) get_le32 (k, k2_dir_id)
|
||||||
|
#define reiserfs_key_set_did(k,val) set_le32 (k, k2_dir_id, val)
|
||||||
|
|
||||||
|
#define reiserfs_key_get_oid(k) get_le32 (k, k2_objectid)
|
||||||
|
#define reiserfs_key_set_oid(k,val) set_le32 (k, k2_objectid, val)
|
||||||
|
|
||||||
|
#define reiserfs_key_get_off1(k) get_le32 (k, u.k2_offset_v1.k_offset)
|
||||||
|
#define reiserfs_key_set_off1(k,val) set_le32 (k, u.k2_offset_v1.k_offset, val)
|
||||||
|
|
||||||
|
#define reiserfs_key_get_uni(k) get_le32 (k, u.k2_offset_v1.k_uniqueness)
|
||||||
|
#define reiserfs_key_set_uni(k,val) set_le32 (k, u.k2_offset_v1.k_uniqueness, val)
|
||||||
|
|
||||||
|
#define REISERFS_KEY_SIZE (sizeof(reiserfs_key_t))
|
||||||
|
#define REISERFS_KEY_SHSIZE 8
|
||||||
|
|
||||||
|
|
||||||
|
// values for k_uniqueness field of the reiserfs_key_t
|
||||||
|
#define UNI_SD 0
|
||||||
|
#define UNI_DE 500
|
||||||
|
#define UNI_DE 500
|
||||||
|
#define UNI_DIRECT 0xffffffff
|
||||||
|
#define UNI_EXT 0xfffffffe
|
||||||
|
#define UNI_UNKN 555
|
||||||
|
|
||||||
|
/* values for k_type field of the reiserfs_key_t */
|
||||||
|
#define TYPE_STAT_DATA 0x0
|
||||||
|
#define TYPE_EXTENT 0x1
|
||||||
|
#define TYPE_DIRECT 0X2
|
||||||
|
#define TYPE_DIRENTRY 0X3
|
||||||
|
#define TYPE_LAST 0x4
|
||||||
|
#define TYPE_UNKNOWN 0xf
|
||||||
|
|
||||||
|
#define KEY_FORMAT_1 0
|
||||||
|
#define KEY_FORMAT_2 1
|
||||||
|
#define KEY_FORMAT_UNDEFINED 15
|
||||||
|
|
||||||
|
/* Our function for comparing keys can compare keys of different lengths.
|
||||||
|
It takes as a parameter the length of the keys it is to compare. These
|
||||||
|
defines are used in determining what is to be passed to it as that
|
||||||
|
parameter. */
|
||||||
|
#define REISERFS_KEY_LEN 4
|
||||||
|
#define REISERFS_KEY_SHORT_LEN 2
|
||||||
|
|
||||||
|
/* there are 4 types of items: stat data, directory item, extent, direct.
|
||||||
|
FIXME: This table does not describe new key format
|
||||||
|
+-------------------+------------+--------------+------------+
|
||||||
|
| | k_offset | k_uniqueness | mergeable? |
|
||||||
|
+-------------------+------------+--------------+------------+
|
||||||
|
| stat data | 0 | 0 | no |
|
||||||
|
+-------------------+------------+--------------+------------+
|
||||||
|
| 1st directory item| OFFSET_DOT |DIRENTRY_UNIQU| no |
|
||||||
|
| non 1st directory | hash value | | yes |
|
||||||
|
| item | | | |
|
||||||
|
+-------------------+------------+--------------+------------+
|
||||||
|
| extent item | offset + 1 |TYPE_EXTENT | if not the first object EXT item
|
||||||
|
+-------------------+------------+--------------+------------+
|
||||||
|
| direct item | offset + 1 |TYPE_DIRECT | if not the first object direct item
|
||||||
|
+-------------------+------------+--------------+------------+
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define reiserfs_key_stat(p_s_key) \
|
||||||
|
(reiserfs_key_get_type (p_s_key) == TYPE_STAT_DATA )
|
||||||
|
#define reiserfs_key_dir(p_s_key) \
|
||||||
|
(reiserfs_key_get_type (p_s_key) == TYPE_DIRENTRY )
|
||||||
|
#define reiserfs_key_direct(p_s_key) \
|
||||||
|
(reiserfs_key_get_type (p_s_key) == TYPE_DIRECT )
|
||||||
|
#define reiserfs_key_ext(p_s_key) \
|
||||||
|
(reiserfs_key_get_type (p_s_key) == TYPE_EXTENT )
|
||||||
|
#define reiserfs_key_unkn(p_s_key) \
|
||||||
|
(reiserfs_key_get_type (p_s_key) >= TYPE_LAST)
|
||||||
|
|
||||||
|
#define MAX_KEY1_OFFSET 0xffffffff
|
||||||
|
#define MAX_KEY2_OFFSET 0xfffffffffffffffLL
|
||||||
|
|
||||||
|
/* hash value occupies 24 bits starting from 7 up to 30 */
|
||||||
|
#define OFFSET_HASH(offset) ((offset) & 0x7fffff80)
|
||||||
|
/* generation number occupies 7 bits starting from 0 up to 6 */
|
||||||
|
#define OFFSET_GEN(offset) ((offset) & 0x0000007f)
|
||||||
|
|
||||||
|
#define OFFSET_SD 0
|
||||||
|
#define OFFSET_DOT 1
|
||||||
|
#define OFFSET_DOT_DOT 2
|
||||||
|
|
||||||
|
extern const reiserfs_key_t MIN_KEY;
|
||||||
|
extern const reiserfs_key_t MAX_KEY;
|
||||||
|
extern const reiserfs_key_t root_dir_key;
|
||||||
|
extern const reiserfs_key_t parent_root_dir_key;
|
||||||
|
extern reiserfs_key_t lost_found_dir_key;
|
||||||
|
|
||||||
|
extern void reiserfs_key_copy (reiserfs_key_t * to, const reiserfs_key_t * from);
|
||||||
|
extern void reiserfs_key_copy2 (reiserfs_key_t * to, const reiserfs_key_t * from);
|
||||||
|
extern int reiserfs_key_comp (const void * k1, const void * k2);
|
||||||
|
extern int reiserfs_key_comp3 (const void * k1, const void * k2);
|
||||||
|
extern int reiserfs_key_comp2 (const void * p_s_key1, const void * p_s_key2);
|
||||||
|
|
||||||
|
extern int reiserfs_key_format (const reiserfs_key_t * key);
|
||||||
|
|
||||||
|
extern unsigned long long reiserfs_key_get_off (const reiserfs_key_t * key);
|
||||||
|
|
||||||
|
extern int reiserfs_key_get_type (const reiserfs_key_t * key);
|
||||||
|
|
||||||
|
extern char * reiserfs_key_name (const reiserfs_key_t * key);
|
||||||
|
|
||||||
|
extern void reiserfs_key_set_type (int format,
|
||||||
|
reiserfs_key_t * key,
|
||||||
|
int type);
|
||||||
|
|
||||||
|
extern void reiserfs_key_set_off (int format,
|
||||||
|
reiserfs_key_t * key,
|
||||||
|
unsigned long long offset);
|
||||||
|
|
||||||
|
extern void reiserfs_key_set_sec (int format,
|
||||||
|
reiserfs_key_t * key,
|
||||||
|
unsigned long long offset,
|
||||||
|
int type);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*
|
||||||
|
* Leaf balancing method declarations.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_LEAF_H
|
||||||
|
#define REISERFS_LEAF_H
|
||||||
|
|
||||||
|
#include <reiserfs/types.h>
|
||||||
|
#include <misc/bitops.h>
|
||||||
|
|
||||||
|
/* size of item header */
|
||||||
|
#define REISERFS_IH_SIZE (sizeof(reiserfs_ih_t))
|
||||||
|
|
||||||
|
/* set/get fields of item head on disk with these defines */
|
||||||
|
#define reiserfs_ih_get_entries(ih) get_le16 (ih, u.ih2_entry_count)
|
||||||
|
#define reiserfs_ih_set_entries(ih,val) set_le16 (ih, u.ih2_entry_count, val)
|
||||||
|
|
||||||
|
#define reiserfs_ih_get_free(ih) get_le16 (ih, u.ih2_free_space)
|
||||||
|
#define reiserfs_ih_set_free(ih,val) set_le16 (ih, u.ih2_free_space, 0)
|
||||||
|
|
||||||
|
#define reiserfs_ih_get_len(ih) get_le16 (ih, ih2_item_len)
|
||||||
|
#define reiserfs_ih_set_len(ih,val) set_le16 (ih, ih2_item_len, val)
|
||||||
|
|
||||||
|
#define reiserfs_ih_get_loc(ih) get_le16 (ih, ih2_item_location)
|
||||||
|
#define reiserfs_ih_set_loc(ih,val) set_le16 (ih, ih2_item_location, val)
|
||||||
|
|
||||||
|
#define reiserfs_ih_format_v1(ih) (reiserfs_ih_get_format (ih) == KEY_FORMAT_1)
|
||||||
|
|
||||||
|
#define IH_Unreachable 0
|
||||||
|
#define IH_Was_Tail 1
|
||||||
|
#define IH_Checked 2
|
||||||
|
#define IH_Writable 3
|
||||||
|
|
||||||
|
/* Unreachable bit is set on tree rebuilding and is cleared in semantic pass */
|
||||||
|
#define reiserfs_ih_clflags(ih) reiserfs_ih_set_flags (ih, 0)
|
||||||
|
|
||||||
|
#define reiserfs_ih_isreach(ih) \
|
||||||
|
(!(reiserfs_ih_get_flags (ih) & (1 << IH_Unreachable)))
|
||||||
|
|
||||||
|
#define reiserfs_ih_clunreach(ih) reiserfs_ih_set_flags (ih, \
|
||||||
|
reiserfs_ih_get_flags (ih) & ~(1 << IH_Unreachable))
|
||||||
|
|
||||||
|
#define reiserfs_ih_mkunreach(ih) reiserfs_ih_set_flags (ih, \
|
||||||
|
reiserfs_ih_get_flags (ih) | (1 << IH_Unreachable))
|
||||||
|
|
||||||
|
#define reiserfs_ih_wastail(ih) \
|
||||||
|
(reiserfs_ih_get_flags (ih) & (1 << IH_Was_Tail))
|
||||||
|
|
||||||
|
#define reiserfs_ih_mktail(ih) reiserfs_ih_set_flags (ih, \
|
||||||
|
reiserfs_ih_get_flags (ih) | (1 << IH_Was_Tail))
|
||||||
|
|
||||||
|
#define reiserfs_ih_cltail(ih) reiserfs_ih_set_flags (ih, \
|
||||||
|
reiserfs_ih_get_flags (ih) & ~(1 << IH_Was_Tail))
|
||||||
|
|
||||||
|
#define reiserfs_ih_ischeck(ih) \
|
||||||
|
(reiserfs_ih_get_flags (ih) & (1 << IH_Checked))
|
||||||
|
|
||||||
|
#define reiserfs_ih_mkcheck(ih) reiserfs_ih_set_flags (ih, \
|
||||||
|
reiserfs_ih_get_flags (ih) | (1 << IH_Checked))
|
||||||
|
|
||||||
|
#define reiserfs_ih_clcheck(ih) reiserfs_ih_set_flags (ih, \
|
||||||
|
reiserfs_ih_get_flags (ih) & ~(1 << IH_Checked))
|
||||||
|
|
||||||
|
#define reiserfs_ih_iswrite(ih) \
|
||||||
|
(reiserfs_ih_get_flags (ih) & (1 << IH_Writable))
|
||||||
|
|
||||||
|
#define reiserfs_ih_mkwrite(ih) reiserfs_ih_set_flags (ih, \
|
||||||
|
reiserfs_ih_get_flags (ih) | (1 << IH_Writable))
|
||||||
|
|
||||||
|
#define reiserfs_ih_clwrite(ih) reiserfs_ih_set_flags (ih, \
|
||||||
|
reiserfs_ih_get_flags (ih) & ~(1 << IH_Writable))
|
||||||
|
|
||||||
|
|
||||||
|
#define reiserfs_ih_stat(p_s_ih) reiserfs_key_stat(&((p_s_ih)->ih_key))
|
||||||
|
#define reiserfs_ih_dir(p_s_ih) reiserfs_key_dir(&((p_s_ih)->ih_key))
|
||||||
|
#define reiserfs_ih_direct(p_s_ih) reiserfs_key_direct(&((p_s_ih)->ih_key))
|
||||||
|
#define reiserfs_ih_ext(p_s_ih) reiserfs_key_ext(&((p_s_ih)->ih_key))
|
||||||
|
|
||||||
|
|
||||||
|
/* maximal length of item */
|
||||||
|
#define REISERFS_ITEM_MAX(block_size) \
|
||||||
|
(block_size - REISERFS_NODEH_SIZE - REISERFS_IH_SIZE)
|
||||||
|
|
||||||
|
#define REISERFS_ITEM_MIN 1
|
||||||
|
|
||||||
|
#define REISERFS_DIRECT_MAX(size) \
|
||||||
|
((size) - REISERFS_NODEH_SIZE - 2 * REISERFS_IH_SIZE - \
|
||||||
|
REISERFS_SD_SIZE - REISERFS_EXT_SIZE)
|
||||||
|
|
||||||
|
/* get the item header */
|
||||||
|
#define reiserfs_ih_at(bh,item_num) \
|
||||||
|
((reiserfs_ih_t * )((bh)->b_data + REISERFS_NODEH_SIZE) + (item_num))
|
||||||
|
|
||||||
|
/* get the key */
|
||||||
|
#define reiserfs_ih_key_at(bh,item_num) \
|
||||||
|
(&(reiserfs_ih_at(bh,item_num)->ih_key))
|
||||||
|
|
||||||
|
/* get item body */
|
||||||
|
#define reiserfs_item_at(bh,item_num) \
|
||||||
|
( (bh)->b_data + reiserfs_ih_get_loc (reiserfs_ih_at((bh),(item_num))))
|
||||||
|
|
||||||
|
/* following defines use reiserfs buffer header and item header */
|
||||||
|
/* get item body */
|
||||||
|
#define reiserfs_item_by_ih(bh,ih) ((bh)->b_data + reiserfs_ih_get_loc(ih))
|
||||||
|
|
||||||
|
#define reiserfs_leaf_head(bh) \
|
||||||
|
(reiserfs_nh_get_level ((reiserfs_node_head_t *)((bh)->b_data)) \
|
||||||
|
== LEAF_LEVEL)
|
||||||
|
|
||||||
|
/* check whether byte number 'offset' is in this item */
|
||||||
|
#define reiserfs_item_has_off(p_s_ih, n_offset, n_blocksize) \
|
||||||
|
(reiserfs_key_get_off(&(p_s_ih)->ih_key) <= (n_offset) && \
|
||||||
|
reiserfs_key_get_off(&(p_s_ih)->ih_key) + \
|
||||||
|
reiserfs_leaf_ibytes(p_s_ih,n_blocksize) > (n_offset) )
|
||||||
|
|
||||||
|
#define reiserfs_item_has_key(p_s_ih, p_s_key, n_blocksize) \
|
||||||
|
(!reiserfs_key_comp2(p_s_ih, p_s_key) && \
|
||||||
|
reiserfs_item_has_off(p_s_ih, reiserfs_key_get_off (p_s_key), \
|
||||||
|
n_blocksize))
|
||||||
|
|
||||||
|
#define reiserfs_item_off_at(ih, pos, bs) \
|
||||||
|
(reiserfs_key_get_off (&(ih)->ih_key) + \
|
||||||
|
(pos) * (reiserfs_ih_direct(ih) ? 1 : (bs)))
|
||||||
|
|
||||||
|
#define reiserfs_dir(ih, item) \
|
||||||
|
((reiserfs_ih_stat(ih) && !not_a_directory(item)) || \
|
||||||
|
reiserfs_ih_dir(ih))
|
||||||
|
|
||||||
|
#define reiserfs_item_count(ih) \
|
||||||
|
(reiserfs_ih_ext(ih) ? reiserfs_ext_count(ih) : \
|
||||||
|
reiserfs_ih_direct(ih) ? reiserfs_ih_get_len(ih) : \
|
||||||
|
reiserfs_ih_dir(ih) ? reiserfs_ih_get_entries(ih) : \
|
||||||
|
reiserfs_ih_stat(ih) ? 1 : 0)
|
||||||
|
|
||||||
|
extern void reiserfs_leaf_mkempty (reiserfs_bh_t *bh);
|
||||||
|
|
||||||
|
extern int reiserfs_leaf_mergeable (reiserfs_ih_t *left,
|
||||||
|
reiserfs_ih_t *right,
|
||||||
|
int bsize);
|
||||||
|
|
||||||
|
extern int reiserfs_leaf_count_items(reiserfs_bh_t *bh);
|
||||||
|
|
||||||
|
extern int reiserfs_leaf_free_count(reiserfs_bh_t *bh);
|
||||||
|
|
||||||
|
extern int reiserfs_leaf_estimate_items(reiserfs_bh_t * bh);
|
||||||
|
|
||||||
|
extern int reiserfs_leaf_valid(reiserfs_bh_t *bh);
|
||||||
|
|
||||||
|
typedef void (*ih_func_t) (reiserfs_ih_t * ih);
|
||||||
|
typedef void (*item_func_t) (reiserfs_bh_t * bh,
|
||||||
|
reiserfs_ih_t * ih);
|
||||||
|
|
||||||
|
extern void reiserfs_leaf_traverse(reiserfs_bh_t * bh,
|
||||||
|
ih_func_t action,
|
||||||
|
item_func_t * actions);
|
||||||
|
|
||||||
|
extern void reiserfs_leaf_delete_item (reiserfs_filsys_t *,
|
||||||
|
reiserfs_bh_t * bh,
|
||||||
|
int item_num);
|
||||||
|
|
||||||
|
extern void reiserfs_leaf_delete_entry (reiserfs_filsys_t *,
|
||||||
|
reiserfs_bh_t * bh,
|
||||||
|
int item_num,
|
||||||
|
int entry_num,
|
||||||
|
int del_count);
|
||||||
|
|
||||||
|
extern int reiserfs_leaf_correct_at (reiserfs_filsys_t *,
|
||||||
|
reiserfs_ih_t *, char *,
|
||||||
|
unfm_func_t, int);
|
||||||
|
|
||||||
|
extern __u32 reiserfs_leaf_ibytes (const reiserfs_ih_t * ih,
|
||||||
|
int blocksize);
|
||||||
|
|
||||||
|
extern int reiserfs_leaf_print(FILE * fp,
|
||||||
|
reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_bh_t * bh,
|
||||||
|
int print_mode,
|
||||||
|
int first,
|
||||||
|
int last);
|
||||||
|
|
||||||
|
/* key format is stored in 12 bits starting from 0-th of item_head's ih2_format*/
|
||||||
|
extern __u16 reiserfs_ih_get_format(const reiserfs_ih_t *ih);
|
||||||
|
extern void reiserfs_ih_set_format(reiserfs_ih_t *ih, __u16 val);
|
||||||
|
extern __u16 reiserfs_ih_get_flags(const reiserfs_ih_t *ih);
|
||||||
|
extern void reiserfs_ih_set_flags(reiserfs_ih_t *ih, __u16 val);
|
||||||
|
|
||||||
|
enum leaf_print {
|
||||||
|
LP_LEAF_DETAILS = 0x1,
|
||||||
|
LP_DIRECT_ITEMS = 0x2,
|
||||||
|
LP_LAST
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_LB_H
|
||||||
|
#define REISERFS_LB_H
|
||||||
|
|
||||||
|
extern void reiserfs_lb_delete_item (reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_bufinfo_t * bi,
|
||||||
|
int first,
|
||||||
|
int del_num);
|
||||||
|
|
||||||
|
extern void reiserfs_lb_delete_unit (reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_bufinfo_t * bi,
|
||||||
|
int cut_item_num,
|
||||||
|
int pos_in_item,
|
||||||
|
int cut_size);
|
||||||
|
|
||||||
|
extern void reiserfs_lb_delete (reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_bufinfo_t * cur_bi,
|
||||||
|
int last_first,
|
||||||
|
int first,
|
||||||
|
int del_num,
|
||||||
|
int del_bytes);
|
||||||
|
|
||||||
|
extern int reiserfs_lb_balance (reiserfs_tb_t * tb,
|
||||||
|
reiserfs_ih_t * ih,
|
||||||
|
const char * body,
|
||||||
|
int flag,
|
||||||
|
int zeros_number,
|
||||||
|
reiserfs_ih_t * insert_key,
|
||||||
|
reiserfs_bh_t ** insert_ptr);
|
||||||
|
|
||||||
|
extern int reiserfs_lb_copy (reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_bufinfo_t * dest_bi,
|
||||||
|
reiserfs_bh_t * src,
|
||||||
|
int last_first,
|
||||||
|
int cpy_num,
|
||||||
|
int cpy_bytes);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_LIBREISER4_H
|
||||||
|
#define REISERFS_LIBREISER4_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <reiserfs/types.h>
|
||||||
|
#include <reiserfs/bitmap.h>
|
||||||
|
#include <reiserfs/buffer.h>
|
||||||
|
#include <reiserfs/filesystem.h>
|
||||||
|
#include <reiserfs/journal.h>
|
||||||
|
#include <reiserfs/super.h>
|
||||||
|
#include <reiserfs/tree.h>
|
||||||
|
#include <reiserfs/key.h>
|
||||||
|
#include <reiserfs/node.h>
|
||||||
|
#include <reiserfs/leaf.h>
|
||||||
|
#include <reiserfs/direntry.h>
|
||||||
|
#include <reiserfs/internal.h>
|
||||||
|
#include <reiserfs/extent.h>
|
||||||
|
#include <reiserfs/stat.h>
|
||||||
|
#include <reiserfs/fix_node.h>
|
||||||
|
#include <reiserfs/tree_balance.h>
|
||||||
|
#include <reiserfs/internal_balance.h>
|
||||||
|
#include <reiserfs/leaf_balance.h>
|
||||||
|
#include <reiserfs/badblock.h>
|
||||||
|
#include <reiserfs/objmap.h>
|
||||||
|
#include <reiserfs/policy.h>
|
||||||
|
#include <reiserfs/print.h>
|
||||||
|
#include <reiserfs/hash.h>
|
||||||
|
|
||||||
|
#ifdef LIBREISERFS_READY
|
||||||
|
extern const char *libreiserfs_version(void);
|
||||||
|
extern int libreiserfs_max_interface_version(void);
|
||||||
|
extern int libreiserfs_min_interface_version(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_NODE_H
|
||||||
|
#define REISERFS_NODE_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Picture represents a leaf of internal tree
|
||||||
|
* ______________________________________________________
|
||||||
|
* | | Array of | | |
|
||||||
|
* |Block | Object-Item | F r e e | Objects- |
|
||||||
|
* | head | Headers | S p a c e | Items |
|
||||||
|
* |______|_______________|___________________|___________|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Header of a disk block. More precisely, header of a formatted leaf
|
||||||
|
or internal node, and not the header of an unformatted node. */
|
||||||
|
struct reiserfs_node_head {
|
||||||
|
__u16 blk2_level; /* Level of a block in the tree. */
|
||||||
|
__u16 blk2_nr_item; /* Number of keys/items in a block. */
|
||||||
|
__u16 blk2_free_space; /* Block free space in bytes. */
|
||||||
|
__u16 blk_reserved;
|
||||||
|
__u32 reserved [4];
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct reiserfs_node_head reiserfs_node_head_t;
|
||||||
|
|
||||||
|
#define REISERFS_NODEH_SIZE (sizeof(reiserfs_node_head_t))
|
||||||
|
|
||||||
|
/* set/get fields of block head on disk with these defines */
|
||||||
|
#define reiserfs_nh_get_level(blkh) get_le16 (blkh, blk2_level)
|
||||||
|
#define reiserfs_nh_set_level(blkh,val) set_le16 (blkh, blk2_level, val)
|
||||||
|
|
||||||
|
#define reiserfs_nh_get_items(blkh) get_le16 (blkh, blk2_nr_item)
|
||||||
|
#define reiserfs_nh_set_items(blkh,val) set_le16 (blkh, blk2_nr_item, val)
|
||||||
|
|
||||||
|
#define reiserfs_nh_get_free(blkh) get_le16 (blkh, blk2_free_space)
|
||||||
|
#define reiserfs_nh_set_free(blkh,val) set_le16 (blkh, blk2_free_space, val)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* values for blk_type field
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define FREE_LEVEL 0 /* Node of this level is out of the tree. */
|
||||||
|
#define LEAF_LEVEL 1 /* Leaf node level. */
|
||||||
|
|
||||||
|
/* Given the buffer head of a formatted node, resolve to the block head of that node. */
|
||||||
|
#define NODE_HEAD(p_s_bh) ((reiserfs_node_head_t *)((p_s_bh)->b_data))
|
||||||
|
|
||||||
|
#define reiserfs_node_items(bh) reiserfs_nh_get_items (NODE_HEAD(bh))
|
||||||
|
#define reiserfs_node_level(bh) reiserfs_nh_get_level (NODE_HEAD(bh))
|
||||||
|
#define reiserfs_node_free(bh) reiserfs_nh_get_free (NODE_HEAD(bh))
|
||||||
|
|
||||||
|
/* Does the buffer contain a disk block which is in the tree. */
|
||||||
|
#define REISERFS_NODE_INTREE(p_s_bh) \
|
||||||
|
(reiserfs_nh_get_level(NODE_HEAD (p_s_bh)) != FREE_LEVEL)
|
||||||
|
|
||||||
|
#define REISERFS_NODE_SPACE(blocksize) ((blocksize) - REISERFS_NODEH_SIZE)
|
||||||
|
|
||||||
|
/* amount of used space in buffer (not including block head) */
|
||||||
|
#define reiserfs_node_used(cur) (REISERFS_NODE_SPACE(cur->b_size) - \
|
||||||
|
(reiserfs_node_free(cur)))
|
||||||
|
|
||||||
|
enum node_type {
|
||||||
|
NT_LEAF = 0x1,
|
||||||
|
NT_INTERNAL = 0x2,
|
||||||
|
NT_SUPER = 0x3,
|
||||||
|
NT_JDESC = 0x4,
|
||||||
|
NT_IH_ARRAY = 0x5,
|
||||||
|
NT_UNKNOWN
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum node_type node_type_t;
|
||||||
|
|
||||||
|
extern void reiserfs_node_replace_key (reiserfs_bh_t * dest, int n_dest,
|
||||||
|
reiserfs_bh_t * src, int n_src);
|
||||||
|
|
||||||
|
extern void reiserfs_node_forget(reiserfs_filsys_t *fs,
|
||||||
|
unsigned long blk);
|
||||||
|
|
||||||
|
|
||||||
|
extern int reiserfs_node_formatted (reiserfs_bh_t * bh, int level);
|
||||||
|
extern int reiserfs_node_type (reiserfs_bh_t *bh);
|
||||||
|
extern char *reiserfs_node_type_name(int code);
|
||||||
|
|
||||||
|
extern void reiserfs_node_print (FILE * fp,
|
||||||
|
reiserfs_filsys_t *,
|
||||||
|
reiserfs_bh_t * bh, ...);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_OBJMAP_H
|
||||||
|
#define REISERFS_OBJMAP_H
|
||||||
|
|
||||||
|
/* object identifier for root dir */
|
||||||
|
#define REISERFS_ROOT_OBJECTID 2
|
||||||
|
#define REISERFS_ROOT_PARENT_OBJECTID 1
|
||||||
|
|
||||||
|
extern int reiserfs_objmap_test (reiserfs_filsys_t * fs, __u32 objectid);
|
||||||
|
|
||||||
|
extern void reiserfs_objmap_set (reiserfs_filsys_t * fs, __u32 objectid);
|
||||||
|
|
||||||
|
extern void reiserfs_objmap_print (FILE * fp, reiserfs_filsys_t * fs);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_POLICY_H
|
||||||
|
#define REISERFS_POLICY_H
|
||||||
|
|
||||||
|
/* this is aggressive tail suppression policy taken from the kernel */
|
||||||
|
/* It should be REISERFS_DIRECT_MAX used here, but sometimes it is not enough,
|
||||||
|
* and items got deleted. */
|
||||||
|
#define reiserfs_policy_ext(n_file_size,n_tail_size,n_block_size) \
|
||||||
|
( \
|
||||||
|
(!(n_tail_size)) || \
|
||||||
|
(((n_tail_size) > REISERFS_ITEM_MAX(n_block_size)) || \
|
||||||
|
( (n_file_size) >= (n_block_size) * 4 ) || \
|
||||||
|
( ( (n_file_size) >= (n_block_size) * 3 ) && \
|
||||||
|
( (n_tail_size) >= (REISERFS_ITEM_MAX(n_block_size))/4) ) || \
|
||||||
|
( ( (n_file_size) >= (n_block_size) * 2 ) && \
|
||||||
|
( (n_tail_size) >= (REISERFS_ITEM_MAX(n_block_size))/2) ) || \
|
||||||
|
( ( (n_file_size) >= (n_block_size) ) && \
|
||||||
|
( (n_tail_size) >= (REISERFS_ITEM_MAX(n_block_size) * 3)/4) ) ) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_PRINT_H
|
||||||
|
#define REISERFS_PRINT_H
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
extern void reiserfs_warning (FILE * fp, const char * fmt, ...);
|
||||||
|
|
||||||
|
#define reiserfs_panic(fmt, list...) \
|
||||||
|
{\
|
||||||
|
fflush (stdout);\
|
||||||
|
fprintf (stderr, "%s %d %s\n", __FILE__, __LINE__, __FUNCTION__);\
|
||||||
|
reiserfs_warning (stderr, (const char *)fmt, ## list);\
|
||||||
|
reiserfs_warning (stderr, "\n" );\
|
||||||
|
abort ();\
|
||||||
|
}
|
||||||
|
#define reiserfs_exit(val, fmt, list...) \
|
||||||
|
{\
|
||||||
|
fflush (stdout);\
|
||||||
|
reiserfs_warning (stderr, (const char *)fmt, ## list);\
|
||||||
|
reiserfs_warning (stderr, "\n" );\
|
||||||
|
exit (val);\
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,192 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_STAT_H
|
||||||
|
#define REISERFS_STAT_H
|
||||||
|
|
||||||
|
/* Stat Data on disk (reiserfs version of UFS disk inode minus the address blocks) */
|
||||||
|
|
||||||
|
/* The sense of adding union to stat data is to keep a value of real number of
|
||||||
|
blocks used by file. The necessity of adding such information is caused by
|
||||||
|
existing of files with holes. Reiserfs should keep number of used blocks
|
||||||
|
for file, but not calculate it from file size (that is not correct for
|
||||||
|
holed files). Thus we have to add additional information to stat data.
|
||||||
|
When we have a device special file, there is no need to get number of used
|
||||||
|
blocks for them, and, accordingly, we doesn't need to keep major and minor
|
||||||
|
numbers for regular files, which might have holes. So this field is being
|
||||||
|
overloaded. */
|
||||||
|
|
||||||
|
struct reiserfs_sd_v1 {
|
||||||
|
__u16 sd_mode; /* file type, permissions */
|
||||||
|
__u16 sd_nlink; /* number of hard links */
|
||||||
|
__u16 sd_uid; /* owner */
|
||||||
|
__u16 sd_gid; /* group */
|
||||||
|
__u32 sd_size; /* file size */
|
||||||
|
__u32 sd_atime; /* time of last access */
|
||||||
|
__u32 sd_mtime; /* time file was last modified */
|
||||||
|
__u32 sd_ctime; /* time inode (stat data) was last changed (except
|
||||||
|
changes to sd_atime and sd_mtime) */
|
||||||
|
union {
|
||||||
|
__u32 sd_rdev;
|
||||||
|
__u32 sd_blocks; /* number of blocks file uses */
|
||||||
|
} __attribute__ ((__packed__)) u;
|
||||||
|
__u32 sd_fdb; /* first byte of file which is stored
|
||||||
|
in a direct item: except that if it
|
||||||
|
equals 1 it is a symlink and if it
|
||||||
|
equals MAX_KEY_OFFSET there is no
|
||||||
|
direct item. The existence of this
|
||||||
|
field really grates on me. Let's
|
||||||
|
replace it with a macro based on
|
||||||
|
sd_size and our tail suppression
|
||||||
|
policy. Someday. -Hans */
|
||||||
|
} __attribute__ ((__packed__));
|
||||||
|
|
||||||
|
typedef struct reiserfs_sd_v1 reiserfs_sd_v1_t;
|
||||||
|
|
||||||
|
#define REISERFS_SD_SIZE_V1 (sizeof(reiserfs_sd_v1_t))
|
||||||
|
|
||||||
|
/* this is used to check sd_size of stat data v1 */
|
||||||
|
#define REISERFS_SD_SIZE_MAX_V1 0x7fffffff
|
||||||
|
|
||||||
|
// sd_fdb is set to this when there are no direct items in a file
|
||||||
|
#define REISERFS_SD_NODIRECT 0xffffffff
|
||||||
|
|
||||||
|
/* Stat Data on disk (reiserfs version of UFS disk inode minus the
|
||||||
|
address blocks) */
|
||||||
|
struct reiserfs_sd {
|
||||||
|
__u16 sd_mode; /* file type, permissions */
|
||||||
|
__u16 sd_attrs;
|
||||||
|
__u32 sd_nlink; /* 32 bit nlink! */
|
||||||
|
__u64 sd_size; /* 64 bit size!*/
|
||||||
|
__u32 sd_uid; /* 32 bit uid! */
|
||||||
|
__u32 sd_gid; /* 32 bit gid! */
|
||||||
|
__u32 sd_atime; /* time of last access */
|
||||||
|
__u32 sd_mtime; /* time file was last modified */
|
||||||
|
__u32 sd_ctime; /* time inode (stat data) was last changed (except
|
||||||
|
changes to sd_atime and sd_mtime) */
|
||||||
|
__u32 sd_blocks;
|
||||||
|
union {
|
||||||
|
__u32 sd_rdev;
|
||||||
|
__u32 sd_generation;
|
||||||
|
//__u32 sd_fdb;
|
||||||
|
/* first byte of file which is stored in a direct item: except that if
|
||||||
|
it equals 1 it is a symlink and if it equals ~(__u32)0 there is no
|
||||||
|
direct item. The existence of this field really grates on me. Let's
|
||||||
|
replace it with a macro based on sd_size and our tail suppression
|
||||||
|
policy? */
|
||||||
|
} __attribute__ ((__packed__)) u;
|
||||||
|
} __attribute__ ((__packed__));
|
||||||
|
//
|
||||||
|
// this is 44 bytes long
|
||||||
|
//
|
||||||
|
|
||||||
|
typedef struct reiserfs_sd reiserfs_sd_t;
|
||||||
|
|
||||||
|
#define REISERFS_SD_SIZE (sizeof(reiserfs_sd_t))
|
||||||
|
|
||||||
|
/* this is used to check sd_size of stat data v2: max offset which can
|
||||||
|
be reached with a key of format 2 is 60 bits */
|
||||||
|
#define REISERFS_SD_SIZE_MAX_V2 0xfffffffffffffffLL
|
||||||
|
|
||||||
|
/* reiserfs_sd_v1_t* access macros */
|
||||||
|
#define reiserfs_sd_v1_mode(sd) (le16_to_cpu((sd)->sd_mode))
|
||||||
|
#define reiserfs_set_sd_v1_mode(sd,n) ((sd)->sd_mode = cpu_to_le16((n)))
|
||||||
|
#define reiserfs_sd_v1_nlink(sd) (le16_to_cpu((sd)->sd_nlink))
|
||||||
|
#define reiserfs_set_sd_v1_nlink(sd,n) ((sd)->sd_nlink = cpu_to_le16((n)))
|
||||||
|
#define reiserfs_sd_v1_uid(sd) (le16_to_cpu((sd)->sd_uid))
|
||||||
|
#define reiserfs_set_sd_v1_uid(sd,n) ((sd)->sd_uid = cpu_to_le16((n)))
|
||||||
|
#define reiserfs_sd_v1_gid(sd) (le16_to_cpu((sd)->sd_gid))
|
||||||
|
#define reiserfs_set_sd_v1_gid(sd,n) ((sd)->sd_gid = cpu_to_le16((n)))
|
||||||
|
#define reiserfs_sd_v1_size(sd) (le32_to_cpu((sd)->sd_size))
|
||||||
|
#define reiserfs_set_sd_v1_size(sd,n) ((sd)->sd_size = cpu_to_le32((n)))
|
||||||
|
#define reiserfs_sd_v1_atime(sd) (le32_to_cpu((sd)->sd_atime))
|
||||||
|
#define reiserfs_set_sd_v1_atime(sd,n) ((sd)->sd_atime = cpu_to_le32((n)))
|
||||||
|
#define reiserfs_sd_v1_mtime(sd) (le32_to_cpu((sd)->sd_mtime))
|
||||||
|
#define reiserfs_set_sd_v1_mtime(sd,n) ((sd)->sd_mtime = cpu_to_le32((n)))
|
||||||
|
#define reiserfs_sd_v1_ctime(sd) (le32_to_cpu((sd)->sd_ctime))
|
||||||
|
#define reiserfs_set_sd_v1_ctime(sd,n) ((sd)->sd_ctime = cpu_to_le32((n)))
|
||||||
|
#define reiserfs_sd_v1_blocks(sd) (le32_to_cpu((sd)->u.sd_blocks))
|
||||||
|
#define reiserfs_set_sd_v1_blocks(sd,n) ((sd)->u.sd_blocks = cpu_to_le32((n)))
|
||||||
|
#define reiserfs_sd_v1_rdev(sd) (le32_to_cpu((sd)->u.sd_rdev))
|
||||||
|
#define reiserfs_set_sd_v1_rdev(sd,n) ((sd)->u.sd_rdev = cpu_to_le32((n)))
|
||||||
|
#define reiserfs_sd_v1_fdb(sd) (le32_to_cpu((sd)->sd_fdb))
|
||||||
|
#define reiserfs_set_sd_v1_fdb(sd,n) ((sd)->sd_fdb = cpu_to_le32((n)))
|
||||||
|
|
||||||
|
/* reiserfs_sd_t */
|
||||||
|
#define reiserfs_sd_v2_mode(sd) (le16_to_cpu((sd)->sd_mode))
|
||||||
|
#define reiserfs_set_sd_v2_mode(sd,n) ((sd)->sd_mode = cpu_to_le16((n)))
|
||||||
|
#define reiserfs_sd_v2_attrs(sd) (le16_to_cpu((sd)->sd_attrs))
|
||||||
|
#define reiserfs_set_sd_v2_attrs(sd,n) ((sd)->sd_attrs = cpu_to_le16((n)))
|
||||||
|
#define reiserfs_sd_v2_nlink(sd) (le32_to_cpu((sd)->sd_nlink))
|
||||||
|
#define reiserfs_set_sd_v2_nlink(sd,n) ((sd)->sd_nlink = cpu_to_le32((n)))
|
||||||
|
#define reiserfs_sd_v2_size(sd) (le64_to_cpu((sd)->sd_size))
|
||||||
|
#define reiserfs_set_sd_v2_size(sd,n) ((sd)->sd_size = cpu_to_le64((n)))
|
||||||
|
#define reiserfs_sd_v2_uid(sd) (le32_to_cpu((sd)->sd_uid))
|
||||||
|
#define reiserfs_set_sd_v2_uid(sd,n) ((sd)->sd_uid = cpu_to_le32((n)))
|
||||||
|
#define reiserfs_sd_v2_gid(sd) (le32_to_cpu((sd)->sd_gid))
|
||||||
|
#define reiserfs_set_sd_v2_gid(sd,n) ((sd)->sd_gid = cpu_to_le32((n)))
|
||||||
|
#define reiserfs_sd_v2_atime(sd) (le32_to_cpu((sd)->sd_atime))
|
||||||
|
#define reiserfs_set_sd_v2_atime(sd,n) ((sd)->sd_atime = cpu_to_le32((n)))
|
||||||
|
#define reiserfs_sd_v2_mtime(sd) (le32_to_cpu((sd)->sd_mtime))
|
||||||
|
#define reiserfs_set_sd_v2_mtime(sd,n) ((sd)->sd_mtime = cpu_to_le32((n)))
|
||||||
|
#define reiserfs_sd_v2_ctime(sd) (le32_to_cpu((sd)->sd_ctime))
|
||||||
|
#define reiserfs_set_sd_v2_ctime(sd,n) ((sd)->sd_ctime = cpu_to_le32((n)))
|
||||||
|
#define reiserfs_sd_v2_blocks(sd) (le32_to_cpu((sd)->sd_blocks))
|
||||||
|
#define reiserfs_set_sd_v2_blocks(sd,n) ((sd)->sd_blocks = cpu_to_le32((n)))
|
||||||
|
#define reiserfs_sd_v2_rdev(sd) (le32_to_cpu((sd)->u.sd_rdev))
|
||||||
|
#define reiserfs_set_sd_v2_rdev(sd,n) ((sd)->u.sd_rdev = cpu_to_le32((n)))
|
||||||
|
|
||||||
|
extern void reiserfs_stat_init (int blocksize, int key_format,
|
||||||
|
__u32 dirid, __u32 objectid,
|
||||||
|
reiserfs_ih_t * ih, void * sd);
|
||||||
|
|
||||||
|
extern void reiserfs_stat_set (int field, reiserfs_ih_t * ih,
|
||||||
|
void * sd, void * value);
|
||||||
|
|
||||||
|
extern void reiserfs_stat_get (int field, reiserfs_ih_t * ih,
|
||||||
|
void * sd, void * value);
|
||||||
|
|
||||||
|
/* access to stat data fields */
|
||||||
|
#define STAT_MODE 0
|
||||||
|
#define STAT_SIZE 1
|
||||||
|
#define STAT_NLINK 2
|
||||||
|
#define STAT_BLOCKS 3
|
||||||
|
#define STAT_FDB 4
|
||||||
|
|
||||||
|
#define reiserfs_stat_get_mode(ih, sd, pmode) \
|
||||||
|
reiserfs_stat_get(STAT_MODE, ih, sd, pmode)
|
||||||
|
#define reiserfs_stat_set_mode(ih, sd, pmode) \
|
||||||
|
reiserfs_stat_set(STAT_MODE, ih, sd, pmode)
|
||||||
|
|
||||||
|
#define reiserfs_stat_get_size(ih, sd, psize) \
|
||||||
|
reiserfs_stat_get(STAT_SIZE, ih, sd, psize)
|
||||||
|
#define reiserfs_stat_set_size(ih, sd, psize) \
|
||||||
|
reiserfs_stat_set(STAT_SIZE, ih, sd, psize)
|
||||||
|
|
||||||
|
#define reiserfs_stat_get_blocks(ih, sd, pblocks) \
|
||||||
|
reiserfs_stat_get(STAT_BLOCKS, ih, sd, pblocks)
|
||||||
|
|
||||||
|
#define reiserfs_stat_set_blocks(ih, sd, pblocks) \
|
||||||
|
reiserfs_stat_set(STAT_BLOCKS, ih, sd, pblocks)
|
||||||
|
|
||||||
|
#define reiserfs_stat_get_nlink(ih, sd, pnlink) \
|
||||||
|
reiserfs_stat_get(STAT_NLINK, ih, sd, pnlink)
|
||||||
|
|
||||||
|
#define reiserfs_stat_set_nlink(ih, sd, pnlink) \
|
||||||
|
reiserfs_stat_set(STAT_NLINK, ih, sd, pnlink)
|
||||||
|
|
||||||
|
#define reiserfs_stat_get_fdb(ih, sd, pfdb) \
|
||||||
|
reiserfs_stat_get(STAT_FDB, ih, sd, pfdb)
|
||||||
|
|
||||||
|
#define reiserfs_stat_set_fdb(ih, sd, pfdb) \
|
||||||
|
reiserfs_stat_set(STAT_FDB, ih, sd, pfdb)
|
||||||
|
|
||||||
|
|
||||||
|
extern int reiserfs_print_stat_data (FILE * fp,
|
||||||
|
reiserfs_bh_t * bh,
|
||||||
|
reiserfs_ih_t * ih,
|
||||||
|
int alltimes);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_SUPER_H
|
||||||
|
#define REISERFS_SUPER_H
|
||||||
|
|
||||||
|
#define REISERFS_SB_SIZE_V1 (sizeof(reiserfs_sb_v1_t)) /* 76 bytes */
|
||||||
|
|
||||||
|
#define reiserfs_sb_jp(sb) (&((sb)->s_v1.sb_journal))
|
||||||
|
|
||||||
|
/* values for sb_version field of struct reiserfs_super_block. sb_version is
|
||||||
|
only reliable on filesystem with non-standard journal */
|
||||||
|
#define REISERFS_FORMAT_3_5 0
|
||||||
|
#define REISERFS_FORMAT_3_6 2
|
||||||
|
#define REISERFS_FORMAT_UNKNOWN -1
|
||||||
|
|
||||||
|
|
||||||
|
/* values for sb_mount_state field */
|
||||||
|
#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 */
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
reiserfs_attrs_cleared = 0x00000001,
|
||||||
|
} reiserfs_super_block_flags;
|
||||||
|
|
||||||
|
#define REISERFS_SB_SIZE (sizeof(reiserfs_sb_t)) /* 204 bytes */
|
||||||
|
|
||||||
|
/* set/get fields of super block with these defines */
|
||||||
|
#define reiserfs_sb_get_blocks(sb) get_le32 (sb, s_v1.sb_block_count)
|
||||||
|
#define reiserfs_sb_set_blocks(sb,val) set_le32 (sb, s_v1.sb_block_count, val)
|
||||||
|
|
||||||
|
#define reiserfs_sb_get_free(sb) get_le32 (sb, s_v1.sb_free_blocks)
|
||||||
|
#define reiserfs_sb_set_free(sb,val) set_le32 (sb, s_v1.sb_free_blocks, val)
|
||||||
|
|
||||||
|
#define reiserfs_sb_get_root(sb) get_le32 (sb,s_v1.sb_root_block)
|
||||||
|
#define reiserfs_sb_set_root(sb,val) set_le32 (sb, s_v1.sb_root_block, val)
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#define get_sb_mount_id(sb) get_le32 (sb,s_v1.sb_mountid)
|
||||||
|
#define set_sb_mount_id(sb,val) set_le32 (sb, s_v1.sb_mountid, val)
|
||||||
|
|
||||||
|
#define get_sb_journal_magic(sb) get_le32 (sb, s_v1.sb_journal_magic)
|
||||||
|
#define set_sb_journal_magic(sb,val) set_le32 (sb, s_v1.sb_journal_magic, val)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define reiserfs_sb_get_blksize(sb) get_le16 (sb, s_v1.sb_blocksize)
|
||||||
|
#define reiserfs_sb_set_blksize(sb,val) set_le16 (sb, s_v1.sb_blocksize, val)
|
||||||
|
|
||||||
|
#define reiserfs_sb_get_mapmax(sb) get_le16 (sb, s_v1.sb_oid_maxsize)
|
||||||
|
#define reiserfs_sb_set_mapmax(sb,val) set_le16 (sb, s_v1.sb_oid_maxsize, val)
|
||||||
|
|
||||||
|
#define reiserfs_sb_get_mapcur(sb) get_le16 (sb, s_v1.sb_oid_cursize)
|
||||||
|
#define reiserfs_sb_set_mapcur(sb,val) set_le16 (sb, s_v1.sb_oid_cursize, val)
|
||||||
|
|
||||||
|
#define reiserfs_sb_get_umount(sb) get_le16 (sb, s_v1.sb_umount_state)
|
||||||
|
#define reiserfs_sb_set_umount(sb,val) set_le16 (sb, s_v1.sb_umount_state, val)
|
||||||
|
|
||||||
|
#define reiserfs_sb_get_state(sb) get_le16 (sb, s_v1.sb_fs_state)
|
||||||
|
#define reiserfs_sb_set_state(sb,flag) set_le16 (sb, s_v1.sb_fs_state, flag)
|
||||||
|
|
||||||
|
#define reiserfs_sb_get_hash(sb) get_le32 (sb, s_v1.sb_hash_function_code)
|
||||||
|
#define reiserfs_sb_set_hash(sb,val) set_le32 (sb, s_v1.sb_hash_function_code, val)
|
||||||
|
|
||||||
|
#define reiserfs_sb_get_height(sb) get_le16 (sb, s_v1.sb_tree_height)
|
||||||
|
#define reiserfs_sb_set_height(sb,val) set_le16 (sb, s_v1.sb_tree_height, val)
|
||||||
|
|
||||||
|
#define reiserfs_sb_get_bmaps(sb) get_le16 (sb, s_v1.sb_bmap_nr)
|
||||||
|
#define reiserfs_sb_set_bmaps(sb,val) set_le16 (sb, s_v1.sb_bmap_nr, val)
|
||||||
|
|
||||||
|
#define reiserfs_sb_get_version(sb) get_le16 (sb, s_v1.sb_version)
|
||||||
|
#define reiserfs_sb_set_version(sb,val) set_le16 (sb, s_v1.sb_version, val)
|
||||||
|
|
||||||
|
#define reiserfs_sb_get_reserved(sb) \
|
||||||
|
get_le16 (sb, s_v1.sb_reserved_for_journal)
|
||||||
|
#define reiserfs_sb_set_reserved(sb,val) \
|
||||||
|
set_le16 (sb, s_v1.sb_reserved_for_journal, val)
|
||||||
|
|
||||||
|
#define reiserfs_sb_get_gen(sb) get_le32 (sb, sb_inode_generation)
|
||||||
|
#define reiserfs_sb_set_gen(sb,val) set_le32 (sb, sb_inode_generation, val)
|
||||||
|
|
||||||
|
#define reiserfs_sb_get_flags(sb) get_le32 (sb, s_flags)
|
||||||
|
#define reiserfs_sb_set_flags(sb, val) set_le32 (sb, s_flags, val)
|
||||||
|
|
||||||
|
#define reiserfs_sb_isflag(sb, flag) \
|
||||||
|
(get_le32 (sb, s_flags) & flag)
|
||||||
|
#define reiserfs_sb_mkflag(sb, flag) \
|
||||||
|
set_le32 (sb, s_flags, get_le32 (sb, s_flags) | flag)
|
||||||
|
#define reiserfs_sb_clflag(sb, flag) \
|
||||||
|
set_le32 (sb, s_flags, get_le32 (sb, s_flags) & ~(flag))
|
||||||
|
|
||||||
|
/* 0 does not guarantee that fs is consistent */
|
||||||
|
#define reiserfs_sb_state_ok(fs) \
|
||||||
|
((reiserfs_sb_get_umount (fs->fs_ondisk_sb) == FS_CLEANLY_UMOUNTED) && \
|
||||||
|
(reiserfs_sb_get_state (fs->fs_ondisk_sb) == FS_CONSISTENT))
|
||||||
|
|
||||||
|
|
||||||
|
/* prejournalled reiserfs had signature in the other place in super block */
|
||||||
|
#define REISERFS_SUPER_MAGIC_STRING_OFFSET_NJ 20
|
||||||
|
|
||||||
|
/* f_type of struct statfs will be set at this value by statfs(2) */
|
||||||
|
#define REISERFS_SUPER_MAGIC 0x52654973
|
||||||
|
|
||||||
|
/* various reiserfs signatures. We have 3 so far. ReIsErFs for 3.5 format with
|
||||||
|
standard journal, ReIsEr2Fs for 3.6 (or converted 3.5) and ReIsEr3Fs for
|
||||||
|
filesystem with non-standard journal (formats are distinguished by
|
||||||
|
sb_version in that case). Those signatures should be looked for at the
|
||||||
|
64-th and at the 8-th 1k block of the device */
|
||||||
|
#define REISERFS_3_5_SUPER_MAGIC_STRING "ReIsErFs"
|
||||||
|
#define REISERFS_3_6_SUPER_MAGIC_STRING "ReIsEr2Fs"
|
||||||
|
#define REISERFS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" /* JR stands for Journal
|
||||||
|
Relocation */
|
||||||
|
|
||||||
|
/* these are possible values for sb_fs_state */
|
||||||
|
enum reiserfs_state_flags {
|
||||||
|
/* this is set by mkreiserfs and by reiserfsck */
|
||||||
|
FS_CONSISTENT = 0x0,
|
||||||
|
/* this is set by the kernel when fsck is wanted. */
|
||||||
|
FS_ERROR = 0x1,
|
||||||
|
/* this is set by fsck when fatal corruption is found */
|
||||||
|
FS_FATAL = 0x2,
|
||||||
|
/* this is set by kernel when io error occures */
|
||||||
|
/* IO_ERROR = 0x4, */
|
||||||
|
|
||||||
|
FS_STATE_LAST = 0x5
|
||||||
|
};
|
||||||
|
|
||||||
|
extern int reiserfs_super_35_magic (reiserfs_sb_t * rs);
|
||||||
|
|
||||||
|
extern int reiserfs_super_36_magic (reiserfs_sb_t * rs);
|
||||||
|
|
||||||
|
extern int reiserfs_super_jr_magic (reiserfs_sb_t * rs);
|
||||||
|
|
||||||
|
extern int reiserfs_super_magic (reiserfs_sb_t * rs);
|
||||||
|
|
||||||
|
extern int reiserfs_super_format (reiserfs_sb_t * sb);
|
||||||
|
|
||||||
|
extern int reiserfs_super_size (reiserfs_sb_t * rs);
|
||||||
|
|
||||||
|
extern int reiserfs_super_prejournaled (reiserfs_sb_t * rs);
|
||||||
|
|
||||||
|
extern void reiserfs_super_print_state (FILE * fp,
|
||||||
|
reiserfs_filsys_t * fs);
|
||||||
|
|
||||||
|
extern int reiserfs_super_print (FILE * fp,
|
||||||
|
reiserfs_filsys_t *,
|
||||||
|
char * file_name,
|
||||||
|
reiserfs_bh_t * bh,
|
||||||
|
int short_print);
|
||||||
|
|
||||||
|
extern int reiserfs_super_valid(reiserfs_bh_t *bh);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,160 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_TREE_H
|
||||||
|
#define REISERFS_TREE_H
|
||||||
|
|
||||||
|
#include <reiserfs/types.h>
|
||||||
|
|
||||||
|
/* Search_by_key fills up the path from the root to the leaf as it
|
||||||
|
descends the tree looking for the key. It uses reiserfs_buffer_read to
|
||||||
|
try to find buffers in the cache given their block number. If it
|
||||||
|
does not find them in the cache it reads them from disk. For each
|
||||||
|
node reiserfs_tree_search_item finds using reiserfs_buffer_read it then uses
|
||||||
|
bin_search to look through that node. bin_search will find the
|
||||||
|
position of the block_number of the next node if it is looking
|
||||||
|
through an internal node. If it is looking through a leaf node
|
||||||
|
bin_search will find the position of the item which has key either
|
||||||
|
equal to given key, or which is the maximal key less than the given
|
||||||
|
key. */
|
||||||
|
|
||||||
|
|
||||||
|
#define REISERFS_PATH_INIT(var) \
|
||||||
|
reiserfs_path_t var = {REISERFS_PATH_OFFILL, }
|
||||||
|
|
||||||
|
/* Get path element by path and path position. */
|
||||||
|
#define REISERFS_PATH_ELEM(p_s_path,nr_elem) \
|
||||||
|
((p_s_path)->path_elements + (nr_elem))
|
||||||
|
|
||||||
|
/* Get buffer header at the path by path and path position. */
|
||||||
|
#define REISERFS_PATH_BUFFER(p_s_path,nr_elem) \
|
||||||
|
(REISERFS_PATH_ELEM(p_s_path, nr_elem)->pe_buffer)
|
||||||
|
|
||||||
|
/* Get position in the element at the path by path and path position. */
|
||||||
|
#define REISERFS_PATH_POS(p_s_path,nr_elem) \
|
||||||
|
(REISERFS_PATH_ELEM(p_s_path, nr_elem)->pe_position)
|
||||||
|
|
||||||
|
#define REISERFS_PATH_LEAF(p_s_path) \
|
||||||
|
(REISERFS_PATH_BUFFER((p_s_path), (p_s_path)->path_length))
|
||||||
|
|
||||||
|
#define REISERFS_PATH_LEAF_POS(p_s_path) \
|
||||||
|
(REISERFS_PATH_POS((p_s_path), (p_s_path)->path_length))
|
||||||
|
|
||||||
|
#define REISERFS_PATH_IH(p_s_path) \
|
||||||
|
reiserfs_ih_at(REISERFS_PATH_LEAF(p_s_path), \
|
||||||
|
REISERFS_PATH_LEAF_POS(p_s_path))
|
||||||
|
|
||||||
|
/* in reiserfs_tb_balance leaf has h == 0 in contrast with path structure,
|
||||||
|
where root has level == 0. That is why we need these defines */
|
||||||
|
#define REISERFS_PATH_UPBUFFER(p_s_path, h) \
|
||||||
|
(REISERFS_PATH_BUFFER (p_s_path, p_s_path->path_length - (h)))
|
||||||
|
|
||||||
|
/* tb->F[h] or tb->S[0]->b_parent */
|
||||||
|
#define REISERFS_PATH_UPPARENT(path, h) \
|
||||||
|
REISERFS_PATH_UPBUFFER (path, (h) + 1)
|
||||||
|
|
||||||
|
#define REISERFS_PATH_UPPOS(path, h) \
|
||||||
|
REISERFS_PATH_POS (path, path->path_length - (h))
|
||||||
|
|
||||||
|
/* tb->S[h]->b_item_order */
|
||||||
|
#define REISERFS_PATH_UPPARENT_POS(path, h) \
|
||||||
|
REISERFS_PATH_UPPOS(path, h + 1)
|
||||||
|
|
||||||
|
#define REISERFS_PATH_LEVEL(p_s_path, n_h) \
|
||||||
|
((p_s_path)->path_length - (n_h))
|
||||||
|
|
||||||
|
#define REISERFS_PATH_ITEM(path) \
|
||||||
|
((void *) reiserfs_item_at(REISERFS_PATH_LEAF(path), \
|
||||||
|
REISERFS_PATH_LEAF_POS (path)))
|
||||||
|
|
||||||
|
extern int reiserfs_tree_search_entry (reiserfs_filsys_t *fs,
|
||||||
|
const reiserfs_key_t * key,
|
||||||
|
reiserfs_path_t * path);
|
||||||
|
|
||||||
|
extern int reiserfs_tree_search_position (reiserfs_filsys_t *fs,
|
||||||
|
const reiserfs_key_t * key,
|
||||||
|
reiserfs_path_t * path);
|
||||||
|
|
||||||
|
extern const reiserfs_key_t * reiserfs_tree_lkey (reiserfs_path_t * path,
|
||||||
|
reiserfs_filsys_t *fs);
|
||||||
|
|
||||||
|
extern const reiserfs_key_t * reiserfs_tree_rkey (reiserfs_path_t * path,
|
||||||
|
reiserfs_filsys_t *fs);
|
||||||
|
|
||||||
|
extern const reiserfs_key_t *reiserfs_tree_next_key (reiserfs_path_t * path,
|
||||||
|
reiserfs_filsys_t *fs);
|
||||||
|
|
||||||
|
extern int reiserfs_tree_delete_entry (reiserfs_filsys_t *,
|
||||||
|
reiserfs_key_t *);
|
||||||
|
|
||||||
|
extern void reiserfs_tree_delete (reiserfs_filsys_t *,
|
||||||
|
reiserfs_path_t *, int);
|
||||||
|
|
||||||
|
extern void reiserfs_tree_delete_unit (reiserfs_filsys_t *,
|
||||||
|
reiserfs_path_t *, int);
|
||||||
|
|
||||||
|
extern void reiserfs_tree_insert_unit (reiserfs_filsys_t *,
|
||||||
|
reiserfs_path_t * path,
|
||||||
|
const void * body,
|
||||||
|
int size);
|
||||||
|
|
||||||
|
extern void reiserfs_tree_insert (reiserfs_filsys_t *,
|
||||||
|
reiserfs_path_t * ,
|
||||||
|
reiserfs_ih_t *,
|
||||||
|
const void *);
|
||||||
|
|
||||||
|
extern int reiserfs_tree_search_name (reiserfs_filsys_t *,
|
||||||
|
const reiserfs_key_t * dir,
|
||||||
|
char * name,
|
||||||
|
unsigned int * min_gen_counter,
|
||||||
|
reiserfs_key_t * key);
|
||||||
|
|
||||||
|
extern int reiserfs_tree_search_body (reiserfs_filsys_t * fs,
|
||||||
|
const reiserfs_key_t * key,
|
||||||
|
reiserfs_path_t * path);
|
||||||
|
|
||||||
|
extern int reiserfs_tree_search_item (reiserfs_filsys_t * fs,
|
||||||
|
const reiserfs_key_t * key,
|
||||||
|
reiserfs_path_t * path);
|
||||||
|
|
||||||
|
extern int reiserfs_tree_scan_name (reiserfs_filsys_t *,
|
||||||
|
reiserfs_key_t * dir,
|
||||||
|
char * name,
|
||||||
|
reiserfs_path_t * path);
|
||||||
|
|
||||||
|
extern int reiserfs_tree_insert_entry (reiserfs_filsys_t *,
|
||||||
|
const reiserfs_key_t * dir,
|
||||||
|
char * name,
|
||||||
|
int name_len,
|
||||||
|
const reiserfs_key_t * key,
|
||||||
|
__u16 fsck_need);
|
||||||
|
|
||||||
|
typedef void (*item_modify_t) (reiserfs_ih_t *, void *item);
|
||||||
|
|
||||||
|
extern __u16 reiserfs_tree_root (reiserfs_filsys_t * fs,
|
||||||
|
item_modify_t modify,
|
||||||
|
__u16 ih_flags);
|
||||||
|
|
||||||
|
extern int reiserfs_tree_create_stat (reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_path_t * path,
|
||||||
|
const reiserfs_key_t * key,
|
||||||
|
item_modify_t modify);
|
||||||
|
|
||||||
|
extern void reiserfs_tree_pathrelse (reiserfs_path_t * p_s_search_path);
|
||||||
|
|
||||||
|
extern int reiserfs_tree_left_mergeable (reiserfs_filsys_t * s,
|
||||||
|
reiserfs_path_t * path);
|
||||||
|
|
||||||
|
extern int reiserfs_tree_right_mergeable (reiserfs_filsys_t * s,
|
||||||
|
reiserfs_path_t * path);
|
||||||
|
|
||||||
|
extern int reiserfs_tree_node_mergeable (reiserfs_bh_t *left,
|
||||||
|
reiserfs_bh_t *right);
|
||||||
|
|
||||||
|
extern int reiserfs_tree_merge(reiserfs_filsys_t *fs,
|
||||||
|
reiserfs_path_t *dst_path,
|
||||||
|
reiserfs_path_t *src_path);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,202 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_TB_H
|
||||||
|
#define REISERFS_TB_H
|
||||||
|
|
||||||
|
/* This temporary structure is used in tree balance algorithms, and
|
||||||
|
constructed as we go to the extent that its various parts are needed. It
|
||||||
|
contains arrays of nodes that can potentially be involved in the balancing
|
||||||
|
of node S, and parameters that define how each of the nodes must be
|
||||||
|
balanced. Note that in these algorithms for balancing the worst case is to
|
||||||
|
need to balance the current node S and the left and right neighbors and all
|
||||||
|
of their parents plus create a new node. We implement S1 balancing for the
|
||||||
|
leaf nodes and S0 balancing for the internal nodes (S1 and S0 are defined
|
||||||
|
in our papers.)*/
|
||||||
|
|
||||||
|
/* size of the array of buffers to free at end of reiserfs_tb_balance */
|
||||||
|
#define TB_2FREE_MAX 7
|
||||||
|
|
||||||
|
#define TB_FEB_MAX (REISERFS_TREE_HEIGHT_MAX + 1)
|
||||||
|
|
||||||
|
/* someday somebody will prefix every field in this struct with tb_ */
|
||||||
|
struct reiserfs_tb {
|
||||||
|
reiserfs_filsys_t * tb_fs;
|
||||||
|
|
||||||
|
reiserfs_path_t * tb_path;
|
||||||
|
|
||||||
|
/* array of left neighbors of nodes in the path */
|
||||||
|
reiserfs_bh_t * L[REISERFS_TREE_HEIGHT_MAX];
|
||||||
|
|
||||||
|
/* array of right neighbors of nodes in the path*/
|
||||||
|
reiserfs_bh_t * R[REISERFS_TREE_HEIGHT_MAX];
|
||||||
|
|
||||||
|
/* array of fathers of the left neighbors */
|
||||||
|
reiserfs_bh_t * FL[REISERFS_TREE_HEIGHT_MAX];
|
||||||
|
|
||||||
|
/* array of fathers of the right neighbors */
|
||||||
|
reiserfs_bh_t * FR[REISERFS_TREE_HEIGHT_MAX];
|
||||||
|
|
||||||
|
/* array of common parents of center node and its left neighbor */
|
||||||
|
reiserfs_bh_t * CFL[REISERFS_TREE_HEIGHT_MAX];
|
||||||
|
|
||||||
|
/* array of common parents of center node and its right neighbor */
|
||||||
|
reiserfs_bh_t * CFR[REISERFS_TREE_HEIGHT_MAX];
|
||||||
|
|
||||||
|
/* array of blocknr's that are free and are the nearest to the left
|
||||||
|
node that are usable for writing dirty formatted leaves, using
|
||||||
|
the write_next_to algorithm. */
|
||||||
|
|
||||||
|
/*unsigned long free_and_near[MAX_DIRTIABLE];*/
|
||||||
|
|
||||||
|
/* array of empty buffers. Number of buffers in array equals cur_blknum. */
|
||||||
|
reiserfs_bh_t * FEB[TB_FEB_MAX];
|
||||||
|
|
||||||
|
reiserfs_bh_t * used[TB_FEB_MAX];
|
||||||
|
|
||||||
|
/* array of number of items which must be shifted to the left in order to
|
||||||
|
balance the current node; for leaves includes item that will be partially
|
||||||
|
shifted; for internal nodes, it is the number of child pointers rather
|
||||||
|
than items. It includes the new item being created. For preserve_shifted
|
||||||
|
purposes the code sometimes subtracts one from this number to get the
|
||||||
|
number of currently existing items being shifted, and even more often
|
||||||
|
for leaves it subtracts one to get the number of wholly shifted items
|
||||||
|
for other purposes. */
|
||||||
|
short int lnum[REISERFS_TREE_HEIGHT_MAX];
|
||||||
|
|
||||||
|
/* substitute right for left in comment above */
|
||||||
|
short int rnum[REISERFS_TREE_HEIGHT_MAX];
|
||||||
|
|
||||||
|
/* array indexed by height h mapping the key delimiting L[h] and
|
||||||
|
S[h] to its item number within the node CFL[h] */
|
||||||
|
short int lkey[REISERFS_TREE_HEIGHT_MAX];
|
||||||
|
|
||||||
|
/* substitute r for l in comment above */
|
||||||
|
short int rkey[REISERFS_TREE_HEIGHT_MAX];
|
||||||
|
|
||||||
|
/* the number of bytes by we are trying to add or remove from S[h].
|
||||||
|
A negative value means removing. */
|
||||||
|
short int insert_size[REISERFS_TREE_HEIGHT_MAX];
|
||||||
|
|
||||||
|
/* number of nodes that will replace node S[h] after balancing on the level
|
||||||
|
h of the tree. If 0 then S is being deleted, if 1 then S is remaining
|
||||||
|
and no new nodes are being created, if 2 or 3 then 1 or 2 new nodes is
|
||||||
|
being created */
|
||||||
|
short int blknum[REISERFS_TREE_HEIGHT_MAX];
|
||||||
|
|
||||||
|
/* fields that are used only for balancing leaves of the tree */
|
||||||
|
|
||||||
|
/* number of empty blocks having been already allocated */
|
||||||
|
short int cur_blknum;
|
||||||
|
|
||||||
|
/* number of items that fall into left most node when S[0] splits */
|
||||||
|
short int s0num;
|
||||||
|
|
||||||
|
/* number of items that fall into first new node when S[0] splits */
|
||||||
|
short int s1num;
|
||||||
|
|
||||||
|
/* number of items that fall into second new node when S[0] splits */
|
||||||
|
short int s2num;
|
||||||
|
|
||||||
|
/* number of bytes which can flow to the left neighbor from the left */
|
||||||
|
short int lbytes;
|
||||||
|
|
||||||
|
/* most liquid item that cannot be shifted from S[0] entirely
|
||||||
|
if -1 then nothing will be partially shifted */
|
||||||
|
|
||||||
|
/* number of bytes which will flow to the right neighbor from the right */
|
||||||
|
short int rbytes;
|
||||||
|
|
||||||
|
/* number of bytes which flow to the first new node when S[0] splits
|
||||||
|
note: if S[0] splits into 3 nodes, then items do not need to be cut */
|
||||||
|
short int s1bytes;
|
||||||
|
short int s2bytes;
|
||||||
|
|
||||||
|
/* buffers which are to be freed after reiserfs_tb_balance finishes
|
||||||
|
by reiserfs_unfix_nodes */
|
||||||
|
reiserfs_bh_t * buf_to_free[TB_2FREE_MAX];
|
||||||
|
|
||||||
|
/* kmalloced memory. Used to create virtual node and keep map of dirtied
|
||||||
|
bitmap blocks */
|
||||||
|
char * vn_buf;
|
||||||
|
|
||||||
|
/* size of the vn_buf */
|
||||||
|
int vn_buf_size;
|
||||||
|
|
||||||
|
/* VN starts after bitmap of bitmap blocks */
|
||||||
|
struct reiserfs_virtual_node * tb_vn;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct reiserfs_tb reiserfs_tb_t;
|
||||||
|
|
||||||
|
enum tb_return {
|
||||||
|
CARRY_ON = 0x0,
|
||||||
|
NO_DISK_SPACE = 0x3,
|
||||||
|
IO_ERROR = 0x4,
|
||||||
|
NO_BALANCING_NEEDED = 0x5,
|
||||||
|
ITEM_FOUND = 0x6,
|
||||||
|
ITEM_NOT_FOUND = 0x7,
|
||||||
|
POSITION_FOUND = 0x8,
|
||||||
|
POSITION_NOT_FOUND = 0x9,
|
||||||
|
GOTO_PREVIOUS_ITEM = 0xa,
|
||||||
|
POSITION_FOUND_INVISIBLE= 0xb,
|
||||||
|
FILE_NOT_FOUND = 0xc,
|
||||||
|
DIRECTORY_NOT_FOUND = 0xd,
|
||||||
|
DIRECTORY_FOUND = 0xf,
|
||||||
|
LAST_SEARCH
|
||||||
|
};
|
||||||
|
|
||||||
|
/* These are modes of balancing */
|
||||||
|
|
||||||
|
/* When inserting an item. */
|
||||||
|
#define M_INSERT 'i'
|
||||||
|
/* When inserting into (directories only) or appending onto an already
|
||||||
|
existant item. */
|
||||||
|
#define M_PASTE 'p'
|
||||||
|
/* When deleting an item. */
|
||||||
|
#define M_DELETE 'd'
|
||||||
|
/* When truncating an item or removing an entry from a (directory) item. */
|
||||||
|
#define M_CUT 'c'
|
||||||
|
|
||||||
|
/* used when balancing on leaf level skipped (in reiserfsck) */
|
||||||
|
#define M_INTERNAL 'n'
|
||||||
|
|
||||||
|
#define FIRST_TO_LAST 0
|
||||||
|
#define LAST_TO_FIRST 1
|
||||||
|
|
||||||
|
/* used in reiserfs_tb_balance for passing parent of node information that
|
||||||
|
has been gotten from tb struct */
|
||||||
|
struct reiserfs_bufinfo {
|
||||||
|
reiserfs_bh_t * bi_bh;
|
||||||
|
reiserfs_bh_t * bi_parent;
|
||||||
|
int bi_position;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct reiserfs_bufinfo reiserfs_bufinfo_t;
|
||||||
|
|
||||||
|
|
||||||
|
extern void reiserfs_tb_attach_new (reiserfs_bufinfo_t * bi);
|
||||||
|
|
||||||
|
extern reiserfs_bh_t * reiserfs_tb_FEB (reiserfs_tb_t *tb);
|
||||||
|
|
||||||
|
extern int reiserfs_tb_lpos (reiserfs_tb_t * tb, int h);
|
||||||
|
|
||||||
|
extern int reiserfs_tb_rpos (reiserfs_tb_t * tb, int h);
|
||||||
|
|
||||||
|
extern void reiserfs_tb_balance (reiserfs_tb_t * tb,
|
||||||
|
reiserfs_ih_t * ih,
|
||||||
|
const char * body,
|
||||||
|
int flag,
|
||||||
|
int zeros_num);
|
||||||
|
|
||||||
|
extern void reiserfs_tb_init (reiserfs_tb_t * tb,
|
||||||
|
reiserfs_filsys_t *,
|
||||||
|
reiserfs_path_t * path,
|
||||||
|
int size);
|
||||||
|
|
||||||
|
extern void reiserfs_tb_print_path (reiserfs_tb_t * tb,
|
||||||
|
reiserfs_path_t * path);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,297 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REISERFS_TYPES_H
|
||||||
|
#define REISERFS_TYPES_H
|
||||||
|
|
||||||
|
#include "misc/types.h"
|
||||||
|
#include "misc/swab.h"
|
||||||
|
|
||||||
|
struct reiserfs_bitmap {
|
||||||
|
unsigned long bm_byte_size;
|
||||||
|
unsigned long bm_bit_size;
|
||||||
|
char * bm_map;
|
||||||
|
unsigned long bm_set_bits;
|
||||||
|
int bm_dirty; /* used for fetched bitmap */
|
||||||
|
unsigned long bm_first_zero;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct reiserfs_bitmap reiserfs_bitmap_t;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct reiserfs_bh reiserfs_bh_t;
|
||||||
|
|
||||||
|
struct reiserfs_bh {
|
||||||
|
unsigned long b_blocknr;
|
||||||
|
int b_dev;
|
||||||
|
unsigned long b_size;
|
||||||
|
char * b_data;
|
||||||
|
unsigned long b_state;
|
||||||
|
unsigned int b_count;
|
||||||
|
unsigned int b_list ;
|
||||||
|
void (*b_start_io) (unsigned long);
|
||||||
|
void (*b_end_io)(reiserfs_bh_t *bh, int uptodate);
|
||||||
|
|
||||||
|
reiserfs_bh_t * b_next;
|
||||||
|
reiserfs_bh_t * b_prev;
|
||||||
|
reiserfs_bh_t * b_hash_next;
|
||||||
|
reiserfs_bh_t * b_hash_prev;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* magic string to find desc blocks in the journal */
|
||||||
|
#define JOURNAL_DESC_MAGIC "ReIsErLB"
|
||||||
|
|
||||||
|
struct reiserfs_journal_param {
|
||||||
|
/* where does journal start from on its device */
|
||||||
|
__u32 jp_start;
|
||||||
|
/* journal device st_rdev */
|
||||||
|
__u32 jp_dev;
|
||||||
|
/* size of the journal on FS creation. used to make sure
|
||||||
|
they don't overflow it */
|
||||||
|
__u32 jp_size;
|
||||||
|
/* max number of blocks in a transaction. */
|
||||||
|
__u32 jp_tlen;
|
||||||
|
/* random value made on fs creation (this was sb_journal_block_count) */
|
||||||
|
__u32 jp_magic;
|
||||||
|
/* max number of blocks to batch into a trans */
|
||||||
|
__u32 jp_max_batch;
|
||||||
|
/* in seconds, how old can an async commit be */
|
||||||
|
__u32 jp_commit_age;
|
||||||
|
/* in seconds, how old can a transaction be */
|
||||||
|
__u32 jp_trans_age;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct reiserfs_journal_param reiserfs_journal_param_t;
|
||||||
|
|
||||||
|
/* this header block gets written whenever a transaction is considered fully
|
||||||
|
** flushed, and is more recent than the last fully flushed transaction. fully
|
||||||
|
** flushed means all the log blocks and all the real blocks are on disk, and
|
||||||
|
** this transaction does not need to be replayed. */
|
||||||
|
struct reiserfs_journal_header {
|
||||||
|
/* id of last fully flushed transaction */
|
||||||
|
__u32 jh_last_flush_trans_id ;
|
||||||
|
/* offset in the log of where to start replay after a crash */
|
||||||
|
__u32 jh_flush_offset ;
|
||||||
|
|
||||||
|
__u32 jh_mount_id ;
|
||||||
|
|
||||||
|
reiserfs_journal_param_t jh_journal;
|
||||||
|
|
||||||
|
/* the mount id of the fs during the last reiserfsck --check. */
|
||||||
|
__u32 jh_last_check_mount_id;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* this is the super from 3.5.X */
|
||||||
|
struct reiserfs_super_block_v1
|
||||||
|
{
|
||||||
|
__u32 sb_block_count; /* 0 number of block on data device */
|
||||||
|
__u32 sb_free_blocks; /* 4 free blocks count */
|
||||||
|
__u32 sb_root_block; /* 8 root of the tree */
|
||||||
|
|
||||||
|
reiserfs_journal_param_t sb_journal; /* 12 */
|
||||||
|
|
||||||
|
__u16 sb_blocksize; /* 44 */
|
||||||
|
__u16 sb_oid_maxsize; /* 46 max size of object id array, see
|
||||||
|
get_objectid() commentary */
|
||||||
|
__u16 sb_oid_cursize; /* 48 current size of object id array */
|
||||||
|
__u16 sb_umount_state; /* 50 this is set to 1 when filesystem was
|
||||||
|
umounted, to 2 - when not */
|
||||||
|
|
||||||
|
char s_magic[10]; /* 52 reiserfs magic string indicates that
|
||||||
|
file system is reiserfs: "ReIsErFs" or
|
||||||
|
"ReIsEr2Fs" or "ReIsEr3Fs" */
|
||||||
|
__u16 sb_fs_state; /* 62 it is set to used by fsck to mark which phase of
|
||||||
|
rebuilding is done (used for fsck debugging) */
|
||||||
|
__u32 sb_hash_function_code;/* 64 code of fuction which was/is/will be
|
||||||
|
used to sort names in a directory. See
|
||||||
|
codes in above */
|
||||||
|
__u16 sb_tree_height; /* 68 height of filesytem tree. Tree
|
||||||
|
consisting of only one root block has 2
|
||||||
|
here */
|
||||||
|
__u16 sb_bmap_nr; /* 70 amount of bitmap blocks needed to
|
||||||
|
address each block of file system */
|
||||||
|
__u16 sb_version; /* 72 this field is only reliable on
|
||||||
|
filesystem with non-standard journal */
|
||||||
|
__u16 sb_reserved_for_journal; /* 74 size in blocks of journal area on
|
||||||
|
main device, we need to keep after
|
||||||
|
non-standard journal relocation */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct reiserfs_super_block_v1 reiserfs_sb_v1_t;
|
||||||
|
|
||||||
|
/* Structure of super block on disk */
|
||||||
|
struct reiserfs_super_block {
|
||||||
|
/* 0 */ reiserfs_sb_v1_t s_v1;
|
||||||
|
/* 76 */ __u32 sb_inode_generation;
|
||||||
|
/* Right now used only by inode-attributes, if enabled */
|
||||||
|
/* 80 */ __u32 s_flags;
|
||||||
|
/* filesystem unique identifier */
|
||||||
|
/* 84 */ unsigned char s_uuid[16];
|
||||||
|
/* filesystem volume label */
|
||||||
|
/*100 */ unsigned char s_label[16];
|
||||||
|
/* zero filled by mkreiserfs and reiserfs_convert_objectid_map_v1()
|
||||||
|
* so any additions must be updated there as well. */
|
||||||
|
/*116 */ char s_unused[88];
|
||||||
|
/*204*/
|
||||||
|
} __attribute__ ((__packed__));;
|
||||||
|
|
||||||
|
typedef struct reiserfs_super_block reiserfs_sb_t;
|
||||||
|
|
||||||
|
typedef __u32 (*hashf_t) (const char *, int);
|
||||||
|
|
||||||
|
typedef struct reiserfs_filsys reiserfs_filsys_t;
|
||||||
|
|
||||||
|
struct reiserfs_filsys {
|
||||||
|
unsigned int fs_blocksize;
|
||||||
|
int fs_format; /* on-disk format version */
|
||||||
|
hashf_t hash; /* pointer to function which is used to sort
|
||||||
|
names in directory. It is set by
|
||||||
|
reiserfs_fs_open if it is set in the super
|
||||||
|
block, otherwise it is set by first
|
||||||
|
reiserfs_hash_correct */
|
||||||
|
|
||||||
|
char fs_file_name[4096]; /* file name of underlying device */
|
||||||
|
int fs_dev; /* descriptor of opened block device file */
|
||||||
|
reiserfs_bh_t * fs_super_bh; /* buffer containing super block */
|
||||||
|
reiserfs_sb_t * fs_ondisk_sb; /* pointer to its b_data */
|
||||||
|
|
||||||
|
|
||||||
|
reiserfs_bitmap_t * fs_bitmap2; /* ondisk bitmap after
|
||||||
|
reiserfs_bitmap_open */
|
||||||
|
|
||||||
|
|
||||||
|
/* opened journal fields */
|
||||||
|
char fs_j_file_name[4096]; /* file name of relocated journal device */
|
||||||
|
int fs_journal_dev; /* descriptor of opened journal device */
|
||||||
|
reiserfs_bh_t * fs_jh_bh; /* buffer containing journal header */
|
||||||
|
|
||||||
|
/* badblocks */
|
||||||
|
reiserfs_bitmap_t * fs_badblocks_bm;
|
||||||
|
|
||||||
|
int fs_dirt;
|
||||||
|
int fs_flags;
|
||||||
|
void * fs_vp;
|
||||||
|
int (*block_allocator) (reiserfs_filsys_t * fs,
|
||||||
|
unsigned long * free_blocknrs,
|
||||||
|
unsigned long start, int amount_needed);
|
||||||
|
int (*block_deallocator) (reiserfs_filsys_t * fs, unsigned long block);
|
||||||
|
|
||||||
|
__u16 lost_format;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define REISERFS_TREE_HEIGHT_MAX 6
|
||||||
|
#define REISERFS_PATH_OFFINIT 2
|
||||||
|
#define REISERFS_PATH_OFFILL 1
|
||||||
|
#define REISERFS_PATH_MAX (REISERFS_TREE_HEIGHT_MAX + \
|
||||||
|
REISERFS_PATH_OFFINIT)
|
||||||
|
|
||||||
|
struct reiserfs_path_element {
|
||||||
|
/* Pointer to the buffer at the path in the tree. */
|
||||||
|
reiserfs_bh_t * pe_buffer;
|
||||||
|
|
||||||
|
/* Position in the tree node which is placed in the buffer above. */
|
||||||
|
int pe_position;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct reiserfs_path_element reiserfs_path_element_t;
|
||||||
|
|
||||||
|
|
||||||
|
/* We need to keep track of who the ancestors of nodes are. When we
|
||||||
|
perform a search we record which nodes were visited while
|
||||||
|
descending the tree looking for the node we searched for. This list
|
||||||
|
of nodes is called the path. This information is used while
|
||||||
|
performing balancing. Note that this path information may become
|
||||||
|
invalid, and this means we must check it when using it to see if it
|
||||||
|
is still valid. You'll need to read reiserfs_tree_search_item and the
|
||||||
|
comments in it, especially about decrement_counters_in_path(),
|
||||||
|
to understand this structure. */
|
||||||
|
struct reiserfs_path {
|
||||||
|
/* Length of the array above. */
|
||||||
|
unsigned int path_length;
|
||||||
|
|
||||||
|
/* Array of the path elements. */
|
||||||
|
reiserfs_path_element_t path_elements[REISERFS_PATH_MAX];
|
||||||
|
|
||||||
|
int pos_in_item;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct reiserfs_path reiserfs_path_t;
|
||||||
|
|
||||||
|
struct reiserfs_koff_v1 {
|
||||||
|
__u32 k_offset;
|
||||||
|
__u32 k_uniqueness;
|
||||||
|
} __attribute__ ((__packed__));
|
||||||
|
|
||||||
|
struct reiserfs_koff_v2 {
|
||||||
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
|
__u64 k_offset:60;
|
||||||
|
__u64 k_type: 4;
|
||||||
|
#elif __BYTE_ORDER == __BIG_ENDIAN
|
||||||
|
__u64 k_type: 4;
|
||||||
|
__u64 k_offset:60;
|
||||||
|
#else
|
||||||
|
# error "nuxi/pdp-endian archs are not supported"
|
||||||
|
#endif
|
||||||
|
} __attribute__ ((__packed__));
|
||||||
|
|
||||||
|
/* Key of the object determines object's location in the tree,
|
||||||
|
composed of 4 components */
|
||||||
|
struct reiserfs_key {
|
||||||
|
/* packing locality: by default parent directory object id */
|
||||||
|
__u32 k2_dir_id;
|
||||||
|
|
||||||
|
/* object identifier */
|
||||||
|
__u32 k2_objectid;
|
||||||
|
|
||||||
|
union {
|
||||||
|
struct reiserfs_koff_v1 k2_offset_v1;
|
||||||
|
struct reiserfs_koff_v2 k2_offset_v2;
|
||||||
|
} __attribute__ ((__packed__)) u;
|
||||||
|
} __attribute__ ((__packed__));
|
||||||
|
|
||||||
|
typedef struct reiserfs_key reiserfs_key_t;
|
||||||
|
|
||||||
|
/* Everything in the filesystem is stored as a set of items. The item head
|
||||||
|
contains the key of the item, its free space (for extent items) and
|
||||||
|
specifies the location of the item itself within the block. */
|
||||||
|
|
||||||
|
struct reiserfs_ih {
|
||||||
|
reiserfs_key_t ih_key; /* Everything in the tree is found by searching for it
|
||||||
|
based on its key.*/
|
||||||
|
|
||||||
|
union {
|
||||||
|
__u16 ih2_free_space; /* The free space in the last unformatted node
|
||||||
|
of an extent item if this is an extent
|
||||||
|
item. This equals 0xFFFF iff this is a direct
|
||||||
|
item or stat data item. Note that the key, not
|
||||||
|
this field, is used to determine the item
|
||||||
|
type, and thus which field this union
|
||||||
|
contains. */
|
||||||
|
__u16 ih2_entry_count; /* Iff this is a directory item, this field
|
||||||
|
equals the number of directory entries in
|
||||||
|
the directory item. */
|
||||||
|
} __attribute__ ((__packed__)) u;
|
||||||
|
__u16 ih2_item_len; /* total size of the item body */
|
||||||
|
__u16 ih2_item_location; /* an offset to the item body within the
|
||||||
|
block */
|
||||||
|
|
||||||
|
__u16 ih_format; /* key format is stored in bits 0-11 of this item
|
||||||
|
flags are stored in bits 12-15 */
|
||||||
|
#if 0
|
||||||
|
struct {
|
||||||
|
__u16 key_format : 12; /* KEY_FORMAT_1 or KEY_FORMAT_2. This is not
|
||||||
|
necessary, but we have space, let use it */
|
||||||
|
__u16 flags : 4; /* fsck set here its flag (reachable/unreachable) */
|
||||||
|
} __attribute__ ((__packed__)) ih2_format;
|
||||||
|
#endif
|
||||||
|
} __attribute__ ((__packed__));
|
||||||
|
|
||||||
|
typedef struct reiserfs_ih reiserfs_ih_t;
|
||||||
|
|
||||||
|
typedef int (*unfm_func_t) (reiserfs_filsys_t *, __u32);
|
||||||
|
|
||||||
|
#endif
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,407 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
|
||||||
* reiserfsprogs/README
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef REISERFSPROGS_LIB_H
|
|
||||||
#define REISERFSPROGS_LIB_H
|
|
||||||
|
|
||||||
#define BADBLOCK_DIRID 1
|
|
||||||
#define BADBLOCK_OBJID (__u32)-1
|
|
||||||
|
|
||||||
typedef struct reiserfs_filsys reiserfs_filsys_t;
|
|
||||||
|
|
||||||
#include "reiserfs_fs.h"
|
|
||||||
|
|
||||||
struct _bitmap {
|
|
||||||
unsigned long bm_byte_size;
|
|
||||||
unsigned long bm_bit_size;
|
|
||||||
char * bm_map;
|
|
||||||
unsigned long bm_set_bits;
|
|
||||||
int bm_dirty; /* used for fetched bitmap */
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct _bitmap reiserfs_bitmap_t;
|
|
||||||
|
|
||||||
typedef __u32 (*hashf_t) (const char *, int);
|
|
||||||
|
|
||||||
struct reiserfs_filsys {
|
|
||||||
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
|
|
||||||
reiserfs_open if it is set in the super
|
|
||||||
block, otherwise it is set by first
|
|
||||||
is_properly_hashed */
|
|
||||||
|
|
||||||
char * fs_file_name; /* file name of underlying device */
|
|
||||||
int fs_dev; /* descriptor of opened block device file */
|
|
||||||
struct buffer_head * fs_super_bh; /* buffer containing super block */
|
|
||||||
struct reiserfs_super_block * fs_ondisk_sb; /* pointer to its b_data */
|
|
||||||
|
|
||||||
|
|
||||||
reiserfs_bitmap_t * fs_bitmap2; /* ondisk bitmap after
|
|
||||||
reiserfs_open_ondisk_bitmap */
|
|
||||||
|
|
||||||
|
|
||||||
/* opened journal fields */
|
|
||||||
char * fs_j_file_name; /* file name of relocated journal device */
|
|
||||||
int fs_journal_dev; /* descriptor of opened journal device */
|
|
||||||
struct buffer_head * fs_jh_bh; /* buffer containing journal header */
|
|
||||||
|
|
||||||
/* badblocks */
|
|
||||||
reiserfs_bitmap_t * fs_badblocks_bm;
|
|
||||||
|
|
||||||
int fs_dirt;
|
|
||||||
int fs_flags;
|
|
||||||
void * fs_vp;
|
|
||||||
int (*block_allocator) (reiserfs_filsys_t * fs,
|
|
||||||
unsigned long * free_blocknrs,
|
|
||||||
unsigned long start, int amount_needed);
|
|
||||||
int (*block_deallocator) (reiserfs_filsys_t * fs, unsigned long block);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct _transaction {
|
|
||||||
unsigned long mount_id;
|
|
||||||
unsigned long trans_id;
|
|
||||||
unsigned long desc_blocknr;
|
|
||||||
unsigned long trans_len;
|
|
||||||
unsigned long commit_blocknr;
|
|
||||||
unsigned long next_trans_offset;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct _transaction reiserfs_trans_t;
|
|
||||||
|
|
||||||
|
|
||||||
/* reiserfslib.c */
|
|
||||||
|
|
||||||
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, 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 *);
|
|
||||||
void reiserfs_free (reiserfs_filsys_t *);
|
|
||||||
void reiserfs_close (reiserfs_filsys_t *);
|
|
||||||
void reiserfs_reopen (reiserfs_filsys_t *, int flags);
|
|
||||||
int is_opened_rw (reiserfs_filsys_t * fs);
|
|
||||||
|
|
||||||
/*
|
|
||||||
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, 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);
|
|
||||||
|
|
||||||
int reiserfs_new_blocknrs (reiserfs_filsys_t *,
|
|
||||||
unsigned long * free_blocknrs, unsigned long start,
|
|
||||||
int amount_needed);
|
|
||||||
int reiserfs_free_block (reiserfs_filsys_t *, unsigned long block);
|
|
||||||
int spread_bitmaps (reiserfs_filsys_t *);
|
|
||||||
int filesystem_dirty (reiserfs_filsys_t *);
|
|
||||||
void mark_filesystem_dirty (reiserfs_filsys_t *);
|
|
||||||
|
|
||||||
void reiserfs_paste_into_item (reiserfs_filsys_t *, struct path * path,
|
|
||||||
const void * body, int size);
|
|
||||||
void reiserfs_insert_item (reiserfs_filsys_t *, struct path * path,
|
|
||||||
struct item_head * ih, const void * body);
|
|
||||||
|
|
||||||
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,
|
|
||||||
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, __u16 fsck_need);
|
|
||||||
|
|
||||||
struct key * uget_lkey (struct path * path);
|
|
||||||
struct key * uget_rkey (struct path * path);
|
|
||||||
int reiserfs_search_by_key_3 (reiserfs_filsys_t *, struct key * key,
|
|
||||||
struct path * path);
|
|
||||||
int reiserfs_search_by_key_4 (reiserfs_filsys_t *, struct key * key,
|
|
||||||
struct path * path);
|
|
||||||
int reiserfs_search_by_entry_key (reiserfs_filsys_t *, struct key * key,
|
|
||||||
struct path * path);
|
|
||||||
int usearch_by_position (reiserfs_filsys_t *, struct key * key, int version, struct path * path);
|
|
||||||
struct key * reiserfs_next_key (struct path * path);
|
|
||||||
void copy_key (void * to, void * from);
|
|
||||||
void copy_short_key (void * to, void * from);
|
|
||||||
void copy_item_head(void * p_v_to, void * p_v_from);
|
|
||||||
int comp_keys (const void * k1, const void * k2);
|
|
||||||
int comp_keys_3 (const void * k1, const void * k2);
|
|
||||||
int comp_short_keys (const void * p_s_key1, const void * p_s_key2);
|
|
||||||
int comp_items (struct item_head * p_s_ih, struct path * p_s_path);
|
|
||||||
|
|
||||||
__u32 hash_value (hashf_t func, char * name, int namelen);
|
|
||||||
|
|
||||||
int create_dir_sd (reiserfs_filsys_t * fs,
|
|
||||||
struct path * path, struct key * key,
|
|
||||||
void (*modify_item)(struct item_head *, void *));
|
|
||||||
void make_sure_root_dir_exists (reiserfs_filsys_t * fs,
|
|
||||||
void (*modyfy_item)(struct item_head *, void *),
|
|
||||||
int ih_flags);
|
|
||||||
|
|
||||||
typedef void (*badblock_func_t) (reiserfs_filsys_t *fs,
|
|
||||||
struct path *badblock_path,
|
|
||||||
void *data);
|
|
||||||
|
|
||||||
void mark_badblock(reiserfs_filsys_t *fs, struct path *badblock_path, void *data);
|
|
||||||
int create_badblock_bitmap (reiserfs_filsys_t * fs, char * badblocks_file);
|
|
||||||
void add_badblock_list (reiserfs_filsys_t * fs, int no_badblock_in_tree_yet);
|
|
||||||
void badblock_list(reiserfs_filsys_t * fs, badblock_func_t action, void *data);
|
|
||||||
|
|
||||||
extern struct key root_dir_key;
|
|
||||||
extern struct key parent_root_dir_key;
|
|
||||||
extern struct key lost_found_dir_key;
|
|
||||||
extern __u16 root_dir_format;
|
|
||||||
extern __u16 lost_found_dir_format;
|
|
||||||
|
|
||||||
|
|
||||||
/* bitmap.c */
|
|
||||||
int reiserfs_open_ondisk_bitmap (reiserfs_filsys_t *);
|
|
||||||
int reiserfs_create_ondisk_bitmap (reiserfs_filsys_t *);
|
|
||||||
void reiserfs_free_ondisk_bitmap (reiserfs_filsys_t *);
|
|
||||||
void reiserfs_close_ondisk_bitmap (reiserfs_filsys_t *);
|
|
||||||
int reiserfs_flush_to_ondisk_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys_t * fs);
|
|
||||||
|
|
||||||
reiserfs_bitmap_t * reiserfs_create_bitmap (unsigned int bit_count);
|
|
||||||
int reiserfs_expand_bitmap (reiserfs_bitmap_t * bm, unsigned int bit_count);
|
|
||||||
void reiserfs_shrink_bitmap (reiserfs_bitmap_t * bm, unsigned int bit_count);
|
|
||||||
void reiserfs_delete_bitmap (reiserfs_bitmap_t * bm);
|
|
||||||
void reiserfs_bitmap_copy (reiserfs_bitmap_t * to, reiserfs_bitmap_t * from);
|
|
||||||
int reiserfs_bitmap_compare (reiserfs_bitmap_t * bm1, reiserfs_bitmap_t * bm2);
|
|
||||||
void reiserfs_bitmap_disjunction (reiserfs_bitmap_t * disk, reiserfs_bitmap_t * cont);
|
|
||||||
void reiserfs_bitmap_delta (reiserfs_bitmap_t * base, reiserfs_bitmap_t * exclude);
|
|
||||||
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);
|
|
||||||
|
|
||||||
int reiserfs_bitmap_test_bit (reiserfs_bitmap_t * bm, unsigned int bit_number);
|
|
||||||
int reiserfs_bitmap_find_zero_bit (reiserfs_bitmap_t * bm, unsigned long * start);
|
|
||||||
/*int reiserfs_fetch_ondisk_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys_t *);*/
|
|
||||||
/*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);
|
|
||||||
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);
|
|
||||||
void reiserfs_bitmap_save (FILE * fp, reiserfs_bitmap_t * bm);
|
|
||||||
|
|
||||||
/* this probably should be in fsck */
|
|
||||||
void reiserfs_begin_stage_info_save(FILE * file, unsigned long stage);
|
|
||||||
void reiserfs_end_stage_info_save(FILE * file);
|
|
||||||
int is_stage_magic_correct (FILE * fp);
|
|
||||||
//void reiserfs_stage_info_save(struct fsck_data *, FILE * file);
|
|
||||||
|
|
||||||
reiserfs_bitmap_t * reiserfs_bitmap_load (FILE * fp);
|
|
||||||
void reiserfs_bitmap_invert (reiserfs_bitmap_t * bm);
|
|
||||||
|
|
||||||
|
|
||||||
int reiserfs_remove_entry (reiserfs_filsys_t *, struct key * key);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* node_formats.c */
|
|
||||||
|
|
||||||
#define THE_LEAF 1
|
|
||||||
#define THE_INTERNAL 2
|
|
||||||
#define THE_SUPER 3
|
|
||||||
#define THE_JDESC 4
|
|
||||||
#define HAS_IH_ARRAY 5
|
|
||||||
#define THE_UNKNOWN 6
|
|
||||||
|
|
||||||
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);
|
|
||||||
int does_look_like_super_block (struct reiserfs_super_block * rs);
|
|
||||||
int is_any_reiserfs_magic_string (struct reiserfs_super_block * rs);
|
|
||||||
int get_reiserfs_format (struct reiserfs_super_block * sb);
|
|
||||||
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);
|
|
||||||
int not_journalable (reiserfs_filsys_t *, unsigned long block);
|
|
||||||
int block_of_bitmap (reiserfs_filsys_t *, unsigned long block);
|
|
||||||
int block_of_journal (reiserfs_filsys_t *, unsigned long block);
|
|
||||||
int is_tree_node (struct buffer_head * bh, int level);
|
|
||||||
int is_properly_hashed (reiserfs_filsys_t *,
|
|
||||||
char * name, int namelen, __u32 offset);
|
|
||||||
int dir_entry_bad_location (struct reiserfs_de_head * deh,
|
|
||||||
struct item_head * ih, int first);
|
|
||||||
void make_dir_stat_data (int blocksize, int key_format,
|
|
||||||
__u32 dirid, __u32 objectid,
|
|
||||||
struct item_head * ih, void * sd);
|
|
||||||
void make_empty_dir_item_v1 (char * body, __u32 dirid, __u32 objid,
|
|
||||||
__u32 par_dirid, __u32 par_objid);
|
|
||||||
void make_empty_dir_item (char * body, __u32 dirid, __u32 objid,
|
|
||||||
__u32 par_dirid, __u32 par_objid);
|
|
||||||
int reiserfs_is_fs_consistent (reiserfs_filsys_t * fs);
|
|
||||||
|
|
||||||
|
|
||||||
typedef void (*item_action_t) (struct buffer_head * bh, struct item_head * ih);
|
|
||||||
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);
|
|
||||||
unsigned long long get_offset (const struct key * key);
|
|
||||||
int uniqueness2type (__u32 uniqueness);
|
|
||||||
__u32 type2uniqueness (int type);
|
|
||||||
int get_type (const struct key * key);
|
|
||||||
char * key_of_what (const struct key * key);
|
|
||||||
int type_unknown (struct key * key);
|
|
||||||
void set_type (int format, struct key * key, int type);
|
|
||||||
void set_offset (int format, struct key * key, loff_t offset);
|
|
||||||
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);
|
|
||||||
|
|
||||||
#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 (unsigned int code);
|
|
||||||
int func2code (hashf_t func);
|
|
||||||
hashf_t code2func (unsigned int code);
|
|
||||||
hashf_t name2func (char * hash);
|
|
||||||
int find_hash_in_use (char * name, int namelen, __u32 deh_offset, unsigned int code_to_try_first);
|
|
||||||
|
|
||||||
int entry_length (struct item_head * ih, struct reiserfs_de_head * deh,
|
|
||||||
int pos_in_item);
|
|
||||||
char * name_in_entry (struct reiserfs_de_head * deh, int pos_in_item);
|
|
||||||
int name_in_entry_length (struct item_head * ih,
|
|
||||||
struct reiserfs_de_head * deh, int pos_in_item);
|
|
||||||
int name_length (char * name, int key_format);
|
|
||||||
|
|
||||||
/* access to stat data fields */
|
|
||||||
void get_set_sd_field (int field, struct item_head * ih, void * sd,
|
|
||||||
void * value, int set);
|
|
||||||
#define GET_SD_MODE 0
|
|
||||||
#define GET_SD_SIZE 1
|
|
||||||
#define GET_SD_NLINK 2
|
|
||||||
#define GET_SD_BLOCKS 3
|
|
||||||
#define GET_SD_FIRST_DIRECT_BYTE 4
|
|
||||||
|
|
||||||
#define get_sd_mode(ih,sd,pmode) get_set_sd_field (GET_SD_MODE, ih, sd, pmode, 0/*get*/)
|
|
||||||
#define set_sd_mode(ih,sd,pmode) get_set_sd_field (GET_SD_MODE, ih, sd, pmode, 1/*set*/)
|
|
||||||
|
|
||||||
#define get_sd_size(ih,sd,psize) get_set_sd_field (GET_SD_SIZE, ih, sd, psize, 0/*get*/)
|
|
||||||
#define set_sd_size(ih,sd,psize) get_set_sd_field (GET_SD_SIZE, ih, sd, psize, 1/*set*/)
|
|
||||||
|
|
||||||
#define get_sd_blocks(ih,sd,pblocks) get_set_sd_field (GET_SD_BLOCKS, ih, sd, pblocks, 0/*get*/)
|
|
||||||
#define set_sd_blocks(ih,sd,pblocks) get_set_sd_field (GET_SD_BLOCKS, ih, sd, pblocks, 1/*set*/)
|
|
||||||
|
|
||||||
//#define get_sd_rdev(ih,sd,pblocks) get_set_sd_field (GET_SD_RDEV, ih, sd, pblocks, 0/*get*/)
|
|
||||||
//#define set_sd_rdev(ih,sd,pblocks) get_set_sd_field (GET_SD_RDEV, ih, sd, pblocks, 1/*set*/)
|
|
||||||
|
|
||||||
//#define get_sd_generation(ih,sd,pblocks) get_set_sd_field (GET_SD_GENER, ih, sd, pblocks, 0/*get*/)
|
|
||||||
//#define set_sd_generation(ih,sd,pblocks) get_set_sd_field (GET_SD_GENER, ih, sd, pblocks, 1/*set*/)
|
|
||||||
|
|
||||||
#define get_sd_nlink(ih,sd,pnlink) get_set_sd_field (GET_SD_NLINK, ih, sd, pnlink, 0/*get*/)
|
|
||||||
#define set_sd_nlink(ih,sd,pnlink) get_set_sd_field (GET_SD_NLINK, ih, sd, pnlink, 1/*set*/)
|
|
||||||
|
|
||||||
#define get_sd_first_direct_byte(ih,sd,pfdb) get_set_sd_field (GET_SD_FIRST_DIRECT_BYTE, ih, sd, pfdb, 0/*get*/)
|
|
||||||
#define set_sd_first_direct_byte(ih,sd,pfdb) get_set_sd_field (GET_SD_FIRST_DIRECT_BYTE, ih, sd, pfdb, 1/*set*/)
|
|
||||||
|
|
||||||
int is_objectid_used (reiserfs_filsys_t * fs, __u32 objectid);
|
|
||||||
void mark_objectid_used (reiserfs_filsys_t * fs, __u32 objectid);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* journal.c */
|
|
||||||
int get_boundary_transactions (reiserfs_filsys_t *, reiserfs_trans_t *,
|
|
||||||
reiserfs_trans_t *);
|
|
||||||
int next_transaction (reiserfs_filsys_t *, reiserfs_trans_t *, reiserfs_trans_t);
|
|
||||||
|
|
||||||
int replay_one_transaction (reiserfs_filsys_t *, reiserfs_trans_t *);
|
|
||||||
|
|
||||||
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 *,
|
|
||||||
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);
|
|
||||||
|
|
||||||
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);
|
|
||||||
int reiserfs_journal_opened (reiserfs_filsys_t *);
|
|
||||||
void reiserfs_flush_journal (reiserfs_filsys_t * fs);
|
|
||||||
void reiserfs_free_journal (reiserfs_filsys_t * fs);
|
|
||||||
void reiserfs_close_journal (reiserfs_filsys_t *);
|
|
||||||
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, int verbose);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* prints.c */
|
|
||||||
void print_indirect_item (FILE * fp, struct buffer_head * bh, int item_num);
|
|
||||||
void print_block (FILE * fp, reiserfs_filsys_t *, struct buffer_head * bh, ...);//int print_mode, int first, int last);
|
|
||||||
int print_super_block (FILE * fp, reiserfs_filsys_t *, char * file_name, struct buffer_head * bh, int short_print);
|
|
||||||
void print_journal (reiserfs_filsys_t *);
|
|
||||||
void print_journal_header (reiserfs_filsys_t * fs);
|
|
||||||
void reiserfs_warning (FILE * fp, const char * fmt, ...);
|
|
||||||
char ftypelet (mode_t mode);
|
|
||||||
void reiserfs_print_item (FILE * fp, struct buffer_head * bh,
|
|
||||||
struct item_head * ih);
|
|
||||||
void print_filesystem_state (FILE * fp, reiserfs_filsys_t * fs);
|
|
||||||
void print_one_transaction (reiserfs_filsys_t * fs, reiserfs_trans_t * trans);
|
|
||||||
void print_journal_params (FILE * fp, struct journal_params * jp);
|
|
||||||
char * get_reiserfs_version (__u16 version);
|
|
||||||
int can_we_format_it (char * device_name, int force);
|
|
||||||
|
|
||||||
|
|
||||||
#define reiserfs_panic(fmt, list...) \
|
|
||||||
{\
|
|
||||||
fflush (stdout);\
|
|
||||||
fprintf (stderr, "%s %d %s\n", __FILE__, __LINE__, __FUNCTION__);\
|
|
||||||
reiserfs_warning (stderr, (const char *)fmt, ## list);\
|
|
||||||
reiserfs_warning (stderr, "\n" );\
|
|
||||||
abort ();\
|
|
||||||
}
|
|
||||||
#define reiserfs_exit(val, fmt, list...) \
|
|
||||||
{\
|
|
||||||
fflush (stdout);\
|
|
||||||
reiserfs_warning (stderr, (const char *)fmt, ## list);\
|
|
||||||
reiserfs_warning (stderr, "\n" );\
|
|
||||||
exit (val);\
|
|
||||||
}
|
|
||||||
|
|
||||||
#define check_forcing_ask_confirmation(force) \
|
|
||||||
if (force < 1) {\
|
|
||||||
/* avoid formatting it without being forced */\
|
|
||||||
reiserfs_warning (stderr, "Use -f to force over\n");\
|
|
||||||
return 0;\
|
|
||||||
}\
|
|
||||||
if (force < 2) {\
|
|
||||||
if (!user_confirmed (stderr, "Continue (y/n):", "y\n"))\
|
|
||||||
return 0;\
|
|
||||||
}\
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* REISERFSPROGS_LIB_H */
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
noinst_HEADERS = badblock.h misc.h print.h device.h mntent.h
|
||||||
@@ -0,0 +1,337 @@
|
|||||||
|
# Makefile.in generated by automake 1.9.5 from Makefile.am.
|
||||||
|
# @configure_input@
|
||||||
|
|
||||||
|
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||||
|
# 2003, 2004, 2005 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 = :
|
||||||
|
build_triplet = @build@
|
||||||
|
host_triplet = @host@
|
||||||
|
subdir = include/util
|
||||||
|
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
|
||||||
|
$(srcdir)/Makefile.in
|
||||||
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
|
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||||
|
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||||
|
$(ACLOCAL_M4)
|
||||||
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
|
CONFIG_HEADER = $(top_builddir)/config.h
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
SOURCES =
|
||||||
|
DIST_SOURCES =
|
||||||
|
HEADERS = $(noinst_HEADERS)
|
||||||
|
ETAGS = etags
|
||||||
|
CTAGS = ctags
|
||||||
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
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@
|
||||||
|
LN_S = @LN_S@
|
||||||
|
LTLIBOBJS = @LTLIBOBJS@
|
||||||
|
MAINT = @MAINT@
|
||||||
|
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
||||||
|
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
||||||
|
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@
|
||||||
|
PROGS_LDFLAGS = @PROGS_LDFLAGS@
|
||||||
|
RANLIB = @RANLIB@
|
||||||
|
SET_MAKE = @SET_MAKE@
|
||||||
|
SHELL = @SHELL@
|
||||||
|
STRIP = @STRIP@
|
||||||
|
UUID_LIBS = @UUID_LIBS@
|
||||||
|
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__leading_dot = @am__leading_dot@
|
||||||
|
am__quote = @am__quote@
|
||||||
|
am__tar = @am__tar@
|
||||||
|
am__untar = @am__untar@
|
||||||
|
bindir = @bindir@
|
||||||
|
build = @build@
|
||||||
|
build_alias = @build_alias@
|
||||||
|
build_cpu = @build_cpu@
|
||||||
|
build_os = @build_os@
|
||||||
|
build_vendor = @build_vendor@
|
||||||
|
datadir = @datadir@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
host = @host@
|
||||||
|
host_alias = @host_alias@
|
||||||
|
host_cpu = @host_cpu@
|
||||||
|
host_os = @host_os@
|
||||||
|
host_vendor = @host_vendor@
|
||||||
|
includedir = @includedir@
|
||||||
|
infodir = @infodir@
|
||||||
|
install_sh = @install_sh@
|
||||||
|
libdir = @libdir@
|
||||||
|
libexecdir = @libexecdir@
|
||||||
|
localstatedir = @localstatedir@
|
||||||
|
mandir = @mandir@
|
||||||
|
mkdir_p = @mkdir_p@
|
||||||
|
oldincludedir = @oldincludedir@
|
||||||
|
prefix = @prefix@
|
||||||
|
program_transform_name = @program_transform_name@
|
||||||
|
sbindir = @sbindir@
|
||||||
|
sharedstatedir = @sharedstatedir@
|
||||||
|
sysconfdir = @sysconfdir@
|
||||||
|
target_alias = @target_alias@
|
||||||
|
noinst_HEADERS = badblock.h misc.h print.h device.h mntent.h
|
||||||
|
all: all-am
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||||
|
@for dep in $?; do \
|
||||||
|
case '$(am__configure_deps)' in \
|
||||||
|
*$$dep*) \
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||||
|
&& exit 0; \
|
||||||
|
exit 1;; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/util/Makefile'; \
|
||||||
|
cd $(top_srcdir) && \
|
||||||
|
$(AUTOMAKE) --gnu include/util/Makefile
|
||||||
|
.PRECIOUS: Makefile
|
||||||
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
|
@case '$?' in \
|
||||||
|
*config.status*) \
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||||
|
*) \
|
||||||
|
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||||
|
esac;
|
||||||
|
|
||||||
|
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
|
||||||
|
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
uninstall-info-am:
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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; }'`; \
|
||||||
|
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||||
|
test -n "$$unique" || unique=$$empty_fix; \
|
||||||
|
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||||
|
$$tags $$unique; \
|
||||||
|
fi
|
||||||
|
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
|
||||||
|
|
||||||
|
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"; \
|
||||||
|
$(mkdir_p) "$(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 $(HEADERS)
|
||||||
|
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
|
||||||
|
|
||||||
|
installcheck: installcheck-am
|
||||||
|
install-strip:
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
|
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||||
|
`test -z '$(STRIP)' || \
|
||||||
|
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||||
|
mostlyclean-generic:
|
||||||
|
|
||||||
|
clean-generic:
|
||||||
|
|
||||||
|
distclean-generic:
|
||||||
|
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(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 mostlyclean-am
|
||||||
|
|
||||||
|
distclean: distclean-am
|
||||||
|
-rm -f Makefile
|
||||||
|
distclean-am: clean-am distclean-generic distclean-tags
|
||||||
|
|
||||||
|
dvi: dvi-am
|
||||||
|
|
||||||
|
dvi-am:
|
||||||
|
|
||||||
|
html: html-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
|
||||||
|
-rm -f Makefile
|
||||||
|
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-tags distdir dvi \
|
||||||
|
dvi-am html html-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.
|
||||||
|
.NOEXPORT:
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef UTIL_BADBLOCK_H
|
||||||
|
#define UTIL_BADBLOCK_H
|
||||||
|
|
||||||
|
#include "reiserfs/libreiserfs.h"
|
||||||
|
|
||||||
|
extern int util_badblock_load (reiserfs_filsys_t * fs,
|
||||||
|
char * badblocks_file);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef UTIL_DEVICE_H
|
||||||
|
#define UTIL_DEVICE_H
|
||||||
|
|
||||||
|
#include "misc/types.h"
|
||||||
|
#include <linux/major.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifndef major
|
||||||
|
#define major(rdev) ((rdev)>>8)
|
||||||
|
#define minor(rdev) ((rdev) & 0xff)
|
||||||
|
#endif /* major */
|
||||||
|
|
||||||
|
#ifndef SCSI_DISK_MAJOR
|
||||||
|
#define SCSI_DISK_MAJOR(maj) ((maj) == SCSI_DISK0_MAJOR || \
|
||||||
|
((maj) >= SCSI_DISK1_MAJOR && (maj) <= SCSI_DISK7_MAJOR))
|
||||||
|
#endif /* SCSI_DISK_MAJOR */
|
||||||
|
|
||||||
|
#ifndef SCSI_BLK_MAJOR
|
||||||
|
#define SCSI_BLK_MAJOR(maj) (SCSI_DISK_MAJOR(maj) || (maj) == SCSI_CDROM_MAJOR)
|
||||||
|
#endif /* SCSI_BLK_MAJOR */
|
||||||
|
|
||||||
|
#ifndef IDE_DISK_MAJOR
|
||||||
|
#ifdef IDE9_MAJOR
|
||||||
|
#define IDE_DISK_MAJOR(maj) ((maj) == IDE0_MAJOR || (maj) == IDE1_MAJOR || \
|
||||||
|
(maj) == IDE2_MAJOR || (maj) == IDE3_MAJOR || \
|
||||||
|
(maj) == IDE4_MAJOR || (maj) == IDE5_MAJOR || \
|
||||||
|
(maj) == IDE6_MAJOR || (maj) == IDE7_MAJOR || \
|
||||||
|
(maj) == IDE8_MAJOR || (maj) == IDE9_MAJOR)
|
||||||
|
#else
|
||||||
|
#define IDE_DISK_MAJOR(maj) ((maj) == IDE0_MAJOR || (maj) == IDE1_MAJOR || \
|
||||||
|
(maj) == IDE2_MAJOR || (maj) == IDE3_MAJOR || \
|
||||||
|
(maj) == IDE4_MAJOR || (maj) == IDE5_MAJOR)
|
||||||
|
#endif /* IDE9_MAJOR */
|
||||||
|
#endif /* IDE_DISK_MAJOR */
|
||||||
|
|
||||||
|
typedef enum mount_flags {
|
||||||
|
MF_NOT_MOUNTED = 0x0,
|
||||||
|
MF_RO = 0x1,
|
||||||
|
MF_RW = 0x2
|
||||||
|
} mount_flags_t;
|
||||||
|
|
||||||
|
extern FILE * util_file_open (char * filename, char * option);
|
||||||
|
|
||||||
|
typedef struct util_device_dma {
|
||||||
|
int fd;
|
||||||
|
int support_type;
|
||||||
|
int dma;
|
||||||
|
__u64 speed;
|
||||||
|
dev_t st_rdev;
|
||||||
|
} util_device_dma_t;
|
||||||
|
|
||||||
|
extern int util_device_dma_prep(util_device_dma_t *dma_info);
|
||||||
|
|
||||||
|
extern int util_device_get_dma(util_device_dma_t *dma_info);
|
||||||
|
|
||||||
|
extern void util_device_dma_fini(int fd, util_device_dma_t *dma_info);
|
||||||
|
|
||||||
|
extern int util_device_formatable (char * device_name, int force);
|
||||||
|
|
||||||
|
extern int util_root_mounted(char *device);
|
||||||
|
|
||||||
|
extern int util_device_mounted(char *device);
|
||||||
|
|
||||||
|
extern int util_file_ro(char *file);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef UTIL_MISC_H
|
||||||
|
#define UTIL_MISC_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
extern void util_misc_progress (FILE * fp,
|
||||||
|
unsigned long *passed,
|
||||||
|
unsigned long total,
|
||||||
|
unsigned int inc,
|
||||||
|
int forward);
|
||||||
|
|
||||||
|
extern void util_misc_speed (FILE *fp,
|
||||||
|
unsigned long total,
|
||||||
|
unsigned long passed,
|
||||||
|
int cursor_pos,
|
||||||
|
int reset_time);
|
||||||
|
|
||||||
|
|
||||||
|
extern void util_misc_print_name (FILE * fp, char * name, int len);
|
||||||
|
|
||||||
|
extern void util_misc_erase_name (FILE * fp, int len);
|
||||||
|
|
||||||
|
extern void util_misc_fini_name (FILE *fp);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef UTIL_MNTENT_H
|
||||||
|
#define UTIL_MNTENT_H
|
||||||
|
|
||||||
|
extern struct mntent *util_mntent(char *device);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef UTIL_PRINT_H
|
||||||
|
#define UTIL_PRINT_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
extern int util_user_confirmed(FILE * fp, char * q, char * yes);
|
||||||
|
|
||||||
|
extern void util_print_banner(char *name);
|
||||||
|
|
||||||
|
#endif
|
||||||
+234
-162
@@ -1,19 +1,38 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
|
||||||
# install - install a program, script, or datafile
|
# install - install a program, script, or datafile
|
||||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
|
||||||
|
scriptversion=2005-02-02.21
|
||||||
|
|
||||||
|
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||||
|
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||||
|
# following copyright and license.
|
||||||
#
|
#
|
||||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
# Copyright (C) 1994 X Consortium
|
||||||
#
|
#
|
||||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# documentation for any purpose is hereby granted without fee, provided that
|
# of this software and associated documentation files (the "Software"), to
|
||||||
# the above copyright notice appear in all copies and that both that
|
# deal in the Software without restriction, including without limitation the
|
||||||
# copyright notice and this permission notice appear in supporting
|
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
# sell copies of the Software, and to permit persons to whom the Software is
|
||||||
# publicity pertaining to distribution of the software without specific,
|
# furnished to do so, subject to the following conditions:
|
||||||
# written prior permission. M.I.T. makes no representations about the
|
#
|
||||||
# suitability of this software for any purpose. It is provided "as is"
|
# The above copyright notice and this permission notice shall be included in
|
||||||
# without express or implied warranty.
|
# all copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||||
|
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||||
|
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
#
|
||||||
|
# Except as contained in this notice, the name of the X Consortium shall not
|
||||||
|
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||||
|
# ings in this Software without prior written authorization from the X Consor-
|
||||||
|
# tium.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# FSF changes to this file are in the public domain.
|
||||||
#
|
#
|
||||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||||
# `make' implicit rules from creating a file called install from it
|
# `make' implicit rules from creating a file called install from it
|
||||||
@@ -23,13 +42,11 @@
|
|||||||
# from scratch. It can only install one file at a time, a restriction
|
# from scratch. It can only install one file at a time, a restriction
|
||||||
# shared with many OS's install programs.
|
# shared with many OS's install programs.
|
||||||
|
|
||||||
|
|
||||||
# set DOITPROG to echo to test this script
|
# set DOITPROG to echo to test this script
|
||||||
|
|
||||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||||
doit="${DOITPROG-}"
|
doit="${DOITPROG-}"
|
||||||
|
|
||||||
|
|
||||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||||
|
|
||||||
mvprog="${MVPROG-mv}"
|
mvprog="${MVPROG-mv}"
|
||||||
@@ -41,29 +58,59 @@ stripprog="${STRIPPROG-strip}"
|
|||||||
rmprog="${RMPROG-rm}"
|
rmprog="${RMPROG-rm}"
|
||||||
mkdirprog="${MKDIRPROG-mkdir}"
|
mkdirprog="${MKDIRPROG-mkdir}"
|
||||||
|
|
||||||
transformbasename=""
|
|
||||||
transform_arg=""
|
|
||||||
instcmd="$mvprog"
|
|
||||||
chmodcmd="$chmodprog 0755"
|
chmodcmd="$chmodprog 0755"
|
||||||
chowncmd=""
|
chowncmd=
|
||||||
chgrpcmd=""
|
chgrpcmd=
|
||||||
stripcmd=""
|
stripcmd=
|
||||||
rmcmd="$rmprog -f"
|
rmcmd="$rmprog -f"
|
||||||
mvcmd="$mvprog"
|
mvcmd="$mvprog"
|
||||||
src=""
|
src=
|
||||||
dst=""
|
dst=
|
||||||
dir_arg=""
|
dir_arg=
|
||||||
|
dstarg=
|
||||||
|
no_target_directory=
|
||||||
|
|
||||||
while [ x"$1" != x ]; do
|
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||||
|
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||||
|
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||||
|
or: $0 [OPTION]... -d DIRECTORIES...
|
||||||
|
|
||||||
|
In the 1st form, copy SRCFILE to DSTFILE.
|
||||||
|
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||||
|
In the 4th, create DIRECTORIES.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-c (ignored)
|
||||||
|
-d create directories instead of installing files.
|
||||||
|
-g GROUP $chgrpprog installed files to GROUP.
|
||||||
|
-m MODE $chmodprog installed files to MODE.
|
||||||
|
-o USER $chownprog installed files to USER.
|
||||||
|
-s $stripprog installed files.
|
||||||
|
-t DIRECTORY install into DIRECTORY.
|
||||||
|
-T report an error if DSTFILE is a directory.
|
||||||
|
--help display this help and exit.
|
||||||
|
--version display version info and exit.
|
||||||
|
|
||||||
|
Environment variables override the default commands:
|
||||||
|
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
|
||||||
|
"
|
||||||
|
|
||||||
|
while test -n "$1"; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-c) instcmd="$cpprog"
|
-c) shift
|
||||||
shift
|
|
||||||
continue;;
|
continue;;
|
||||||
|
|
||||||
-d) dir_arg=true
|
-d) dir_arg=true
|
||||||
shift
|
shift
|
||||||
continue;;
|
continue;;
|
||||||
|
|
||||||
|
-g) chgrpcmd="$chgrpprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
--help) echo "$usage"; exit $?;;
|
||||||
|
|
||||||
-m) chmodcmd="$chmodprog $2"
|
-m) chmodcmd="$chmodprog $2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
@@ -74,178 +121,203 @@ while [ x"$1" != x ]; do
|
|||||||
shift
|
shift
|
||||||
continue;;
|
continue;;
|
||||||
|
|
||||||
-g) chgrpcmd="$chgrpprog $2"
|
-s) stripcmd=$stripprog
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-t) dstarg=$2
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
continue;;
|
continue;;
|
||||||
|
|
||||||
-s) stripcmd="$stripprog"
|
-T) no_target_directory=true
|
||||||
shift
|
shift
|
||||||
continue;;
|
continue;;
|
||||||
|
|
||||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
--version) echo "$0 $scriptversion"; exit $?;;
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
*) # When -d is used, all remaining arguments are directories to create.
|
||||||
shift
|
# When -t is used, the destination is already specified.
|
||||||
continue;;
|
test -n "$dir_arg$dstarg" && break
|
||||||
|
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||||
*) if [ x"$src" = x ]
|
for arg
|
||||||
then
|
do
|
||||||
src=$1
|
if test -n "$dstarg"; then
|
||||||
else
|
# $@ is not empty: it contains at least $arg.
|
||||||
# this colon is to work around a 386BSD /bin/sh bug
|
set fnord "$@" "$dstarg"
|
||||||
:
|
shift # fnord
|
||||||
dst=$1
|
|
||||||
fi
|
fi
|
||||||
shift
|
shift # arg
|
||||||
continue;;
|
dstarg=$arg
|
||||||
|
done
|
||||||
|
break;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ x"$src" = x ]
|
if test -z "$1"; then
|
||||||
then
|
if test -z "$dir_arg"; then
|
||||||
echo "install: no input file specified"
|
echo "$0: no input file specified." >&2
|
||||||
exit 1
|
exit 1
|
||||||
else
|
fi
|
||||||
true
|
# It's OK to call `install-sh -d' without argument.
|
||||||
|
# This can happen when creating conditional directories.
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ x"$dir_arg" != x ]; then
|
for src
|
||||||
|
do
|
||||||
|
# Protect names starting with `-'.
|
||||||
|
case $src in
|
||||||
|
-*) src=./$src ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test -n "$dir_arg"; then
|
||||||
dst=$src
|
dst=$src
|
||||||
src=""
|
src=
|
||||||
|
|
||||||
if [ -d $dst ]; then
|
if test -d "$dst"; then
|
||||||
instcmd=:
|
mkdircmd=:
|
||||||
chmodcmd=""
|
chmodcmd=
|
||||||
else
|
else
|
||||||
instcmd=mkdir
|
mkdircmd=$mkdirprog
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
|
|
||||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
|
||||||
# might cause directories to be created, which would be especially bad
|
|
||||||
# if $src (and thus $dsttmp) contains '*'.
|
|
||||||
|
|
||||||
if [ -f $src -o -d $src ]
|
|
||||||
then
|
|
||||||
true
|
|
||||||
else
|
else
|
||||||
echo "install: $src does not exist"
|
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||||
|
# might cause directories to be created, which would be especially bad
|
||||||
|
# if $src (and thus $dsttmp) contains '*'.
|
||||||
|
if test ! -f "$src" && test ! -d "$src"; then
|
||||||
|
echo "$0: $src does not exist." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ x"$dst" = x ]
|
if test -z "$dstarg"; then
|
||||||
then
|
echo "$0: no destination specified." >&2
|
||||||
echo "install: no destination specified"
|
|
||||||
exit 1
|
exit 1
|
||||||
else
|
|
||||||
true
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If destination is a directory, append the input filename; if your system
|
dst=$dstarg
|
||||||
# does not like double slashes in filenames, you may need to add some logic
|
# Protect names starting with `-'.
|
||||||
|
case $dst in
|
||||||
|
-*) dst=./$dst ;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ -d $dst ]
|
# If destination is a directory, append the input filename; won't work
|
||||||
then
|
# if double slashes aren't ignored.
|
||||||
dst="$dst"/`basename $src`
|
if test -d "$dst"; then
|
||||||
else
|
if test -n "$no_target_directory"; then
|
||||||
true
|
echo "$0: $dstarg: Is a directory" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
dst=$dst/`basename "$src"`
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
## this sed command emulates the dirname command
|
# This sed command emulates the dirname command.
|
||||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
|
||||||
|
|
||||||
# Make sure that the destination directory exists.
|
# Make sure that the destination directory exists.
|
||||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
|
||||||
|
|
||||||
# Skip lots of stat calls in the usual case.
|
# Skip lots of stat calls in the usual case.
|
||||||
if [ ! -d "$dstdir" ]; then
|
if test ! -d "$dstdir"; then
|
||||||
defaultIFS='
|
defaultIFS='
|
||||||
'
|
'
|
||||||
IFS="${IFS-${defaultIFS}}"
|
IFS="${IFS-$defaultIFS}"
|
||||||
|
|
||||||
oIFS="${IFS}"
|
oIFS=$IFS
|
||||||
# Some sh's can't handle IFS=/ for some reason.
|
# Some sh's can't handle IFS=/ for some reason.
|
||||||
IFS='%'
|
IFS='%'
|
||||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||||
IFS="${oIFS}"
|
|
||||||
|
|
||||||
pathcomp=''
|
|
||||||
|
|
||||||
while [ $# -ne 0 ] ; do
|
|
||||||
pathcomp="${pathcomp}${1}"
|
|
||||||
shift
|
shift
|
||||||
|
IFS=$oIFS
|
||||||
|
|
||||||
if [ ! -d "${pathcomp}" ] ;
|
pathcomp=
|
||||||
then
|
|
||||||
$mkdirprog "${pathcomp}"
|
while test $# -ne 0 ; do
|
||||||
else
|
pathcomp=$pathcomp$1
|
||||||
true
|
shift
|
||||||
|
if test ! -d "$pathcomp"; then
|
||||||
|
$mkdirprog "$pathcomp"
|
||||||
|
# mkdir can fail with a `File exist' error in case several
|
||||||
|
# install-sh are creating the directory concurrently. This
|
||||||
|
# is OK.
|
||||||
|
test -d "$pathcomp" || exit
|
||||||
|
fi
|
||||||
|
pathcomp=$pathcomp/
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pathcomp="${pathcomp}/"
|
if test -n "$dir_arg"; then
|
||||||
|
$doit $mkdircmd "$dst" \
|
||||||
|
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
|
||||||
|
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
|
||||||
|
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
|
||||||
|
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
|
||||||
|
|
||||||
|
else
|
||||||
|
dstfile=`basename "$dst"`
|
||||||
|
|
||||||
|
# Make a couple of temp file names in the proper directory.
|
||||||
|
dsttmp=$dstdir/_inst.$$_
|
||||||
|
rmtmp=$dstdir/_rm.$$_
|
||||||
|
|
||||||
|
# Trap to clean up those temp files at exit.
|
||||||
|
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||||
|
trap '(exit $?); exit' 1 2 13 15
|
||||||
|
|
||||||
|
# Copy the file name to the temp name.
|
||||||
|
$doit $cpprog "$src" "$dsttmp" &&
|
||||||
|
|
||||||
|
# and set any options; do chmod last to preserve setuid bits.
|
||||||
|
#
|
||||||
|
# If any of these fail, we abort the whole thing. If we want to
|
||||||
|
# ignore errors from any of these, just make sure not to ignore
|
||||||
|
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||||
|
#
|
||||||
|
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
|
||||||
|
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
|
||||||
|
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
|
||||||
|
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
|
||||||
|
|
||||||
|
# Now rename the file to the real destination.
|
||||||
|
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
|
||||||
|
|| {
|
||||||
|
# The rename failed, perhaps because mv can't rename something else
|
||||||
|
# to itself, or perhaps because mv is so ancient that it does not
|
||||||
|
# support -f.
|
||||||
|
|
||||||
|
# Now remove or move aside any old file at destination location.
|
||||||
|
# We try this two ways since rm can't unlink itself on some
|
||||||
|
# systems and the destination file might be busy for other
|
||||||
|
# reasons. In this case, the final cleanup might fail but the new
|
||||||
|
# file should still install successfully.
|
||||||
|
{
|
||||||
|
if test -f "$dstdir/$dstfile"; then
|
||||||
|
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|
||||||
|
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|
||||||
|
|| {
|
||||||
|
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
|
||||||
|
(exit 1); exit 1
|
||||||
|
}
|
||||||
|
else
|
||||||
|
:
|
||||||
|
fi
|
||||||
|
} &&
|
||||||
|
|
||||||
|
# Now rename the file to the real destination.
|
||||||
|
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fi || { (exit 1); exit 1; }
|
||||||
done
|
done
|
||||||
fi
|
|
||||||
|
|
||||||
if [ x"$dir_arg" != x ]
|
# The final little trick to "correctly" pass the exit status to the exit trap.
|
||||||
then
|
{
|
||||||
$doit $instcmd $dst &&
|
(exit 0); exit 0
|
||||||
|
}
|
||||||
|
|
||||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
# Local variables:
|
||||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
# time-stamp-start: "scriptversion="
|
||||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||||
else
|
# time-stamp-end: "$"
|
||||||
|
# End:
|
||||||
# If we're going to rename the final executable, determine the name now.
|
|
||||||
|
|
||||||
if [ x"$transformarg" = x ]
|
|
||||||
then
|
|
||||||
dstfile=`basename $dst`
|
|
||||||
else
|
|
||||||
dstfile=`basename $dst $transformbasename |
|
|
||||||
sed $transformarg`$transformbasename
|
|
||||||
fi
|
|
||||||
|
|
||||||
# don't allow the sed command to completely eliminate the filename
|
|
||||||
|
|
||||||
if [ x"$dstfile" = x ]
|
|
||||||
then
|
|
||||||
dstfile=`basename $dst`
|
|
||||||
else
|
|
||||||
true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make a temp file name in the proper directory.
|
|
||||||
|
|
||||||
dsttmp=$dstdir/#inst.$$#
|
|
||||||
|
|
||||||
# Move or copy the file name to the temp name
|
|
||||||
|
|
||||||
$doit $instcmd $src $dsttmp &&
|
|
||||||
|
|
||||||
trap "rm -f ${dsttmp}" 0 &&
|
|
||||||
|
|
||||||
# and set any options; do chmod last to preserve setuid bits
|
|
||||||
|
|
||||||
# If any of these fail, we abort the whole thing. If we want to
|
|
||||||
# ignore errors from any of these, just make sure not to ignore
|
|
||||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
|
||||||
|
|
||||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
|
||||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
|
||||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
|
||||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
|
||||||
|
|
||||||
# Now rename the file to the real destination.
|
|
||||||
|
|
||||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
|
||||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
|
||||||
|
|
||||||
fi &&
|
|
||||||
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
noinst_LIBRARIES = libmisc.a
|
|
||||||
|
|
||||||
libmisc_a_SOURCES = io.c misc.c
|
|
||||||
##reiserfs.c
|
|
||||||
|
|
||||||
@@ -1,960 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
|
||||||
* reiserfsprogs/README
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "io.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <asm/types.h>
|
|
||||||
|
|
||||||
void check_memory_msg (void) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"\nThe problem has occurred looks like a hardware problem (perhaps\n"
|
|
||||||
"memory). Send us the bug report only if the second run dies at\n"
|
|
||||||
"the same place with the same block number.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void check_hd_msg (void) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"\nThe problem has occurred looks like a hardware problem. If you have\n"
|
|
||||||
"bad blocks, we advise you to get a new hard drive, because once you\n"
|
|
||||||
"get one bad block that the disk drive internals cannot hide from\n"
|
|
||||||
"your sight,the chances of getting more are generally said to become\n"
|
|
||||||
"much higher (precise statistics are unknown to us), and this disk\n"
|
|
||||||
"drive is probably not expensive enough for you to you to risk your\n"
|
|
||||||
"time and data on it. If you don't want to follow that follow that\n"
|
|
||||||
"advice 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 means\n"
|
|
||||||
"it takes a block it has in reserve and allocates it for use for\n"
|
|
||||||
"of that block number). If it cannot remap the block, use badblock\n"
|
|
||||||
"option (-B) with reiserfs utils to handle this block correctly.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static int is_bad_block (unsigned long block)
|
|
||||||
{
|
|
||||||
#ifdef IO_FAILURE_EMULATION
|
|
||||||
|
|
||||||
/* this array similates bad blocks on the device */
|
|
||||||
unsigned long bad_blocks [] =
|
|
||||||
{
|
|
||||||
8208, 8209, 8210
|
|
||||||
/*, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19*/
|
|
||||||
};
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < sizeof (bad_blocks) / sizeof (bad_blocks[0]); i ++)
|
|
||||||
if (bad_blocks [i] == block)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* All buffers are in double linked cycled list. If getblk found buffer with
|
|
||||||
wanted block number in hash queue it moves buffer to the end of list. */
|
|
||||||
|
|
||||||
static int g_nr_buffers;
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned long buffers_memory;
|
|
||||||
|
|
||||||
/* create buffers until we spend this fraction of system memory, this
|
|
||||||
** is a hard limit on the amount of buffer ram used
|
|
||||||
*/
|
|
||||||
#define BUFFER_MEMORY_FRACTION 10
|
|
||||||
|
|
||||||
/* number of bytes in local buffer cache before we start forcing syncs
|
|
||||||
** of dirty data and reusing unused buffers instead of allocating new
|
|
||||||
** ones. If a flush doesn't find reusable buffers, new ones are
|
|
||||||
** still allocated up to the BUFFER_MEMORY_FRACTION percentage
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
#define BUFFER_SOFT_LIMIT (500 * 1024)
|
|
||||||
static unsigned long buffer_soft_limit = BUFFER_SOFT_LIMIT;
|
|
||||||
|
|
||||||
|
|
||||||
#define NR_HASH_QUEUES 4096
|
|
||||||
static struct buffer_head * g_a_hash_queues [NR_HASH_QUEUES];
|
|
||||||
static struct buffer_head * Buffer_list_head;
|
|
||||||
static struct buffer_head * g_free_buffers = NULL ;
|
|
||||||
static struct buffer_head * g_buffer_heads;
|
|
||||||
static int buffer_hits = 0 ;
|
|
||||||
static int buffer_misses = 0 ;
|
|
||||||
static int buffer_reads = 0 ;
|
|
||||||
static int buffer_writes = 0 ;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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 */
|
|
||||||
int free = 0;
|
|
||||||
struct buffer_head * next;
|
|
||||||
|
|
||||||
next = *list;
|
|
||||||
if (!next)
|
|
||||||
return ;
|
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
if (next->b_dev == dev && next->b_size == size) {
|
|
||||||
all ++;
|
|
||||||
if (next->b_count != 0) {
|
|
||||||
in_use ++;
|
|
||||||
}
|
|
||||||
if (buffer_dirty (next)) {
|
|
||||||
dirty ++;
|
|
||||||
}
|
|
||||||
if (buffer_clean (next) && next->b_count == 0) {
|
|
||||||
free ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
next = next->b_next;
|
|
||||||
if (next == *list)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("show_buffers (dev %d, size %lu): free %d, count != 0 %d, dirty %d, "
|
|
||||||
"all %d\n", dev, size, free, in_use, dirty, all);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void show_buffers (int dev, int size)
|
|
||||||
{
|
|
||||||
_show_buffers(&Buffer_list_head, dev, size) ;
|
|
||||||
_show_buffers(&g_free_buffers, dev, size) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void insert_into_hash_queue (struct buffer_head * bh)
|
|
||||||
{
|
|
||||||
int index = bh->b_blocknr % NR_HASH_QUEUES;
|
|
||||||
|
|
||||||
if (bh->b_hash_prev || bh->b_hash_next)
|
|
||||||
die ("insert_into_hash_queue: hash queue corrupted");
|
|
||||||
|
|
||||||
if (g_a_hash_queues[index]) {
|
|
||||||
g_a_hash_queues[index]->b_hash_prev = bh;
|
|
||||||
bh->b_hash_next = g_a_hash_queues[index];
|
|
||||||
}
|
|
||||||
g_a_hash_queues[index] = 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 == -1) ? */
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (bh == g_a_hash_queues[bh->b_blocknr % NR_HASH_QUEUES]) {
|
|
||||||
if (bh->b_hash_prev != 0)
|
|
||||||
die ("remove_from_hash_queue: hash queue corrupted");
|
|
||||||
g_a_hash_queues[bh->b_blocknr % NR_HASH_QUEUES] = bh->b_hash_next;
|
|
||||||
}
|
|
||||||
if (bh->b_hash_next)
|
|
||||||
bh->b_hash_next->b_hash_prev = bh->b_hash_prev;
|
|
||||||
|
|
||||||
if (bh->b_hash_prev)
|
|
||||||
bh->b_hash_prev->b_hash_next = bh->b_hash_next;
|
|
||||||
|
|
||||||
bh->b_hash_prev = bh->b_hash_next = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void put_buffer_list_end (struct buffer_head **list,
|
|
||||||
struct buffer_head * bh)
|
|
||||||
{
|
|
||||||
struct buffer_head * last = 0;
|
|
||||||
|
|
||||||
if (bh->b_prev || bh->b_next)
|
|
||||||
die ("put_buffer_list_end: buffer list corrupted");
|
|
||||||
|
|
||||||
if (*list == 0) {
|
|
||||||
bh->b_next = bh;
|
|
||||||
bh->b_prev = bh;
|
|
||||||
*list = bh;
|
|
||||||
} else {
|
|
||||||
last = (*list)->b_prev;
|
|
||||||
|
|
||||||
bh->b_next = last->b_next;
|
|
||||||
bh->b_prev = last;
|
|
||||||
last->b_next->b_prev = bh;
|
|
||||||
last->b_next = bh;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void remove_from_buffer_list (struct buffer_head **list,
|
|
||||||
struct buffer_head * bh)
|
|
||||||
{
|
|
||||||
if (bh == bh->b_next) {
|
|
||||||
*list = 0;
|
|
||||||
} else {
|
|
||||||
bh->b_prev->b_next = bh->b_next;
|
|
||||||
bh->b_next->b_prev = bh->b_prev;
|
|
||||||
if (bh == *list)
|
|
||||||
*list = bh->b_next;
|
|
||||||
}
|
|
||||||
|
|
||||||
bh->b_next = bh->b_prev = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void put_buffer_list_head (struct buffer_head **list,
|
|
||||||
struct buffer_head * bh)
|
|
||||||
{
|
|
||||||
put_buffer_list_end (list, bh);
|
|
||||||
*list = bh;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
#include <sys/mman.h>
|
|
||||||
|
|
||||||
static size_t estimate_memory_amount (void)
|
|
||||||
{
|
|
||||||
size_t len = 1;
|
|
||||||
size_t max = 0;
|
|
||||||
void * addr;
|
|
||||||
|
|
||||||
while (len > 0) {
|
|
||||||
addr = mmap (0, len, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
|
||||||
if (addr == MAP_FAILED) {
|
|
||||||
if (errno != ENOMEM)
|
|
||||||
die ("mmap failed: %s\n", strerror(errno));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (mlock (addr, len) != 0) {
|
|
||||||
if (errno == EPERM)
|
|
||||||
die ("No permission to run mlock");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
munlock (addr, len);
|
|
||||||
munmap (addr, len);
|
|
||||||
max = len;
|
|
||||||
len *= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// * If we've looped, we don't want to return 0, we want to return the
|
|
||||||
// * last successful len before we looped. In the event that mmap/mlock
|
|
||||||
// * failed for len = 1, max will still be 0, so we don't get an invalid
|
|
||||||
// * result
|
|
||||||
return max;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define GROW_BUFFERS__NEW_BUFERS_PER_CALL 10
|
|
||||||
|
|
||||||
/* creates number of new buffers and insert them into head of buffer list */
|
|
||||||
static int grow_buffers (int size)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
struct buffer_head * bh, * tmp;
|
|
||||||
|
|
||||||
|
|
||||||
/* get memory for array of buffer heads */
|
|
||||||
bh = (struct buffer_head *)getmem (GROW_BUFFERS__NEW_BUFERS_PER_CALL *
|
|
||||||
sizeof (struct buffer_head) + sizeof (struct buffer_head *));
|
|
||||||
if (g_buffer_heads == 0)
|
|
||||||
g_buffer_heads = bh;
|
|
||||||
else {
|
|
||||||
/* link new array to the end of array list */
|
|
||||||
tmp = g_buffer_heads;
|
|
||||||
while (*(struct buffer_head **)(tmp + GROW_BUFFERS__NEW_BUFERS_PER_CALL) != 0)
|
|
||||||
tmp = *(struct buffer_head **)(tmp + GROW_BUFFERS__NEW_BUFERS_PER_CALL);
|
|
||||||
*(struct buffer_head **)(tmp + GROW_BUFFERS__NEW_BUFERS_PER_CALL) = bh;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < GROW_BUFFERS__NEW_BUFERS_PER_CALL; i ++) {
|
|
||||||
|
|
||||||
tmp = bh + i;
|
|
||||||
memset (tmp, 0, sizeof (struct buffer_head));
|
|
||||||
tmp->b_data = getmem (size);
|
|
||||||
if (tmp->b_data == 0)
|
|
||||||
die ("grow_buffers: no memory for new buffer data");
|
|
||||||
tmp->b_dev = -1;
|
|
||||||
tmp->b_size = size;
|
|
||||||
put_buffer_list_head (&g_free_buffers, tmp);
|
|
||||||
}
|
|
||||||
buffers_memory += GROW_BUFFERS__NEW_BUFERS_PER_CALL * size;
|
|
||||||
g_nr_buffers += GROW_BUFFERS__NEW_BUFERS_PER_CALL;
|
|
||||||
return GROW_BUFFERS__NEW_BUFERS_PER_CALL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
struct buffer_head *find_buffer(int dev, unsigned long block, unsigned long size)
|
|
||||||
{
|
|
||||||
struct buffer_head * next;
|
|
||||||
|
|
||||||
next = g_a_hash_queues[block % NR_HASH_QUEUES];
|
|
||||||
for (;;) {
|
|
||||||
struct buffer_head *tmp = next;
|
|
||||||
if (!next)
|
|
||||||
break;
|
|
||||||
next = tmp->b_hash_next;
|
|
||||||
if (tmp->b_blocknr != block || tmp->b_size != size || tmp->b_dev != dev)
|
|
||||||
continue;
|
|
||||||
next = tmp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return next;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static struct buffer_head * get_free_buffer (struct buffer_head **list,
|
|
||||||
unsigned long size)
|
|
||||||
{
|
|
||||||
struct buffer_head * next;
|
|
||||||
|
|
||||||
next = *list;
|
|
||||||
if (!next)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
if (!next)
|
|
||||||
die ("get_free_buffer: buffer list is corrupted");
|
|
||||||
if (next->b_count == 0 && buffer_clean (next) && next->b_size == size) {
|
|
||||||
remove_from_hash_queue (next);
|
|
||||||
remove_from_buffer_list (list, next);
|
|
||||||
return next;
|
|
||||||
}
|
|
||||||
next = next->b_next;
|
|
||||||
if (next == *list)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* 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, int dev, int to_write) {
|
|
||||||
struct buffer_head * next;
|
|
||||||
int written = 0;
|
|
||||||
|
|
||||||
|
|
||||||
restart:
|
|
||||||
next = *list;
|
|
||||||
if (!next)
|
|
||||||
return 0;
|
|
||||||
for (;;) {
|
|
||||||
if (!next)
|
|
||||||
die ("sync_buffers: buffer list is corrupted");
|
|
||||||
|
|
||||||
if (next->b_dev == dev && buffer_dirty (next) && buffer_uptodate (next)) {
|
|
||||||
if ((to_write == 0 || next->b_count == 0) && !buffer_do_not_flush (next)) {
|
|
||||||
bwrite (next);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if this buffer is reusable, put it onto the end of the free list */
|
|
||||||
if (next->b_count == 0 && buffer_clean(next)) {
|
|
||||||
remove_from_hash_queue (next);
|
|
||||||
remove_from_buffer_list (list, next);
|
|
||||||
put_buffer_list_end (&g_free_buffers, next);
|
|
||||||
written++ ;
|
|
||||||
if (written == to_write)
|
|
||||||
return written;
|
|
||||||
goto restart;
|
|
||||||
}
|
|
||||||
if (to_write && written >= to_write)
|
|
||||||
return written;
|
|
||||||
|
|
||||||
next = next->b_next;
|
|
||||||
if (next == *list)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return written;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void flush_buffers (int dev)
|
|
||||||
{
|
|
||||||
if (dev == -1)
|
|
||||||
die ("flush_buffers: device is not specified");
|
|
||||||
|
|
||||||
sync_buffers (&Buffer_list_head, dev, 0/*all*/);
|
|
||||||
buffer_soft_limit = BUFFER_SOFT_LIMIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
struct buffer_head * getblk (int dev, unsigned long block, int size)
|
|
||||||
{
|
|
||||||
struct buffer_head * bh;
|
|
||||||
|
|
||||||
bh = find_buffer (dev, block, size);
|
|
||||||
if (bh) {
|
|
||||||
/* move the buffer to the end of list */
|
|
||||||
|
|
||||||
/*checkmem (bh->b_data, bh->b_size);*/
|
|
||||||
|
|
||||||
remove_from_buffer_list (&Buffer_list_head, bh);
|
|
||||||
put_buffer_list_end (&Buffer_list_head, bh);
|
|
||||||
bh->b_count ++;
|
|
||||||
buffer_hits++ ;
|
|
||||||
return bh;
|
|
||||||
}
|
|
||||||
buffer_misses++ ;
|
|
||||||
|
|
||||||
bh = get_free_buffer (&g_free_buffers, size);
|
|
||||||
if (bh == NULL) {
|
|
||||||
if (buffers_memory >= buffer_soft_limit) {
|
|
||||||
if (sync_buffers (&Buffer_list_head, dev, 32) == 0) {
|
|
||||||
grow_buffers(size);
|
|
||||||
buffer_soft_limit = buffers_memory +
|
|
||||||
GROW_BUFFERS__NEW_BUFERS_PER_CALL * size;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (grow_buffers(size) == 0)
|
|
||||||
sync_buffers (&Buffer_list_head, dev, 32);
|
|
||||||
}
|
|
||||||
|
|
||||||
bh = get_free_buffer (&g_free_buffers, size);
|
|
||||||
if (bh == NULL) {
|
|
||||||
show_buffers (dev, size);
|
|
||||||
die ("getblk: no free buffers after grow_buffers "
|
|
||||||
"and refill (%d)", g_nr_buffers);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bh->b_count = 1;
|
|
||||||
bh->b_dev = dev;
|
|
||||||
bh->b_size = size;
|
|
||||||
bh->b_blocknr = block;
|
|
||||||
bh->b_end_io = NULL ;
|
|
||||||
memset (bh->b_data, 0, size);
|
|
||||||
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);
|
|
||||||
/*checkmem (bh->b_data, bh->b_size);*/
|
|
||||||
|
|
||||||
return bh;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void brelse (struct buffer_head * bh)
|
|
||||||
{
|
|
||||||
if (bh == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
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));*/
|
|
||||||
|
|
||||||
bh->b_count --;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void bforget (struct buffer_head * bh)
|
|
||||||
{
|
|
||||||
if (bh) {
|
|
||||||
bh->b_state = 0;
|
|
||||||
brelse (bh);
|
|
||||||
remove_from_hash_queue (bh);
|
|
||||||
remove_from_buffer_list(&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)
|
|
||||||
{
|
|
||||||
unsigned long long offset;
|
|
||||||
ssize_t bytes;
|
|
||||||
|
|
||||||
buffer_reads++ ;
|
|
||||||
|
|
||||||
offset = (unsigned long long)bh->b_size * bh->b_blocknr;
|
|
||||||
if (lseek (bh->b_dev, offset, SEEK_SET) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
bytes = read (bh->b_dev, bh->b_data, bh->b_size);
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
bh = getblk (dev, block, size);
|
|
||||||
|
|
||||||
/*checkmem (bh->b_data, get_mem_size(bh->b_data));*/
|
|
||||||
|
|
||||||
if (buffer_uptodate (bh))
|
|
||||||
return bh;
|
|
||||||
|
|
||||||
ret = f_read(bh);
|
|
||||||
|
|
||||||
if (ret > 0) {
|
|
||||||
die ("%s: End of file, cannot read the block (%lu).\n",
|
|
||||||
__FUNCTION__, block);
|
|
||||||
} 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__, block, strerror(errno));
|
|
||||||
} else {
|
|
||||||
fprintf (stderr, "%s: Cannot read the block (%lu): (%s).\n",
|
|
||||||
__FUNCTION__, block, strerror(errno));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mark_buffer_uptodate (bh, 0);
|
|
||||||
return bh;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ROLLBACK_FILE_START_MAGIC "_RollBackFileForReiserfsFSCK"
|
|
||||||
|
|
||||||
static struct block_handler * rollback_blocks_array;
|
|
||||||
static __u32 rollback_blocks_number = 0;
|
|
||||||
static FILE * s_rollback_file = 0;
|
|
||||||
static FILE * log_file;
|
|
||||||
static int do_rollback = 0;
|
|
||||||
|
|
||||||
static char * rollback_data;
|
|
||||||
static int rollback_blocksize;
|
|
||||||
|
|
||||||
void init_rollback_file (char * rollback_file, int *blocksize, FILE * log) {
|
|
||||||
char * string;
|
|
||||||
struct stat buf;
|
|
||||||
|
|
||||||
if (rollback_file == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
stat(rollback_file, &buf);
|
|
||||||
|
|
||||||
s_rollback_file = fopen (rollback_file, "w+");
|
|
||||||
if (s_rollback_file == NULL) {
|
|
||||||
fprintf (stderr, "Cannot create file %s, work without a rollback file\n", rollback_file);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
rollback_blocksize = *blocksize;
|
|
||||||
|
|
||||||
string = ROLLBACK_FILE_START_MAGIC;
|
|
||||||
fwrite (string, 28, 1, s_rollback_file);
|
|
||||||
fwrite (&rollback_blocksize, sizeof (rollback_blocksize), 1, s_rollback_file);
|
|
||||||
fwrite (&rollback_blocks_number, sizeof (rollback_blocks_number), 1, s_rollback_file);
|
|
||||||
fflush(s_rollback_file);
|
|
||||||
|
|
||||||
rollback_data = getmem(rollback_blocksize);
|
|
||||||
|
|
||||||
// printf("\ncheckmem1");
|
|
||||||
// fflush (stdout);
|
|
||||||
// checkmem (rollback_data, get_mem_size((char *)rollback_data));
|
|
||||||
// printf(" OK");
|
|
||||||
|
|
||||||
log_file = log;
|
|
||||||
if (log_file)
|
|
||||||
fprintf (log_file, "rollback: file (%s) initialize\n", rollback_file);
|
|
||||||
|
|
||||||
do_rollback = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void erase_rollback_file (char * rollback_file) {
|
|
||||||
close_rollback_file ();
|
|
||||||
unlink (rollback_file);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int open_rollback_file (char * rollback_file, FILE * log) {
|
|
||||||
char string [28];
|
|
||||||
struct stat buf;
|
|
||||||
|
|
||||||
if (rollback_file == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (stat(rollback_file, &buf)) {
|
|
||||||
fprintf (stderr, "Cannot stat rollback file (%s)\n", rollback_file);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_rollback_file = fopen (rollback_file, "r+");
|
|
||||||
if (s_rollback_file == NULL) {
|
|
||||||
fprintf (stderr, "Cannot open file (%s)\n", rollback_file);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fread (string, 28, 1, s_rollback_file);
|
|
||||||
if (!strcmp (string, ROLLBACK_FILE_START_MAGIC)) {
|
|
||||||
fprintf (stderr, "Specified file (%s) does not look like a rollback file\n", rollback_file);
|
|
||||||
fclose (s_rollback_file);
|
|
||||||
s_rollback_file = 0;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fread (&rollback_blocksize, sizeof (rollback_blocksize), 1, s_rollback_file);
|
|
||||||
|
|
||||||
if (rollback_blocksize <= 0) {
|
|
||||||
fprintf(stderr, "rollback: wrong rollback blocksize, exit\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
log_file = log;
|
|
||||||
if (log_file)
|
|
||||||
fprintf (log_file, "rollback: file (%s) opened\n", rollback_file);
|
|
||||||
|
|
||||||
do_rollback = 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void close_rollback_file () {
|
|
||||||
if (s_rollback_file == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!do_rollback) {
|
|
||||||
if (fseek (s_rollback_file, 28 + sizeof(int), SEEK_SET) == (loff_t)-1)
|
|
||||||
return;
|
|
||||||
fwrite (&rollback_blocks_number, sizeof (rollback_blocksize), 1, s_rollback_file);
|
|
||||||
if (log_file != 0)
|
|
||||||
fprintf (log_file, "rollback: %d blocks backed up\n", rollback_blocks_number);
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (s_rollback_file);
|
|
||||||
|
|
||||||
freemem (rollback_data);
|
|
||||||
freemem (rollback_blocks_array);
|
|
||||||
|
|
||||||
// fprintf (stdout, "rollback: (%u) blocks saved, \n", rollback_blocks_number);
|
|
||||||
|
|
||||||
/* for (i = 0; i < rollback_blocks_number; i++)
|
|
||||||
fprintf(stdout, "device (%Lu), block number (%u)\n",
|
|
||||||
rollback_blocks_array [i].device,
|
|
||||||
rollback_blocks_array [i].blocknr);
|
|
||||||
fprintf(stdout, "\n");
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void do_fsck_rollback (int fd_device, int fd_journal_device, FILE * progress) {
|
|
||||||
long long int offset;
|
|
||||||
|
|
||||||
struct stat buf;
|
|
||||||
int descriptor;
|
|
||||||
ssize_t retval;
|
|
||||||
int count_failed = 0;
|
|
||||||
int count_rollbacked = 0;
|
|
||||||
|
|
||||||
int b_dev;
|
|
||||||
int n_dev = 0;
|
|
||||||
int n_journal_dev = 0;
|
|
||||||
unsigned long total, done = 0;
|
|
||||||
|
|
||||||
if (fd_device == 0) {
|
|
||||||
fprintf(stderr, "rollback: unspecified device, exit\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fd_journal_device) {
|
|
||||||
if (!fstat (fd_journal_device, &buf)) {
|
|
||||||
n_journal_dev = buf.st_rdev;
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "rollback: specified journal device cannot be stated\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fstat (fd_device, &buf)) {
|
|
||||||
n_dev = buf.st_rdev;
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "rollback: specified device cannot be stated, exit\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
rollback_data = getmem (rollback_blocksize);
|
|
||||||
// printf("\ncheckmem2");
|
|
||||||
// fflush (stdout);
|
|
||||||
// checkmem (rollback_data, get_mem_size((char *)rollback_data));
|
|
||||||
// printf(" OK");
|
|
||||||
|
|
||||||
fread (&rollback_blocks_number, sizeof (rollback_blocks_number), 1, s_rollback_file);
|
|
||||||
|
|
||||||
total = rollback_blocks_number;
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
print_how_far (progress, &done, rollback_blocks_number, 1, 0/*not quiet*/);
|
|
||||||
|
|
||||||
descriptor = 0;
|
|
||||||
if ((retval = fread (&b_dev, sizeof (b_dev), 1, s_rollback_file)) <= 0) {
|
|
||||||
if (retval)
|
|
||||||
fprintf (stderr, "rollback: fread: %s\n", strerror (errno));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ((retval = fread (&offset, sizeof (offset), 1, s_rollback_file)) <= 0) {
|
|
||||||
if (retval)
|
|
||||||
fprintf (stderr, "rollback: fread: %s\n", strerror (errno));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((retval = fread (rollback_data, rollback_blocksize, 1, s_rollback_file)) <= 0) {
|
|
||||||
if (retval)
|
|
||||||
fprintf (stderr, "rollback: fread: %s\n", strerror (errno));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n_dev == b_dev)
|
|
||||||
descriptor = fd_device;
|
|
||||||
if ((n_journal_dev) && (n_journal_dev == b_dev))
|
|
||||||
descriptor = fd_journal_device;
|
|
||||||
|
|
||||||
if (descriptor == 0) {
|
|
||||||
fprintf(stderr, "rollback: block from unknown device, skip block\n");
|
|
||||||
count_failed ++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lseek (descriptor, offset, SEEK_SET) == (loff_t)-1) {
|
|
||||||
fprintf(stderr, "device cannot be lseeked, skip block\n");
|
|
||||||
count_failed ++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (write (descriptor, rollback_data, rollback_blocksize) == -1) {
|
|
||||||
fprintf (stderr, "rollback: write %d bytes returned error "
|
|
||||||
"(block=%lld, dev=%d): %s\n", rollback_blocksize,
|
|
||||||
offset/rollback_blocksize, b_dev, strerror (errno));
|
|
||||||
count_failed ++;
|
|
||||||
} else {
|
|
||||||
count_rollbacked ++;
|
|
||||||
/*if you want to know what gets rollbacked, uncomment it*/
|
|
||||||
/* if (log_file != 0 && log_file != stdout)
|
|
||||||
fprintf (log_file, "rollback: block %Lu of device %Lu was restored\n",
|
|
||||||
(loff_t)offset/rollback_blocksize, b_dev);
|
|
||||||
*/
|
|
||||||
// fprintf (stdout, "rollback: block (%Ld) written\n", (loff_t)offset/rollback_blocksize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printf ("\n");
|
|
||||||
if (log_file != 0)
|
|
||||||
fprintf (log_file, "rollback: (%u) blocks restored\n", count_rollbacked);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
static void rollback__mark_block_saved (struct block_handler * rb_e) {
|
|
||||||
if (rollback_blocks_array == NULL)
|
|
||||||
rollback_blocks_array = getmem (ROLLBACK__INCREASE_BLOCK_NUMBER * sizeof (*rb_e));
|
|
||||||
|
|
||||||
if (rollback_blocks_number == get_mem_size ((void *)rollback_blocks_array) / sizeof (*rb_e))
|
|
||||||
rollback_blocks_array = expandmem (rollback_blocks_array, get_mem_size((void *)rollback_blocks_array),
|
|
||||||
ROLLBACK__INCREASE_BLOCK_NUMBER * sizeof (*rb_e));
|
|
||||||
|
|
||||||
// checkmem ((char *)rollback_blocks_array, get_mem_size((char *)rollback_blocks_array));
|
|
||||||
|
|
||||||
rollback_blocks_array[rollback_blocks_number] = *rb_e;
|
|
||||||
rollback_blocks_number ++;
|
|
||||||
qsort (rollback_blocks_array, rollback_blocks_number, sizeof (*rb_e), rollback_compare);
|
|
||||||
|
|
||||||
// printf("\ncheckmem3");
|
|
||||||
// fflush (stdout);
|
|
||||||
// checkmem ((char *)rollback_blocks_array, get_mem_size((char *)rollback_blocks_array));
|
|
||||||
// printf(" OK");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/* for now - just make sure that bad blocks did not get here */
|
|
||||||
int bwrite (struct buffer_head * bh)
|
|
||||||
{
|
|
||||||
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",
|
|
||||||
bh->b_blocknr);
|
|
||||||
exit(8);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!buffer_dirty (bh) || !buffer_uptodate (bh))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
buffer_writes++ ;
|
|
||||||
if (bh->b_start_io)
|
|
||||||
/* this is used by undo feature of reiserfsck */
|
|
||||||
bh->b_start_io (bh->b_blocknr);
|
|
||||||
|
|
||||||
size = bh->b_size;
|
|
||||||
offset = (loff_t)size * (loff_t)bh->b_blocknr;
|
|
||||||
|
|
||||||
if (lseek (bh->b_dev, offset, SEEK_SET) == (loff_t)-1){
|
|
||||||
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 == (unsigned long)rollback_blocksize) {
|
|
||||||
struct stat buf;
|
|
||||||
__u32 position;
|
|
||||||
struct block_handler block_h;
|
|
||||||
|
|
||||||
/*log previous content into the log*/
|
|
||||||
if (!fstat (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)
|
|
||||||
{
|
|
||||||
/*read initial data from the disk*/
|
|
||||||
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),
|
|
||||||
&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);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
} else {
|
|
||||||
fprintf (stderr, "bwrite: read (block=%lu, dev=%d): %s\n",
|
|
||||||
bh->b_blocknr, bh->b_dev, strerror (errno));
|
|
||||||
exit(8);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lseek (bh->b_dev, offset, SEEK_SET) == (loff_t)-1) {
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
} 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
mark_buffer_clean (bh);
|
|
||||||
|
|
||||||
if (bh->b_end_io) {
|
|
||||||
bh->b_end_io(bh, 1) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int _check_and_free_buffer_list(struct buffer_head *list) {
|
|
||||||
struct buffer_head *next = list ;
|
|
||||||
int count = 0 ;
|
|
||||||
if (!list)
|
|
||||||
return 0 ;
|
|
||||||
|
|
||||||
for(;;) {
|
|
||||||
if (next->b_count != 0)
|
|
||||||
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 "
|
|
||||||
"(%d %lu) found\n", next->b_dev, next->b_blocknr);
|
|
||||||
|
|
||||||
freemem (next->b_data);
|
|
||||||
count++;
|
|
||||||
next = next->b_next;
|
|
||||||
if (next == list)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void check_and_free_buffer_mem (void)
|
|
||||||
{
|
|
||||||
int count = 0;
|
|
||||||
struct buffer_head * next ;
|
|
||||||
|
|
||||||
// printf("check and free buffer mem, hits %d misses %d reads %d writes %d\n",
|
|
||||||
// buffer_hits, buffer_misses, buffer_reads, buffer_writes) ;
|
|
||||||
/*sync_buffers (0, 0);*/
|
|
||||||
|
|
||||||
count = _check_and_free_buffer_list(Buffer_list_head);
|
|
||||||
count += _check_and_free_buffer_list(g_free_buffers);
|
|
||||||
|
|
||||||
if (count != g_nr_buffers)
|
|
||||||
die ("check_and_free_buffer_mem: found %d buffers, must be %d",
|
|
||||||
count, g_nr_buffers);
|
|
||||||
|
|
||||||
/* free buffer heads */
|
|
||||||
while ((next = g_buffer_heads)) {
|
|
||||||
g_buffer_heads = *(struct buffer_head **)
|
|
||||||
(next + GROW_BUFFERS__NEW_BUFERS_PER_CALL);
|
|
||||||
|
|
||||||
freemem (next);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* */
|
|
||||||
void free_buffers (void)
|
|
||||||
{
|
|
||||||
check_and_free_buffer_mem ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void _invalidate_buffer_list(struct buffer_head *list, int dev)
|
|
||||||
{
|
|
||||||
struct buffer_head * next;
|
|
||||||
|
|
||||||
if (!list)
|
|
||||||
return;
|
|
||||||
|
|
||||||
next = list;
|
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
if (next->b_dev == dev) {
|
|
||||||
if (buffer_dirty (next) || next->b_count)
|
|
||||||
fprintf (stderr, "invalidate_buffers: dirty buffer or used buffer (%d %lu) found\n",
|
|
||||||
next->b_count, next->b_blocknr);
|
|
||||||
next->b_state = 0;
|
|
||||||
remove_from_hash_queue (next);
|
|
||||||
}
|
|
||||||
next = next->b_next;
|
|
||||||
if (next == list)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* forget all buffers of the given device */
|
|
||||||
void invalidate_buffers (int dev)
|
|
||||||
{
|
|
||||||
_invalidate_buffer_list(Buffer_list_head, dev) ;
|
|
||||||
_invalidate_buffer_list(g_free_buffers, dev) ;
|
|
||||||
}
|
|
||||||
-986
@@ -1,986 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
|
||||||
* reiserfsprogs/README
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
|
||||||
|
|
||||||
#include "misc.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <mntent.h>
|
|
||||||
#include <sys/vfs.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <utime.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <linux/hdreg.h>
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* Debian modifications by Ed Boraas <ed@debian.org> */
|
|
||||||
#include <sys/mount.h>
|
|
||||||
/* End Debian mods */
|
|
||||||
|
|
||||||
#define STAT_FIELD(Field, Type) \
|
|
||||||
inline Type misc_device_##Field(char *device) { \
|
|
||||||
struct stat st; \
|
|
||||||
\
|
|
||||||
if (stat(device, &st) == 0) \
|
|
||||||
return st.st_##Field; \
|
|
||||||
\
|
|
||||||
fprintf(stderr, "Stat of the device '%s' failed.", device); \
|
|
||||||
exit(8); \
|
|
||||||
}
|
|
||||||
|
|
||||||
STAT_FIELD(mode, mode_t);
|
|
||||||
STAT_FIELD(rdev, dev_t);
|
|
||||||
STAT_FIELD(size, off_t);
|
|
||||||
STAT_FIELD(blocks, blkcnt_t);
|
|
||||||
|
|
||||||
void die (char * fmt, ...)
|
|
||||||
{
|
|
||||||
static char buf[1024];
|
|
||||||
va_list args;
|
|
||||||
|
|
||||||
va_start (args, fmt);
|
|
||||||
vsprintf (buf, fmt, args);
|
|
||||||
va_end (args);
|
|
||||||
|
|
||||||
fprintf (stderr, "\n%s\n", buf);
|
|
||||||
abort ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define MEM_BEGIN "_mem_begin_"
|
|
||||||
#define MEM_END "mem_end"
|
|
||||||
#define MEM_FREED "__free_"
|
|
||||||
#define CONTROL_SIZE (strlen (MEM_BEGIN) + 1 + sizeof (int) + strlen (MEM_END) + 1)
|
|
||||||
|
|
||||||
|
|
||||||
unsigned int get_mem_size(char *p) {
|
|
||||||
char *begin;
|
|
||||||
|
|
||||||
begin = p - strlen (MEM_BEGIN) - 1 - sizeof(int);
|
|
||||||
return *(int *)(begin + strlen (MEM_BEGIN) + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void checkmem (char * p, int size)
|
|
||||||
{
|
|
||||||
char * begin;
|
|
||||||
char * end;
|
|
||||||
|
|
||||||
begin = p - strlen (MEM_BEGIN) - 1 - sizeof (int);
|
|
||||||
if (strcmp (begin, MEM_BEGIN))
|
|
||||||
die ("checkmem: memory corrupted - invalid head sign");
|
|
||||||
|
|
||||||
if (*(int *)(begin + strlen (MEM_BEGIN) + 1) != size)
|
|
||||||
die ("checkmem: memory corrupted - invalid size");
|
|
||||||
|
|
||||||
end = begin + size + CONTROL_SIZE - strlen (MEM_END) - 1;
|
|
||||||
if (strcmp (end, MEM_END))
|
|
||||||
die ("checkmem: memory corrupted - invalid end sign");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
p = (char *)malloc (CONTROL_SIZE + 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;
|
|
||||||
p += size;
|
|
||||||
strcpy (p, MEM_END);
|
|
||||||
|
|
||||||
return mem;
|
|
||||||
}
|
|
||||||
|
|
||||||
void * expandmem (void * vp, int size, int by)
|
|
||||||
{
|
|
||||||
int allocated;
|
|
||||||
char * mem, * p = vp;
|
|
||||||
int expand_by = by;
|
|
||||||
|
|
||||||
if (p) {
|
|
||||||
checkmem (p, size);
|
|
||||||
allocated = CONTROL_SIZE + size;
|
|
||||||
p -= (strlen (MEM_BEGIN) + 1 + sizeof (int));
|
|
||||||
} else {
|
|
||||||
allocated = 0;
|
|
||||||
/* add control bytes to the new allocated area */
|
|
||||||
expand_by += CONTROL_SIZE;
|
|
||||||
}
|
|
||||||
p = realloc (p, allocated + expand_by);
|
|
||||||
if (!p)
|
|
||||||
die ("expandmem: no more memory (%d)", size);
|
|
||||||
if (!vp) {
|
|
||||||
strcpy (p, MEM_BEGIN);
|
|
||||||
}
|
|
||||||
mem = p + strlen (MEM_BEGIN) + 1 + sizeof (int);
|
|
||||||
|
|
||||||
*(int *)(p + strlen (MEM_BEGIN) + 1) = size + by;
|
|
||||||
/* fill new allocated area by 0s */
|
|
||||||
if(by > 0)
|
|
||||||
memset (mem + size, 0, by);
|
|
||||||
strcpy (mem + size + by, MEM_END);
|
|
||||||
// checkmem (mem, size + by);
|
|
||||||
|
|
||||||
return mem;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void freemem (void * vp)
|
|
||||||
{
|
|
||||||
char * p = vp;
|
|
||||||
int size;
|
|
||||||
|
|
||||||
if (!p)
|
|
||||||
return;
|
|
||||||
size = get_mem_size (vp);
|
|
||||||
checkmem (p, size);
|
|
||||||
|
|
||||||
p -= (strlen (MEM_BEGIN) + 1 + sizeof (int));
|
|
||||||
strcpy (p, MEM_FREED);
|
|
||||||
strcpy (p + size + CONTROL_SIZE - strlen (MEM_END) - 1, MEM_FREED);
|
|
||||||
free (p);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
typedef int (*func_t) (char *);
|
|
||||||
|
|
||||||
/* Lookup the @file in the @mntfile. @file is mntent.mnt_fsname if @fsname
|
|
||||||
is set; mntent.mnt_dir otherwise. Return the mnt entry from the @mntfile.
|
|
||||||
|
|
||||||
Warning: if the root fs is mounted RO, the content of /etc/mtab may be
|
|
||||||
not correct. */
|
|
||||||
static struct mntent *misc_mntent_lookup(char *mntfile,
|
|
||||||
char *file,
|
|
||||||
int path)
|
|
||||||
{
|
|
||||||
struct mntent *mnt;
|
|
||||||
int name_match = 0;
|
|
||||||
struct stat st;
|
|
||||||
dev_t rdev = 0;
|
|
||||||
dev_t dev = 0;
|
|
||||||
ino_t ino = 0;
|
|
||||||
char *name;
|
|
||||||
FILE *fp;
|
|
||||||
|
|
||||||
assert(mntfile != NULL);
|
|
||||||
assert(file != NULL);
|
|
||||||
|
|
||||||
if (stat(file, &st) == 0) {
|
|
||||||
/* Devices is stated. */
|
|
||||||
if (S_ISBLK(st.st_mode)) {
|
|
||||||
rdev = st.st_rdev;
|
|
||||||
} else {
|
|
||||||
dev = st.st_dev;
|
|
||||||
ino = st.st_ino;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((fp = setmntent(mntfile, "r")) == NULL)
|
|
||||||
return INVAL_PTR;
|
|
||||||
|
|
||||||
while ((mnt = getmntent(fp)) != NULL) {
|
|
||||||
/* Check if names match. */
|
|
||||||
name = path ? mnt->mnt_dir : mnt->mnt_fsname;
|
|
||||||
|
|
||||||
if (strcmp(file, name) == 0)
|
|
||||||
name_match = 1;
|
|
||||||
|
|
||||||
if (stat(name, &st))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* If names do not match, check if stats match. */
|
|
||||||
if (!name_match) {
|
|
||||||
if (rdev && S_ISBLK(st.st_mode)) {
|
|
||||||
if (rdev != st.st_rdev)
|
|
||||||
continue;
|
|
||||||
} else if (dev && !S_ISBLK(st.st_mode)) {
|
|
||||||
if (dev != st.st_dev ||
|
|
||||||
ino != st.st_ino)
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If not path and not block device do not check anything more. */
|
|
||||||
if (!path && !rdev)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (path) {
|
|
||||||
/* Either names or stats match. Make sure the st_dev of
|
|
||||||
the path is same as @mnt_fsname device rdev. */
|
|
||||||
if (stat(mnt->mnt_fsname, &st) == 0 &&
|
|
||||||
dev == st.st_rdev)
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
/* Either names or stats match. Make sure the st_dev of
|
|
||||||
the mount entry is same as the given device rdev. */
|
|
||||||
if (stat(mnt->mnt_dir, &st) == 0 &&
|
|
||||||
rdev == st.st_dev)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
endmntent (fp);
|
|
||||||
return mnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int misc_root_mounted(char *device) {
|
|
||||||
struct stat rootst, devst;
|
|
||||||
|
|
||||||
assert(device != NULL);
|
|
||||||
|
|
||||||
if (stat("/", &rootst) != 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (stat(device, &devst) != 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (!S_ISBLK(devst.st_mode) ||
|
|
||||||
devst.st_rdev != rootst.st_dev)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int misc_file_ro(char *file) {
|
|
||||||
if (utime(file, 0) == -1) {
|
|
||||||
if (errno == EROFS)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct mntent *misc_mntent(char *device) {
|
|
||||||
int proc = 0, path = 0, root = 0;
|
|
||||||
|
|
||||||
struct mntent *mnt;
|
|
||||||
struct statfs stfs;
|
|
||||||
|
|
||||||
assert(device != NULL);
|
|
||||||
|
|
||||||
/* Check if the root. */
|
|
||||||
if (misc_root_mounted(device) == 1)
|
|
||||||
root = 1;
|
|
||||||
|
|
||||||
#ifdef __linux__
|
|
||||||
/* Check if /proc is procfs. */
|
|
||||||
if (statfs("/proc", &stfs) == 0 && stfs.f_type == 0x9fa0) {
|
|
||||||
proc = 1;
|
|
||||||
|
|
||||||
if (root) {
|
|
||||||
/* Lookup the "/" entry in /proc/mounts. Special
|
|
||||||
case as root entry can present as:
|
|
||||||
rootfs / rootfs rw 0 0
|
|
||||||
Look up the mount point in this case. */
|
|
||||||
mnt = misc_mntent_lookup("/proc/mounts", "/", 1);
|
|
||||||
} else {
|
|
||||||
/* Lookup the @device /proc/mounts */
|
|
||||||
mnt = misc_mntent_lookup("/proc/mounts", device, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mnt == INVAL_PTR)
|
|
||||||
proc = 0;
|
|
||||||
else if (mnt)
|
|
||||||
return mnt;
|
|
||||||
}
|
|
||||||
#endif /* __linux__ */
|
|
||||||
|
|
||||||
#if defined(MOUNTED) || defined(_PATH_MOUNTED)
|
|
||||||
|
|
||||||
#ifndef MOUNTED
|
|
||||||
#define MOUNTED _PATH_MOUNTED
|
|
||||||
#endif
|
|
||||||
/* Check in MOUNTED (/etc/mtab) if RW. */
|
|
||||||
if (!misc_file_ro(MOUNTED)) {
|
|
||||||
path = 1;
|
|
||||||
|
|
||||||
if (root) {
|
|
||||||
mnt = misc_mntent_lookup(MOUNTED, "/", 1);
|
|
||||||
} else {
|
|
||||||
mnt = misc_mntent_lookup(MOUNTED, device, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mnt == INVAL_PTR)
|
|
||||||
path = 0;
|
|
||||||
else if (mnt)
|
|
||||||
return mnt;
|
|
||||||
}
|
|
||||||
#endif /* defined(MOUNTED) || defined(_PATH_MOUNTED) */
|
|
||||||
|
|
||||||
/* If has not been checked in neither /proc/mounts nor /etc/mtab (or
|
|
||||||
errors have occured), return INVAL_PTR, NULL otherwise. */
|
|
||||||
return (!proc && !path) ? INVAL_PTR : NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int misc_device_mounted(char *device) {
|
|
||||||
struct mntent *mnt;
|
|
||||||
|
|
||||||
/* Check for the "/" first to avoid any possible problem with
|
|
||||||
reflecting the root fs info in mtab files. */
|
|
||||||
if (misc_root_mounted(device) == 1) {
|
|
||||||
return misc_file_ro("/") ? MF_RO : MF_RW;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Lookup the mount entry. */
|
|
||||||
if ((mnt = misc_mntent(device)) == NULL) {
|
|
||||||
return MF_NOT_MOUNTED;
|
|
||||||
} else if (mnt == INVAL_PTR) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return hasmntopt(mnt, MNTOPT_RO) ? MF_RO : MF_RW;
|
|
||||||
}
|
|
||||||
|
|
||||||
char buf1 [100];
|
|
||||||
char buf2 [100];
|
|
||||||
|
|
||||||
void print_how_fast (unsigned long passed, unsigned long total,
|
|
||||||
int cursor_pos, int reset_time)
|
|
||||||
{
|
|
||||||
static time_t t0 = 0, t1 = 0, t2 = 0;
|
|
||||||
int speed;
|
|
||||||
int indent;
|
|
||||||
|
|
||||||
if (reset_time)
|
|
||||||
time (&t0);
|
|
||||||
|
|
||||||
time (&t1);
|
|
||||||
if (t1 != t0) {
|
|
||||||
speed = passed / (t1 - t0);
|
|
||||||
if (total - passed) {
|
|
||||||
if (t1 - t2 < 1)
|
|
||||||
return;
|
|
||||||
t2 = t1;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
speed = 0;
|
|
||||||
|
|
||||||
/* what has to be written */
|
|
||||||
if (total)
|
|
||||||
sprintf (buf1, "left %lu, %d /sec", total - passed, speed);
|
|
||||||
else {
|
|
||||||
/*(*passed) ++;*/
|
|
||||||
sprintf (buf1, "done %lu, %d /sec", passed, speed);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* make indent */
|
|
||||||
indent = 79 - cursor_pos - strlen (buf1);
|
|
||||||
memset (buf2, ' ', indent);
|
|
||||||
buf2[indent] = 0;
|
|
||||||
fprintf (stderr, "%s%s", buf2, buf1);
|
|
||||||
|
|
||||||
memset (buf2, '\b', indent + strlen (buf1));
|
|
||||||
buf2 [indent + strlen (buf1)] = 0;
|
|
||||||
fprintf (stderr, "%s", buf2);
|
|
||||||
fflush (stderr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static char * strs[] =
|
|
||||||
{"0%",".",".",".",".","20%",".",".",".",".","40%",".",".",".",".","60%",".",".",".",".","80%",".",".",".",".","100%"};
|
|
||||||
|
|
||||||
static char progress_to_be[1024];
|
|
||||||
static char current_progress[1024];
|
|
||||||
|
|
||||||
static void str_to_be (char * buf, int prosents)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
prosents -= prosents % 4;
|
|
||||||
buf[0] = 0;
|
|
||||||
for (i = 0; i <= prosents / 4; i ++)
|
|
||||||
strcat (buf, strs[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void print_how_far (FILE * fp,
|
|
||||||
unsigned long * passed, unsigned long total,
|
|
||||||
unsigned int inc, int quiet)
|
|
||||||
{
|
|
||||||
int percent;
|
|
||||||
|
|
||||||
if (*passed == 0)
|
|
||||||
current_progress[0] = 0;
|
|
||||||
|
|
||||||
(*passed) += inc;
|
|
||||||
if (*passed > total) {
|
|
||||||
/* fprintf (fp, "\nprint_how_far: total %lu has been reached already. cur=%lu\n",
|
|
||||||
total, *passed);*/
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
percent = ((*passed) * 100) / total;
|
|
||||||
|
|
||||||
str_to_be (progress_to_be, percent);
|
|
||||||
|
|
||||||
if (strlen (current_progress) != strlen (progress_to_be)) {
|
|
||||||
fprintf (fp, "%s", progress_to_be + strlen (current_progress));
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
fflush (fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(__linux__) && defined(_IOR) && !defined(BLKGETSIZE64)
|
|
||||||
/* Note! Despite this call being called with *64, it must be encoded to
|
|
||||||
* return only sizeof(size_t), since in earlier kernel versions it was
|
|
||||||
* declared _IOR(0x12, 114, sizeof(u64)), making it use sizeof(sizeof(u64)).
|
|
||||||
*
|
|
||||||
* However, the call itself does always return 64bit!
|
|
||||||
*/
|
|
||||||
# define BLKGETSIZE64 _IOR(0x12, 114, size_t)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* To not have problem with last sectors on the block device when switching
|
|
||||||
to smaller one. */
|
|
||||||
#define MAX_BS (64 * 1024)
|
|
||||||
|
|
||||||
int valid_offset( int fd, loff_t offset) {
|
|
||||||
char ch;
|
|
||||||
loff_t res;
|
|
||||||
|
|
||||||
/*res = reiserfs_llseek (fd, offset, 0);*/
|
|
||||||
res = lseek (fd, offset, SEEK_SET);
|
|
||||||
if (res < 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* if (read (fd, &ch, 1) < 0) does not wirk on files */
|
|
||||||
if (read (fd, &ch, 1) < 1)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* calculates number of blocks in a file. Returns 0 for "sparse"
|
|
||||||
regular files and files other than regular files and block devices */
|
|
||||||
unsigned long count_blocks (char * filename, int blocksize)
|
|
||||||
{
|
|
||||||
loff_t high, low;
|
|
||||||
unsigned long sz;
|
|
||||||
__u64 size;
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
if (!S_ISBLK(misc_device_mode(filename)) &&
|
|
||||||
!S_ISREG(misc_device_mode(filename)))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
fd = open (filename, O_RDONLY);
|
|
||||||
if (fd == -1) {
|
|
||||||
fprintf(stderr, "Failed to open '%s': %s.\n", filename, strerror(errno));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef BLKGETSIZE64
|
|
||||||
{
|
|
||||||
if (ioctl (fd, BLKGETSIZE64, &size) >= 0) {
|
|
||||||
size = (size / MAX_BS) * MAX_BS / blocksize;
|
|
||||||
sz = size;
|
|
||||||
if ((__u64)sz != size)
|
|
||||||
die ("count_blocks: block device too large");
|
|
||||||
|
|
||||||
close(fd);
|
|
||||||
return sz;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef BLKGETSIZE
|
|
||||||
{
|
|
||||||
if (ioctl (fd, BLKGETSIZE, &sz) >= 0) {
|
|
||||||
size = sz;
|
|
||||||
|
|
||||||
close(fd);
|
|
||||||
return (size * 512 / MAX_BS) * MAX_BS / blocksize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
low = 0;
|
|
||||||
for( high = 1; valid_offset (fd, high); high *= 2 )
|
|
||||||
low = high;
|
|
||||||
while (low < high - 1) {
|
|
||||||
const loff_t mid = ( low + high ) / 2;
|
|
||||||
|
|
||||||
if (valid_offset (fd, mid))
|
|
||||||
low = mid;
|
|
||||||
else
|
|
||||||
high = mid;
|
|
||||||
}
|
|
||||||
|
|
||||||
valid_offset (fd, 0);
|
|
||||||
|
|
||||||
close (fd);
|
|
||||||
return (low + 1) * MAX_BS / MAX_BS / blocksize;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* there are masks for certain bits */
|
|
||||||
__u16 mask16 (int from, int count)
|
|
||||||
{
|
|
||||||
__u16 mask;
|
|
||||||
|
|
||||||
|
|
||||||
mask = (0xffff >> from);
|
|
||||||
mask <<= from;
|
|
||||||
mask <<= (16 - from - count);
|
|
||||||
mask >>= (16 - from - count);
|
|
||||||
return mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
__u32 mask32 (int from, int count)
|
|
||||||
{
|
|
||||||
__u32 mask;
|
|
||||||
|
|
||||||
|
|
||||||
mask = (0xffffffff >> from);
|
|
||||||
mask <<= from;
|
|
||||||
mask <<= (32 - from - count);
|
|
||||||
mask >>= (32 - from - count);
|
|
||||||
return mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
__u64 mask64 (int from, int count)
|
|
||||||
{
|
|
||||||
__u64 mask;
|
|
||||||
|
|
||||||
|
|
||||||
mask = (0xffffffffffffffffLL >> from);
|
|
||||||
mask <<= from;
|
|
||||||
mask <<= (64 - from - count);
|
|
||||||
mask >>= (64 - from - count);
|
|
||||||
return mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
__u32 get_random (void)
|
|
||||||
{
|
|
||||||
srandom (time (0));
|
|
||||||
return random ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* this implements binary search in the array 'base' among 'num' elements each
|
|
||||||
of those is 'width' bytes long. 'comp_func' is used to compare keys */
|
|
||||||
int reiserfs_bin_search (void * key, void * base, __u32 num, int width,
|
|
||||||
__u32 * ppos, comparison_fn_t comp_func)
|
|
||||||
{
|
|
||||||
__u32 rbound, lbound, j;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (num == 0 || base == NULL) {
|
|
||||||
/* objectid map may be 0 elements long */
|
|
||||||
*ppos = 0;
|
|
||||||
return POSITION_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
lbound = 0;
|
|
||||||
rbound = num - 1;
|
|
||||||
|
|
||||||
for (j = (rbound + lbound) / 2; lbound <= rbound; j = (rbound + lbound) / 2) {
|
|
||||||
ret = comp_func ((void *)((char *)base + j * width), key ) ;
|
|
||||||
if (ret < 0) { /* second is greater */
|
|
||||||
lbound = j + 1;
|
|
||||||
continue;
|
|
||||||
|
|
||||||
} else if (ret > 0) { /* first is greater */
|
|
||||||
if (j == 0)
|
|
||||||
break;
|
|
||||||
rbound = j - 1;
|
|
||||||
continue;
|
|
||||||
} else { /* equal */
|
|
||||||
*ppos = j;
|
|
||||||
return POSITION_FOUND;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*ppos = lbound;
|
|
||||||
return POSITION_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define BLOCKLIST__ELEMENT_NUMBER 10
|
|
||||||
|
|
||||||
/*element is block number and device*/
|
|
||||||
int blockdev_list_compare (const void * block1, const void * block2) {
|
|
||||||
if (*(__u32 *)block1 < *(__u32 *)block2)
|
|
||||||
return -1;
|
|
||||||
if (*(__u32 *)block1 > *(__u32 *)block2)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
if (*((__u32 *)block1 + 1) < *((__u32 *)block2 + 1))
|
|
||||||
return -1;
|
|
||||||
if (*((__u32 *)block1 + 1) > *((__u32 *)block2 + 1))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void blocklist__insert_in_position (void *elem, void **base, __u32 *count,
|
|
||||||
int elem_size, __u32 *position)
|
|
||||||
{
|
|
||||||
if (elem_size == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (*base == NULL)
|
|
||||||
*base = getmem (BLOCKLIST__ELEMENT_NUMBER * elem_size);
|
|
||||||
|
|
||||||
if (*count == get_mem_size((void *)*base) / elem_size)
|
|
||||||
*base = expandmem (*base, get_mem_size((void *)*base),
|
|
||||||
BLOCKLIST__ELEMENT_NUMBER * elem_size);
|
|
||||||
|
|
||||||
if (*position < *count) {
|
|
||||||
memmove (*base + (*position + 1),
|
|
||||||
*base + (*position),
|
|
||||||
(*count - *position) * elem_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy (*base + (char) *position * elem_size, elem, elem_size);
|
|
||||||
*count+=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 0 - dma is not supported, scsi or regular file */
|
|
||||||
/* 1 - xt drive */
|
|
||||||
/* 2 - ide drive */
|
|
||||||
static void get_dma_support(dma_info_t *dma_info){
|
|
||||||
if (S_ISREG(dma_info->st.st_mode))
|
|
||||||
dma_info->st.st_rdev = dma_info->st.st_dev;
|
|
||||||
|
|
||||||
if (IDE_DISK_MAJOR(major(dma_info->st.st_rdev))) {
|
|
||||||
dma_info->support_type = 2;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef XT_DISK_MAJOR
|
|
||||||
if (major(dma_info->st.st_rdev) == XT_DISK_MAJOR) {
|
|
||||||
dma_info->support_type = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
dma_info->support_type = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return values:
|
|
||||||
* 0 - ok;
|
|
||||||
* 1 - preparation cannot be done
|
|
||||||
* -1 - preparation failed
|
|
||||||
*/
|
|
||||||
|
|
||||||
int prepare_dma_check(dma_info_t *dma_info) {
|
|
||||||
DIR *dir;
|
|
||||||
struct dirent *dirent;
|
|
||||||
struct stat st;
|
|
||||||
dev_t rdev;
|
|
||||||
int rem;
|
|
||||||
char buf[256];
|
|
||||||
|
|
||||||
#ifndef HDIO_GET_DMA
|
|
||||||
return -1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fstat(dma_info->fd, &dma_info->st))
|
|
||||||
die("stat on device failed\n");
|
|
||||||
|
|
||||||
get_dma_support(dma_info);
|
|
||||||
|
|
||||||
/* dma should be supported */
|
|
||||||
if (dma_info->support_type == 0)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
if (dma_info->support_type == 2) {
|
|
||||||
rdev = dma_info->st.st_rdev;
|
|
||||||
|
|
||||||
if ((rem = (minor(rdev) % 64)) != 0) {
|
|
||||||
rdev -= rem;
|
|
||||||
if(!(dir = opendir("/dev/"))) {
|
|
||||||
dma_info->support_type = 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((dirent = readdir(dir)) != NULL) {
|
|
||||||
if (strncmp(dirent->d_name, ".", 1) == 0 || strncmp(dirent->d_name, "..", 2) == 0)
|
|
||||||
continue;
|
|
||||||
memset(buf, 0, 256);
|
|
||||||
strncat(buf, "/dev/", 5);
|
|
||||||
strncat(buf, dirent->d_name, strlen(dirent->d_name));
|
|
||||||
|
|
||||||
if (stat(buf, &st))
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (S_ISBLK(st.st_mode) && st.st_rdev == rdev)
|
|
||||||
{
|
|
||||||
dma_info->st = st;
|
|
||||||
dma_info->fd = open(buf, O_RDONLY
|
|
||||||
#if defined(O_LARGEFILE)
|
|
||||||
| O_LARGEFILE
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
closedir(dir);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closedir(dir);
|
|
||||||
dma_info->support_type = 1;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int is_dma_on (int fd) {
|
|
||||||
#ifdef HDIO_GET_DMA
|
|
||||||
static long parm;
|
|
||||||
if (ioctl(fd, HDIO_GET_DMA, &parm))
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
return parm;
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static __u64 dma_speed(int fd, int support_type) {
|
|
||||||
static struct hd_driveid id;
|
|
||||||
__u64 speed = 0;
|
|
||||||
|
|
||||||
if (support_type != 2)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
#ifdef HDIO_OBSOLETE_IDENTITY
|
|
||||||
if (!ioctl(fd, HDIO_GET_IDENTITY, &id) ||
|
|
||||||
!ioctl(fd, HDIO_OBSOLETE_IDENTITY)) {
|
|
||||||
#else
|
|
||||||
if (!ioctl(fd, HDIO_GET_IDENTITY, &id)) {
|
|
||||||
#endif
|
|
||||||
speed |= (__u64)id.dma_1word & ~(__u64)0xff;
|
|
||||||
speed |= ((__u64)id.dma_mword & ~(__u64)0xff) << 16;
|
|
||||||
speed |= ((__u64)id.dma_ultra & ~(__u64)0xff) << 32;
|
|
||||||
} else if (errno == -ENOMSG)
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
int get_dma_info(dma_info_t *dma_info) {
|
|
||||||
if ((dma_info->dma = is_dma_on(dma_info->fd)) == -1)
|
|
||||||
return -1;
|
|
||||||
if ((dma_info->speed = dma_speed(dma_info->fd, dma_info->support_type)) == (__u64)-1)
|
|
||||||
return -1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void clean_after_dma_check(int fd, dma_info_t *dma_info) {
|
|
||||||
signal(SIGALRM, SIG_IGN);
|
|
||||||
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;
|
|
||||||
__u32 num1, num2;
|
|
||||||
|
|
||||||
fprintf(out, "A pair of credits:\n");
|
|
||||||
|
|
||||||
srandom (time (0));
|
|
||||||
|
|
||||||
num1 = random() % CREDITS_COUNT;
|
|
||||||
line = credits[num1];
|
|
||||||
fprintf(out, "%s\n", line);
|
|
||||||
|
|
||||||
while ((num1 == (num2 = random() % CREDITS_COUNT))) {}
|
|
||||||
|
|
||||||
line = credits[num2];
|
|
||||||
|
|
||||||
fprintf(out, "%s\n", line);
|
|
||||||
}
|
|
||||||
|
|
||||||
int user_confirmed (FILE * fp, char * q, char * yes) {
|
|
||||||
char * answer = 0;
|
|
||||||
size_t n = 0;
|
|
||||||
|
|
||||||
fprintf (fp, "%s", q);
|
|
||||||
if (getline (&answer, &n, stdin) != (ssize_t)strlen (yes) || strcmp (yes, answer))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
noinst_LIBRARIES = libmisc-static.a
|
||||||
|
|
||||||
|
libmisc_static_a_SOURCES = bitops.c device.c malloc.c misc.c
|
||||||
|
libmisc_static_a_CFLAGS = @CFLAGS@
|
||||||
|
|
||||||
|
INCLUDES = -I$(top_srcdir)/include
|
||||||
@@ -0,0 +1,451 @@
|
|||||||
|
# Makefile.in generated by automake 1.9.5 from Makefile.am.
|
||||||
|
# @configure_input@
|
||||||
|
|
||||||
|
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||||
|
# 2003, 2004, 2005 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@
|
||||||
|
|
||||||
|
SOURCES = $(libmisc_static_a_SOURCES)
|
||||||
|
|
||||||
|
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 = :
|
||||||
|
build_triplet = @build@
|
||||||
|
host_triplet = @host@
|
||||||
|
subdir = libmisc
|
||||||
|
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||||
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
|
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||||
|
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||||
|
$(ACLOCAL_M4)
|
||||||
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
|
CONFIG_HEADER = $(top_builddir)/config.h
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
LIBRARIES = $(noinst_LIBRARIES)
|
||||||
|
AR = ar
|
||||||
|
ARFLAGS = cru
|
||||||
|
libmisc_static_a_AR = $(AR) $(ARFLAGS)
|
||||||
|
libmisc_static_a_LIBADD =
|
||||||
|
am_libmisc_static_a_OBJECTS = libmisc_static_a-bitops.$(OBJEXT) \
|
||||||
|
libmisc_static_a-device.$(OBJEXT) \
|
||||||
|
libmisc_static_a-malloc.$(OBJEXT) \
|
||||||
|
libmisc_static_a-misc.$(OBJEXT)
|
||||||
|
libmisc_static_a_OBJECTS = $(am_libmisc_static_a_OBJECTS)
|
||||||
|
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||||
|
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||||
|
am__depfiles_maybe = depfiles
|
||||||
|
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||||
|
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||||
|
CCLD = $(CC)
|
||||||
|
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
|
SOURCES = $(libmisc_static_a_SOURCES)
|
||||||
|
DIST_SOURCES = $(libmisc_static_a_SOURCES)
|
||||||
|
ETAGS = etags
|
||||||
|
CTAGS = ctags
|
||||||
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
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@
|
||||||
|
LN_S = @LN_S@
|
||||||
|
LTLIBOBJS = @LTLIBOBJS@
|
||||||
|
MAINT = @MAINT@
|
||||||
|
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
||||||
|
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
||||||
|
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@
|
||||||
|
PROGS_LDFLAGS = @PROGS_LDFLAGS@
|
||||||
|
RANLIB = @RANLIB@
|
||||||
|
SET_MAKE = @SET_MAKE@
|
||||||
|
SHELL = @SHELL@
|
||||||
|
STRIP = @STRIP@
|
||||||
|
UUID_LIBS = @UUID_LIBS@
|
||||||
|
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__leading_dot = @am__leading_dot@
|
||||||
|
am__quote = @am__quote@
|
||||||
|
am__tar = @am__tar@
|
||||||
|
am__untar = @am__untar@
|
||||||
|
bindir = @bindir@
|
||||||
|
build = @build@
|
||||||
|
build_alias = @build_alias@
|
||||||
|
build_cpu = @build_cpu@
|
||||||
|
build_os = @build_os@
|
||||||
|
build_vendor = @build_vendor@
|
||||||
|
datadir = @datadir@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
host = @host@
|
||||||
|
host_alias = @host_alias@
|
||||||
|
host_cpu = @host_cpu@
|
||||||
|
host_os = @host_os@
|
||||||
|
host_vendor = @host_vendor@
|
||||||
|
includedir = @includedir@
|
||||||
|
infodir = @infodir@
|
||||||
|
install_sh = @install_sh@
|
||||||
|
libdir = @libdir@
|
||||||
|
libexecdir = @libexecdir@
|
||||||
|
localstatedir = @localstatedir@
|
||||||
|
mandir = @mandir@
|
||||||
|
mkdir_p = @mkdir_p@
|
||||||
|
oldincludedir = @oldincludedir@
|
||||||
|
prefix = @prefix@
|
||||||
|
program_transform_name = @program_transform_name@
|
||||||
|
sbindir = @sbindir@
|
||||||
|
sharedstatedir = @sharedstatedir@
|
||||||
|
sysconfdir = @sysconfdir@
|
||||||
|
target_alias = @target_alias@
|
||||||
|
noinst_LIBRARIES = libmisc-static.a
|
||||||
|
libmisc_static_a_SOURCES = bitops.c device.c malloc.c misc.c
|
||||||
|
libmisc_static_a_CFLAGS = @CFLAGS@
|
||||||
|
INCLUDES = -I$(top_srcdir)/include
|
||||||
|
all: all-am
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .c .o .obj
|
||||||
|
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||||
|
@for dep in $?; do \
|
||||||
|
case '$(am__configure_deps)' in \
|
||||||
|
*$$dep*) \
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||||
|
&& exit 0; \
|
||||||
|
exit 1;; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libmisc/Makefile'; \
|
||||||
|
cd $(top_srcdir) && \
|
||||||
|
$(AUTOMAKE) --gnu libmisc/Makefile
|
||||||
|
.PRECIOUS: Makefile
|
||||||
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
|
@case '$?' in \
|
||||||
|
*config.status*) \
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||||
|
*) \
|
||||||
|
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||||
|
esac;
|
||||||
|
|
||||||
|
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
|
||||||
|
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
|
||||||
|
clean-noinstLIBRARIES:
|
||||||
|
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
|
||||||
|
libmisc-static.a: $(libmisc_static_a_OBJECTS) $(libmisc_static_a_DEPENDENCIES)
|
||||||
|
-rm -f libmisc-static.a
|
||||||
|
$(libmisc_static_a_AR) libmisc-static.a $(libmisc_static_a_OBJECTS) $(libmisc_static_a_LIBADD)
|
||||||
|
$(RANLIB) libmisc-static.a
|
||||||
|
|
||||||
|
mostlyclean-compile:
|
||||||
|
-rm -f *.$(OBJEXT)
|
||||||
|
|
||||||
|
distclean-compile:
|
||||||
|
-rm -f *.tab.c
|
||||||
|
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmisc_static_a-bitops.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmisc_static_a-device.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmisc_static_a-malloc.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmisc_static_a-misc.Po@am__quote@
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||||
|
|
||||||
|
.c.obj:
|
||||||
|
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||||
|
|
||||||
|
libmisc_static_a-bitops.o: bitops.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -MT libmisc_static_a-bitops.o -MD -MP -MF "$(DEPDIR)/libmisc_static_a-bitops.Tpo" -c -o libmisc_static_a-bitops.o `test -f 'bitops.c' || echo '$(srcdir)/'`bitops.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmisc_static_a-bitops.Tpo" "$(DEPDIR)/libmisc_static_a-bitops.Po"; else rm -f "$(DEPDIR)/libmisc_static_a-bitops.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bitops.c' object='libmisc_static_a-bitops.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -c -o libmisc_static_a-bitops.o `test -f 'bitops.c' || echo '$(srcdir)/'`bitops.c
|
||||||
|
|
||||||
|
libmisc_static_a-bitops.obj: bitops.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -MT libmisc_static_a-bitops.obj -MD -MP -MF "$(DEPDIR)/libmisc_static_a-bitops.Tpo" -c -o libmisc_static_a-bitops.obj `if test -f 'bitops.c'; then $(CYGPATH_W) 'bitops.c'; else $(CYGPATH_W) '$(srcdir)/bitops.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmisc_static_a-bitops.Tpo" "$(DEPDIR)/libmisc_static_a-bitops.Po"; else rm -f "$(DEPDIR)/libmisc_static_a-bitops.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bitops.c' object='libmisc_static_a-bitops.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -c -o libmisc_static_a-bitops.obj `if test -f 'bitops.c'; then $(CYGPATH_W) 'bitops.c'; else $(CYGPATH_W) '$(srcdir)/bitops.c'; fi`
|
||||||
|
|
||||||
|
libmisc_static_a-device.o: device.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -MT libmisc_static_a-device.o -MD -MP -MF "$(DEPDIR)/libmisc_static_a-device.Tpo" -c -o libmisc_static_a-device.o `test -f 'device.c' || echo '$(srcdir)/'`device.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmisc_static_a-device.Tpo" "$(DEPDIR)/libmisc_static_a-device.Po"; else rm -f "$(DEPDIR)/libmisc_static_a-device.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='device.c' object='libmisc_static_a-device.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -c -o libmisc_static_a-device.o `test -f 'device.c' || echo '$(srcdir)/'`device.c
|
||||||
|
|
||||||
|
libmisc_static_a-device.obj: device.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -MT libmisc_static_a-device.obj -MD -MP -MF "$(DEPDIR)/libmisc_static_a-device.Tpo" -c -o libmisc_static_a-device.obj `if test -f 'device.c'; then $(CYGPATH_W) 'device.c'; else $(CYGPATH_W) '$(srcdir)/device.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmisc_static_a-device.Tpo" "$(DEPDIR)/libmisc_static_a-device.Po"; else rm -f "$(DEPDIR)/libmisc_static_a-device.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='device.c' object='libmisc_static_a-device.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -c -o libmisc_static_a-device.obj `if test -f 'device.c'; then $(CYGPATH_W) 'device.c'; else $(CYGPATH_W) '$(srcdir)/device.c'; fi`
|
||||||
|
|
||||||
|
libmisc_static_a-malloc.o: malloc.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -MT libmisc_static_a-malloc.o -MD -MP -MF "$(DEPDIR)/libmisc_static_a-malloc.Tpo" -c -o libmisc_static_a-malloc.o `test -f 'malloc.c' || echo '$(srcdir)/'`malloc.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmisc_static_a-malloc.Tpo" "$(DEPDIR)/libmisc_static_a-malloc.Po"; else rm -f "$(DEPDIR)/libmisc_static_a-malloc.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='malloc.c' object='libmisc_static_a-malloc.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -c -o libmisc_static_a-malloc.o `test -f 'malloc.c' || echo '$(srcdir)/'`malloc.c
|
||||||
|
|
||||||
|
libmisc_static_a-malloc.obj: malloc.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -MT libmisc_static_a-malloc.obj -MD -MP -MF "$(DEPDIR)/libmisc_static_a-malloc.Tpo" -c -o libmisc_static_a-malloc.obj `if test -f 'malloc.c'; then $(CYGPATH_W) 'malloc.c'; else $(CYGPATH_W) '$(srcdir)/malloc.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmisc_static_a-malloc.Tpo" "$(DEPDIR)/libmisc_static_a-malloc.Po"; else rm -f "$(DEPDIR)/libmisc_static_a-malloc.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='malloc.c' object='libmisc_static_a-malloc.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -c -o libmisc_static_a-malloc.obj `if test -f 'malloc.c'; then $(CYGPATH_W) 'malloc.c'; else $(CYGPATH_W) '$(srcdir)/malloc.c'; fi`
|
||||||
|
|
||||||
|
libmisc_static_a-misc.o: misc.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -MT libmisc_static_a-misc.o -MD -MP -MF "$(DEPDIR)/libmisc_static_a-misc.Tpo" -c -o libmisc_static_a-misc.o `test -f 'misc.c' || echo '$(srcdir)/'`misc.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmisc_static_a-misc.Tpo" "$(DEPDIR)/libmisc_static_a-misc.Po"; else rm -f "$(DEPDIR)/libmisc_static_a-misc.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libmisc_static_a-misc.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -c -o libmisc_static_a-misc.o `test -f 'misc.c' || echo '$(srcdir)/'`misc.c
|
||||||
|
|
||||||
|
libmisc_static_a-misc.obj: misc.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -MT libmisc_static_a-misc.obj -MD -MP -MF "$(DEPDIR)/libmisc_static_a-misc.Tpo" -c -o libmisc_static_a-misc.obj `if test -f 'misc.c'; then $(CYGPATH_W) 'misc.c'; else $(CYGPATH_W) '$(srcdir)/misc.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmisc_static_a-misc.Tpo" "$(DEPDIR)/libmisc_static_a-misc.Po"; else rm -f "$(DEPDIR)/libmisc_static_a-misc.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libmisc_static_a-misc.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -c -o libmisc_static_a-misc.obj `if test -f 'misc.c'; then $(CYGPATH_W) 'misc.c'; else $(CYGPATH_W) '$(srcdir)/misc.c'; fi`
|
||||||
|
uninstall-info-am:
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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; }'`; \
|
||||||
|
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||||
|
test -n "$$unique" || unique=$$empty_fix; \
|
||||||
|
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||||
|
$$tags $$unique; \
|
||||||
|
fi
|
||||||
|
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
|
||||||
|
|
||||||
|
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"; \
|
||||||
|
$(mkdir_p) "$(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 $(LIBRARIES)
|
||||||
|
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
|
||||||
|
|
||||||
|
installcheck: installcheck-am
|
||||||
|
install-strip:
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
|
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||||
|
`test -z '$(STRIP)' || \
|
||||||
|
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||||
|
mostlyclean-generic:
|
||||||
|
|
||||||
|
clean-generic:
|
||||||
|
|
||||||
|
distclean-generic:
|
||||||
|
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(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-noinstLIBRARIES mostlyclean-am
|
||||||
|
|
||||||
|
distclean: distclean-am
|
||||||
|
-rm -rf ./$(DEPDIR)
|
||||||
|
-rm -f Makefile
|
||||||
|
distclean-am: clean-am distclean-compile distclean-generic \
|
||||||
|
distclean-tags
|
||||||
|
|
||||||
|
dvi: dvi-am
|
||||||
|
|
||||||
|
dvi-am:
|
||||||
|
|
||||||
|
html: html-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
|
||||||
|
-rm -rf ./$(DEPDIR)
|
||||||
|
-rm -f Makefile
|
||||||
|
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-generic distclean-tags distdir dvi dvi-am html \
|
||||||
|
html-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.
|
||||||
|
.NOEXPORT:
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "misc/bitops.h"
|
||||||
|
#include "misc/types.h"
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* there are masks for certain bits */
|
||||||
|
__u16 mask16 (int from, int count)
|
||||||
|
{
|
||||||
|
__u16 mask;
|
||||||
|
|
||||||
|
|
||||||
|
mask = (0xffff >> from);
|
||||||
|
mask <<= from;
|
||||||
|
mask <<= (16 - from - count);
|
||||||
|
mask >>= (16 - from - count);
|
||||||
|
return mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__u32 mask32 (int from, int count)
|
||||||
|
{
|
||||||
|
__u32 mask;
|
||||||
|
|
||||||
|
|
||||||
|
mask = (0xffffffff >> from);
|
||||||
|
mask <<= from;
|
||||||
|
mask <<= (32 - from - count);
|
||||||
|
mask >>= (32 - from - count);
|
||||||
|
return mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__u64 mask64 (int from, int count)
|
||||||
|
{
|
||||||
|
__u64 mask;
|
||||||
|
|
||||||
|
|
||||||
|
mask = (0xffffffffffffffffLL >> from);
|
||||||
|
mask <<= from;
|
||||||
|
mask <<= (64 - from - count);
|
||||||
|
mask >>= (64 - from - count);
|
||||||
|
return mask;
|
||||||
|
}
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "misc/device.h"
|
||||||
|
#include "misc/misc.h"
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/mount.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#define MISC_DEVICE_STAT(Field, Type) \
|
||||||
|
Type misc_device_##Field(char *device) { \
|
||||||
|
struct stat st; \
|
||||||
|
\
|
||||||
|
if (stat(device, &st) == 0) \
|
||||||
|
return st.st_##Field; \
|
||||||
|
\
|
||||||
|
fprintf(stderr, "Stat of the device '%s' failed.\n", device); \
|
||||||
|
return (Type)-1; \
|
||||||
|
}
|
||||||
|
|
||||||
|
MISC_DEVICE_STAT(mode, mode_t);
|
||||||
|
MISC_DEVICE_STAT(rdev, dev_t);
|
||||||
|
|
||||||
|
int misc_device_valid_offset(int fd, long long int offset) {
|
||||||
|
long long int res;
|
||||||
|
char ch;
|
||||||
|
|
||||||
|
/*res = reiserfs_llseek (fd, offset, 0);*/
|
||||||
|
res = lseek (fd, (off_t)offset, SEEK_SET);
|
||||||
|
if (res < 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* if (read (fd, &ch, 1) < 0) does not wirk on files */
|
||||||
|
if (read (fd, &ch, 1) < 1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* To not have problem with last sectors on the block device when switching
|
||||||
|
to smaller one. */
|
||||||
|
#define MAX_BS (64 * 1024)
|
||||||
|
|
||||||
|
/* calculates number of blocks in a file. Returns 0 for "sparse"
|
||||||
|
regular files and files other than regular files and block devices */
|
||||||
|
unsigned long misc_device_count_blocks (char * filename, int blocksize)
|
||||||
|
{
|
||||||
|
long long int high, low;
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
fd = open (filename, O_RDONLY);
|
||||||
|
if (fd == -1) {
|
||||||
|
fprintf(stderr, "Failed to open '%s': %s.\n", filename, strerror(errno));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!S_ISBLK(misc_device_mode(filename)) &&
|
||||||
|
!S_ISREG(misc_device_mode(filename)))
|
||||||
|
{
|
||||||
|
close(fd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef BLKGETSIZE64
|
||||||
|
{
|
||||||
|
unsigned long long size;
|
||||||
|
unsigned long sz;
|
||||||
|
|
||||||
|
if (ioctl (fd, BLKGETSIZE64, &size) >= 0) {
|
||||||
|
size = (size / MAX_BS) * MAX_BS / blocksize;
|
||||||
|
sz = size;
|
||||||
|
if ((unsigned long long)sz != size)
|
||||||
|
misc_die ("misc_device_count_blocks: block device too large");
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
return sz;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef BLKGETSIZE
|
||||||
|
{
|
||||||
|
unsigned long long size;
|
||||||
|
unsigned long sz;
|
||||||
|
|
||||||
|
if (ioctl (fd, BLKGETSIZE, &sz) >= 0) {
|
||||||
|
size = sz;
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
return (size * 512 / MAX_BS) * MAX_BS / blocksize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
low = 0;
|
||||||
|
for( high = 1; misc_device_valid_offset (fd, high); high *= 2 )
|
||||||
|
low = high;
|
||||||
|
while (low < high - 1) {
|
||||||
|
const long long int mid = ( low + high ) / 2;
|
||||||
|
|
||||||
|
if (misc_device_valid_offset (fd, mid))
|
||||||
|
low = mid;
|
||||||
|
else
|
||||||
|
high = mid;
|
||||||
|
}
|
||||||
|
|
||||||
|
misc_device_valid_offset (fd, 0);
|
||||||
|
|
||||||
|
close (fd);
|
||||||
|
return (low + 1) * MAX_BS / MAX_BS / blocksize;
|
||||||
|
}
|
||||||
|
|
||||||
|
char misc_device_typec (unsigned short mode)
|
||||||
|
{
|
||||||
|
if (S_ISBLK ((mode_t)mode))
|
||||||
|
return 'b';
|
||||||
|
if (S_ISCHR (mode))
|
||||||
|
return 'c';
|
||||||
|
if (S_ISDIR (mode))
|
||||||
|
return 'd';
|
||||||
|
if (S_ISREG (mode))
|
||||||
|
return '-';
|
||||||
|
if (S_ISFIFO (mode))
|
||||||
|
return 'p';
|
||||||
|
if (S_ISLNK (mode))
|
||||||
|
return 'l';
|
||||||
|
if (S_ISSOCK (mode))
|
||||||
|
return 's';
|
||||||
|
return '?';
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "misc/malloc.h"
|
||||||
|
#include "misc/misc.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#define MEM_BEGIN "_mem_begin_"
|
||||||
|
#define MEM_END "mem_end"
|
||||||
|
#define MEM_FREED "__free_"
|
||||||
|
#define CONTROL_SIZE (strlen (MEM_BEGIN) + 1 + sizeof (int) + strlen (MEM_END) + 1)
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int misc_memsize(char *p) {
|
||||||
|
char *begin;
|
||||||
|
|
||||||
|
begin = p - strlen (MEM_BEGIN) - 1 - sizeof(int);
|
||||||
|
return *(int *)(begin + strlen (MEM_BEGIN) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void misc_checkmem (char * p, int size)
|
||||||
|
{
|
||||||
|
char * begin;
|
||||||
|
char * end;
|
||||||
|
|
||||||
|
begin = p - strlen (MEM_BEGIN) - 1 - sizeof (int);
|
||||||
|
if (strcmp (begin, MEM_BEGIN))
|
||||||
|
misc_die ("misc_checkmem: memory corrupted - invalid head sign");
|
||||||
|
|
||||||
|
if (*(int *)(begin + strlen (MEM_BEGIN) + 1) != size)
|
||||||
|
misc_die ("misc_checkmem: memory corrupted - invalid size");
|
||||||
|
|
||||||
|
end = begin + size + CONTROL_SIZE - strlen (MEM_END) - 1;
|
||||||
|
if (strcmp (end, MEM_END))
|
||||||
|
misc_die ("misc_checkmem: memory corrupted - invalid end sign");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void *misc_getmem (int size)
|
||||||
|
{
|
||||||
|
char * mem;
|
||||||
|
|
||||||
|
if ((mem = misc_malloc(size)) == NULL)
|
||||||
|
misc_die ("misc_getmem: no more memory (%d)", size);
|
||||||
|
|
||||||
|
memset (mem, 0, size);
|
||||||
|
// misc_checkmem (mem, size);
|
||||||
|
|
||||||
|
return mem;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *misc_malloc(int size) {
|
||||||
|
char * p;
|
||||||
|
char * mem;
|
||||||
|
|
||||||
|
p = (char *)malloc (CONTROL_SIZE + size);
|
||||||
|
if (!p)
|
||||||
|
misc_die ("misc_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;
|
||||||
|
p += size;
|
||||||
|
strcpy (p, MEM_END);
|
||||||
|
|
||||||
|
return mem;
|
||||||
|
}
|
||||||
|
|
||||||
|
void * misc_expandmem (void * vp, int size, int by)
|
||||||
|
{
|
||||||
|
int allocated;
|
||||||
|
char * mem, * p = vp;
|
||||||
|
int expand_by = by;
|
||||||
|
|
||||||
|
if (p) {
|
||||||
|
misc_checkmem (p, size);
|
||||||
|
allocated = CONTROL_SIZE + size;
|
||||||
|
p -= (strlen (MEM_BEGIN) + 1 + sizeof (int));
|
||||||
|
} else {
|
||||||
|
allocated = 0;
|
||||||
|
/* add control bytes to the new allocated area */
|
||||||
|
expand_by += CONTROL_SIZE;
|
||||||
|
}
|
||||||
|
p = realloc (p, allocated + expand_by);
|
||||||
|
if (!p)
|
||||||
|
misc_die ("misc_expandmem: no more memory (%d)", size);
|
||||||
|
if (!vp) {
|
||||||
|
strcpy (p, MEM_BEGIN);
|
||||||
|
}
|
||||||
|
mem = p + strlen (MEM_BEGIN) + 1 + sizeof (int);
|
||||||
|
|
||||||
|
*(int *)(p + strlen (MEM_BEGIN) + 1) = size + by;
|
||||||
|
/* fill new allocated area by 0s */
|
||||||
|
if(by > 0)
|
||||||
|
memset (mem + size, 0, by);
|
||||||
|
strcpy (mem + size + by, MEM_END);
|
||||||
|
// misc_checkmem (mem, size + by);
|
||||||
|
|
||||||
|
return mem;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void misc_freemem (void * vp)
|
||||||
|
{
|
||||||
|
char * p = vp;
|
||||||
|
int size;
|
||||||
|
|
||||||
|
if (!p)
|
||||||
|
return;
|
||||||
|
size = misc_memsize (vp);
|
||||||
|
misc_checkmem (p, size);
|
||||||
|
|
||||||
|
p -= (strlen (MEM_BEGIN) + 1 + sizeof (int));
|
||||||
|
strcpy (p, MEM_FREED);
|
||||||
|
strcpy (p + size + CONTROL_SIZE - strlen (MEM_END) - 1, MEM_FREED);
|
||||||
|
free (p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
+200
@@ -0,0 +1,200 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "misc/malloc.h"
|
||||||
|
#include "misc/misc.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
void misc_die (char * fmt, ...)
|
||||||
|
{
|
||||||
|
static char buf[4096];
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start (args, fmt);
|
||||||
|
vsprintf (buf, fmt, args);
|
||||||
|
va_end (args);
|
||||||
|
|
||||||
|
fprintf (stderr, "\n%s\n", buf);
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__u32 misc_random (void)
|
||||||
|
{
|
||||||
|
srandom (time (0));
|
||||||
|
return random ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* this implements binary search in the array 'base' among 'num' elements each
|
||||||
|
of those is 'width' bytes long. 'comp_func' is used to compare keys */
|
||||||
|
int misc_bin_search (const void * key, void * base, __u32 num, int width,
|
||||||
|
int * ppos, misc_comp_func_t comp_func)
|
||||||
|
{
|
||||||
|
__u32 rbound, lbound, j;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (num == 0 || base == NULL) {
|
||||||
|
/* objectid map may be 0 elements long */
|
||||||
|
*ppos = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
lbound = 0;
|
||||||
|
rbound = num - 1;
|
||||||
|
|
||||||
|
for (j = (rbound + lbound) / 2; lbound <= rbound; j = (rbound + lbound) / 2) {
|
||||||
|
ret = comp_func ((void *)((char *)base + j * width), key ) ;
|
||||||
|
if (ret < 0) { /* second is greater */
|
||||||
|
lbound = j + 1;
|
||||||
|
continue;
|
||||||
|
|
||||||
|
} else if (ret > 0) { /* first is greater */
|
||||||
|
if (j == 0)
|
||||||
|
break;
|
||||||
|
rbound = j - 1;
|
||||||
|
continue;
|
||||||
|
} else { /* equal */
|
||||||
|
*ppos = j;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*ppos = lbound;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define BLOCKLIST__ELEMENT_NUMBER 10
|
||||||
|
|
||||||
|
/*element is block number and device*/
|
||||||
|
int blockdev_list_compare (const void * block1, const void * block2) {
|
||||||
|
if (*(__u32 *)block1 < *(__u32 *)block2)
|
||||||
|
return -1;
|
||||||
|
if (*(__u32 *)block1 > *(__u32 *)block2)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (*((__u32 *)block1 + 1) < *((__u32 *)block2 + 1))
|
||||||
|
return -1;
|
||||||
|
if (*((__u32 *)block1 + 1) > *((__u32 *)block2 + 1))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void blocklist__insert_in_position (void *elem, void **base, __u32 *count,
|
||||||
|
int elem_size, int *position)
|
||||||
|
{
|
||||||
|
if (elem_size == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (*base == NULL)
|
||||||
|
*base = misc_getmem (BLOCKLIST__ELEMENT_NUMBER * elem_size);
|
||||||
|
|
||||||
|
if (*count == misc_memsize((void *)*base) / elem_size)
|
||||||
|
*base = misc_expandmem (*base, misc_memsize((void *)*base),
|
||||||
|
BLOCKLIST__ELEMENT_NUMBER * elem_size);
|
||||||
|
|
||||||
|
if (*position < *count) {
|
||||||
|
memmove (*base + (*position + 1),
|
||||||
|
*base + (*position),
|
||||||
|
(*count - *position) * elem_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy (*base + (char) *position * elem_size, elem, elem_size);
|
||||||
|
*count+=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int misc_device_rdev_match(char *path, void *data) {
|
||||||
|
dev_t *rdev = (dev_t *)data;
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
|
/* If stat fails just continue walking. */
|
||||||
|
if (stat(path, &st))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* Only block files are interesting. */
|
||||||
|
if (!S_ISBLK(st.st_mode))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* Matched rdev wanted. */
|
||||||
|
if (st.st_rdev != *rdev)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* Stop walking. */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* The method walks through all subtree of the path,
|
||||||
|
open all directories and walk through them recursevely.
|
||||||
|
|
||||||
|
Return values:
|
||||||
|
positive: stop walking;
|
||||||
|
negative: error occured.
|
||||||
|
*/
|
||||||
|
int misc_dir_walk(char *path, dir_walk_func_t func, void *data) {
|
||||||
|
struct dirent *dirent;
|
||||||
|
struct stat st;
|
||||||
|
off_t pos;
|
||||||
|
DIR *dir;
|
||||||
|
int len;
|
||||||
|
int res;
|
||||||
|
|
||||||
|
strcat(path, "/");
|
||||||
|
|
||||||
|
if (!(dir = opendir(path)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
len = strlen(path);
|
||||||
|
|
||||||
|
while ((dirent = readdir(dir)) != NULL) {
|
||||||
|
path[len] = 0;
|
||||||
|
|
||||||
|
if (strcmp(dirent->d_name, ".") == 0 ||
|
||||||
|
strcmp(dirent->d_name, "..") == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcat(path, dirent->d_name);
|
||||||
|
|
||||||
|
if ((res = func(path, data))) {
|
||||||
|
closedir(dir);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stat(path, &st) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ((S_ISDIR(st.st_mode))) {
|
||||||
|
pos = telldir(dir);
|
||||||
|
closedir(dir);
|
||||||
|
|
||||||
|
if ((res = misc_dir_walk(path, func, data)))
|
||||||
|
return res;
|
||||||
|
|
||||||
|
path[len] = 0;
|
||||||
|
if (!(dir = opendir(path)))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
seekdir(dir, pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closedir(dir);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
libreiserfs_sources = badblock.c fix_node.c leaf.c stat.c \
|
||||||
|
bitmap.c hash.c leaf_balance.c buffer.c \
|
||||||
|
internal.c libreiserfs.c internal_balance.c super.c \
|
||||||
|
direntry.c node.c tree.c extent.c \
|
||||||
|
journal.c objmap.c tree_balance.c filesystem.c \
|
||||||
|
key.c prints.c
|
||||||
|
|
||||||
|
#lib_LIBRARIES = libreiserfs.la
|
||||||
|
noinst_LIBRARIES = libreiserfs-static.a
|
||||||
|
|
||||||
|
#libreiserfs_la_LIBADD = $(top_builddir)/libmisc/libmisc-static.la
|
||||||
|
#libreiserfs_la_SOURCES = $(libreiserfs_sources)
|
||||||
|
# libreiserfs_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
|
||||||
|
# -release $(LT_RELEASE)
|
||||||
|
#libreiserfs_la_CFLAGS = @CFLAGS@
|
||||||
|
|
||||||
|
libreiserfs_static_a_LIBADD = $(top_builddir)/libmisc/libmisc-static.a
|
||||||
|
libreiserfs_static_a_SOURCES = $(libreiserfs_sources)
|
||||||
|
#libreiserfs_static_a_LDFLAGS = -static
|
||||||
|
libreiserfs_static_a_CFLAGS = @CFLAGS@
|
||||||
|
|
||||||
|
INCLUDES = -I$(top_srcdir)/include
|
||||||
@@ -0,0 +1,758 @@
|
|||||||
|
# Makefile.in generated by automake 1.9.5 from Makefile.am.
|
||||||
|
# @configure_input@
|
||||||
|
|
||||||
|
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||||
|
# 2003, 2004, 2005 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@
|
||||||
|
|
||||||
|
SOURCES = $(libreiserfs_static_a_SOURCES)
|
||||||
|
|
||||||
|
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 = :
|
||||||
|
build_triplet = @build@
|
||||||
|
host_triplet = @host@
|
||||||
|
subdir = libreiserfs
|
||||||
|
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||||
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
|
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||||
|
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||||
|
$(ACLOCAL_M4)
|
||||||
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
|
CONFIG_HEADER = $(top_builddir)/config.h
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
LIBRARIES = $(noinst_LIBRARIES)
|
||||||
|
AR = ar
|
||||||
|
ARFLAGS = cru
|
||||||
|
libreiserfs_static_a_AR = $(AR) $(ARFLAGS)
|
||||||
|
libreiserfs_static_a_DEPENDENCIES = \
|
||||||
|
$(top_builddir)/libmisc/libmisc-static.a
|
||||||
|
am__objects_1 = libreiserfs_static_a-badblock.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-fix_node.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-leaf.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-stat.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-bitmap.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-hash.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-leaf_balance.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-buffer.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-internal.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-libreiserfs.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-internal_balance.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-super.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-direntry.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-node.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-tree.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-extent.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-journal.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-objmap.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-tree_balance.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-filesystem.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-key.$(OBJEXT) \
|
||||||
|
libreiserfs_static_a-prints.$(OBJEXT)
|
||||||
|
am_libreiserfs_static_a_OBJECTS = $(am__objects_1)
|
||||||
|
libreiserfs_static_a_OBJECTS = $(am_libreiserfs_static_a_OBJECTS)
|
||||||
|
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||||
|
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||||
|
am__depfiles_maybe = depfiles
|
||||||
|
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||||
|
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||||
|
CCLD = $(CC)
|
||||||
|
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
|
SOURCES = $(libreiserfs_static_a_SOURCES)
|
||||||
|
DIST_SOURCES = $(libreiserfs_static_a_SOURCES)
|
||||||
|
ETAGS = etags
|
||||||
|
CTAGS = ctags
|
||||||
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
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@
|
||||||
|
LN_S = @LN_S@
|
||||||
|
LTLIBOBJS = @LTLIBOBJS@
|
||||||
|
MAINT = @MAINT@
|
||||||
|
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
||||||
|
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
||||||
|
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@
|
||||||
|
PROGS_LDFLAGS = @PROGS_LDFLAGS@
|
||||||
|
RANLIB = @RANLIB@
|
||||||
|
SET_MAKE = @SET_MAKE@
|
||||||
|
SHELL = @SHELL@
|
||||||
|
STRIP = @STRIP@
|
||||||
|
UUID_LIBS = @UUID_LIBS@
|
||||||
|
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__leading_dot = @am__leading_dot@
|
||||||
|
am__quote = @am__quote@
|
||||||
|
am__tar = @am__tar@
|
||||||
|
am__untar = @am__untar@
|
||||||
|
bindir = @bindir@
|
||||||
|
build = @build@
|
||||||
|
build_alias = @build_alias@
|
||||||
|
build_cpu = @build_cpu@
|
||||||
|
build_os = @build_os@
|
||||||
|
build_vendor = @build_vendor@
|
||||||
|
datadir = @datadir@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
host = @host@
|
||||||
|
host_alias = @host_alias@
|
||||||
|
host_cpu = @host_cpu@
|
||||||
|
host_os = @host_os@
|
||||||
|
host_vendor = @host_vendor@
|
||||||
|
includedir = @includedir@
|
||||||
|
infodir = @infodir@
|
||||||
|
install_sh = @install_sh@
|
||||||
|
libdir = @libdir@
|
||||||
|
libexecdir = @libexecdir@
|
||||||
|
localstatedir = @localstatedir@
|
||||||
|
mandir = @mandir@
|
||||||
|
mkdir_p = @mkdir_p@
|
||||||
|
oldincludedir = @oldincludedir@
|
||||||
|
prefix = @prefix@
|
||||||
|
program_transform_name = @program_transform_name@
|
||||||
|
sbindir = @sbindir@
|
||||||
|
sharedstatedir = @sharedstatedir@
|
||||||
|
sysconfdir = @sysconfdir@
|
||||||
|
target_alias = @target_alias@
|
||||||
|
libreiserfs_sources = badblock.c fix_node.c leaf.c stat.c \
|
||||||
|
bitmap.c hash.c leaf_balance.c buffer.c \
|
||||||
|
internal.c libreiserfs.c internal_balance.c super.c \
|
||||||
|
direntry.c node.c tree.c extent.c \
|
||||||
|
journal.c objmap.c tree_balance.c filesystem.c \
|
||||||
|
key.c prints.c
|
||||||
|
|
||||||
|
|
||||||
|
#lib_LIBRARIES = libreiserfs.la
|
||||||
|
noinst_LIBRARIES = libreiserfs-static.a
|
||||||
|
|
||||||
|
#libreiserfs_la_LIBADD = $(top_builddir)/libmisc/libmisc-static.la
|
||||||
|
#libreiserfs_la_SOURCES = $(libreiserfs_sources)
|
||||||
|
# libreiserfs_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
|
||||||
|
# -release $(LT_RELEASE)
|
||||||
|
#libreiserfs_la_CFLAGS = @CFLAGS@
|
||||||
|
libreiserfs_static_a_LIBADD = $(top_builddir)/libmisc/libmisc-static.a
|
||||||
|
libreiserfs_static_a_SOURCES = $(libreiserfs_sources)
|
||||||
|
#libreiserfs_static_a_LDFLAGS = -static
|
||||||
|
libreiserfs_static_a_CFLAGS = @CFLAGS@
|
||||||
|
INCLUDES = -I$(top_srcdir)/include
|
||||||
|
all: all-am
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .c .o .obj
|
||||||
|
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||||
|
@for dep in $?; do \
|
||||||
|
case '$(am__configure_deps)' in \
|
||||||
|
*$$dep*) \
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||||
|
&& exit 0; \
|
||||||
|
exit 1;; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libreiserfs/Makefile'; \
|
||||||
|
cd $(top_srcdir) && \
|
||||||
|
$(AUTOMAKE) --gnu libreiserfs/Makefile
|
||||||
|
.PRECIOUS: Makefile
|
||||||
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
|
@case '$?' in \
|
||||||
|
*config.status*) \
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||||
|
*) \
|
||||||
|
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||||
|
esac;
|
||||||
|
|
||||||
|
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
|
||||||
|
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
|
||||||
|
clean-noinstLIBRARIES:
|
||||||
|
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
|
||||||
|
libreiserfs-static.a: $(libreiserfs_static_a_OBJECTS) $(libreiserfs_static_a_DEPENDENCIES)
|
||||||
|
-rm -f libreiserfs-static.a
|
||||||
|
$(libreiserfs_static_a_AR) libreiserfs-static.a $(libreiserfs_static_a_OBJECTS) $(libreiserfs_static_a_LIBADD)
|
||||||
|
$(RANLIB) libreiserfs-static.a
|
||||||
|
|
||||||
|
mostlyclean-compile:
|
||||||
|
-rm -f *.$(OBJEXT)
|
||||||
|
|
||||||
|
distclean-compile:
|
||||||
|
-rm -f *.tab.c
|
||||||
|
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-badblock.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-bitmap.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-buffer.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-direntry.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-extent.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-filesystem.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-fix_node.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-hash.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-internal.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-internal_balance.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-journal.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-key.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-leaf.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-leaf_balance.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-libreiserfs.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-node.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-objmap.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-prints.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-stat.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-super.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-tree.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libreiserfs_static_a-tree_balance.Po@am__quote@
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||||
|
|
||||||
|
.c.obj:
|
||||||
|
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||||
|
|
||||||
|
libreiserfs_static_a-badblock.o: badblock.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-badblock.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-badblock.Tpo" -c -o libreiserfs_static_a-badblock.o `test -f 'badblock.c' || echo '$(srcdir)/'`badblock.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-badblock.Tpo" "$(DEPDIR)/libreiserfs_static_a-badblock.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-badblock.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='badblock.c' object='libreiserfs_static_a-badblock.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-badblock.o `test -f 'badblock.c' || echo '$(srcdir)/'`badblock.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-badblock.obj: badblock.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-badblock.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-badblock.Tpo" -c -o libreiserfs_static_a-badblock.obj `if test -f 'badblock.c'; then $(CYGPATH_W) 'badblock.c'; else $(CYGPATH_W) '$(srcdir)/badblock.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-badblock.Tpo" "$(DEPDIR)/libreiserfs_static_a-badblock.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-badblock.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='badblock.c' object='libreiserfs_static_a-badblock.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-badblock.obj `if test -f 'badblock.c'; then $(CYGPATH_W) 'badblock.c'; else $(CYGPATH_W) '$(srcdir)/badblock.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-fix_node.o: fix_node.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-fix_node.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-fix_node.Tpo" -c -o libreiserfs_static_a-fix_node.o `test -f 'fix_node.c' || echo '$(srcdir)/'`fix_node.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-fix_node.Tpo" "$(DEPDIR)/libreiserfs_static_a-fix_node.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-fix_node.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fix_node.c' object='libreiserfs_static_a-fix_node.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-fix_node.o `test -f 'fix_node.c' || echo '$(srcdir)/'`fix_node.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-fix_node.obj: fix_node.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-fix_node.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-fix_node.Tpo" -c -o libreiserfs_static_a-fix_node.obj `if test -f 'fix_node.c'; then $(CYGPATH_W) 'fix_node.c'; else $(CYGPATH_W) '$(srcdir)/fix_node.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-fix_node.Tpo" "$(DEPDIR)/libreiserfs_static_a-fix_node.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-fix_node.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fix_node.c' object='libreiserfs_static_a-fix_node.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-fix_node.obj `if test -f 'fix_node.c'; then $(CYGPATH_W) 'fix_node.c'; else $(CYGPATH_W) '$(srcdir)/fix_node.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-leaf.o: leaf.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-leaf.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-leaf.Tpo" -c -o libreiserfs_static_a-leaf.o `test -f 'leaf.c' || echo '$(srcdir)/'`leaf.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-leaf.Tpo" "$(DEPDIR)/libreiserfs_static_a-leaf.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-leaf.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='leaf.c' object='libreiserfs_static_a-leaf.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-leaf.o `test -f 'leaf.c' || echo '$(srcdir)/'`leaf.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-leaf.obj: leaf.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-leaf.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-leaf.Tpo" -c -o libreiserfs_static_a-leaf.obj `if test -f 'leaf.c'; then $(CYGPATH_W) 'leaf.c'; else $(CYGPATH_W) '$(srcdir)/leaf.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-leaf.Tpo" "$(DEPDIR)/libreiserfs_static_a-leaf.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-leaf.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='leaf.c' object='libreiserfs_static_a-leaf.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-leaf.obj `if test -f 'leaf.c'; then $(CYGPATH_W) 'leaf.c'; else $(CYGPATH_W) '$(srcdir)/leaf.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-stat.o: stat.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-stat.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-stat.Tpo" -c -o libreiserfs_static_a-stat.o `test -f 'stat.c' || echo '$(srcdir)/'`stat.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-stat.Tpo" "$(DEPDIR)/libreiserfs_static_a-stat.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-stat.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stat.c' object='libreiserfs_static_a-stat.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-stat.o `test -f 'stat.c' || echo '$(srcdir)/'`stat.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-stat.obj: stat.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-stat.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-stat.Tpo" -c -o libreiserfs_static_a-stat.obj `if test -f 'stat.c'; then $(CYGPATH_W) 'stat.c'; else $(CYGPATH_W) '$(srcdir)/stat.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-stat.Tpo" "$(DEPDIR)/libreiserfs_static_a-stat.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-stat.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stat.c' object='libreiserfs_static_a-stat.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-stat.obj `if test -f 'stat.c'; then $(CYGPATH_W) 'stat.c'; else $(CYGPATH_W) '$(srcdir)/stat.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-bitmap.o: bitmap.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-bitmap.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-bitmap.Tpo" -c -o libreiserfs_static_a-bitmap.o `test -f 'bitmap.c' || echo '$(srcdir)/'`bitmap.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-bitmap.Tpo" "$(DEPDIR)/libreiserfs_static_a-bitmap.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-bitmap.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bitmap.c' object='libreiserfs_static_a-bitmap.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-bitmap.o `test -f 'bitmap.c' || echo '$(srcdir)/'`bitmap.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-bitmap.obj: bitmap.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-bitmap.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-bitmap.Tpo" -c -o libreiserfs_static_a-bitmap.obj `if test -f 'bitmap.c'; then $(CYGPATH_W) 'bitmap.c'; else $(CYGPATH_W) '$(srcdir)/bitmap.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-bitmap.Tpo" "$(DEPDIR)/libreiserfs_static_a-bitmap.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-bitmap.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bitmap.c' object='libreiserfs_static_a-bitmap.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-bitmap.obj `if test -f 'bitmap.c'; then $(CYGPATH_W) 'bitmap.c'; else $(CYGPATH_W) '$(srcdir)/bitmap.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-hash.o: hash.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-hash.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-hash.Tpo" -c -o libreiserfs_static_a-hash.o `test -f 'hash.c' || echo '$(srcdir)/'`hash.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-hash.Tpo" "$(DEPDIR)/libreiserfs_static_a-hash.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-hash.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hash.c' object='libreiserfs_static_a-hash.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-hash.o `test -f 'hash.c' || echo '$(srcdir)/'`hash.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-hash.obj: hash.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-hash.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-hash.Tpo" -c -o libreiserfs_static_a-hash.obj `if test -f 'hash.c'; then $(CYGPATH_W) 'hash.c'; else $(CYGPATH_W) '$(srcdir)/hash.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-hash.Tpo" "$(DEPDIR)/libreiserfs_static_a-hash.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-hash.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hash.c' object='libreiserfs_static_a-hash.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-hash.obj `if test -f 'hash.c'; then $(CYGPATH_W) 'hash.c'; else $(CYGPATH_W) '$(srcdir)/hash.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-leaf_balance.o: leaf_balance.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-leaf_balance.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-leaf_balance.Tpo" -c -o libreiserfs_static_a-leaf_balance.o `test -f 'leaf_balance.c' || echo '$(srcdir)/'`leaf_balance.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-leaf_balance.Tpo" "$(DEPDIR)/libreiserfs_static_a-leaf_balance.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-leaf_balance.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='leaf_balance.c' object='libreiserfs_static_a-leaf_balance.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-leaf_balance.o `test -f 'leaf_balance.c' || echo '$(srcdir)/'`leaf_balance.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-leaf_balance.obj: leaf_balance.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-leaf_balance.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-leaf_balance.Tpo" -c -o libreiserfs_static_a-leaf_balance.obj `if test -f 'leaf_balance.c'; then $(CYGPATH_W) 'leaf_balance.c'; else $(CYGPATH_W) '$(srcdir)/leaf_balance.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-leaf_balance.Tpo" "$(DEPDIR)/libreiserfs_static_a-leaf_balance.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-leaf_balance.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='leaf_balance.c' object='libreiserfs_static_a-leaf_balance.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-leaf_balance.obj `if test -f 'leaf_balance.c'; then $(CYGPATH_W) 'leaf_balance.c'; else $(CYGPATH_W) '$(srcdir)/leaf_balance.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-buffer.o: buffer.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-buffer.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-buffer.Tpo" -c -o libreiserfs_static_a-buffer.o `test -f 'buffer.c' || echo '$(srcdir)/'`buffer.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-buffer.Tpo" "$(DEPDIR)/libreiserfs_static_a-buffer.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-buffer.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buffer.c' object='libreiserfs_static_a-buffer.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-buffer.o `test -f 'buffer.c' || echo '$(srcdir)/'`buffer.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-buffer.obj: buffer.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-buffer.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-buffer.Tpo" -c -o libreiserfs_static_a-buffer.obj `if test -f 'buffer.c'; then $(CYGPATH_W) 'buffer.c'; else $(CYGPATH_W) '$(srcdir)/buffer.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-buffer.Tpo" "$(DEPDIR)/libreiserfs_static_a-buffer.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-buffer.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buffer.c' object='libreiserfs_static_a-buffer.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-buffer.obj `if test -f 'buffer.c'; then $(CYGPATH_W) 'buffer.c'; else $(CYGPATH_W) '$(srcdir)/buffer.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-internal.o: internal.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-internal.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-internal.Tpo" -c -o libreiserfs_static_a-internal.o `test -f 'internal.c' || echo '$(srcdir)/'`internal.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-internal.Tpo" "$(DEPDIR)/libreiserfs_static_a-internal.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-internal.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='internal.c' object='libreiserfs_static_a-internal.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-internal.o `test -f 'internal.c' || echo '$(srcdir)/'`internal.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-internal.obj: internal.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-internal.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-internal.Tpo" -c -o libreiserfs_static_a-internal.obj `if test -f 'internal.c'; then $(CYGPATH_W) 'internal.c'; else $(CYGPATH_W) '$(srcdir)/internal.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-internal.Tpo" "$(DEPDIR)/libreiserfs_static_a-internal.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-internal.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='internal.c' object='libreiserfs_static_a-internal.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-internal.obj `if test -f 'internal.c'; then $(CYGPATH_W) 'internal.c'; else $(CYGPATH_W) '$(srcdir)/internal.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-libreiserfs.o: libreiserfs.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-libreiserfs.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-libreiserfs.Tpo" -c -o libreiserfs_static_a-libreiserfs.o `test -f 'libreiserfs.c' || echo '$(srcdir)/'`libreiserfs.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-libreiserfs.Tpo" "$(DEPDIR)/libreiserfs_static_a-libreiserfs.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-libreiserfs.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libreiserfs.c' object='libreiserfs_static_a-libreiserfs.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-libreiserfs.o `test -f 'libreiserfs.c' || echo '$(srcdir)/'`libreiserfs.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-libreiserfs.obj: libreiserfs.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-libreiserfs.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-libreiserfs.Tpo" -c -o libreiserfs_static_a-libreiserfs.obj `if test -f 'libreiserfs.c'; then $(CYGPATH_W) 'libreiserfs.c'; else $(CYGPATH_W) '$(srcdir)/libreiserfs.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-libreiserfs.Tpo" "$(DEPDIR)/libreiserfs_static_a-libreiserfs.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-libreiserfs.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libreiserfs.c' object='libreiserfs_static_a-libreiserfs.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-libreiserfs.obj `if test -f 'libreiserfs.c'; then $(CYGPATH_W) 'libreiserfs.c'; else $(CYGPATH_W) '$(srcdir)/libreiserfs.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-internal_balance.o: internal_balance.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-internal_balance.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-internal_balance.Tpo" -c -o libreiserfs_static_a-internal_balance.o `test -f 'internal_balance.c' || echo '$(srcdir)/'`internal_balance.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-internal_balance.Tpo" "$(DEPDIR)/libreiserfs_static_a-internal_balance.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-internal_balance.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='internal_balance.c' object='libreiserfs_static_a-internal_balance.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-internal_balance.o `test -f 'internal_balance.c' || echo '$(srcdir)/'`internal_balance.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-internal_balance.obj: internal_balance.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-internal_balance.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-internal_balance.Tpo" -c -o libreiserfs_static_a-internal_balance.obj `if test -f 'internal_balance.c'; then $(CYGPATH_W) 'internal_balance.c'; else $(CYGPATH_W) '$(srcdir)/internal_balance.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-internal_balance.Tpo" "$(DEPDIR)/libreiserfs_static_a-internal_balance.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-internal_balance.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='internal_balance.c' object='libreiserfs_static_a-internal_balance.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-internal_balance.obj `if test -f 'internal_balance.c'; then $(CYGPATH_W) 'internal_balance.c'; else $(CYGPATH_W) '$(srcdir)/internal_balance.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-super.o: super.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-super.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-super.Tpo" -c -o libreiserfs_static_a-super.o `test -f 'super.c' || echo '$(srcdir)/'`super.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-super.Tpo" "$(DEPDIR)/libreiserfs_static_a-super.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-super.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='super.c' object='libreiserfs_static_a-super.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-super.o `test -f 'super.c' || echo '$(srcdir)/'`super.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-super.obj: super.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-super.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-super.Tpo" -c -o libreiserfs_static_a-super.obj `if test -f 'super.c'; then $(CYGPATH_W) 'super.c'; else $(CYGPATH_W) '$(srcdir)/super.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-super.Tpo" "$(DEPDIR)/libreiserfs_static_a-super.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-super.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='super.c' object='libreiserfs_static_a-super.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-super.obj `if test -f 'super.c'; then $(CYGPATH_W) 'super.c'; else $(CYGPATH_W) '$(srcdir)/super.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-direntry.o: direntry.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-direntry.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-direntry.Tpo" -c -o libreiserfs_static_a-direntry.o `test -f 'direntry.c' || echo '$(srcdir)/'`direntry.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-direntry.Tpo" "$(DEPDIR)/libreiserfs_static_a-direntry.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-direntry.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='direntry.c' object='libreiserfs_static_a-direntry.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-direntry.o `test -f 'direntry.c' || echo '$(srcdir)/'`direntry.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-direntry.obj: direntry.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-direntry.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-direntry.Tpo" -c -o libreiserfs_static_a-direntry.obj `if test -f 'direntry.c'; then $(CYGPATH_W) 'direntry.c'; else $(CYGPATH_W) '$(srcdir)/direntry.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-direntry.Tpo" "$(DEPDIR)/libreiserfs_static_a-direntry.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-direntry.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='direntry.c' object='libreiserfs_static_a-direntry.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-direntry.obj `if test -f 'direntry.c'; then $(CYGPATH_W) 'direntry.c'; else $(CYGPATH_W) '$(srcdir)/direntry.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-node.o: node.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-node.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-node.Tpo" -c -o libreiserfs_static_a-node.o `test -f 'node.c' || echo '$(srcdir)/'`node.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-node.Tpo" "$(DEPDIR)/libreiserfs_static_a-node.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-node.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='node.c' object='libreiserfs_static_a-node.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-node.o `test -f 'node.c' || echo '$(srcdir)/'`node.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-node.obj: node.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-node.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-node.Tpo" -c -o libreiserfs_static_a-node.obj `if test -f 'node.c'; then $(CYGPATH_W) 'node.c'; else $(CYGPATH_W) '$(srcdir)/node.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-node.Tpo" "$(DEPDIR)/libreiserfs_static_a-node.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-node.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='node.c' object='libreiserfs_static_a-node.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-node.obj `if test -f 'node.c'; then $(CYGPATH_W) 'node.c'; else $(CYGPATH_W) '$(srcdir)/node.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-tree.o: tree.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-tree.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-tree.Tpo" -c -o libreiserfs_static_a-tree.o `test -f 'tree.c' || echo '$(srcdir)/'`tree.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-tree.Tpo" "$(DEPDIR)/libreiserfs_static_a-tree.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-tree.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tree.c' object='libreiserfs_static_a-tree.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-tree.o `test -f 'tree.c' || echo '$(srcdir)/'`tree.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-tree.obj: tree.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-tree.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-tree.Tpo" -c -o libreiserfs_static_a-tree.obj `if test -f 'tree.c'; then $(CYGPATH_W) 'tree.c'; else $(CYGPATH_W) '$(srcdir)/tree.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-tree.Tpo" "$(DEPDIR)/libreiserfs_static_a-tree.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-tree.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tree.c' object='libreiserfs_static_a-tree.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-tree.obj `if test -f 'tree.c'; then $(CYGPATH_W) 'tree.c'; else $(CYGPATH_W) '$(srcdir)/tree.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-extent.o: extent.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-extent.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-extent.Tpo" -c -o libreiserfs_static_a-extent.o `test -f 'extent.c' || echo '$(srcdir)/'`extent.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-extent.Tpo" "$(DEPDIR)/libreiserfs_static_a-extent.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-extent.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='extent.c' object='libreiserfs_static_a-extent.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-extent.o `test -f 'extent.c' || echo '$(srcdir)/'`extent.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-extent.obj: extent.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-extent.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-extent.Tpo" -c -o libreiserfs_static_a-extent.obj `if test -f 'extent.c'; then $(CYGPATH_W) 'extent.c'; else $(CYGPATH_W) '$(srcdir)/extent.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-extent.Tpo" "$(DEPDIR)/libreiserfs_static_a-extent.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-extent.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='extent.c' object='libreiserfs_static_a-extent.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-extent.obj `if test -f 'extent.c'; then $(CYGPATH_W) 'extent.c'; else $(CYGPATH_W) '$(srcdir)/extent.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-journal.o: journal.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-journal.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-journal.Tpo" -c -o libreiserfs_static_a-journal.o `test -f 'journal.c' || echo '$(srcdir)/'`journal.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-journal.Tpo" "$(DEPDIR)/libreiserfs_static_a-journal.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-journal.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='journal.c' object='libreiserfs_static_a-journal.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-journal.o `test -f 'journal.c' || echo '$(srcdir)/'`journal.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-journal.obj: journal.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-journal.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-journal.Tpo" -c -o libreiserfs_static_a-journal.obj `if test -f 'journal.c'; then $(CYGPATH_W) 'journal.c'; else $(CYGPATH_W) '$(srcdir)/journal.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-journal.Tpo" "$(DEPDIR)/libreiserfs_static_a-journal.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-journal.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='journal.c' object='libreiserfs_static_a-journal.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-journal.obj `if test -f 'journal.c'; then $(CYGPATH_W) 'journal.c'; else $(CYGPATH_W) '$(srcdir)/journal.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-objmap.o: objmap.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-objmap.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-objmap.Tpo" -c -o libreiserfs_static_a-objmap.o `test -f 'objmap.c' || echo '$(srcdir)/'`objmap.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-objmap.Tpo" "$(DEPDIR)/libreiserfs_static_a-objmap.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-objmap.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='objmap.c' object='libreiserfs_static_a-objmap.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-objmap.o `test -f 'objmap.c' || echo '$(srcdir)/'`objmap.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-objmap.obj: objmap.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-objmap.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-objmap.Tpo" -c -o libreiserfs_static_a-objmap.obj `if test -f 'objmap.c'; then $(CYGPATH_W) 'objmap.c'; else $(CYGPATH_W) '$(srcdir)/objmap.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-objmap.Tpo" "$(DEPDIR)/libreiserfs_static_a-objmap.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-objmap.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='objmap.c' object='libreiserfs_static_a-objmap.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-objmap.obj `if test -f 'objmap.c'; then $(CYGPATH_W) 'objmap.c'; else $(CYGPATH_W) '$(srcdir)/objmap.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-tree_balance.o: tree_balance.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-tree_balance.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-tree_balance.Tpo" -c -o libreiserfs_static_a-tree_balance.o `test -f 'tree_balance.c' || echo '$(srcdir)/'`tree_balance.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-tree_balance.Tpo" "$(DEPDIR)/libreiserfs_static_a-tree_balance.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-tree_balance.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tree_balance.c' object='libreiserfs_static_a-tree_balance.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-tree_balance.o `test -f 'tree_balance.c' || echo '$(srcdir)/'`tree_balance.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-tree_balance.obj: tree_balance.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-tree_balance.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-tree_balance.Tpo" -c -o libreiserfs_static_a-tree_balance.obj `if test -f 'tree_balance.c'; then $(CYGPATH_W) 'tree_balance.c'; else $(CYGPATH_W) '$(srcdir)/tree_balance.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-tree_balance.Tpo" "$(DEPDIR)/libreiserfs_static_a-tree_balance.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-tree_balance.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tree_balance.c' object='libreiserfs_static_a-tree_balance.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-tree_balance.obj `if test -f 'tree_balance.c'; then $(CYGPATH_W) 'tree_balance.c'; else $(CYGPATH_W) '$(srcdir)/tree_balance.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-filesystem.o: filesystem.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-filesystem.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-filesystem.Tpo" -c -o libreiserfs_static_a-filesystem.o `test -f 'filesystem.c' || echo '$(srcdir)/'`filesystem.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-filesystem.Tpo" "$(DEPDIR)/libreiserfs_static_a-filesystem.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-filesystem.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='filesystem.c' object='libreiserfs_static_a-filesystem.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-filesystem.o `test -f 'filesystem.c' || echo '$(srcdir)/'`filesystem.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-filesystem.obj: filesystem.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-filesystem.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-filesystem.Tpo" -c -o libreiserfs_static_a-filesystem.obj `if test -f 'filesystem.c'; then $(CYGPATH_W) 'filesystem.c'; else $(CYGPATH_W) '$(srcdir)/filesystem.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-filesystem.Tpo" "$(DEPDIR)/libreiserfs_static_a-filesystem.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-filesystem.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='filesystem.c' object='libreiserfs_static_a-filesystem.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-filesystem.obj `if test -f 'filesystem.c'; then $(CYGPATH_W) 'filesystem.c'; else $(CYGPATH_W) '$(srcdir)/filesystem.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-key.o: key.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-key.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-key.Tpo" -c -o libreiserfs_static_a-key.o `test -f 'key.c' || echo '$(srcdir)/'`key.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-key.Tpo" "$(DEPDIR)/libreiserfs_static_a-key.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-key.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='key.c' object='libreiserfs_static_a-key.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-key.o `test -f 'key.c' || echo '$(srcdir)/'`key.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-key.obj: key.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-key.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-key.Tpo" -c -o libreiserfs_static_a-key.obj `if test -f 'key.c'; then $(CYGPATH_W) 'key.c'; else $(CYGPATH_W) '$(srcdir)/key.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-key.Tpo" "$(DEPDIR)/libreiserfs_static_a-key.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-key.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='key.c' object='libreiserfs_static_a-key.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-key.obj `if test -f 'key.c'; then $(CYGPATH_W) 'key.c'; else $(CYGPATH_W) '$(srcdir)/key.c'; fi`
|
||||||
|
|
||||||
|
libreiserfs_static_a-prints.o: prints.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-prints.o -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-prints.Tpo" -c -o libreiserfs_static_a-prints.o `test -f 'prints.c' || echo '$(srcdir)/'`prints.c; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-prints.Tpo" "$(DEPDIR)/libreiserfs_static_a-prints.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-prints.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='prints.c' object='libreiserfs_static_a-prints.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-prints.o `test -f 'prints.c' || echo '$(srcdir)/'`prints.c
|
||||||
|
|
||||||
|
libreiserfs_static_a-prints.obj: prints.c
|
||||||
|
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -MT libreiserfs_static_a-prints.obj -MD -MP -MF "$(DEPDIR)/libreiserfs_static_a-prints.Tpo" -c -o libreiserfs_static_a-prints.obj `if test -f 'prints.c'; then $(CYGPATH_W) 'prints.c'; else $(CYGPATH_W) '$(srcdir)/prints.c'; fi`; \
|
||||||
|
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libreiserfs_static_a-prints.Tpo" "$(DEPDIR)/libreiserfs_static_a-prints.Po"; else rm -f "$(DEPDIR)/libreiserfs_static_a-prints.Tpo"; exit 1; fi
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='prints.c' object='libreiserfs_static_a-prints.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libreiserfs_static_a_CFLAGS) $(CFLAGS) -c -o libreiserfs_static_a-prints.obj `if test -f 'prints.c'; then $(CYGPATH_W) 'prints.c'; else $(CYGPATH_W) '$(srcdir)/prints.c'; fi`
|
||||||
|
uninstall-info-am:
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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; }'`; \
|
||||||
|
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||||
|
test -n "$$unique" || unique=$$empty_fix; \
|
||||||
|
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||||
|
$$tags $$unique; \
|
||||||
|
fi
|
||||||
|
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
|
||||||
|
|
||||||
|
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"; \
|
||||||
|
$(mkdir_p) "$(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 $(LIBRARIES)
|
||||||
|
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
|
||||||
|
|
||||||
|
installcheck: installcheck-am
|
||||||
|
install-strip:
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
|
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||||
|
`test -z '$(STRIP)' || \
|
||||||
|
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||||
|
mostlyclean-generic:
|
||||||
|
|
||||||
|
clean-generic:
|
||||||
|
|
||||||
|
distclean-generic:
|
||||||
|
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(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-noinstLIBRARIES mostlyclean-am
|
||||||
|
|
||||||
|
distclean: distclean-am
|
||||||
|
-rm -rf ./$(DEPDIR)
|
||||||
|
-rm -f Makefile
|
||||||
|
distclean-am: clean-am distclean-compile distclean-generic \
|
||||||
|
distclean-tags
|
||||||
|
|
||||||
|
dvi: dvi-am
|
||||||
|
|
||||||
|
dvi-am:
|
||||||
|
|
||||||
|
html: html-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
|
||||||
|
-rm -rf ./$(DEPDIR)
|
||||||
|
-rm -f Makefile
|
||||||
|
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-generic distclean-tags distdir dvi dvi-am html \
|
||||||
|
html-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.
|
||||||
|
.NOEXPORT:
|
||||||
@@ -0,0 +1,202 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "reiserfs/libreiserfs.h"
|
||||||
|
#include "misc/unaligned.h"
|
||||||
|
#include "misc/misc.h"
|
||||||
|
|
||||||
|
reiserfs_key_t badblock_key = {REISERFS_BAD_DID, REISERFS_BAD_OID, {{0, 0},}};
|
||||||
|
|
||||||
|
void reiserfs_badblock_traverse(reiserfs_filsys_t * fs,
|
||||||
|
badblock_func_t action,
|
||||||
|
void *data)
|
||||||
|
{
|
||||||
|
reiserfs_path_t badblock_path;
|
||||||
|
reiserfs_key_t rd_key = badblock_key;
|
||||||
|
const reiserfs_key_t *key;
|
||||||
|
|
||||||
|
badblock_path.path_length = REISERFS_PATH_OFFILL;
|
||||||
|
reiserfs_key_set_sec (KEY_FORMAT_2, &badblock_key, 1, TYPE_EXTENT);
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
if (reiserfs_tree_search_item (fs, &rd_key, &badblock_path) == IO_ERROR) {
|
||||||
|
fprintf (stderr, "%s: Some problems while searching by the key "
|
||||||
|
"occured. Probably due to tree corruptions.\n",
|
||||||
|
__FUNCTION__);
|
||||||
|
reiserfs_tree_pathrelse (&badblock_path);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (reiserfs_nh_get_items (NODE_HEAD (REISERFS_PATH_LEAF (&badblock_path))) <=
|
||||||
|
REISERFS_PATH_LEAF_POS (&badblock_path))
|
||||||
|
{
|
||||||
|
reiserfs_tree_pathrelse (&badblock_path);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
rd_key = REISERFS_PATH_IH(&badblock_path)->ih_key;
|
||||||
|
|
||||||
|
if (reiserfs_key_get_did(&rd_key) != REISERFS_BAD_DID ||
|
||||||
|
reiserfs_key_get_oid(&rd_key) != REISERFS_BAD_OID ||
|
||||||
|
!reiserfs_key_ext(&rd_key))
|
||||||
|
{
|
||||||
|
reiserfs_tree_pathrelse (&badblock_path);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((key = reiserfs_tree_next_key(&badblock_path, fs)))
|
||||||
|
rd_key = *key;
|
||||||
|
else
|
||||||
|
memset(&rd_key, 0, sizeof(rd_key));
|
||||||
|
|
||||||
|
action(fs, &badblock_path, data);
|
||||||
|
|
||||||
|
if (reiserfs_key_get_did(&rd_key) == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void callback_badblock_rm(reiserfs_filsys_t *fs,
|
||||||
|
reiserfs_path_t *badblock_path,
|
||||||
|
void *data)
|
||||||
|
{
|
||||||
|
reiserfs_tb_t tb;
|
||||||
|
reiserfs_ih_t * tmp_ih;
|
||||||
|
|
||||||
|
tmp_ih = REISERFS_PATH_IH(badblock_path);
|
||||||
|
memset (REISERFS_PATH_ITEM (badblock_path),
|
||||||
|
0, reiserfs_ih_get_len (tmp_ih));
|
||||||
|
|
||||||
|
reiserfs_tb_init (&tb, fs, badblock_path,
|
||||||
|
-(REISERFS_IH_SIZE +
|
||||||
|
reiserfs_ih_get_len(REISERFS_PATH_IH(badblock_path))));
|
||||||
|
|
||||||
|
if (reiserfs_fix_nodes (M_DELETE, &tb, 0) != CARRY_ON)
|
||||||
|
misc_die ("%s: reiserfs_fix_nodes failed", __FUNCTION__);
|
||||||
|
|
||||||
|
reiserfs_tb_balance (&tb, 0, 0, M_DELETE, 0/*zero num*/);
|
||||||
|
}
|
||||||
|
|
||||||
|
void reiserfs_badblock_extract(reiserfs_filsys_t *fs,
|
||||||
|
reiserfs_path_t *badblock_path,
|
||||||
|
void *data)
|
||||||
|
{
|
||||||
|
reiserfs_ih_t *tmp_ih;
|
||||||
|
__u32 *ind_item;
|
||||||
|
__u32 i;
|
||||||
|
|
||||||
|
if (!fs->fs_badblocks_bm) {
|
||||||
|
fs->fs_badblocks_bm =
|
||||||
|
reiserfs_bitmap_create(reiserfs_sb_get_blocks(fs->fs_ondisk_sb));
|
||||||
|
|
||||||
|
reiserfs_bitmap_zero (fs->fs_badblocks_bm);
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp_ih = REISERFS_PATH_IH(badblock_path);
|
||||||
|
ind_item = (__u32 *)REISERFS_PATH_ITEM(badblock_path);
|
||||||
|
|
||||||
|
for (i = 0; i < reiserfs_ext_count(tmp_ih); i++) {
|
||||||
|
reiserfs_bitmap_set_bit(fs->fs_badblocks_bm,
|
||||||
|
d32_get(ind_item, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
reiserfs_tree_pathrelse (badblock_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int reiserfs_alloc_blocks (reiserfs_filsys_t * fs,
|
||||||
|
unsigned long *blknr,
|
||||||
|
unsigned long start,
|
||||||
|
int count)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i ++) {
|
||||||
|
blknr[i] = 0;
|
||||||
|
if (reiserfs_bitmap_find_zero_bit(fs->fs_bitmap2, blknr + i))
|
||||||
|
misc_die ("%s: failed to allocate a block.", __FUNCTION__);
|
||||||
|
|
||||||
|
reiserfs_bitmap_set_bit(fs->fs_bitmap2, blknr[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return CARRY_ON;
|
||||||
|
}
|
||||||
|
|
||||||
|
void reiserfs_badblock_flush (reiserfs_filsys_t * fs, int replace) {
|
||||||
|
reiserfs_tb_t tb;
|
||||||
|
reiserfs_path_t badblock_path;
|
||||||
|
reiserfs_ih_t badblock_ih;
|
||||||
|
__u32 ni;
|
||||||
|
|
||||||
|
__u64 offset;
|
||||||
|
__u32 i, j;
|
||||||
|
|
||||||
|
if (fs->fs_badblocks_bm == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* delete all items with badblock_key */
|
||||||
|
if (replace)
|
||||||
|
reiserfs_badblock_traverse(fs, callback_badblock_rm, NULL);
|
||||||
|
|
||||||
|
memset(&badblock_ih, 0, sizeof(badblock_ih));
|
||||||
|
reiserfs_ih_set_format (&badblock_ih, KEY_FORMAT_2);
|
||||||
|
reiserfs_ih_set_len (&badblock_ih, REISERFS_EXT_SIZE);
|
||||||
|
reiserfs_ih_set_free (&badblock_ih, 0);
|
||||||
|
reiserfs_ih_set_loc (&badblock_ih, 0);
|
||||||
|
reiserfs_key_set_did (&badblock_ih.ih_key, REISERFS_BAD_DID);
|
||||||
|
reiserfs_key_set_oid (&badblock_ih.ih_key, REISERFS_BAD_OID);
|
||||||
|
reiserfs_key_set_type (KEY_FORMAT_2, &badblock_ih.ih_key, TYPE_EXTENT);
|
||||||
|
|
||||||
|
j = 0;
|
||||||
|
|
||||||
|
fs->block_allocator = reiserfs_alloc_blocks;
|
||||||
|
|
||||||
|
/* insert all badblock pointers */
|
||||||
|
for (i = 0; i < fs->fs_badblocks_bm->bm_bit_size; i++) {
|
||||||
|
int retval;
|
||||||
|
|
||||||
|
if (!reiserfs_bitmap_test_bit (fs->fs_badblocks_bm, i))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
offset = j * fs->fs_blocksize + 1;
|
||||||
|
reiserfs_key_set_off (KEY_FORMAT_2, &badblock_ih.ih_key, offset);
|
||||||
|
ni = cpu_to_le32 (i);
|
||||||
|
|
||||||
|
retval = reiserfs_tree_search_position (fs, &badblock_ih.ih_key,
|
||||||
|
&badblock_path);
|
||||||
|
|
||||||
|
switch (retval) {
|
||||||
|
case (FILE_NOT_FOUND):
|
||||||
|
reiserfs_tb_init (&tb, fs, &badblock_path,
|
||||||
|
REISERFS_IH_SIZE + reiserfs_ih_get_len(&badblock_ih));
|
||||||
|
|
||||||
|
if (reiserfs_fix_nodes (M_INSERT, &tb, &badblock_ih) != CARRY_ON)
|
||||||
|
misc_die ("reiserfs_badblock_flush: reiserfs_fix_nodes failed");
|
||||||
|
|
||||||
|
reiserfs_tb_balance (&tb, &badblock_ih, (void *)&ni , M_INSERT, 0);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (POSITION_NOT_FOUND):
|
||||||
|
case (POSITION_FOUND):
|
||||||
|
/* Insert the new item to the found position. */
|
||||||
|
|
||||||
|
reiserfs_tb_init (&tb, fs, &badblock_path, REISERFS_EXT_SIZE);
|
||||||
|
|
||||||
|
if (reiserfs_fix_nodes (M_PASTE, &tb, 0) != CARRY_ON)
|
||||||
|
misc_die ("reiserfs_badblock_flush: reiserfs_fix_nodes failed");
|
||||||
|
|
||||||
|
reiserfs_tb_balance (&tb, 0, (const char *)&ni, M_PASTE, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -3,243 +3,48 @@
|
|||||||
* reiserfsprogs/README
|
* reiserfsprogs/README
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
#ifdef HAVE_CONFIG_H
|
||||||
* 2000/10/26 - Initial version.
|
# include <config.h>
|
||||||
*/
|
#endif
|
||||||
|
|
||||||
|
#include "reiserfs/libreiserfs.h"
|
||||||
|
#include "misc/malloc.h"
|
||||||
|
|
||||||
#include "includes.h"
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
/* create clean bitmap */
|
/* create clean bitmap */
|
||||||
reiserfs_bitmap_t * reiserfs_create_bitmap (unsigned int bit_count)
|
reiserfs_bitmap_t * reiserfs_bitmap_create (unsigned int bit_count)
|
||||||
{
|
{
|
||||||
reiserfs_bitmap_t * bm;
|
reiserfs_bitmap_t * bm;
|
||||||
|
|
||||||
bm = getmem (sizeof (*bm));
|
bm = misc_getmem (sizeof (*bm));
|
||||||
if (!bm)
|
if (!bm)
|
||||||
return 0;
|
return 0;
|
||||||
bm->bm_bit_size = bit_count;
|
bm->bm_bit_size = bit_count;
|
||||||
bm->bm_byte_size = ((unsigned long long)bit_count + 7) / 8;
|
bm->bm_byte_size = ((unsigned long long)bit_count + 7) / 8;
|
||||||
bm->bm_set_bits = 0;
|
bm->bm_map = misc_getmem (bm->bm_byte_size);
|
||||||
bm->bm_map = getmem (bm->bm_byte_size);
|
|
||||||
if (!bm->bm_map) {
|
if (!bm->bm_map) {
|
||||||
freemem (bm);
|
misc_freemem (bm);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bm;
|
return bm;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Expand existing bitmap. Return non-zero if can't. FIXME: it is
|
|
||||||
assumed that bit_count is new number of blocks to be addressed */
|
|
||||||
int reiserfs_expand_bitmap (reiserfs_bitmap_t * bm, unsigned int bit_count)
|
|
||||||
{
|
|
||||||
unsigned int byte_count = ((bit_count + 7) / 8);
|
|
||||||
char * new_map;
|
|
||||||
|
|
||||||
new_map = expandmem (bm->bm_map, bm->bm_byte_size,
|
|
||||||
byte_count - bm->bm_byte_size);
|
|
||||||
|
|
||||||
if (!new_map) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bm->bm_map = new_map;
|
|
||||||
bm->bm_byte_size = byte_count;
|
|
||||||
bm->bm_bit_size = bit_count;
|
|
||||||
|
|
||||||
bm->bm_dirty = 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void reiserfs_shrink_bitmap (reiserfs_bitmap_t * bm, unsigned int bit_count)
|
|
||||||
{
|
|
||||||
unsigned long i;
|
|
||||||
|
|
||||||
assert (bm->bm_bit_size >= bit_count);
|
|
||||||
|
|
||||||
bm->bm_byte_size = (bit_count + 7) / 8;
|
|
||||||
bm->bm_bit_size = bit_count;
|
|
||||||
bm->bm_set_bits = 0;
|
|
||||||
|
|
||||||
bm->bm_dirty = 1;
|
|
||||||
|
|
||||||
for (i = 0; i < bm->bm_bit_size; i++) {
|
|
||||||
if (reiserfs_bitmap_test_bit(bm, i))
|
|
||||||
bm->bm_set_bits++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* bitmap destructor */
|
|
||||||
void reiserfs_delete_bitmap (reiserfs_bitmap_t * bm)
|
|
||||||
{
|
|
||||||
freemem(bm->bm_map);
|
|
||||||
bm->bm_map = NULL; /* to not reuse bitmap handle */
|
|
||||||
bm->bm_bit_size = 0;
|
|
||||||
bm->bm_byte_size = 0;
|
|
||||||
freemem(bm);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void reiserfs_bitmap_copy (reiserfs_bitmap_t * to, reiserfs_bitmap_t * from)
|
|
||||||
{
|
|
||||||
assert (to->bm_byte_size == from->bm_byte_size);
|
|
||||||
memcpy (to->bm_map, from->bm_map, from->bm_byte_size);
|
|
||||||
to->bm_bit_size = from->bm_bit_size;
|
|
||||||
to->bm_set_bits = from->bm_set_bits;
|
|
||||||
to->bm_dirty = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int reiserfs_bitmap_compare (reiserfs_bitmap_t * bm1, reiserfs_bitmap_t * bm2)
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
|
|
||||||
diff = 0;
|
|
||||||
|
|
||||||
/* compare full bytes */
|
|
||||||
bytes = bm1->bm_bit_size / 8;
|
|
||||||
bits = bytes * 8;
|
|
||||||
if (memcmp (bm1->bm_map, bm2->bm_map, bytes)) {
|
|
||||||
for (i = 0; i < bits; i ++)
|
|
||||||
if (reiserfs_bitmap_test_bit(bm1, i) != reiserfs_bitmap_test_bit(bm2, i))
|
|
||||||
diff ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* compare last byte of bitmap which can be used partially */
|
|
||||||
bits = bm1->bm_bit_size % 8;
|
|
||||||
for (i = bm1->bm_bit_size / 8 * 8; i < bm1->bm_bit_size / 8 * 8 + bits; i ++)
|
|
||||||
if (reiserfs_bitmap_test_bit(bm1, i) != reiserfs_bitmap_test_bit(bm2, i))
|
|
||||||
diff ++;
|
|
||||||
|
|
||||||
/* int mask;
|
|
||||||
|
|
||||||
mask = 255 >> (8 - bits);
|
|
||||||
if ((bm1->bm_map [bytes] & mask) != (bm2->bm_map [bytes] & mask)) {
|
|
||||||
diff ++;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
return diff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Does X | Y for every bit of the bitmap `to`, where
|
|
||||||
X - bit of the `to` bitmap,
|
|
||||||
Y - `from` bitmap.
|
|
||||||
Save result in the `to` bitmap.
|
|
||||||
*/
|
|
||||||
void reiserfs_bitmap_disjunction (reiserfs_bitmap_t * to,
|
|
||||||
reiserfs_bitmap_t * from)
|
|
||||||
{
|
|
||||||
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 (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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Does X & !Y for every bit of the bitmap `base`, where
|
|
||||||
X - bit of the `base` bitmap,
|
|
||||||
Y - `exclude` bitmap.
|
|
||||||
Save result in the `base` bitmap.
|
|
||||||
*/
|
|
||||||
void reiserfs_bitmap_delta (reiserfs_bitmap_t * base, reiserfs_bitmap_t * exclude) {
|
|
||||||
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 (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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void reiserfs_bitmap_set_bit (reiserfs_bitmap_t * bm, unsigned int bit_number)
|
|
||||||
{
|
|
||||||
assert(bit_number < bm->bm_bit_size);
|
|
||||||
if (misc_test_bit (bit_number, bm->bm_map))
|
|
||||||
return;
|
|
||||||
misc_set_bit(bit_number, bm->bm_map);
|
|
||||||
bm->bm_set_bits ++;
|
|
||||||
bm->bm_dirty = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void reiserfs_bitmap_clear_bit (reiserfs_bitmap_t * bm, unsigned int bit_number)
|
|
||||||
{
|
|
||||||
assert(bit_number < bm->bm_bit_size);
|
|
||||||
if (!misc_test_bit (bit_number, bm->bm_map))
|
|
||||||
return;
|
|
||||||
misc_clear_bit (bit_number, bm->bm_map);
|
|
||||||
bm->bm_set_bits --;
|
|
||||||
bm->bm_dirty = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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 misc_test_bit(bit_number, bm->bm_map);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
unsigned int reiserfs_bitmap_zeros (reiserfs_bitmap_t * bm) {
|
|
||||||
return bm->bm_bit_size - bm->bm_set_bits;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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 * first)
|
|
||||||
{
|
|
||||||
unsigned long bit_nr = *first;
|
|
||||||
assert(*first < bm->bm_bit_size);
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
*first = bit_nr;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* read every bitmap block and copy their content into bitmap 'bm' */
|
/* 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)
|
static int reiserfs_bitmap_fetch (reiserfs_bitmap_t * bm,
|
||||||
|
reiserfs_filsys_t * fs)
|
||||||
{
|
{
|
||||||
unsigned int last_byte_unused_bits;
|
unsigned int last_byte_unused_bits;
|
||||||
unsigned long block, to_copy;
|
unsigned long block, to_copy;
|
||||||
struct buffer_head * bh;
|
reiserfs_bh_t * bh;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int copied;
|
int copied;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char * p;
|
char * p;
|
||||||
|
|
||||||
to_copy = (get_sb_block_count (fs->fs_ondisk_sb) + 7) / 8;
|
to_copy = (reiserfs_sb_get_blocks (fs->fs_ondisk_sb) + 7) / 8;
|
||||||
|
|
||||||
/*reiserfs_warning (stderr, "Fetching on-disk bitmap..");*/
|
/*reiserfs_warning (stderr, "Fetching on-disk bitmap..");*/
|
||||||
assert (bm->bm_byte_size == to_copy);
|
assert (bm->bm_byte_size == to_copy);
|
||||||
@@ -249,19 +54,20 @@ static int reiserfs_fetch_ondisk_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys
|
|||||||
block = fs->fs_super_bh->b_blocknr + 1;
|
block = fs->fs_super_bh->b_blocknr + 1;
|
||||||
|
|
||||||
while (to_copy) {
|
while (to_copy) {
|
||||||
bh = bread (fs->fs_dev, block, fs->fs_blocksize);
|
bh = reiserfs_buffer_read (fs->fs_dev, block, fs->fs_blocksize);
|
||||||
if (!bh) {
|
if (!bh) {
|
||||||
reiserfs_warning (stderr, "reiserfs_fetch_ondisk_bitmap: "
|
reiserfs_warning (stderr, "reiserfs_bitmap_fetch: "
|
||||||
"bread failed reading bitmap (%lu)\n", block);
|
"reiserfs_buffer_read failed reading bitmap "
|
||||||
|
"(%lu)\n", block);
|
||||||
|
|
||||||
bh = getblk (fs->fs_dev, block, fs->fs_blocksize);
|
bh = reiserfs_buffer_open (fs->fs_dev, block, fs->fs_blocksize);
|
||||||
if (!bh) {
|
if (!bh) {
|
||||||
reiserfs_exit (1, "reiserfs_fetch_ondisk_bitmap: "
|
reiserfs_exit (1, "reiserfs_bitmap_fetch: "
|
||||||
"getblk failed");
|
"reiserfs_buffer_open failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
memset (bh->b_data, 0xff, bh->b_size);
|
memset (bh->b_data, 0xff, bh->b_size);
|
||||||
mark_buffer_uptodate (bh, 1);
|
reiserfs_buffer_mkuptodate (bh, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to_copy < fs->fs_blocksize) {
|
if (to_copy < fs->fs_blocksize) {
|
||||||
@@ -275,13 +81,14 @@ static int reiserfs_fetch_ondisk_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys
|
|||||||
copied = to_copy;
|
copied = to_copy;
|
||||||
}
|
}
|
||||||
memcpy (p, bh->b_data, copied);
|
memcpy (p, bh->b_data, copied);
|
||||||
brelse (bh);
|
reiserfs_buffer_close (bh);
|
||||||
p += copied;
|
p += copied;
|
||||||
to_copy -= copied;
|
to_copy -= copied;
|
||||||
|
|
||||||
/* next bitmap block */
|
/* next bitmap block */
|
||||||
if (spread_bitmaps (fs))
|
if (reiserfs_bitmap_spread (fs))
|
||||||
block = (block / (fs->fs_blocksize * 8) + 1) * (fs->fs_blocksize * 8);
|
block = (block / (fs->fs_blocksize * 8) + 1) *
|
||||||
|
(fs->fs_blocksize * 8);
|
||||||
else
|
else
|
||||||
block ++;
|
block ++;
|
||||||
}
|
}
|
||||||
@@ -308,30 +115,85 @@ static int reiserfs_fetch_ondisk_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* read bitmap blocks */
|
||||||
|
int reiserfs_bitmap_open (reiserfs_filsys_t * fs) {
|
||||||
|
unsigned int bmap_nr, count;
|
||||||
|
|
||||||
|
if (fs->fs_bitmap2)
|
||||||
|
reiserfs_panic ("bitmap is initiaized already");
|
||||||
|
|
||||||
|
count = reiserfs_sb_get_blocks (fs->fs_ondisk_sb);
|
||||||
|
|
||||||
|
fs->fs_bitmap2 = reiserfs_bitmap_create (count);
|
||||||
|
|
||||||
|
if (!fs->fs_bitmap2)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
bmap_nr = reiserfs_bmap_nr(count, fs->fs_blocksize);
|
||||||
|
bmap_nr = reiserfs_bmap_over(bmap_nr) ? 0 : bmap_nr;
|
||||||
|
|
||||||
|
if (bmap_nr != reiserfs_sb_get_bmaps (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 -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return reiserfs_bitmap_fetch (fs->fs_bitmap2, fs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* bitmap destructor */
|
||||||
|
void reiserfs_bitmap_delete (reiserfs_bitmap_t * bm)
|
||||||
|
{
|
||||||
|
misc_freemem(bm->bm_map);
|
||||||
|
bm->bm_map = NULL; /* to not reuse bitmap handle */
|
||||||
|
bm->bm_bit_size = 0;
|
||||||
|
bm->bm_byte_size = 0;
|
||||||
|
misc_freemem(bm);
|
||||||
|
}
|
||||||
|
|
||||||
|
void reiserfs_bitmap_free (reiserfs_filsys_t * fs)
|
||||||
|
{
|
||||||
|
if (fs->fs_bitmap2) {
|
||||||
|
reiserfs_bitmap_delete (fs->fs_bitmap2);
|
||||||
|
fs->fs_bitmap2 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void reiserfs_bitmap_close (reiserfs_filsys_t * fs)
|
||||||
|
{
|
||||||
|
if (!fs->fs_bitmap2)
|
||||||
|
return;
|
||||||
|
reiserfs_bitmap_flush (fs->fs_bitmap2, fs);
|
||||||
|
reiserfs_bitmap_free (fs);
|
||||||
|
}
|
||||||
|
|
||||||
/* copy bitmap 'bm' to buffers which hold on-disk bitmap if bitmap was ever
|
/* copy bitmap 'bm' to buffers which hold on-disk bitmap if bitmap was ever
|
||||||
changed and return 1. Otherwise - return 0 */
|
changed and return 1. Otherwise - return 0 */
|
||||||
int reiserfs_flush_to_ondisk_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys_t * fs)
|
int reiserfs_bitmap_flush (reiserfs_bitmap_t * bm, reiserfs_filsys_t * fs)
|
||||||
{
|
{
|
||||||
unsigned int last_byte_unused_bits, i;
|
unsigned int last_byte_unused_bits, i;
|
||||||
unsigned long to_copy, copied, block;
|
unsigned long to_copy, copied, block;
|
||||||
struct buffer_head * bh;
|
reiserfs_bh_t * bh;
|
||||||
char * p;
|
char * p;
|
||||||
|
|
||||||
/* make sure that the device is big enough */
|
/* make sure that the device is big enough */
|
||||||
bh = bread (fs->fs_dev, bm->bm_bit_size - 1, fs->fs_blocksize);
|
bh = reiserfs_buffer_read (fs->fs_dev, bm->bm_bit_size - 1, fs->fs_blocksize);
|
||||||
if (!bh) {
|
if (!bh) {
|
||||||
reiserfs_warning (stderr, "reiserfs_flush_to_ondisk_bitmap: bread failed for block %lu\n",
|
reiserfs_warning (stderr, "reiserfs_bitmap_flush: reiserfs_buffer_read "
|
||||||
bm->bm_bit_size - 1);
|
"failed for block %lu\n", bm->bm_bit_size - 1);
|
||||||
/*
|
/*
|
||||||
bh = getblk (fs->fs_dev, bm->bm_bit_size - 1, fs->fs_blocksize);
|
bh = reiserfs_buffer_open (fs->fs_dev, bm->bm_bit_size - 1,
|
||||||
|
fs->fs_blocksize);
|
||||||
if (!bh)
|
if (!bh)
|
||||||
reiserfs_panic ("reiserfs_flush_to_ondisk_bitmap: getblk failed");
|
reiserfs_panic ("reiserfs_bitmap_flush: reiserfs_buffer_open failed");
|
||||||
mark_buffer_uptodate (bh, 1);
|
reiserfs_buffer_mkuptodate (bh, 1);
|
||||||
mark_buffer_dirty (bh);
|
reiserfs_buffer_mkdirty (bh);
|
||||||
bwrite (bh);*/
|
reiserfs_buffer_write (bh);*/
|
||||||
}
|
}
|
||||||
brelse (bh);
|
reiserfs_buffer_close (bh);
|
||||||
|
|
||||||
if (!bm->bm_dirty)
|
if (!bm->bm_dirty)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -343,14 +205,15 @@ int reiserfs_flush_to_ondisk_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys_t *
|
|||||||
block = fs->fs_super_bh->b_blocknr + 1;
|
block = fs->fs_super_bh->b_blocknr + 1;
|
||||||
|
|
||||||
while (to_copy) {
|
while (to_copy) {
|
||||||
/* we bread to make sure that filesystem contains enough blocks */
|
/* we reiserfs_buffer_read to make sure that filesystem contains
|
||||||
bh = getblk (fs->fs_dev, block, fs->fs_blocksize);
|
enough blocks */
|
||||||
|
bh = reiserfs_buffer_open (fs->fs_dev, block, fs->fs_blocksize);
|
||||||
if (!bh) {
|
if (!bh) {
|
||||||
reiserfs_exit (1, "Getblk failed for (%lu)\n", block);
|
reiserfs_exit (1, "Getblk failed for (%lu)\n", block);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset (bh->b_data, 0xff, bh->b_size);
|
memset (bh->b_data, 0xff, bh->b_size);
|
||||||
mark_buffer_uptodate (bh, 1);
|
reiserfs_buffer_mkuptodate (bh, 1);
|
||||||
|
|
||||||
if (to_copy < fs->fs_blocksize)
|
if (to_copy < fs->fs_blocksize)
|
||||||
copied = to_copy;
|
copied = to_copy;
|
||||||
@@ -360,16 +223,19 @@ int reiserfs_flush_to_ondisk_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys_t *
|
|||||||
last_byte_unused_bits = bm->bm_byte_size * 8 - bm->bm_bit_size;
|
last_byte_unused_bits = bm->bm_byte_size * 8 - bm->bm_bit_size;
|
||||||
|
|
||||||
for (i = 0; i < last_byte_unused_bits; i ++)
|
for (i = 0; i < last_byte_unused_bits; i ++)
|
||||||
misc_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);
|
reiserfs_buffer_mkdirty (bh);
|
||||||
|
reiserfs_buffer_close (bh);
|
||||||
p += copied;
|
p += copied;
|
||||||
to_copy -= copied;
|
to_copy -= copied;
|
||||||
|
|
||||||
/* next bitmap block */
|
/* next bitmap block */
|
||||||
if (spread_bitmaps (fs))
|
if (reiserfs_bitmap_spread (fs))
|
||||||
block = (block / (fs->fs_blocksize * 8) + 1) * (fs->fs_blocksize * 8);
|
block = (block / (fs->fs_blocksize * 8) + 1) *
|
||||||
|
(fs->fs_blocksize * 8);
|
||||||
else
|
else
|
||||||
block ++;
|
block ++;
|
||||||
}
|
}
|
||||||
@@ -378,12 +244,223 @@ int reiserfs_flush_to_ondisk_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys_t *
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Expand existing bitmap. Return non-zero if can't. FIXME: it is
|
||||||
|
assumed that bit_count is new number of blocks to be addressed */
|
||||||
|
int reiserfs_bitmap_expand (reiserfs_bitmap_t * bm,
|
||||||
|
unsigned int bit_count)
|
||||||
|
{
|
||||||
|
unsigned int byte_count = ((bit_count + 7) / 8);
|
||||||
|
char * new_map;
|
||||||
|
|
||||||
|
new_map = misc_expandmem (bm->bm_map, bm->bm_byte_size,
|
||||||
|
byte_count - bm->bm_byte_size);
|
||||||
|
|
||||||
|
if (!new_map) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bm->bm_map = new_map;
|
||||||
|
bm->bm_byte_size = byte_count;
|
||||||
|
bm->bm_bit_size = bit_count;
|
||||||
|
|
||||||
|
bm->bm_dirty = 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void reiserfs_bitmap_shrink (reiserfs_bitmap_t * bm,
|
||||||
|
unsigned int bit_count)
|
||||||
|
{
|
||||||
|
unsigned long i;
|
||||||
|
|
||||||
|
assert (bm->bm_bit_size >= bit_count);
|
||||||
|
|
||||||
|
bm->bm_byte_size = (bit_count + 7) / 8;
|
||||||
|
bm->bm_bit_size = bit_count;
|
||||||
|
bm->bm_set_bits = 0;
|
||||||
|
if (bm->bm_first_zero > bm->bm_bit_size)
|
||||||
|
bm->bm_first_zero = bm->bm_bit_size;
|
||||||
|
|
||||||
|
bm->bm_dirty = 1;
|
||||||
|
|
||||||
|
for (i = 0; i < bm->bm_bit_size; i++) {
|
||||||
|
if (reiserfs_bitmap_test_bit(bm, i))
|
||||||
|
bm->bm_set_bits++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void reiserfs_bitmap_copy (reiserfs_bitmap_t * to,
|
||||||
|
reiserfs_bitmap_t * from)
|
||||||
|
{
|
||||||
|
assert (to->bm_byte_size == from->bm_byte_size);
|
||||||
|
memcpy (to->bm_map, from->bm_map, from->bm_byte_size);
|
||||||
|
to->bm_bit_size = from->bm_bit_size;
|
||||||
|
to->bm_set_bits = from->bm_set_bits;
|
||||||
|
to->bm_first_zero = from->bm_first_zero;
|
||||||
|
to->bm_dirty = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int reiserfs_bitmap_compare (reiserfs_bitmap_t * bm1,
|
||||||
|
reiserfs_bitmap_t * bm2)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
|
||||||
|
diff = 0;
|
||||||
|
|
||||||
|
/* compare full bytes */
|
||||||
|
bytes = bm1->bm_bit_size / 8;
|
||||||
|
bits = bytes * 8;
|
||||||
|
if (memcmp (bm1->bm_map, bm2->bm_map, bytes)) {
|
||||||
|
for (i = 0; i < bits; i ++)
|
||||||
|
if (reiserfs_bitmap_test_bit(bm1, i) !=
|
||||||
|
reiserfs_bitmap_test_bit(bm2, i))
|
||||||
|
{
|
||||||
|
diff ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* compare last byte of bitmap which can be used partially */
|
||||||
|
bits = bm1->bm_bit_size % 8;
|
||||||
|
for (i = bm1->bm_bit_size / 8 * 8;
|
||||||
|
i < bm1->bm_bit_size / 8 * 8 + bits;
|
||||||
|
i ++)
|
||||||
|
{
|
||||||
|
if (reiserfs_bitmap_test_bit(bm1, i) !=
|
||||||
|
reiserfs_bitmap_test_bit(bm2, i))
|
||||||
|
{
|
||||||
|
diff ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* int mask;
|
||||||
|
|
||||||
|
mask = 255 >> (8 - bits);
|
||||||
|
if ((bm1->bm_map [bytes] & mask) != (bm2->bm_map [bytes] & mask)) {
|
||||||
|
diff ++;
|
||||||
|
} */
|
||||||
|
}
|
||||||
|
|
||||||
|
return diff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Does X | Y for every bit of the bitmap `to`, where
|
||||||
|
X - bit of the `to` bitmap,
|
||||||
|
Y - `from` bitmap.
|
||||||
|
Save result in the `to` bitmap.
|
||||||
|
*/
|
||||||
|
void reiserfs_bitmap_disjunction (reiserfs_bitmap_t * to,
|
||||||
|
reiserfs_bitmap_t * from)
|
||||||
|
{
|
||||||
|
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 (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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Does X & !Y for every bit of the bitmap `base`, where
|
||||||
|
X - bit of the `base` bitmap,
|
||||||
|
Y - `exclude` bitmap.
|
||||||
|
Save result in the `base` bitmap.
|
||||||
|
*/
|
||||||
|
void reiserfs_bitmap_delta (reiserfs_bitmap_t * base,
|
||||||
|
reiserfs_bitmap_t * exclude)
|
||||||
|
{
|
||||||
|
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 (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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void reiserfs_bitmap_set_bit (reiserfs_bitmap_t * bm,
|
||||||
|
unsigned int bit_number)
|
||||||
|
{
|
||||||
|
assert(bit_number < bm->bm_bit_size);
|
||||||
|
if (misc_test_bit (bit_number, bm->bm_map))
|
||||||
|
return;
|
||||||
|
misc_set_bit(bit_number, bm->bm_map);
|
||||||
|
bm->bm_set_bits ++;
|
||||||
|
bm->bm_dirty = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void reiserfs_bitmap_clear_bit (reiserfs_bitmap_t * bm,
|
||||||
|
unsigned int bit_number)
|
||||||
|
{
|
||||||
|
assert(bit_number < bm->bm_bit_size);
|
||||||
|
if (!misc_test_bit (bit_number, bm->bm_map))
|
||||||
|
return;
|
||||||
|
misc_clear_bit (bit_number, bm->bm_map);
|
||||||
|
bm->bm_set_bits --;
|
||||||
|
bm->bm_dirty = 1;
|
||||||
|
if (bm->bm_first_zero > bit_number)
|
||||||
|
bm->bm_first_zero = bit_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 misc_test_bit(bit_number, bm->bm_map);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int reiserfs_bitmap_find_zero_bit (reiserfs_bitmap_t * bm,
|
||||||
|
unsigned long * first)
|
||||||
|
{
|
||||||
|
unsigned long bit_nr;
|
||||||
|
int upd;
|
||||||
|
|
||||||
|
assert(*first < bm->bm_bit_size);
|
||||||
|
|
||||||
|
upd = (bm->bm_first_zero >= *first) ? 1 : 0;
|
||||||
|
bit_nr = misc_find_next_zero_bit(bm->bm_map, bm->bm_bit_size,
|
||||||
|
upd ? bm->bm_first_zero : *first);
|
||||||
|
|
||||||
|
if (upd)
|
||||||
|
bm->bm_first_zero = bit_nr;
|
||||||
|
|
||||||
|
if (bit_nr >= bm->bm_bit_size)
|
||||||
|
/* search failed */
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
*first = bit_nr;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void reiserfs_bitmap_zero (reiserfs_bitmap_t * bm)
|
void reiserfs_bitmap_zero (reiserfs_bitmap_t * bm)
|
||||||
{
|
{
|
||||||
memset (bm->bm_map, 0, bm->bm_byte_size);
|
memset (bm->bm_map, 0, bm->bm_byte_size);
|
||||||
bm->bm_set_bits = 0;
|
bm->bm_set_bits = 0;
|
||||||
bm->bm_dirty = 1;
|
bm->bm_dirty = 1;
|
||||||
|
bm->bm_first_zero = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -392,8 +469,36 @@ void reiserfs_bitmap_fill (reiserfs_bitmap_t * bm)
|
|||||||
memset (bm->bm_map, 0xff, bm->bm_byte_size);
|
memset (bm->bm_map, 0xff, bm->bm_byte_size);
|
||||||
bm->bm_set_bits = bm->bm_bit_size;
|
bm->bm_set_bits = bm->bm_bit_size;
|
||||||
bm->bm_dirty = 1;
|
bm->bm_dirty = 1;
|
||||||
|
bm->bm_first_zero = bm->bm_set_bits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reiserfs_bitmap_invert (reiserfs_bitmap_t * bm)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
/*reiserfs_warning (stderr, "Bitmap inverting..");fflush (stderr);*/
|
||||||
|
for (i = 0; i < bm->bm_bit_size; i ++) {
|
||||||
|
if (reiserfs_bitmap_test_bit (bm, i))
|
||||||
|
reiserfs_bitmap_clear_bit (bm, i);
|
||||||
|
else
|
||||||
|
reiserfs_bitmap_set_bit (bm, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*reiserfs_warning (stderr, "done\n");*/
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int reiserfs_bitmap_zeros (reiserfs_bitmap_t * bm) {
|
||||||
|
return bm->bm_bit_size - bm->bm_set_bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int reiserfs_bitmap_ones (reiserfs_bitmap_t * bm) {
|
||||||
|
return bm->bm_set_bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
int reiserfs_bitmap_spread (reiserfs_filsys_t * fs) {
|
||||||
|
return fs->fs_super_bh->b_blocknr != 2;
|
||||||
|
}
|
||||||
|
|
||||||
/* format of bitmap saved in a file:
|
/* format of bitmap saved in a file:
|
||||||
magic number (32 bits)
|
magic number (32 bits)
|
||||||
@@ -405,26 +510,6 @@ void reiserfs_bitmap_fill (reiserfs_bitmap_t * bm)
|
|||||||
#define BITMAP_START_MAGIC 374031
|
#define BITMAP_START_MAGIC 374031
|
||||||
#define BITMAP_END_MAGIC 7786472
|
#define BITMAP_END_MAGIC 7786472
|
||||||
|
|
||||||
|
|
||||||
FILE * open_file (char * filename, char * option)
|
|
||||||
{
|
|
||||||
FILE * fp = fopen (filename, option);
|
|
||||||
if (!fp) {
|
|
||||||
reiserfs_warning (stderr, "open_file: could not open file %s\n", filename);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
reiserfs_warning (stderr, "Temp file opened by fsck: \"%s\" .. \n", filename);
|
|
||||||
return fp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void close_file (FILE * fp)
|
|
||||||
{
|
|
||||||
fclose (fp);
|
|
||||||
/*reiserfs_warning (stderr, "done\n"); fflush (stderr);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void reiserfs_bitmap_save (FILE * fp, reiserfs_bitmap_t * bm)
|
void reiserfs_bitmap_save (FILE * fp, reiserfs_bitmap_t * bm)
|
||||||
{
|
{
|
||||||
// FILE * fp;
|
// FILE * fp;
|
||||||
@@ -437,15 +522,14 @@ void reiserfs_bitmap_save (FILE * fp, reiserfs_bitmap_t * bm)
|
|||||||
|
|
||||||
/* fp = fopen (filename, "w+");
|
/* fp = fopen (filename, "w+");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
reiserfs_warning (stderr, "reiserfs_bitmap_save: could not save bitmap in %s: %s",
|
reiserfs_warning (stderr, "reiserfs_bitmap_save: could not save "
|
||||||
filename, strerror(errno));
|
"bitmap in %s: %s", filename, strerror(errno));
|
||||||
return;
|
return;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
// reiserfs_warning (stderr, "Saving bitmap in \"%s\" .. ", filename); fflush (stderr);
|
/* reiserfs_warning (stderr, "Saving bitmap in \"%s\" .. ", filename);
|
||||||
|
fflush (stderr);*/
|
||||||
|
|
||||||
|
|
||||||
v = BITMAP_START_MAGIC;
|
v = BITMAP_START_MAGIC;
|
||||||
fwrite (&v, 4, 1, fp);
|
fwrite (&v, 4, 1, fp);
|
||||||
@@ -458,7 +542,8 @@ void reiserfs_bitmap_save (FILE * fp, reiserfs_bitmap_t * bm)
|
|||||||
position = ftell(fp);
|
position = ftell(fp);
|
||||||
|
|
||||||
if (fseek (fp, 4, SEEK_CUR)) {
|
if (fseek (fp, 4, SEEK_CUR)) {
|
||||||
reiserfs_warning (stderr, "reiserfs_bitmap_save: fseek failed: %s\n", strerror(errno));
|
reiserfs_warning (stderr, "reiserfs_bitmap_save: fseek failed: %s\n",
|
||||||
|
strerror(errno));
|
||||||
// fclose (fp);
|
// fclose (fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -509,14 +594,16 @@ void reiserfs_bitmap_save (FILE * fp, reiserfs_bitmap_t * bm)
|
|||||||
fwrite (&v, 4, 1, fp);
|
fwrite (&v, 4, 1, fp);
|
||||||
|
|
||||||
if (fseek (fp, position, SEEK_SET)) {
|
if (fseek (fp, position, SEEK_SET)) {
|
||||||
reiserfs_warning (stderr, "reiserfs_bitmap_save: fseek failed: %s", strerror(errno));
|
reiserfs_warning (stderr, "reiserfs_bitmap_save: fseek failed: %s",
|
||||||
|
strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite (&extents, 4, 1, fp);
|
fwrite (&extents, 4, 1, fp);
|
||||||
|
|
||||||
if (fseek (fp, 0, SEEK_END)) {
|
if (fseek (fp, 0, SEEK_END)) {
|
||||||
reiserfs_warning (stderr, "reiserfs_bitmap_save: fseek failed: %s", strerror(errno));
|
reiserfs_warning (stderr, "reiserfs_bitmap_save: fseek failed: %s",
|
||||||
|
strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -531,62 +618,6 @@ void reiserfs_bitmap_save (FILE * fp, reiserfs_bitmap_t * bm)
|
|||||||
bitmap of bad_unfm
|
bitmap of bad_unfm
|
||||||
magic number (32 bits) */
|
magic number (32 bits) */
|
||||||
|
|
||||||
#define FSCK_DUMP_START_MAGIC 374033
|
|
||||||
#define FSCK_DUMP_END_MAGIC 7786470
|
|
||||||
|
|
||||||
|
|
||||||
void reiserfs_begin_stage_info_save(FILE * file, unsigned long stage)
|
|
||||||
{
|
|
||||||
__u32 v = FSCK_DUMP_START_MAGIC;
|
|
||||||
fwrite (&v, 4, 1, file);
|
|
||||||
fwrite (&stage, 4, 1, file);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void reiserfs_end_stage_info_save(FILE * file)
|
|
||||||
{
|
|
||||||
__u32 v = FSCK_DUMP_END_MAGIC;
|
|
||||||
fwrite (&v, 4, 1, file);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*return last passed stage*/
|
|
||||||
int is_stage_magic_correct (FILE * fp)
|
|
||||||
{
|
|
||||||
__u32 v;
|
|
||||||
|
|
||||||
if (fseek (fp, -4, SEEK_END)) {
|
|
||||||
reiserfs_warning (stderr, "is_stage_magic_correct: fseek failed: %s\n",
|
|
||||||
strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fread (&v, 4, 1, fp);
|
|
||||||
if (v != FSCK_DUMP_END_MAGIC) {
|
|
||||||
reiserfs_warning (stderr, "is_stage_magic_correct: no magic found\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fseek (fp, 0, SEEK_SET)) {
|
|
||||||
reiserfs_warning (stderr, "is_stage_magic_correct: fseek failed: %s\n",
|
|
||||||
strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fread (&v, 4, 1, fp);
|
|
||||||
if (v != FSCK_DUMP_START_MAGIC) {
|
|
||||||
reiserfs_warning (stderr, "is_stage_magic_correct: no magic found\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fread (&v, 4, 1, fp);
|
|
||||||
if (v != PASS_0_DONE && v != PASS_1_DONE && v != TREE_IS_BUILT && v != SEMANTIC_DONE && v != LOST_FOUND_DONE) {
|
|
||||||
reiserfs_warning (stderr, "is_stage_magic_correct: wrong pass found");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (__u16)v;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
reiserfs_bitmap_t * reiserfs_bitmap_load (FILE * fp)
|
reiserfs_bitmap_t * reiserfs_bitmap_load (FILE * fp)
|
||||||
@@ -601,7 +632,8 @@ reiserfs_bitmap_t * reiserfs_bitmap_load (FILE * fp)
|
|||||||
|
|
||||||
/* fp = fopen (filename, "r");
|
/* fp = fopen (filename, "r");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
reiserfs_warning (stderr, "reiserfs_bitmap_load: fopen failed: %s\n", strerror(errno));
|
reiserfs_warning (stderr, "reiserfs_bitmap_load: fopen failed: %s\n",
|
||||||
|
strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
@@ -616,7 +648,7 @@ reiserfs_bitmap_t * reiserfs_bitmap_load (FILE * fp)
|
|||||||
/* read bit size of bitmap */
|
/* read bit size of bitmap */
|
||||||
fread (&v, 4, 1, fp);
|
fread (&v, 4, 1, fp);
|
||||||
|
|
||||||
bm = reiserfs_create_bitmap (v);
|
bm = reiserfs_bitmap_create (v);
|
||||||
if (!bm) {
|
if (!bm) {
|
||||||
reiserfs_warning (stderr, "reiserfs_bitmap_load: creation failed");
|
reiserfs_warning (stderr, "reiserfs_bitmap_load: creation failed");
|
||||||
// fclose (fp);
|
// fclose (fp);
|
||||||
@@ -655,76 +687,73 @@ reiserfs_bitmap_t * reiserfs_bitmap_load (FILE * fp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reiserfs_warning (stderr, "%d bits set - done\n", reiserfs_bitmap_ones (bm));*/
|
/* reiserfs_warning (stderr, "%d bits set - done\n",
|
||||||
|
reiserfs_bitmap_ones (bm));*/
|
||||||
fflush (stderr);
|
fflush (stderr);
|
||||||
return bm;
|
return bm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void reiserfs_bitmap_invert (reiserfs_bitmap_t * bm)
|
int reiserfs_bitmap_block (reiserfs_filsys_t * fs, unsigned long block) {
|
||||||
{
|
unsigned int bmap_nr;
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
/*reiserfs_warning (stderr, "Bitmap inverting..");fflush (stderr);*/
|
|
||||||
for (i = 0; i < bm->bm_bit_size; i ++) {
|
|
||||||
if (reiserfs_bitmap_test_bit (bm, i))
|
|
||||||
reiserfs_bitmap_clear_bit (bm, i);
|
|
||||||
else
|
|
||||||
reiserfs_bitmap_set_bit (bm, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*reiserfs_warning (stderr, "done\n");*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void reiserfs_free_ondisk_bitmap (reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
if (fs->fs_bitmap2) {
|
|
||||||
reiserfs_delete_bitmap (fs->fs_bitmap2);
|
|
||||||
fs->fs_bitmap2 = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* read bitmap blocks */
|
|
||||||
int reiserfs_open_ondisk_bitmap (reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
if (fs->fs_bitmap2)
|
|
||||||
reiserfs_panic ("bitmap is initiaized already");
|
|
||||||
|
|
||||||
fs->fs_bitmap2 = reiserfs_create_bitmap (get_sb_block_count (fs->fs_ondisk_sb));
|
|
||||||
if (!fs->fs_bitmap2)
|
|
||||||
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))
|
|
||||||
{
|
|
||||||
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 -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return reiserfs_fetch_ondisk_bitmap (fs->fs_bitmap2, fs);
|
|
||||||
}
|
|
||||||
|
|
||||||
int reiserfs_create_ondisk_bitmap (reiserfs_filsys_t * fs)
|
|
||||||
{
|
|
||||||
if (fs->fs_bitmap2)
|
|
||||||
reiserfs_panic ("bitmap is initiaized already");
|
|
||||||
|
|
||||||
fs->fs_bitmap2 = reiserfs_create_bitmap (get_sb_block_count (fs->fs_ondisk_sb));
|
|
||||||
if (!fs->fs_bitmap2)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
|
if (reiserfs_bitmap_spread (fs)) {
|
||||||
|
if (!(block % (fs->fs_blocksize * 8)))
|
||||||
|
/* bitmap block */
|
||||||
return 1;
|
return 1;
|
||||||
|
return ((REISERFS_DISK_OFFSET_IN_BYTES / fs->fs_blocksize + 1)
|
||||||
|
== block);
|
||||||
|
} else {
|
||||||
|
bmap_nr = reiserfs_bmap_nr(reiserfs_sb_get_blocks(fs->fs_ondisk_sb),
|
||||||
|
fs->fs_blocksize);
|
||||||
|
|
||||||
|
/* bitmap in */
|
||||||
|
return (block > 2ul && block < 3ul + bmap_nr) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* read bitmap of disk and print details */
|
||||||
void reiserfs_close_ondisk_bitmap (reiserfs_filsys_t * fs)
|
void reiserfs_bitmap_print (FILE * fp, reiserfs_filsys_t * fs, int silent)
|
||||||
{
|
{
|
||||||
if (!fs->fs_bitmap2)
|
reiserfs_sb_t * sb;
|
||||||
return;
|
int bmap_nr;
|
||||||
reiserfs_flush_to_ondisk_bitmap (fs->fs_bitmap2, fs);
|
int i;
|
||||||
reiserfs_free_ondisk_bitmap (fs);
|
int bits_per_block;
|
||||||
|
int blocks;
|
||||||
|
unsigned long block;
|
||||||
|
reiserfs_bh_t * bh;
|
||||||
|
|
||||||
|
|
||||||
|
sb = fs->fs_ondisk_sb;
|
||||||
|
bits_per_block = fs->fs_blocksize * 8;
|
||||||
|
blocks = bits_per_block;
|
||||||
|
bmap_nr = reiserfs_bmap_nr(reiserfs_sb_get_blocks(fs->fs_ondisk_sb),
|
||||||
|
fs->fs_blocksize);
|
||||||
|
|
||||||
|
reiserfs_warning (fp, "Bitmap blocks are:\n");
|
||||||
|
block = fs->fs_super_bh->b_blocknr + 1;
|
||||||
|
for (i = 0; i < bmap_nr; i ++) {
|
||||||
|
bh = reiserfs_buffer_read (fs->fs_dev, block, fs->fs_blocksize);
|
||||||
|
if (!bh) {
|
||||||
|
reiserfs_warning (stderr, "reiserfs_bitmap_print: reiserfs_buffer_read "
|
||||||
|
"failed for %d: %lu\n", i, block);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (i == bmap_nr - 1)
|
||||||
|
if (reiserfs_sb_get_blocks (sb) % bits_per_block)
|
||||||
|
blocks = reiserfs_sb_get_blocks (sb) % bits_per_block;
|
||||||
|
reiserfs_print_bmap_block (fp, i, block, bh->b_data, blocks,
|
||||||
|
silent, fs->fs_blocksize);
|
||||||
|
|
||||||
|
reiserfs_buffer_close (bh);
|
||||||
|
|
||||||
|
if (reiserfs_bitmap_spread (fs))
|
||||||
|
block = (block / (fs->fs_blocksize * 8) + 1) *
|
||||||
|
(fs->fs_blocksize * 8);
|
||||||
|
else {
|
||||||
|
block ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,707 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "reiserfs/libreiserfs.h"
|
||||||
|
#include "misc/malloc.h"
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
static int is_bad_block (unsigned long block)
|
||||||
|
{
|
||||||
|
#ifdef IO_FAILURE_EMULATION
|
||||||
|
|
||||||
|
/* this array similates bad blocks on the device */
|
||||||
|
unsigned long bad_blocks [] =
|
||||||
|
{
|
||||||
|
8208, 8209, 8210
|
||||||
|
/*, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19*/
|
||||||
|
};
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof (bad_blocks) / sizeof (bad_blocks[0]); i ++)
|
||||||
|
if (bad_blocks [i] == block)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* All buffers are in double linked cycled list. If reiserfs_buffer_open found buffer with
|
||||||
|
wanted block number in hash queue it moves buffer to the end of list. */
|
||||||
|
|
||||||
|
static int g_nr_buffers;
|
||||||
|
|
||||||
|
|
||||||
|
static unsigned long buffers_memory;
|
||||||
|
|
||||||
|
/* create buffers until we spend this fraction of system memory, this
|
||||||
|
** is a hard limit on the amount of buffer ram used
|
||||||
|
*/
|
||||||
|
#define BUFFER_MEMORY_FRACTION 10
|
||||||
|
|
||||||
|
/* number of bytes in local buffer cache before we start forcing syncs
|
||||||
|
** of dirty data and reusing unused buffers instead of allocating new
|
||||||
|
** ones. If a flush doesn't find reusable buffers, new ones are
|
||||||
|
** still allocated up to the BUFFER_MEMORY_FRACTION percentage
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
#define BUFFER_SOFT_LIMIT (500 * 1024)
|
||||||
|
static unsigned long buffer_soft_limit = BUFFER_SOFT_LIMIT;
|
||||||
|
|
||||||
|
|
||||||
|
#define NR_HASH_QUEUES 4096
|
||||||
|
static reiserfs_bh_t * g_a_hash_queues [NR_HASH_QUEUES];
|
||||||
|
static reiserfs_bh_t * Buffer_list_head;
|
||||||
|
static reiserfs_bh_t * g_free_buffers = NULL ;
|
||||||
|
static reiserfs_bh_t * g_buffer_heads;
|
||||||
|
static int buffer_hits = 0 ;
|
||||||
|
static int buffer_misses = 0 ;
|
||||||
|
static int buffer_reads = 0 ;
|
||||||
|
static int buffer_writes = 0 ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void _show_buffers(reiserfs_bh_t **list, int dev, unsigned long size) {
|
||||||
|
int all = 0;
|
||||||
|
int dirty = 0;
|
||||||
|
int in_use = 0; /* count != 0 */
|
||||||
|
int free = 0;
|
||||||
|
reiserfs_bh_t * next;
|
||||||
|
|
||||||
|
next = *list;
|
||||||
|
if (!next)
|
||||||
|
return ;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
if (next->b_dev == dev && next->b_size == size) {
|
||||||
|
all ++;
|
||||||
|
if (next->b_count != 0) {
|
||||||
|
in_use ++;
|
||||||
|
}
|
||||||
|
if (reiserfs_buffer_isdirty (next)) {
|
||||||
|
dirty ++;
|
||||||
|
}
|
||||||
|
if (reiserfs_buffer_isclean (next) && next->b_count == 0) {
|
||||||
|
free ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
next = next->b_next;
|
||||||
|
if (next == *list)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("show_buffers (dev %d, size %lu): free %d, count != 0 %d, dirty %d, "
|
||||||
|
"all %d\n", dev, size, free, in_use, dirty, all);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void show_buffers (int dev, int size)
|
||||||
|
{
|
||||||
|
_show_buffers(&Buffer_list_head, dev, size) ;
|
||||||
|
_show_buffers(&g_free_buffers, dev, size) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void insert_into_hash_queue (reiserfs_bh_t * bh)
|
||||||
|
{
|
||||||
|
int index = bh->b_blocknr % NR_HASH_QUEUES;
|
||||||
|
|
||||||
|
if (bh->b_hash_prev || bh->b_hash_next)
|
||||||
|
misc_die ("insert_into_hash_queue: hash queue corrupted");
|
||||||
|
|
||||||
|
if (g_a_hash_queues[index]) {
|
||||||
|
g_a_hash_queues[index]->b_hash_prev = bh;
|
||||||
|
bh->b_hash_next = g_a_hash_queues[index];
|
||||||
|
}
|
||||||
|
g_a_hash_queues[index] = bh;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void remove_from_hash_queue (reiserfs_bh_t * 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 == -1) ? */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bh == g_a_hash_queues[bh->b_blocknr % NR_HASH_QUEUES]) {
|
||||||
|
if (bh->b_hash_prev != 0)
|
||||||
|
misc_die ("remove_from_hash_queue: hash queue corrupted");
|
||||||
|
g_a_hash_queues[bh->b_blocknr % NR_HASH_QUEUES] = bh->b_hash_next;
|
||||||
|
}
|
||||||
|
if (bh->b_hash_next)
|
||||||
|
bh->b_hash_next->b_hash_prev = bh->b_hash_prev;
|
||||||
|
|
||||||
|
if (bh->b_hash_prev)
|
||||||
|
bh->b_hash_prev->b_hash_next = bh->b_hash_next;
|
||||||
|
|
||||||
|
bh->b_hash_prev = bh->b_hash_next = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void put_buffer_list_end (reiserfs_bh_t **list,
|
||||||
|
reiserfs_bh_t * bh)
|
||||||
|
{
|
||||||
|
reiserfs_bh_t * last = 0;
|
||||||
|
|
||||||
|
if (bh->b_prev || bh->b_next)
|
||||||
|
misc_die ("put_buffer_list_end: buffer list corrupted");
|
||||||
|
|
||||||
|
if (*list == 0) {
|
||||||
|
bh->b_next = bh;
|
||||||
|
bh->b_prev = bh;
|
||||||
|
*list = bh;
|
||||||
|
} else {
|
||||||
|
last = (*list)->b_prev;
|
||||||
|
|
||||||
|
bh->b_next = last->b_next;
|
||||||
|
bh->b_prev = last;
|
||||||
|
last->b_next->b_prev = bh;
|
||||||
|
last->b_next = bh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void remove_from_buffer_list (reiserfs_bh_t **list,
|
||||||
|
reiserfs_bh_t * bh)
|
||||||
|
{
|
||||||
|
if (bh == bh->b_next) {
|
||||||
|
*list = 0;
|
||||||
|
} else {
|
||||||
|
bh->b_prev->b_next = bh->b_next;
|
||||||
|
bh->b_next->b_prev = bh->b_prev;
|
||||||
|
if (bh == *list)
|
||||||
|
*list = bh->b_next;
|
||||||
|
}
|
||||||
|
|
||||||
|
bh->b_next = bh->b_prev = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void put_buffer_list_head (reiserfs_bh_t **list,
|
||||||
|
reiserfs_bh_t * bh)
|
||||||
|
{
|
||||||
|
put_buffer_list_end (list, bh);
|
||||||
|
*list = bh;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <sys/mman.h>
|
||||||
|
|
||||||
|
static size_t estimate_memory_amount (void)
|
||||||
|
{
|
||||||
|
size_t len = 1;
|
||||||
|
size_t max = 0;
|
||||||
|
void * addr;
|
||||||
|
|
||||||
|
while (len > 0) {
|
||||||
|
addr = mmap (0, len, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||||
|
if (addr == MAP_FAILED) {
|
||||||
|
if (errno != ENOMEM)
|
||||||
|
misc_die ("mmap failed: %s\n", strerror(errno));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (mlock (addr, len) != 0) {
|
||||||
|
if (errno == EPERM)
|
||||||
|
misc_die ("No permission to run mlock");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
munlock (addr, len);
|
||||||
|
munmap (addr, len);
|
||||||
|
max = len;
|
||||||
|
len *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * If we've looped, we don't want to return 0, we want to return the
|
||||||
|
// * last successful len before we looped. In the event that mmap/mlock
|
||||||
|
// * failed for len = 1, max will still be 0, so we don't get an invalid
|
||||||
|
// * result
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define GROW_BUFFERS__NEW_BUFERS_PER_CALL 10
|
||||||
|
|
||||||
|
/* creates number of new buffers and insert them into head of buffer list */
|
||||||
|
static int grow_buffers (int size)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
reiserfs_bh_t * bh, * tmp;
|
||||||
|
|
||||||
|
|
||||||
|
/* get memory for array of buffer heads */
|
||||||
|
bh = (reiserfs_bh_t *)misc_getmem (GROW_BUFFERS__NEW_BUFERS_PER_CALL *
|
||||||
|
sizeof (reiserfs_bh_t) + sizeof (reiserfs_bh_t *));
|
||||||
|
if (g_buffer_heads == 0)
|
||||||
|
g_buffer_heads = bh;
|
||||||
|
else {
|
||||||
|
/* link new array to the end of array list */
|
||||||
|
tmp = g_buffer_heads;
|
||||||
|
while (*(reiserfs_bh_t **)(tmp + GROW_BUFFERS__NEW_BUFERS_PER_CALL) != 0)
|
||||||
|
tmp = *(reiserfs_bh_t **)(tmp + GROW_BUFFERS__NEW_BUFERS_PER_CALL);
|
||||||
|
*(reiserfs_bh_t **)(tmp + GROW_BUFFERS__NEW_BUFERS_PER_CALL) = bh;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < GROW_BUFFERS__NEW_BUFERS_PER_CALL; i ++) {
|
||||||
|
|
||||||
|
tmp = bh + i;
|
||||||
|
memset (tmp, 0, sizeof (reiserfs_bh_t));
|
||||||
|
tmp->b_data = misc_getmem (size);
|
||||||
|
if (tmp->b_data == 0)
|
||||||
|
misc_die ("grow_buffers: no memory for new buffer data");
|
||||||
|
tmp->b_dev = -1;
|
||||||
|
tmp->b_size = size;
|
||||||
|
put_buffer_list_head (&g_free_buffers, tmp);
|
||||||
|
}
|
||||||
|
buffers_memory += GROW_BUFFERS__NEW_BUFERS_PER_CALL * size;
|
||||||
|
g_nr_buffers += GROW_BUFFERS__NEW_BUFERS_PER_CALL;
|
||||||
|
return GROW_BUFFERS__NEW_BUFERS_PER_CALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
reiserfs_bh_t *reiserfs_buffer_find (int dev,
|
||||||
|
unsigned long block,
|
||||||
|
unsigned long size)
|
||||||
|
{
|
||||||
|
reiserfs_bh_t * next;
|
||||||
|
|
||||||
|
next = g_a_hash_queues[block % NR_HASH_QUEUES];
|
||||||
|
for (;;) {
|
||||||
|
reiserfs_bh_t *tmp = next;
|
||||||
|
if (!next)
|
||||||
|
break;
|
||||||
|
next = tmp->b_hash_next;
|
||||||
|
if (tmp->b_blocknr != block || tmp->b_size != size || tmp->b_dev != dev)
|
||||||
|
continue;
|
||||||
|
next = tmp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static reiserfs_bh_t * get_free_buffer (reiserfs_bh_t **list,
|
||||||
|
unsigned long size)
|
||||||
|
{
|
||||||
|
reiserfs_bh_t * next;
|
||||||
|
|
||||||
|
next = *list;
|
||||||
|
if (!next)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
if (!next)
|
||||||
|
misc_die ("get_free_buffer: buffer list is corrupted");
|
||||||
|
if (next->b_count == 0 && reiserfs_buffer_isclean (next) && next->b_size == size) {
|
||||||
|
remove_from_hash_queue (next);
|
||||||
|
remove_from_buffer_list (list, next);
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
next = next->b_next;
|
||||||
|
if (next == *list)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* to_write == 0 when all blocks have to be flushed. Otherwise - write only
|
||||||
|
buffers with b_count == 0 */
|
||||||
|
static int sync_buffers (reiserfs_bh_t **list, int dev, int to_write) {
|
||||||
|
reiserfs_bh_t * next;
|
||||||
|
int written = 0;
|
||||||
|
|
||||||
|
|
||||||
|
restart:
|
||||||
|
next = *list;
|
||||||
|
if (!next)
|
||||||
|
return 0;
|
||||||
|
for (;;) {
|
||||||
|
if (!next)
|
||||||
|
misc_die ("sync_buffers: buffer list is corrupted");
|
||||||
|
|
||||||
|
if (next->b_dev == dev && reiserfs_buffer_isdirty (next) && reiserfs_buffer_uptodate (next)) {
|
||||||
|
if ((to_write == 0 || next->b_count == 0) && !reiserfs_buffer_noflush (next)) {
|
||||||
|
reiserfs_buffer_write (next);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if this buffer is reusable, put it onto the end of the free list */
|
||||||
|
if (next->b_count == 0 && reiserfs_buffer_isclean(next)) {
|
||||||
|
remove_from_hash_queue (next);
|
||||||
|
remove_from_buffer_list (list, next);
|
||||||
|
put_buffer_list_end (&g_free_buffers, next);
|
||||||
|
written++ ;
|
||||||
|
if (written == to_write)
|
||||||
|
return written;
|
||||||
|
goto restart;
|
||||||
|
}
|
||||||
|
if (to_write && written >= to_write)
|
||||||
|
return written;
|
||||||
|
|
||||||
|
next = next->b_next;
|
||||||
|
if (next == *list)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return written;
|
||||||
|
}
|
||||||
|
|
||||||
|
void reiserfs_buffer_flush_all (int dev) {
|
||||||
|
if (dev == -1)
|
||||||
|
misc_die ("reiserfs_buffer_flush_all: device is not specified");
|
||||||
|
|
||||||
|
sync_buffers (&Buffer_list_head, dev, 0/*all*/);
|
||||||
|
buffer_soft_limit = BUFFER_SOFT_LIMIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
reiserfs_bh_t * reiserfs_buffer_open (int dev, unsigned long block,
|
||||||
|
unsigned long size)
|
||||||
|
{
|
||||||
|
reiserfs_bh_t * bh;
|
||||||
|
|
||||||
|
bh = reiserfs_buffer_find (dev, block, size);
|
||||||
|
if (bh) {
|
||||||
|
/* move the buffer to the end of list */
|
||||||
|
|
||||||
|
/*checkmem (bh->b_data, bh->b_size);*/
|
||||||
|
|
||||||
|
remove_from_buffer_list (&Buffer_list_head, bh);
|
||||||
|
put_buffer_list_end (&Buffer_list_head, bh);
|
||||||
|
bh->b_count ++;
|
||||||
|
buffer_hits++ ;
|
||||||
|
return bh;
|
||||||
|
}
|
||||||
|
buffer_misses++ ;
|
||||||
|
|
||||||
|
bh = get_free_buffer (&g_free_buffers, size);
|
||||||
|
if (bh == NULL) {
|
||||||
|
if (buffers_memory >= buffer_soft_limit) {
|
||||||
|
if (sync_buffers (&Buffer_list_head, dev, 32) == 0) {
|
||||||
|
grow_buffers(size);
|
||||||
|
buffer_soft_limit = buffers_memory +
|
||||||
|
GROW_BUFFERS__NEW_BUFERS_PER_CALL * size;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (grow_buffers(size) == 0)
|
||||||
|
sync_buffers (&Buffer_list_head, dev, 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
bh = get_free_buffer (&g_free_buffers, size);
|
||||||
|
if (bh == NULL) {
|
||||||
|
show_buffers (dev, size);
|
||||||
|
misc_die ("reiserfs_buffer_open: no free buffers after grow_buffers "
|
||||||
|
"and refill (%d)", g_nr_buffers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bh->b_count = 1;
|
||||||
|
bh->b_dev = dev;
|
||||||
|
bh->b_size = size;
|
||||||
|
bh->b_blocknr = block;
|
||||||
|
bh->b_end_io = NULL ;
|
||||||
|
memset (bh->b_data, 0, size);
|
||||||
|
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);
|
||||||
|
/*checkmem (bh->b_data, bh->b_size);*/
|
||||||
|
|
||||||
|
return bh;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void reiserfs_buffer_close (reiserfs_bh_t * bh)
|
||||||
|
{
|
||||||
|
if (bh == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (bh->b_count == 0)
|
||||||
|
misc_die ("reiserfs_buffer_close: can not free a free buffer %lu", bh->b_blocknr);
|
||||||
|
|
||||||
|
/*checkmem (bh->b_data, misc_memsize (bh->b_data));*/
|
||||||
|
|
||||||
|
bh->b_count --;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void reiserfs_buffer_forget (reiserfs_bh_t * bh) {
|
||||||
|
if (bh) {
|
||||||
|
bh->b_state = 0;
|
||||||
|
reiserfs_buffer_close (bh);
|
||||||
|
remove_from_hash_queue (bh);
|
||||||
|
remove_from_buffer_list(&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(reiserfs_bh_t * bh)
|
||||||
|
{
|
||||||
|
unsigned long long offset;
|
||||||
|
ssize_t bytes;
|
||||||
|
|
||||||
|
buffer_reads++ ;
|
||||||
|
|
||||||
|
offset = (unsigned long long)bh->b_size * bh->b_blocknr;
|
||||||
|
if (lseek (bh->b_dev, offset, SEEK_SET) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
bytes = read (bh->b_dev, bh->b_data, bh->b_size);
|
||||||
|
|
||||||
|
return bytes < 0 ? -1 : (bytes != (ssize_t)bh->b_size ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define check_hd_msg \
|
||||||
|
"\nThe problem has occurred looks like a hardware problem. If you have\n" \
|
||||||
|
"bad blocks, we advise you to get a new hard drive, because once you\n" \
|
||||||
|
"get one bad block that the disk drive internals cannot hide from\n" \
|
||||||
|
"your sight,the chances of getting more are generally said to become\n" \
|
||||||
|
"much higher (precise statistics are unknown to us), and this disk\n" \
|
||||||
|
"drive is probably not expensive enough for you to you to risk your\n" \
|
||||||
|
"time and data on it. If you don't want to follow that follow that\n" \
|
||||||
|
"advice 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 means\n" \
|
||||||
|
"it takes a block it has in reserve and allocates it for use for\n" \
|
||||||
|
"of that block number). If it cannot remap the block, use badblock\n" \
|
||||||
|
"option (-B) with reiserfs utils to handle this block correctly.\n" \
|
||||||
|
|
||||||
|
reiserfs_bh_t *reiserfs_buffer_read (int dev, unsigned long block,
|
||||||
|
unsigned long size)
|
||||||
|
{
|
||||||
|
reiserfs_bh_t * bh;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (is_bad_block (block))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
bh = reiserfs_buffer_open (dev, block, size);
|
||||||
|
|
||||||
|
/*checkmem (bh->b_data, misc_memsize(bh->b_data));*/
|
||||||
|
|
||||||
|
if (reiserfs_buffer_uptodate (bh))
|
||||||
|
return bh;
|
||||||
|
|
||||||
|
ret = f_read(bh);
|
||||||
|
|
||||||
|
if (ret > 0) {
|
||||||
|
misc_die ("%s: End of file, cannot read the block (%lu).\n",
|
||||||
|
__FUNCTION__, block);
|
||||||
|
} else if (ret < 0) {
|
||||||
|
/* BAD BLOCK LIST SUPPORT
|
||||||
|
* misc_die ("%s: Cannot read a block # %lu. Specify list of badblocks\n",*/
|
||||||
|
|
||||||
|
if (errno == EIO) {
|
||||||
|
fprintf(stderr, check_hd_msg);
|
||||||
|
misc_die ("%s: Cannot read the block (%lu): (%s).\n",
|
||||||
|
__FUNCTION__, block, strerror(errno));
|
||||||
|
} else {
|
||||||
|
fprintf (stderr, "%s: Cannot read the block (%lu): (%s).\n",
|
||||||
|
__FUNCTION__, block, strerror(errno));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reiserfs_buffer_mkuptodate (bh, 0);
|
||||||
|
return bh;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* for now - just make sure that bad blocks did not get here */
|
||||||
|
int reiserfs_buffer_write (reiserfs_bh_t * bh)
|
||||||
|
{
|
||||||
|
off_t offset;
|
||||||
|
long long bytes, size;
|
||||||
|
|
||||||
|
if (is_bad_block (bh->b_blocknr)) {
|
||||||
|
fprintf (stderr, "reiserfs_buffer_write: bad block is going to be written: %lu\n",
|
||||||
|
bh->b_blocknr);
|
||||||
|
exit(8);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!reiserfs_buffer_isdirty (bh) || !reiserfs_buffer_uptodate (bh))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
buffer_writes++ ;
|
||||||
|
if (bh->b_start_io)
|
||||||
|
/* this is used by undo feature of reiserfsck */
|
||||||
|
bh->b_start_io (bh->b_blocknr);
|
||||||
|
|
||||||
|
size = bh->b_size;
|
||||||
|
offset = (off_t)size * bh->b_blocknr;
|
||||||
|
|
||||||
|
if (lseek (bh->b_dev, offset, SEEK_SET) == (long long int)-1){
|
||||||
|
fprintf (stderr, "reiserfs_buffer_write: 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 */
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ROLLBACK_READY
|
||||||
|
if (s_rollback_file != NULL && bh->b_size == (unsigned long)rollback_blocksize) {
|
||||||
|
struct stat buf;
|
||||||
|
int position;
|
||||||
|
struct block_handler block_h;
|
||||||
|
|
||||||
|
/*log previous content into the log*/
|
||||||
|
if (!fstat (bh->b_dev, &buf)) {
|
||||||
|
block_h.blocknr = bh->b_blocknr;
|
||||||
|
block_h.device = buf.st_rdev;
|
||||||
|
if (misc_bin_search(&block_h, rollback_blocks_array,
|
||||||
|
rollback_blocks_number, sizeof (block_h),
|
||||||
|
&position, blockdev_list_compare) != 1)
|
||||||
|
{
|
||||||
|
/*read initial data from the disk*/
|
||||||
|
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),
|
||||||
|
&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);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
} else {
|
||||||
|
fprintf (stderr, "reiserfs_buffer_write: read (block=%lu, dev=%d): %s\n",
|
||||||
|
bh->b_blocknr, bh->b_dev, strerror (errno));
|
||||||
|
exit(8);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lseek (bh->b_dev, offset, SEEK_SET) == (long long int)-1) {
|
||||||
|
fprintf (stderr, "reiserfs_buffer_write: lseek to position %llu (block=%lu, "
|
||||||
|
"dev=%d): %s\n", offset, bh->b_blocknr, bh->b_dev,
|
||||||
|
strerror(errno));
|
||||||
|
exit(8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fprintf (stderr, "reiserfs_buffer_write: 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);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bytes = write(bh->b_dev, bh->b_data, size);
|
||||||
|
if (bytes != size) {
|
||||||
|
fprintf (stderr, "reiserfs_buffer_write: write %lld bytes returned %lld (block=%ld, "
|
||||||
|
"dev=%d): %s\n", size, bytes, bh->b_blocknr, bh->b_dev,
|
||||||
|
strerror(errno));
|
||||||
|
exit(8);
|
||||||
|
}
|
||||||
|
|
||||||
|
reiserfs_buffer_mkclean (bh);
|
||||||
|
|
||||||
|
if (bh->b_end_io) {
|
||||||
|
bh->b_end_io(bh, 1) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int _check_and_free_buffer_list(reiserfs_bh_t *list) {
|
||||||
|
reiserfs_bh_t *next = list ;
|
||||||
|
int count = 0 ;
|
||||||
|
if (!list)
|
||||||
|
return 0 ;
|
||||||
|
|
||||||
|
for(;;) {
|
||||||
|
if (next->b_count != 0)
|
||||||
|
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 (reiserfs_buffer_isdirty (next) && reiserfs_buffer_uptodate (next))
|
||||||
|
fprintf (stderr, "check_and_free_buffer_mem: dirty buffer "
|
||||||
|
"(%d %lu) found\n", next->b_dev, next->b_blocknr);
|
||||||
|
|
||||||
|
misc_freemem (next->b_data);
|
||||||
|
count++;
|
||||||
|
next = next->b_next;
|
||||||
|
if (next == list)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
void reiserfs_buffer_free_all (void) {
|
||||||
|
int count = 0;
|
||||||
|
reiserfs_bh_t * next ;
|
||||||
|
|
||||||
|
// printf("check and free buffer mem, hits %d misses %d reads %d writes %d\n",
|
||||||
|
// buffer_hits, buffer_misses, buffer_reads, buffer_writes) ;
|
||||||
|
/*sync_buffers (0, 0);*/
|
||||||
|
|
||||||
|
count = _check_and_free_buffer_list(Buffer_list_head);
|
||||||
|
count += _check_and_free_buffer_list(g_free_buffers);
|
||||||
|
|
||||||
|
if (count != g_nr_buffers)
|
||||||
|
misc_die ("check_and_free_buffer_mem: found %d buffers, must be %d",
|
||||||
|
count, g_nr_buffers);
|
||||||
|
|
||||||
|
/* free buffer heads */
|
||||||
|
while ((next = g_buffer_heads)) {
|
||||||
|
g_buffer_heads = *(reiserfs_bh_t **)
|
||||||
|
(next + GROW_BUFFERS__NEW_BUFERS_PER_CALL);
|
||||||
|
|
||||||
|
misc_freemem (next);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _invalidate_buffer_list(reiserfs_bh_t *list, int dev)
|
||||||
|
{
|
||||||
|
reiserfs_bh_t * next;
|
||||||
|
|
||||||
|
if (!list)
|
||||||
|
return;
|
||||||
|
|
||||||
|
next = list;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
if (next->b_dev == dev) {
|
||||||
|
if (reiserfs_buffer_isdirty (next) || next->b_count)
|
||||||
|
fprintf (stderr, "invalidate_buffer_list: dirty "
|
||||||
|
"buffer or used buffer (%d %lu) found\n",
|
||||||
|
next->b_count, next->b_blocknr);
|
||||||
|
|
||||||
|
next->b_state = 0;
|
||||||
|
remove_from_hash_queue (next);
|
||||||
|
}
|
||||||
|
|
||||||
|
next = next->b_next;
|
||||||
|
if (next == list)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* forget all buffers of the given device */
|
||||||
|
void reiserfs_buffer_invalidate_all (int dev) {
|
||||||
|
_invalidate_buffer_list(Buffer_list_head, dev) ;
|
||||||
|
_invalidate_buffer_list(g_free_buffers, dev) ;
|
||||||
|
}
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* length of the directory entry in directory item. This define calculates
|
||||||
|
length of i-th directory entry using directory entry locations from dir
|
||||||
|
entry head. When it calculates length of 0-th directory entry, it uses
|
||||||
|
length of whole item in place of entry location of the non-existent
|
||||||
|
following entry in the calculation. See picture above.*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "reiserfs/libreiserfs.h"
|
||||||
|
|
||||||
|
// NOTE: this is not name length. This is length of whole entry
|
||||||
|
int reiserfs_direntry_entry_len (reiserfs_ih_t * ih,
|
||||||
|
reiserfs_deh_t * deh,
|
||||||
|
int pos_in_item)
|
||||||
|
{
|
||||||
|
if (pos_in_item)
|
||||||
|
return (reiserfs_deh_get_loc (deh - 1) - reiserfs_deh_get_loc (deh));
|
||||||
|
return (reiserfs_ih_get_len (ih) - reiserfs_deh_get_loc (deh));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int reiserfs_direntry_name_len (reiserfs_ih_t * ih,
|
||||||
|
reiserfs_deh_t * deh,
|
||||||
|
int pos_in_item)
|
||||||
|
{
|
||||||
|
int len, i;
|
||||||
|
char * name;
|
||||||
|
|
||||||
|
len = reiserfs_direntry_entry_len (ih, deh, pos_in_item);
|
||||||
|
name = reiserfs_deh_name (deh, pos_in_item);
|
||||||
|
|
||||||
|
// name might be padded with 0s
|
||||||
|
i = 0;
|
||||||
|
while (name[i] && i < len)
|
||||||
|
i++;
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
int reiserfs_direntry_entry_estimate (char * name, int key_format) {
|
||||||
|
if (key_format == KEY_FORMAT_2)
|
||||||
|
return MISC_ROUND_UP (strlen(name));
|
||||||
|
else if (key_format == KEY_FORMAT_1)
|
||||||
|
return strlen(name);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the only corruption which is not considered fatal - is hash mismatching. If
|
||||||
|
bad_dir is set - directory item having such names is considered bad */
|
||||||
|
int reiserfs_direntry_check (reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_ih_t * ih,
|
||||||
|
char * item,
|
||||||
|
int bad_dir)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int namelen;
|
||||||
|
reiserfs_deh_t * deh = (reiserfs_deh_t *)item;
|
||||||
|
__u32 prev_offset = 0;
|
||||||
|
__u16 prev_location = reiserfs_ih_get_len (ih);
|
||||||
|
|
||||||
|
for (i = 0; i < reiserfs_ih_get_entries (ih); i ++, deh ++) {
|
||||||
|
if (reiserfs_deh_get_loc (deh) >= prev_location)
|
||||||
|
return 1;
|
||||||
|
prev_location = reiserfs_deh_get_loc (deh);
|
||||||
|
|
||||||
|
namelen = reiserfs_direntry_name_len (ih, deh, i);
|
||||||
|
if (namelen > REISERFS_NAME_MAX)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (reiserfs_deh_get_off (deh) <= prev_offset)
|
||||||
|
return 1;
|
||||||
|
prev_offset = reiserfs_deh_get_off (deh);
|
||||||
|
|
||||||
|
/* check hash value */
|
||||||
|
if (!reiserfs_hash_correct (&fs->hash,
|
||||||
|
item + prev_location,
|
||||||
|
namelen, prev_offset))
|
||||||
|
{
|
||||||
|
if (bad_dir)
|
||||||
|
/* make is_bad_leaf to not insert whole leaf. Node will be
|
||||||
|
marked not-insertable and put into tree item by item in
|
||||||
|
pass 2 */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int reiserfs_direntry_loc_check (reiserfs_deh_t * deh,
|
||||||
|
reiserfs_ih_t * ih,
|
||||||
|
int first)
|
||||||
|
{
|
||||||
|
if (reiserfs_deh_get_loc (deh) <
|
||||||
|
REISERFS_DEH_SIZE * reiserfs_ih_get_entries (ih))
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reiserfs_deh_get_loc (deh) >= reiserfs_ih_get_len (ih))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (!first) {
|
||||||
|
if (reiserfs_deh_get_loc (deh) >= reiserfs_deh_get_loc (deh - 1))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void reiserfs_direntry_print (FILE * fp, reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_bh_t * bh, reiserfs_ih_t * ih)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int namelen;
|
||||||
|
reiserfs_deh_t * deh;
|
||||||
|
char * name;
|
||||||
|
/* static char namebuf [80];*/
|
||||||
|
|
||||||
|
if (!reiserfs_ih_dir (ih))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/*printk ("\n%2%-25s%-30s%-15s%-15s%-15s\n", " Name", "length",
|
||||||
|
"Object key", "Hash", "Gen number", "Status"); */
|
||||||
|
|
||||||
|
reiserfs_warning (fp, "%3s: %-25s%s%-22s%-12s%s\n", "###", "Name",
|
||||||
|
"length", " Object key", " Hash", "Gen number");
|
||||||
|
|
||||||
|
deh = reiserfs_deh (bh, ih);
|
||||||
|
for (i = 0; i < reiserfs_ih_get_entries (ih); i ++, deh ++) {
|
||||||
|
if (reiserfs_direntry_loc_check (deh, ih, i == 0 ? 1 : 0)) {
|
||||||
|
reiserfs_warning (fp, "%3d: wrong entry location %u, deh_offset %u\n",
|
||||||
|
i, reiserfs_deh_get_loc (deh), reiserfs_deh_get_off (deh));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (i && reiserfs_direntry_loc_check (deh - 1, ih, ((i - 1) == 0) ? 1 : 0))
|
||||||
|
/* previous entry has bad location so we can not calculate entry
|
||||||
|
length */
|
||||||
|
namelen = 25;
|
||||||
|
else
|
||||||
|
namelen = reiserfs_direntry_name_len (ih, deh, i);
|
||||||
|
|
||||||
|
name = reiserfs_deh_name (deh, i);
|
||||||
|
reiserfs_warning (fp, "%3d: \"%-25.*s\"(%3d)%20K%12d%5d, loc %u, "
|
||||||
|
"state %x %s\n", i, namelen, name, namelen,
|
||||||
|
(reiserfs_key_t *)&(deh->deh2_dir_id),
|
||||||
|
OFFSET_HASH (reiserfs_deh_get_off (deh)),
|
||||||
|
OFFSET_GEN (reiserfs_deh_get_off (deh)),
|
||||||
|
reiserfs_deh_get_loc (deh), reiserfs_deh_get_state (deh),
|
||||||
|
reiserfs_hash_name (reiserfs_hash_find (
|
||||||
|
name, namelen, reiserfs_deh_get_off (deh),
|
||||||
|
fs ? reiserfs_sb_get_hash (fs->fs_ondisk_sb) :
|
||||||
|
UNSET_HASH)));
|
||||||
|
|
||||||
|
/*fs ? (reiserfs_hash_correct (&fs->hash, name,
|
||||||
|
namelen, deh_offset (deh)) ? "" : "(BROKEN)") : "??");*/
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "reiserfs/libreiserfs.h"
|
||||||
|
#include "misc/unaligned.h"
|
||||||
|
|
||||||
|
/* check item length, ih_free_space for pure 3.5 format, unformatted node
|
||||||
|
pointers */
|
||||||
|
int reiserfs_ext_check (reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_ih_t * ih,
|
||||||
|
char * item,
|
||||||
|
unfm_func_t func)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
__u32 * ind = (__u32 *)item;
|
||||||
|
|
||||||
|
if (reiserfs_ih_get_len (ih) % REISERFS_EXT_SIZE)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
for (i = 0; i < reiserfs_ext_count (ih); i ++) {
|
||||||
|
if (!ind [i])
|
||||||
|
continue;
|
||||||
|
if (func && func (fs, d32_get (ind, i)))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fs->fs_format == REISERFS_FORMAT_3_5) {
|
||||||
|
/* check ih_free_space for 3.5 format only */
|
||||||
|
if (reiserfs_ih_get_free (ih) > fs->fs_blocksize - 1)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// printing of extent item
|
||||||
|
//
|
||||||
|
static void start_new_sequence (__u32 * start, int * len, __u32 new)
|
||||||
|
{
|
||||||
|
*start = new;
|
||||||
|
*len = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sequence_finished (__u32 start, int * len, __u32 new)
|
||||||
|
{
|
||||||
|
if (le32_to_cpu (start) == MAX_INT)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (start == 0 && new == 0) {
|
||||||
|
(*len) ++;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (start != 0 && (le32_to_cpu (start) + *len) == le32_to_cpu (new)) {
|
||||||
|
(*len) ++;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void print_sequence (FILE * fp, __u32 start, int len)
|
||||||
|
{
|
||||||
|
if (start == MAX_INT)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (len == 1)
|
||||||
|
reiserfs_warning (fp, " %d", le32_to_cpu (start));
|
||||||
|
else
|
||||||
|
reiserfs_warning (fp, " %d(%d)", le32_to_cpu (start), len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void reiserfs_ext_print(FILE * fp,
|
||||||
|
reiserfs_bh_t * bh,
|
||||||
|
int item_num)
|
||||||
|
{
|
||||||
|
reiserfs_ih_t * ih;
|
||||||
|
unsigned int j;
|
||||||
|
__u32 * unp, prev = MAX_INT;
|
||||||
|
int num = 0;
|
||||||
|
|
||||||
|
ih = reiserfs_ih_at (bh, item_num);
|
||||||
|
unp = (__u32 *)reiserfs_item_by_ih (bh, ih);
|
||||||
|
|
||||||
|
if (reiserfs_ih_get_len (ih) % REISERFS_EXT_SIZE)
|
||||||
|
reiserfs_warning (fp, "reiserfs_ext_print: invalid item len");
|
||||||
|
|
||||||
|
reiserfs_warning (fp, "%d pointer%s\n[", reiserfs_ext_count (ih),
|
||||||
|
reiserfs_ext_count (ih) != 1 ? "s" : "" );
|
||||||
|
for (j = 0; j < reiserfs_ext_count (ih); j ++) {
|
||||||
|
if (sequence_finished (prev, &num, d32_get(unp, j))) {
|
||||||
|
print_sequence (fp, prev, num);
|
||||||
|
start_new_sequence (&prev, &num, d32_get(unp, j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print_sequence (fp, prev, num);
|
||||||
|
reiserfs_warning (fp, "]\n");
|
||||||
|
}
|
||||||
@@ -0,0 +1,480 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "reiserfs/libreiserfs.h"
|
||||||
|
#include "misc/malloc.h"
|
||||||
|
#include "misc/device.h"
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int reiserfs_fs_blksize_check (unsigned int blocksize)
|
||||||
|
{
|
||||||
|
return ((((blocksize & -blocksize) == blocksize)
|
||||||
|
&& (blocksize >= 512) && (blocksize <= 8192)));
|
||||||
|
}
|
||||||
|
|
||||||
|
reiserfs_blktype_t reiserfs_fs_block(reiserfs_filsys_t *fs,
|
||||||
|
unsigned long block)
|
||||||
|
{
|
||||||
|
if (block < fs->fs_super_bh->b_blocknr ||
|
||||||
|
block >= reiserfs_sb_get_blocks (fs->fs_ondisk_sb))
|
||||||
|
{
|
||||||
|
return BT_INVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (block == fs->fs_super_bh->b_blocknr)
|
||||||
|
return BT_SUPER;
|
||||||
|
|
||||||
|
if (reiserfs_journal_block (fs, block))
|
||||||
|
return BT_JOURNAL;
|
||||||
|
|
||||||
|
if (reiserfs_bitmap_block(fs, block))
|
||||||
|
return BT_BITMAP;
|
||||||
|
|
||||||
|
return BT_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* read super block. fixme: only 4k blocks, pre-journaled format
|
||||||
|
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_fs_open (char * filename, int flags,
|
||||||
|
int *error, void * vp, int check)
|
||||||
|
{
|
||||||
|
reiserfs_filsys_t * fs;
|
||||||
|
reiserfs_bh_t * bh;
|
||||||
|
reiserfs_sb_t * sb;
|
||||||
|
int fd, i;
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
*error = 0;
|
||||||
|
|
||||||
|
fd = open (filename, flags
|
||||||
|
#if defined(O_LARGEFILE)
|
||||||
|
| O_LARGEFILE
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
if (fd == -1) {
|
||||||
|
if (error)
|
||||||
|
*error = errno;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs = misc_getmem (sizeof (*fs));
|
||||||
|
fs->fs_dev = fd;
|
||||||
|
fs->fs_vp = vp;
|
||||||
|
strncpy(fs->fs_file_name, filename, sizeof(fs->fs_file_name));
|
||||||
|
|
||||||
|
/* reiserfs super block is either in 16-th or in 2-nd 4k block of the
|
||||||
|
device */
|
||||||
|
for (i = 2; i < 17; i += 14) {
|
||||||
|
bh = reiserfs_buffer_read (fd, i, 4096);
|
||||||
|
if (!bh) {
|
||||||
|
reiserfs_warning (stderr, "reiserfs_fs_open: reiserfs_buffer_read "
|
||||||
|
"failed reading block %d\n", i);
|
||||||
|
} else {
|
||||||
|
sb = (reiserfs_sb_t *)bh->b_data;
|
||||||
|
|
||||||
|
if (reiserfs_super_magic(sb))
|
||||||
|
goto found;
|
||||||
|
|
||||||
|
/* reiserfs signature is not found at the i-th 4k block */
|
||||||
|
reiserfs_buffer_close (bh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reiserfs_warning(stderr, "\nreiserfs_fs_open: the reiserfs superblock "
|
||||||
|
"cannot be found on %s.\n", filename);
|
||||||
|
|
||||||
|
misc_freemem (fs);
|
||||||
|
close (fd);
|
||||||
|
fs = NULL;
|
||||||
|
return fs;
|
||||||
|
|
||||||
|
found:
|
||||||
|
|
||||||
|
if (!reiserfs_fs_blksize_check(reiserfs_sb_get_blksize(sb))) {
|
||||||
|
reiserfs_warning(stderr, "reiserfs_fs_open: a superblock with "
|
||||||
|
"wrong parameters was found in the block (%d).\n", i);
|
||||||
|
misc_freemem (fs);
|
||||||
|
close (fd);
|
||||||
|
reiserfs_buffer_close(bh);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (check) {
|
||||||
|
/* A few checks of found super block. */
|
||||||
|
reiserfs_bh_t *tmp_bh;
|
||||||
|
|
||||||
|
tmp_bh = reiserfs_buffer_read (fd, reiserfs_sb_get_blocks(sb) - 1,
|
||||||
|
reiserfs_sb_get_blksize(sb));
|
||||||
|
|
||||||
|
if (!tmp_bh) {
|
||||||
|
reiserfs_warning (stderr, "\n%s: Your partition is not big enough "
|
||||||
|
"to contain the \nfilesystem of (%lu) blocks as "
|
||||||
|
"was specified in the found super block.\n",
|
||||||
|
__FUNCTION__, reiserfs_sb_get_blocks(sb) - 1);
|
||||||
|
|
||||||
|
misc_freemem (fs);
|
||||||
|
close (fd);
|
||||||
|
reiserfs_buffer_close(bh);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
reiserfs_buffer_close(tmp_bh);
|
||||||
|
}
|
||||||
|
|
||||||
|
fs->fs_blocksize = reiserfs_sb_get_blksize (sb);
|
||||||
|
|
||||||
|
/* check block size on the filesystem */
|
||||||
|
if (fs->fs_blocksize != 4096) {
|
||||||
|
i = bh->b_blocknr * 4096 / fs->fs_blocksize;
|
||||||
|
reiserfs_buffer_close (bh);
|
||||||
|
bh = reiserfs_buffer_read (fd, i, fs->fs_blocksize);
|
||||||
|
if (!bh) {
|
||||||
|
reiserfs_warning (stderr, "reiserfs_fs_open: reiserfs_buffer_read "
|
||||||
|
"failed reading block %d, size %d\n",
|
||||||
|
i, fs->fs_blocksize);
|
||||||
|
misc_freemem (fs);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
sb = (reiserfs_sb_t *)bh->b_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs->hash = reiserfs_hash_func (reiserfs_sb_get_hash (sb));
|
||||||
|
fs->fs_super_bh = bh;
|
||||||
|
fs->fs_ondisk_sb = sb;
|
||||||
|
fs->fs_flags = flags; /* O_RDONLY or O_RDWR */
|
||||||
|
|
||||||
|
fs->fs_format = reiserfs_super_format (sb);
|
||||||
|
|
||||||
|
/*reiserfs_read_bitmap_blocks(fs);*/
|
||||||
|
if (flags & O_RDWR)
|
||||||
|
fs->fs_dirt = 1;
|
||||||
|
else
|
||||||
|
fs->fs_dirt = 0;
|
||||||
|
|
||||||
|
return fs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* creates buffer for super block and fills it up with fields which are
|
||||||
|
constant for given size and version of a filesystem */
|
||||||
|
reiserfs_filsys_t * reiserfs_fs_create (char * filename,
|
||||||
|
int version,
|
||||||
|
unsigned long block_count,
|
||||||
|
int block_size,
|
||||||
|
int default_journal,
|
||||||
|
int new_format)
|
||||||
|
{
|
||||||
|
reiserfs_filsys_t * fs;
|
||||||
|
unsigned long bmap_nr;
|
||||||
|
|
||||||
|
if (misc_device_count_blocks (filename, block_size) < block_count) {
|
||||||
|
reiserfs_warning (stderr, "reiserfs_fs_create: no enough "
|
||||||
|
"blocks on device\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!reiserfs_journal_fits (REISERFS_DISK_OFFSET_IN_BYTES / block_size,
|
||||||
|
block_size, block_count, 0))
|
||||||
|
{
|
||||||
|
reiserfs_warning (stderr, "reiserfs_fs_create: can not create that "
|
||||||
|
"small (%d blocks) filesystem\n", block_count);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs = misc_getmem (sizeof (*fs));
|
||||||
|
if (!fs) {
|
||||||
|
reiserfs_warning (stderr, "reiserfs_fs_create: misc_getmem failed\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs->fs_dev = open (filename, O_RDWR
|
||||||
|
#if defined(O_LARGEFILE)
|
||||||
|
| O_LARGEFILE
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
if (fs->fs_dev == -1) {
|
||||||
|
reiserfs_warning (stderr, "reiserfs_fs_create: could not open %s: %s\n",
|
||||||
|
filename, strerror(errno));
|
||||||
|
|
||||||
|
misc_freemem (fs);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs->fs_blocksize = block_size;
|
||||||
|
sprintf(fs->fs_file_name, filename);
|
||||||
|
fs->fs_format = version;
|
||||||
|
|
||||||
|
if (new_format)
|
||||||
|
fs->fs_super_bh = reiserfs_buffer_open (fs->fs_dev,
|
||||||
|
REISERFS_DISK_OFFSET_IN_BYTES / block_size, block_size);
|
||||||
|
else
|
||||||
|
fs->fs_super_bh = reiserfs_buffer_open (fs->fs_dev,
|
||||||
|
REISERFS_OLD_DISK_OFFSET_IN_BYTES / block_size, block_size);
|
||||||
|
|
||||||
|
if (!fs->fs_super_bh) {
|
||||||
|
reiserfs_warning (stderr, "reiserfs_fs_create: "
|
||||||
|
"reiserfs_buffer_open failed\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
reiserfs_buffer_mkuptodate (fs->fs_super_bh, 1);
|
||||||
|
|
||||||
|
fs->fs_ondisk_sb = (reiserfs_sb_t *)fs->fs_super_bh->b_data;
|
||||||
|
memset (fs->fs_ondisk_sb, 0, block_size);
|
||||||
|
|
||||||
|
/* fill super block fields which are constant for given version
|
||||||
|
and block count */
|
||||||
|
reiserfs_sb_set_blocks (fs->fs_ondisk_sb, block_count);
|
||||||
|
/* sb_free_blocks */
|
||||||
|
/* sb_root_block */
|
||||||
|
/* sb_journal_1st_block */
|
||||||
|
/* sb_journal_dev */
|
||||||
|
/* sb_orig_journal_size */
|
||||||
|
/* sb_joural_magic */
|
||||||
|
/* sb_journal magic_F */
|
||||||
|
/* sb_mount_id */
|
||||||
|
/* sb_not_used0 */
|
||||||
|
/* sb_generation_number */
|
||||||
|
reiserfs_sb_set_blksize (fs->fs_ondisk_sb, block_size);
|
||||||
|
switch (version) {
|
||||||
|
case REISERFS_FORMAT_3_5:
|
||||||
|
reiserfs_sb_set_mapmax (fs->fs_ondisk_sb,
|
||||||
|
(block_size - REISERFS_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,
|
||||||
|
strlen (REISERFS_3_5_SUPER_MAGIC_STRING));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case REISERFS_FORMAT_3_6:
|
||||||
|
reiserfs_sb_set_mapmax (fs->fs_ondisk_sb,
|
||||||
|
(block_size - REISERFS_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,
|
||||||
|
strlen (REISERFS_3_6_SUPER_MAGIC_STRING));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!default_journal)
|
||||||
|
memcpy (fs->fs_ondisk_sb->s_v1.s_magic,
|
||||||
|
REISERFS_JR_SUPER_MAGIC_STRING,
|
||||||
|
strlen (REISERFS_JR_SUPER_MAGIC_STRING));
|
||||||
|
|
||||||
|
/* sb_fsck_state */
|
||||||
|
/* sb_hash_function_code */
|
||||||
|
/* sb_tree_height */
|
||||||
|
bmap_nr = reiserfs_bmap_nr(block_count, block_size);
|
||||||
|
|
||||||
|
reiserfs_sb_set_version (fs->fs_ondisk_sb, version);
|
||||||
|
reiserfs_sb_set_bmaps (fs->fs_ondisk_sb,
|
||||||
|
reiserfs_bmap_over(bmap_nr) ? 0 : bmap_nr);
|
||||||
|
|
||||||
|
/* sb_not_used1 */
|
||||||
|
reiserfs_buffer_mkdirty (fs->fs_super_bh);
|
||||||
|
fs->fs_dirt = 1;
|
||||||
|
|
||||||
|
return fs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* flush bitmap, reiserfs_buffer_close super block, flush all dirty buffers,
|
||||||
|
close and open again the device, read super block */
|
||||||
|
static void reiserfs_only_reopen (reiserfs_filsys_t * fs, int flag)
|
||||||
|
{
|
||||||
|
unsigned long super_block;
|
||||||
|
|
||||||
|
|
||||||
|
/* reiserfs_bitmap_flush (fs->fs_bitmap2, fs);*/
|
||||||
|
super_block = fs->fs_super_bh->b_blocknr;
|
||||||
|
reiserfs_buffer_close (fs->fs_super_bh);
|
||||||
|
reiserfs_buffer_flush_all(fs->fs_dev);
|
||||||
|
|
||||||
|
reiserfs_buffer_invalidate_all (fs->fs_dev);
|
||||||
|
if (close (fs->fs_dev))
|
||||||
|
misc_die ("reiserfs_fs_reopen: closed failed: %s", strerror(errno));
|
||||||
|
|
||||||
|
fs->fs_dev = open (fs->fs_file_name, flag
|
||||||
|
#if defined(O_LARGEFILE)
|
||||||
|
| O_LARGEFILE
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
if (fs->fs_dev == -1)
|
||||||
|
misc_die ("reiserfs_fs_reopen: could not reopen device: %s",
|
||||||
|
strerror(errno));
|
||||||
|
|
||||||
|
fs->fs_super_bh = reiserfs_buffer_read (fs->fs_dev, super_block,
|
||||||
|
fs->fs_blocksize);
|
||||||
|
|
||||||
|
if (!fs->fs_super_bh)
|
||||||
|
misc_die ("reiserfs_fs_reopen: reading super block failed");
|
||||||
|
|
||||||
|
fs->fs_ondisk_sb = (reiserfs_sb_t *)fs->fs_super_bh->b_data;
|
||||||
|
fs->fs_flags = flag; /* O_RDONLY or O_RDWR */
|
||||||
|
|
||||||
|
if (flag & O_RDWR)
|
||||||
|
fs->fs_dirt = 1;
|
||||||
|
else
|
||||||
|
fs->fs_dirt = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void reiserfs_fs_reopen (reiserfs_filsys_t * fs, int flag)
|
||||||
|
{
|
||||||
|
reiserfs_only_reopen (fs, flag);
|
||||||
|
reiserfs_journal_reopen (fs, flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
int reiserfs_fs_rw (reiserfs_filsys_t * fs)
|
||||||
|
{
|
||||||
|
if ((fs->fs_flags) & O_RDWR)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* flush all changes made on a filesystem */
|
||||||
|
void reiserfs_fs_flush (reiserfs_filsys_t * fs)
|
||||||
|
{
|
||||||
|
if (fs->fs_dirt) {
|
||||||
|
reiserfs_journal_flush (fs);
|
||||||
|
reiserfs_buffer_flush_all(fs->fs_dev);
|
||||||
|
}
|
||||||
|
fs->fs_dirt = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* free all memory involved into manipulating with filesystem */
|
||||||
|
void reiserfs_fs_free (reiserfs_filsys_t * fs)
|
||||||
|
{
|
||||||
|
reiserfs_journal_free (fs);
|
||||||
|
reiserfs_bitmap_free (fs);
|
||||||
|
|
||||||
|
/* release super block and memory used by filesystem handler */
|
||||||
|
reiserfs_buffer_close (fs->fs_super_bh);
|
||||||
|
fs->fs_super_bh = 0;
|
||||||
|
|
||||||
|
reiserfs_buffer_free_all ();
|
||||||
|
misc_freemem (fs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* this closes everything: journal. bitmap and the fs itself */
|
||||||
|
void reiserfs_fs_close (reiserfs_filsys_t * fs)
|
||||||
|
{
|
||||||
|
reiserfs_journal_close (fs);
|
||||||
|
reiserfs_bitmap_close (fs);
|
||||||
|
|
||||||
|
reiserfs_fs_flush (fs);
|
||||||
|
fsync(fs->fs_dev);
|
||||||
|
reiserfs_fs_free (fs);
|
||||||
|
}
|
||||||
|
|
||||||
|
void reiserfs_print_bmap_block (FILE * fp, int i, unsigned long block,
|
||||||
|
char * map, int blocks, int silent,
|
||||||
|
int blocksize)
|
||||||
|
{
|
||||||
|
int j, k;
|
||||||
|
int bits = blocksize * 8;
|
||||||
|
int zeros = 0, ones = 0;
|
||||||
|
|
||||||
|
|
||||||
|
reiserfs_warning (fp, "#%d: block %lu: ", i, block);
|
||||||
|
|
||||||
|
blocks = blocksize * 8;
|
||||||
|
|
||||||
|
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 (misc_test_bit (j, map)) {
|
||||||
|
ones ++;
|
||||||
|
if (j == blocks - 1) {
|
||||||
|
if (!silent)
|
||||||
|
reiserfs_warning (fp, "%d)\n", j + i * bits);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
if (!silent)
|
||||||
|
reiserfs_warning (fp, "%d) Free(%d-",
|
||||||
|
j - 1 + i * bits, j + i * bits);
|
||||||
|
|
||||||
|
while (!misc_test_bit (j, map)) {
|
||||||
|
zeros ++;
|
||||||
|
if (j == blocks - 1) {
|
||||||
|
if (!silent)
|
||||||
|
reiserfs_warning (fp, "%d)\n", j + i * bits);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
if (!silent)
|
||||||
|
reiserfs_warning (fp, "%d) Busy(%d-",
|
||||||
|
j - 1 + i * bits, j + i * bits);
|
||||||
|
|
||||||
|
j --;
|
||||||
|
end:
|
||||||
|
/* to make gcc 3.2 do not sware here */;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* first block addressed by this bitmap is free */
|
||||||
|
zeros ++;
|
||||||
|
if (!silent)
|
||||||
|
reiserfs_warning (fp, "Free (%d-", i * bits);
|
||||||
|
for (j = 1; j < blocks; j ++) {
|
||||||
|
k = 0;
|
||||||
|
while (!misc_test_bit (j, map)) {
|
||||||
|
k ++;
|
||||||
|
if (j == blocks - 1) {
|
||||||
|
if (!silent)
|
||||||
|
reiserfs_warning (fp, "%d)\n", j + i * bits);
|
||||||
|
zeros += k;
|
||||||
|
goto end2;
|
||||||
|
}
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
zeros += k;
|
||||||
|
if (!silent)
|
||||||
|
reiserfs_warning (fp, "%d) Busy(%d-",
|
||||||
|
j - 1 + i * bits, j + i * bits);
|
||||||
|
|
||||||
|
k = 0;
|
||||||
|
while (misc_test_bit (j, map)) {
|
||||||
|
ones ++;
|
||||||
|
if (j == blocks - 1) {
|
||||||
|
if (!silent)
|
||||||
|
reiserfs_warning (fp, "%d)\n", j + i * bits);
|
||||||
|
ones += k;
|
||||||
|
goto end2;
|
||||||
|
}
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
ones += k;
|
||||||
|
if (!silent)
|
||||||
|
reiserfs_warning (fp, "%d) Free(%d-",
|
||||||
|
j - 1 + i * bits, j + i * bits);
|
||||||
|
|
||||||
|
j --;
|
||||||
|
end2:
|
||||||
|
/* to make gcc 3.2 do not sware here */;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reiserfs_warning (fp, "used %d, free %d\n", ones, zeros);
|
||||||
|
}
|
||||||
|
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,358 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Keyed 32-bit hash function using TEA in a Davis-Meyer function
|
||||||
|
* H0 = Key
|
||||||
|
* Hi = E Mi(Hi-1) + Hi-1
|
||||||
|
*
|
||||||
|
* (see Applied Cryptography, 2nd edition, p448).
|
||||||
|
*
|
||||||
|
* Jeremy Fitzhardinge <jeremy@zip.com.au> 1998
|
||||||
|
*
|
||||||
|
* Jeremy has agreed to the contents of reiserfs/README. -Hans
|
||||||
|
* Yura's function is added (04/07/2000)
|
||||||
|
*/
|
||||||
|
|
||||||
|
//
|
||||||
|
// reiserfs_hash_keyed
|
||||||
|
// reiserfs_hash_yura
|
||||||
|
// r5
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "reiserfs/libreiserfs.h"
|
||||||
|
|
||||||
|
#define DELTA 0x9E3779B9
|
||||||
|
#define FULLROUNDS 10 /* 32 is overkill, 16 is strong crypto */
|
||||||
|
#define PARTROUNDS 6 /* 6 gets complete mixing */
|
||||||
|
|
||||||
|
/* a, b, c, d - data; h0, h1 - accumulated hash */
|
||||||
|
#define TEACORE(rounds) \
|
||||||
|
do { \
|
||||||
|
__u32 sum = 0; \
|
||||||
|
int n = rounds; \
|
||||||
|
__u32 b0, b1; \
|
||||||
|
\
|
||||||
|
b0 = h0; \
|
||||||
|
b1 = h1; \
|
||||||
|
\
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
sum += DELTA; \
|
||||||
|
b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b); \
|
||||||
|
b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d); \
|
||||||
|
} while(--n); \
|
||||||
|
\
|
||||||
|
h0 += b0; \
|
||||||
|
h1 += b1; \
|
||||||
|
} while(0);
|
||||||
|
|
||||||
|
|
||||||
|
__u32 reiserfs_hash_keyed(const char *msg, int len)
|
||||||
|
{
|
||||||
|
__u32 k[] = { 0x9464a485, 0x542e1a94, 0x3e846bff, 0xb75bcfc3};
|
||||||
|
|
||||||
|
__u32 h0 = k[0], h1 = k[1];
|
||||||
|
__u32 a, b, c, d;
|
||||||
|
__u32 pad;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
|
||||||
|
pad = (__u32)len | ((__u32)len << 8);
|
||||||
|
pad |= pad << 16;
|
||||||
|
|
||||||
|
while(len >= 16)
|
||||||
|
{
|
||||||
|
a = (__u32)msg[ 0] |
|
||||||
|
(__u32)msg[ 1] << 8 |
|
||||||
|
(__u32)msg[ 2] << 16|
|
||||||
|
(__u32)msg[ 3] << 24;
|
||||||
|
b = (__u32)msg[ 4] |
|
||||||
|
(__u32)msg[ 5] << 8 |
|
||||||
|
(__u32)msg[ 6] << 16|
|
||||||
|
(__u32)msg[ 7] << 24;
|
||||||
|
c = (__u32)msg[ 8] |
|
||||||
|
(__u32)msg[ 9] << 8 |
|
||||||
|
(__u32)msg[10] << 16|
|
||||||
|
(__u32)msg[11] << 24;
|
||||||
|
d = (__u32)msg[12] |
|
||||||
|
(__u32)msg[13] << 8 |
|
||||||
|
(__u32)msg[14] << 16|
|
||||||
|
(__u32)msg[15] << 24;
|
||||||
|
|
||||||
|
TEACORE(PARTROUNDS);
|
||||||
|
|
||||||
|
len -= 16;
|
||||||
|
msg += 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len >= 12)
|
||||||
|
{
|
||||||
|
if (len >= 16)
|
||||||
|
*(int *)0 = 0;
|
||||||
|
|
||||||
|
a = (__u32)msg[ 0] |
|
||||||
|
(__u32)msg[ 1] << 8 |
|
||||||
|
(__u32)msg[ 2] << 16|
|
||||||
|
(__u32)msg[ 3] << 24;
|
||||||
|
b = (__u32)msg[ 4] |
|
||||||
|
(__u32)msg[ 5] << 8 |
|
||||||
|
(__u32)msg[ 6] << 16|
|
||||||
|
(__u32)msg[ 7] << 24;
|
||||||
|
c = (__u32)msg[ 8] |
|
||||||
|
(__u32)msg[ 9] << 8 |
|
||||||
|
(__u32)msg[10] << 16|
|
||||||
|
(__u32)msg[11] << 24;
|
||||||
|
|
||||||
|
d = pad;
|
||||||
|
for(i = 12; i < len; i++)
|
||||||
|
{
|
||||||
|
d <<= 8;
|
||||||
|
d |= msg[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (len >= 8)
|
||||||
|
{
|
||||||
|
if (len >= 12)
|
||||||
|
*(int *)0 = 0;
|
||||||
|
a = (__u32)msg[ 0] |
|
||||||
|
(__u32)msg[ 1] << 8 |
|
||||||
|
(__u32)msg[ 2] << 16|
|
||||||
|
(__u32)msg[ 3] << 24;
|
||||||
|
b = (__u32)msg[ 4] |
|
||||||
|
(__u32)msg[ 5] << 8 |
|
||||||
|
(__u32)msg[ 6] << 16|
|
||||||
|
(__u32)msg[ 7] << 24;
|
||||||
|
|
||||||
|
c = d = pad;
|
||||||
|
for(i = 8; i < len; i++)
|
||||||
|
{
|
||||||
|
c <<= 8;
|
||||||
|
c |= msg[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (len >= 4)
|
||||||
|
{
|
||||||
|
if (len >= 8)
|
||||||
|
*(int *)0 = 0;
|
||||||
|
a = (__u32)msg[ 0] |
|
||||||
|
(__u32)msg[ 1] << 8 |
|
||||||
|
(__u32)msg[ 2] << 16|
|
||||||
|
(__u32)msg[ 3] << 24;
|
||||||
|
|
||||||
|
b = c = d = pad;
|
||||||
|
for(i = 4; i < len; i++)
|
||||||
|
{
|
||||||
|
b <<= 8;
|
||||||
|
b |= msg[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (len >= 4)
|
||||||
|
*(int *)0 = 0;
|
||||||
|
a = b = c = d = pad;
|
||||||
|
for(i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
a <<= 8;
|
||||||
|
a |= msg[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEACORE(FULLROUNDS);
|
||||||
|
|
||||||
|
return h0^h1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__u32 reiserfs_hash_yura (const char *msg, int len)
|
||||||
|
{
|
||||||
|
int j, pow;
|
||||||
|
__u32 a, c;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (pow=1,i=1; i < len; i++) pow = pow * 10;
|
||||||
|
|
||||||
|
if (len == 1)
|
||||||
|
a = msg[0]-48;
|
||||||
|
else
|
||||||
|
a = (msg[0] - 48) * pow;
|
||||||
|
|
||||||
|
for (i=1; i < len; i++) {
|
||||||
|
c = msg[i] - 48;
|
||||||
|
for (pow=1,j=i; j < len-1; j++) pow = pow * 10;
|
||||||
|
a = a + c * pow;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; i < 40; i++) {
|
||||||
|
c = '0' - 48;
|
||||||
|
for (pow=1,j=i; j < len-1; j++) pow = pow * 10;
|
||||||
|
a = a + c * pow;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; i < 256; i++) {
|
||||||
|
c = i;
|
||||||
|
for (pow=1,j=i; j < len-1; j++) pow = pow * 10;
|
||||||
|
a = a + c * pow;
|
||||||
|
}
|
||||||
|
|
||||||
|
a = a << 7;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__u32 reiserfs_hash_r5 (const char *msg, int len)
|
||||||
|
{
|
||||||
|
__u32 a=0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < len; i ++) {
|
||||||
|
a += msg[i] << 4;
|
||||||
|
a += msg[i] >> 4;
|
||||||
|
a *= 11;
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct {
|
||||||
|
hashf_t func;
|
||||||
|
char * name;
|
||||||
|
} hashes[REISERFS_HASH_LAST] = {{0, "not set"},
|
||||||
|
{reiserfs_hash_keyed, "\"tea\""},
|
||||||
|
{reiserfs_hash_yura, "\"rupasov\""},
|
||||||
|
{reiserfs_hash_r5, "\"r5\""}};
|
||||||
|
|
||||||
|
#define HASH_AMOUNT (sizeof (hashes) / sizeof (hashes [0]))
|
||||||
|
|
||||||
|
#define good_name(hashfn,name,namelen,deh_offset) \
|
||||||
|
(reiserfs_hash_value (hashfn, name, namelen) == OFFSET_HASH (deh_offset))
|
||||||
|
|
||||||
|
|
||||||
|
/* this also sets hash function */
|
||||||
|
int reiserfs_hash_correct (hashf_t *func, char * name,
|
||||||
|
int namelen, __u32 offset)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
if (namelen == 1 && name[0] == '.') {
|
||||||
|
if (offset == OFFSET_DOT)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (namelen == 2 && name[0] == '.' && name[1] == '.') {
|
||||||
|
if (offset == OFFSET_DOT_DOT)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*func == 0) {
|
||||||
|
/* try to find what hash function the name is sorted with */
|
||||||
|
for (i = 1; i < HASH_AMOUNT; i ++) {
|
||||||
|
if (good_name (hashes [i].func, name, namelen, offset)) {
|
||||||
|
if (*func) {
|
||||||
|
/* two or more hash functions give ok for this name */
|
||||||
|
fprintf (stderr, "Detecting hash code: could not detect "
|
||||||
|
"hash with name \"%.*s\"\n", namelen, name);
|
||||||
|
*func = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set hash function */
|
||||||
|
*func = hashes [i].func;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*func == 0)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (good_name (*func, name, namelen, offset))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int reiserfs_hash_find (char * name, int namelen, __u32 offset,
|
||||||
|
unsigned int code_to_try_first)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
if (!namelen || !name[0])
|
||||||
|
return UNSET_HASH;
|
||||||
|
|
||||||
|
if (code_to_try_first) {
|
||||||
|
if (good_name (hashes [code_to_try_first].func, name, namelen, offset))
|
||||||
|
return code_to_try_first;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 1; i < HASH_AMOUNT; i ++) {
|
||||||
|
if (i == code_to_try_first)
|
||||||
|
continue;
|
||||||
|
if (good_name (hashes [i].func, name, namelen, offset))
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* not matching hash found */
|
||||||
|
return UNSET_HASH;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char * reiserfs_hash_name(unsigned int code) {
|
||||||
|
if (code >= HASH_AMOUNT || code < 0)
|
||||||
|
return 0;
|
||||||
|
return hashes [code].name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int reiserfs_hash_code (hashf_t func)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < HASH_AMOUNT; i ++)
|
||||||
|
if (func == hashes [i].func)
|
||||||
|
return i;
|
||||||
|
|
||||||
|
reiserfs_panic ("reiserfs_hash_code: no hashes matches this function\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
hashf_t reiserfs_hash_func(unsigned int code) {
|
||||||
|
if (code >= HASH_AMOUNT) {
|
||||||
|
reiserfs_warning (stderr, "reiserfs_hash_func: wrong hash code %d.\n"
|
||||||
|
"Using default %s hash function\n", code,
|
||||||
|
reiserfs_hash_name (DEFAULT_HASH));
|
||||||
|
code = DEFAULT_HASH;
|
||||||
|
}
|
||||||
|
return hashes [code].func;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
hashf_t reiserfs_hash_get (char * hash) {
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < HASH_AMOUNT; i ++)
|
||||||
|
if (!strcmp (hash, hashes [i].name))
|
||||||
|
return hashes [i].func;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
__u32 reiserfs_hash_value (hashf_t func, char * name, int namelen) {
|
||||||
|
__u32 res;
|
||||||
|
|
||||||
|
res = func (name, namelen);
|
||||||
|
res = OFFSET_HASH(res);
|
||||||
|
if (res == 0)
|
||||||
|
res = 128;
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "reiserfs/libreiserfs.h"
|
||||||
|
|
||||||
|
/* returns 1 if buf looks like an internal node, 0 otherwise */
|
||||||
|
int reiserfs_internal_correct (reiserfs_bh_t *bh) {
|
||||||
|
reiserfs_node_head_t * blkh;
|
||||||
|
unsigned int nr;
|
||||||
|
int used_space;
|
||||||
|
|
||||||
|
blkh = (reiserfs_node_head_t *)bh->b_data;
|
||||||
|
|
||||||
|
if (!reiserfs_int_head (bh))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
nr = reiserfs_nh_get_items (blkh);
|
||||||
|
if (nr > (bh->b_size - REISERFS_NODEH_SIZE - REISERFS_DC_SIZE) /
|
||||||
|
(REISERFS_KEY_SIZE + REISERFS_DC_SIZE))
|
||||||
|
{
|
||||||
|
/* for internal which is not root we might check min number of keys */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
used_space = REISERFS_NODEH_SIZE + REISERFS_KEY_SIZE * nr +
|
||||||
|
REISERFS_DC_SIZE * (nr + 1);
|
||||||
|
|
||||||
|
if (used_space != bh->b_size - reiserfs_nh_get_free (blkh))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// one may imagine much more checks
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* this prints internal nodes (4 keys/items in line) (dc_number,
|
||||||
|
dc_size)[k_dirid, k_objectid, k_offset, k_uniqueness](dc_number,
|
||||||
|
dc_size)...*/
|
||||||
|
int reiserfs_internal_print (FILE * fp,
|
||||||
|
reiserfs_bh_t * bh,
|
||||||
|
int first, int last)
|
||||||
|
{
|
||||||
|
reiserfs_key_t * key;
|
||||||
|
reiserfs_dc_t * dc;
|
||||||
|
int i;
|
||||||
|
int from, to;
|
||||||
|
|
||||||
|
if (!reiserfs_int_head (bh))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (first == -1) {
|
||||||
|
from = 0;
|
||||||
|
to = reiserfs_node_items (bh);
|
||||||
|
} else {
|
||||||
|
from = first;
|
||||||
|
to = last < reiserfs_node_items (bh) ? last : reiserfs_node_items (bh);
|
||||||
|
}
|
||||||
|
|
||||||
|
reiserfs_warning (fp, "INTERNAL NODE (%ld) contains %b\n",
|
||||||
|
bh->b_blocknr, bh);
|
||||||
|
|
||||||
|
dc = reiserfs_int_at (bh, from);
|
||||||
|
reiserfs_warning (fp, "PTR %d: %y ", from, dc);
|
||||||
|
|
||||||
|
for (i = from, key = reiserfs_int_key_at (bh, from), dc ++;
|
||||||
|
i < to; i ++, key ++, dc ++)
|
||||||
|
{
|
||||||
|
reiserfs_warning (fp, "KEY %d: %20k PTR %d: %20y ",
|
||||||
|
i, key, i + 1, dc);
|
||||||
|
|
||||||
|
if (i && i % 4 == 0)
|
||||||
|
reiserfs_warning (fp, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
reiserfs_warning (fp, "\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* internal node bh must point to block */
|
||||||
|
int reiserfs_internal_get_pos (reiserfs_bh_t * bh,
|
||||||
|
unsigned long block)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i <= reiserfs_node_items (bh); i ++) {
|
||||||
|
if (reiserfs_dc_get_nr (reiserfs_int_at (bh, i)) == block)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
misc_die ("An internal pointer to the block (%lu) cannot be "
|
||||||
|
"found in the node (%lu)", block, bh->b_blocknr);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,971 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "reiserfs/libreiserfs.h"
|
||||||
|
|
||||||
|
/* modes of reiserfs_ib_shift_left, reiserfs_ib_shift_right and
|
||||||
|
reiserfs_ib_insert */
|
||||||
|
#define INTERNAL_SHIFT_FROM_S_TO_L 0
|
||||||
|
#define INTERNAL_SHIFT_FROM_R_TO_S 1
|
||||||
|
#define INTERNAL_SHIFT_FROM_L_TO_S 2
|
||||||
|
#define INTERNAL_SHIFT_FROM_S_TO_R 3
|
||||||
|
#define INTERNAL_INSERT_TO_S 4
|
||||||
|
#define INTERNAL_INSERT_TO_L 5
|
||||||
|
#define INTERNAL_INSERT_TO_R 6
|
||||||
|
|
||||||
|
static void reiserfs_ib_shift_prep (int shift_mode,
|
||||||
|
reiserfs_tb_t * tb,
|
||||||
|
int h,
|
||||||
|
reiserfs_bufinfo_t * dest_bi,
|
||||||
|
reiserfs_bufinfo_t * src_bi,
|
||||||
|
int * d_key,
|
||||||
|
reiserfs_bh_t ** cf)
|
||||||
|
{
|
||||||
|
/* define dest, src, dest parent, dest position */
|
||||||
|
switch (shift_mode) {
|
||||||
|
case INTERNAL_SHIFT_FROM_S_TO_L:
|
||||||
|
/* used in reiserfs_ib_shift_left */
|
||||||
|
src_bi->bi_bh = REISERFS_PATH_UPBUFFER (tb->tb_path, h);
|
||||||
|
src_bi->bi_parent = REISERFS_PATH_UPPARENT (tb->tb_path, h);
|
||||||
|
src_bi->bi_position = REISERFS_PATH_UPPOS (tb->tb_path, h + 1);
|
||||||
|
dest_bi->bi_bh = tb->L[h];
|
||||||
|
dest_bi->bi_parent = tb->FL[h];
|
||||||
|
dest_bi->bi_position = reiserfs_tb_lpos (tb, h);
|
||||||
|
*d_key = tb->lkey[h];
|
||||||
|
*cf = tb->CFL[h];
|
||||||
|
break;
|
||||||
|
case INTERNAL_SHIFT_FROM_L_TO_S:
|
||||||
|
src_bi->bi_bh = tb->L[h];
|
||||||
|
src_bi->bi_parent = tb->FL[h];
|
||||||
|
src_bi->bi_position = reiserfs_tb_lpos (tb, h);
|
||||||
|
dest_bi->bi_bh = REISERFS_PATH_UPBUFFER (tb->tb_path, h);
|
||||||
|
dest_bi->bi_parent = REISERFS_PATH_UPPARENT (tb->tb_path, h);
|
||||||
|
/* dest position is analog of dest->b_item_order */
|
||||||
|
dest_bi->bi_position = REISERFS_PATH_UPPOS (tb->tb_path, h + 1);
|
||||||
|
*d_key = tb->lkey[h];
|
||||||
|
*cf = tb->CFL[h];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case INTERNAL_SHIFT_FROM_R_TO_S:
|
||||||
|
/* used in reiserfs_ib_shift_left */
|
||||||
|
src_bi->bi_bh = tb->R[h];
|
||||||
|
src_bi->bi_parent = tb->FR[h];
|
||||||
|
src_bi->bi_position = reiserfs_tb_rpos (tb, h);
|
||||||
|
dest_bi->bi_bh = REISERFS_PATH_UPBUFFER (tb->tb_path, h);
|
||||||
|
dest_bi->bi_parent = REISERFS_PATH_UPPARENT (tb->tb_path, h);
|
||||||
|
dest_bi->bi_position = REISERFS_PATH_UPPOS (tb->tb_path, h + 1);
|
||||||
|
*d_key = tb->rkey[h];
|
||||||
|
*cf = tb->CFR[h];
|
||||||
|
break;
|
||||||
|
case INTERNAL_SHIFT_FROM_S_TO_R:
|
||||||
|
src_bi->bi_bh = REISERFS_PATH_UPBUFFER (tb->tb_path, h);
|
||||||
|
src_bi->bi_parent = REISERFS_PATH_UPPARENT (tb->tb_path, h);
|
||||||
|
src_bi->bi_position = REISERFS_PATH_UPPOS (tb->tb_path, h + 1);
|
||||||
|
dest_bi->bi_bh = tb->R[h];
|
||||||
|
dest_bi->bi_parent = tb->FR[h];
|
||||||
|
dest_bi->bi_position = reiserfs_tb_rpos (tb, h);
|
||||||
|
*d_key = tb->rkey[h];
|
||||||
|
*cf = tb->CFR[h];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case INTERNAL_INSERT_TO_L:
|
||||||
|
dest_bi->bi_bh = tb->L[h];
|
||||||
|
dest_bi->bi_parent = tb->FL[h];
|
||||||
|
dest_bi->bi_position = reiserfs_tb_lpos (tb, h);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case INTERNAL_INSERT_TO_S:
|
||||||
|
dest_bi->bi_bh = REISERFS_PATH_UPBUFFER (tb->tb_path, h);
|
||||||
|
dest_bi->bi_parent = REISERFS_PATH_UPPARENT (tb->tb_path, h);
|
||||||
|
dest_bi->bi_position = REISERFS_PATH_UPPOS (tb->tb_path, h + 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case INTERNAL_INSERT_TO_R:
|
||||||
|
dest_bi->bi_bh = tb->R[h];
|
||||||
|
dest_bi->bi_parent = tb->FR[h];
|
||||||
|
dest_bi->bi_position = reiserfs_tb_rpos (tb, h);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
reiserfs_panic ("reiserfs_ib_shift_prep",
|
||||||
|
"shift type is unknown (%d)", shift_mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Insert 'count' node pointers into buffer cur before position 'to' + 1.
|
||||||
|
* Insert count items into buffer cur before position to.
|
||||||
|
* Items and node pointers are specified by inserted and bh respectively.
|
||||||
|
*/
|
||||||
|
static void reiserfs_ib_insert (reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_bufinfo_t * cur_bi,
|
||||||
|
int to, int count,
|
||||||
|
reiserfs_ih_t * inserted,
|
||||||
|
reiserfs_bh_t ** bh)
|
||||||
|
{
|
||||||
|
reiserfs_bh_t * cur = cur_bi->bi_bh;
|
||||||
|
reiserfs_node_head_t * blkh;
|
||||||
|
int nr;
|
||||||
|
reiserfs_key_t * key;
|
||||||
|
reiserfs_dc_t new_dc[2];
|
||||||
|
reiserfs_dc_t * dc;
|
||||||
|
int i;
|
||||||
|
int from;
|
||||||
|
|
||||||
|
if (count <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
blkh = NODE_HEAD (cur);
|
||||||
|
nr = reiserfs_nh_get_items (blkh);
|
||||||
|
|
||||||
|
/* prepare space for count disk_child */
|
||||||
|
dc = reiserfs_int_at (cur,to+1);
|
||||||
|
|
||||||
|
memmove (dc + count, dc, (nr+1-(to+1)) * REISERFS_DC_SIZE);
|
||||||
|
|
||||||
|
/* make disk child array for insertion */
|
||||||
|
for (i = 0; i < count; i ++) {
|
||||||
|
reiserfs_dc_init(new_dc + i, REISERFS_NODE_SPACE(bh[i]->b_size) -
|
||||||
|
reiserfs_nh_get_free (NODE_HEAD (bh[i])),
|
||||||
|
bh[i]->b_blocknr);
|
||||||
|
/*
|
||||||
|
reiserfs_dc_set_size (new_dc + i,
|
||||||
|
REISERFS_NODE_SPACE(bh[i]->b_size) -
|
||||||
|
reiserfs_nh_get_free (NODE_HEAD (bh[i])));
|
||||||
|
reiserfs_dc_set_nr (new_dc + i, bh[i]->b_blocknr);*/
|
||||||
|
}
|
||||||
|
memcpy (dc, new_dc, REISERFS_DC_SIZE * count);
|
||||||
|
|
||||||
|
/* prepare space for 'count' items */
|
||||||
|
from = ((to == -1) ? 0 : to);
|
||||||
|
key = reiserfs_int_key_at (cur, from);
|
||||||
|
|
||||||
|
memmove (key + count, key, (nr - from/*to*/) * REISERFS_KEY_SIZE +
|
||||||
|
(nr + 1 + count) * REISERFS_DC_SIZE);
|
||||||
|
|
||||||
|
/* copy keys */
|
||||||
|
memcpy (key, inserted, REISERFS_KEY_SIZE);
|
||||||
|
if ( count > 1 )
|
||||||
|
memcpy (key + 1, inserted + 1, REISERFS_KEY_SIZE);
|
||||||
|
|
||||||
|
/* sizes, item number */
|
||||||
|
reiserfs_nh_set_items (blkh, nr + count);
|
||||||
|
reiserfs_nh_set_free (blkh, reiserfs_nh_get_free (blkh) -
|
||||||
|
count * (REISERFS_DC_SIZE + REISERFS_KEY_SIZE));
|
||||||
|
|
||||||
|
reiserfs_buffer_mkdirty (cur);
|
||||||
|
|
||||||
|
if (cur_bi->bi_parent) {
|
||||||
|
dc = reiserfs_int_at (cur_bi->bi_parent,cur_bi->bi_position);
|
||||||
|
reiserfs_dc_set_size (dc, reiserfs_dc_get_size (dc) +
|
||||||
|
count * (REISERFS_DC_SIZE + REISERFS_KEY_SIZE));
|
||||||
|
reiserfs_buffer_mkdirty (cur_bi->bi_parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Delete del_num items and node pointers from buffer cur starting from *
|
||||||
|
* the first_i'th item and first_p'th pointers respectively. */
|
||||||
|
static void reiserfs_ib_delete (reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_bufinfo_t * cur_bi,
|
||||||
|
int first_p,
|
||||||
|
int first_i,
|
||||||
|
int del_num)
|
||||||
|
{
|
||||||
|
reiserfs_bh_t * cur = cur_bi->bi_bh;
|
||||||
|
int nr;
|
||||||
|
reiserfs_node_head_t * blkh;
|
||||||
|
reiserfs_key_t * key;
|
||||||
|
reiserfs_dc_t * dc;
|
||||||
|
|
||||||
|
if ( del_num == 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
blkh = NODE_HEAD(cur);
|
||||||
|
nr = reiserfs_nh_get_items (blkh);
|
||||||
|
|
||||||
|
if ( first_p == 0 && del_num == nr + 1 ) {
|
||||||
|
reiserfs_tb_attach_new(cur_bi);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* deleting */
|
||||||
|
dc = reiserfs_int_at (cur, first_p);
|
||||||
|
|
||||||
|
memmove (dc, dc + del_num, (nr + 1 - first_p - del_num) *
|
||||||
|
REISERFS_DC_SIZE);
|
||||||
|
key = reiserfs_int_key_at (cur, first_i);
|
||||||
|
memmove (key, key + del_num, (nr - first_i - del_num) * REISERFS_KEY_SIZE +
|
||||||
|
(nr + 1 - del_num) * REISERFS_DC_SIZE);
|
||||||
|
|
||||||
|
|
||||||
|
/* sizes, item number */
|
||||||
|
reiserfs_nh_set_items (blkh, reiserfs_nh_get_items (blkh) - del_num);
|
||||||
|
reiserfs_nh_set_free (blkh, reiserfs_nh_get_free (blkh) +
|
||||||
|
del_num * (REISERFS_KEY_SIZE + REISERFS_DC_SIZE));
|
||||||
|
|
||||||
|
reiserfs_buffer_mkdirty (cur);
|
||||||
|
|
||||||
|
if (cur_bi->bi_parent) {
|
||||||
|
dc = reiserfs_int_at (cur_bi->bi_parent, cur_bi->bi_position);
|
||||||
|
reiserfs_dc_set_size (dc, reiserfs_dc_get_size (dc) -
|
||||||
|
del_num * (REISERFS_KEY_SIZE + REISERFS_DC_SIZE));
|
||||||
|
reiserfs_buffer_mkdirty (cur_bi->bi_parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* copy cpy_num node pointers and cpy_num - 1 items from buffer src to buffer
|
||||||
|
dest last_first == FIRST_TO_LAST means, that we copy first items from src
|
||||||
|
to tail of dest last_first == LAST_TO_FIRST means, that we copy last items
|
||||||
|
from src to head of dest */
|
||||||
|
static void reiserfs_ib_copy (reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_bufinfo_t * dest_bi,
|
||||||
|
reiserfs_bh_t * src,
|
||||||
|
int last_first,
|
||||||
|
int cpy_num)
|
||||||
|
{
|
||||||
|
/* ATTENTION! Number of node pointers in DEST is equal to number of
|
||||||
|
items in DEST as delimiting key have already inserted to buffer dest.*/
|
||||||
|
reiserfs_bh_t * dest = dest_bi->bi_bh;
|
||||||
|
int nr_dest, nr_src;
|
||||||
|
int dest_order, src_order;
|
||||||
|
reiserfs_node_head_t * blkh;
|
||||||
|
reiserfs_key_t * key;
|
||||||
|
reiserfs_dc_t * dc;
|
||||||
|
|
||||||
|
nr_src = reiserfs_node_items (src);
|
||||||
|
|
||||||
|
if ( cpy_num == 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* coping */
|
||||||
|
blkh = NODE_HEAD (dest);
|
||||||
|
nr_dest = reiserfs_nh_get_items (blkh);
|
||||||
|
|
||||||
|
/*dest_order = (last_first == LAST_TO_FIRST) ? 0 : nr_dest;*/
|
||||||
|
/*src_order = (last_first == LAST_TO_FIRST) ? (nr_src - cpy_num + 1) : 0;*/
|
||||||
|
(last_first == LAST_TO_FIRST) ?
|
||||||
|
(dest_order = 0, src_order = nr_src - cpy_num + 1) :
|
||||||
|
(dest_order = nr_dest, src_order = 0);
|
||||||
|
|
||||||
|
/* prepare space for cpy_num pointers */
|
||||||
|
dc = reiserfs_int_at (dest, dest_order);
|
||||||
|
|
||||||
|
memmove (dc + cpy_num, dc, (nr_dest - dest_order) * REISERFS_DC_SIZE);
|
||||||
|
|
||||||
|
/* insert pointers */
|
||||||
|
memcpy (dc, reiserfs_int_at (src, src_order), REISERFS_DC_SIZE * cpy_num);
|
||||||
|
|
||||||
|
/* prepare space for cpy_num - 1 item headers */
|
||||||
|
key = reiserfs_int_key_at(dest, dest_order);
|
||||||
|
memmove (key + cpy_num - 1, key, REISERFS_KEY_SIZE * (nr_dest - dest_order) +
|
||||||
|
REISERFS_DC_SIZE * (nr_dest + cpy_num));
|
||||||
|
|
||||||
|
|
||||||
|
/* insert headers */
|
||||||
|
memcpy (key, reiserfs_int_key_at (src, src_order), REISERFS_KEY_SIZE * (cpy_num - 1));
|
||||||
|
|
||||||
|
/* sizes, item number */
|
||||||
|
reiserfs_nh_set_items (blkh, reiserfs_nh_get_items (blkh) + cpy_num - 1);
|
||||||
|
reiserfs_nh_set_free (blkh, reiserfs_nh_get_free (blkh) -
|
||||||
|
(REISERFS_KEY_SIZE * (cpy_num - 1) +
|
||||||
|
REISERFS_DC_SIZE * cpy_num));
|
||||||
|
|
||||||
|
reiserfs_buffer_mkdirty (dest);
|
||||||
|
|
||||||
|
if (dest_bi->bi_parent) {
|
||||||
|
dc = reiserfs_int_at(dest_bi->bi_parent,dest_bi->bi_position);
|
||||||
|
reiserfs_dc_set_size (dc, reiserfs_dc_get_size (dc) +
|
||||||
|
REISERFS_KEY_SIZE * (cpy_num - 1) +
|
||||||
|
REISERFS_DC_SIZE * cpy_num);
|
||||||
|
reiserfs_buffer_mkdirty (dest_bi->bi_parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Copy cpy_num node pointers and cpy_num - 1 items from buffer src to
|
||||||
|
buffer dest. Delete cpy_num - del_par items and node pointers from
|
||||||
|
buffer src. last_first == FIRST_TO_LAST means, that we copy/delete
|
||||||
|
first items from src. last_first == LAST_TO_FIRST means, that we
|
||||||
|
copy/delete last items from src. */
|
||||||
|
static void reiserfs_ib_move (reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_bufinfo_t * dest_bi,
|
||||||
|
reiserfs_bufinfo_t * src_bi,
|
||||||
|
int last_first,
|
||||||
|
int cpy_num,
|
||||||
|
int del_par)
|
||||||
|
{
|
||||||
|
int first_pointer;
|
||||||
|
int first_item;
|
||||||
|
|
||||||
|
reiserfs_ib_copy (fs, dest_bi, src_bi->bi_bh, last_first, cpy_num);
|
||||||
|
|
||||||
|
if (last_first == FIRST_TO_LAST) { /* shift_left occurs */
|
||||||
|
first_pointer = 0;
|
||||||
|
first_item = 0;
|
||||||
|
/* delete cpy_num - del_par pointers and keys starting for pointers
|
||||||
|
with first_pointer, for key - with first_item */
|
||||||
|
reiserfs_ib_delete (fs, src_bi, first_pointer,
|
||||||
|
first_item, cpy_num - del_par);
|
||||||
|
} else {
|
||||||
|
/* shift_right occurs */
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
i = ( cpy_num - del_par == ( j = reiserfs_node_items(src_bi->bi_bh)) + 1 ) ?
|
||||||
|
0 : j - cpy_num + del_par;
|
||||||
|
|
||||||
|
reiserfs_ib_delete (fs, src_bi, j + 1 - cpy_num + del_par,
|
||||||
|
i, cpy_num - del_par);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Insert n_src'th key of buffer src before n_dest'th key of buffer dest. */
|
||||||
|
static void reiserfs_ib_insert_key (reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_bufinfo_t * dest_bi,
|
||||||
|
/* insert key before key with
|
||||||
|
n_dest number */
|
||||||
|
int dest_position_before,
|
||||||
|
reiserfs_bh_t * src,
|
||||||
|
int src_position )
|
||||||
|
{
|
||||||
|
reiserfs_bh_t * dest = dest_bi->bi_bh;
|
||||||
|
int nr;
|
||||||
|
reiserfs_node_head_t * blkh;
|
||||||
|
reiserfs_key_t * key;
|
||||||
|
|
||||||
|
blkh = NODE_HEAD(dest);
|
||||||
|
nr = reiserfs_nh_get_items (blkh);
|
||||||
|
|
||||||
|
/* prepare space for inserting key */
|
||||||
|
key = reiserfs_int_key_at (dest, dest_position_before);
|
||||||
|
memmove (key + 1, key, (nr - dest_position_before) * REISERFS_KEY_SIZE +
|
||||||
|
(nr + 1) * REISERFS_DC_SIZE);
|
||||||
|
|
||||||
|
/* insert key */
|
||||||
|
memcpy (key, reiserfs_int_key_at(src, src_position), REISERFS_KEY_SIZE);
|
||||||
|
|
||||||
|
/* Change dirt, free space, item number fields. */
|
||||||
|
reiserfs_nh_set_items (blkh, reiserfs_nh_get_items (blkh) + 1);
|
||||||
|
reiserfs_nh_set_free (blkh, reiserfs_nh_get_free (blkh) - REISERFS_KEY_SIZE);
|
||||||
|
|
||||||
|
reiserfs_buffer_mkdirty (dest);
|
||||||
|
|
||||||
|
if (dest_bi->bi_parent) {
|
||||||
|
reiserfs_dc_t * dc;
|
||||||
|
|
||||||
|
dc = reiserfs_int_at(dest_bi->bi_parent,dest_bi->bi_position);
|
||||||
|
reiserfs_dc_set_size (dc, reiserfs_dc_get_size (dc) + REISERFS_KEY_SIZE);
|
||||||
|
reiserfs_buffer_mkdirty (dest_bi->bi_parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Insert d_key'th (delimiting) key from buffer cfl to tail of dest.
|
||||||
|
* Copy pointer_amount node pointers and pointer_amount - 1 items from
|
||||||
|
* buffer src to buffer dest.
|
||||||
|
* Replace d_key'th key in buffer cfl.
|
||||||
|
* Delete pointer_amount items and node pointers from buffer src. */
|
||||||
|
/* this can be invoked both to shift from S to L and from R to S */
|
||||||
|
static void reiserfs_ib_shift_left (/* INTERNAL_FROM_S_TO_L |
|
||||||
|
INTERNAL_FROM_R_TO_S */
|
||||||
|
int mode,
|
||||||
|
reiserfs_tb_t * tb,
|
||||||
|
int h, int pointer_amount)
|
||||||
|
{
|
||||||
|
reiserfs_bufinfo_t dest_bi, src_bi;
|
||||||
|
reiserfs_bh_t * cf;
|
||||||
|
int d_key_position;
|
||||||
|
|
||||||
|
reiserfs_ib_shift_prep (mode, tb, h, &dest_bi, &src_bi,
|
||||||
|
&d_key_position, &cf);
|
||||||
|
|
||||||
|
/*printk("pointer_amount = %d\n",pointer_amount);*/
|
||||||
|
|
||||||
|
if (pointer_amount) {
|
||||||
|
/* insert delimiting key from common father of dest and src
|
||||||
|
to node dest into position B_NR_ITEM(dest) */
|
||||||
|
reiserfs_ib_insert_key (tb->tb_fs, &dest_bi,
|
||||||
|
reiserfs_node_items(dest_bi.bi_bh),
|
||||||
|
cf, d_key_position);
|
||||||
|
|
||||||
|
if (reiserfs_node_items(src_bi.bi_bh) == pointer_amount - 1) {
|
||||||
|
if (src_bi.bi_position/*src->b_item_order*/ == 0)
|
||||||
|
reiserfs_node_replace_key (cf, d_key_position,
|
||||||
|
src_bi.bi_parent, 0);
|
||||||
|
} else {
|
||||||
|
reiserfs_node_replace_key (cf, d_key_position,
|
||||||
|
src_bi.bi_bh, pointer_amount - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* last parameter is del_parameter */
|
||||||
|
reiserfs_ib_move (tb->tb_fs, &dest_bi, &src_bi,
|
||||||
|
FIRST_TO_LAST, pointer_amount, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Insert delimiting key to L[h].
|
||||||
|
* Copy n node pointers and n - 1 items from buffer S[h] to L[h].
|
||||||
|
* Delete n - 1 items and node pointers from buffer S[h].
|
||||||
|
*/
|
||||||
|
/* it always shifts from S[h] to L[h] */
|
||||||
|
static void reiserfs_ib_shift1_left (reiserfs_tb_t * tb,
|
||||||
|
int h, int pointer_amount)
|
||||||
|
{
|
||||||
|
reiserfs_bufinfo_t dest_bi, src_bi;
|
||||||
|
reiserfs_bh_t * cf;
|
||||||
|
int d_key_position;
|
||||||
|
|
||||||
|
reiserfs_ib_shift_prep (INTERNAL_SHIFT_FROM_S_TO_L, tb, h,
|
||||||
|
&dest_bi, &src_bi, &d_key_position, &cf);
|
||||||
|
|
||||||
|
if ( pointer_amount > 0 )
|
||||||
|
/* insert lkey[h]-th key from CFL[h] to left neighbor L[h] */
|
||||||
|
reiserfs_ib_insert_key (tb->tb_fs, &dest_bi,
|
||||||
|
reiserfs_node_items(dest_bi.bi_bh),
|
||||||
|
cf, d_key_position);
|
||||||
|
|
||||||
|
/* last parameter is del_parameter */
|
||||||
|
reiserfs_ib_move (tb->tb_fs, &dest_bi, &src_bi,
|
||||||
|
FIRST_TO_LAST, pointer_amount, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Insert d_key'th (delimiting) key from buffer cfr to head of dest.
|
||||||
|
* Copy n node pointers and n - 1 items from buffer src to buffer dest.
|
||||||
|
* Replace d_key'th key in buffer cfr.
|
||||||
|
* Delete n items and node pointers from buffer src.
|
||||||
|
*/
|
||||||
|
static void reiserfs_ib_shift_right (/* INTERNAL_FROM_S_TO_R |
|
||||||
|
INTERNAL_FROM_L_TO_S */
|
||||||
|
int mode,
|
||||||
|
reiserfs_tb_t * tb,
|
||||||
|
int h, int pointer_amount)
|
||||||
|
{
|
||||||
|
reiserfs_bufinfo_t dest_bi, src_bi;
|
||||||
|
reiserfs_bh_t * cf;
|
||||||
|
int d_key_position;
|
||||||
|
int nr;
|
||||||
|
|
||||||
|
|
||||||
|
reiserfs_ib_shift_prep (mode, tb, h, &dest_bi, &src_bi,
|
||||||
|
&d_key_position, &cf);
|
||||||
|
|
||||||
|
nr = reiserfs_node_items (src_bi.bi_bh);
|
||||||
|
|
||||||
|
if (pointer_amount > 0) {
|
||||||
|
/* insert delimiting key from common father of dest and src
|
||||||
|
to dest node into position 0 */
|
||||||
|
reiserfs_ib_insert_key (tb->tb_fs, &dest_bi,
|
||||||
|
0, cf, d_key_position);
|
||||||
|
if (nr == pointer_amount - 1) {
|
||||||
|
/* when S[h] disappers replace left delemiting key as well */
|
||||||
|
if (tb->CFL[h]) {
|
||||||
|
reiserfs_node_replace_key(cf, d_key_position,
|
||||||
|
tb->CFL[h], tb->lkey[h]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reiserfs_node_replace_key(cf, d_key_position,
|
||||||
|
src_bi.bi_bh, nr - pointer_amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* last parameter is del_parameter */
|
||||||
|
reiserfs_ib_move (tb->tb_fs, &dest_bi, &src_bi,
|
||||||
|
LAST_TO_FIRST, pointer_amount, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Insert delimiting key to R[h].
|
||||||
|
* Copy n node pointers and n - 1 items from buffer S[h] to R[h].
|
||||||
|
* Delete n - 1 items and node pointers from buffer S[h].
|
||||||
|
*/
|
||||||
|
/* it always shift from S[h] to R[h] */
|
||||||
|
static void reiserfs_ib_shift1_right (reiserfs_tb_t * tb,
|
||||||
|
int h, int pointer_amount)
|
||||||
|
{
|
||||||
|
reiserfs_bufinfo_t dest_bi, src_bi;
|
||||||
|
reiserfs_bh_t * cf;
|
||||||
|
int d_key_position;
|
||||||
|
|
||||||
|
reiserfs_ib_shift_prep (INTERNAL_SHIFT_FROM_S_TO_R, tb, h,
|
||||||
|
&dest_bi, &src_bi, &d_key_position, &cf);
|
||||||
|
|
||||||
|
if (pointer_amount > 0) /* insert rkey from CFR[h] to right neighbor R[h] */
|
||||||
|
reiserfs_ib_insert_key (tb->tb_fs, &dest_bi,
|
||||||
|
0, cf, d_key_position);
|
||||||
|
|
||||||
|
/* last parameter is del_parameter */
|
||||||
|
reiserfs_ib_move (tb->tb_fs, &dest_bi, &src_bi,
|
||||||
|
LAST_TO_FIRST, pointer_amount, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Delete insert_num node pointers together with their left items
|
||||||
|
* and balance current node.*/
|
||||||
|
static void reiserfs_ib_balance_delete (reiserfs_tb_t * tb,
|
||||||
|
int h, int child_pos)
|
||||||
|
{
|
||||||
|
int insert_num;
|
||||||
|
int n;
|
||||||
|
reiserfs_bh_t * tbSh = REISERFS_PATH_UPBUFFER (tb->tb_path, h);
|
||||||
|
reiserfs_bufinfo_t bi;
|
||||||
|
|
||||||
|
insert_num = tb->insert_size[h] / ((int)(REISERFS_DC_SIZE + REISERFS_KEY_SIZE));
|
||||||
|
|
||||||
|
/* delete child-node-pointer(s) together with their left item(s) */
|
||||||
|
bi.bi_bh = tbSh;
|
||||||
|
|
||||||
|
bi.bi_parent = REISERFS_PATH_UPPARENT (tb->tb_path, h);
|
||||||
|
|
||||||
|
bi.bi_position = REISERFS_PATH_UPPOS (tb->tb_path, h + 1);
|
||||||
|
|
||||||
|
reiserfs_ib_delete (tb->tb_fs, &bi, child_pos,
|
||||||
|
(child_pos == 0) ? child_pos : child_pos - 1,
|
||||||
|
-insert_num);
|
||||||
|
|
||||||
|
n = reiserfs_node_items(tbSh);
|
||||||
|
|
||||||
|
if ( tb->lnum[h] == 0 && tb->rnum[h] == 0 ) {
|
||||||
|
if ( tb->blknum[h] == 0 ) {
|
||||||
|
/* node S[h] (root of the tree) is empty now */
|
||||||
|
reiserfs_bh_t *new_root;
|
||||||
|
reiserfs_sb_t * sb;
|
||||||
|
|
||||||
|
/* choose a new root */
|
||||||
|
if ( ! tb->L[h-1] || ! reiserfs_node_items(tb->L[h-1]) )
|
||||||
|
new_root = tb->R[h-1];
|
||||||
|
else
|
||||||
|
new_root = tb->L[h-1];
|
||||||
|
|
||||||
|
/* update super block's tree height and pointer to a root block */
|
||||||
|
sb = tb->tb_fs->fs_ondisk_sb;
|
||||||
|
reiserfs_sb_set_root (sb, new_root->b_blocknr);
|
||||||
|
reiserfs_sb_set_height (sb, reiserfs_sb_get_height (sb) - 1);
|
||||||
|
|
||||||
|
reiserfs_buffer_mkdirty (tb->tb_fs->fs_super_bh);
|
||||||
|
tb->tb_fs->fs_dirt = 1;
|
||||||
|
|
||||||
|
/* mark buffer S[h] not uptodate and put it in free list */
|
||||||
|
reiserfs_node_forget(tb->tb_fs, tbSh->b_blocknr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( tb->L[h] && tb->lnum[h] == -reiserfs_node_items(tb->L[h]) - 1 ) {
|
||||||
|
/* join S[h] with L[h] */
|
||||||
|
/*tb->L[h], tb->CFL[h], tb->lkey[h], tb->S[h], n+1);*/
|
||||||
|
reiserfs_ib_shift_left (INTERNAL_SHIFT_FROM_S_TO_L,
|
||||||
|
tb, h, n + 1);
|
||||||
|
/* preserve not needed, internal, 1 mean free block */
|
||||||
|
reiserfs_node_forget(tb->tb_fs, tbSh->b_blocknr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( tb->R[h] && tb->rnum[h] == -reiserfs_node_items(tb->R[h]) - 1 ) {
|
||||||
|
/* join S[h] with R[h] */
|
||||||
|
reiserfs_ib_shift_right (INTERNAL_SHIFT_FROM_S_TO_R,
|
||||||
|
tb, h, n + 1);
|
||||||
|
reiserfs_node_forget(tb->tb_fs, tbSh->b_blocknr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( tb->lnum[h] < 0 ) {
|
||||||
|
/* borrow from left neighbor L[h] */
|
||||||
|
reiserfs_ib_shift_right (INTERNAL_SHIFT_FROM_L_TO_S,
|
||||||
|
tb, h, -tb->lnum[h]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( tb->rnum[h] < 0 ) {
|
||||||
|
/* borrow from right neighbor R[h] */
|
||||||
|
/*tb->S[h], tb->CFR[h], tb->rkey[h], tb->R[h], -tb->rnum[h]);*/
|
||||||
|
reiserfs_ib_shift_left (INTERNAL_SHIFT_FROM_R_TO_S,
|
||||||
|
tb, h, -tb->rnum[h]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( tb->lnum[h] > 0 ) {
|
||||||
|
/* split S[h] into two parts and put them into neighbors */
|
||||||
|
/*tb->L[h], tb->CFL[h], tb->lkey[h], tb->S[h], tb->lnum[h]);*/
|
||||||
|
reiserfs_ib_shift_left (INTERNAL_SHIFT_FROM_S_TO_L,
|
||||||
|
tb, h, tb->lnum[h]);
|
||||||
|
reiserfs_ib_shift_right (INTERNAL_SHIFT_FROM_S_TO_R,
|
||||||
|
tb, h, tb->rnum[h]);
|
||||||
|
reiserfs_node_forget(tb->tb_fs, tbSh->b_blocknr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
reiserfs_panic ("reiserfs_ib_balance_delete", "unexpected "
|
||||||
|
"tb->lnum[%d]==%d or tb->rnum[%d]==%d",
|
||||||
|
h, tb->lnum[h], h, tb->rnum[h]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Replace delimiting key of buffers L[h] and S[h] by the given key.*/
|
||||||
|
static void reiserfs_ib_set_lkey (reiserfs_tb_t * tb,
|
||||||
|
int h, reiserfs_ih_t * key)
|
||||||
|
{
|
||||||
|
if (reiserfs_node_items(REISERFS_PATH_UPBUFFER(tb->tb_path, h)) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
memcpy (reiserfs_int_key_at(tb->CFL[h],tb->lkey[h]), key, REISERFS_KEY_SIZE);
|
||||||
|
reiserfs_buffer_mkdirty (tb->CFL[h]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Replace delimiting key of buffers S[h] and R[h] by the given key.*/
|
||||||
|
static void reiserfs_ib_set_rkey (reiserfs_tb_t * tb,
|
||||||
|
int h, reiserfs_ih_t * key)
|
||||||
|
{
|
||||||
|
memcpy (reiserfs_int_key_at(tb->CFR[h],tb->rkey[h]), key, REISERFS_KEY_SIZE);
|
||||||
|
reiserfs_buffer_mkdirty (tb->CFR[h]);
|
||||||
|
}
|
||||||
|
|
||||||
|
int reiserfs_ib_balance (reiserfs_tb_t * tb,
|
||||||
|
/* level of the tree */
|
||||||
|
int h,
|
||||||
|
int child_pos,
|
||||||
|
/* key for insertion on higher level */
|
||||||
|
reiserfs_ih_t * insert_key,
|
||||||
|
/* node for insertion on higher level*/
|
||||||
|
reiserfs_bh_t ** insert_ptr)
|
||||||
|
/* if inserting/pasting
|
||||||
|
{
|
||||||
|
child_pos is the position of the node-pointer in S[h] that *
|
||||||
|
pointed to S[h-1] before balancing of the h-1 level; *
|
||||||
|
this means that new pointers and items must be inserted AFTER *
|
||||||
|
child_pos
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
it is the position of the leftmost pointer that must be deleted (together with
|
||||||
|
its corresponding key to the left of the pointer)
|
||||||
|
as a result of the previous level's balancing.
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
reiserfs_bh_t * tbSh = REISERFS_PATH_UPBUFFER (tb->tb_path, h);
|
||||||
|
reiserfs_bufinfo_t bi;
|
||||||
|
|
||||||
|
/* we return this: it is 0 if there is no S[h],
|
||||||
|
else it is tb->S[h]->b_item_order */
|
||||||
|
int order;
|
||||||
|
|
||||||
|
int insert_num, n, k;
|
||||||
|
reiserfs_bh_t * S_new;
|
||||||
|
reiserfs_ih_t new_insert_key;
|
||||||
|
reiserfs_bh_t * new_insert_ptr = NULL;
|
||||||
|
reiserfs_ih_t * new_insert_key_addr = insert_key;
|
||||||
|
|
||||||
|
order = ( tbSh ) ? REISERFS_PATH_UPPOS (tb->tb_path, h + 1)
|
||||||
|
/*tb->S[h]->b_item_order*/ : 0;
|
||||||
|
|
||||||
|
/* Using insert_size[h] calculate the number insert_num of items
|
||||||
|
that must be inserted to or deleted from S[h]. */
|
||||||
|
insert_num = tb->insert_size[h]/((int)(REISERFS_KEY_SIZE + REISERFS_DC_SIZE));
|
||||||
|
|
||||||
|
/* Check whether insert_num is proper **/
|
||||||
|
/* Make balance in case insert_num < 0 */
|
||||||
|
if ( insert_num < 0 ) {
|
||||||
|
reiserfs_ib_balance_delete (tb, h, child_pos);
|
||||||
|
return order;
|
||||||
|
}
|
||||||
|
|
||||||
|
k = 0;
|
||||||
|
if ( tb->lnum[h] > 0 ) {
|
||||||
|
/* shift lnum[h] items from S[h] to the left neighbor L[h]. check
|
||||||
|
how many of new items fall into L[h] or CFL[h] after shifting */
|
||||||
|
|
||||||
|
/* number of items in L[h] */
|
||||||
|
n = reiserfs_nh_get_items (NODE_HEAD(tb->L[h]));
|
||||||
|
if ( tb->lnum[h] <= child_pos ) {
|
||||||
|
/* new items don't fall into L[h] or CFL[h] */
|
||||||
|
reiserfs_ib_shift_left (INTERNAL_SHIFT_FROM_S_TO_L,
|
||||||
|
tb, h, tb->lnum[h]);
|
||||||
|
child_pos -= tb->lnum[h];
|
||||||
|
} else if ( tb->lnum[h] > child_pos + insert_num ) {
|
||||||
|
/* all new items fall into L[h] */
|
||||||
|
reiserfs_ib_shift_left (INTERNAL_SHIFT_FROM_S_TO_L,
|
||||||
|
tb, h, tb->lnum[h] - insert_num);
|
||||||
|
|
||||||
|
/* insert insert_num keys and node-pointers into L[h] */
|
||||||
|
bi.bi_bh = tb->L[h];
|
||||||
|
bi.bi_parent = tb->FL[h];
|
||||||
|
bi.bi_position = reiserfs_tb_lpos (tb, h);
|
||||||
|
reiserfs_ib_insert (tb->tb_fs, &bi,
|
||||||
|
/*tb->L[h], tb->S[h-1]->b_next*/
|
||||||
|
n + child_pos + 1,
|
||||||
|
insert_num,insert_key,insert_ptr);
|
||||||
|
|
||||||
|
insert_num = 0;
|
||||||
|
} else {
|
||||||
|
reiserfs_dc_t * dc;
|
||||||
|
|
||||||
|
/* some items fall into L[h] or CFL[h], but some don't fall */
|
||||||
|
reiserfs_ib_shift1_left (tb, h, child_pos + 1);
|
||||||
|
/* calculate number of new items that fall into L[h] */
|
||||||
|
k = tb->lnum[h] - child_pos - 1;
|
||||||
|
|
||||||
|
bi.bi_bh = tb->L[h];
|
||||||
|
bi.bi_parent = tb->FL[h];
|
||||||
|
bi.bi_position = reiserfs_tb_lpos (tb, h);
|
||||||
|
reiserfs_ib_insert (tb->tb_fs, &bi,
|
||||||
|
/*tb->L[h], tb->S[h-1]->b_next,*/
|
||||||
|
n + child_pos + 1,k,
|
||||||
|
insert_key,insert_ptr);
|
||||||
|
|
||||||
|
reiserfs_ib_set_lkey(tb, h, insert_key + k);
|
||||||
|
|
||||||
|
/* replace the first node-ptr in S[h] by
|
||||||
|
node-ptr to insert_ptr[k] */
|
||||||
|
dc = reiserfs_int_at(tbSh, 0);
|
||||||
|
|
||||||
|
reiserfs_dc_init(dc, REISERFS_NODE_SPACE(insert_ptr[k]->b_size) -
|
||||||
|
reiserfs_nh_get_free (NODE_HEAD(insert_ptr[k])),
|
||||||
|
insert_ptr[k]->b_blocknr);
|
||||||
|
/* reiserfs_dc_set_size (dc, REISERFS_NODE_SPACE(insert_ptr[k]->b_size) -
|
||||||
|
reiserfs_nh_get_free (NODE_HEAD(insert_ptr[k])));
|
||||||
|
reiserfs_dc_set_nr (dc, insert_ptr[k]->b_blocknr); */
|
||||||
|
reiserfs_buffer_mkdirty (tbSh);
|
||||||
|
|
||||||
|
k++;
|
||||||
|
insert_key += k;
|
||||||
|
insert_ptr += k;
|
||||||
|
insert_num -= k;
|
||||||
|
child_pos = 0;
|
||||||
|
}
|
||||||
|
} /* tb->lnum[h] > 0 */
|
||||||
|
|
||||||
|
if ( tb->rnum[h] > 0 ) {
|
||||||
|
/*shift rnum[h] items from S[h] to the right neighbor R[h]*/
|
||||||
|
/* check how many of new items fall into R or CFR after shifting */
|
||||||
|
n = reiserfs_nh_get_items (NODE_HEAD (tbSh)); /* number of items in S[h] */
|
||||||
|
if ( n - tb->rnum[h] >= child_pos )
|
||||||
|
/* new items fall into S[h] */
|
||||||
|
/*reiserfs_ib_shift_right(tb,h,tbSh,tb->CFR[h],
|
||||||
|
tb->rkey[h],tb->R[h], tb->rnum[h]);*/
|
||||||
|
reiserfs_ib_shift_right (INTERNAL_SHIFT_FROM_S_TO_R,
|
||||||
|
tb, h, tb->rnum[h]);
|
||||||
|
else
|
||||||
|
if ( n + insert_num - tb->rnum[h] < child_pos ) {
|
||||||
|
/* all new items fall into R[h] */
|
||||||
|
reiserfs_ib_shift_right (INTERNAL_SHIFT_FROM_S_TO_R,
|
||||||
|
tb, h, tb->rnum[h] - insert_num);
|
||||||
|
|
||||||
|
/* insert insert_num keys and node-pointers into R[h] */
|
||||||
|
bi.bi_bh = tb->R[h];
|
||||||
|
bi.bi_parent = tb->FR[h];
|
||||||
|
bi.bi_position = reiserfs_tb_rpos (tb, h);
|
||||||
|
reiserfs_ib_insert (tb->tb_fs, &bi,
|
||||||
|
/*tb->R[h],tb->S[h-1]->b_next*/
|
||||||
|
child_pos - n - insert_num +
|
||||||
|
tb->rnum[h] - 1, insert_num,
|
||||||
|
insert_key,insert_ptr);
|
||||||
|
insert_num = 0;
|
||||||
|
} else {
|
||||||
|
reiserfs_dc_t * dc;
|
||||||
|
|
||||||
|
/* one of the items falls into CFR[h] */
|
||||||
|
reiserfs_ib_shift1_right(tb, h, n - child_pos + 1);
|
||||||
|
/* calculate number of new items that fall into R[h] */
|
||||||
|
k = tb->rnum[h] - n + child_pos - 1;
|
||||||
|
|
||||||
|
bi.bi_bh = tb->R[h];
|
||||||
|
bi.bi_parent = tb->FR[h];
|
||||||
|
bi.bi_position = reiserfs_tb_rpos (tb, h);
|
||||||
|
reiserfs_ib_insert (tb->tb_fs, &bi,
|
||||||
|
/*tb->R[h], tb->R[h]->b_child,*/ 0,
|
||||||
|
k, insert_key + 1, insert_ptr + 1);
|
||||||
|
|
||||||
|
reiserfs_ib_set_rkey(tb, h, insert_key +
|
||||||
|
insert_num - k - 1);
|
||||||
|
|
||||||
|
/* replace the first node-ptr in R[h] by node-ptr
|
||||||
|
insert_ptr[insert_num-k-1]*/
|
||||||
|
dc = reiserfs_int_at(tb->R[h], 0);
|
||||||
|
reiserfs_dc_init(dc, REISERFS_NODE_SPACE(
|
||||||
|
insert_ptr[insert_num-k-1]->b_size) -
|
||||||
|
reiserfs_nh_get_free(NODE_HEAD(insert_ptr[insert_num-k-1])),
|
||||||
|
insert_ptr[insert_num-k-1]->b_blocknr);
|
||||||
|
/*
|
||||||
|
reiserfs_dc_set_size (dc,
|
||||||
|
REISERFS_NODE_SPACE(insert_ptr[insert_num-k-1]->b_size) -
|
||||||
|
reiserfs_nh_get_free (NODE_HEAD(insert_ptr[insert_num-k-1])));
|
||||||
|
reiserfs_dc_set_nr (dc, insert_ptr[insert_num-k-1]->b_blocknr);
|
||||||
|
*/
|
||||||
|
reiserfs_buffer_mkdirty (tb->R[h]);
|
||||||
|
|
||||||
|
insert_num -= (k + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Fill new node that appears instead of S[h] **/
|
||||||
|
if ( ! tb->blknum[h] )
|
||||||
|
{ /* node S[h] is empty now */
|
||||||
|
/* Mark buffer as invalid and put it to head of free list. */
|
||||||
|
/* do not preserve, internal node*/
|
||||||
|
reiserfs_node_forget(tb->tb_fs, tbSh->b_blocknr);
|
||||||
|
return order;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! tbSh ) {
|
||||||
|
/* create new root */
|
||||||
|
reiserfs_dc_t * dc;
|
||||||
|
reiserfs_bh_t * tbSh_1 = REISERFS_PATH_UPBUFFER (tb->tb_path, h - 1);
|
||||||
|
reiserfs_sb_t * sb;
|
||||||
|
|
||||||
|
if ( tb->blknum[h] != 1 )
|
||||||
|
reiserfs_panic(0, "reiserfs_ib_balance",
|
||||||
|
"One new node required for creating the new root");
|
||||||
|
/* S[h] = empty buffer from the list FEB. */
|
||||||
|
tbSh = reiserfs_tb_FEB (tb);
|
||||||
|
reiserfs_nh_set_level (NODE_HEAD(tbSh), h + 1);
|
||||||
|
|
||||||
|
/* Put the unique node-pointer to S[h] that points to S[h-1]. */
|
||||||
|
|
||||||
|
dc = reiserfs_int_at(tbSh, 0);
|
||||||
|
|
||||||
|
reiserfs_dc_init(dc, REISERFS_NODE_SPACE (tbSh_1->b_size) -
|
||||||
|
reiserfs_nh_get_free (NODE_HEAD(tbSh_1)),
|
||||||
|
tbSh_1->b_blocknr);
|
||||||
|
/*
|
||||||
|
reiserfs_dc_set_size (dc, REISERFS_NODE_SPACE (tbSh_1->b_size) -
|
||||||
|
reiserfs_nh_get_free (NODE_HEAD(tbSh_1)));
|
||||||
|
reiserfs_dc_set_nr (dc, tbSh_1->b_blocknr); */
|
||||||
|
tb->insert_size[h] -= REISERFS_DC_SIZE;
|
||||||
|
reiserfs_nh_set_free (NODE_HEAD(tbSh),
|
||||||
|
reiserfs_nh_get_free (NODE_HEAD(tbSh)) -
|
||||||
|
REISERFS_DC_SIZE);
|
||||||
|
|
||||||
|
reiserfs_buffer_mkdirty (tbSh);
|
||||||
|
|
||||||
|
/* put new root into path structure */
|
||||||
|
REISERFS_PATH_BUFFER(tb->tb_path, REISERFS_PATH_OFFILL) = tbSh;
|
||||||
|
|
||||||
|
/* Change root in structure super block. */
|
||||||
|
sb = tb->tb_fs->fs_ondisk_sb;
|
||||||
|
reiserfs_sb_set_root (sb, tbSh->b_blocknr);
|
||||||
|
reiserfs_sb_set_height (sb, reiserfs_sb_get_height (sb) + 1);
|
||||||
|
|
||||||
|
reiserfs_buffer_mkdirty (tb->tb_fs->fs_super_bh);
|
||||||
|
tb->tb_fs->fs_dirt = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( tb->blknum[h] == 2 ) {
|
||||||
|
int snum;
|
||||||
|
reiserfs_bufinfo_t dest_bi, src_bi;
|
||||||
|
|
||||||
|
|
||||||
|
/* S_new = free buffer from list FEB */
|
||||||
|
S_new = reiserfs_tb_FEB(tb);
|
||||||
|
|
||||||
|
reiserfs_nh_set_level (NODE_HEAD(S_new), h + 1);
|
||||||
|
|
||||||
|
dest_bi.bi_bh = S_new;
|
||||||
|
dest_bi.bi_parent = 0;
|
||||||
|
dest_bi.bi_position = 0;
|
||||||
|
src_bi.bi_bh = tbSh;
|
||||||
|
src_bi.bi_parent = REISERFS_PATH_UPPARENT (tb->tb_path, h);
|
||||||
|
src_bi.bi_position = REISERFS_PATH_UPPOS (tb->tb_path, h + 1);
|
||||||
|
|
||||||
|
n = reiserfs_nh_get_items (NODE_HEAD(tbSh)); /* number of items in S[h] */
|
||||||
|
snum = (insert_num + n + 1)/2;
|
||||||
|
if ( n - snum >= child_pos ) {
|
||||||
|
/* new items don't fall into S_new */
|
||||||
|
/* store the delimiting key for the next level */
|
||||||
|
/* new_insert_key = (n - snum)'th key in S[h] */
|
||||||
|
memcpy (&new_insert_key,reiserfs_int_key_at(tbSh,n - snum),
|
||||||
|
REISERFS_KEY_SIZE);
|
||||||
|
/* last parameter is del_par */
|
||||||
|
reiserfs_ib_move (tb->tb_fs, &dest_bi, &src_bi,
|
||||||
|
LAST_TO_FIRST, snum, 0);
|
||||||
|
} else if ( n + insert_num - snum < child_pos ) {
|
||||||
|
/* all new items fall into S_new */
|
||||||
|
/* store the delimiting key for the next level */
|
||||||
|
/* new_insert_key = (n + insert_item - snum)'th key in S[h] */
|
||||||
|
memcpy(&new_insert_key,reiserfs_int_key_at(tbSh,n + insert_num - snum),
|
||||||
|
REISERFS_KEY_SIZE);
|
||||||
|
/* last parameter is del_par */
|
||||||
|
reiserfs_ib_move (tb->tb_fs, &dest_bi, &src_bi,
|
||||||
|
LAST_TO_FIRST, snum - insert_num, 0);
|
||||||
|
|
||||||
|
/* reiserfs_ib_move(S_new,tbSh,1,snum - insert_num,0);*/
|
||||||
|
|
||||||
|
/* insert insert_num keys and node-pointers into S_new */
|
||||||
|
reiserfs_ib_insert (tb->tb_fs, &dest_bi,
|
||||||
|
/*S_new,tb->S[h-1]->b_next,*/
|
||||||
|
child_pos - n - insert_num + snum - 1,
|
||||||
|
insert_num,insert_key,insert_ptr);
|
||||||
|
insert_num = 0;
|
||||||
|
} else {
|
||||||
|
reiserfs_dc_t * dc;
|
||||||
|
|
||||||
|
/* some items fall into S_new, but some don't fall */
|
||||||
|
/* last parameter is del_par */
|
||||||
|
reiserfs_ib_move (tb->tb_fs, &dest_bi, &src_bi,
|
||||||
|
LAST_TO_FIRST, n - child_pos + 1, 1);
|
||||||
|
/* reiserfs_ib_move(S_new,tbSh,1,n - child_pos + 1,1);*/
|
||||||
|
/* calculate number of new items that fall into S_new */
|
||||||
|
k = snum - n + child_pos - 1;
|
||||||
|
|
||||||
|
reiserfs_ib_insert (tb->tb_fs, &dest_bi,
|
||||||
|
/*S_new,*/ 0, k, insert_key + 1,
|
||||||
|
insert_ptr+1);
|
||||||
|
|
||||||
|
/* new_insert_key = insert_key[insert_num - k - 1] */
|
||||||
|
memcpy(&new_insert_key,insert_key + insert_num - k - 1, REISERFS_KEY_SIZE);
|
||||||
|
/* replace first node-ptr in S_new by node-ptr to
|
||||||
|
insert_ptr[insert_num-k-1] */
|
||||||
|
|
||||||
|
dc = reiserfs_int_at(S_new,0);
|
||||||
|
reiserfs_dc_init(dc, REISERFS_NODE_SPACE(
|
||||||
|
insert_ptr[insert_num-k-1]->b_size) -
|
||||||
|
reiserfs_nh_get_free (NODE_HEAD(insert_ptr[insert_num-k-1])),
|
||||||
|
insert_ptr[insert_num-k-1]->b_blocknr);
|
||||||
|
/*
|
||||||
|
reiserfs_dc_set_size (dc, REISERFS_NODE_SPACE(insert_ptr[insert_num-k-1]->b_size) -
|
||||||
|
reiserfs_nh_get_free (NODE_HEAD(insert_ptr[insert_num-k-1])));
|
||||||
|
reiserfs_dc_set_nr (dc, insert_ptr[insert_num-k-1]->b_blocknr);
|
||||||
|
*/
|
||||||
|
reiserfs_buffer_mkdirty (S_new);
|
||||||
|
|
||||||
|
insert_num -= (k + 1);
|
||||||
|
}
|
||||||
|
/* new_insert_ptr = node_pointer to S_new */
|
||||||
|
new_insert_ptr = S_new;
|
||||||
|
|
||||||
|
// S_new->b_count --;
|
||||||
|
}
|
||||||
|
|
||||||
|
n = reiserfs_nh_get_items (NODE_HEAD(tbSh)); /*number of items in S[h] */
|
||||||
|
|
||||||
|
if ( -1 <= child_pos && child_pos <= n && insert_num > 0 ) {
|
||||||
|
bi.bi_bh = tbSh;
|
||||||
|
bi.bi_parent = REISERFS_PATH_UPPARENT (tb->tb_path, h);
|
||||||
|
bi.bi_position = REISERFS_PATH_UPPOS (tb->tb_path, h + 1);
|
||||||
|
if (child_pos == -1) {
|
||||||
|
/* this is a little different from original do_balance:
|
||||||
|
here we insert the minimal keys in the tree, that has never
|
||||||
|
happened when file system works */
|
||||||
|
if (tb->CFL[h-1] || insert_num != 1 || h != 1)
|
||||||
|
misc_die ("reiserfs_ib_balance: invalid child_pos");
|
||||||
|
/* insert_child (tb->S[h], tb->S[h-1], child_pos, insert_num,
|
||||||
|
B_N_ITEM_HEAD(tb->S[0],0), insert_ptr);*/
|
||||||
|
reiserfs_ib_insert (tb->tb_fs, &bi, child_pos, insert_num,
|
||||||
|
reiserfs_ih_at(REISERFS_PATH_LEAF (tb->tb_path), 0),
|
||||||
|
insert_ptr);
|
||||||
|
} else
|
||||||
|
reiserfs_ib_insert (tb->tb_fs, &bi, child_pos,insert_num,
|
||||||
|
insert_key,insert_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy (new_insert_key_addr,&new_insert_key,REISERFS_KEY_SIZE);
|
||||||
|
insert_ptr[0] = new_insert_ptr;
|
||||||
|
|
||||||
|
return order;
|
||||||
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,273 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "reiserfs/libreiserfs.h"
|
||||||
|
#include "misc/unaligned.h"
|
||||||
|
|
||||||
|
const reiserfs_key_t root_dir_key =
|
||||||
|
{cpu_to_le32(REISERFS_ROOT_PARENT_OBJECTID),
|
||||||
|
cpu_to_le32(REISERFS_ROOT_OBJECTID),
|
||||||
|
{{0, 0},}};
|
||||||
|
|
||||||
|
const reiserfs_key_t parent_root_dir_key = {
|
||||||
|
0, cpu_to_le32(REISERFS_ROOT_PARENT_OBJECTID),
|
||||||
|
{{0, 0},}};
|
||||||
|
|
||||||
|
reiserfs_key_t lost_found_dir_key =
|
||||||
|
{0, 0, {{0, 0}, }};
|
||||||
|
|
||||||
|
/* Minimal possible key. It is never in the tree. */
|
||||||
|
const reiserfs_key_t MIN_KEY = {0, 0, {{0, 0},}};
|
||||||
|
|
||||||
|
/* Maximal possible key. It is never in the tree. */
|
||||||
|
const reiserfs_key_t MAX_KEY =
|
||||||
|
{0xffffffff, 0xffffffff,
|
||||||
|
{{0xffffffff, 0xffffffff},}};
|
||||||
|
|
||||||
|
void reiserfs_key_copy (reiserfs_key_t * to, const reiserfs_key_t * from) {
|
||||||
|
memcpy (to, from, REISERFS_KEY_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void reiserfs_key_copy2 (reiserfs_key_t * to, const reiserfs_key_t * from) {
|
||||||
|
memcpy (to, from, REISERFS_KEY_SHSIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
|
# define get_key_offset_v2(key) (__u64)((key->u.k2_offset_v2.k_offset))
|
||||||
|
# define set_key_offset_v2(key,val) (void)(key->u.k2_offset_v2.k_offset = (val))
|
||||||
|
# define get_key_type_v2(key) (__u16)((key->u.k2_offset_v2.k_type))
|
||||||
|
# define set_key_type_v2(key,val) (void)(key->u.k2_offset_v2.k_type = (val))
|
||||||
|
#elif __BYTE_ORDER == __BIG_ENDIAN
|
||||||
|
typedef union {
|
||||||
|
struct offset_v2 offset_v2;
|
||||||
|
__u64 linear;
|
||||||
|
} __attribute__ ((__packed__)) offset_v2_esafe_overlay;
|
||||||
|
|
||||||
|
static inline __u64 get_key_offset_v2 (const reiserfs_key_t *key)
|
||||||
|
{
|
||||||
|
offset_v2_esafe_overlay tmp =
|
||||||
|
*(offset_v2_esafe_overlay *) (&(key->u.k2_offset_v2));
|
||||||
|
tmp.linear = le64_to_cpu( tmp.linear );
|
||||||
|
return tmp.offset_v2.k_offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline __u32 get_key_type_v2 (const reiserfs_key_t *key)
|
||||||
|
{
|
||||||
|
offset_v2_esafe_overlay tmp =
|
||||||
|
*(offset_v2_esafe_overlay *) (&(key->u.k2_offset_v2));
|
||||||
|
tmp.linear = le64_to_cpu( tmp.linear );
|
||||||
|
return tmp.offset_v2.k_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void set_key_offset_v2 (reiserfs_key_t *key, __u64 offset)
|
||||||
|
{
|
||||||
|
offset_v2_esafe_overlay *tmp =
|
||||||
|
(offset_v2_esafe_overlay *)(&(key->u.k2_offset_v2));
|
||||||
|
tmp->linear = le64_to_cpu(tmp->linear);
|
||||||
|
tmp->offset_v2.k_offset = offset;
|
||||||
|
tmp->linear = cpu_to_le64(tmp->linear);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void set_key_type_v2 (reiserfs_key_t *key, __u32 type)
|
||||||
|
{
|
||||||
|
offset_v2_esafe_overlay *tmp =
|
||||||
|
(offset_v2_esafe_overlay *)(&(key->u.k2_offset_v2));
|
||||||
|
if (type > 15)
|
||||||
|
reiserfs_panic ("set_key_type_v2: type is too big %d", type);
|
||||||
|
|
||||||
|
tmp->linear = le64_to_cpu(tmp->linear);
|
||||||
|
tmp->offset_v2.k_type = type;
|
||||||
|
tmp->linear = cpu_to_le64(tmp->linear);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# error "nuxi/pdp-endian archs are not supported"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline int is_key_format_1 (int type) {
|
||||||
|
return ( (type == 0 || type == 15) ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* old keys (on i386) have k_offset_v2.k_type == 15 (direct and
|
||||||
|
extent) or == 0 (dir items and stat data) */
|
||||||
|
|
||||||
|
/* */
|
||||||
|
int reiserfs_key_format (const reiserfs_key_t * key)
|
||||||
|
{
|
||||||
|
int type;
|
||||||
|
|
||||||
|
type = get_key_type_v2 (key);
|
||||||
|
|
||||||
|
if (is_key_format_1 (type))
|
||||||
|
return KEY_FORMAT_1;
|
||||||
|
|
||||||
|
return KEY_FORMAT_2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned long long reiserfs_key_get_off (const reiserfs_key_t * key) {
|
||||||
|
if (reiserfs_key_format (key) == KEY_FORMAT_1)
|
||||||
|
return reiserfs_key_get_off1 (key);
|
||||||
|
|
||||||
|
return get_key_offset_v2 (key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int uniqueness2type (__u32 uniqueness) {
|
||||||
|
switch (uniqueness) {
|
||||||
|
case UNI_SD: return TYPE_STAT_DATA;
|
||||||
|
case UNI_EXT: return TYPE_EXTENT;
|
||||||
|
case UNI_DIRECT: return TYPE_DIRECT;
|
||||||
|
case UNI_DE: return TYPE_DIRENTRY;
|
||||||
|
}
|
||||||
|
return TYPE_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static __u32 type2uniqueness (int type) {
|
||||||
|
switch (type) {
|
||||||
|
case TYPE_STAT_DATA: return UNI_SD;
|
||||||
|
case TYPE_EXTENT: return UNI_EXT;
|
||||||
|
case TYPE_DIRECT: return UNI_DIRECT;
|
||||||
|
case TYPE_DIRENTRY: return UNI_DE;
|
||||||
|
}
|
||||||
|
return UNI_UNKN;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int reiserfs_key_get_type (const reiserfs_key_t * key)
|
||||||
|
{
|
||||||
|
int type_v2 = get_key_type_v2 (key);
|
||||||
|
|
||||||
|
if (is_key_format_1 (type_v2))
|
||||||
|
return uniqueness2type (reiserfs_key_get_uni (key));
|
||||||
|
|
||||||
|
return type_v2;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *key_type_name[TYPE_UNKNOWN + 1] = {
|
||||||
|
[TYPE_STAT_DATA] = "SD",
|
||||||
|
[TYPE_EXTENT] = "EXT",
|
||||||
|
[TYPE_DIRECT] = "DRCT",
|
||||||
|
[TYPE_DIRENTRY] = "DIR",
|
||||||
|
[TYPE_UNKNOWN] = "???"
|
||||||
|
};
|
||||||
|
|
||||||
|
char * reiserfs_key_name (const reiserfs_key_t * key)
|
||||||
|
{
|
||||||
|
__u32 type = reiserfs_key_get_type (key);
|
||||||
|
return key_type_name[type <= TYPE_DIRENTRY ? type : TYPE_UNKNOWN];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* this sets key format as well as type of item key belongs to */
|
||||||
|
void reiserfs_key_set_type (int format, reiserfs_key_t * key, int type)
|
||||||
|
{
|
||||||
|
if (format == KEY_FORMAT_1)
|
||||||
|
reiserfs_key_set_uni (key, type2uniqueness (type));
|
||||||
|
else
|
||||||
|
set_key_type_v2 (key, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void reiserfs_key_set_off (int format, reiserfs_key_t * key,
|
||||||
|
unsigned long long offset)
|
||||||
|
{
|
||||||
|
if (format == KEY_FORMAT_1)
|
||||||
|
reiserfs_key_set_off1 (key, offset);
|
||||||
|
else
|
||||||
|
set_key_offset_v2 (key, offset);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set secondary fields. */
|
||||||
|
void reiserfs_key_set_sec (int format, reiserfs_key_t * key,
|
||||||
|
unsigned long long offset, int type)
|
||||||
|
{
|
||||||
|
reiserfs_key_set_type (format, key, type);
|
||||||
|
reiserfs_key_set_off (format, key, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Compare keys using REISERFS_KEY_SHORT_LEN fields.
|
||||||
|
Returns: -1 if key1 < key2
|
||||||
|
0 if key1 = key2
|
||||||
|
1 if key1 > key2
|
||||||
|
*/
|
||||||
|
|
||||||
|
int reiserfs_key_comp2 (const void * k1, const void * k2)
|
||||||
|
{
|
||||||
|
int n_key_length = REISERFS_KEY_SHORT_LEN;
|
||||||
|
__u32 * p_s_key1 = (__u32 *)k1;
|
||||||
|
__u32 * p_s_key2 = (__u32 *)k2;
|
||||||
|
__u32 u1, u2;
|
||||||
|
|
||||||
|
for( ; n_key_length--; ++p_s_key1, ++p_s_key2 ) {
|
||||||
|
u1 = d32_get(p_s_key1, 0) ;
|
||||||
|
u2 = d32_get(p_s_key2, 0) ;
|
||||||
|
if ( u1 < u2 )
|
||||||
|
return -1;
|
||||||
|
if ( u1 > u2 )
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int reiserfs_key_comp3 (const void * p1, const void * p2)
|
||||||
|
{
|
||||||
|
int retval;
|
||||||
|
const reiserfs_key_t * k1 = p1;
|
||||||
|
const reiserfs_key_t * k2 = p2;
|
||||||
|
unsigned long long off1, off2;
|
||||||
|
|
||||||
|
retval = reiserfs_key_comp2 (k1, k2);
|
||||||
|
if (retval)
|
||||||
|
return retval;
|
||||||
|
off1 = reiserfs_key_get_off(k1) ;
|
||||||
|
off2 = reiserfs_key_get_off(k2) ;
|
||||||
|
if (off1 < off2)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (off1 > off2)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Compare keys using all 4 key fields.
|
||||||
|
Returns: -1 if key1 < key2
|
||||||
|
0 if key1 = key2
|
||||||
|
1 if key1 > key2
|
||||||
|
*/
|
||||||
|
int reiserfs_key_comp (const void * p1, const void * p2)
|
||||||
|
{
|
||||||
|
int retval;
|
||||||
|
const reiserfs_key_t * k1 = p1;
|
||||||
|
const reiserfs_key_t * k2 = p2;
|
||||||
|
__u32 u1, u2;
|
||||||
|
|
||||||
|
retval = reiserfs_key_comp3 (k1, k2);
|
||||||
|
if (retval)
|
||||||
|
return retval;
|
||||||
|
|
||||||
|
u1 = reiserfs_key_get_type (k1);
|
||||||
|
u2 = reiserfs_key_get_type (k2);
|
||||||
|
|
||||||
|
if (u1 < u2)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (u1 > u2)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,373 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||||
|
* reiserfsprogs/README
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "reiserfs/libreiserfs.h"
|
||||||
|
#include "misc/bitops.h"
|
||||||
|
|
||||||
|
void reiserfs_leaf_mkempty (reiserfs_bh_t * bh)
|
||||||
|
{
|
||||||
|
reiserfs_nh_set_items (NODE_HEAD (bh), 0);
|
||||||
|
reiserfs_nh_set_free (NODE_HEAD (bh), REISERFS_NODE_SPACE (bh->b_size));
|
||||||
|
reiserfs_nh_set_level (NODE_HEAD (bh), LEAF_LEVEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
__u32 reiserfs_leaf_ibytes (const reiserfs_ih_t * ih, int blocksize) {
|
||||||
|
switch (reiserfs_key_get_type (&ih->ih_key)) {
|
||||||
|
case TYPE_DIRECT:
|
||||||
|
return reiserfs_ih_get_len (ih);
|
||||||
|
case TYPE_EXTENT:
|
||||||
|
return reiserfs_ext_count(ih) * blocksize;// - reiserfs_ih_get_free (ih);
|
||||||
|
case TYPE_STAT_DATA:
|
||||||
|
case TYPE_DIRENTRY:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
reiserfs_warning (stderr, "reiserfs_leaf_ibytes: called for wrong "
|
||||||
|
"type of item %h", ih);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int reiserfs_leaf_mergeable (reiserfs_ih_t * left,
|
||||||
|
reiserfs_ih_t * right,
|
||||||
|
int bsize)
|
||||||
|
{
|
||||||
|
if (reiserfs_key_comp (&left->ih_key, &right->ih_key) != -1) {
|
||||||
|
reiserfs_panic ("vs-16070: reiserfs_leaf_mergeable: left %k, "
|
||||||
|
"right %k", &(left->ih_key), &(right->ih_key));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reiserfs_key_comp2 (&left->ih_key, &right->ih_key))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (reiserfs_key_get_type (&left->ih_key) !=
|
||||||
|
reiserfs_key_get_type (&right->ih_key))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Directories are always mergeable. If fsck will need to handle dir items
|
||||||
|
separaely too, move it lower. */
|
||||||
|
if (reiserfs_ih_dir (left))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* Merge only items with the same flags. */
|
||||||
|
if (reiserfs_ih_get_flags(left) != reiserfs_ih_get_flags(right))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if ((reiserfs_ih_direct (left) || reiserfs_ih_ext (left))) {
|
||||||
|
return (reiserfs_key_get_off (&left->ih_key) +
|
||||||
|
reiserfs_leaf_ibytes (left, bsize) ==
|
||||||
|
reiserfs_key_get_off (&right->ih_key)) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int reiserfs_leaf_count_items(reiserfs_bh_t *bh) {
|
||||||
|
reiserfs_ih_t * ih;
|
||||||
|
int prev_location;
|
||||||
|
int nr;
|
||||||
|
|
||||||
|
/* look at the table of item head */
|
||||||
|
prev_location = bh->b_size;
|
||||||
|
ih = reiserfs_ih_at(bh, 0);
|
||||||
|
nr = 0;
|
||||||
|
while (1) {
|
||||||
|
if (reiserfs_ih_get_loc (ih) + reiserfs_ih_get_len (ih) != prev_location)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (reiserfs_ih_get_loc (ih) <
|
||||||
|
REISERFS_IH_SIZE * (nr + 1) + REISERFS_NODEH_SIZE)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reiserfs_ih_get_len (ih) > REISERFS_ITEM_MAX (bh->b_size))
|
||||||
|
break;
|
||||||
|
|
||||||
|
prev_location = reiserfs_ih_get_loc (ih);
|
||||||
|
ih ++;
|
||||||
|
nr ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nr;
|
||||||
|
}
|
||||||
|
|
||||||
|
int reiserfs_leaf_free_count(reiserfs_bh_t *bh) {
|
||||||
|
reiserfs_ih_t * ih;
|
||||||
|
int nr;
|
||||||
|
|
||||||
|
nr = reiserfs_nh_get_items(NODE_HEAD(bh));
|
||||||
|
ih = reiserfs_ih_at(bh, nr - 1);
|
||||||
|
|
||||||
|
return (nr ? reiserfs_ih_get_loc (ih) : bh->b_size) -
|
||||||
|
REISERFS_NODEH_SIZE - REISERFS_IH_SIZE * nr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int leaf_blkh_correct(reiserfs_bh_t * bh) {
|
||||||
|
unsigned int nr;
|
||||||
|
|
||||||
|
nr = reiserfs_nh_get_items(NODE_HEAD(bh));
|
||||||
|
if (nr > ((bh->b_size - REISERFS_NODEH_SIZE) /
|
||||||
|
(REISERFS_IH_SIZE + REISERFS_ITEM_MIN)))
|
||||||
|
{
|
||||||
|
/* item number is too big or too small */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return reiserfs_leaf_free_count(bh) ==
|
||||||
|
reiserfs_nh_get_free (NODE_HEAD(bh));
|
||||||
|
}
|
||||||
|
|
||||||
|
int reiserfs_leaf_estimate_items(reiserfs_bh_t * bh) {
|
||||||
|
int nr = reiserfs_leaf_count_items(bh);
|
||||||
|
|
||||||
|
return nr >= reiserfs_nh_get_items (NODE_HEAD(bh)) ?
|
||||||
|
reiserfs_nh_get_items (NODE_HEAD(bh)) : nr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* for every item call common action and an action corresponding to
|
||||||
|
item type */
|
||||||
|
void reiserfs_leaf_traverse(reiserfs_bh_t * bh,
|
||||||
|
ih_func_t action,
|
||||||
|
item_func_t * actions)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
reiserfs_ih_t * ih;
|
||||||
|
item_func_t iaction;
|
||||||
|
|
||||||
|
ih = reiserfs_ih_at (bh, 0);
|
||||||
|
for (i = 0; i < reiserfs_nh_get_items (NODE_HEAD (bh)); i ++, ih ++) {
|
||||||
|
if (action)
|
||||||
|
action (ih);
|
||||||
|
|
||||||
|
iaction = actions[reiserfs_key_get_type (&ih->ih_key)];
|
||||||
|
if (iaction)
|
||||||
|
iaction (bh, ih);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Returns 0 if not leaf, NT_LEAF if looks correct, NT_IH_ARRAY if
|
||||||
|
looks like corrupted leaf. */
|
||||||
|
int reiserfs_leaf_valid(reiserfs_bh_t *bh) {
|
||||||
|
int counted;
|
||||||
|
int num;
|
||||||
|
|
||||||
|
if (!reiserfs_leaf_head (bh))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
counted = reiserfs_leaf_count_items(bh);
|
||||||
|
|
||||||
|
/* if leaf block header is ok, check item count also. */
|
||||||
|
if (leaf_blkh_correct(bh)) {
|
||||||
|
num = reiserfs_nh_get_items (NODE_HEAD(bh));
|
||||||
|
return counted >= num ? NT_LEAF : NT_IH_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* leaf block header is corrupted, it is ih_array if
|
||||||
|
some items were detected.*/
|
||||||
|
return counted ? NT_IH_ARRAY : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* wrappers for operations on one separated leaf */
|
||||||
|
void reiserfs_leaf_delete_item (reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_bh_t * bh,
|
||||||
|
int item_num)
|
||||||
|
{
|
||||||
|
reiserfs_bufinfo_t bi;
|
||||||
|
|
||||||
|
bi.bi_bh = bh;
|
||||||
|
bi.bi_parent = 0;
|
||||||
|
bi.bi_position = 0;
|
||||||
|
reiserfs_lb_delete_item (fs, &bi, item_num, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void reiserfs_leaf_delete_entry (reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_bh_t * bh,
|
||||||
|
int item_num,
|
||||||
|
int entry_num,
|
||||||
|
int del_count)
|
||||||
|
{
|
||||||
|
reiserfs_bufinfo_t bi;
|
||||||
|
|
||||||
|
bi.bi_bh = bh;
|
||||||
|
bi.bi_parent = 0;
|
||||||
|
bi.bi_position = 0;
|
||||||
|
reiserfs_lb_delete_unit (fs, &bi, item_num, entry_num, del_count);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ih_key, ih_location and ih_item_len seem correct, check other fields */
|
||||||
|
static int reiserfs_leaf_ih_correct (reiserfs_ih_t * ih) {
|
||||||
|
int ih_format;
|
||||||
|
int format;
|
||||||
|
|
||||||
|
/* key format from item_head */
|
||||||
|
ih_format = reiserfs_ih_get_format (ih);
|
||||||
|
if (ih_format != KEY_FORMAT_1 && ih_format != KEY_FORMAT_2)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* key format calculated on key */
|
||||||
|
format = reiserfs_key_format (&ih->ih_key);
|
||||||
|
if (reiserfs_ih_stat (ih)) {
|
||||||
|
/* for stat data we can not find key format from a key itself, so look at
|
||||||
|
the item length */
|
||||||
|
if (reiserfs_ih_get_len (ih) == REISERFS_SD_SIZE)
|
||||||
|
format = KEY_FORMAT_2;
|
||||||
|
else if (reiserfs_ih_get_len (ih) == REISERFS_SD_SIZE_V1)
|
||||||
|
format = KEY_FORMAT_1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (format != ih_format)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* we do not check ih_format.fsck_need as fsck might change it. So,
|
||||||
|
debugreiserfs -p will have to dump it */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* used by debugreisrefs -p only yet */
|
||||||
|
int reiserfs_leaf_correct_at (reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_ih_t * ih, char * item,
|
||||||
|
unfm_func_t func, int bad_dir)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
if (!does_key_look_correct (fs, &ih->ih_key))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (!reiserfs_leaf_ih_correct (ih))
|
||||||
|
return 1;
|
||||||
|
*/
|
||||||
|
if (!reiserfs_leaf_ih_correct (ih))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
|
||||||
|
if (reiserfs_ih_stat (ih) || reiserfs_ih_direct (ih))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (reiserfs_ih_dir (ih)) {
|
||||||
|
return reiserfs_direntry_check (fs, ih, item, bad_dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reiserfs_ih_ext (ih)) {
|
||||||
|
return reiserfs_ext_check (fs, ih, item, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int is_symlink = 0;
|
||||||
|
int reiserfs_leaf_print(FILE * fp,
|
||||||
|
reiserfs_filsys_t * fs,
|
||||||
|
reiserfs_bh_t * bh,
|
||||||
|
int print_mode,
|
||||||
|
int first,
|
||||||
|
int last)
|
||||||
|
{
|
||||||
|
reiserfs_ih_t * ih;
|
||||||
|
int i;
|
||||||
|
int from, to;
|
||||||
|
int real_nr, nr;
|
||||||
|
|
||||||
|
if (!reiserfs_node_formatted (bh, LEAF_LEVEL))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
ih = reiserfs_ih_at (bh,0);
|
||||||
|
real_nr = reiserfs_leaf_count_items(bh);
|
||||||
|
nr = reiserfs_nh_get_items(NODE_HEAD(bh));
|
||||||
|
|
||||||
|
reiserfs_warning (fp, "\n==========================================="
|
||||||
|
"========================\n");
|
||||||
|
|
||||||
|
reiserfs_warning (fp, "LEAF NODE (%ld) contains %b (real items %d)\n",
|
||||||
|
bh->b_blocknr, bh, real_nr);
|
||||||
|
|
||||||
|
if (!(misc_test_bit(LP_LEAF_DETAILS, &print_mode))) {
|
||||||
|
reiserfs_warning (fp, "FIRST ITEM_KEY: %k, LAST ITEM KEY: %k\n",
|
||||||
|
&(ih->ih_key), &((ih + real_nr - 1)->ih_key));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (first < 0 || first > real_nr - 1)
|
||||||
|
from = 0;
|
||||||
|
else
|
||||||
|
from = first;
|
||||||
|
|
||||||
|
if (last < 0 || last > real_nr)
|
||||||
|
to = real_nr;
|
||||||
|
else
|
||||||
|
to = last;
|
||||||
|
|
||||||
|
|
||||||
|
reiserfs_warning (fp, "---------------------------------------------"
|
||||||
|
"----------------------------------\n"
|
||||||
|
"|###|type|ilen|f/sp| loc|fmt|fsck| "
|
||||||
|
" key |\n"
|
||||||
|
"| | | |e/cn| | |need| "
|
||||||
|
" |\n");
|
||||||
|
|
||||||
|
for (i = from; i < to; i++) {
|
||||||
|
reiserfs_warning (fp, "-----------------------------------------"
|
||||||
|
"--------------------------------------\n"
|
||||||
|
"|%3d|%30H|%s\n", i, ih + i, i >= nr ?
|
||||||
|
" DELETED" : "");
|
||||||
|
|
||||||
|
if (reiserfs_ih_stat(ih+i)) {
|
||||||
|
is_symlink = reiserfs_print_stat_data (fp, bh, ih + i, 0/*all times*/);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reiserfs_ih_dir(ih+i)) {
|
||||||
|
reiserfs_direntry_print (fp, fs, bh, ih+i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reiserfs_ih_ext(ih+i)) {
|
||||||
|
reiserfs_ext_print (fp, bh, i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reiserfs_ih_direct(ih+i)) {
|
||||||
|
int j = 0;
|
||||||
|
if (is_symlink || misc_test_bit(LP_DIRECT_ITEMS, &print_mode)) {
|
||||||
|
reiserfs_warning (fp, "\"");
|
||||||
|
while (j < reiserfs_ih_get_len (&ih[i])) {
|
||||||
|
if (reiserfs_item_by_ih(bh,ih+i)[j] == 10)
|
||||||
|
reiserfs_warning (fp, "\\n");
|
||||||
|
else
|
||||||
|
reiserfs_warning (fp, "%c", reiserfs_item_by_ih(bh,ih+i)[j]);
|
||||||
|
j ++;
|
||||||
|
}
|
||||||
|
reiserfs_warning (fp, "\"\n");
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reiserfs_warning (fp, "============================================="
|
||||||
|
"======================\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
__u16 reiserfs_ih_get_format(const reiserfs_ih_t *ih) {
|
||||||
|
return misc_get_bitfield_XX (16, &ih->ih_format, 0, 12);
|
||||||
|
}
|
||||||
|
|
||||||
|
void reiserfs_ih_set_format(reiserfs_ih_t *ih, __u16 val) {
|
||||||
|
misc_set_bitfield_XX (16, &ih->ih_format, val, 0, 12);
|
||||||
|
}
|
||||||
|
|
||||||
|
__u16 reiserfs_ih_get_flags(const reiserfs_ih_t *ih) {
|
||||||
|
return misc_get_bitfield_XX (16, &ih->ih_format, 12, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
void reiserfs_ih_set_flags(reiserfs_ih_t *ih, __u16 val) {
|
||||||
|
misc_set_bitfield_XX (16, &ih->ih_format, val, 12, 4);
|
||||||
|
}
|
||||||
|
|
||||||
Loaded 100 of 189 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user