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

+7
View File
@@ -0,0 +1,7 @@
noinst_LIBRARIES = libutil-static.a
libutil_static_a_SOURCES = badblock.c device.c misc.c mntent.c print.c
libutil_static_a_LIBADD = $(top_builddir)/libmisc/libmisc-static.a
libutil_static_a_CFLAGS = @CFLAGS@
INCLUDES = -I$(top_srcdir)/include
+469
View File
@@ -0,0 +1,469 @@
# 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 = $(libutil_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 = libutil
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
libutil_static_a_AR = $(AR) $(ARFLAGS)
libutil_static_a_DEPENDENCIES = \
$(top_builddir)/libmisc/libmisc-static.a
am_libutil_static_a_OBJECTS = libutil_static_a-badblock.$(OBJEXT) \
libutil_static_a-device.$(OBJEXT) \
libutil_static_a-misc.$(OBJEXT) \
libutil_static_a-mntent.$(OBJEXT) \
libutil_static_a-print.$(OBJEXT)
libutil_static_a_OBJECTS = $(am_libutil_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 = $(libutil_static_a_SOURCES)
DIST_SOURCES = $(libutil_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 = libutil-static.a
libutil_static_a_SOURCES = badblock.c device.c misc.c mntent.c print.c
libutil_static_a_LIBADD = $(top_builddir)/libmisc/libmisc-static.a
libutil_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 libutil/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu libutil/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)
libutil-static.a: $(libutil_static_a_OBJECTS) $(libutil_static_a_DEPENDENCIES)
-rm -f libutil-static.a
$(libutil_static_a_AR) libutil-static.a $(libutil_static_a_OBJECTS) $(libutil_static_a_LIBADD)
$(RANLIB) libutil-static.a
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutil_static_a-badblock.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutil_static_a-device.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutil_static_a-misc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutil_static_a-mntent.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutil_static_a-print.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) '$<'`
libutil_static_a-badblock.o: badblock.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libutil_static_a_CFLAGS) $(CFLAGS) -MT libutil_static_a-badblock.o -MD -MP -MF "$(DEPDIR)/libutil_static_a-badblock.Tpo" -c -o libutil_static_a-badblock.o `test -f 'badblock.c' || echo '$(srcdir)/'`badblock.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libutil_static_a-badblock.Tpo" "$(DEPDIR)/libutil_static_a-badblock.Po"; else rm -f "$(DEPDIR)/libutil_static_a-badblock.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='badblock.c' object='libutil_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) $(libutil_static_a_CFLAGS) $(CFLAGS) -c -o libutil_static_a-badblock.o `test -f 'badblock.c' || echo '$(srcdir)/'`badblock.c
libutil_static_a-badblock.obj: badblock.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libutil_static_a_CFLAGS) $(CFLAGS) -MT libutil_static_a-badblock.obj -MD -MP -MF "$(DEPDIR)/libutil_static_a-badblock.Tpo" -c -o libutil_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)/libutil_static_a-badblock.Tpo" "$(DEPDIR)/libutil_static_a-badblock.Po"; else rm -f "$(DEPDIR)/libutil_static_a-badblock.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='badblock.c' object='libutil_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) $(libutil_static_a_CFLAGS) $(CFLAGS) -c -o libutil_static_a-badblock.obj `if test -f 'badblock.c'; then $(CYGPATH_W) 'badblock.c'; else $(CYGPATH_W) '$(srcdir)/badblock.c'; fi`
libutil_static_a-device.o: device.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libutil_static_a_CFLAGS) $(CFLAGS) -MT libutil_static_a-device.o -MD -MP -MF "$(DEPDIR)/libutil_static_a-device.Tpo" -c -o libutil_static_a-device.o `test -f 'device.c' || echo '$(srcdir)/'`device.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libutil_static_a-device.Tpo" "$(DEPDIR)/libutil_static_a-device.Po"; else rm -f "$(DEPDIR)/libutil_static_a-device.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='device.c' object='libutil_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) $(libutil_static_a_CFLAGS) $(CFLAGS) -c -o libutil_static_a-device.o `test -f 'device.c' || echo '$(srcdir)/'`device.c
libutil_static_a-device.obj: device.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libutil_static_a_CFLAGS) $(CFLAGS) -MT libutil_static_a-device.obj -MD -MP -MF "$(DEPDIR)/libutil_static_a-device.Tpo" -c -o libutil_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)/libutil_static_a-device.Tpo" "$(DEPDIR)/libutil_static_a-device.Po"; else rm -f "$(DEPDIR)/libutil_static_a-device.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='device.c' object='libutil_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) $(libutil_static_a_CFLAGS) $(CFLAGS) -c -o libutil_static_a-device.obj `if test -f 'device.c'; then $(CYGPATH_W) 'device.c'; else $(CYGPATH_W) '$(srcdir)/device.c'; fi`
libutil_static_a-misc.o: misc.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libutil_static_a_CFLAGS) $(CFLAGS) -MT libutil_static_a-misc.o -MD -MP -MF "$(DEPDIR)/libutil_static_a-misc.Tpo" -c -o libutil_static_a-misc.o `test -f 'misc.c' || echo '$(srcdir)/'`misc.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libutil_static_a-misc.Tpo" "$(DEPDIR)/libutil_static_a-misc.Po"; else rm -f "$(DEPDIR)/libutil_static_a-misc.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libutil_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) $(libutil_static_a_CFLAGS) $(CFLAGS) -c -o libutil_static_a-misc.o `test -f 'misc.c' || echo '$(srcdir)/'`misc.c
libutil_static_a-misc.obj: misc.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libutil_static_a_CFLAGS) $(CFLAGS) -MT libutil_static_a-misc.obj -MD -MP -MF "$(DEPDIR)/libutil_static_a-misc.Tpo" -c -o libutil_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)/libutil_static_a-misc.Tpo" "$(DEPDIR)/libutil_static_a-misc.Po"; else rm -f "$(DEPDIR)/libutil_static_a-misc.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libutil_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) $(libutil_static_a_CFLAGS) $(CFLAGS) -c -o libutil_static_a-misc.obj `if test -f 'misc.c'; then $(CYGPATH_W) 'misc.c'; else $(CYGPATH_W) '$(srcdir)/misc.c'; fi`
libutil_static_a-mntent.o: mntent.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libutil_static_a_CFLAGS) $(CFLAGS) -MT libutil_static_a-mntent.o -MD -MP -MF "$(DEPDIR)/libutil_static_a-mntent.Tpo" -c -o libutil_static_a-mntent.o `test -f 'mntent.c' || echo '$(srcdir)/'`mntent.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libutil_static_a-mntent.Tpo" "$(DEPDIR)/libutil_static_a-mntent.Po"; else rm -f "$(DEPDIR)/libutil_static_a-mntent.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mntent.c' object='libutil_static_a-mntent.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) $(libutil_static_a_CFLAGS) $(CFLAGS) -c -o libutil_static_a-mntent.o `test -f 'mntent.c' || echo '$(srcdir)/'`mntent.c
libutil_static_a-mntent.obj: mntent.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libutil_static_a_CFLAGS) $(CFLAGS) -MT libutil_static_a-mntent.obj -MD -MP -MF "$(DEPDIR)/libutil_static_a-mntent.Tpo" -c -o libutil_static_a-mntent.obj `if test -f 'mntent.c'; then $(CYGPATH_W) 'mntent.c'; else $(CYGPATH_W) '$(srcdir)/mntent.c'; fi`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libutil_static_a-mntent.Tpo" "$(DEPDIR)/libutil_static_a-mntent.Po"; else rm -f "$(DEPDIR)/libutil_static_a-mntent.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mntent.c' object='libutil_static_a-mntent.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) $(libutil_static_a_CFLAGS) $(CFLAGS) -c -o libutil_static_a-mntent.obj `if test -f 'mntent.c'; then $(CYGPATH_W) 'mntent.c'; else $(CYGPATH_W) '$(srcdir)/mntent.c'; fi`
libutil_static_a-print.o: print.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libutil_static_a_CFLAGS) $(CFLAGS) -MT libutil_static_a-print.o -MD -MP -MF "$(DEPDIR)/libutil_static_a-print.Tpo" -c -o libutil_static_a-print.o `test -f 'print.c' || echo '$(srcdir)/'`print.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libutil_static_a-print.Tpo" "$(DEPDIR)/libutil_static_a-print.Po"; else rm -f "$(DEPDIR)/libutil_static_a-print.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='print.c' object='libutil_static_a-print.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) $(libutil_static_a_CFLAGS) $(CFLAGS) -c -o libutil_static_a-print.o `test -f 'print.c' || echo '$(srcdir)/'`print.c
libutil_static_a-print.obj: print.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libutil_static_a_CFLAGS) $(CFLAGS) -MT libutil_static_a-print.obj -MD -MP -MF "$(DEPDIR)/libutil_static_a-print.Tpo" -c -o libutil_static_a-print.obj `if test -f 'print.c'; then $(CYGPATH_W) 'print.c'; else $(CYGPATH_W) '$(srcdir)/print.c'; fi`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libutil_static_a-print.Tpo" "$(DEPDIR)/libutil_static_a-print.Po"; else rm -f "$(DEPDIR)/libutil_static_a-print.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='print.c' object='libutil_static_a-print.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) $(libutil_static_a_CFLAGS) $(CFLAGS) -c -o libutil_static_a-print.obj `if test -f 'print.c'; then $(CYGPATH_W) 'print.c'; else $(CYGPATH_W) '$(srcdir)/print.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:
+62
View File
@@ -0,0 +1,62 @@
/*
* Copyright 2000-2004 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "util/badblock.h"
int util_badblock_load (reiserfs_filsys_t * fs, char * badblocks_file) {
FILE * fd;
char buf[128];
__u32 blocknr;
int count;
fs->fs_badblocks_bm =
reiserfs_bitmap_create(reiserfs_sb_get_blocks(fs->fs_ondisk_sb));
reiserfs_bitmap_zero (fs->fs_badblocks_bm);
if (!badblocks_file)
return 0;
fd = fopen (badblocks_file, "r");
if (fd == NULL) {
fprintf (stderr, "%s: Failed to open the given badblock file '%s'.\n\n",
__FUNCTION__, badblocks_file);
return 1;
}
while (!feof (fd)) {
if (fgets(buf, sizeof(buf), fd) == NULL)
break;
count = sscanf(buf, "%u", &blocknr);
if (count <= 0)
continue;
if (blocknr >= reiserfs_sb_get_blocks (fs->fs_ondisk_sb)) {
fprintf (stderr, "%s: block number (%u) points out of fs size "
"(%u).\n", __FUNCTION__, blocknr,
reiserfs_sb_get_blocks(fs->fs_ondisk_sb));
} else if (reiserfs_fs_block(fs, blocknr) != BT_UNKNOWN) {
fprintf (stderr, "%s: block number (%u) belongs to system "
"reiserfs area. It cannot be relocated.\n",
__FUNCTION__, blocknr);
return 1;
} else {
reiserfs_bitmap_set_bit (fs->fs_badblocks_bm, blocknr);
}
}
fclose (fd);
return 0;
}
+258
View File
@@ -0,0 +1,258 @@
/*
* Copyright 1996-2004 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "util/device.h"
#include "util/print.h"
#include "util/mntent.h"
#include "misc/device.h"
#include "misc/types.h"
#include "misc/misc.h"
#include "reiserfs/print.h"
#include <linux/hdreg.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <mntent.h>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <errno.h>
#include <utime.h>
#include <assert.h>
#define reiserfs_confirm(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 (!util_user_confirmed (stderr, "Continue (y/n):", "y\n"))\
return 0;\
}\
/* 0 - dma is not supported, scsi or regular file */
/* 1 - xt drive */
/* 2 - ide drive */
static void get_dma_support(util_device_dma_t *dma_info, struct stat *st){
if (S_ISREG(st->st_mode))
st->st_rdev = st->st_dev;
if (IDE_DISK_MAJOR(major(st->st_rdev))) {
dma_info->support_type = 2;
return;
}
#ifdef XT_DISK_MAJOR
if (major(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 util_device_dma_prep(util_device_dma_t *dma_info) {
struct stat st;
char buf[4096];
dev_t rdev;
int rem;
int res;
#ifndef HDIO_GET_DMA
return -1;
#endif
if (fstat(dma_info->fd, &st))
misc_die("stat on device failed\n");
get_dma_support(dma_info, &st);
/* dma should be supported */
if (dma_info->support_type == 0)
return 1;
if (dma_info->support_type == 1)
return 0;
rdev = dma_info->st_rdev = st.st_rdev;
/* If it is the whole device? no preparation needed then. */
if ((rem = (minor(rdev) % 64)) == 0)
return 0;
dma_info->st_rdev -= rem;
strcpy(buf, "/dev");
if ((res = misc_dir_walk(buf, misc_device_rdev_match, &dma_info->st_rdev)) <= 0) {
dma_info->st_rdev += rem;
dma_info->support_type = 1;
return res;
}
/* Matched block device file found. Open it. */
dma_info->fd = open(buf, O_RDONLY
#if defined(O_LARGEFILE)
| O_LARGEFILE
#endif
);
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 util_device_get_dma(util_device_dma_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 util_device_dma_fini(int fd, util_device_dma_t *dma_info) {
signal(SIGALRM, SIG_IGN);
if (dma_info->fd && fd != dma_info->fd)
close(dma_info->fd);
}
FILE * util_file_open (char * filename, char * option)
{
FILE * fp = fopen (filename, option);
if (!fp) {
reiserfs_warning (stderr, "util_file_open: could not "
"open file %s\n", filename);
return 0;
}
reiserfs_warning (stderr, "Temp file opened by fsck: "
"\"%s\" .. \n", filename);
return fp;
}
/* we only can use a file for filesystem or journal if it is either not
mounted block device or regular file and we are forced to use it */
int util_device_formatable (char * device_name, int force)
{
mode_t mode;
dev_t rdev;
if (util_device_mounted(device_name) > 0) {
/* device looks mounted */
reiserfs_warning (stderr, "'%s' looks mounted.", device_name);
reiserfs_confirm (force);
}
mode = misc_device_mode(device_name);
rdev = misc_device_rdev(device_name);
if (!S_ISBLK (mode)) {
/* file is not a block device */
reiserfs_warning (stderr, "%s is not a block special device\n", device_name);
reiserfs_confirm (force);
} else {
if ((IDE_DISK_MAJOR (major(rdev)) && minor(rdev) % 64 == 0) ||
(SCSI_BLK_MAJOR (major(rdev)) && minor(rdev) % 16 == 0)) {
/* /dev/hda or similar */
reiserfs_warning (stderr, "%s is entire device, not just one partition!\n",
device_name);
reiserfs_confirm (force);
}
}
return 1;
}
int util_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;
}
int util_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 (util_root_mounted(device) == 1) {
return util_file_ro("/") ? MF_RO : MF_RW;
}
/* Lookup the mount entry. */
if ((mnt = util_mntent(device)) == NULL) {
return MF_NOT_MOUNTED;
} else if (mnt == INVAL_PTR) {
return 0;
}
return hasmntopt(mnt, MNTOPT_RO) ? MF_RO : MF_RW;
}
int util_file_ro(char *file) {
if (utime(file, 0) == -1) {
if (errno == EROFS)
return 1;
}
return 0;
}
+225
View File
@@ -0,0 +1,225 @@
/*
* Copyright 2000-2004 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "util/misc.h"
#include "misc/malloc.h"
#include "misc/misc.h"
#include <time.h>
#include <stdlib.h>
#include <string.h>
char buf1 [100];
char buf2 [100];
static time_t t0 = 0, t1 = 0, t2 = 0;
void util_misc_speed (FILE *fp, unsigned long passed,
unsigned long total, int cursor_pos,
int reset_time)
{
int speed;
int indent;
if (passed == 0)
reset_time = 1;
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 if (reset_time) {
speed = 0;
} else {
return;
}
/* what has to be written */
if (reset_time)
buf1[0] = 0;
else 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 (fp, "%s%s", buf2, buf1);
memset (buf2, '\b', indent + strlen (buf1));
buf2 [indent + strlen (buf1)] = 0;
fprintf (fp, "%s", buf2);
fflush (fp);
}
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 util_misc_progress (FILE * fp, unsigned long * passed,
unsigned long total, unsigned int inc,
int forward)
{
int percent;
if (*passed == 0)
current_progress[0] = 0;
(*passed) += inc;
if (*passed > total) {
/* fprintf (fp, "\nutil_misc_progress: 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 (forward != 2) {
util_misc_speed(fp, *passed /* - inc*/, forward ? 0 : total,
strlen (progress_to_be), (*passed == inc) ? 1 : 0);
}
fflush (fp);
}
static int screen_width = 0;
static int screen_curr_pos = 0;
static char *screen_savebuffer;
static int screen_savebuffer_len;
void screen_init() {
char *width;
width = getenv("COLUMNS");
if ( width )
screen_width = atoi(width);
if (screen_width == 0)
screen_width = 80; // We default to 80 characters wide screen
screen_width--;
screen_savebuffer_len=screen_width;
screen_savebuffer=misc_getmem(screen_width+1);
memset(screen_savebuffer,0,screen_savebuffer_len+1);
}
void util_misc_name (FILE * fp) {
static int printed_len = 0;
int i;
if (screen_curr_pos == 0 || t0 == 0) {
/* Start the new progress. */
time (&t0);
t2 = t0;
} else {
time (&t1);
if (t1 - t2 < 1)
return;
t2 = t1;
}
if (screen_width && screen_curr_pos >= screen_width ) {
fprintf(fp, "... %.*s", screen_width - 4,
screen_savebuffer + ( screen_curr_pos - (screen_width - 4)));
printed_len = screen_width;
} else if (screen_width) {
fprintf(fp, "%s", screen_savebuffer);
for (i = 0; i <= printed_len - screen_curr_pos ; i++)
fprintf(fp, " ");
printed_len = screen_curr_pos;
}
fprintf(fp, "\r");
fflush (fp);
}
/* semantic pass progress */
void util_misc_print_name (FILE *fp, char * name, int len) {
int i;
if (screen_width == 0)
screen_init();
if ( len + screen_curr_pos + 1 > screen_savebuffer_len) {
char *t;
t = misc_expandmem(screen_savebuffer, screen_savebuffer_len + 1,
len + screen_curr_pos - screen_savebuffer_len + 1);
if (!t) {
return; // ????
}
screen_savebuffer = t;
screen_savebuffer_len = len + screen_curr_pos + 1;
}
strcat(screen_savebuffer,"/");
strncat(screen_savebuffer,name,len);
i = screen_curr_pos;
screen_curr_pos += len+1;
for ( ; i<screen_curr_pos; i++)
if ( screen_savebuffer[i] < 32 )
screen_savebuffer[i] = '?';
screen_savebuffer[screen_curr_pos]=0;
util_misc_name(fp);
}
void util_misc_erase_name (FILE * fp, int len) {
screen_curr_pos-=(len+1);
if (screen_curr_pos < 0 )
misc_die("%s: Get out of buffer's data!\n", __FUNCTION__);
screen_savebuffer[screen_curr_pos]=0;
}
void util_misc_fini_name (FILE * fp) {
screen_curr_pos = 0;
util_misc_name(fp);
}
+164
View File
@@ -0,0 +1,164 @@
/*
* Copyright 1996-2004 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
/* 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. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "misc/types.h"
#include "util/device.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/vfs.h>
#include <mntent.h>
#include <assert.h>
#include <stdio.h>
static struct mntent *util_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;
}
struct mntent *util_mntent(char *device) {
int proc = 0, path = 0, root = 0;
struct mntent *mnt;
struct statfs stfs;
assert(device != NULL);
/* Check if the root. */
if (util_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 = util_mntent_lookup("/proc/mounts", "/", 1);
} else {
/* Lookup the @device /proc/mounts */
mnt = util_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 (!util_file_ro(MOUNTED)) {
path = 1;
if (root) {
mnt = util_mntent_lookup(MOUNTED, "/", 1);
} else {
mnt = util_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;
}
+33
View File
@@ -0,0 +1,33 @@
/*
* Copyright 1996-2004 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "util/print.h"
#include <string.h>
int util_user_confirmed (FILE * fp, char * q, char * yes) {
char answer[4096];
fprintf (fp, "%s", q);
if (fgets(answer, sizeof(answer), stdin) == NULL ||
(strlen(answer) != strlen(yes) || strcmp(yes, answer)))
{
return 0;
}
return 1;
}
#define BANNER \
"Copyright (C) 2001-2005 by Hans Reiser, " \
"licensing governed by reiserfsprogs/COPYING."
void util_print_banner(char *name) {
fprintf(stderr, "%s %s\n%s\n", name, VERSION, BANNER);
}