Imported reiserfsprogs-3.6.9

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

No files matched your search

+258 -159
View File
@@ -1,6 +1,8 @@
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -10,251 +12,348 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
noinst_LIBRARIES = libmisc.a
libmisc_a_SOURCES = io.c misc.c
subdir = lib
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../include/config.h
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
libmisc_a_AR = $(AR) cru
libmisc_a_LIBADD =
am_libmisc_a_OBJECTS = io.$(OBJEXT) misc.$(OBJEXT)
libmisc_a_OBJECTS = $(am_libmisc_a_OBJECTS)
DEFS = @DEFS@ -I. -I$(srcdir) -I../include
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
libmisc_a_LIBADD =
libmisc_a_OBJECTS = io.o misc.o
AR = ar
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/io.Po ./$(DEPDIR)/misc.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libmisc_a_SOURCES)
DIST_COMMON = Makefile.am Makefile.in
SOURCES = $(libmisc_a_SOURCES)
OBJECTS = $(libmisc_a_OBJECTS)
all: all-redirect
all: all-am
.SUFFIXES:
.SUFFIXES: .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps lib/Makefile
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu lib/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-noinstLIBRARIES:
AR = ar
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
distclean-noinstLIBRARIES:
maintainer-clean-noinstLIBRARIES:
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
libmisc.a: $(libmisc_a_OBJECTS) $(libmisc_a_DEPENDENCIES)
-rm -f libmisc.a
$(libmisc_a_AR) libmisc.a $(libmisc_a_OBJECTS) $(libmisc_a_LIBADD)
$(RANLIB) libmisc.a
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
-rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/io.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Po@am__quote@
libmisc.a: $(libmisc_a_OBJECTS) $(libmisc_a_DEPENDENCIES)
-rm -f libmisc.a
$(AR) cru libmisc.a $(libmisc_a_OBJECTS) $(libmisc_a_LIBADD)
$(RANLIB) libmisc.a
distclean-depend:
-rm -rf ./$(DEPDIR)
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am:
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
mkid -fID $$unique
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
mostlyclean-tags:
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
clean-tags:
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = lib
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
io.o: io.c ../include/io.h ../include/misc.h ../include/swab.h \
../include/config.h
misc.o: misc.c ../include/swab.h ../include/io.h ../include/misc.h
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am:
install-exec: install-exec-am
all-am: Makefile $(LIBRARIES)
install-data-am:
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am:
uninstall: uninstall-am
all-am: Makefile $(LIBRARIES)
all-redirect: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \
mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-noinstLIBRARIES clean-compile clean-tags clean-generic \
mostlyclean-am
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
distclean-am: distclean-noinstLIBRARIES distclean-compile \
distclean-tags distclean-generic clean-am
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-noinstLIBRARIES \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am:
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
check-am installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES ctags distclean distclean-compile \
distclean-depend distclean-generic distclean-tags distdir dvi \
dvi-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
+111 -81
View File
@@ -1,6 +1,8 @@
/*
* Copyright 1996-2002 Hans Reiser, see reiserfs/README for licensing and copyright details
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#define _GNU_SOURCE
#include <stdio.h>
@@ -20,15 +22,28 @@
void check_memory_msg (void) {
fprintf(stderr,
"\nThe problem has occurred looks like a hardware problem. Send us the bug\n"
"report only if the second run dies at the same place with the same block\n"
"number.\n");
"\nThe problem has occurred looks like a hardware problem (perhaps memory).\n"
"Send us the bug report only if the second run dies at the same place with\n"
"the same block number.\n");
}
void check_hd_msg (void) {
fprintf(stderr,
"\nThe problem has occurred looks like a hardware problem.\n"
"Check your hard drive for badblocks.\n");
"If you have bad blocks, we advise you to get a new hard\n"
"drive, because once you get one bad block that the disk\n"
"drive internals cannot hide from your sight, the chances\n"
"of getting more are generally said to become much higher\n"
"(precise statistics are unknown to us), and this disk drive\n"
"is probably not expensive enough for you to risk your time\n"
"and data on it. If you don't want to follow that advice,\n"
"then if you have just a few bad blocks, try writing to the\n"
"bad blocks and see if the drive remaps the bad blocks (that\n"
"means it takes a block it has in reserve and allocates it\n"
"for use for requests of that block number). If it cannot\n"
"remap the block, this could be quite bad, as it may mean\n"
"that so many blocks have gone bad that none remain in \n"
"reserve to allocate.\n");
}
static int is_bad_block (unsigned long block)
@@ -74,7 +89,7 @@ static unsigned long buffers_memory;
**
*/
#define BUFFER_SOFT_LIMIT (500 * 1024)
static int buffer_soft_limit = BUFFER_SOFT_LIMIT;
static unsigned long buffer_soft_limit = BUFFER_SOFT_LIMIT;
#define NR_HASH_QUEUES 4096
@@ -89,8 +104,7 @@ static int buffer_writes = 0 ;
static void _show_buffers(struct buffer_head **list, int dev, int size)
{
static void _show_buffers(struct buffer_head **list, int dev, unsigned long size) {
int all = 0;
int dirty = 0;
int in_use = 0; /* count != 0 */
@@ -119,8 +133,8 @@ static void _show_buffers(struct buffer_head **list, int dev, int size)
break;
}
printf ("show_buffers (dev %d, size %d): free %d, count != 0 %d, dirty %d, all %d\n",
dev, size, free, in_use, dirty, all);
printf("show_buffers (dev %d, size %lu): free %d, count != 0 %d, dirty %d, "
"all %d\n", dev, size, free, in_use, dirty, all);
}
@@ -149,7 +163,7 @@ static void insert_into_hash_queue (struct buffer_head * bh)
static void remove_from_hash_queue (struct buffer_head * bh)
{
if (bh->b_hash_next == 0 && bh->b_hash_prev == 0 && bh != g_a_hash_queues[bh->b_blocknr % NR_HASH_QUEUES])
/* (b_dev == 0) ? */
/* (b_dev == -1) ? */
return;
if (bh == g_a_hash_queues[bh->b_blocknr % NR_HASH_QUEUES]) {
@@ -226,7 +240,7 @@ static size_t estimate_memory_amount (void)
addr = mmap (0, len, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (addr == MAP_FAILED) {
if (errno != ENOMEM)
die ("mmap failed: %m\n");
die ("mmap failed: %s\n", strerror(errno));
break;
}
if (mlock (addr, len) != 0) {
@@ -278,7 +292,7 @@ static int grow_buffers (int size)
tmp->b_data = getmem (size);
if (tmp->b_data == 0)
die ("grow_buffers: no memory for new buffer data");
tmp->b_dev = 0;
tmp->b_dev = -1;
tmp->b_size = size;
put_buffer_list_head (&g_free_buffers, tmp);
}
@@ -288,7 +302,7 @@ static int grow_buffers (int size)
}
struct buffer_head * find_buffer (int dev, unsigned long block, int size)
struct buffer_head *find_buffer(int dev, unsigned long block, unsigned long size)
{
struct buffer_head * next;
@@ -308,7 +322,7 @@ struct buffer_head * find_buffer (int dev, unsigned long block, int size)
static struct buffer_head * get_free_buffer (struct buffer_head **list,
int size)
unsigned long size)
{
struct buffer_head * next;
@@ -334,8 +348,7 @@ static struct buffer_head * get_free_buffer (struct buffer_head **list,
/* to_write == 0 when all blocks have to be flushed. Otherwise - write only
buffers with b_count == 0 */
static int sync_buffers (struct buffer_head **list, dev_t dev, int to_write)
{
static int sync_buffers (struct buffer_head **list, int dev, int to_write) {
struct buffer_head * next;
int written = 0;
@@ -376,10 +389,11 @@ restart:
}
void flush_buffers (dev_t dev)
void flush_buffers (int dev)
{
if (!dev)
die ("flush_buffers: device is not specifed");
if (dev == -1)
die ("flush_buffers: device is not specified");
sync_buffers (&Buffer_list_head, dev, 0/*all*/);
buffer_soft_limit = BUFFER_SOFT_LIMIT;
}
@@ -428,8 +442,8 @@ struct buffer_head * getblk (int dev, unsigned long block, int size)
bh->b_blocknr = block;
bh->b_end_io = NULL ;
memset (bh->b_data, 0, size);
clear_bit(BH_Dirty, &bh->b_state);
clear_bit(BH_Uptodate, &bh->b_state);
misc_clear_bit(BH_Dirty, &bh->b_state);
misc_clear_bit(BH_Uptodate, &bh->b_state);
put_buffer_list_end (&Buffer_list_head, bh);
insert_into_hash_queue (bh);
@@ -443,9 +457,9 @@ void brelse (struct buffer_head * bh)
{
if (bh == 0)
return;
if (bh->b_count == 0) {
if (bh->b_count == 0)
die ("brelse: can not free a free buffer %lu", bh->b_blocknr);
}
/*checkmem (bh->b_data, get_mem_size (bh->b_data));*/
@@ -460,36 +474,32 @@ void bforget (struct buffer_head * bh)
brelse (bh);
remove_from_hash_queue (bh);
remove_from_buffer_list(&Buffer_list_head, bh);
if (bh->b_count == 0)
put_buffer_list_head(&g_free_buffers, bh);
else
put_buffer_list_head(&Buffer_list_head, bh);
put_buffer_list_head(&Buffer_list_head, bh);
}
}
/* Returns 0 on success; 1 - end of file; 0 - OK. */
static int f_read(struct buffer_head * bh)
{
loff_t offset;
unsigned long long offset;
ssize_t bytes;
buffer_reads++ ;
offset = (loff_t)bh->b_size * (loff_t)bh->b_blocknr;
if (lseek64 (bh->b_dev, offset, SEEK_SET) == (loff_t)-1)
return 0;
offset = (unsigned long long)bh->b_size * bh->b_blocknr;
if (lseek64 (bh->b_dev, offset, SEEK_SET) < 0)
return -1;
bytes = read (bh->b_dev, bh->b_data, bh->b_size);
if (bytes != (ssize_t)bh->b_size)
return 0;
return 1;
return bytes < 0 ? -1 : (bytes != (ssize_t)bh->b_size ? 1 : 0);
}
struct buffer_head * bread (int dev, unsigned long block, size_t size)
{
struct buffer_head * bh;
int ret;
if (is_bad_block (block))
return 0;
@@ -501,13 +511,25 @@ struct buffer_head * bread (int dev, unsigned long block, size_t size)
if (buffer_uptodate (bh))
return bh;
if (f_read(bh) == 0 || is_bad_block (block)) {
/* BAD BLOCK LIST SUPPORT
die ("%s: Cannot read a block # %lu. Specify list of badblocks\n",*/
check_hd_msg();
die ("%s: Cannot read the block (%lu).\n", __FUNCTION__, bh->b_blocknr);
}
ret = f_read(bh);
if (ret > 0)
die ("%s: End of file, cannot read the block (%lu).\n", __FUNCTION__, bh->b_blocknr);
else if (ret < 0) {
/* BAD BLOCK LIST SUPPORT
* die ("%s: Cannot read a block # %lu. Specify list of badblocks\n",*/
if (errno == EIO) {
check_hd_msg();
die ("%s: Cannot read the block (%lu): (%s).\n", __FUNCTION__,
bh->b_blocknr, strerror(errno));
} else {
fprintf (stderr, "%s: Cannot read the block (%lu): (%s).\n", __FUNCTION__,
bh->b_blocknr, strerror(errno));
return NULL;
}
}
mark_buffer_uptodate (bh, 0);
return bh;
}
@@ -554,7 +576,7 @@ void init_rollback_file (char * rollback_file, int *blocksize, FILE * log) {
s_rollback_file = fopen (rollback_file, "w+");
if (s_rollback_file == NULL) {
fprintf (stderr, "Cannot create file %s, work w/out a rollback file\n", rollback_file);
fprintf (stderr, "Cannot create file %s, work without a rollback file\n", rollback_file);
return;
}
@@ -738,8 +760,9 @@ void do_fsck_rollback (int fd_device, int fd_journal_device, FILE * progress) {
}
if (write (descriptor, rollback_data, rollback_blocksize) == -1) {
fprintf (stderr, "rollback: write %d bytes returned error (block=%Ld, dev=%Ld): %s\n",
rollback_blocksize, (long long)offset/rollback_blocksize, (long long)b_dev, strerror (errno));
fprintf (stderr, "rollback: write %d bytes returned error "
"(block=%lld, dev=%lld): %s\n", rollback_blocksize,
offset/rollback_blocksize, b_dev, strerror (errno));
count_failed ++;
} else {
count_rollbacked ++;
@@ -781,9 +804,8 @@ static void rollback__mark_block_saved (struct block_handler * rb_e) {
/* for now - just make sure that bad blocks did not get here */
int bwrite (struct buffer_head * bh)
{
loff_t offset;
ssize_t bytes;
size_t size;
unsigned long long offset;
long long bytes, size;
if (is_bad_block (bh->b_blocknr)) {
fprintf (stderr, "bwrite: bad block is going to be written: %lu\n",
@@ -803,12 +825,12 @@ int bwrite (struct buffer_head * bh)
offset = (loff_t)size * (loff_t)bh->b_blocknr;
if (lseek64 (bh->b_dev, offset, SEEK_SET) == (loff_t)-1){
fprintf (stderr, "bwrite: lseek to position %Ld (block=%lu, dev=%d): %s\n",
(long long)offset, bh->b_blocknr, bh->b_dev, strerror (errno));
fprintf (stderr, "bwrite: lseek to position %llu (block=%lu, dev=%d): %s\n",
offset, bh->b_blocknr, bh->b_dev, strerror(errno));
exit(8); /* File system errors left uncorrected */
}
if (s_rollback_file != NULL && bh->b_size == rollback_blocksize) {
if (s_rollback_file != NULL && bh->b_size == (unsigned long)rollback_blocksize) {
struct stat64 buf;
__u32 position;
struct block_handler block_h;
@@ -817,47 +839,54 @@ int bwrite (struct buffer_head * bh)
if (!fstat64 (bh->b_dev, &buf)) {
block_h.blocknr = bh->b_blocknr;
block_h.device = buf.st_rdev;
if (reiserfs_bin_search (&block_h, rollback_blocks_array, rollback_blocks_number,
sizeof (block_h), &position, blockdev_list_compare) != POSITION_FOUND) {
if (reiserfs_bin_search(&block_h, rollback_blocks_array,
rollback_blocks_number, sizeof (block_h),
&position, blockdev_list_compare)
!= POSITION_FOUND)
{
/*read initial data from the disk*/
if (read (bh->b_dev, rollback_data, bh->b_size) == bh->b_size) {
fwrite (&buf.st_rdev, sizeof (buf.st_rdev), 1, s_rollback_file);
fwrite (&offset, sizeof (offset), 1, s_rollback_file);
fwrite (rollback_data, rollback_blocksize, 1, s_rollback_file);
if (read(bh->b_dev, rollback_data, bh->b_size) == (long long)bh->b_size) {
fwrite(&buf.st_rdev, sizeof (buf.st_rdev), 1, s_rollback_file);
fwrite(&offset, sizeof (offset), 1, s_rollback_file);
fwrite(rollback_data, rollback_blocksize, 1, s_rollback_file);
fflush(s_rollback_file);
blocklist__insert_in_position(&block_h, (void **)&rollback_blocks_array,
blocklist__insert_in_position(&block_h, (void *)(&rollback_blocks_array),
&rollback_blocks_number, sizeof(block_h), &position);
/*if you want to know what gets saved, uncomment it*/
/* if (log_file != 0 && log_file != stdout) {
fprintf (log_file, "rollback: block %lu of device %Lu was backed up\n",
bh->b_blocknr, buf.st_rdev);
fprintf (log_file, "rollback: block %lu of device %Lu was "
"backed up\n", bh->b_blocknr, buf.st_rdev);
}
*/
} else {
fprintf (stderr, "bwrite: read (block=%lu, dev=%d): %s\n", bh->b_blocknr,
bh->b_dev, strerror (errno));
fprintf (stderr, "bwrite: read (block=%lu, dev=%d): %s\n",
bh->b_blocknr, bh->b_dev, strerror (errno));
exit(8);
}
if (lseek64 (bh->b_dev, offset, SEEK_SET) == (loff_t)-1) {
fprintf (stderr, "bwrite: lseek to position %Ld (block=%lu, dev=%d): %s\n",
(long long)offset, bh->b_blocknr, bh->b_dev, strerror (errno));
fprintf (stderr, "bwrite: lseek to position %llu (block=%lu, "
"dev=%d): %s\n", offset, bh->b_blocknr, bh->b_dev,
strerror(errno));
exit(8);
}
}
} else {
fprintf (stderr, "bwrite: fstat of (%d) returned -1: %s\n", bh->b_dev,
strerror(errno));
fprintf (stderr, "bwrite: fstat of (%d) returned -1: %s\n",
bh->b_dev, strerror(errno));
}
} else if (s_rollback_file != NULL) {
fprintf (stderr, "rollback: block (%lu) has the size different from the fs uses, "
"block skipped\n", bh->b_blocknr);
fprintf (stderr, "rollback: block (%lu) has the size different from "
"the fs uses, block skipped\n", bh->b_blocknr);
}
bytes = write (bh->b_dev, bh->b_data, size);
if (bytes != (ssize_t)size) {
fprintf (stderr, "bwrite: write %ld bytes returned %ld (block=%ld, dev=%d): %s\n",
(long)size, (long)bytes, bh->b_blocknr, bh->b_dev, strerror (errno));
bytes = write(bh->b_dev, bh->b_data, size);
if (bytes != size) {
fprintf (stderr, "bwrite: write %lld bytes returned %lld (block=%ld, "
"dev=%d): %s\n", size, bytes, bh->b_blocknr, bh->b_dev,
strerror(errno));
exit(8);
}
@@ -879,12 +908,13 @@ static int _check_and_free_buffer_list(struct buffer_head *list) {
for(;;) {
if (next->b_count != 0)
fprintf (stderr, "check_and_free_buffer_mem: not free buffer (%x, %ld, %ld, %d)\n",
next->b_dev, next->b_blocknr, next->b_size, next->b_count);
fprintf (stderr, "check_and_free_buffer_mem: not free buffer "
"(%d, %ld, %ld, %d)\n", next->b_dev, next->b_blocknr,
next->b_size, next->b_count);
if (buffer_dirty (next) && buffer_uptodate (next))
fprintf (stderr, "check_and_free_buffer_mem: dirty buffer (%x %lu) found\n",
next->b_dev, next->b_blocknr);
fprintf (stderr, "check_and_free_buffer_mem: dirty buffer "
"(%d %lu) found\n", next->b_dev, next->b_blocknr);
freemem (next->b_data);
count++;
@@ -895,7 +925,7 @@ static int _check_and_free_buffer_list(struct buffer_head *list) {
return count;
}
void check_and_free_buffer_mem (void)
static void check_and_free_buffer_mem (void)
{
int count = 0;
struct buffer_head * next ;
@@ -927,7 +957,7 @@ void free_buffers (void)
}
static void _invalidate_buffer_list(struct buffer_head *list, dev_t dev)
static void _invalidate_buffer_list(struct buffer_head *list, int dev)
{
struct buffer_head * next;
@@ -951,7 +981,7 @@ static void _invalidate_buffer_list(struct buffer_head *list, dev_t dev)
}
/* forget all buffers of the given device */
void invalidate_buffers (dev_t dev)
void invalidate_buffers (int dev)
{
_invalidate_buffer_list(Buffer_list_head, dev) ;
_invalidate_buffer_list(g_free_buffers, dev) ;
@@ -964,7 +994,7 @@ int user_confirmed (FILE * fp, char * q, char * yes)
size_t n = 0;
fprintf (fp, "%s", q);
if (getline (&answer, &n, stdin) != strlen (yes) || strcmp (yes, answer))
if (getline (&answer, &n, stdin) != (ssize_t)strlen (yes) || strcmp (yes, answer))
return 0;
return 1;
+189 -30
View File
@@ -1,5 +1,6 @@
/*
* Copyright 1996-2002 Hans Reiser
* Copyright 1996-2003 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
/* for stat64() */
@@ -22,14 +23,12 @@
#include <linux/hdreg.h>
#include <dirent.h>
#include <asm/ioctl.h>
#include <unistd.h>
//#include <linux/unistd.h>
//#include <sys/stat.h>
#if defined(__linux__) && defined(_IOR) && !defined(BLKGETSIZE64)
# define BLKGETSIZE64 _IOR(0x12, 114, sizeof(__u64))
#endif
#include "swab.h"
@@ -61,11 +60,10 @@ void die (char * fmt, ...)
#define CONTROL_SIZE (strlen (MEM_BEGIN) + 1 + sizeof (int) + strlen (MEM_END) + 1)
int get_mem_size (char * p)
{
char * begin;
begin = p - strlen (MEM_BEGIN) - 1 - sizeof (int);
unsigned int get_mem_size(char *p) {
char *begin;
begin = p - strlen (MEM_BEGIN) - 1 - sizeof(int);
return *(int *)(begin + strlen (MEM_BEGIN) + 1);
}
@@ -88,8 +86,20 @@ void checkmem (char * p, int size)
}
void * getmem (int size)
void *getmem (int size)
{
char * mem;
if ((mem = mem_alloc(size)) == NULL)
die ("getmem: no more memory (%d)", size);
memset (mem, 0, size);
// checkmem (mem, size);
return mem;
}
void *mem_alloc(int size) {
char * p;
char * mem;
@@ -97,21 +107,19 @@ void * getmem (int size)
if (!p)
die ("getmem: no more memory (%d)", size);
/* Write the MEM_BEGIN magic in the beginning of allocated memory. */
strcpy (p, MEM_BEGIN);
p += strlen (MEM_BEGIN) + 1;
/* Write the size after the magic. */
*(int *)p = size;
p += sizeof (int);
mem = p;
memset (mem, 0, size);
p += size;
strcpy (p, MEM_END);
// checkmem (mem, size);
return mem;
}
void * expandmem (void * vp, int size, int by)
{
int allocated;
@@ -250,7 +258,7 @@ static int _is_mounted (char * device_name, func_t f)
mode_t mode;
if (stat ("/", &root_st) == -1)
die ("is_mounted: could not stat \"/\": %m\n");
die ("is_mounted: could not stat \"/\": %s\n", strerror(errno));
mode = get_st_mode (device_name);
@@ -272,11 +280,12 @@ static int _is_mounted (char * device_name, func_t f)
/* proc filesystem is not mounted, or /proc/mounts does not
exist */
if (f)
return (user_confirmed (stderr, " (could not figure out) Is filesystem mounted read-only? (Yes)",
"Yes\n"));
return (user_confirmed (stderr,
" (could not figure out) Is filesystem mounted read-only? (Yes)",
"Yes\n"));
else
return (user_confirmed (stderr, " (could not figure out) Is filesystem mounted? (Yes)",
"Yes\n"));
return (user_confirmed (stderr,
" (could not figure out) Is filesystem mounted? (Yes)", "Yes\n"));
}
retval = 0;
@@ -366,7 +375,7 @@ static void str_to_be (char * buf, int prosents)
void print_how_far (FILE * fp,
unsigned long * passed, unsigned long total,
int inc, int quiet)
unsigned int inc, int quiet)
{
int percent;
@@ -390,9 +399,10 @@ void print_how_far (FILE * fp,
strcat (current_progress, progress_to_be + strlen (current_progress));
if (!quiet)
print_how_fast (*passed/* - inc*/, total, strlen (progress_to_be),
(*passed == inc) ? 1 : 0);
if (!quiet) {
print_how_fast(*passed /* - inc*/, total, strlen (progress_to_be),
(*passed == inc) ? 1 : 0);
}
fflush (fp);
}
@@ -419,10 +429,11 @@ unsigned long count_blocks (char * filename, int blocksize)
#ifdef BLKGETSIZE64
{
if (ioctl (fd, BLKGETSIZE64, &size) >= 0) {
size = (size / 4096) * 4096 / blocksize;
sz = size;
if ((__u64)sz != size)
die ("count_blocks: block device too large");
return (size / 4096) * 4096 / blocksize;
return sz;
}
}
#endif
@@ -580,8 +591,8 @@ int blocklist__is_block_saved (struct block_handler ** base, __u32 * count,
return 0;
}
*/
void blocklist__insert_in_position (void *elem, void **base, __u32 *count, int elem_size,
__u32 * position)
void blocklist__insert_in_position (void *elem, void **base, __u32 *count,
int elem_size, __u32 *position)
{
if (elem_size == 0)
return;
@@ -589,7 +600,7 @@ void blocklist__insert_in_position (void *elem, void **base, __u32 *count, int e
if (*base == NULL)
*base = getmem (BLOCKLIST__ELEMENT_NUMBER * elem_size);
if (*count == get_mem_size ((void *)*base) / elem_size)
if (*count == get_mem_size((void *)*base) / elem_size)
*base = expandmem (*base, get_mem_size((void *)*base),
BLOCKLIST__ELEMENT_NUMBER * elem_size);
@@ -643,11 +654,11 @@ int uuid_is_correct (unsigned char * uuid)
if (i == 16)
return 0;
if (!test_bit(7, &uuid[8]) || test_bit(6, &uuid[8]))
if (!misc_test_bit(7, &uuid[8]) || misc_test_bit(6, &uuid[8]))
return 0;
if (test_bit(7, &uuid[6]) || !test_bit(6, &uuid[6]) ||
test_bit(5, &uuid[6]) || test_bit(4, &uuid[6]))
if (misc_test_bit(7, &uuid[6]) || !misc_test_bit(6, &uuid[6]) ||
misc_test_bit(5, &uuid[6]) || misc_test_bit(4, &uuid[6]))
return 0;
return 1;
@@ -822,3 +833,151 @@ void clean_after_dma_check(int fd, dma_info_t *dma_info) {
if (dma_info->fd && fd != dma_info->fd)
close(dma_info->fd);
}
/* Only le bitops operations are used. */
inline int misc_set_bit (unsigned long long nr, void * addr) {
__u8 * p, mask;
int retval;
p = (__u8 *)addr;
p += nr >> 3;
mask = 1 << (nr & 0x7);
/*cli();*/
retval = (mask & *p) != 0;
*p |= mask;
/*sti();*/
return retval;
}
inline int misc_clear_bit (unsigned long long nr, void * addr) {
__u8 * p, mask;
int retval;
p = (__u8 *)addr;
p += nr >> 3;
mask = 1 << (nr & 0x7);
/*cli();*/
retval = (mask & *p) != 0;
*p &= ~mask;
/*sti();*/
return retval;
}
inline int misc_test_bit(unsigned long long nr, const void * addr) {
__u8 * p, mask;
p = (__u8 *)addr;
p += nr >> 3;
mask = 1 << (nr & 0x7);
return ((mask & *p) != 0);
}
inline unsigned long long misc_find_first_zero_bit (const void *vaddr,
unsigned long long size)
{
const __u8 *p = vaddr, *addr = vaddr;
unsigned long long res;
if (!size)
return 0;
size = (size >> 3) + ((size & 0x7) > 0);
while (*p++ == 255) {
if (--size == 0)
return (unsigned long long)(p - addr) << 3;
}
--p;
for (res = 0; res < 8; res++)
if (!misc_test_bit (res, p))
break;
return res + (p - addr) * 8;
}
inline unsigned long long misc_find_next_zero_bit (const void *vaddr,
unsigned long long size, unsigned long long offset)
{
const __u8 *addr = vaddr;
const __u8 *p = addr + (offset >> 3);
int bit = offset & 7;
unsigned long long res;
if (offset >= size)
return size;
if (bit) {
/* Look for zero in first char */
for (res = bit; res < 8; res++)
if (!misc_test_bit (res, p))
return res + (p - addr) * 8;
p++;
}
/* No zero yet, search remaining full bytes for a zero */
res = misc_find_first_zero_bit (p, size - 8 * (p - addr));
return res + (p - addr) * 8;
}
inline unsigned long long misc_find_first_set_bit (const void *vaddr,
unsigned long long size)
{
const __u8 *p = vaddr, *addr = vaddr;
unsigned long long res;
if (!size)
return 0;
size = (size >> 3) + ((size & 0x7) > 0);
while (*p++ == 0) {
if (--size == 0)
return (unsigned long long)(p - addr) << 3;
}
--p;
for (res = 0; res < 8; res++)
if (misc_test_bit (res, p))
break;
return res + (p - addr) * 8;
}
inline unsigned long long misc_find_next_set_bit(const void *vaddr,
unsigned long long size, unsigned long long offset)
{
const __u8 *addr = vaddr;
const __u8 *p = addr + (offset >> 3);
int bit = offset & 7;
unsigned long long res;
if (offset >= size)
return size;
if (bit) {
/* Look for zero in first char */
for (res = bit; res < 8; res++)
if (misc_test_bit (res, p))
return res + (p - addr) * 8;
p++;
}
/* No set bit yet, search remaining full bytes for a 1 */
res = misc_find_first_set_bit (p, size - 8 * (p - addr));
return res + (p - addr) * 8;
}
#include "credits.h"
/* Reads the "CREDITS" file and prints one paragraph from it. */
void misc_print_credit(FILE *out) {
char *line;
fprintf(out, "\nA pair of credits:\n");
line = credits[(random() % CREDITS_COUNT)];
fprintf(out, "%s", line);
line = credits[(random() % CREDITS_COUNT)];
fprintf(out, "%s", line);
}