summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am6
-rw-r--r--include/erasurecode/erasurecode.h68
-rw-r--r--include/erasurecode/erasurecode_backend.h111
-rw-r--r--include/erasurecode/erasurecode_internal.h50
-rw-r--r--include/erasurecode/erasurecode_stdinc.h8
-rw-r--r--src/Makefile.am3
-rw-r--r--src/Makefile.in735
-rw-r--r--src/backends/xor/flat_xor_3.c42
-rw-r--r--src/builtin/xor_codes/Makefile.in550
-rw-r--r--src/erasurecode.c182
-rw-r--r--test/Makefile.am2
-rw-r--r--test/liberasurecode_test.c8
12 files changed, 291 insertions, 1474 deletions
diff --git a/Makefile.am b/Makefile.am
index bf9868a..09cd80c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,9 +5,9 @@ SUBDIRS = src test
EXTRA_DIST = autogen.sh
if DEBUG
-AM_CFLAGS = -g3 -O0 -D_GNU_SOURCE=1
+AM_CFLAGS = -g3 -O0 -D_GNU_SOURCE=1 -Werror
else
-AM_CFLAGS = -O2 -D_GNU_SOURCE=1
+AM_CFLAGS = -O2 -D_GNU_SOURCE=1 -Werror
endif
INCLUDE = -I$(abs_top_builddir)/include \
@@ -22,7 +22,7 @@ AM_CFLAGS += -fPIC $(AM_CPPFLAGS) -L/usr/local/lib
include_HEADERS = \
include/erasurecode/list.h \
include/erasurecode/erasurecode_stdinc.h \
- include/erasurecode/erasurecode_internal.h \
+ include/erasurecode/erasurecode_backend.h \
include/erasurecode/erasurecode.h \
include/erasurecode/erasurecode_version.h \
include/xor_codes/xor_hd_code_defs.h \
diff --git a/include/erasurecode/erasurecode.h b/include/erasurecode/erasurecode.h
index 9d2c8a9..14bac82 100644
--- a/include/erasurecode/erasurecode.h
+++ b/include/erasurecode/erasurecode.h
@@ -20,6 +20,8 @@
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * liberasurecode frontend API header
*/
#ifndef _ERASURECODE_H_
@@ -39,7 +41,14 @@ extern "C" {
#define dl_restrict
#endif
-/* liberasurecode API header */
+/* liberasurecode frontend API functions */
+void liberasurecode_supported_backends(char **backend_names);
+int liberasurecode_instance_create(const char *backend_name,
+ int k, int m, int w, void *args);
+int liberasurecode_instance_destroy(int instance);
+int liberasurecode_encode(int instance);
+int liberasurecode_decode(int instance);
+int liberasurecode_reconstruct(int instance);
/* Supported EC backends */
typedef enum {
@@ -51,63 +60,6 @@ typedef enum {
EC_BACKENDS_MAX,
} ec_backend_id_t;
-struct ec_backend_ops {
- /* Backend register/init, unregister/cleanup routines */
- int (*init)();
- int (*exit)();
-
- /* Generic function pointers to be overridden with dlsym() */
- /* Do not define these as int (*f)(void) */
- int (*encode)();
- int (*decode)();
- int (*reconstruct)();
- int (*get_fragments_needed)();
- int (*get_fragment_metadata)();
- int (*verify_fragment_metadata)();
- int (*verify_stripe_metadata)();
-};
-
-#define MAX_BASENAMELEN 64
-#define MAX_LIBNAMELEN 64
-#define MAX_LIBVERLEN 64
-typedef void * ec_backend_handle_t;
-
-/* EC backend private data */
-struct ec_backend_args {
- uint32_t k; /* Number of data fragments */
- uint32_t m; /* Number of parity fragments */
- uint32_t w; /* Word-size in bits */
- uint32_t arg1; /* Reserved1 */
- uint32_t arg2; /* Reserved2 */
- uint32_t arg3; /* Reserved3 */
-};
-
-/* EC backend common attributes */
-struct ec_backend_common {
- ec_backend_id_t id; /* EC backend id */
- char name[MAX_BASENAMELEN]; /* EC backend common name */
- char soname[MAX_LIBNAMELEN]; /* EC backend shared library path */
- char soversion[MAX_LIBVERLEN]; /* EC backend shared library version */
- uint8_t users; /* EC backend number of active references */
-
- struct ec_backend_ops * ops; /* EC backend ops table */
-};
-
-/* EC backend definition */
-typedef struct ec_backend {
- struct ec_backend_common common; /* EC backend common attributes */
- struct ec_backend_args args; /* EC backend instance data (private) */
- void * handle; /* EC backend shared library handle */
-
- SLIST_ENTRY(ec_backend) link;
-} *ec_backend_t;
-
-/* API functions */
-int liberasurecode_backend_create_instance(ec_backend_t *pinstance,
- const char *name, int k, int m, int w, int arg1, int arg2, int arg3);
-int liberasurecode_backend_destroy_instance(ec_backend_t instance);
-
-
/* Error codes */
typedef enum {
EBACKENDNOTSUPP = 200,
diff --git a/include/erasurecode/erasurecode_backend.h b/include/erasurecode/erasurecode_backend.h
new file mode 100644
index 0000000..528a140
--- /dev/null
+++ b/include/erasurecode/erasurecode_backend.h
@@ -0,0 +1,111 @@
+/*
+ * <Copyright>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY
+ * THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _ERASURECODE_INTERNAL_H_
+#define _ERASURECODE_INTERNAL_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "erasurecode.h"
+
+/* EC backend private data */
+struct ec_backend_args {
+ uint32_t k; /* Number of data fragments */
+ uint32_t m; /* Number of parity fragments */
+ uint32_t w; /* Word-size in bits */
+ void* args;
+};
+
+/* EC backend stubs - implemented per backend */
+struct ec_backend_op_stubs {
+ /** Backend register/init, unregister/cleanup routines **/
+
+ /* Private backend init routine */
+ void * (*init)(struct ec_backend_args args);
+
+ /* Private backend cleanup routine */
+ int (*exit)(void *);
+
+ /* Do not define these as int (*f)(void) */
+ int (*encode)(void *desc);
+ int (*decode)(void *desc);
+ int (*get_fragments_needed)(void *desc);
+ int (*reconstruct)(void *desc);
+};
+
+/**
+ * EC backend method names - actual function names from the library
+ * 1:1 mapping from op_stubs above to function names in the .so
+ * */
+struct ec_backend_fnmap {
+ const char *stub_name; /* stub name in ec_backend_op_stubs */
+ const char *fn_name; /* corresponding library function name */
+};
+
+#define MAX_LEN 64
+/* EC backend common attributes */
+struct ec_backend_common {
+ ec_backend_id_t id; /* EC backend type */
+ char name[MAX_LEN]; /* EC backend common name */
+ char soname[PATH_MAX]; /* EC backend shared library path */
+ char soversion[MAX_LEN]; /* EC backend shared library version */
+
+ struct ec_backend_op_stubs *ops; /* EC backend stubs */
+ struct ec_backend_fnmap *fnmap; /* EC backend ops/stubs to library fn name map */
+
+ uint8_t users; /* EC backend number of active references */
+};
+
+/* EC backend definition */
+typedef struct ec_backend {
+ struct ec_backend_common common; /* EC backend common attributes */
+ struct ec_backend_args args; /* EC backend instance data (private) */
+ void * backend_desc; /* EC backend instance handle */
+ void * backend_sohandle; /* EC backend shared library handle */
+
+ int instance_desc; /* liberasurecode instance handle */
+
+ SLIST_ENTRY(ec_backend) link;
+} *ec_backend_t;
+
+/* Init/exit routines */
+int liberasurecode_backend_init(ec_backend_t backend);
+int liberasurecode_backend_exit(ec_backend_t backend);
+
+/* Backend registration interface */
+int liberasurecode_backend_register(ec_backend_t backend);
+int liberasurecode_backend_unregister(ec_backend_t backend);
+
+/* Backend query interface */
+ec_backend_t liberasurecode_backend_get_by_name(const char *name);
+ec_backend_t liberasurecode_backend_get_by_soname(const char *soname);
+void liberasurecode_backend_put(ec_backend_t backend);
+
+/* Validate backend before calling init */
+int validate_backend(ec_backend_t backend);
+
+#endif // _ERASURECODE_INTERNAL_H_
+
diff --git a/include/erasurecode/erasurecode_internal.h b/include/erasurecode/erasurecode_internal.h
deleted file mode 100644
index 2feede5..0000000
--- a/include/erasurecode/erasurecode_internal.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * <Copyright>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice, this
- * list of conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY
- * THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ERASURECODE_INTERNAL_H_
-#define _ERASURECODE_INTERNAL_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "erasurecode.h"
-
-/* Init/exit routines */
-int liberasurecode_backend_init(ec_backend_t backend);
-int liberasurecode_backend_exit(ec_backend_t backend);
-
-/* Backend registration interface */
-int liberasurecode_backend_register(ec_backend_t backend);
-int liberasurecode_backend_unregister(ec_backend_t backend);
-
-/* Backend query interface */
-ec_backend_t liberasurecode_backend_get_by_name(const char *name);
-ec_backend_t liberasurecode_backend_get_by_soname(const char *soname);
-void liberasurecode_backend_put(ec_backend_t backend);
-
-/* Validate backend before calling init */
-int validate_backend(ec_backend_t backend);
-
-#endif // _ERASURECODE_INTERNAL_H_
diff --git a/include/erasurecode/erasurecode_stdinc.h b/include/erasurecode/erasurecode_stdinc.h
index 84dea54..0724e46 100644
--- a/include/erasurecode/erasurecode_stdinc.h
+++ b/include/erasurecode/erasurecode_stdinc.h
@@ -82,6 +82,14 @@
#endif
#ifdef HAVE_PTHREAD_H
# include <pthread.h>
+#define RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER
+#define rwlock_t pthread_rwlock_t
+#define rwlock_rdlock pthread_rwlock_rdlock
+#define rwlock_wrlock pthread_rwlock_wrlock
+#define rwlock_tryrdlock pthread_rwlock_tryrdlock
+#define rwlock_trywrlock pthread_rwlock_trywrlock
+#define rwlock_unlock pthread_rwlock_unlock
+#define rwlock_destroy pthread_rwlock_destroy
#endif
#ifdef HAVE_ERRNO_H
# include <errno.h>
diff --git a/src/Makefile.am b/src/Makefile.am
index 780db29..43ff2be 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -14,8 +14,9 @@ liberasurecode_la_SOURCES = \
utils/chksum/galois.c \
backends/xor/flat_xor_3.c
+liberasurecode_la_CPPFLAGS = -Werror
liberasurecode_la_LIBADD = \
- builtin/xor_codes/libXorcode.la -lgf_complete
+ builtin/xor_codes/libXorcode.la -lgf_complete -lpthread
# Version format (C - A).(A).(R) for C:R:A input
liberasurecode_la_LDFLAGS = -rpath '$(libdir)' -version-info 9:4:9
diff --git a/src/Makefile.in b/src/Makefile.in
deleted file mode 100644
index 9efaa57..0000000
--- a/src/Makefile.in
+++ /dev/null
@@ -1,735 +0,0 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-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 = src
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
- $(top_srcdir)/m4/ax_ext.m4 \
- $(top_srcdir)/m4/ax_gcc_x86_avx_xgetbv.m4 \
- $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \
- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/include/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
- $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
- *) f=$$p;; \
- esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
- srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
- for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
- for p in $$list; do echo "$$p $$p"; done | \
- sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
- $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
- if (++n[$$2] == $(am__install_max)) \
- { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
- END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
- sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
- sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
- test -z "$$files" \
- || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
- || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
- $(am__cd) "$$dir" && rm -f $$files; }; \
- }
-am__installdirs = "$(DESTDIR)$(libdir)"
-LTLIBRARIES = $(lib_LTLIBRARIES)
-liberasurecode_la_DEPENDENCIES = builtin/xor_codes/libXorcode.la
-am__dirstamp = $(am__leading_dot)dirstamp
-am_liberasurecode_la_OBJECTS = erasurecode.lo utils/chksum/crc32.lo \
- utils/chksum/alg_sig.lo utils/chksum/galois.lo \
- backends/xor/flat_xor_3.lo
-liberasurecode_la_OBJECTS = $(am_liberasurecode_la_OBJECTS)
-AM_V_lt = $(am__v_lt_@AM_V@)
-am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-liberasurecode_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
- $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
- $(AM_CFLAGS) $(CFLAGS) $(liberasurecode_la_LDFLAGS) $(LDFLAGS) \
- -o $@
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
-depcomp =
-am__depfiles_maybe =
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
- $(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_@AM_V@)
-am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo " CC " $@;
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-CCLD = $(CC)
-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_@AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
-SOURCES = $(liberasurecode_la_SOURCES)
-DIST_SOURCES = $(liberasurecode_la_SOURCES)
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
- distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
- $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
- distdir
-ETAGS = etags
-CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-am__relativize = \
- dir0=`pwd`; \
- sed_first='s,^\([^/]*\)/.*$$,\1,'; \
- sed_rest='s,^[^/]*/*,,'; \
- sed_last='s,^.*/\([^/]*\)$$,\1,'; \
- sed_butlast='s,/*[^/]*$$,,'; \
- while test -n "$$dir1"; do \
- first=`echo "$$dir1" | sed -e "$$sed_first"`; \
- if test "$$first" != "."; then \
- if test "$$first" = ".."; then \
- dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
- dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
- else \
- first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
- if test "$$first2" = "$$first"; then \
- dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
- else \
- dir2="../$$dir2"; \
- fi; \
- dir0="$$dir0"/"$$first"; \
- fi; \
- fi; \
- dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
- done; \
- reldir="$$dir2"
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJECTS = @OBJECTS@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-SIMD_FLAGS = @SIMD_FLAGS@
-STRIP = @STRIP@
-VERSION = @VERSION@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_aux_dir = @ac_aux_dir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__leading_dot = @am__leading_dot@
-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@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-SUBDIRS = builtin/xor_codes
-lib_LTLIBRARIES = liberasurecode.la
-INCLUDES = \
- -I$(top_srcdir)/include/erasurecode \
- -I$(top_srcdir)/include/xor_codes
-
-
-# liberasurecode params
-liberasurecode_la_SOURCES = \
- erasurecode.c \
- utils/chksum/crc32.c \
- utils/chksum/alg_sig.c \
- utils/chksum/galois.c \
- backends/xor/flat_xor_3.c
-
-liberasurecode_la_LIBADD = \
- builtin/xor_codes/libXorcode.la -lgf_complete
-
-
-# Version format (C - A).(A).(R) for C:R:A input
-liberasurecode_la_LDFLAGS = -rpath '$(libdir)' -version-info 9:4:9
-all: all-recursive
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .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 ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps src/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
-$(am__aclocal_m4_deps):
-install-libLTLIBRARIES: $(lib_LTLIBRARIES)
- @$(NORMAL_INSTALL)
- test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
- @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
- list2=; for p in $$list; do \
- if test -f $$p; then \
- list2="$$list2 $$p"; \
- else :; fi; \
- done; \
- test -z "$$list2" || { \
- echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
- $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
- }
-
-uninstall-libLTLIBRARIES:
- @$(NORMAL_UNINSTALL)
- @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
- for p in $$list; do \
- $(am__strip_dir) \
- echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
- $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
- done
-
-clean-libLTLIBRARIES:
- -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
- echo "rm -f \"$${dir}/so_locations\""; \
- rm -f "$${dir}/so_locations"; \
- done
-utils/chksum/$(am__dirstamp):
- @$(MKDIR_P) utils/chksum
- @: > utils/chksum/$(am__dirstamp)
-utils/chksum/crc32.lo: utils/chksum/$(am__dirstamp)
-utils/chksum/alg_sig.lo: utils/chksum/$(am__dirstamp)
-utils/chksum/galois.lo: utils/chksum/$(am__dirstamp)
-backends/xor/$(am__dirstamp):
- @$(MKDIR_P) backends/xor
- @: > backends/xor/$(am__dirstamp)
-backends/xor/flat_xor_3.lo: backends/xor/$(am__dirstamp)
-liberasurecode.la: $(liberasurecode_la_OBJECTS) $(liberasurecode_la_DEPENDENCIES) $(EXTRA_liberasurecode_la_DEPENDENCIES)
- $(AM_V_CCLD)$(liberasurecode_la_LINK) -rpath $(libdir) $(liberasurecode_la_OBJECTS) $(liberasurecode_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT)
- -rm -f backends/xor/flat_xor_3.$(OBJEXT)
- -rm -f backends/xor/flat_xor_3.lo
- -rm -f utils/chksum/alg_sig.$(OBJEXT)
- -rm -f utils/chksum/alg_sig.lo
- -rm -f utils/chksum/crc32.$(OBJEXT)
- -rm -f utils/chksum/crc32.lo
- -rm -f utils/chksum/galois.$(OBJEXT)
- -rm -f utils/chksum/galois.lo
-
-distclean-compile:
- -rm -f *.tab.c
-
-.c.o:
- $(AM_V_CC)$(COMPILE) -c -o $@ $<
-
-.c.obj:
- $(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
- $(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
- -rm -rf backends/xor/.libs backends/xor/_libs
- -rm -rf utils/chksum/.libs utils/chksum/_libs
-
-# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-# (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- target=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- dot_seen=yes; \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done; \
- if test "$$dot_seen" = "no"; then \
- $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
- fi; test -z "$$fail"
-
-$(RECURSIVE_CLEAN_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- case "$@" in \
- distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
- *) list='$(SUBDIRS)' ;; \
- esac; \
- rev=''; for subdir in $$list; do \
- if test "$$subdir" = "."; then :; else \
- rev="$$subdir $$rev"; \
- fi; \
- done; \
- rev="$$rev ."; \
- target=`echo $@ | sed s/-recursive//`; \
- for subdir in $$rev; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done && test -z "$$fail"
-tags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
- done
-ctags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
- 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; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- set x; \
- here=`pwd`; \
- if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
- include_option=--etags-include; \
- empty_fix=.; \
- else \
- include_option=--include; \
- empty_fix=; \
- fi; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test ! -f $$subdir/TAGS || \
- set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
- fi; \
- done; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
- fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- 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; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__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)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
- else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
- || exit 1; \
- fi; \
- done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test -d "$(distdir)/$$subdir" \
- || $(MKDIR_P) "$(distdir)/$$subdir" \
- || exit 1; \
- fi; \
- done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
- $(am__relativize); \
- new_distdir=$$reldir; \
- dir1=$$subdir; dir2="$(top_distdir)"; \
- $(am__relativize); \
- new_top_distdir=$$reldir; \
- echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
- echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
- ($(am__cd) $$subdir && \
- $(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$$new_top_distdir" \
- distdir="$$new_distdir" \
- am__remove_distdir=: \
- am__skip_length_check=: \
- am__skip_mode_fix=: \
- distdir) \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-recursive
-all-am: Makefile $(LTLIBRARIES)
-installdirs: installdirs-recursive
-installdirs-am:
- for dir in "$(DESTDIR)$(libdir)"; do \
- test -z "$$dir" || $(MKDIR_P) "$$dir"; \
- done
-install: install-recursive
-install-exec: install-exec-recursive
-install-data: install-data-recursive
-uninstall: uninstall-recursive
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-recursive
-install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
- -rm -f backends/xor/$(am__dirstamp)
- -rm -f utils/chksum/$(am__dirstamp)
-
-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-recursive
-
-clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
- mostlyclean-am
-
-distclean: distclean-recursive
- -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
-
-dvi: dvi-recursive
-
-dvi-am:
-
-html: html-recursive
-
-html-am:
-
-info: info-recursive
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-recursive
-
-install-dvi-am:
-
-install-exec-am: install-libLTLIBRARIES
-
-install-html: install-html-recursive
-
-install-html-am:
-
-install-info: install-info-recursive
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-recursive
-
-install-pdf-am:
-
-install-ps: install-ps-recursive
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-recursive
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-recursive
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
-
-pdf: pdf-recursive
-
-pdf-am:
-
-ps: ps-recursive
-
-ps-am:
-
-uninstall-am: uninstall-libLTLIBRARIES
-
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
- install-am install-strip tags-recursive
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am check check-am clean clean-generic \
- clean-libLTLIBRARIES clean-libtool ctags ctags-recursive \
- distclean distclean-compile distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-libLTLIBRARIES install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs installdirs-am \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
- uninstall-libLTLIBRARIES
-
-
-# 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:
diff --git a/src/backends/xor/flat_xor_3.c b/src/backends/xor/flat_xor_3.c
index 6428465..a369bcd 100644
--- a/src/backends/xor/flat_xor_3.c
+++ b/src/backends/xor/flat_xor_3.c
@@ -22,14 +22,19 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "erasurecode.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <xor_code.h>
+#include "erasurecode_backend.h"
/* Forward declarations */
-struct ec_backend_ops flat_xor_3_ops;
+struct ec_backend_op_stubs flat_xor_3_ops;
struct ec_backend flat_xor_3;
-static int flat_xor_3_encode()
+static int flat_xor_3_encode(void * desc)
{
+ xor_code_t *xor_desc = desc;
+ // xor_desc->encode(xor_desc, data, parity, blocksize);
}
static int flat_xor_3_decode()
@@ -46,34 +51,48 @@ static int flat_xor_3_min_fragments()
static int flat_xor_3_fragment_metadata()
{
+ return 0;
}
static int flat_xor_3_verify_frag_metadata()
{
+ return 0;
}
static int flat_xor_3_verify_stripe_metadata()
{
+ return 0;
}
-static int flat_xor_3_init()
+static void * flat_xor_3_init(struct ec_backend_args args)
{
+ /* hd = 3 for flat_xor_3 */
+ const int hd = 3;
+
+ return (void *) init_xor_hd_code(args.k, args.m, hd);
}
-static int flat_xor_3_exit()
+static int flat_xor_3_exit(void *desc)
{
+ free((xor_code_t *) desc);
}
-struct ec_backend_ops flat_xor_3_ops = {
+struct ec_backend_op_stubs flat_xor_3_op_stubs = {
.init = flat_xor_3_init,
.exit = flat_xor_3_exit,
.encode = flat_xor_3_encode,
.decode = flat_xor_3_decode,
- .reconstruct = flat_xor_3_reconstruct,
.get_fragments_needed = flat_xor_3_min_fragments,
- .get_fragment_metadata = flat_xor_3_fragment_metadata,
- .verify_fragment_metadata = flat_xor_3_verify_frag_metadata,
- .verify_stripe_metadata = flat_xor_3_verify_stripe_metadata,
+ .reconstruct = flat_xor_3_reconstruct,
+};
+
+struct ec_backend_fnmap flat_xor_3_fn_map[] = {
+ { "init", "init_xor_hd_code" },
+ { "exit", NULL, },
+ { "encode", "encode" },
+ { "decode", "decode" },
+ { "get_fragments_needed", "fragments_needed", },
+ { "reconstruct", "xor_reconstruct_one" },
};
struct ec_backend_common backend_flat_xor_3 = {
@@ -81,7 +100,8 @@ struct ec_backend_common backend_flat_xor_3 = {
.name = "flat_xor_3",
.soname = "libXorcode.so",
.soversion = "1.0",
+ .ops = &flat_xor_3_op_stubs,
+ .fnmap = flat_xor_3_fn_map,
.users = 0,
- .ops = &flat_xor_3_ops,
};
diff --git a/src/builtin/xor_codes/Makefile.in b/src/builtin/xor_codes/Makefile.in
deleted file mode 100644
index 9912c8c..0000000
--- a/src/builtin/xor_codes/Makefile.in
+++ /dev/null
@@ -1,550 +0,0 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-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 = src/builtin/xor_codes
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
- $(top_srcdir)/m4/ax_ext.m4 \
- $(top_srcdir)/m4/ax_gcc_x86_avx_xgetbv.m4 \
- $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \
- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/include/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
- $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
- *) f=$$p;; \
- esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
- srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
- for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
- for p in $$list; do echo "$$p $$p"; done | \
- sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
- $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
- if (++n[$$2] == $(am__install_max)) \
- { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
- END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
- sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
- sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
- test -z "$$files" \
- || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
- || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
- $(am__cd) "$$dir" && rm -f $$files; }; \
- }
-am__installdirs = "$(DESTDIR)$(libdir)"
-LTLIBRARIES = $(lib_LTLIBRARIES)
-libXorcode_la_LIBADD =
-am_libXorcode_la_OBJECTS = libXorcode_la-xor_code.lo \
- libXorcode_la-xor_hd_code.lo
-libXorcode_la_OBJECTS = $(am_libXorcode_la_OBJECTS)
-AM_V_lt = $(am__v_lt_@AM_V@)
-am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-libXorcode_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(libXorcode_la_LDFLAGS) $(LDFLAGS) -o $@
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
-depcomp =
-am__depfiles_maybe =
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
- $(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_@AM_V@)
-am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo " CC " $@;
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-CCLD = $(CC)
-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_@AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
-SOURCES = $(libXorcode_la_SOURCES)
-DIST_SOURCES = $(libXorcode_la_SOURCES)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJECTS = @OBJECTS@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-SIMD_FLAGS = @SIMD_FLAGS@
-STRIP = @STRIP@
-VERSION = @VERSION@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_aux_dir = @ac_aux_dir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__leading_dot = @am__leading_dot@
-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@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-lib_LTLIBRARIES = libXorcode.la
-
-# libXorcode params
-libXorcode_la_SOURCES = xor_code.c xor_hd_code.c
-libXorcode_la_CPPFLAGS = -I$(top_srcdir)/include/xor_codes
-
-# Version format (C - A).(A).(R) for C:R:A input
-libXorcode_la_LDFLAGS = -rpath '$(libdir)' -version-info 1:1:0
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .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 ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/builtin/xor_codes/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps src/builtin/xor_codes/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
-$(am__aclocal_m4_deps):
-install-libLTLIBRARIES: $(lib_LTLIBRARIES)
- @$(NORMAL_INSTALL)
- test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
- @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
- list2=; for p in $$list; do \
- if test -f $$p; then \
- list2="$$list2 $$p"; \
- else :; fi; \
- done; \
- test -z "$$list2" || { \
- echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
- $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
- }
-
-uninstall-libLTLIBRARIES:
- @$(NORMAL_UNINSTALL)
- @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
- for p in $$list; do \
- $(am__strip_dir) \
- echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
- $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
- done
-
-clean-libLTLIBRARIES:
- -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
- echo "rm -f \"$${dir}/so_locations\""; \
- rm -f "$${dir}/so_locations"; \
- done
-libXorcode.la: $(libXorcode_la_OBJECTS) $(libXorcode_la_DEPENDENCIES) $(EXTRA_libXorcode_la_DEPENDENCIES)
- $(AM_V_CCLD)$(libXorcode_la_LINK) -rpath $(libdir) $(libXorcode_la_OBJECTS) $(libXorcode_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT)
-
-distclean-compile:
- -rm -f *.tab.c
-
-.c.o:
- $(AM_V_CC)$(COMPILE) -c -o $@ $<
-
-.c.obj:
- $(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
- $(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
-
-libXorcode_la-xor_code.lo: xor_code.c
- $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXorcode_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libXorcode_la-xor_code.lo `test -f 'xor_code.c' || echo '$(srcdir)/'`xor_code.c
-
-libXorcode_la-xor_hd_code.lo: xor_hd_code.c
- $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXorcode_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libXorcode_la-xor_hd_code.lo `test -f 'xor_hd_code.c' || echo '$(srcdir)/'`xor_hd_code.c
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-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; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- set x; \
- 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; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
- fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- 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; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__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)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- cp -fpR $$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 $(LTLIBRARIES)
-installdirs:
- for dir in "$(DESTDIR)$(libdir)"; 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:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-libLTLIBRARIES clean-libtool \
- mostlyclean-am
-
-distclean: distclean-am
- -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am: install-libLTLIBRARIES
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-libLTLIBRARIES
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libLTLIBRARIES clean-libtool ctags distclean \
- distclean-compile distclean-generic distclean-libtool \
- distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am \
- install-libLTLIBRARIES install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am uninstall-libLTLIBRARIES
-
-
-# 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:
diff --git a/src/erasurecode.c b/src/erasurecode.c
index 0142f44..e892632 100644
--- a/src/erasurecode.c
+++ b/src/erasurecode.c
@@ -1,4 +1,4 @@
-/*
+/*
* <Copyright>
*
* Redistribution and use in source and binary forms, with or without
@@ -20,15 +20,18 @@
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * liberasurecode API implementation
+ *
+ * vi: set noai tw=79 ts=4 sw=4:
*/
-#include "erasurecode.h"
-#include "erasurecode_internal.h"
#include "list.h"
+#include "erasurecode.h"
+#include "erasurecode_stdinc.h"
+#include "erasurecode_backend.h"
-#include <errno.h>
-#include <stdlib.h>
-#include <pthread.h>
+/* =~=*=~==~=*=~==~=*=~= Supported EC backends =~=*=~==~=*=~==~=*=~==~=*=~== */
/* EC backend references */
extern struct ec_backend_common backend_flat_xor_3;
@@ -41,29 +44,6 @@ ec_backend_t ec_backends_supported[EC_BACKENDS_MAX] = {
/* backend_flat_xor_4 */ NULL,
};
-/* Registered erasure code backend instances */
-SLIST_HEAD(backend_list, ec_backend) active_instances =
- SLIST_HEAD_INITIALIZER(active_instances);
-pthread_mutex_t active_instances_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-int liberasurecode_backend_instance_register(ec_backend_t instance)
-{
- pthread_mutex_lock(&active_instances_mutex);
- SLIST_INSERT_HEAD(&active_instances, instance, link);
- pthread_mutex_unlock(&active_instances_mutex);
-
- return 0;
-}
-
-int liberasurecode_backend_instance_unregister(ec_backend_t instance)
-{
- pthread_mutex_lock(&active_instances_mutex);
- SLIST_REMOVE(&active_instances, instance, ec_backend, link);
- pthread_mutex_unlock(&active_instances_mutex);
-
- return 0;
-}
-
/* Get EC backend by name */
ec_backend_t liberasurecode_backend_lookup_by_name(const char *name)
{
@@ -91,12 +71,83 @@ ec_backend_id_t liberasurecode_backend_lookup_id(const char *name)
return -1;
}
-/* Check if a backend name is in the supported list */
-int liberasurecode_backend_supported(const char *name)
+/* =~=*=~==~=*=~==~=*=~= EC backend instance management =~=*=~==~=*=~==~=*= */
+
+/* Registered erasure code backend instances */
+SLIST_HEAD(backend_list, ec_backend) active_instances =
+ SLIST_HEAD_INITIALIZER(active_instances);
+rwlock_t active_instances_rwlock = RWLOCK_INITIALIZER;
+
+/* Backend instance id */
+int next_backend_desc = 0;
+
+/**
+ * Look up a backend instance by descriptor
+ *
+ * Returns pointer to a registered liberasurecode instance
+ * The caller must hold active_instances_rwlock
+ */
+ec_backend_t liberasurecode_backend_instance_get_by_desc(int desc)
+{
+ struct ec_backend *b = NULL;
+ SLIST_FOREACH(b, &active_instances, link) {
+ if (b->instance_desc == desc)
+ break;
+ }
+ return b;
+}
+
+/**
+ * Allocated backend instance descriptor
+ *
+ * Returns a unique descriptor for a new backend.
+ * The caller must hold active_instances_rwlock
+ */
+int liberasurecode_backend_alloc_desc(void)
+{
+ for (;;) {
+ if (++next_backend_desc <= 0)
+ next_backend_desc = 1;
+ if (!liberasurecode_backend_instance_get_by_desc(next_backend_desc))
+ return next_backend_desc;
+ }
+}
+
+/**
+ * Register a backend instance with liberasurecode
+ *
+ * Returns new backend descriptor
+ */
+int liberasurecode_backend_instance_register(ec_backend_t instance)
+{
+ int desc = -1;
+
+ rwlock_wrlock(&active_instances_rwlock);
+ SLIST_INSERT_HEAD(&active_instances, instance, link);
+ desc = liberasurecode_backend_alloc_desc();
+ if (desc <= 0)
+ goto register_out;
+ instance->instance_desc = desc;
+
+register_out:
+ rwlock_unlock(&active_instances_rwlock);
+ return desc;
+}
+
+/**
+ * Unregister a backend instance
+ */
+int liberasurecode_backend_instance_unregister(ec_backend_t instance)
{
- return (liberasurecode_backend_lookup_by_name(name) != NULL);
+ rwlock_wrlock(&active_instances_rwlock);
+ SLIST_REMOVE(&active_instances, instance, ec_backend, link);
+ rwlock_unlock(&active_instances_rwlock);
+
+ return 0;
}
+/* =~=*=~==~=*=~== liberasurecode backend API implementation =~=*=~==~=*=~== */
+
static void print_dlerror(const char *caller)
{
char *msg = dlerror();
@@ -106,16 +157,17 @@ static void print_dlerror(const char *caller)
fprintf (stderr, "%s: dynamic linking error %s\n", caller, msg);
}
+
/* Generic dlopen/dlclose routines */
int liberasurecode_backend_open(ec_backend_t instance)
{
void *handle = NULL;
- if (instance && NULL != instance->handle)
+ if (instance && NULL != instance->backend_sohandle)
return 0;
/* Use RTLD_LOCAL to avoid symbol collisions */
- instance->handle = dlopen(instance->common.soname, RTLD_LAZY | RTLD_LOCAL);
- if (NULL == instance->handle) {
+ instance->backend_sohandle = dlopen(instance->common.soname, RTLD_LAZY | RTLD_LOCAL);
+ if (NULL == instance->backend_sohandle) {
print_dlerror(__func__);
return -EBACKENDNOTAVAIL;
}
@@ -126,31 +178,34 @@ int liberasurecode_backend_open(ec_backend_t instance)
int liberasurecode_backend_close(ec_backend_t instance)
{
- if (NULL == instance || NULL == instance->handle)
+ if (NULL == instance || NULL == instance->backend_sohandle)
return 0;
- dlclose(instance->handle);
+ dlclose(instance->backend_sohandle);
dlerror(); /* Clear any existing errors */
- instance->handle = NULL;
+ instance->backend_sohandle = NULL;
return 0;
}
-/* Initialize and open a backend - pointer to backend instance
- * returned in 'pinstance.' */
-int liberasurecode_backend_create_instance(
- ec_backend_t *pinstance,
- const char *name, int k, int m, int w,
- int arg1, int arg2, int arg3)
+/* =~=*=~==~=*=~= liberasurecode frontend API implementation =~=*=~==~=*=~== */
+
+/**
+ * Initialize and register a liberasurecode backend
+ *
+ * Returns instance descriptor (int > 0)
+ */
+int liberasurecode_instance_create(const char *backend_name,
+ int k, int m, int w, void *args)
{
int err = 0;
ec_backend_t instance = NULL;
- struct ec_backend_args args = {
+ struct ec_backend_args bargs = {
.k = k, .m = m, .w = w,
- .arg1 = arg1, .arg2 = arg2, .arg3 = arg3,
+ .args = args,
};
- ec_backend_id_t id = liberasurecode_backend_lookup_id(name);
+ ec_backend_id_t id = liberasurecode_backend_lookup_id(backend_name);
if (-1 == id)
return -EBACKENDNOTSUPP;
@@ -161,37 +216,46 @@ int liberasurecode_backend_create_instance(
/* Copy common backend, args struct */
instance->common = ec_backends_supported[id]->common;
- instance->args = args;
+ instance->args = bargs;
/* Open backend .so if not already open */
- /* backend handle is returned in backend->handle */
+ /* .so handle is returned in instance->backend_sohandle */
err = liberasurecode_backend_open(instance);
if (err < 0) {
/* ignore during init, return the same handle */
free(instance);
- *pinstance = NULL;
return err;
}
/* Call private init() for the backend */
- instance->common.ops->init();
+ instance->backend_desc = instance->common.ops->init(bargs);
- /* Register instance */
- liberasurecode_backend_instance_register(instance);
+ /* Register instance and return a descriptor/instance id */
+ instance->instance_desc = liberasurecode_backend_instance_register(instance);
- *pinstance = instance;
-
- return 0;
+ return instance->instance_desc;
}
-/* deinitialize and close a backend */
-int liberasurecode_backend_destroy_instance(ec_backend_t instance)
+/* Deinitialize and close a backend */
+int liberasurecode_instance_destroy(int desc)
{
+ ec_backend_t instance = liberasurecode_backend_instance_get_by_desc(desc);
+
+ /* Call private exit() for the backend */
+ instance->common.ops->exit(instance->backend_desc);
+
+ /* dlclose() backend library */
liberasurecode_backend_close(instance);
+
+ /* Remove instace from registry */
liberasurecode_backend_instance_unregister(instance);
+
+ /* Cleanup */
free(instance);
}
+/* ==~=*=~==~=*=~==~=*=~==~=*=~==~=* misc *=~==~=*=~==~=*=~==~=*=~==~=*=~== */
+
#if 0
/* Validate backend before calling init */
int liberasurecode_backend_validate(ec_backend_t backend)
@@ -244,4 +308,4 @@ ec_backend_t liberasurecode_backend_lookup_by_soname(const char *soname)
}
#endif
-
+/* ==~=*=~==~=*=~==~=*=~==~=*=~==~=*=~==~=*=~==~=*=~==~=*=~==~=*=~==~=*=~== */
diff --git a/test/Makefile.am b/test/Makefile.am
index 5d82389..41763d3 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -15,6 +15,6 @@ check_PROGRAMS += alg_sig_test
liberasurecode_test_SOURCES = liberasurecode_test.c
liberasurecode_test_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/erasurecode
-liberasurecode_test_LDFLAGS = -static -lgf_complete $(top_srcdir)/src/liberasurecode.la -ldl
+liberasurecode_test_LDFLAGS = -lgf_complete $(top_srcdir)/src/liberasurecode.la -ldl -lpthread
check_PROGRAMS += liberasurecode_test
diff --git a/test/liberasurecode_test.c b/test/liberasurecode_test.c
index 77344fc..6463ef2 100644
--- a/test/liberasurecode_test.c
+++ b/test/liberasurecode_test.c
@@ -2,12 +2,8 @@
int main()
{
- ec_backend_t backend;
-
- int err = liberasurecode_backend_create_instance(&backend,
- "flat_xor_3", 10, 4, 0, 0, 0, 0);
- if (backend)
- liberasurecode_backend_destroy_instance(backend);
+ int desc = liberasurecode_instance_create("flat_xor_3", 10, 4, 0, NULL);
+ liberasurecode_instance_destroy(desc);
return 0;
}