Imported reiserfsprogs-3.6.20
This commit is contained in:
1 parent
0ed773997f
commit
dac518d099
189 files changed
+43353
-29787
No files matched your search
@@ -0,0 +1,6 @@
|
||||
noinst_LIBRARIES = libmisc-static.a
|
||||
|
||||
libmisc_static_a_SOURCES = bitops.c device.c malloc.c misc.c
|
||||
libmisc_static_a_CFLAGS = @CFLAGS@
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include
|
||||
@@ -0,0 +1,451 @@
|
||||
# Makefile.in generated by automake 1.9.5 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
SOURCES = $(libmisc_static_a_SOURCES)
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = libmisc
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LIBRARIES = $(noinst_LIBRARIES)
|
||||
AR = ar
|
||||
ARFLAGS = cru
|
||||
libmisc_static_a_AR = $(AR) $(ARFLAGS)
|
||||
libmisc_static_a_LIBADD =
|
||||
am_libmisc_static_a_OBJECTS = libmisc_static_a-bitops.$(OBJEXT) \
|
||||
libmisc_static_a-device.$(OBJEXT) \
|
||||
libmisc_static_a-malloc.$(OBJEXT) \
|
||||
libmisc_static_a-misc.$(OBJEXT)
|
||||
libmisc_static_a_OBJECTS = $(am_libmisc_static_a_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(libmisc_static_a_SOURCES)
|
||||
DIST_SOURCES = $(libmisc_static_a_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
||||
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PROGS_LDFLAGS = @PROGS_LDFLAGS@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
UUID_LIBS = @UUID_LIBS@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
noinst_LIBRARIES = libmisc-static.a
|
||||
libmisc_static_a_SOURCES = bitops.c device.c malloc.c misc.c
|
||||
libmisc_static_a_CFLAGS = @CFLAGS@
|
||||
INCLUDES = -I$(top_srcdir)/include
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .obj
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libmisc/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu libmisc/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
clean-noinstLIBRARIES:
|
||||
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
|
||||
libmisc-static.a: $(libmisc_static_a_OBJECTS) $(libmisc_static_a_DEPENDENCIES)
|
||||
-rm -f libmisc-static.a
|
||||
$(libmisc_static_a_AR) libmisc-static.a $(libmisc_static_a_OBJECTS) $(libmisc_static_a_LIBADD)
|
||||
$(RANLIB) libmisc-static.a
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmisc_static_a-bitops.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmisc_static_a-device.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmisc_static_a-malloc.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmisc_static_a-misc.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
libmisc_static_a-bitops.o: bitops.c
|
||||
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -MT libmisc_static_a-bitops.o -MD -MP -MF "$(DEPDIR)/libmisc_static_a-bitops.Tpo" -c -o libmisc_static_a-bitops.o `test -f 'bitops.c' || echo '$(srcdir)/'`bitops.c; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmisc_static_a-bitops.Tpo" "$(DEPDIR)/libmisc_static_a-bitops.Po"; else rm -f "$(DEPDIR)/libmisc_static_a-bitops.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bitops.c' object='libmisc_static_a-bitops.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -c -o libmisc_static_a-bitops.o `test -f 'bitops.c' || echo '$(srcdir)/'`bitops.c
|
||||
|
||||
libmisc_static_a-bitops.obj: bitops.c
|
||||
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -MT libmisc_static_a-bitops.obj -MD -MP -MF "$(DEPDIR)/libmisc_static_a-bitops.Tpo" -c -o libmisc_static_a-bitops.obj `if test -f 'bitops.c'; then $(CYGPATH_W) 'bitops.c'; else $(CYGPATH_W) '$(srcdir)/bitops.c'; fi`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmisc_static_a-bitops.Tpo" "$(DEPDIR)/libmisc_static_a-bitops.Po"; else rm -f "$(DEPDIR)/libmisc_static_a-bitops.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bitops.c' object='libmisc_static_a-bitops.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -c -o libmisc_static_a-bitops.obj `if test -f 'bitops.c'; then $(CYGPATH_W) 'bitops.c'; else $(CYGPATH_W) '$(srcdir)/bitops.c'; fi`
|
||||
|
||||
libmisc_static_a-device.o: device.c
|
||||
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -MT libmisc_static_a-device.o -MD -MP -MF "$(DEPDIR)/libmisc_static_a-device.Tpo" -c -o libmisc_static_a-device.o `test -f 'device.c' || echo '$(srcdir)/'`device.c; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmisc_static_a-device.Tpo" "$(DEPDIR)/libmisc_static_a-device.Po"; else rm -f "$(DEPDIR)/libmisc_static_a-device.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='device.c' object='libmisc_static_a-device.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -c -o libmisc_static_a-device.o `test -f 'device.c' || echo '$(srcdir)/'`device.c
|
||||
|
||||
libmisc_static_a-device.obj: device.c
|
||||
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -MT libmisc_static_a-device.obj -MD -MP -MF "$(DEPDIR)/libmisc_static_a-device.Tpo" -c -o libmisc_static_a-device.obj `if test -f 'device.c'; then $(CYGPATH_W) 'device.c'; else $(CYGPATH_W) '$(srcdir)/device.c'; fi`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmisc_static_a-device.Tpo" "$(DEPDIR)/libmisc_static_a-device.Po"; else rm -f "$(DEPDIR)/libmisc_static_a-device.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='device.c' object='libmisc_static_a-device.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -c -o libmisc_static_a-device.obj `if test -f 'device.c'; then $(CYGPATH_W) 'device.c'; else $(CYGPATH_W) '$(srcdir)/device.c'; fi`
|
||||
|
||||
libmisc_static_a-malloc.o: malloc.c
|
||||
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -MT libmisc_static_a-malloc.o -MD -MP -MF "$(DEPDIR)/libmisc_static_a-malloc.Tpo" -c -o libmisc_static_a-malloc.o `test -f 'malloc.c' || echo '$(srcdir)/'`malloc.c; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmisc_static_a-malloc.Tpo" "$(DEPDIR)/libmisc_static_a-malloc.Po"; else rm -f "$(DEPDIR)/libmisc_static_a-malloc.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='malloc.c' object='libmisc_static_a-malloc.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -c -o libmisc_static_a-malloc.o `test -f 'malloc.c' || echo '$(srcdir)/'`malloc.c
|
||||
|
||||
libmisc_static_a-malloc.obj: malloc.c
|
||||
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -MT libmisc_static_a-malloc.obj -MD -MP -MF "$(DEPDIR)/libmisc_static_a-malloc.Tpo" -c -o libmisc_static_a-malloc.obj `if test -f 'malloc.c'; then $(CYGPATH_W) 'malloc.c'; else $(CYGPATH_W) '$(srcdir)/malloc.c'; fi`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmisc_static_a-malloc.Tpo" "$(DEPDIR)/libmisc_static_a-malloc.Po"; else rm -f "$(DEPDIR)/libmisc_static_a-malloc.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='malloc.c' object='libmisc_static_a-malloc.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -c -o libmisc_static_a-malloc.obj `if test -f 'malloc.c'; then $(CYGPATH_W) 'malloc.c'; else $(CYGPATH_W) '$(srcdir)/malloc.c'; fi`
|
||||
|
||||
libmisc_static_a-misc.o: misc.c
|
||||
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -MT libmisc_static_a-misc.o -MD -MP -MF "$(DEPDIR)/libmisc_static_a-misc.Tpo" -c -o libmisc_static_a-misc.o `test -f 'misc.c' || echo '$(srcdir)/'`misc.c; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmisc_static_a-misc.Tpo" "$(DEPDIR)/libmisc_static_a-misc.Po"; else rm -f "$(DEPDIR)/libmisc_static_a-misc.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libmisc_static_a-misc.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -c -o libmisc_static_a-misc.o `test -f 'misc.c' || echo '$(srcdir)/'`misc.c
|
||||
|
||||
libmisc_static_a-misc.obj: misc.c
|
||||
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -MT libmisc_static_a-misc.obj -MD -MP -MF "$(DEPDIR)/libmisc_static_a-misc.Tpo" -c -o libmisc_static_a-misc.obj `if test -f 'misc.c'; then $(CYGPATH_W) 'misc.c'; else $(CYGPATH_W) '$(srcdir)/misc.c'; fi`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmisc_static_a-misc.Tpo" "$(DEPDIR)/libmisc_static_a-misc.Po"; else rm -f "$(DEPDIR)/libmisc_static_a-misc.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libmisc_static_a-misc.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmisc_static_a_CFLAGS) $(CFLAGS) -c -o libmisc_static_a-misc.obj `if test -f 'misc.c'; then $(CYGPATH_W) 'misc.c'; else $(CYGPATH_W) '$(srcdir)/misc.c'; fi`
|
||||
uninstall-info-am:
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LIBRARIES)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-noinstLIBRARIES ctags distclean distclean-compile \
|
||||
distclean-generic distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-exec install-exec-am install-info \
|
||||
install-info-am install-man install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am uninstall-info-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||
* reiserfsprogs/README
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "misc/bitops.h"
|
||||
#include "misc/types.h"
|
||||
|
||||
/* Only le bitops operations are used. */
|
||||
inline int misc_set_bit (unsigned long long nr, void * addr) {
|
||||
__u8 * p, mask;
|
||||
int retval;
|
||||
|
||||
p = (__u8 *)addr;
|
||||
p += nr >> 3;
|
||||
mask = 1 << (nr & 0x7);
|
||||
/*cli();*/
|
||||
retval = (mask & *p) != 0;
|
||||
*p |= mask;
|
||||
/*sti();*/
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
inline int misc_clear_bit (unsigned long long nr, void * addr) {
|
||||
__u8 * p, mask;
|
||||
int retval;
|
||||
|
||||
p = (__u8 *)addr;
|
||||
p += nr >> 3;
|
||||
mask = 1 << (nr & 0x7);
|
||||
/*cli();*/
|
||||
retval = (mask & *p) != 0;
|
||||
*p &= ~mask;
|
||||
/*sti();*/
|
||||
return retval;
|
||||
}
|
||||
|
||||
inline int misc_test_bit(unsigned long long nr, const void * addr) {
|
||||
__u8 * p, mask;
|
||||
|
||||
p = (__u8 *)addr;
|
||||
p += nr >> 3;
|
||||
mask = 1 << (nr & 0x7);
|
||||
return ((mask & *p) != 0);
|
||||
}
|
||||
|
||||
inline unsigned long long misc_find_first_zero_bit (const void *vaddr,
|
||||
unsigned long long size)
|
||||
{
|
||||
const __u8 *p = vaddr, *addr = vaddr;
|
||||
unsigned long long res;
|
||||
|
||||
if (!size)
|
||||
return 0;
|
||||
|
||||
size = (size >> 3) + ((size & 0x7) > 0);
|
||||
while (*p++ == 255) {
|
||||
if (--size == 0)
|
||||
return (unsigned long long)(p - addr) << 3;
|
||||
}
|
||||
|
||||
--p;
|
||||
for (res = 0; res < 8; res++)
|
||||
if (!misc_test_bit (res, p))
|
||||
break;
|
||||
return res + (p - addr) * 8;
|
||||
}
|
||||
|
||||
|
||||
inline unsigned long long misc_find_next_zero_bit (const void *vaddr,
|
||||
unsigned long long size, unsigned long long offset)
|
||||
{
|
||||
const __u8 *addr = vaddr;
|
||||
const __u8 *p = addr + (offset >> 3);
|
||||
int bit = offset & 7;
|
||||
unsigned long long res;
|
||||
|
||||
if (offset >= size)
|
||||
return size;
|
||||
|
||||
if (bit) {
|
||||
/* Look for zero in first char */
|
||||
for (res = bit; res < 8; res++)
|
||||
if (!misc_test_bit (res, p))
|
||||
return res + (p - addr) * 8;
|
||||
p++;
|
||||
}
|
||||
/* No zero yet, search remaining full bytes for a zero */
|
||||
res = misc_find_first_zero_bit (p, size - 8 * (p - addr));
|
||||
return res + (p - addr) * 8;
|
||||
}
|
||||
|
||||
inline unsigned long long misc_find_first_set_bit (const void *vaddr,
|
||||
unsigned long long size)
|
||||
{
|
||||
const __u8 *p = vaddr, *addr = vaddr;
|
||||
unsigned long long res;
|
||||
|
||||
if (!size)
|
||||
return 0;
|
||||
|
||||
size = (size >> 3) + ((size & 0x7) > 0);
|
||||
while (*p++ == 0) {
|
||||
if (--size == 0)
|
||||
return (unsigned long long)(p - addr) << 3;
|
||||
}
|
||||
|
||||
--p;
|
||||
for (res = 0; res < 8; res++)
|
||||
if (misc_test_bit (res, p))
|
||||
break;
|
||||
|
||||
return res + (p - addr) * 8;
|
||||
}
|
||||
|
||||
inline unsigned long long misc_find_next_set_bit(const void *vaddr,
|
||||
unsigned long long size, unsigned long long offset)
|
||||
{
|
||||
const __u8 *addr = vaddr;
|
||||
const __u8 *p = addr + (offset >> 3);
|
||||
int bit = offset & 7;
|
||||
unsigned long long res;
|
||||
|
||||
if (offset >= size)
|
||||
return size;
|
||||
|
||||
if (bit) {
|
||||
/* Look for zero in first char */
|
||||
for (res = bit; res < 8; res++)
|
||||
if (misc_test_bit (res, p))
|
||||
return res + (p - addr) * 8;
|
||||
p++;
|
||||
}
|
||||
/* No set bit yet, search remaining full bytes for a 1 */
|
||||
res = misc_find_first_set_bit (p, size - 8 * (p - addr));
|
||||
return res + (p - addr) * 8;
|
||||
}
|
||||
|
||||
/* there are masks for certain bits */
|
||||
__u16 mask16 (int from, int count)
|
||||
{
|
||||
__u16 mask;
|
||||
|
||||
|
||||
mask = (0xffff >> from);
|
||||
mask <<= from;
|
||||
mask <<= (16 - from - count);
|
||||
mask >>= (16 - from - count);
|
||||
return mask;
|
||||
}
|
||||
|
||||
|
||||
__u32 mask32 (int from, int count)
|
||||
{
|
||||
__u32 mask;
|
||||
|
||||
|
||||
mask = (0xffffffff >> from);
|
||||
mask <<= from;
|
||||
mask <<= (32 - from - count);
|
||||
mask >>= (32 - from - count);
|
||||
return mask;
|
||||
}
|
||||
|
||||
|
||||
__u64 mask64 (int from, int count)
|
||||
{
|
||||
__u64 mask;
|
||||
|
||||
|
||||
mask = (0xffffffffffffffffLL >> from);
|
||||
mask <<= from;
|
||||
mask <<= (64 - from - count);
|
||||
mask >>= (64 - from - count);
|
||||
return mask;
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||
* reiserfsprogs/README
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "misc/device.h"
|
||||
#include "misc/misc.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mount.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#define MISC_DEVICE_STAT(Field, Type) \
|
||||
Type misc_device_##Field(char *device) { \
|
||||
struct stat st; \
|
||||
\
|
||||
if (stat(device, &st) == 0) \
|
||||
return st.st_##Field; \
|
||||
\
|
||||
fprintf(stderr, "Stat of the device '%s' failed.\n", device); \
|
||||
return (Type)-1; \
|
||||
}
|
||||
|
||||
MISC_DEVICE_STAT(mode, mode_t);
|
||||
MISC_DEVICE_STAT(rdev, dev_t);
|
||||
|
||||
int misc_device_valid_offset(int fd, long long int offset) {
|
||||
long long int res;
|
||||
char ch;
|
||||
|
||||
/*res = reiserfs_llseek (fd, offset, 0);*/
|
||||
res = lseek (fd, (off_t)offset, SEEK_SET);
|
||||
if (res < 0)
|
||||
return 0;
|
||||
|
||||
/* if (read (fd, &ch, 1) < 0) does not wirk on files */
|
||||
if (read (fd, &ch, 1) < 1)
|
||||
return 0;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* To not have problem with last sectors on the block device when switching
|
||||
to smaller one. */
|
||||
#define MAX_BS (64 * 1024)
|
||||
|
||||
/* calculates number of blocks in a file. Returns 0 for "sparse"
|
||||
regular files and files other than regular files and block devices */
|
||||
unsigned long misc_device_count_blocks (char * filename, int blocksize)
|
||||
{
|
||||
long long int high, low;
|
||||
int fd;
|
||||
|
||||
fd = open (filename, O_RDONLY);
|
||||
if (fd == -1) {
|
||||
fprintf(stderr, "Failed to open '%s': %s.\n", filename, strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!S_ISBLK(misc_device_mode(filename)) &&
|
||||
!S_ISREG(misc_device_mode(filename)))
|
||||
{
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef BLKGETSIZE64
|
||||
{
|
||||
unsigned long long size;
|
||||
unsigned long sz;
|
||||
|
||||
if (ioctl (fd, BLKGETSIZE64, &size) >= 0) {
|
||||
size = (size / MAX_BS) * MAX_BS / blocksize;
|
||||
sz = size;
|
||||
if ((unsigned long long)sz != size)
|
||||
misc_die ("misc_device_count_blocks: block device too large");
|
||||
|
||||
close(fd);
|
||||
return sz;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef BLKGETSIZE
|
||||
{
|
||||
unsigned long long size;
|
||||
unsigned long sz;
|
||||
|
||||
if (ioctl (fd, BLKGETSIZE, &sz) >= 0) {
|
||||
size = sz;
|
||||
|
||||
close(fd);
|
||||
return (size * 512 / MAX_BS) * MAX_BS / blocksize;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
low = 0;
|
||||
for( high = 1; misc_device_valid_offset (fd, high); high *= 2 )
|
||||
low = high;
|
||||
while (low < high - 1) {
|
||||
const long long int mid = ( low + high ) / 2;
|
||||
|
||||
if (misc_device_valid_offset (fd, mid))
|
||||
low = mid;
|
||||
else
|
||||
high = mid;
|
||||
}
|
||||
|
||||
misc_device_valid_offset (fd, 0);
|
||||
|
||||
close (fd);
|
||||
return (low + 1) * MAX_BS / MAX_BS / blocksize;
|
||||
}
|
||||
|
||||
char misc_device_typec (unsigned short mode)
|
||||
{
|
||||
if (S_ISBLK ((mode_t)mode))
|
||||
return 'b';
|
||||
if (S_ISCHR (mode))
|
||||
return 'c';
|
||||
if (S_ISDIR (mode))
|
||||
return 'd';
|
||||
if (S_ISREG (mode))
|
||||
return '-';
|
||||
if (S_ISFIFO (mode))
|
||||
return 'p';
|
||||
if (S_ISLNK (mode))
|
||||
return 'l';
|
||||
if (S_ISSOCK (mode))
|
||||
return 's';
|
||||
return '?';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||
* reiserfsprogs/README
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "misc/malloc.h"
|
||||
#include "misc/misc.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define MEM_BEGIN "_mem_begin_"
|
||||
#define MEM_END "mem_end"
|
||||
#define MEM_FREED "__free_"
|
||||
#define CONTROL_SIZE (strlen (MEM_BEGIN) + 1 + sizeof (int) + strlen (MEM_END) + 1)
|
||||
|
||||
|
||||
unsigned int misc_memsize(char *p) {
|
||||
char *begin;
|
||||
|
||||
begin = p - strlen (MEM_BEGIN) - 1 - sizeof(int);
|
||||
return *(int *)(begin + strlen (MEM_BEGIN) + 1);
|
||||
}
|
||||
|
||||
|
||||
void misc_checkmem (char * p, int size)
|
||||
{
|
||||
char * begin;
|
||||
char * end;
|
||||
|
||||
begin = p - strlen (MEM_BEGIN) - 1 - sizeof (int);
|
||||
if (strcmp (begin, MEM_BEGIN))
|
||||
misc_die ("misc_checkmem: memory corrupted - invalid head sign");
|
||||
|
||||
if (*(int *)(begin + strlen (MEM_BEGIN) + 1) != size)
|
||||
misc_die ("misc_checkmem: memory corrupted - invalid size");
|
||||
|
||||
end = begin + size + CONTROL_SIZE - strlen (MEM_END) - 1;
|
||||
if (strcmp (end, MEM_END))
|
||||
misc_die ("misc_checkmem: memory corrupted - invalid end sign");
|
||||
}
|
||||
|
||||
|
||||
void *misc_getmem (int size)
|
||||
{
|
||||
char * mem;
|
||||
|
||||
if ((mem = misc_malloc(size)) == NULL)
|
||||
misc_die ("misc_getmem: no more memory (%d)", size);
|
||||
|
||||
memset (mem, 0, size);
|
||||
// misc_checkmem (mem, size);
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
||||
void *misc_malloc(int size) {
|
||||
char * p;
|
||||
char * mem;
|
||||
|
||||
p = (char *)malloc (CONTROL_SIZE + size);
|
||||
if (!p)
|
||||
misc_die ("misc_getmem: no more memory (%d)", size);
|
||||
|
||||
/* Write the MEM_BEGIN magic in the beginning of allocated memory. */
|
||||
strcpy (p, MEM_BEGIN);
|
||||
p += strlen (MEM_BEGIN) + 1;
|
||||
/* Write the size after the magic. */
|
||||
*(int *)p = size;
|
||||
p += sizeof (int);
|
||||
mem = p;
|
||||
p += size;
|
||||
strcpy (p, MEM_END);
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
||||
void * misc_expandmem (void * vp, int size, int by)
|
||||
{
|
||||
int allocated;
|
||||
char * mem, * p = vp;
|
||||
int expand_by = by;
|
||||
|
||||
if (p) {
|
||||
misc_checkmem (p, size);
|
||||
allocated = CONTROL_SIZE + size;
|
||||
p -= (strlen (MEM_BEGIN) + 1 + sizeof (int));
|
||||
} else {
|
||||
allocated = 0;
|
||||
/* add control bytes to the new allocated area */
|
||||
expand_by += CONTROL_SIZE;
|
||||
}
|
||||
p = realloc (p, allocated + expand_by);
|
||||
if (!p)
|
||||
misc_die ("misc_expandmem: no more memory (%d)", size);
|
||||
if (!vp) {
|
||||
strcpy (p, MEM_BEGIN);
|
||||
}
|
||||
mem = p + strlen (MEM_BEGIN) + 1 + sizeof (int);
|
||||
|
||||
*(int *)(p + strlen (MEM_BEGIN) + 1) = size + by;
|
||||
/* fill new allocated area by 0s */
|
||||
if(by > 0)
|
||||
memset (mem + size, 0, by);
|
||||
strcpy (mem + size + by, MEM_END);
|
||||
// misc_checkmem (mem, size + by);
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
||||
|
||||
void misc_freemem (void * vp)
|
||||
{
|
||||
char * p = vp;
|
||||
int size;
|
||||
|
||||
if (!p)
|
||||
return;
|
||||
size = misc_memsize (vp);
|
||||
misc_checkmem (p, size);
|
||||
|
||||
p -= (strlen (MEM_BEGIN) + 1 + sizeof (int));
|
||||
strcpy (p, MEM_FREED);
|
||||
strcpy (p + size + CONTROL_SIZE - strlen (MEM_END) - 1, MEM_FREED);
|
||||
free (p);
|
||||
}
|
||||
|
||||
|
||||
+200
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
* Copyright 1996-2004 by Hans Reiser, licensing governed by
|
||||
* reiserfsprogs/README
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "misc/malloc.h"
|
||||
#include "misc/misc.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
|
||||
void misc_die (char * fmt, ...)
|
||||
{
|
||||
static char buf[4096];
|
||||
va_list args;
|
||||
|
||||
va_start (args, fmt);
|
||||
vsprintf (buf, fmt, args);
|
||||
va_end (args);
|
||||
|
||||
fprintf (stderr, "\n%s\n", buf);
|
||||
abort ();
|
||||
}
|
||||
|
||||
|
||||
__u32 misc_random (void)
|
||||
{
|
||||
srandom (time (0));
|
||||
return random ();
|
||||
}
|
||||
|
||||
/* this implements binary search in the array 'base' among 'num' elements each
|
||||
of those is 'width' bytes long. 'comp_func' is used to compare keys */
|
||||
int misc_bin_search (const void * key, void * base, __u32 num, int width,
|
||||
int * ppos, misc_comp_func_t comp_func)
|
||||
{
|
||||
__u32 rbound, lbound, j;
|
||||
int ret;
|
||||
|
||||
if (num == 0 || base == NULL) {
|
||||
/* objectid map may be 0 elements long */
|
||||
*ppos = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
lbound = 0;
|
||||
rbound = num - 1;
|
||||
|
||||
for (j = (rbound + lbound) / 2; lbound <= rbound; j = (rbound + lbound) / 2) {
|
||||
ret = comp_func ((void *)((char *)base + j * width), key ) ;
|
||||
if (ret < 0) { /* second is greater */
|
||||
lbound = j + 1;
|
||||
continue;
|
||||
|
||||
} else if (ret > 0) { /* first is greater */
|
||||
if (j == 0)
|
||||
break;
|
||||
rbound = j - 1;
|
||||
continue;
|
||||
} else { /* equal */
|
||||
*ppos = j;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
*ppos = lbound;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#define BLOCKLIST__ELEMENT_NUMBER 10
|
||||
|
||||
/*element is block number and device*/
|
||||
int blockdev_list_compare (const void * block1, const void * block2) {
|
||||
if (*(__u32 *)block1 < *(__u32 *)block2)
|
||||
return -1;
|
||||
if (*(__u32 *)block1 > *(__u32 *)block2)
|
||||
return 1;
|
||||
|
||||
if (*((__u32 *)block1 + 1) < *((__u32 *)block2 + 1))
|
||||
return -1;
|
||||
if (*((__u32 *)block1 + 1) > *((__u32 *)block2 + 1))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void blocklist__insert_in_position (void *elem, void **base, __u32 *count,
|
||||
int elem_size, int *position)
|
||||
{
|
||||
if (elem_size == 0)
|
||||
return;
|
||||
|
||||
if (*base == NULL)
|
||||
*base = misc_getmem (BLOCKLIST__ELEMENT_NUMBER * elem_size);
|
||||
|
||||
if (*count == misc_memsize((void *)*base) / elem_size)
|
||||
*base = misc_expandmem (*base, misc_memsize((void *)*base),
|
||||
BLOCKLIST__ELEMENT_NUMBER * elem_size);
|
||||
|
||||
if (*position < *count) {
|
||||
memmove (*base + (*position + 1),
|
||||
*base + (*position),
|
||||
(*count - *position) * elem_size);
|
||||
}
|
||||
|
||||
memcpy (*base + (char) *position * elem_size, elem, elem_size);
|
||||
*count+=1;
|
||||
}
|
||||
|
||||
int misc_device_rdev_match(char *path, void *data) {
|
||||
dev_t *rdev = (dev_t *)data;
|
||||
struct stat st;
|
||||
|
||||
/* If stat fails just continue walking. */
|
||||
if (stat(path, &st))
|
||||
return 0;
|
||||
|
||||
/* Only block files are interesting. */
|
||||
if (!S_ISBLK(st.st_mode))
|
||||
return 0;
|
||||
|
||||
/* Matched rdev wanted. */
|
||||
if (st.st_rdev != *rdev)
|
||||
return 0;
|
||||
|
||||
/* Stop walking. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* The method walks through all subtree of the path,
|
||||
open all directories and walk through them recursevely.
|
||||
|
||||
Return values:
|
||||
positive: stop walking;
|
||||
negative: error occured.
|
||||
*/
|
||||
int misc_dir_walk(char *path, dir_walk_func_t func, void *data) {
|
||||
struct dirent *dirent;
|
||||
struct stat st;
|
||||
off_t pos;
|
||||
DIR *dir;
|
||||
int len;
|
||||
int res;
|
||||
|
||||
strcat(path, "/");
|
||||
|
||||
if (!(dir = opendir(path)))
|
||||
return 0;
|
||||
|
||||
len = strlen(path);
|
||||
|
||||
while ((dirent = readdir(dir)) != NULL) {
|
||||
path[len] = 0;
|
||||
|
||||
if (strcmp(dirent->d_name, ".") == 0 ||
|
||||
strcmp(dirent->d_name, "..") == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
strcat(path, dirent->d_name);
|
||||
|
||||
if ((res = func(path, data))) {
|
||||
closedir(dir);
|
||||
return res;
|
||||
}
|
||||
|
||||
if (stat(path, &st) != 0)
|
||||
continue;
|
||||
|
||||
if ((S_ISDIR(st.st_mode))) {
|
||||
pos = telldir(dir);
|
||||
closedir(dir);
|
||||
|
||||
if ((res = misc_dir_walk(path, func, data)))
|
||||
return res;
|
||||
|
||||
path[len] = 0;
|
||||
if (!(dir = opendir(path)))
|
||||
return -1;
|
||||
|
||||
seekdir(dir, pos);
|
||||
}
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user