diff --git a/Makefile.am b/Makefile.am --- a/Makefile.am +++ b/Makefile.am @@ -6,13 +6,15 @@ AM_CPPFLAGS = -DSYSCONFDIR='"$(sysconfdi -I$(top_srcdir)/src AM_CFLAGS = $(DISTLIBS_CFLAGS) LIBS = $(DISTLIBS_LIBS) -LDADD = libdistrencommon.la -bin_PROGRAMS = +bin_PROGRAMS = distren if ENABLE_SERVER bin_PROGRAMS += distrend distrenslave distrensimpleslave endif +include_HEADERS = src/client/distren.h + +lib_LTLIBRARIES = libdistren.la pkglib_LTLIBRARIES = libdistrencommon.la # libdistrencommon.la: @@ -29,6 +31,18 @@ libdistrencommon_la_SOURCES = src/common # either increase the revision number or the interface number each release! libdistrencommon_la_LDFLAGS = $(AM_LDFLAGS) -version-info 0:0:0 +#library client +libdistren_la_SOURCES = \ + src/client/libdistren.c src/client/libdistren.h \ + src/client/libdistren_config.c \ + src/client/libdistren_job.c +libdistren_la_LIBADD = libdistrencommon.la + +#CLI client. +distren_SOURCES = \ + src/client/distren.c +distren_LDADD = libdistrencommon.la libdistren.la + # shared server sources: SERVER_SOURCES = \ src/server/slavefuncs.c src/server/slavefuncs.h \ diff --git a/src/client/libdistren.c b/src/client/libdistren.c --- a/src/client/libdistren.c +++ b/src/client/libdistren.c @@ -82,6 +82,6 @@ int distren_submit_file(distren_t handle */ int distren_free(distren_t handle) { - _free(handle, handle); + free(handle); return 0; } diff --git a/src/client/libdistren.h b/src/client/libdistren.h --- a/src/client/libdistren.h +++ b/src/client/libdistren.h @@ -26,12 +26,16 @@ #include "distren.h" +#include "common/multiio.h" + struct distren { distren_malloc_t malloc; distren_free_t free; struct options_common *options; /*< use a pointer just to avoid #include "options.h"? */ char *server; + + multiio_context_t multiio; }; struct distren_job @@ -62,14 +66,18 @@ void *_malloc(distren_t distren, size_t void _free(distren_t distren, void *tofree); /** - Sets up the distren handle with information garnered from - configuration files, etc. Uses the environment variable - DISTREN_CONFIG or the built-in default config file location. + * Sets up the distren handle with information garnered from + * configuration files, etc. Uses the environment variable + * DISTREN_CONFIG or the built-in default config file location. + * + * Also initializes multiio. */ int _distren_getoptions(distren_t handle); /** - Unsets-up the distren handle with options loadable from a config file. + * Unsets-up the distren handle with options loadable from a config file. + * + * Also unloads multiio. */ int _distren_loseoptions(distren_t handle); diff --git a/src/client/libdistren_config.c b/src/client/libdistren_config.c --- a/src/client/libdistren_config.c +++ b/src/client/libdistren_config.c @@ -38,8 +38,10 @@ int _distren_getoptions(distren_t handle CFG_STR("server", NULL, 0), CFG_END() }; - - if(options_init(0, NULL, &cfg, cfg_opts, "client", &handle->options)) + + handle->multiio = multiio_context_new(); + + if(options_init(0, NULL, &cfg, cfg_opts, "client", &handle->options, handle->multiio)) { fprintf(stderr, "error getting configuration\n"); return 1; @@ -57,6 +59,7 @@ int _distren_getoptions(distren_t handle int _distren_loseoptions(distren_t handle) { options_free(handle->options); + multiio_context_free(handle->multiio); return 0; } diff --git a/src/client/libdistren_unbias.c b/src/client/libdistren_unbias.c deleted file mode 100644 --- a/src/client/libdistren_unbias.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright 2010 Nathan Phillip Brink, Ethan Zonca, Matt Orlando - - This file is a part of DistRen. - - DistRen is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - DistRen is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with DistRen. If not, see . -*/ - -/* - Implementation of libdistren functions that exist to prevent this library from being biased toward certain methods of reporting errors/debug info or free()ing and malloc()ing - */ - -#include "common/config.h" - -#include "libdistren.h" - -void *_malloc(distren_t distren, size_t size) -{ - return (*distren->malloc)(size); -} - -void _free(distren_t distren, void *tofree) -{ - (*distren->free)(tofree); -}