Imported reiserfsprogs-3.6.20

This commit is contained in:
Jeff Mahoney committed 2012-10-11 11:32:09 -04:00
1 parent 0ed773997f
commit dac518d099
189 files changed
+43353 -29787

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
sbin_PROGRAMS = resizefs.reiserfs
man_MANS = resizefs.reiserfs.8
EXTRA_DIST = resizefs.reiserfs.8
resizefs_reiserfs_SOURCES = fe.c resize_reiserfs.c do_shrink.c resize.h
resizefs_reiserfs_LDADD = $(top_builddir)/libreiserfs/libreiserfs-static.a \
$(top_builddir)/libutil/libutil-static.a \
$(top_builddir)/libmisc/libmisc-static.a
resizefs_reiserfs_LDFLAGS = @PROGS_LDFLAGS@
resizefs_reiserfs_CFLAGS = @CFLAGS@
INCLUDES = -I$(top_srcdir)/include
uninstall-resize_reiserfs:
if test -f $(DESTDIR)$(sbindir)/resize_reiserfs; then \
rm -f $(DESTDIR)$(sbindir)/resize_reiserfs; \
fi;
install-resize_reiserfs:
if test -f $(DESTDIR)$(sbindir)/resizefs.reiserfs; then \
rm -f $(DESTDIR)$(sbindir)/resize_reiserfs; \
ln $(DESTDIR)$(sbindir)/resizefs.reiserfs $(DESTDIR)$(sbindir)/resize_reiserfs; \
fi;
install-data-local: install-resize_reiserfs
uninstall-local: uninstall-resize_reiserfs
+533
View File
@@ -0,0 +1,533 @@
# 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 = $(resizefs_reiserfs_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@
sbin_PROGRAMS = resizefs.reiserfs$(EXEEXT)
subdir = utils/resizer
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 =
am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)"
sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(sbin_PROGRAMS)
am_resizefs_reiserfs_OBJECTS = resizefs_reiserfs-fe.$(OBJEXT) \
resizefs_reiserfs-resize_reiserfs.$(OBJEXT) \
resizefs_reiserfs-do_shrink.$(OBJEXT)
resizefs_reiserfs_OBJECTS = $(am_resizefs_reiserfs_OBJECTS)
resizefs_reiserfs_DEPENDENCIES = \
$(top_builddir)/libreiserfs/libreiserfs-static.a \
$(top_builddir)/libutil/libutil-static.a \
$(top_builddir)/libmisc/libmisc-static.a
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 = $(resizefs_reiserfs_SOURCES)
DIST_SOURCES = $(resizefs_reiserfs_SOURCES)
man8dir = $(mandir)/man8
NROFF = nroff
MANS = $(man_MANS)
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@
man_MANS = resizefs.reiserfs.8
EXTRA_DIST = resizefs.reiserfs.8
resizefs_reiserfs_SOURCES = fe.c resize_reiserfs.c do_shrink.c resize.h
resizefs_reiserfs_LDADD = $(top_builddir)/libreiserfs/libreiserfs-static.a \
$(top_builddir)/libutil/libutil-static.a \
$(top_builddir)/libmisc/libmisc-static.a
resizefs_reiserfs_LDFLAGS = @PROGS_LDFLAGS@
resizefs_reiserfs_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 utils/resizer/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu utils/resizer/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
install-sbinPROGRAMS: $(sbin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(sbindir)" || $(mkdir_p) "$(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)
resizefs.reiserfs$(EXEEXT): $(resizefs_reiserfs_OBJECTS) $(resizefs_reiserfs_DEPENDENCIES)
@rm -f resizefs.reiserfs$(EXEEXT)
$(LINK) $(resizefs_reiserfs_LDFLAGS) $(resizefs_reiserfs_OBJECTS) $(resizefs_reiserfs_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resizefs_reiserfs-do_shrink.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resizefs_reiserfs-fe.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resizefs_reiserfs-resize_reiserfs.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) '$<'`
resizefs_reiserfs-fe.o: fe.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(resizefs_reiserfs_CFLAGS) $(CFLAGS) -MT resizefs_reiserfs-fe.o -MD -MP -MF "$(DEPDIR)/resizefs_reiserfs-fe.Tpo" -c -o resizefs_reiserfs-fe.o `test -f 'fe.c' || echo '$(srcdir)/'`fe.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/resizefs_reiserfs-fe.Tpo" "$(DEPDIR)/resizefs_reiserfs-fe.Po"; else rm -f "$(DEPDIR)/resizefs_reiserfs-fe.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fe.c' object='resizefs_reiserfs-fe.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) $(resizefs_reiserfs_CFLAGS) $(CFLAGS) -c -o resizefs_reiserfs-fe.o `test -f 'fe.c' || echo '$(srcdir)/'`fe.c
resizefs_reiserfs-fe.obj: fe.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(resizefs_reiserfs_CFLAGS) $(CFLAGS) -MT resizefs_reiserfs-fe.obj -MD -MP -MF "$(DEPDIR)/resizefs_reiserfs-fe.Tpo" -c -o resizefs_reiserfs-fe.obj `if test -f 'fe.c'; then $(CYGPATH_W) 'fe.c'; else $(CYGPATH_W) '$(srcdir)/fe.c'; fi`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/resizefs_reiserfs-fe.Tpo" "$(DEPDIR)/resizefs_reiserfs-fe.Po"; else rm -f "$(DEPDIR)/resizefs_reiserfs-fe.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fe.c' object='resizefs_reiserfs-fe.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) $(resizefs_reiserfs_CFLAGS) $(CFLAGS) -c -o resizefs_reiserfs-fe.obj `if test -f 'fe.c'; then $(CYGPATH_W) 'fe.c'; else $(CYGPATH_W) '$(srcdir)/fe.c'; fi`
resizefs_reiserfs-resize_reiserfs.o: resize_reiserfs.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(resizefs_reiserfs_CFLAGS) $(CFLAGS) -MT resizefs_reiserfs-resize_reiserfs.o -MD -MP -MF "$(DEPDIR)/resizefs_reiserfs-resize_reiserfs.Tpo" -c -o resizefs_reiserfs-resize_reiserfs.o `test -f 'resize_reiserfs.c' || echo '$(srcdir)/'`resize_reiserfs.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/resizefs_reiserfs-resize_reiserfs.Tpo" "$(DEPDIR)/resizefs_reiserfs-resize_reiserfs.Po"; else rm -f "$(DEPDIR)/resizefs_reiserfs-resize_reiserfs.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='resize_reiserfs.c' object='resizefs_reiserfs-resize_reiserfs.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) $(resizefs_reiserfs_CFLAGS) $(CFLAGS) -c -o resizefs_reiserfs-resize_reiserfs.o `test -f 'resize_reiserfs.c' || echo '$(srcdir)/'`resize_reiserfs.c
resizefs_reiserfs-resize_reiserfs.obj: resize_reiserfs.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(resizefs_reiserfs_CFLAGS) $(CFLAGS) -MT resizefs_reiserfs-resize_reiserfs.obj -MD -MP -MF "$(DEPDIR)/resizefs_reiserfs-resize_reiserfs.Tpo" -c -o resizefs_reiserfs-resize_reiserfs.obj `if test -f 'resize_reiserfs.c'; then $(CYGPATH_W) 'resize_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/resize_reiserfs.c'; fi`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/resizefs_reiserfs-resize_reiserfs.Tpo" "$(DEPDIR)/resizefs_reiserfs-resize_reiserfs.Po"; else rm -f "$(DEPDIR)/resizefs_reiserfs-resize_reiserfs.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='resize_reiserfs.c' object='resizefs_reiserfs-resize_reiserfs.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) $(resizefs_reiserfs_CFLAGS) $(CFLAGS) -c -o resizefs_reiserfs-resize_reiserfs.obj `if test -f 'resize_reiserfs.c'; then $(CYGPATH_W) 'resize_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/resize_reiserfs.c'; fi`
resizefs_reiserfs-do_shrink.o: do_shrink.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(resizefs_reiserfs_CFLAGS) $(CFLAGS) -MT resizefs_reiserfs-do_shrink.o -MD -MP -MF "$(DEPDIR)/resizefs_reiserfs-do_shrink.Tpo" -c -o resizefs_reiserfs-do_shrink.o `test -f 'do_shrink.c' || echo '$(srcdir)/'`do_shrink.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/resizefs_reiserfs-do_shrink.Tpo" "$(DEPDIR)/resizefs_reiserfs-do_shrink.Po"; else rm -f "$(DEPDIR)/resizefs_reiserfs-do_shrink.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='do_shrink.c' object='resizefs_reiserfs-do_shrink.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) $(resizefs_reiserfs_CFLAGS) $(CFLAGS) -c -o resizefs_reiserfs-do_shrink.o `test -f 'do_shrink.c' || echo '$(srcdir)/'`do_shrink.c
resizefs_reiserfs-do_shrink.obj: do_shrink.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(resizefs_reiserfs_CFLAGS) $(CFLAGS) -MT resizefs_reiserfs-do_shrink.obj -MD -MP -MF "$(DEPDIR)/resizefs_reiserfs-do_shrink.Tpo" -c -o resizefs_reiserfs-do_shrink.obj `if test -f 'do_shrink.c'; then $(CYGPATH_W) 'do_shrink.c'; else $(CYGPATH_W) '$(srcdir)/do_shrink.c'; fi`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/resizefs_reiserfs-do_shrink.Tpo" "$(DEPDIR)/resizefs_reiserfs-do_shrink.Po"; else rm -f "$(DEPDIR)/resizefs_reiserfs-do_shrink.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='do_shrink.c' object='resizefs_reiserfs-do_shrink.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) $(resizefs_reiserfs_CFLAGS) $(CFLAGS) -c -o resizefs_reiserfs-do_shrink.obj `if test -f 'do_shrink.c'; then $(CYGPATH_W) 'do_shrink.c'; else $(CYGPATH_W) '$(srcdir)/do_shrink.c'; fi`
uninstall-info-am:
install-man8: $(man8_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
test -z "$(man8dir)" || $(mkdir_p) "$(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
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 $(PROGRAMS) $(MANS)
installdirs:
for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
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-sbinPROGRAMS 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-data-local install-man
install-exec-am: install-sbinPROGRAMS
install-info: install-info-am
install-man: install-man8
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 uninstall-local 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-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-data-local 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-local uninstall-man \
uninstall-man8 uninstall-sbinPROGRAMS
uninstall-resize_reiserfs:
if test -f $(DESTDIR)$(sbindir)/resize_reiserfs; then \
rm -f $(DESTDIR)$(sbindir)/resize_reiserfs; \
fi;
install-resize_reiserfs:
if test -f $(DESTDIR)$(sbindir)/resizefs.reiserfs; then \
rm -f $(DESTDIR)$(sbindir)/resize_reiserfs; \
ln $(DESTDIR)$(sbindir)/resizefs.reiserfs $(DESTDIR)$(sbindir)/resize_reiserfs; \
fi;
install-data-local: install-resize_reiserfs
uninstall-local: uninstall-resize_reiserfs
# 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:
+317
View File
@@ -0,0 +1,317 @@
/*
* Copyright 2000-2004 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "resize.h"
#include "misc/unaligned.h"
#include "util/misc.h"
#include <time.h>
#include <fcntl.h>
static unsigned long int_node_cnt = 0, int_moved_cnt = 0;
static unsigned long leaf_node_cnt = 0, leaf_moved_cnt = 0;
static unsigned long unfm_node_cnt = 0, unfm_moved_cnt = 0;
static unsigned long total_node_cnt = 0;
static unsigned long total_moved_cnt = 0;
static unsigned long unused_block;
static unsigned long blocks_used;
static int block_count_mismatch = 0;
static reiserfs_bitmap_t * bmp;
static reiserfs_sb_t * ondisk_sb;
/* abnornal exit from block reallocation process */
static void quit_resizer(reiserfs_filsys_t * fs)
{
/* save changes to bitmap blocks */
reiserfs_fs_close (fs);
/* leave fs in ERROR state */
reiserfs_exit(1, "fs shrinking was not completed successfully, "
"run reiserfsck.");
}
/* block moving */
static unsigned long move_generic_block(reiserfs_filsys_t * fs,
unsigned long block,
unsigned long bnd, int h)
{
reiserfs_bh_t * bh, * bh2;
/* primitive fsck */
if (block > reiserfs_sb_get_blocks(ondisk_sb)) {
fprintf(stderr, "resize_reiserfs: invalid block number "
"(%lu) found.\n", block);
quit_resizer(fs);
}
/* progress bar, 3D style :) */
if (opt_verbose)
util_misc_progress(stderr, &total_node_cnt, blocks_used, 1, 0);
else
total_node_cnt ++;
/* infinite loop check */
if( total_node_cnt > blocks_used && !block_count_mismatch) {
fputs("resize_reiserfs: warning: block count exeeded\n",stderr);
block_count_mismatch = 1;
}
if (block < bnd) /* block will not be moved */
return 0;
/* move wrong block */
bh = reiserfs_buffer_read(fs->fs_dev, block, fs->fs_blocksize);
if (!bh)
reiserfs_exit (1, "move_generic_block: reiserfs_buffer_read failed.\n");
reiserfs_bitmap_find_zero_bit(bmp, &unused_block);
if (unused_block == 0 || unused_block >= bnd) {
fputs ("resize_reiserfs: can\'t find free block\n", stderr);
quit_resizer(fs);
}
/* blocknr changing */
bh2 = reiserfs_buffer_open(fs->fs_dev, unused_block, fs->fs_blocksize);
memcpy(bh2->b_data, bh->b_data, bh2->b_size);
reiserfs_bitmap_clear_bit(bmp, block);
reiserfs_bitmap_set_bit(bmp, unused_block);
reiserfs_buffer_close(bh);
reiserfs_buffer_mkuptodate(bh2,1);
reiserfs_buffer_mkdirty(bh2);
reiserfs_buffer_write(bh2);
reiserfs_buffer_close(bh2);
total_moved_cnt++;
return unused_block;
}
static unsigned long move_unformatted_block(reiserfs_filsys_t * fs, unsigned long block, unsigned long bnd, int h)
{
unsigned long b;
unfm_node_cnt++;
b = move_generic_block(fs, block, bnd, h);
if (b)
unfm_moved_cnt++;
return b;
}
/* recursive function processing all tree nodes */
static unsigned long move_formatted_block(reiserfs_filsys_t * fs,
unsigned long block,
unsigned long bnd, int h)
{
reiserfs_bh_t * bh;
reiserfs_ih_t *ih;
unsigned long new_blocknr = 0;
int node_is_internal = 0;
unsigned int i, j;
bh = reiserfs_buffer_read(fs->fs_dev, block, fs->fs_blocksize);
if (!bh)
reiserfs_exit (1, "move_formatted_block: reiserfs_buffer_read failed");
if (reiserfs_leaf_head (bh)) {
leaf_node_cnt++;
for (i = 0; i < reiserfs_node_items(bh); i++) {
ih = reiserfs_ih_at(bh, i);
/* skip the bad blocks. */
if (reiserfs_key_get_oid (&ih->ih_key) == REISERFS_BAD_OID &&
reiserfs_key_get_did (&ih->ih_key) == REISERFS_BAD_DID)
{
continue;
}
if (reiserfs_ih_ext(ih)) {
__u32 * extent;
extent = (__u32 *)reiserfs_item_by_ih (bh, ih);
for (j = 0; j < reiserfs_ext_count(ih); j++) {
unsigned long unfm_block;
/* hole */
if (d32_get (extent, j) == 0)
continue;
unfm_block = move_unformatted_block(fs, d32_get (extent, j),
bnd, h + 1);
if (unfm_block) {
d32_put (extent, j, unfm_block);
reiserfs_buffer_mkdirty(bh);
}
}
}
}
} else if (reiserfs_int_head (bh)) { /* internal node */
int_node_cnt++;
node_is_internal = 1;
for (i=0; i <= reiserfs_node_items(bh); i++) {
unsigned long moved_block;
moved_block =
move_formatted_block(fs, reiserfs_dc_get_nr(
reiserfs_int_at (bh, i)), bnd, h+1);
if (moved_block) {
reiserfs_dc_set_nr (reiserfs_int_at (bh, i),
moved_block);
reiserfs_buffer_mkdirty(bh);
}
}
} else {
misc_die("Block (%lu) has invalid format\n", block);
}
if (reiserfs_buffer_isdirty(bh)) {
reiserfs_buffer_mkuptodate(bh,1);
reiserfs_buffer_write(bh);
}
reiserfs_buffer_close(bh);
new_blocknr = move_generic_block(fs, block, bnd, h);
if (new_blocknr) {
if (node_is_internal)
int_moved_cnt++;
else
leaf_moved_cnt++;
}
return new_blocknr;
}
int shrink_fs(reiserfs_filsys_t * fs, long long int new_blocks)
{
unsigned long n_root_block;
unsigned int bmap_nr_new;
unsigned int bmap_nr_old;
unsigned long bad_count;
unsigned long old_blocks;
ondisk_sb = fs->fs_ondisk_sb;
old_blocks = reiserfs_sb_get_blocks(ondisk_sb);
bmap_nr_old = reiserfs_bmap_nr(old_blocks, fs->fs_blocksize);
bmap_nr_new = reiserfs_bmap_nr(new_blocks, fs->fs_blocksize);
/* is shrinking possible ? */
if (old_blocks - new_blocks >
reiserfs_sb_get_free(ondisk_sb) + bmap_nr_old - bmap_nr_new)
{
fprintf(stderr, "resize_reiserfs: can\'t shrink fs; too many "
"blocks already allocated\n");
return -1;
}
/* warn about alpha version */
{
int c;
printf(
"You are running BETA version of reiserfs shrinker.\n"
"This version is only for testing or VERY CAREFUL use.\n"
"Backup of you data is recommended.\n\n"
"Do you want to continue? [y/N]:"
);
fflush(stdout);
c = getchar();
if (c != 'y' && c != 'Y')
exit(1);
}
reiserfs_fs_reopen(fs, O_RDWR);
if (reiserfs_bitmap_open(fs))
reiserfs_exit(1, "cannot open ondisk bitmap");
bmp = fs->fs_bitmap2;
ondisk_sb = fs->fs_ondisk_sb;
reiserfs_sb_set_state (fs->fs_ondisk_sb, FS_ERROR);
reiserfs_buffer_mkuptodate(fs->fs_super_bh, 1);
reiserfs_buffer_mkdirty(fs->fs_super_bh);
reiserfs_buffer_write(fs->fs_super_bh);
/* calculate number of data blocks */
blocks_used =
old_blocks
- reiserfs_sb_get_free(fs->fs_ondisk_sb)
- bmap_nr_old
- reiserfs_jp_get_size(reiserfs_sb_jp (fs->fs_ondisk_sb))
- REISERFS_DISK_OFFSET_IN_BYTES / fs->fs_blocksize
- 2; /* superblock itself and 1 descriptor after the journal */
unused_block = 1;
if (opt_verbose) {
printf("Processing the tree: ");
fflush(stdout);
}
n_root_block = move_formatted_block(fs, reiserfs_sb_get_root(ondisk_sb),
new_blocks, 0);
if (n_root_block)
reiserfs_sb_set_root (ondisk_sb, n_root_block);
if (opt_verbose)
printf ("\n\nnodes processed (moved):\n"
"int %lu (%lu),\n"
"leaves %lu (%lu),\n"
"unfm %lu (%lu),\n"
"total %lu (%lu).\n\n",
int_node_cnt, int_moved_cnt,
leaf_node_cnt, leaf_moved_cnt,
unfm_node_cnt, unfm_moved_cnt,
(unsigned long)total_node_cnt, total_moved_cnt);
if (block_count_mismatch) {
fprintf(stderr, "resize_reiserfs: data block count %lu"
" doesn\'t match data block count %lu from super block\n",
(unsigned long)total_node_cnt, blocks_used);
}
{
unsigned long l;
/* make sure that none of truncated block are in use */
printf("check for used blocks in truncated region\n");
for (l = new_blocks; l < fs->fs_bitmap2->bm_bit_size; l ++) {
if ((l % (fs->fs_blocksize * 8)) == 0)
continue;
if (reiserfs_bitmap_test_bit (fs->fs_bitmap2, l))
printf ("<%lu>", l);
}
printf("\n");
}
reiserfs_badblock_traverse(fs, reiserfs_badblock_extract, NULL);
if (fs->fs_badblocks_bm) {
bad_count = reiserfs_bitmap_ones(fs->fs_badblocks_bm);
reiserfs_bitmap_shrink (fs->fs_badblocks_bm, new_blocks);
reiserfs_badblock_flush(fs, 1);
bad_count -= reiserfs_bitmap_ones(fs->fs_badblocks_bm);
} else
bad_count = 0;
reiserfs_bitmap_shrink (fs->fs_bitmap2, new_blocks);
reiserfs_sb_set_free (ondisk_sb, reiserfs_sb_get_free(ondisk_sb)
- (old_blocks - new_blocks)
+ (bmap_nr_old - bmap_nr_new)
+ bad_count);
reiserfs_sb_set_blocks (ondisk_sb, new_blocks);
reiserfs_sb_set_bmaps (ondisk_sb, bmap_nr_new);
return 0;
}
+37
View File
@@ -0,0 +1,37 @@
/*
* Copyright 2000-2004 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "resize.h"
#include "util/mntent.h"
#include <errno.h>
#include <sys/mount.h>
#include <mntent.h>
/* the front-end for kernel on-line resizer */
int resize_fs_online(char * devname, long long int blocks) {
struct mntent *mnt;
char buf[64];
/* Find the mount entry. */
if ((mnt = util_mntent(devname)) == NULL)
misc_die ("resize_reiserfs: can't find mount entry\n");
sprintf(buf,"resize=%lld", blocks);
if (mount(mnt->mnt_fsname, mnt->mnt_dir, mnt->mnt_type,
(unsigned long)(MS_MGC_VAL << 16 | MS_REMOUNT), buf))
{
misc_die ("resize_reiserfs: remount failed: %s\n",
strerror(errno));
}
return 0;
}
+26
View File
@@ -0,0 +1,26 @@
/*
* Copyright 2000-2004 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "reiserfs/libreiserfs.h"
#define print_usage_and_exit() {\
fprintf (stderr, "Usage: %s [-s[+|-]#[G|M|K]] [-fqvV] device\n\n", argv[0]);\
exit(16);\
}
/* reiserfs_resize.c */
extern reiserfs_bh_t * g_sb_bh;
extern char * g_progname;
extern int opt_force;
extern int opt_verbose;
extern int opt_nowrite;
extern int opt_safe;
/* fe.c */
extern int resize_fs_online(char * devname, long long int blocks);
/* do_shrink.c */
extern int shrink_fs(reiserfs_filsys_t *, long long int blocks);
+357
View File
@@ -0,0 +1,357 @@
/*
* Copyright 2000-2004 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "resize.h"
#include "misc/device.h"
#include "misc/malloc.h"
#include "util/device.h"
#include "util/print.h"
#include <getopt.h>
#include <errno.h>
#include <fcntl.h>
int opt_banner = 0;
int opt_force = 0;
int opt_verbose = 1; /* now "verbose" option is default */
int opt_nowrite = 0;
int opt_safe = 0;
int opt_skipj = 0;
/* calculate the new fs size (in blocks) from old fs size and the string
representation of new size */
static long long int calc_new_fs_size(unsigned long count,
unsigned int bs,
char *bytes_str)
{
long long int bytes;
long long int blocks;
char *end;
int rel;
end = bytes_str + strlen(bytes_str) - 1;
rel = bytes_str[0] == '+' || bytes_str[0] == '-';
bytes = strtoll(bytes_str, &bytes_str, 10);
/* Some error occured while convertion or the specified
string is not valid. */
if (bytes == LONG_LONG_MIN || bytes == LONG_LONG_MAX ||
(bytes_str != end && bytes_str != end + 1))
return -EINVAL;
switch (*end) {
case 'G':
case 'g':
bytes *= 1024;
case 'M':
case 'm':
bytes *= 1024;
case 'K':
case 'k':
bytes *= 1024;
}
blocks = bytes / bs;
return rel ? count + blocks : blocks;
}
/* print some fs parameters */
static void sb_report(reiserfs_sb_t * sb1,
reiserfs_sb_t * sb2)
{
printf(
"ReiserFS report:\n"
"blocksize %d\n"
"block count %d (%d)\n"
"free blocks %d (%d)\n"
"bitmap block count %d (%d)\n",
reiserfs_sb_get_blksize(sb1),
reiserfs_sb_get_blocks(sb1), reiserfs_sb_get_blocks(sb2),
reiserfs_sb_get_free(sb1), reiserfs_sb_get_free(sb2),
reiserfs_sb_get_bmaps(sb1), reiserfs_sb_get_bmaps(sb2));
};
/* conditional bwrite */
static int bwrite_cond (reiserfs_bh_t * bh)
{
if(!opt_nowrite) {
reiserfs_buffer_mkuptodate(bh,1);
reiserfs_buffer_mkdirty(bh);
reiserfs_buffer_write(bh);
}
return 0;
}
/* the first one of the most important functions */
static int expand_fs (reiserfs_filsys_t * fs, long long int block_count_new) {
unsigned int bmap_nr_new, bmap_nr_old;
unsigned int block_count_old;
reiserfs_sb_t * sb;
unsigned int i;
reiserfs_fs_reopen(fs, O_RDWR);
if (reiserfs_bitmap_open(fs))
reiserfs_exit(1, "cannot open ondisk bitmap");
sb = fs->fs_ondisk_sb;
reiserfs_sb_set_state (fs->fs_ondisk_sb, FS_ERROR);
bwrite_cond(fs->fs_super_bh);
if (reiserfs_bitmap_expand (fs->fs_bitmap2, block_count_new))
reiserfs_exit(1, "cannot expand bitmap\n");
/* count bitmap blocks in new fs */
block_count_old = reiserfs_sb_get_blocks(sb);
bmap_nr_old = reiserfs_bmap_nr(block_count_old, fs->fs_blocksize);
bmap_nr_new = reiserfs_bmap_nr(block_count_new, fs->fs_blocksize);
/* update super block buffer*/
reiserfs_sb_set_free (sb, reiserfs_sb_get_free(sb) +
(block_count_new - reiserfs_sb_get_blocks(sb)) -
(bmap_nr_new - bmap_nr_old));
reiserfs_sb_set_blocks (sb, block_count_new);
reiserfs_sb_set_bmaps (sb, reiserfs_bmap_over(bmap_nr_new) ?
0 : bmap_nr_new);
/* mark new bitmap blocks as used */
for (i = bmap_nr_old; i < bmap_nr_new; i++)
reiserfs_bitmap_set_bit (fs->fs_bitmap2, i * fs->fs_blocksize * 8);
/* normally, this is done by reiserfs_bitmap_set_bit, but if we
** haven't actually added any bitmap blocks, the bitmap won't be dirtied.
**
** In memory, reiserfsprogs puts zeros for the bits past the end of
** the old filesystem. But, on disk that bitmap is full of ones.
** we explicitly dirty the bitmap here to make sure the zeros get written
** to disk
*/
fs->fs_bitmap2->bm_dirty = 1 ;
return 0;
}
static int resizer_check_fs_size(reiserfs_filsys_t *fs, long long int new_size) {
if (new_size < 0) {
reiserfs_warning(stderr, "\nresizer_reiserfs: the new size "
"value is wrong.\n\n");
return new_size;
}
if (new_size == reiserfs_sb_get_blocks(fs->fs_ondisk_sb)) {
reiserfs_warning (stderr, "%s already is of the needed size. "
"Nothing to be done\n\n", fs->fs_file_name);
return 1;
}
if (new_size < reiserfs_sb_get_blocks(fs->fs_ondisk_sb)) {
if (util_device_mounted(fs->fs_file_name) > 0) {
reiserfs_warning (stderr, "Can't shrink filesystem on-line.\n\n");
return 1;
}
}
if (new_size >= reiserfs_sb_get_blocks(fs->fs_ondisk_sb)) {
unsigned long long offset = (unsigned long long)new_size * fs->fs_blocksize - 1;
if(!misc_device_valid_offset(fs->fs_dev, offset)) {
reiserfs_warning (stderr, "%s is of %lu blocks size only with "
"reiserfs of %d blocks\nsize on it. You are "
"trying to expand reiserfs up to %lu blocks "
"size.\nYou probably forgot to expand your "
"partition size.\n\n", fs->fs_file_name,
misc_device_count_blocks(fs->fs_file_name, fs->fs_blocksize),
reiserfs_sb_get_blocks(fs->fs_ondisk_sb), new_size);
return 1;
}
}
return 0;
}
int main(int argc, char *argv[]) {
char * bytes_count_str = NULL;
char * devname;
char * jdevice_name = NULL;
reiserfs_filsys_t * fs;
reiserfs_sb_t * sb;
int c;
int error;
reiserfs_sb_t *sb_old;
long long int block_count_new;
if (argc < 2)
print_usage_and_exit();
while ((c = getopt(argc, argv, "fvcqks:j:V")) != EOF) {
switch (c) {
case 's' :
if (!optarg)
reiserfs_exit(1, "Missing argument to -s option");
bytes_count_str = optarg;
break;
case 'j' :
if (!optarg)
reiserfs_exit(1, "Missing argument to -j option");
jdevice_name = optarg;
case 'f':
opt_force = 1;
break;
case 'v':
opt_verbose++;
break;
case 'n':
/* no nowrite option at this moment */
/* opt_nowrite = 1; */
break;
case 'c':
opt_safe = 1;
break;
case 'q':
opt_verbose = 0;
break;
case 'k':
opt_skipj = 1;
break;
case 'V':
opt_banner++;
break;
default:
print_usage_and_exit ();
}
}
util_print_banner (argv[0]);
if (opt_banner)
exit(0);
devname = argv[optind];
fs = reiserfs_fs_open(devname, O_RDONLY, &error, 0, 1);
if (!fs) {
if (error) {
reiserfs_exit(1, "cannot open '%s': %s",
devname, strerror(error));
} else {
exit(1);
}
}
if (reiserfs_journal_open (fs, jdevice_name, O_RDWR
#ifdef O_LARGEFILE
| O_LARGEFILE
#endif
))
{
reiserfs_exit(1, "Failed to open the journal device (%s).",
jdevice_name);
}
if (reiserfs_journal_params_check(fs)) {
if (!opt_skipj) {
reiserfs_exit(1, "Wrong journal parameters detected on (%s)",
jdevice_name);
} else {
reiserfs_journal_close(fs);
}
}
/* forced to continue without journal available/specified */
if (fs == NULL) {
reiserfs_exit(1, "no reiserfs found on the device.");
}
if (!reiserfs_bitmap_spread (fs)) {
reiserfs_exit(1, "cannot resize reiserfs in old (not spread "
"bitmap) format.");
}
sb = fs->fs_ondisk_sb;
/* If size change was specified by user, calculate it,
otherwise take the whole device. */
block_count_new = bytes_count_str ?
calc_new_fs_size(reiserfs_sb_get_blocks(sb),
fs->fs_blocksize, bytes_count_str) :
misc_device_count_blocks(devname, fs->fs_blocksize);
if (resizer_check_fs_size(fs, block_count_new))
return 1;
if (util_device_mounted(devname) > 0) {
reiserfs_fs_close(fs);
fs = NULL;
error = resize_fs_online(devname, block_count_new);
reiserfs_warning(stderr, "\n\nresize_reiserfs: On-line resizing %s.\n\n",
error ? "failed" : "finished successfully");
return error;
}
if (!reiserfs_sb_state_ok (fs)) {
reiserfs_warning (stderr, "\n\nresize_reiserfs: run reiserfsck --check "
"first\n\n");
reiserfs_fs_close (fs);
fs = NULL;
return 1;
}
if (reiserfs_sb_get_umount(sb) != FS_CLEANLY_UMOUNTED)
/* fixme: shouldn't we check for something like: fsck guarantees: fs is ok */
reiserfs_exit(1, "the file system isn't in valid state.");
/* Needed to keep idiot compiler from issuing false warning */
sb_old = 0;
/* save SB for reporting */
if(opt_verbose) {
sb_old = misc_getmem(REISERFS_SB_SIZE);
memcpy(sb_old, fs->fs_ondisk_sb, REISERFS_SB_SIZE);
}
error = (block_count_new > reiserfs_sb_get_blocks(fs->fs_ondisk_sb)) ?
expand_fs(fs, block_count_new) : shrink_fs(fs, block_count_new);
if (error) {
reiserfs_warning(stderr, "\n\nresize_reiserfs: Resizing failed.\n\n ");
return error;
}
if(opt_verbose) {
sb_report(fs->fs_ondisk_sb, sb_old);
misc_freemem(sb_old);
}
reiserfs_sb_set_state (fs->fs_ondisk_sb, FS_CONSISTENT);
bwrite_cond(fs->fs_super_bh);
if (opt_verbose) {
printf("\nSyncing..");
fflush(stdout);
}
reiserfs_fs_close (fs);
if (opt_verbose)
printf("done\n");
reiserfs_warning(stderr, "\n\nresize_reiserfs: Resizing finished "
"successfully.\n\n ");
return 0;
}
+122
View File
@@ -0,0 +1,122 @@
.\" -*- nroff -*-
.\" Copyright 1996-2004 Hans Reiser.
.\"
.TH resizefs.reiserfs 8 "January 2004" "Reiserfsprogs-3.6.19"
.SH NAME
resizefs.reiserfs \- resizer tool for the ReiserFS filesystem
.SH SYNOPSIS
.BR resizefs.reiserfs
[
.B \-s
.IR \fR[\fB+\fR|\fB\- ]\fIsize\fB[\fBK\fR|\fBM\fR|\fBG\fR]
] [
.B \-j
.IR \fR\fIdev
] [
.B \-fqv
]
.I device
.SH DESCRIPTION
The
.B resizefs.reiserfs
tool resizes an unmounted reiserfs file system. It enlarges or shrinks an
reiserfs file system located on a
.I device
so that it will have
.I size
bytes or size=old_size +(\-)
.I size
bytes if the + or \- prefix is used.
If the
.B \-s
option is not specified, the filesystem will be resized to fill the
given device.
The
.I size
parameter may have one of the optional modifiers
.BR K ", " M ", " G ,
which means the
.I size
parameter is given in kilo\-, mega\-, gigabytes respectively.
.PP
The
.B resizefs.reiserfs
program does not manipulate the size of the device. If you wish to
enlarge a filesystem, you must make sure you expand the underlying
device first. This can be done using
.BR cfdisk (8)
for partitions, by deleting the partition and recreating it with a
larger size (assuming there is free space
.I after
the partition in question). Make sure you re\-create it with the
same starting disk cylinder as before! Otherwise, the resize operation
will certainly not work, and you may lose your entire filesystem.
.PP
The
.B resizefs.reiserfs
program allows to grow a reiserfs on-line if there is a free
space on block
.I device.
.PP
If you wish to shrink a reiserfs partition, first use
.B resizefs.reiserfs
to shrink the file system. You may then use
.BR cfdisk (8)
to shrink the device. When shrinking the size of the device, make sure
you do not make it smaller than the reduced size of the reiserfs filesystem.
.SH OPTIONS
.TP
.BR \-s\ [+|\-]\fIsize
Set the new size in bytes.
.TP
.BR \-j\ \fIdev
Set the journal device name.
.TP
.BR \-f
Force, do not perform checks.
.TP
.BR \-q
Do not print anything but error messages.
.TP
.BR \-v
Turn on extra progress status messages (default).
.SH RETURN VALUES
0 Resizing successful.
.TP
\-1 Resizing not successful.
.SH EXAMPLES
The following example shows how to test
.B resizefs.reiserfs\fR.
Suppose 2Gb reiserfs filesystem is created on the device /dev/hda8
and is mounted on /mnt.
For shrinking the device we need to unmount it first, then run
.B resizefs.reiserfs
with a
.I size \fR parameter (in this case -1Gb):
.PP
\ df
.br
\ umount /mnt
.br
\ resizefs.reiserfs -s -1G /dev/hda8
.br
\ mount /dev/hda8 /mnt
.br
\ df /mnt
.SH AUTHOR
This version of
.B resizefs.reiserfs
has been written by Alexander Zarochentcev <zam@namesys.com>.
.SH BUGS
Please report bugs to the ReiserFS developers <reiserfs-dev@namesys.com>, providing
as much information as possible--your hardware, kernel, patches, settings, all printed
messages; check the syslog file for any related information.
.SH SEE ALSO
.BR cfdisk (8),
.BR fsck.reiserfs (8),
.BR debugfs.reiserfs (8)