From c42000db0f347a26ac1645d830ac949194ec4da0 Mon Sep 17 00:00:00 2001 From: mquinson Date: Wed, 6 Oct 2004 14:03:54 +0000 Subject: [PATCH] Current state. See changelog, sorry, I'm out of time git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@442 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- ChangeLog | 43 +++- configure.ac | 19 +- examples/Makefile.am | 2 +- examples/ping/Makefile.am | 4 - examples/saturate/Makefile.am | 23 +- examples/saturate/saturate.c | 50 +++-- include/Makefile.am | 1 + include/gras.h | 5 - include/gras/datadesc.h | 24 +-- include/gras/messages.h | 21 +- include/gras/transport.h | 2 + include/xbt/config.h | 7 +- include/xbt/dict.h | 12 +- include/xbt/dynar.h | 27 +-- include/xbt/error.h | 2 + include/xbt/log.h | 3 +- include/xbt/set.h | 4 +- src/Makefile.am | 9 +- src/amok/Makefile.am | 8 +- src/amok/bandwidth.c | 233 +++++++++++---------- src/amok/base.c | 91 ++++++-- src/gras/DataDesc/cbps.c | 14 +- src/gras/DataDesc/datadesc.c | 2 +- src/gras/DataDesc/datadesc_private.h | 19 +- src/gras/DataDesc/ddt_create.c | 59 ++++-- src/gras/DataDesc/ddt_exchange.c | 95 +++++---- src/gras/DataDesc/ddt_parse.c | 4 +- src/gras/Msg/msg.c | 4 +- src/gras/Msg/msg_private.h | 15 +- src/gras/Transport/transport.c | 37 +++- src/gras/Transport/transport_plugin_buf.c | 2 +- src/gras/Transport/transport_plugin_file.c | 1 - src/gras/Transport/transport_plugin_sg.c | 1 - src/gras/Transport/transport_plugin_tcp.c | 7 +- src/gras/Transport/transport_private.h | 14 +- src/gras/Virtu/process.c | 16 +- src/gras/Virtu/rl_conditional.c | 1 + src/gras/Virtu/rl_time.c | 3 +- src/gras/Virtu/sg_conditional.c | 1 + src/gras/Virtu/sg_process.c | 2 +- src/gras/Virtu/virtu_interface.h | 7 + src/gras/Virtu/virtu_rl.h | 1 - src/gras/Virtu/virtu_sg.h | 1 - src/gras_private.h | 51 ----- src/xbt/config.c | 23 +- src/xbt/dict.c | 15 +- src/xbt/dict_cursor.c | 34 ++- src/xbt/dict_elm.c | 5 +- src/xbt/dict_private.h | 6 + src/xbt/dynar.c | 76 +++---- src/xbt/error.c | 2 +- src/xbt/log.c | 22 +- src/xbt/log_default_appender.c | 4 +- src/xbt/module.c | 16 +- src/xbt/set.c | 19 +- src/xbt/sysdep.c | 6 +- src/xbt/xbt_interface.h | 19 -- testsuite/gras/datadesc_usage.c | 3 +- testsuite/xbt/config_usage.c | 2 +- testsuite/xbt/dict_crash.c | 4 +- testsuite/xbt/dict_usage.c | 2 +- testsuite/xbt/dynar_double.c | 10 +- testsuite/xbt/dynar_int.c | 10 +- testsuite/xbt/dynar_string.c | 10 +- testsuite/xbt/set_usage.c | 2 +- 65 files changed, 679 insertions(+), 558 deletions(-) delete mode 100644 src/gras_private.h delete mode 100644 src/xbt/xbt_interface.h diff --git a/ChangeLog b/ChangeLog index 3a1cc888f4..6f255aa8cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,16 +1,47 @@ +2004-11-04 Martin Quinson + - Allow to (en/dis)able the cycle detection at run time. + + Whether we should check for cycle or not is now a property of each + datatype. When you think there may be some cycle, use datadesc_cycle_set. + datadesc_cycle_unset allow to remove this property when previously set. + + Note that the cycle detection is off by default since it impacts the + performance. Watch the data you feed GRAS with ;) + + This property is hereditary. Any element embeeded in a structure having it + set have it set for the time of this data exchange. + + You should set it both on sender and receiver side. If you don't set it on + sender side, it will enter an endless loop. If you forget on receiver + side, the cycles won't be recreated after communication. + + - Header reorganization. + Kill gras_private.h, each submodule must load the headers it needs. + +2004-10-04 Martin Quinson + - Interface revolution: do not try to survive to malloc failure. + + Now, gras_malloc and friends call gras_abort() on failure. + As a conclusion, malloc_error is not a valid error anymore, and all + functions for which it was the only gras_error_t return value are + changed. They now return void, or there result directly. + This simplify the API a lot. + 2004-09-29 Martin Quinson - Re-enable raw sockets. Created by gras_socket_{client,server}_ext; Used with gras_raw_{send,recv} + No select possible. - It should allow to kill the last bits of gras first version. + It should allow to kill the last bits of gras first version soon. This is not completely satisfactory yet (dupplicate code with chunk_{send,recv}; a bit out of the plugin mecanism), but it should work. - - Simplify transport plugin interface by not passing any argument to - _server and _client, but embeeding them in the socket struct directly. + - Simplify transport plugin (internal) interface by not passing any + argument to _server and _client, but embeeding them in the socket + struct directly. 2004-09-28 Martin Quinson - Finish the port to AIX. @@ -28,7 +59,7 @@ 2004-09-07 Martin Quinson - Source code reorganization to allow Arnaud to surf all over there. - - Allow to document the logging categories + - Allow to document the logging categories. - Remove all uppercase from logging categories and useless cleanup in names. 2004-08-18 Martin Quinson @@ -52,7 +83,7 @@ Version 0.5 (protocol not changed; ABI changed) - Allow to off turn the cycle detection code in data exchange at compilation time. It should be at run time, but I'm short of time (and - the config stuff is still broken). That way, we keep dict of of the + the config stuff is still broken). That way, we keep dict out of the critical path, which is good because the performance is poor: - search not dichotomial yet - dynar give no way to access their content and memcpy everytime @@ -61,7 +92,7 @@ of the critical path, which is good since they rely on dynar and dictionnaries. The only loose of that is that we cannot detect the redeclaration of a structure/union with another content (but I'm not sure - the code detected this error well before anyway). We still can detect + the code detected well this error before anyway). We still can detect the redefinition discrepancy for the other types. - Use a whole bunch of optimisation flags (plus -fno-strict-aliasing since it breaks the code because of type-punning used all over the place). diff --git a/configure.ac b/configure.ac index 9552da78a9..88c7d2bf12 100644 --- a/configure.ac +++ b/configure.ac @@ -97,8 +97,7 @@ AC_CONFIG_FILES([ include/Makefile src/Makefile examples/Makefile - examples/ping/Makefile - examples/ping/test_sg + examples/ping/Makefile examples/ping/test_sg doc/Makefile tools/compile-remote-worker testsuite/Makefile @@ -115,19 +114,13 @@ AC_CONFIG_FILES([ chmod +x $srcdir/examples/ping/test_rl ]) -# src/gros/Makefile -# src/gras/Makefile - -# testsuite/gras/Makefile -# -# testsuite/gras/trp_tcp_usage -# testsuite/gras/trp_file_usage +# src/amok/Makefile +# examples/bandwidth/Makefile examples/bandwidth/test_sg +# examples/saturate/Makefile examples/saturate/test_sg +# examples/alnem/Makefile examples/alnem/test_sg -# src/examples/pastry/Makefile -# src/amok/Makefile -# src/examples/bandwidth/Makefile src/examples/saturate/Makefile -# src/examples/alnem/Makefile +# examples/pastry/Makefile examples/pastry/test_sg AC_OUTPUT diff --git a/examples/Makefile.am b/examples/Makefile.am index 6b5e04b342..c092314fa3 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,3 +1,3 @@ -SUBDIRS=ping +SUBDIRS=ping # saturate EXTRA_DIST=gras_stub_generator WAN_3.platform.txt WAN_3.platform_2.txt #bandwidth saturate alnem diff --git a/examples/ping/Makefile.am b/examples/ping/Makefile.am index 78575390bf..01d8725017 100644 --- a/examples/ping/Makefile.am +++ b/examples/ping/Makefile.am @@ -28,7 +28,3 @@ MAINTAINERCLEANFILES = _ping_simulator.c _ping_client.c _ping_server.c _ping_client.c _ping_server.c _ping_simulator.c: ping_deployment.txt $(top_srcdir)/examples/gras_stub_generator $(top_srcdir)/examples/gras_stub_generator ping ping_deployment.txt >/dev/null - -# support vpath build -#test_rl test_sg: -# cp $(srcdir)/$@ . && chmod +x $@ diff --git a/examples/saturate/Makefile.am b/examples/saturate/Makefile.am index 958e813f7c..7cad62324c 100644 --- a/examples/saturate/Makefile.am +++ b/examples/saturate/Makefile.am @@ -1,23 +1,30 @@ -DISTCLEANFILES=Makefile.in -INCLUDES= -I$(top_srcdir)/src/include +INCLUDES= -I$(top_srcdir)/include AM_CFLAGS=-g -check_PROGRAMS=saturate_simulator saturate_sensor saturate_maestro +TESTS=test_rl test_sg +EXTRA_DIST=saturate_deployment.txt $(TESTS) + +if HAVE_SG + check_PROGRAMS=saturate_simulator saturate_sensor saturate_maestro + + saturate_simulator_SOURCES=_saturate_simulator.c saturate.c + saturate_simulator_LDADD= $(top_builddir)/src/libgrassg.la @LIBS_SimGrid@ # $(top_srcdir)/src/modules/libgrasmodules.la +else + check_PROGRAMS=saturate_sensor saturate_maestro +endif -saturate_simulator_SOURCES= _saturate_simulator.c saturate.c saturate_sensor_SOURCES= _saturate_sensor.c saturate.c saturate_maestro_SOURCES= _saturate_maestro.c saturate.c -saturate_simulator_LDADD= $(top_srcdir)/src/base/libgrassg.a $(top_srcdir)/src/modules/libgrasmodules.a @LIBS_SimGrid@ -saturate_sensor_LDADD= $(top_srcdir)/src/base/libgrasrl.a $(top_srcdir)/src/modules/libgrasmodules.a -saturate_maestro_LDADD= $(top_srcdir)/src/base/libgrasrl.a $(top_srcdir)/src/modules/libgrasmodules.a +saturate_sensor_LDADD= $(top_srcdir)/src/libgrasrl.la # $(top_srcdir)/src/modules/libgrasmodules.a +saturate_maestro_LDADD= $(top_srcdir)/src/libgrasrl.la # $(top_srcdir)/src/modules/libgrasmodules.a # cleanup templates CLEANFILES= _saturate_simulator.c _saturate_sensor.c _saturate_maestro.c # generate templates _saturate_sensor.c _saturate_maestro.c _saturate_simulator.c: saturate_deployment.txt - ../gras_stub_generator saturate saturate_deployment.txt >/dev/null + $(top_srcdir)/examples/gras_stub_generator saturate saturate_deployment.txt >/dev/null diff --git a/examples/saturate/saturate.c b/examples/saturate/saturate.c index 52136fd4cd..3fe04b94a0 100644 --- a/examples/saturate/saturate.c +++ b/examples/saturate/saturate.c @@ -15,13 +15,15 @@ #include +GRAS_LOG_NEW_DEFAULT_CATEGORY(saturate,"Messages specific to this example"); + /* ********************************************************************** * Sensor code * **********************************************************************/ /* Global private data */ typedef struct { - gras_sock_t *sock; + gras_socket_t *sock; } sensor_data_t; /* Function prototypes */ @@ -31,25 +33,27 @@ int sensor (int argc,char *argv[]) { gras_error_t errcode; sensor_data_t *g=gras_userdata_new(sensor_data_t); - if ((errcode=gras_sock_server_open(4000,4000,&(g->sock)))) { - fprintf(stderr,"Sensor: Error %s encountered while opening the server socket\n",gras_error_name(errcode)); + if ((errcode=gras_socket_server(4000,&(g->sock)))) { + CRITICAL1("Sensor: Error %s encountered while opening the server socket",gras_error_name(errcode)); return 1; } if (grasbw_register_messages()) { - gras_sock_close(g->sock); + gras_socket_close(g->sock); return 1; } while (1) { - if ((errcode=gras_msg_handle(60.0)) && errcode != timeout_error) { - fprintf(stderr,"Sensor: Error '%s' while handling message\n", + if ((errcode=gras_msg_handle(60.0)) && errcode != timeout_error) { + CRITICAL1("Sensor: Error '%s' while handling message", gras_error_name(errcode)); } } - gras_sleep(5,0); - return gras_sock_close(g->sock); + gras_os_sleep(5,0); + gras_socket_close(g->sock); + + return 0; } /* ********************************************************************** @@ -58,7 +62,7 @@ int sensor (int argc,char *argv[]) { /* Global private data */ typedef struct { - gras_sock_t *sock; + gras_socket_t *sock; } maestro_data_t; /* Function prototypes */ @@ -85,7 +89,7 @@ double XP(const char *bw1, const char *bw2, const char *sat1, const char *sat2) gras_error_name(errcode)); return -1; } - gras_sleep(1,0); + gras_os_sleep(1,0); if ((errcode=grasbw_request(bw1,4000,bw2,4000,bufSize,expSize,msgSize,&sec_sat,&bw_sat))) { fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",gras_error_name(errcode)); return -1; @@ -129,18 +133,18 @@ int maestro(int argc,char *argv[]) { int a,b,c,d,begin; - if ((errcode=gras_sock_server_open(4000,5000,&(g->sock)))) { + if ((errcode=gras_socket_server(4000,&(g->sock)))) { fprintf(stderr,"MAESTRO: Error %s encountered while opening the server socket\n",gras_error_name(errcode)); return 1; } if (grasbw_register_messages()) { - gras_sock_close(g->sock); + gras_socket_close(g->sock); return 1; } begin=time(NULL); - beginSim=gras_time(); + beginSim=gras_os_time(); for (a=0; a %f (%f vs %f)%s\n", - gras_time(), + gras_os_time(), hosts[c],hosts[d],hosts[a],hosts[b], bw_sat[c][d]/bw[c][d],bw[c][d],bw_sat[c][d], @@ -200,11 +204,11 @@ int maestro(int argc,char *argv[]) { return -1; } fprintf(stderr,"Did an iteration on saturation pair in %ld sec (%.2f simulated sec)\n", - time(NULL)-begin, gras_time()-beginSim); + time(NULL)-begin, gras_os_time()-beginSim); } } - gras_sleep(5,0); + gras_os_sleep(5,0); exit(0); #if 0 return 0; @@ -216,7 +220,7 @@ int maestro(int argc,char *argv[]) { return 1; } fprintf(stderr,"MAESTRO: Saturation started\n"); - gras_sleep(5,0); + gras_os_sleep(5,0); /* test with saturation */ if ((errcode=grasbw_request(argv[1],atoi(argv[2]),argv[3],atoi(argv[4]), @@ -247,7 +251,9 @@ int maestro(int argc,char *argv[]) { expSize/1024,msgSize/1024, sec,bw); - gras_sleep(5,0); + gras_os_sleep(5,0); #endif - return gras_sock_close(g->sock); + gras_socket_close(g->sock); + + return 0; } diff --git a/include/Makefile.am b/include/Makefile.am index b8181082ab..30bddb4195 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,5 +1,6 @@ include_HEADERS = gras.h xbt.h nobase_include_HEADERS = \ + xbt/misc.h \ xbt/sysdep.h \ xbt/log.h xbt/error.h \ xbt/module.h \ diff --git a/include/gras.h b/include/gras.h index 4420bce863..4f479d48ee 100644 --- a/include/gras.h +++ b/include/gras.h @@ -22,9 +22,4 @@ #include #include -/* FIXME: This is amok */ - -#include -#include - #endif /* GRAS_H */ diff --git a/include/gras/datadesc.h b/include/gras/datadesc.h index 597686b28f..d3e57965ad 100644 --- a/include/gras/datadesc.h +++ b/include/gras/datadesc.h @@ -15,29 +15,10 @@ #include /* size_t */ #include - -/*! C++ users need love */ -#ifndef BEGIN_DECL -# ifdef __cplusplus -# define BEGIN_DECL extern "C" { -# else -# define BEGIN_DECL -# endif -#endif - -/*! C++ users need love */ -#ifndef END_DECL -# ifdef __cplusplus -# define END_DECL } -# else -# define END_DECL -# endif -#endif -/* End of cruft for C++ */ +#include "xbt/misc.h" /* BEGIN_DECL */ BEGIN_DECL - /** * gras_datadesc_type_t: * @@ -104,6 +85,9 @@ gras_datadesc_type_t * * Change stuff within datadescs * *********************************/ +void gras_datadesc_cycle_set(gras_datadesc_type_t *type); +void gras_datadesc_cycle_unset(gras_datadesc_type_t *type); + void gras_datadesc_cb_send (gras_datadesc_type_t *type, gras_datadesc_type_cb_void_t pre); void gras_datadesc_cb_recv(gras_datadesc_type_t *type, diff --git a/include/gras/messages.h b/include/gras/messages.h index b794e142c3..96e8152cd3 100644 --- a/include/gras/messages.h +++ b/include/gras/messages.h @@ -14,24 +14,9 @@ #ifndef GRAS_MESSAGES_H #define GRAS_MESSAGES_H -/*! C++ users need love */ -#ifndef BEGIN_DECL -# ifdef __cplusplus -# define BEGIN_DECL extern "C" { -# else -# define BEGIN_DECL -# endif -#endif - -/*! C++ users need love */ -#ifndef END_DECL -# ifdef __cplusplus -# define END_DECL } -# else -# define END_DECL -# endif -#endif -/* End of cruft for C++ */ +#include "xbt/misc.h" +#include "gras/transport.h" +#include "gras/datadesc.h" BEGIN_DECL diff --git a/include/gras/transport.h b/include/gras/transport.h index ae488b1495..32a5cdb3c4 100644 --- a/include/gras/transport.h +++ b/include/gras/transport.h @@ -13,6 +13,8 @@ #ifndef GRAS_TRANSPORT_H #define GRAS_TRANSPORT_H +#include "xbt/error.h" + typedef struct s_gras_socket gras_socket_t; gras_error_t gras_socket_client(const char *host, diff --git a/include/xbt/config.h b/include/xbt/config.h index db1fa61b4d..a4ff04f570 100644 --- a/include/xbt/config.h +++ b/include/xbt/config.h @@ -13,11 +13,6 @@ #ifndef _GRAS_CONFIG_H_ #define _GRAS_CONFIG_H_ -typedef struct { - char *name; - int port; -} gras_host_t; - /* For now, a config is only a special dynar. But don't rely on it, */ /* it may change in the future. */ typedef gras_dynar_t gras_cfg_t; @@ -29,7 +24,7 @@ typedef enum { } gras_cfgelm_type_t; /*----[ Memory management ]-----------------------------------------------*/ -void gras_cfg_new (gras_cfg_t **whereto); /* (whereto == NULL) is ok */ +gras_cfg_t *gras_cfg_new (void); void gras_cfg_cpy(gras_cfg_t **whereto, gras_cfg_t *tocopy); void gras_cfg_free(gras_cfg_t **cfg); void gras_cfg_dump(const char *name,const char*indent,gras_cfg_t *cfg); diff --git a/include/xbt/dict.h b/include/xbt/dict.h index 3ec4711410..a209155839 100644 --- a/include/xbt/dict.h +++ b/include/xbt/dict.h @@ -21,7 +21,7 @@ typedef struct gras_dict_ gras_dict_t; /*####[ Simple dict functions ]#############################################*/ -void gras_dict_new(gras_dict_t **dict); +gras_dict_t *gras_dict_new(void); void gras_dict_free(gras_dict_t **dict); @@ -117,9 +117,8 @@ gras_error_t gras_multidict_remove_ext(gras_dict_t *head, /*###########################################################################*/ typedef struct gras_dict_cursor_ gras_dict_cursor_t; /* creator/destructor */ -void gras_dict_cursor_new(const gras_dict_t *head, - /*OUT*/gras_dict_cursor_t **cursor); -void gras_dict_cursor_free(gras_dict_cursor_t *cursor); +gras_dict_cursor_t *gras_dict_cursor_new(const gras_dict_t *head); +void gras_dict_cursor_free(gras_dict_cursor_t *cursor); /* back to first element it is not enough to reinit the cache after an add/remove in cache*/ @@ -131,9 +130,8 @@ gras_error_t gras_dict_cursor_get_key (gras_dict_cursor_t *cursor, gras_error_t gras_dict_cursor_get_data (gras_dict_cursor_t *cursor, /*OUT*/void **data); - -void gras_dict_cursor_first (const gras_dict_t *dict, - gras_dict_cursor_t **cursor); +void gras_dict_cursor_first (const gras_dict_t *dict, + gras_dict_cursor_t **cursor); void gras_dict_cursor_step (gras_dict_cursor_t *cursor); int gras_dict_cursor_get_or_free (gras_dict_cursor_t **cursor, char **key, diff --git a/include/xbt/dynar.h b/include/xbt/dynar.h index 0e120b3eb5..9b71233453 100644 --- a/include/xbt/dynar.h +++ b/include/xbt/dynar.h @@ -17,9 +17,8 @@ typedef struct gras_dynar_s gras_dynar_t; typedef void (void_f_ppvoid_t)(void**); typedef void (void_f_pvoid_t) (void*); -void gras_dynar_new(gras_dynar_t **whereto, - size_t elm_size, - void_f_pvoid_t *free_func); +gras_dynar_t *gras_dynar_new(unsigned long elm_size, + void_f_pvoid_t *free_func); void gras_dynar_free(gras_dynar_t *dynar); void gras_dynar_free_container(gras_dynar_t *dynar); @@ -28,30 +27,26 @@ void gras_dynar_reset(gras_dynar_t *dynar); /* regular array functions */ -void gras_dynar_get(const gras_dynar_t *dynar, - int idx, void *dst); -void gras_dynar_set(gras_dynar_t *dynar, - int idx, const void *src); +void gras_dynar_get(const gras_dynar_t *dynar, int idx, void *const dst); +void gras_dynar_set(gras_dynar_t *dynar, int idx, const void *src); void gras_dynar_remplace(gras_dynar_t *dynar, - int idx, const void *object); + int idx, const void *object); /* perl array function */ void gras_dynar_insert_at(gras_dynar_t *dynar, - int idx, const void *src); + int idx, const void *src); void gras_dynar_remove_at(gras_dynar_t *dynar, - int idx, void *object); + int idx, void *object); void gras_dynar_push (gras_dynar_t *dynar, const void *src); -void gras_dynar_pop (gras_dynar_t *dynar, void *dst); +void gras_dynar_pop (gras_dynar_t *dynar, void *const dst); void gras_dynar_unshift (gras_dynar_t *dynar, const void *src); -void gras_dynar_shift (gras_dynar_t *dynar, void *dst); +void gras_dynar_shift (gras_dynar_t *dynar, void *const dst); void gras_dynar_map (const gras_dynar_t *dynar, void_f_pvoid_t *operator); /* cursor functions */ void gras_dynar_cursor_first (const gras_dynar_t *dynar, int *cursor); -void gras_dynar_cursor_step (const gras_dynar_t *dynar, - int *cursor); -int gras_dynar_cursor_get (const gras_dynar_t *dynar, - int *cursor, void *whereto); +void gras_dynar_cursor_step (const gras_dynar_t *dynar, int *cursor); +int gras_dynar_cursor_get (const gras_dynar_t *dynar, int *cursor, void *whereto); /** * gras_dynar_foreach: diff --git a/include/xbt/error.h b/include/xbt/error.h index 4c283f7b79..9aa54b2eaa 100644 --- a/include/xbt/error.h +++ b/include/xbt/error.h @@ -18,6 +18,8 @@ #include /* FIXME: Get rid of it */ +#include "xbt/log.h" + #ifdef HAVE_EXECINFO_H #include /* to print the backtrace */ #endif diff --git a/include/xbt/log.h b/include/xbt/log.h index c36e08481c..d95838a601 100644 --- a/include/xbt/log.h +++ b/include/xbt/log.h @@ -13,12 +13,13 @@ #undef GRAS_LOG_MAYDAY /*#define GRAS_LOG_MAYDAY*/ - #ifndef _GRAS_LOG_H_ #define _GRAS_LOG_H_ #include +#include "xbt/sysdep.h" + /** * gras_log_priority_t: * @gras_log_priority_none: used internally (don't poke with) diff --git a/include/xbt/set.h b/include/xbt/set.h index 8fb2e2c84a..5ab5d1c124 100644 --- a/include/xbt/set.h +++ b/include/xbt/set.h @@ -26,7 +26,7 @@ typedef struct gras_set_elm_ { /*####[ Functions ]##########################################################*/ -void gras_set_new (gras_set_t **dst); +gras_set_t *gras_set_new (void); void gras_set_free(gras_set_t **set); @@ -61,7 +61,7 @@ int gras_set_cursor_get_or_free (gras_set_cursor_t **cursor, gras_set_elm_t **elm); #define gras_set_foreach(set,cursor,elm) \ - for (cursor=NULL, gras_set_cursor_first((set),&(cursor)) ; \ + for ((cursor) = NULL, gras_set_cursor_first((set),&(cursor)) ; \ gras_set_cursor_get_or_free(&(cursor),(gras_set_elm_t**)&(elm)); \ gras_set_cursor_step(cursor) ) diff --git a/src/Makefile.am b/src/Makefile.am index b68f89d47c..1ad9ef19e2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,4 @@ -SUBDIRS=. -# amok not ported to GRAS NG yet +SUBDIRS= . # amok AM_CFLAGS= -g #AM_CFLAGS= -DNDEBUG @@ -17,7 +16,6 @@ MAINTAINERCLEANFILES=Makefile.in INCLUDES= -I$(top_srcdir)/include \ @CFLAGS_SimGrid@ EXTRA_DIST= \ - gras_private.h\ \ xbt/dict_private.h \ \ @@ -27,6 +25,8 @@ EXTRA_DIST= \ gras/Virtu/virtu_sg.h \ gras/DataDesc/ddt_parse.yy.l gras/DataDesc/ddt_parse.yy.c +# gras_private.h + #LIBRARY_VERSION= 0:0:0 # | | | # +------+ | +---+ @@ -74,7 +74,8 @@ endif COMMON_S=\ \ - xbt/xbt_interface.h \ + xbt_modinter.h gras_modinter.h \ + \ xbt/sysdep.c \ xbt/log.c xbt/log_default_appender.c xbt/error.c \ xbt/dynar.c \ diff --git a/src/amok/Makefile.am b/src/amok/Makefile.am index 94a82d5932..5f8e10a6c2 100644 --- a/src/amok/Makefile.am +++ b/src/amok/Makefile.am @@ -1,9 +1,11 @@ DISTCLEANFILES=Makefile.in -INCLUDES= -I$(top_srcdir)/src/include @CFLAGS_SimGrid@ +INCLUDES= -I$(top_srcdir)/src -I$(top_srcdir)/include @CFLAGS_SimGrid@ -lib_LIBRARIES= libgrasmodules.a +lib_LTLIBRARIES= libamok.la -libgrasmodules_a_SOURCES= \ +libamok_la_SOURCES= \ base.c bandwidth.c +VERSION_INFO= -release 20040722 -version-info 0:0:0 + diff --git a/src/amok/bandwidth.c b/src/amok/bandwidth.c index 167559c1cf..41db909bc4 100644 --- a/src/amok/bandwidth.c +++ b/src/amok/bandwidth.c @@ -1,9 +1,9 @@ /* $Id$ */ -/* gras_bandwidth - GRAS mecanism to do Bandwidth tests between to hosts */ +/* amok_bandwidth - Bandwidth tests facilities */ /* Authors: Martin Quinson */ -/* Copyright (C) 2003 the OURAGAN project. */ +/* Copyright (C) 2003, 2004 the OURAGAN project. */ /* This program is free software; you can redistribute it and/or modify it under the terms of the license (GNU LGPL) which comes with this package. */ @@ -12,149 +12,156 @@ #include #include -#include +#include "gras/messages.h" +#include "amok/bandwidth.h" /** - * BwExp_t: + * bw_request_t: * - * Description of a BW experiment (payload when asking an host to do a BW experiment with us) + * Request for a BW experiment. + * If host==NULL, it should be between the sender and the receiver. + * If not, it should be between between the receiver and @host (3-tiers). */ typedef struct { - unsigned int bufSize; - unsigned int expSize; - unsigned int msgSize; - unsigned int port; /* raw socket to use */ -} BwExp_t; - -static const DataDescriptor BwExp_Desc[] = - { SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(BwExp_t,bufSize)), - SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(BwExp_t,expSize)), - SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(BwExp_t,msgSize)), - SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(BwExp_t,port))}; -#define BwExp_Len 4 + gras_host_t host; /* host+raw socket to use */ + unsigned int buf_size; + unsigned int exp_size; + unsigned int msg_size; +} bw_request_t; /** - * SatExp_t: + * bw_res_t: * - * Description of a BW experiment (payload when asking an host to do a BW experiment with us) + * Result of a BW experiment (payload when answering). + * if err.msg != NULL, it wasn't sucessful. Check err.msg and err.code to see why. + * else */ typedef struct { - unsigned int msgSize; - unsigned int timeout; - unsigned int port; /* raw socket to use */ -} SatExp_t; + amok_remoterr_t err; + unsigned int timestamp; + double seconds; + double bw; +} bw_res_t; -static const DataDescriptor SatExp_Desc[] = - { SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(SatExp_t,msgSize)), - SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(SatExp_t,timeout)), - SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(SatExp_t,port))}; -#define SatExp_Len 3 +/** + * sat_request_t: + * + * Description of a saturation experiment (payload asking some host to collaborate for that) + */ +typedef struct { + gras_host_t host; /* host+raw socket to use */ + unsigned int msg_size; + unsigned int timeout; +} sat_request_t; /* Prototypes of local callbacks */ -int grasbw_cbBWHandshake(gras_msg_t *msg); -int grasbw_cbBWRequest(gras_msg_t *msg); +int amok_bw_cb_bw_handshake(gras_socket_t *expeditor, + void *payload); +int amok_bw_cb_bw_request(gras_socket_t *expeditor, + void *payload); -int grasbw_cbSatStart(gras_msg_t *msg); -int grasbw_cbSatBegin(gras_msg_t *msg); +int amok_bw_cb_sat_start(gras_socket_t *expeditor, + void *payload); +int amok_bw_cb_sat_begin(gras_socket_t *expeditor, + void *payload); /**** code ****/ -gras_error_t grasbw_register_messages(void) { +void amok_bw_init(void) { gras_error_t errcode; - - - if ( /* Bandwidth */ - (errcode=gras_msgtype_register(GRASMSG_BW_REQUEST,"BW request",2, - msgHostDesc,msgHostLen, - BwExp_Desc,BwExp_Len)) || - (errcode=gras_msgtype_register(GRASMSG_BW_RESULT, "BW result",2, - msgErrorDesc,msgErrorLen, - msgResultDesc,msgResultLen /* first=seconds, second=bw */)) || - - (errcode=gras_msgtype_register(GRASMSG_BW_HANDSHAKE, "BW handshake",1, - BwExp_Desc,BwExp_Len)) || - (errcode=gras_msgtype_register(GRASMSG_BW_HANDSHAKED, "BW handshake ACK",1, - BwExp_Desc,BwExp_Len)) || - - /* Saturation */ - (errcode=gras_msgtype_register(GRASMSG_SAT_START,"SAT_START",2, - msgHostDesc,msgHostLen, - SatExp_Desc,SatExp_Len)) || - (errcode=gras_msgtype_register(GRASMSG_SAT_STARTED, "SAT_STARTED",1, - msgErrorDesc,msgErrorLen)) || - - (errcode=gras_msgtype_register(GRASMSG_SAT_BEGIN,"SAT_BEGIN",1, - SatExp_Desc,SatExp_Len)) || - (errcode=gras_msgtype_register(GRASMSG_SAT_BEGUN, "SAT_BEGUN",2, - msgErrorDesc,msgErrorLen, - SatExp_Desc,SatExp_Len)) || - - (errcode=gras_msgtype_register(GRASMSG_SAT_END,"SAT_END",0)) || - (errcode=gras_msgtype_register(GRASMSG_SAT_ENDED, "SAT_ENDED",1, - msgErrorDesc,msgErrorLen)) || - - (errcode=gras_msgtype_register(GRASMSG_SAT_STOP,"SAT_STOP",0)) || - (errcode=gras_msgtype_register(GRASMSG_SAT_STOPPED, "SAT_STOPPED",1, - msgErrorDesc,msgErrorLen)) ) - { - - fprintf(stderr,"GRASBW: Unable register the messages (got error %s)\n", - gras_error_name(errcode)); - return errcode; - } - - if ((errcode=gras_cb_register(GRASMSG_BW_HANDSHAKE,-1,&grasbw_cbBWHandshake)) || - (errcode=gras_cb_register(GRASMSG_BW_REQUEST,-1,&grasbw_cbBWRequest)) || - - (errcode=gras_cb_register(GRASMSG_SAT_START,-1,&grasbw_cbSatStart)) || - (errcode=gras_cb_register(GRASMSG_SAT_BEGIN,-1,&grasbw_cbSatBegin)) ) { - - fprintf(stderr,"GRASBW: Unable register the callbacks (got error %s)\n", - gras_error_name(errcode)); - return errcode; - } - - return no_error; + gras_datadesc_type_t *bw_request_desc, *bw_res_desc, *sat_request_desc; + + amok_base_init(); + + /* Build the datatype descriptions */ + bw_request_desc = gras_datadesc_struct("bw_request_t"); + gras_datadesc_struct_append(bw_request_desc,"host",gras_datadesc_by_name("gras_host_t*")); + gras_datadesc_struct_append(bw_request_desc,"buf_size",gras_datadesc_by_name("unsigned int")); + gras_datadesc_struct_append(bw_request_desc,"exp_size",gras_datadesc_by_name("unsigned int")); + gras_datadesc_struct_append(bw_request_desc,"msg_size",gras_datadesc_by_name("unsigned int")); + gras_datadesc_struct_close(bw_request_desc); + bw_request_desc = gras_datadesc_ref("bw_request_t*",bw_request_desc); + + bw_res_desc = gras_datadesc_struct("bw_res_t"); + gras_datadesc_struct_append(bw_res_desc,"err",gras_datadesc_by_name("amok_remoterr_t")); + gras_datadesc_struct_append(bw_res_desc,"timestamp",gras_datadesc_by_name("unsigned int")); + gras_datadesc_struct_append(bw_res_desc,"seconds",gras_datadesc_by_name("double")); + gras_datadesc_struct_append(bw_res_desc,"bw",gras_datadesc_by_name("double")); + gras_datadesc_struct_close(bw_res_desc); + bw_res_desc = gras_datadesc_ref("bw_res_t*",bw_res_desc); + + sat_request_desc = gras_datadesc_struct("sat_request_desc"); + gras_datadesc_struct_append(sat_request_desc,"host",gras_datadesc_by_name("gras_host_t")); + gras_datadesc_struct_append(sat_request_desc,"msg_size",gras_datadesc_by_name("unsigned int")); + gras_datadesc_struct_append(sat_request_desc,"timeout",gras_datadesc_by_name("unsigned int")); + gras_datadesc_struct_close(sat_request_desc); + sat_request_desc = gras_datadesc_ref("sat_request_t*",sat_request_desc); + + /* Register the bandwidth messages */ + gras_msgtype_declare("BW request", bw_request_desc); + gras_msgtype_declare("BW result", bw_res_desc); + gras_msgtype_declare("BW handshake", bw_request_desc); + gras_msgtype_declare("BW handshake ACK", bw_request_desc); + + /* Register the saturation messages */ + gras_msgtype_declare("SAT start", sat_request_desc); + gras_msgtype_declare("SAT started", gras_datadesc_by_name("amok_remoterr_t")); + gras_msgtype_declare("SAT begin", sat_request_desc); + gras_msgtype_declare("SAT begun", gras_datadesc_by_name("amok_remoterr_t")); + gras_msgtype_declare("SAT end", NULL); + gras_msgtype_declare("SAT ended", gras_datadesc_by_name("amok_remoterr_t")); + gras_msgtype_declare("SAT stop", NULL); + gras_msgtype_declare("SAT stopped", gras_datadesc_by_name("amok_remoterr_t")); + + /* Register the callbacks */ + gras_cb_register(gras_msgtype_by_name("BW request"), + &amok_bw_cb_bw_request); + gras_cb_register(gras_msgtype_by_name("BW handshake"), + &amok_bw_cb_bw_handshake); + + gras_cb_register(gras_msgtype_by_name("SAT start"), + &amok_bw_cb_sat_start); + gras_cb_register(gras_msgtype_by_name("SAT begin"), + &amok_bw_cb_sat_begin); } /* *************************************************************************** * Bandwidth tests * ***************************************************************************/ /* Function to do a test from local to given host */ -gras_error_t grasbw_test(const char*to_name,unsigned int to_port, - unsigned int bufSize,unsigned int expSize,unsigned int msgSize, - /*OUT*/ double *sec, double *bw) { - gras_rawsock_t *rawIn,*rawOut; - gras_sock_t *sock; +/** + * amok_bw_test: + * + * Conduct a test between the local host and @peer, and + * report the result in last args + */ +gras_error_t amok_bw_test(gras_socket_t *peer, + unsigned int bufSize,unsigned int expSize,unsigned int msgSize, + /*OUT*/ double *sec, double *bw) { + gras_socket_t *rawIn,*rawOut; + int port; gras_error_t errcode; - BwExp_t *request; + bw_request_t *request; gras_msg_t *answer; - if((errcode=gras_sock_client_open(to_name,to_port,&sock))) { - fprintf(stderr,"grasbw_test(): Error %s encountered while contacting peer\n", - gras_error_name(errcode)); - return errcode; - } - if ((errcode=gras_rawsock_server_open(6666,8000,bufSize,&rawIn))) { - fprintf(stderr,"grasbw_test(): Error %s encountered while opening a raw socket\n", - gras_error_name(errcode)); + for (port = 5000, errcode = system_error; + errcode == system_error; + errcode = gras_socket_server_ext(++port,bufSize,1,&rawIn)); + if (errcode != no_error) { + ERROR1("Error %s encountered while opening a raw socket\n", + gras_error_name(errcode)); return errcode; } - if (!(request=(BwExp_t *)malloc(sizeof(BwExp_t)))) { - fprintf(stderr,"grasbw_test(): Malloc error\n"); - gras_sock_close(sock); - return malloc_error; - } + request=gras_new(bw_request_t); request->bufSize=bufSize; request->expSize=expSize; request->msgSize=msgSize; - request->port=gras_rawsock_get_peer_port(rawIn); + request->host.name = NULL; + request->host.port = gras_socket_peer_port(rawIn); - if ((errcode=gras_msg_new_and_send(sock,GRASMSG_BW_HANDSHAKE, 1, - request,1))) { - fprintf(stderr,"grasbw_test(): Error %s encountered while sending the request.\n", - gras_error_name(errcode)); + if ((errcode=gras_send(peer,gras_msgtype_by_name("BW handshake"),request))) { + ERROR1("Error %s encountered while sending the request.", gras_error_name(errcode)); gras_sock_close(sock); return errcode; } @@ -190,6 +197,9 @@ gras_error_t grasbw_test(const char*to_name,unsigned int to_port, return no_error; } +#if 0 + + /* Callback to the GRASMSG_BW_HANDSHAKE message: opens a server raw socket, indicate its port in an answer GRASMSG_BW_HANDSHAKED message, @@ -685,3 +695,4 @@ gras_error_t grasbw_saturate_stop(const char* from_name,unsigned int from_port, return no_error; } +#endif diff --git a/src/amok/base.c b/src/amok/base.c index 8278bb62b5..7a62512ad8 100644 --- a/src/amok/base.c +++ b/src/amok/base.c @@ -1,6 +1,6 @@ /* $Id$ */ -/* gras_addons - several addons to do specific stuff not in GRAS itself */ +/* base - several addons to do specific stuff not in GRAS itself */ /* Authors: Martin Quinson */ /* Copyright (C) 2003 the OURAGAN project. */ @@ -10,29 +10,88 @@ #include #include +#include -#include +#include "xbt/error.h" +#include "gras/datadesc.h" +#include "amok/base.h" -void -grasRepportError (gras_sock_t *sock, gras_msgid_t id, int SeqCount, - const char *severeError, - gras_error_t errcode, const char* format,...) { - msgError_t *error; +GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(amok,GRAS_LOG_ROOT_CAT,"All AMOK categories"); + +amok_remoterr_t *amok_remoterr_new(gras_error_t param_errcode, + const char* format,...) { + + amok_remoterr_t *res; + va_list ap; + va_start(ap,format); + res = amok_remoterr_new_va(param_errcode,format,ap); + va_end(ap); + return res; +} - if (!(error=(msgError_t*)malloc(sizeof(msgError_t)))) { - fprintf(stderr,severeError); - return; +amok_remoterr_t *amok_remoterr_new_va(gras_error_t param_errcode, + const char* format,va_list ap) { + amok_remoterr_t *res=gras_new(amok_remoterr_t,1); + res->code=param_errcode; + if (format) { + res->msg=(char*)gras_malloc(1024); + vsnprintf(res->msg,1024,format,ap); + } else { + res->msg = NULL; } + + return res; +} + +void amok_remoterr_free(amok_remoterr_t*err) { + if (err) { + if (err->msg) gras_free(err->msg); + gras_free(err); + } +} + - error->errcode=errcode; +void +amok_repport_error (gras_socket_t *sock, gras_msgtype_t *msgtype, + gras_error_t param_errcode, const char* format,...) { + amok_remoterr_t *error; + gras_error_t errcode; + va_list ap; + + error=gras_new(amok_remoterr_t,1); + error->code=param_errcode; + error->msg=(char*)gras_malloc(1024); /* FIXME */ va_start(ap,format); - vsprintf(error->errmsg,format,ap); + vsnprintf(error->msg,1024,format,ap); va_end(ap); - /* FIXME: If message id have more than 17 sequences, the following won't work */ - if (gras_msg_new_and_send(sock,id,SeqCount, error,1,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0, - NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0)) { - fprintf(stderr,severeError); + errcode = gras_msg_send(sock,msgtype,error); + if (errcode != no_error) { + CRITICAL4("Error '%s' while reporting error '%s' to %s:%d", + gras_error_name(errcode),error->msg, + gras_socket_peer_name(sock),gras_socket_peer_port(sock) ); } } + +void amok_base_init(void) { + gras_datadesc_type_t *host_desc, *remoterr_desc; + + /* Build the datatype descriptions */ + host_desc = gras_datadesc_struct("gras_host_t"); + gras_datadesc_struct_append(host_desc,"name",gras_datadesc_by_name("string")); + gras_datadesc_struct_append(host_desc,"exp_size",gras_datadesc_by_name("int")); + gras_datadesc_struct_close(host_desc); + host_desc = gras_datadesc_ref("gras_host_t*",host_desc); + + remoterr_desc = gras_datadesc_struct("amok_remoterr_t"); + gras_datadesc_struct_append(remoterr_desc,"msg",gras_datadesc_by_name("string")); + gras_datadesc_struct_append(remoterr_desc,"code",gras_datadesc_by_name("unsigned int")); + gras_datadesc_struct_close(remoterr_desc); + remoterr_desc = gras_datadesc_ref("amok_remoterr_t*",remoterr_desc); +} + +void amok_base_exit(void) { + /* No real module mecanism in GRAS so far, nothing to do. */ +} + diff --git a/src/gras/DataDesc/cbps.c b/src/gras/DataDesc/cbps.c index cfbb4af274..066fef5681 100644 --- a/src/gras/DataDesc/cbps.c +++ b/src/gras/DataDesc/cbps.c @@ -37,11 +37,11 @@ gras_cbps_t * gras_cbps_new(void) { res=gras_new(gras_cbps_t,1); - gras_dynar_new(&(res->lints), sizeof(int), NULL); - gras_dict_new(&(res->space)); + res->lints = gras_dynar_new(sizeof(int), NULL); + res->space = gras_dict_new(); /* no leak, the content is freed manually on block_end */ - gras_dynar_new(&(res->frames), sizeof(gras_dynar_t*), NULL); - gras_dynar_new(&(res->globals), sizeof(char*), NULL); + res->frames = gras_dynar_new(sizeof(gras_dynar_t*), NULL); + res->globals = gras_dynar_new(sizeof(char*), NULL); gras_cbps_block_begin(res); @@ -84,7 +84,7 @@ gras_cbps_v_push(gras_cbps_t *ps, if (errcode == mismatch_error) { DEBUG1("Create a new variable stack for '%s' into the space",name); - gras_dynar_new(&varstack, sizeof (gras_cbps_elm_t *), NULL); + varstack = gras_dynar_new(sizeof (gras_cbps_elm_t *), NULL); gras_dict_set(ps->space, varname, (void **)varstack, NULL); /* leaking, you think? only if you do not close all the openned blocks ;)*/ } else if (errcode != no_error) { @@ -188,7 +188,7 @@ gras_cbps_v_set (gras_cbps_t *ps, errcode = gras_dict_get(ps->space, name, (void **)&p_dynar); if (errcode == mismatch_error) { - gras_dynar_new(&p_dynar, sizeof (gras_cbps_elm_t *), NULL); + p_dynar = gras_dynar_new(sizeof (gras_cbps_elm_t *), NULL); gras_dict_set(ps->space, name, (void **)p_dynar, NULL); p_elm = gras_new0(gras_cbps_elm_t,1); @@ -255,7 +255,7 @@ gras_cbps_block_begin(gras_cbps_t *ps) { gras_dynar_t *p_dynar = NULL; DEBUG0(">>> Block begin"); - gras_dynar_new(&p_dynar, sizeof (char *), NULL); + p_dynar = gras_dynar_new(sizeof (char *), NULL); gras_dynar_push(ps->frames, &p_dynar); } diff --git a/src/gras/DataDesc/datadesc.c b/src/gras/DataDesc/datadesc.c index 729e301572..1b0515badf 100644 --- a/src/gras/DataDesc/datadesc.c +++ b/src/gras/DataDesc/datadesc.c @@ -41,7 +41,7 @@ gras_datadesc_init(void) { VERB0("Initializing DataDesc"); - gras_set_new(&gras_datadesc_set_local); + gras_datadesc_set_local = gras_set_new(); ddt = gras_datadesc_scalar("signed char", gras_ddt_scalar_char, diff --git a/src/gras/DataDesc/datadesc_private.h b/src/gras/DataDesc/datadesc_private.h index 2d21aadbe8..6350d6b638 100644 --- a/src/gras/DataDesc/datadesc_private.h +++ b/src/gras/DataDesc/datadesc_private.h @@ -13,8 +13,21 @@ #ifndef GRAS_DATADESC_PRIVATE_H #define GRAS_DATADESC_PRIVATE_H -#include "gras_private.h" -#include "gras/DataDesc/datadesc_interface.h" +#include "xbt/sysdep.h" +#include "xbt/log.h" +#include "xbt/error.h" +#include "xbt/dynar.h" +#include "xbt/dict.h" +#include "xbt/set.h" + +#include "gras_config.h" /* GRAS_THISARCH */ + +#include "gras/transport.h" /* socket handling */ + +#include "gras_modinter.h" /* module init/exit */ +#include "gras/datadesc.h" /* rest of module public interface */ + +#include "gras/DataDesc/datadesc_interface.h" /* semi-public API */ /** * aligned: @@ -225,6 +238,8 @@ struct s_gras_datadesc_type { gras_datadesc_type_cb_void_t send; gras_datadesc_type_cb_void_t recv; + + int cycle; /* true if the datatype may contain cycle */ }; /*************************** diff --git a/src/gras/DataDesc/ddt_create.c b/src/gras/DataDesc/ddt_create.c index 757b6cf21d..d7e021d558 100644 --- a/src/gras/DataDesc/ddt_create.c +++ b/src/gras/DataDesc/ddt_create.c @@ -8,6 +8,7 @@ /* This program is free software; you can redistribute it and/or modify it under the terms of the license (GNU LGPL) which comes with this package. */ +#include "xbt/misc.h" /* min()/max() */ #include "gras/DataDesc/datadesc_private.h" GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_create,datadesc,"Creating new datadescriptions"); @@ -25,9 +26,7 @@ void gras_ddt_freev(void *ddt) { } } -static void -gras_ddt_new(const char *name, - gras_datadesc_type_t **dst) { +static gras_datadesc_type_t *gras_ddt_new(const char *name) { gras_error_t errcode; gras_datadesc_type_t *res; @@ -36,11 +35,12 @@ gras_ddt_new(const char *name, res->name = (char*)strdup(name); res->name_len = strlen(name); + res->cycle = 0; - *dst=res; gras_set_add(gras_datadesc_set_local, (gras_set_elm_t*)res,&gras_ddt_freev); GRAS_OUT; + return res; } /** @@ -100,7 +100,7 @@ gras_datadesc_type_t * VERB1("Discarding redefinition of %s",name); return res; } - gras_ddt_new(name,&res); + res = gras_ddt_new(name); for (arch = 0; arch < gras_arch_count; arch ++) { long int sz; @@ -187,7 +187,7 @@ gras_datadesc_type_t * VERB1("Discarding redefinition of %s",name); return res; } - gras_ddt_new(name,&res); + res = gras_ddt_new(name); for (arch=0; archsize[arch] = 0; @@ -195,9 +195,9 @@ gras_datadesc_type_t * res->aligned_size[arch] = 0; } res->category_code = e_gras_datadesc_type_cat_struct; - gras_dynar_new(&(res->category.struct_data.fields), - sizeof(gras_dd_cat_field_t*), - &gras_dd_cat_field_free); + res->category.struct_data.fields = + gras_dynar_new(sizeof(gras_dd_cat_field_t*), + &gras_dd_cat_field_free); GRAS_OUT; return res; @@ -273,6 +273,31 @@ gras_datadesc_struct_close(gras_datadesc_type_t *struct_type) { struct_type->category.struct_data.closed = 1; } +/** + * gras_datadesc_cycle_set: + * + * Tell GRAS that the pointers of the type described by @ddt may present + * some loop, and that the cycle detection mecanism is needed. + * + * Note that setting this option when not needed have a rather bad effect + * on the performance (several times slower on big data). + */ +void +gras_datadesc_cycle_set(gras_datadesc_type_t *ddt) { + ddt->cycle = 1; +} +/** + * gras_datadesc_cycle_unset: + * + * Tell GRAS that the pointers of the type described by @ddt do not present + * any loop and that cycle detection mecanism are not needed. + * (default) + */ +void +gras_datadesc_cycle_unset(gras_datadesc_type_t *ddt) { + ddt->cycle = 0; +} + /** * gras_datadesc_union: * @@ -301,7 +326,7 @@ gras_datadesc_union(const char *name, return res; } - gras_ddt_new(name,&res); + res = gras_ddt_new(name); for (arch=0; archsize[arch] = 0; @@ -310,9 +335,9 @@ gras_datadesc_union(const char *name, } res->category_code = e_gras_datadesc_type_cat_union; - gras_dynar_new(&(res->category.union_data.fields), - sizeof(gras_dd_cat_field_t*), - &gras_dd_cat_field_free); + res->category.union_data.fields = + gras_dynar_new(sizeof(gras_dd_cat_field_t*), + &gras_dd_cat_field_free); res->category.union_data.selector = selector; return res; @@ -391,7 +416,7 @@ gras_datadesc_type_t * return res; } - gras_ddt_new(name,&res); + res = gras_ddt_new(name); gras_assert0(pointer_type, "Cannot get the description of data pointer"); @@ -432,7 +457,7 @@ gras_datadesc_type_t * VERB1("Discarding redefinition of %s",name); return res; } - gras_ddt_new(name,&res); + res = gras_ddt_new(name); gras_assert0(pointer_type, "Cannot get the description of data pointer"); @@ -478,7 +503,7 @@ gras_datadesc_type_t * return res; } - gras_ddt_new(name,&res); + res = gras_ddt_new(name); gras_assert1(fixed_size > 0, "'%s' is a array of null fixed size",name); for (arch=0; archsize[arch] = 0; /* make sure it indicates "dynamic" */ diff --git a/src/gras/DataDesc/ddt_exchange.c b/src/gras/DataDesc/ddt_exchange.c index 05df6ce52b..4bd36ed966 100644 --- a/src/gras/DataDesc/ddt_exchange.c +++ b/src/gras/DataDesc/ddt_exchange.c @@ -13,14 +13,6 @@ GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_exchange,datadesc, "Sending data over the network"); - -#undef DETECT_CYCLE -/* CRUDE HACK to turn all cycle detection of */ -#ifndef DETECT_CYCLE -#define gras_dict_get_ext(a,b,c,d) mismatch_error -#define gras_dict_set_ext(a,b,c,d,e) no_error -#endif - const char *gras_datadesc_cat_names[9] = { "undefined", "scalar", "struct", "union", "ref", "array", "ignored", @@ -34,8 +26,9 @@ static _GRAS_INLINE gras_error_t gras_dd_recv_int(gras_socket_t *sock, int r_arc static _GRAS_INLINE gras_error_t gras_dd_alloc_ref(gras_dict_t *refs, long int size, char **r_ref, long int r_len, - char **l_ref); -static _GRAS_INLINE int + char **l_ref, int detect_cycle); + +static _GRAS_INLINE int gras_dd_is_r_null(char **r_ptr, long int length); static gras_error_t @@ -43,7 +36,8 @@ gras_datadesc_send_rec(gras_socket_t *sock, gras_cbps_t *state, gras_dict_t *refs, gras_datadesc_type_t *type, - char *data); + char *data, + int detect_cycle); static gras_error_t gras_datadesc_recv_rec(gras_socket_t *sock, gras_cbps_t *state, @@ -53,7 +47,8 @@ gras_datadesc_recv_rec(gras_socket_t *sock, char **r_data, long int r_lgr, char *dst, - int subsize); + int subsize, + int detect_cycle); static _GRAS_INLINE gras_error_t @@ -117,7 +112,8 @@ gras_dd_alloc_ref(gras_dict_t *refs, long int size, char **r_ref, long int r_len, /* pointer_type->size[r_arch] */ - char **l_ref) { + char **l_ref, + int detect_cycle) { char *l_data = NULL; gras_assert1(size>0,"Cannot allocate %ld bytes!", size); @@ -128,8 +124,7 @@ gras_dd_alloc_ref(gras_dict_t *refs, DEBUG3("alloc_ref: r_ref=%p; *r_ref=%p, r_len=%ld", (void*)r_ref, (void*)(r_ref?*r_ref:NULL), r_len); -#ifdef DETECT_CYCLE - if (r_ref && !gras_dd_is_r_null( r_ref, r_len)) { + if (detect_cycle && r_ref && !gras_dd_is_r_null( r_ref, r_len)) { gras_error_t errcode; void *ptr = gras_malloc(sizeof(void *)); @@ -137,9 +132,9 @@ gras_dd_alloc_ref(gras_dict_t *refs, DEBUG2("Insert %p under %p",*(void**)ptr, *(void**)r_ref); - TRY(gras_dict_set_ext(refs,(const char *) r_ref, r_len, ptr, gras_free)); + if (detect_cycle) + gras_dict_set_ext(refs,(const char *) r_ref, r_len, ptr, gras_free); } -#endif return no_error; } @@ -318,7 +313,8 @@ gras_datadesc_send_rec(gras_socket_t *sock, gras_cbps_t *state, gras_dict_t *refs, gras_datadesc_type_t *type, - char *data) { + char *data, + int detect_cycle) { gras_error_t errcode; int cpt; @@ -356,7 +352,7 @@ gras_datadesc_send_rec(gras_socket_t *sock, field->pre(state,field_data); VERB1("Send field %s",field->name); - TRY(gras_datadesc_send_rec(sock,state,refs,sub_type, field_data)); + TRY(gras_datadesc_send_rec(sock,state,refs,sub_type, field_data, detect_cycle || sub_type->cycle)); if (field->post) field->post(state,field_data); @@ -397,7 +393,7 @@ gras_datadesc_send_rec(gras_socket_t *sock, if (field->pre) field->pre(state,data); - TRY(gras_datadesc_send_rec(sock,state,refs, sub_type, data)); + TRY(gras_datadesc_send_rec(sock,state,refs, sub_type, data, detect_cycle || sub_type->cycle)); if (field->post) field->post(state,data); @@ -409,9 +405,7 @@ gras_datadesc_send_rec(gras_socket_t *sock, gras_dd_cat_ref_t ref_data; void **ref=(void**)data; -#ifdef DETECT_CYCLE void *dummy; -#endif ref_data = type->category.ref_data; @@ -436,16 +430,19 @@ gras_datadesc_send_rec(gras_socket_t *sock, VERB0("Not sending NULL referenced data"); break; } - errcode = gras_dict_get_ext(refs,(char*)ref, sizeof(void*), &dummy); + errcode = detect_cycle + ? gras_dict_get_ext(refs,(char*)ref, sizeof(void*), &dummy) + : mismatch_error; if (errcode == mismatch_error) { - VERB1("Sending data referenced at %p", (void*)*ref); - TRY(gras_dict_set_ext(refs, (char*)ref, sizeof(void*), ref, NULL)); - TRY(gras_datadesc_send_rec(sock,state,refs, sub_type, *ref)); - + VERB1("Sending data referenced at %p", (void*)*ref); + if (detect_cycle) + gras_dict_set_ext(refs, (char*)ref, sizeof(void*), ref, NULL); + TRY(gras_datadesc_send_rec(sock,state,refs, sub_type, *ref, detect_cycle || sub_type->cycle)); + } else if (errcode == no_error) { - VERB1("Not sending data referenced at %p (already done)", (void*)*ref); + VERB1("Not sending data referenced at %p (already done)", (void*)*ref); } else { - return errcode; + return errcode; } break; @@ -477,7 +474,7 @@ gras_datadesc_send_rec(gras_socket_t *sock, sub_type->aligned_size[GRAS_THISARCH] * count)); } else { for (cpt=0; cptcycle)); ptr += elm_size; } } @@ -505,10 +502,10 @@ gras_error_t gras_datadesc_send(gras_socket_t *sock, gras_cbps_t *state = NULL; gras_dict_t *refs; /* all references already sent */ - gras_dict_new(&refs); + refs = gras_dict_new(); state = gras_cbps_new(); - errcode = gras_datadesc_send_rec(sock,state,refs,type,(char*)src); + errcode = gras_datadesc_send_rec(sock,state,refs,type,(char*)src, type->cycle); gras_dict_free(&refs); gras_cbps_free(&state); @@ -537,7 +534,8 @@ gras_datadesc_recv_rec(gras_socket_t *sock, char **r_data, long int r_lgr, char *l_data, - int subsize) { + int subsize, + int detect_cycle) { gras_error_t errcode; int cpt; @@ -579,7 +577,8 @@ gras_datadesc_recv_rec(gras_socket_t *sock, TRY(gras_datadesc_recv_rec(sock,state,refs, sub_type, r_arch,NULL,0, - field_data,-1)); + field_data,-1, + detect_cycle || sub_type->cycle)); } VERB1("<< Received all fields of the structure %s", type->name); @@ -612,7 +611,8 @@ gras_datadesc_recv_rec(gras_socket_t *sock, TRY(gras_datadesc_recv_rec(sock,state,refs, sub_type, r_arch,NULL,0, - l_data,-1)); + l_data,-1, + detect_cycle || sub_type->cycle)); break; } @@ -650,10 +650,12 @@ gras_datadesc_recv_rec(gras_socket_t *sock, gras_free(r_ref); break; } - errcode = gras_dict_get_ext(refs, + + errcode = detect_cycle + ? gras_dict_get_ext(refs, (char*)r_ref, pointer_type->size[r_arch], - (void**)&l_ref); - + (void**)&l_ref) + : mismatch_error; if (errcode == mismatch_error) { int subsubcount = 0; @@ -677,16 +679,19 @@ gras_datadesc_recv_rec(gras_socket_t *sock, TRY(gras_dd_alloc_ref(refs, subsub_type->size[GRAS_THISARCH] * subsubcount, r_ref,pointer_type->size[r_arch], - (char**)&l_referenced)); + (char**)&l_referenced, + detect_cycle)); } else { TRY(gras_dd_alloc_ref(refs,sub_type->size[GRAS_THISARCH], r_ref,pointer_type->size[r_arch], - (char**)&l_referenced)); + (char**)&l_referenced, + detect_cycle)); } TRY(gras_datadesc_recv_rec(sock,state,refs, sub_type, r_arch,r_ref,pointer_type->size[r_arch], - (char*)l_referenced, subsubcount)); + (char*)l_referenced, subsubcount, + detect_cycle || sub_type->cycle)); *(void**)l_data=l_referenced; VERB3("'%s' remotely referenced at %p locally at %p", sub_type->name, *(void**)r_ref, l_referenced); @@ -748,7 +753,8 @@ gras_datadesc_recv_rec(gras_socket_t *sock, ptr = l_data; for (cpt=0; cptcycle)); ptr += elm_size; } } @@ -782,12 +788,13 @@ gras_datadesc_recv(gras_socket_t *sock, gras_cbps_t *state = NULL; /* callback persistent state */ gras_dict_t *refs; /* all references already sent */ - gras_dict_new(&refs); + refs = gras_dict_new(); state = gras_cbps_new(); errcode = gras_datadesc_recv_rec(sock, state, refs, type, r_arch, NULL, 0, - (char *) dst,-1); + (char *) dst,-1, + type->cycle); gras_dict_free(&refs); gras_cbps_free(&state); diff --git a/src/gras/DataDesc/ddt_parse.c b/src/gras/DataDesc/ddt_parse.c index 7599c9c1f5..0885117175 100644 --- a/src/gras/DataDesc/ddt_parse.c +++ b/src/gras/DataDesc/ddt_parse.c @@ -447,8 +447,8 @@ static gras_datadesc_type_t *parse_struct(char *definition) { gras_datadesc_type_t *struct_type; GRAS_IN; - gras_dynar_new(&identifiers,sizeof(identifier_t),NULL); - gras_dynar_new(&fields_to_push,sizeof(char*),NULL); + identifiers = gras_dynar_new(sizeof(identifier_t),NULL); + fields_to_push = gras_dynar_new(sizeof(char*),NULL); /* Create the struct descriptor */ if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) { diff --git a/src/gras/Msg/msg.c b/src/gras/Msg/msg.c index ce37d34a1e..b787bfa260 100644 --- a/src/gras/Msg/msg.c +++ b/src/gras/Msg/msg.c @@ -33,7 +33,7 @@ void gras_msg_init(void) { VERB0("Initializing Msg"); - gras_set_new(&_gras_msgtype_set); + _gras_msgtype_set = gras_set_new(); memcpy(GRAS_header,"GRAS", 4); GRAS_header[4]=GRAS_PROTOCOL_VERSION; @@ -437,7 +437,7 @@ gras_cb_register(gras_msgtype_t *msgtype, /* First cb? Create room */ list = gras_new(gras_cblist_t,1); list->id = msgtype->code; - gras_dynar_new(&(list->cbs), sizeof(gras_cb_t), NULL); + list->cbs = gras_dynar_new(sizeof(gras_cb_t), NULL); gras_dynar_push(pd->cbl_list,&list); } diff --git a/src/gras/Msg/msg_private.h b/src/gras/Msg/msg_private.h index 6d71574bfb..7e36382860 100644 --- a/src/gras/Msg/msg_private.h +++ b/src/gras/Msg/msg_private.h @@ -13,7 +13,20 @@ #ifndef GRAS_MESSAGE_PRIVATE_H #define GRAS_MESSAGE_PRIVATE_H -#include "gras_private.h" +#include "gras_config.h" + +#include "xbt/sysdep.h" +#include "xbt/log.h" +#include "xbt/error.h" +#include "xbt/dynar.h" +#include "xbt/set.h" +#include "gras/transport.h" +#include "gras/datadesc.h" +#include "gras/virtu.h" + +#include "gras/messages.h" +#include "gras_modinter.h" + #include "gras/Msg/msg_interface.h" /** diff --git a/src/gras/Transport/transport.c b/src/gras/Transport/transport.c index f6014ee413..afbfdddf52 100644 --- a/src/gras/Transport/transport.c +++ b/src/gras/Transport/transport.c @@ -46,11 +46,9 @@ gras_trp_plugin_new(const char *name, gras_trp_setup_t setup) { } -void -gras_trp_init(void){ - +void gras_trp_init(void){ /* make room for all plugins */ - gras_dict_new(&_gras_trp_plugins); + _gras_trp_plugins=gras_dict_new(); /* Add them */ gras_trp_plugin_new("tcp", gras_trp_tcp_setup); @@ -325,18 +323,35 @@ char *gras_socket_peer_name(gras_socket_t *sock) { gras_error_t gras_socket_raw_send(gras_socket_t *peer, unsigned int timeout, - unsigned long int expSize, - unsigned long int msgSize) { - + unsigned long int exp_size, + unsigned long int msg_size) { + gras_error_t errcode; + char *chunk = gras_malloc(msg_size); + int exp_sofar; + gras_assert0(peer->raw,"Asked to send raw data on a regular socket\n"); - return gras_socket_raw_exchange(peer,1,timeout,expSize,msgSize); + for (exp_sofar=0; exp_sofar < exp_size; exp_sofar += msg_size) { + TRY(gras_trp_chunk_send(peer,chunk,msg_size)); + } + + gras_free(chunk); + return no_error;//gras_socket_raw_exchange(peer,1,timeout,expSize,msgSize); } gras_error_t gras_socket_raw_recv(gras_socket_t *peer, unsigned int timeout, - unsigned long int expSize, - unsigned long int msgSize){ + unsigned long int exp_size, + unsigned long int msg_size){ + gras_error_t errcode; + char *chunk = gras_malloc(msg_size); + int exp_sofar; + gras_assert0(peer->raw,"Asked to recveive raw data on a regular socket\n"); - return gras_socket_raw_exchange(peer,0,timeout,expSize,msgSize); + for (exp_sofar=0; exp_sofar < exp_size; exp_sofar += msg_size) { + TRY(gras_trp_chunk_send(peer,chunk,msg_size)); + } + + gras_free(chunk); + return no_error;//gras_socket_raw_exchange(peer,0,timeout,expSize,msgSize); } diff --git a/src/gras/Transport/transport_plugin_buf.c b/src/gras/Transport/transport_plugin_buf.c index cc11972e22..26410d2191 100644 --- a/src/gras/Transport/transport_plugin_buf.c +++ b/src/gras/Transport/transport_plugin_buf.c @@ -12,7 +12,7 @@ #include #include /* memset */ -#include "gras_private.h" +#include "xbt/misc.h" #include "transport_private.h" GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_buf,transport, diff --git a/src/gras/Transport/transport_plugin_file.c b/src/gras/Transport/transport_plugin_file.c index e542ff7ccb..11f1a29cda 100644 --- a/src/gras/Transport/transport_plugin_file.c +++ b/src/gras/Transport/transport_plugin_file.c @@ -15,7 +15,6 @@ #include #include -#include "gras_private.h" #include "transport_private.h" GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_file,transport, diff --git a/src/gras/Transport/transport_plugin_sg.c b/src/gras/Transport/transport_plugin_sg.c index 173f115491..5e685834a0 100644 --- a/src/gras/Transport/transport_plugin_sg.c +++ b/src/gras/Transport/transport_plugin_sg.c @@ -14,7 +14,6 @@ #include -#include "gras_private.h" #include "transport_private.h" #include "gras/Virtu/virtu_sg.h" diff --git a/src/gras/Transport/transport_plugin_tcp.c b/src/gras/Transport/transport_plugin_tcp.c index 25ee77fa88..56aa78e37d 100644 --- a/src/gras/Transport/transport_plugin_tcp.c +++ b/src/gras/Transport/transport_plugin_tcp.c @@ -21,7 +21,6 @@ #include #include /* memset */ -#include "gras_private.h" #include "transport_private.h" GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_tcp,transport,"TCP transport"); @@ -418,9 +417,9 @@ gras_error_t gras_socket_raw_exchange(gras_socket_t *peer, struct timeval timeOut; chunk = gras_malloc(msg_size); - - for (exp_sofar=0; exp_sofar < exp_size; exp_size += msg_sofar) { - for(msg_sofar=0; msg_sofar < msg_size; msg_size += res_last) { + + for (exp_sofar=0; exp_sofar < exp_size; exp_sofar += msg_size) { + for(msg_sofar=0; msg_sofar < msg_size; msg_sofar += res_last) { if(sender) { res_last = send(peer->sd, chunk, msg_size - msg_sofar, 0); diff --git a/src/gras/Transport/transport_private.h b/src/gras/Transport/transport_private.h index f5f1c3d96e..1539170f68 100644 --- a/src/gras/Transport/transport_private.h +++ b/src/gras/Transport/transport_private.h @@ -13,8 +13,18 @@ #ifndef GRAS_TRP_PRIVATE_H #define GRAS_TRP_PRIVATE_H -#include "gras_private.h" -#include "gras/Transport/transport_interface.h" +#include "xbt/sysdep.h" +#include "xbt/log.h" +#include "xbt/error.h" +#include "xbt/dynar.h" +#include "xbt/dict.h" + +#include "gras/cond.h" /* gras_if_RL() */ + +#include "gras_modinter.h" /* module init/exit */ +#include "gras/transport.h" /* rest of module interface */ + +#include "gras/Transport/transport_interface.h" /* semi-public API */ #include "gras/Virtu/virtu_interface.h" /* socketset_get() */ /** diff --git a/src/gras/Virtu/process.c b/src/gras/Virtu/process.c index 052d5c7dbc..eea80f7f68 100644 --- a/src/gras/Virtu/process.c +++ b/src/gras/Virtu/process.c @@ -8,7 +8,13 @@ /* This program is free software; you can redistribute it and/or modify it under the terms of the license (GNU LGPL) which comes with this package. */ -#include "gras_private.h" +#include "xbt/sysdep.h" +#include "xbt/log.h" +#include "xbt/error.h" +#include "gras/transport.h" +#include "gras/datadesc.h" +#include "gras/messages.h" + #include "gras/Virtu/virtu_interface.h" #include "gras/Msg/msg_interface.h" /* FIXME: Get rid of this cyclic */ @@ -31,10 +37,10 @@ void gras_userdata_set(void *ud) { void gras_procdata_init() { gras_procdata_t *pd=gras_procdata_get(); - pd->userdata = NULL; - gras_dynar_new(&(pd->msg_queue), sizeof(gras_msg_t), NULL); - gras_dynar_new(&(pd->cbl_list), sizeof(gras_cblist_t *),gras_cbl_free); - gras_dynar_new(&(pd->sockets), sizeof(gras_socket_t*), NULL); + pd->userdata = NULL; + pd->msg_queue = gras_dynar_new(sizeof(gras_msg_t), NULL); + pd->cbl_list = gras_dynar_new(sizeof(gras_cblist_t *),gras_cbl_free); + pd->sockets = gras_dynar_new(sizeof(gras_socket_t*), NULL); } void diff --git a/src/gras/Virtu/rl_conditional.c b/src/gras/Virtu/rl_conditional.c index c704f0f172..513df2d66d 100644 --- a/src/gras/Virtu/rl_conditional.c +++ b/src/gras/Virtu/rl_conditional.c @@ -8,6 +8,7 @@ /* This program is free software; you can redistribute it and/or modify it under the terms of the license (GNU LGPL) which comes with this package. */ +#include "gras/cond.h" #include "gras/Virtu/virtu_rl.h" int gras_if_RL(void) { diff --git a/src/gras/Virtu/rl_time.c b/src/gras/Virtu/rl_time.c index f9d80742fa..fcd0b1aebd 100644 --- a/src/gras/Virtu/rl_time.c +++ b/src/gras/Virtu/rl_time.c @@ -8,7 +8,8 @@ /* This program is free software; you can redistribute it and/or modify it under the terms of the license (GNU LGPL) which comes with this package. */ -#include "gras_private.h" +#include "xbt/sysdep.h" +#include "gras/virtu.h" #include /* gettimeofday() */ double gras_os_time() { diff --git a/src/gras/Virtu/sg_conditional.c b/src/gras/Virtu/sg_conditional.c index 1c0737e0c3..6d1ad9378a 100644 --- a/src/gras/Virtu/sg_conditional.c +++ b/src/gras/Virtu/sg_conditional.c @@ -8,6 +8,7 @@ /* This program is free software; you can redistribute it and/or modify it under the terms of the license (GNU LGPL) which comes with this package. */ +#include "gras/cond.h" #include "gras/Virtu/virtu_sg.h" int gras_if_RL(void) { diff --git a/src/gras/Virtu/sg_process.c b/src/gras/Virtu/sg_process.c index ea7627c7ab..32066c81a1 100644 --- a/src/gras/Virtu/sg_process.c +++ b/src/gras/Virtu/sg_process.c @@ -29,7 +29,7 @@ gras_process_init() { if (!hd) { hd=gras_new(gras_hostdata_t,1); - gras_dynar_new(&(hd->ports),sizeof(gras_sg_portrec_t),NULL); + hd->ports = gras_dynar_new(sizeof(gras_sg_portrec_t),NULL); memset(hd->proc, 0, sizeof(hd->proc[0]) * GRAS_MAX_CHANNEL); diff --git a/src/gras/Virtu/virtu_interface.h b/src/gras/Virtu/virtu_interface.h index 10c065db2f..935ddb4d7f 100644 --- a/src/gras/Virtu/virtu_interface.h +++ b/src/gras/Virtu/virtu_interface.h @@ -13,6 +13,13 @@ #ifndef GRAS_VIRTU_INTERFACE_H #define GRAS_VIRTU_INTERFACE_H +#include "xbt/sysdep.h" +#include "xbt/log.h" +#include "xbt/error.h" +#include "xbt/dynar.h" +#include "gras/virtu.h" +#include "gras/process.h" + /** * gras_process_data_t: * diff --git a/src/gras/Virtu/virtu_rl.h b/src/gras/Virtu/virtu_rl.h index 648e7c25d4..bcc59f9a7f 100644 --- a/src/gras/Virtu/virtu_rl.h +++ b/src/gras/Virtu/virtu_rl.h @@ -11,7 +11,6 @@ #ifndef VIRTU_RL_H #define VIRTU_RL_H -#include "gras_private.h" #include "gras/Virtu/virtu_interface.h" #endif /* VIRTU_RL_H */ diff --git a/src/gras/Virtu/virtu_sg.h b/src/gras/Virtu/virtu_sg.h index 9d0a89c087..e05ff6aa87 100644 --- a/src/gras/Virtu/virtu_sg.h +++ b/src/gras/Virtu/virtu_sg.h @@ -11,7 +11,6 @@ #ifndef VIRTU_SG_H #define VIRTU_SG_H -#include "gras_private.h" #include "gras/Virtu/virtu_interface.h" #include /* SimGrid header */ diff --git a/src/gras_private.h b/src/gras_private.h deleted file mode 100644 index 124c9dfc1c..0000000000 --- a/src/gras_private.h +++ /dev/null @@ -1,51 +0,0 @@ -/* $Id$ */ - -/* gras_private.h - GRAS private definitions */ - -/* Authors: Martin Quinson */ -/* Copyright (C) 2003 the OURAGAN project. */ - -/* This program is free software; you can redistribute it and/or modify it - under the terms of the license (GNU LGPL) which comes with this package. */ - -#ifndef GRAS_PRIVATE_H -#define GRAS_PRIVATE_H - -#define max(a, b) (((a) > (b))?(a):(b)) -#define min(a, b) (((a) < (b))?(a):(b)) - -#define TRUE 1 -#define FALSE 0 - -#define GRAS_MAX_CHANNEL 10 /* FIXME: killme */ - -#include "gras_config.h" - -#include "xbt/sysdep.h" - -#include "xbt/error.h" -#include "xbt/log.h" -#include "xbt/module.h" -#include "xbt/dynar.h" -#include "xbt/dict.h" -#include "xbt/set.h" -#include "xbt/config.h" - -#include "gras/core.h" -#include "gras/process.h" -#include "gras/virtu.h" -#include "gras/cond.h" - -#include "gras/transport.h" -#include "gras/datadesc.h" -#include "gras/messages.h" - -/* modules initialization functions */ -void gras_msg_init(void); -void gras_msg_exit(void); -void gras_trp_init(void); -void gras_trp_exit(void); -void gras_datadesc_init(void); -void gras_datadesc_exit(void); - -#endif /* GRAS_PRIVATE_H */ diff --git a/src/xbt/config.c b/src/xbt/config.c index c76008db03..640528e564 100644 --- a/src/xbt/config.c +++ b/src/xbt/config.c @@ -10,9 +10,16 @@ /* This program is free software; you can redistribute it and/or modify it under the terms of the license (GNU LGPL) which comes with this package. */ -#include "gras_private.h" /* prototypes of this module */ +#include "xbt/misc.h" +#include "xbt/sysdep.h" +#include "xbt/log.h" +#include "xbt/error.h" +#include "xbt/dynar.h" +#include "xbt/dict.h" -GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(config,gros,"configuration support"); +#include "xbt/config.h" /* prototypes of this module */ + +GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(config,xbt,"configuration support"); /* gras_cfgelm_t: the typedef corresponding to a config cell. @@ -65,8 +72,8 @@ void gras_cfg_host_free(void *d){ */ -void gras_cfg_new(gras_cfg_t **whereto) { - gras_dict_new((gras_dict_t**)whereto); +gras_cfg_t *gras_cfg_new(void) { + return (gras_cfg_t *)gras_dict_new(); } /** @@ -223,19 +230,19 @@ gras_cfg_register(gras_cfg_t *cfg, switch (type) { case gras_cfgelm_int: - gras_dynar_new(&(res->content), sizeof(int), NULL); + res->content = gras_dynar_new(sizeof(int), NULL); break; case gras_cfgelm_double: - gras_dynar_new(&(res->content), sizeof(double), NULL); + res->content = gras_dynar_new(sizeof(double), NULL); break; case gras_cfgelm_string: - gras_dynar_new(&(res->content),sizeof(char*),&gras_cfg_str_free); + res->content = gras_dynar_new(sizeof(char*),&gras_cfg_str_free); break; case gras_cfgelm_host: - gras_dynar_new(&(res->content),sizeof(gras_host_t*),&gras_cfg_host_free); + res->content = gras_dynar_new(sizeof(gras_host_t*),&gras_cfg_host_free); break; default: diff --git a/src/xbt/dict.c b/src/xbt/dict.c index 3bf65c2836..101a08abd7 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -8,8 +8,6 @@ /* This program is free software; you can redistribute it and/or modify it under the terms of the license (GNU LGPL) which comes with this package. */ - -#include "gras_private.h" #include "dict_private.h" #include /* malloc() */ @@ -17,7 +15,7 @@ #include -GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(dict,gros, +GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(dict,xbt, "Dictionaries provide the same functionnalities than hash tables"); /*####[ Private prototypes ]#################################################*/ @@ -32,12 +30,11 @@ GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(dict,gros, * * Creates and initialize a new dictionnary */ -void -gras_dict_new(gras_dict_t **whereto) { - - (*whereto) = gras_new(gras_dict_t,1); - (*whereto)->head=NULL; - +gras_dict_t * +gras_dict_new(void) { + gras_dict_t *res= gras_new(gras_dict_t,1); + res->head=NULL; + return res; } /** * gras_dict_free: diff --git a/src/xbt/dict_cursor.c b/src/xbt/dict_cursor.c index ba7812823a..5e9269ec42 100644 --- a/src/xbt/dict_cursor.c +++ b/src/xbt/dict_cursor.c @@ -8,7 +8,7 @@ /* This program is free software; you can redistribute it and/or modify it under the terms of the license (GNU LGPL) which comes with this package. */ -#include "gras_private.h" +#include "xbt/misc.h" #include "dict_private.h" #include /* strlen() */ @@ -45,25 +45,21 @@ _cursor_push_keys(gras_dict_cursor_t *p_cursor, * * Structure creator */ -void -gras_dict_cursor_new(const gras_dict_t *p_head, - /*OUT*/gras_dict_cursor_t **pp_cursor) { +gras_dict_cursor_t * +gras_dict_cursor_new(const gras_dict_t *p_head) { gras_error_t errcode = no_error; - gras_dict_cursor_t *p_cursor = NULL; - - p_cursor = gras_new(gras_dict_cursor_t,1); - - gras_dynar_new(&p_cursor->keys, sizeof(char **), NULL); - gras_dynar_new(&p_cursor->key_lens, sizeof(int *), NULL); - - p_cursor->pos = 0; - p_cursor->pos_len = 0; - p_cursor->head = p_head ? p_head->head : NULL; + gras_dict_cursor_t *res = NULL; - gras_dict_cursor_rewind(p_cursor); + res = gras_new(gras_dict_cursor_t,1); + res->keys = gras_dynar_new(sizeof(char **), NULL); + res->key_lens = gras_dynar_new(sizeof(int *), NULL); + res->pos = 0; + res->pos_len = 0; + res->head = p_head ? p_head->head : NULL; - *pp_cursor = p_cursor; + gras_dict_cursor_rewind(res); + return res; } /** @@ -161,12 +157,12 @@ gras_dict_cursor_rewind(gras_dict_cursor_t *p_cursor) { * * Create the cursor if it does not exists. Rewind it in any case. */ -void gras_dict_cursor_first (const gras_dict_t *dict, - gras_dict_cursor_t **cursor){ +void gras_dict_cursor_first (const gras_dict_t *dict, + gras_dict_cursor_t **cursor){ if (!*cursor) { DEBUG0("Create the cursor on first use"); - gras_dict_cursor_new(dict,cursor); + *cursor=gras_dict_cursor_new(dict); } gras_dict_cursor_rewind(*cursor); diff --git a/src/xbt/dict_elm.c b/src/xbt/dict_elm.c index 24f61bcf2b..380a35599a 100644 --- a/src/xbt/dict_elm.c +++ b/src/xbt/dict_elm.c @@ -8,8 +8,6 @@ /* This program is free software; you can redistribute it and/or modify it under the terms of the license (GNU LGPL) which comes with this package. */ - -#include "gras_private.h" #include "dict_private.h" /* prototypes of this module */ GRAS_LOG_EXTERNAL_CATEGORY(dict); @@ -143,8 +141,7 @@ _gras_dictelm_alloc(char *key, p_elm->offset = offset; p_elm->content = data; p_elm->free_ctn = free_ctn; - - gras_dynar_new(&(p_elm->sub), sizeof(gras_dictelm_t*), _dictelm_wrapper_free); + p_elm->sub = gras_dynar_new(sizeof(gras_dictelm_t*), _dictelm_wrapper_free); *pp_elm = p_elm; diff --git a/src/xbt/dict_private.h b/src/xbt/dict_private.h index 3b17689904..b675d2b0e0 100644 --- a/src/xbt/dict_private.h +++ b/src/xbt/dict_private.h @@ -12,6 +12,12 @@ #ifndef _GRAS_DICT_ELM_T_ #define _GRAS_DICT_ELM_T_ +#include "xbt/sysdep.h" +#include "xbt/log.h" +#include "xbt/error.h" +#include "xbt/dynar.h" +#include "xbt/dict.h" + /*####[ Type definition ]####################################################*/ typedef struct gras_dictelm_ { char *key; diff --git a/src/xbt/dynar.c b/src/xbt/dynar.c index a0954b78cb..ad9b0f3bfa 100644 --- a/src/xbt/dynar.c +++ b/src/xbt/dynar.c @@ -8,15 +8,19 @@ /* This program is free software; you can redistribute it and/or modify it under the terms of the license (GNU LGPL) which comes with this package. */ -#include "gras_private.h" +#include "xbt/misc.h" +#include "xbt/sysdep.h" +#include "xbt/log.h" +#include "xbt/error.h" +#include "xbt/dynar.h" #include -GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(dynar,gros,"Dynamic arrays"); +GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(dynar,xbt,"Dynamic arrays"); struct gras_dynar_s { - size_t size; - size_t used; - size_t elmsize; + unsigned long size; + unsigned long used; + unsigned long elmsize; void *data; void_f_pvoid_t *free; }; @@ -42,7 +46,7 @@ struct gras_dynar_s { static _GRAS_INLINE void _gras_clear_mem(void * const ptr, - const size_t length) { + const unsigned long length) { memset(ptr, 0, length); } @@ -51,19 +55,19 @@ gras_error_t _gras_dynar_expand(gras_dynar_t * const dynar, const int nb) { gras_error_t errcode = no_error; - const size_t old_size = dynar->size; + const unsigned long old_size = dynar->size; if (nb > old_size) { char * const old_data = dynar->data; - const size_t elmsize = dynar->elmsize; - const size_t old_length = old_size*elmsize; + const unsigned long elmsize = dynar->elmsize; + const unsigned long old_length = old_size*elmsize; - const size_t used = dynar->used; - const size_t used_length = used*elmsize; + const unsigned long used = dynar->used; + const unsigned long used_length = used*elmsize; - const size_t new_size = nb > (2*(old_size+1)) ? nb : (2*(old_size+1)); - const size_t new_length = new_size*elmsize; + const unsigned long new_size = nb > (2*(old_size+1)) ? nb : (2*(old_size+1)); + const unsigned long new_length = new_size*elmsize; char * const new_data = gras_malloc0(elmsize*new_size); DEBUG3("expend %p from %lu to %d elements", (void*)dynar, (unsigned long)old_size, nb); @@ -86,9 +90,9 @@ _gras_dynar_expand(gras_dynar_t * const dynar, static _GRAS_INLINE void * _gras_dynar_elm(const gras_dynar_t * const dynar, - const size_t idx) { + const unsigned long idx) { char * const data = dynar->data; - const size_t elmsize = dynar->elmsize; + const unsigned long elmsize = dynar->elmsize; return data + idx*elmsize; } @@ -97,9 +101,9 @@ static _GRAS_INLINE void _gras_dynar_get_elm(void * const dst, const gras_dynar_t * const dynar, - const size_t idx) { + const unsigned long idx) { void * const elm = _gras_dynar_elm(dynar, idx); - const size_t elmsize = dynar->elmsize; + const unsigned long elmsize = dynar->elmsize; memcpy(dst, elm, elmsize); } @@ -107,17 +111,16 @@ _gras_dynar_get_elm(void * const dst, static _GRAS_INLINE void _gras_dynar_put_elm(const gras_dynar_t * const dynar, - const size_t idx, + const unsigned long idx, const void * const src) { void * const elm = _gras_dynar_elm(dynar, idx); - const size_t elmsize = dynar->elmsize; + const unsigned long elmsize = dynar->elmsize; memcpy(elm, src, elmsize); } /** * gras_dynar_new: - * @whereto: pointer to where the dynar should be created * @elm_size: size of each element in the dynar * @free_func: function to call each time we want to get rid of an element (or NULL if nothing to do). * @@ -125,10 +128,9 @@ _gras_dynar_put_elm(const gras_dynar_t * const dynar, * pointer of pointer. That is to say that dynars can contain either base * types (int, char, double, etc) or pointer of pointers (struct **). */ -void -gras_dynar_new(gras_dynar_t ** const p_dynar, - const size_t elmsize, - void_f_pvoid_t * const free_func) { +gras_dynar_t * +gras_dynar_new(const unsigned long elmsize, + void_f_pvoid_t * const free_func) { gras_dynar_t *dynar = gras_new0(gras_dynar_t,1); @@ -138,7 +140,7 @@ gras_dynar_new(gras_dynar_t ** const p_dynar, dynar->data = NULL; dynar->free = free_func; - *p_dynar = dynar; + return dynar; } /** @@ -310,16 +312,16 @@ gras_dynar_insert_at(gras_dynar_t * const dynar, __check_sloppy_inbound_idx(dynar, idx); { - const size_t old_used = dynar->used; - const size_t new_used = old_used + 1; + const unsigned long old_used = dynar->used; + const unsigned long new_used = old_used + 1; _gras_dynar_expand(dynar, new_used); { - const size_t nb_shift = old_used - idx; - const size_t elmsize = dynar->elmsize; + const unsigned long nb_shift = old_used - idx; + const unsigned long elmsize = dynar->elmsize; - const size_t offset = nb_shift*elmsize; + const unsigned long offset = nb_shift*elmsize; void * const elm_src = _gras_dynar_elm(dynar, idx); void * const elm_dst = _gras_dynar_elm(dynar, idx+1); @@ -354,13 +356,13 @@ gras_dynar_remove_at(gras_dynar_t * const dynar, _gras_dynar_get_elm(object, dynar, idx); { - const size_t old_used = dynar->used; - const size_t new_used = old_used - 1; + const unsigned long old_used = dynar->used; + const unsigned long new_used = old_used - 1; - const size_t nb_shift = old_used-1 - idx; - const size_t elmsize = dynar->elmsize; + const unsigned long nb_shift = old_used-1 - idx; + const unsigned long elmsize = dynar->elmsize; - const size_t offset = nb_shift*elmsize; + const unsigned long offset = nb_shift*elmsize; void * const elm_src = _gras_dynar_elm(dynar, idx+1); void * const elm_dst = _gras_dynar_elm(dynar, idx); @@ -449,8 +451,8 @@ gras_dynar_map(const gras_dynar_t * const dynar, { char elm[64]; - const size_t used = dynar->used; - size_t i = 0; + const unsigned long used = dynar->used; + unsigned long i = 0; for (i = 0; i < used; i++) { _gras_dynar_get_elm(elm, dynar, i); diff --git a/src/xbt/error.c b/src/xbt/error.c index af455a84f3..fa12a0a8b9 100644 --- a/src/xbt/error.c +++ b/src/xbt/error.c @@ -8,7 +8,7 @@ /* This program is free software; you can redistribute it and/or modify it under the terms of the license (GNU LGPL) which comes with this package. */ -#include "gras_private.h" +#include "xbt/error.h" /** * gras_error_name: diff --git a/src/xbt/log.c b/src/xbt/log.c index eb15e532ef..364edb1e12 100644 --- a/src/xbt/log.c +++ b/src/xbt/log.c @@ -8,13 +8,17 @@ /* This program is free software; you can redistribute it and/or modify it under the terms of the license (GNU LGPL) which comes with this package. */ - -#include "xbt_interface.h" -#include "gras_private.h" #include -#include #include +#include "xbt_modinter.h" + +#include "xbt/misc.h" +#include "xbt/sysdep.h" +#include "xbt/log.h" +#include "xbt/error.h" +#include "xbt/dynar.h" + typedef struct { char *catname; gras_log_priority_t thresh; @@ -47,8 +51,8 @@ gras_log_category_t _GRAS_LOGV(GRAS_LOG_ROOT_CAT) = { }; GRAS_LOG_NEW_SUBCATEGORY(gras,GRAS_LOG_ROOT_CAT,"All GRAS categories"); -GRAS_LOG_NEW_SUBCATEGORY(gros,GRAS_LOG_ROOT_CAT,"All GROS categories (gras toolbox)"); -GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(log,gros,"Loggings from the logging mecanism itself"); +GRAS_LOG_NEW_SUBCATEGORY(xbt,GRAS_LOG_ROOT_CAT,"All XBT categories (gras toolbox)"); +GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(log,xbt,"Loggings from the logging mecanism itself"); static void _apply_control(gras_log_category_t* cat) { @@ -144,7 +148,7 @@ void gras_log_parent_set(gras_log_category_t* cat, while(*cpp != cat && *cpp != NULL) { cpp = &(*cpp)->nextSibling; } - assert(*cpp == cat); + gras_assert(*cpp == cat); *cpp = cat->nextSibling; } @@ -316,8 +320,8 @@ void gras_log_control_set(const char* control_string) { if (control_string == NULL) return; if (gras_log_settings == NULL) - gras_dynar_new(&gras_log_settings,sizeof(gras_log_setting_t*), - _free_setting); + gras_log_settings = gras_dynar_new(sizeof(gras_log_setting_t*), + _free_setting); set = gras_new(gras_log_setting_t,1); cs=gras_strdup(control_string); diff --git a/src/xbt/log_default_appender.c b/src/xbt/log_default_appender.c index b4e3054e03..931e6899fd 100644 --- a/src/xbt/log_default_appender.c +++ b/src/xbt/log_default_appender.c @@ -8,7 +8,9 @@ /* This program is free software; you can redistribute it and/or modify it under the terms of the license (GNU LGPL) which comes with this package. */ -#include "gras_private.h" +#include "xbt/sysdep.h" +#include "xbt/log.h" +#include "xbt/error.h" #include GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(log_app,log,"default logging handler"); diff --git a/src/xbt/module.c b/src/xbt/module.c index c2c9f85db0..d2a718853c 100644 --- a/src/xbt/module.c +++ b/src/xbt/module.c @@ -8,11 +8,21 @@ /* This program is free software; you can redistribute it and/or modify it under the terms of the license (GNU LGPL) which comes with this package. */ -#include "gras_private.h" +#include "xbt/sysdep.h" +#include "xbt/log.h" +#include "xbt/error.h" +#include "xbt/dynar.h" +#include "xbt/config.h" -GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(module,gros, "module handling"); +#include "gras/process.h" /* FIXME: bad loop */ + +#include "xbt/module.h" /* this module */ + +#include "xbt_modinter.h" /* prototype of other module's init/exit in XBT */ +#include "gras_modinter.h" /* same in GRAS */ + +GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(module,xbt, "module handling"); -extern void gras_log_exit(void); static int gras_running_process = 0; struct gras_module_ { diff --git a/src/xbt/set.c b/src/xbt/set.c index 974837e57e..aa42896710 100644 --- a/src/xbt/set.c +++ b/src/xbt/set.c @@ -8,9 +8,16 @@ /* This program is free software; you can redistribute it and/or modify it under the terms of the license (GNU LGPL) which comes with this package. */ -#include "gras_private.h" +#include "xbt/misc.h" +#include "xbt/sysdep.h" +#include "xbt/log.h" +#include "xbt/error.h" +#include "xbt/dynar.h" +#include "xbt/dict.h" -GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(set,gros,"data container consisting in dict+dynar"); +#include "xbt/set.h" + +GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(set,xbt,"data container consisting in dict+dynar"); /*####[ Type definition ]####################################################*/ struct gras_set_ { @@ -25,14 +32,14 @@ struct gras_set_ { * * Creates a new set. */ -void gras_set_new (gras_set_t **dst) { +gras_set_t *gras_set_new (void) { gras_set_t *res=gras_new(gras_set_t,1); gras_error_t errcode; - gras_dict_new (&(res->dict)); - gras_dynar_new(&(res->dynar), sizeof(void*),NULL); + res->dict=gras_dict_new (); + res->dynar=gras_dynar_new(sizeof(void*),NULL); - *dst=res; + return res; } /** diff --git a/src/xbt/sysdep.c b/src/xbt/sysdep.c index 2575bf97fb..f7408972e7 100644 --- a/src/xbt/sysdep.c +++ b/src/xbt/sysdep.c @@ -10,11 +10,13 @@ /* This program is free software; you can redistribute it and/or modify it under the terms of the license (GNU LGPL) which comes with this package. */ -#include "gras_private.h" +#include "xbt/sysdep.h" +#include "xbt/log.h" +#include "xbt/error.h" #include -GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(sysdep, gros, "System dependency"); +GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(sysdep, xbt, "System dependency"); /**** **** Memory management diff --git a/src/xbt/xbt_interface.h b/src/xbt/xbt_interface.h deleted file mode 100644 index efa29e7376..0000000000 --- a/src/xbt/xbt_interface.h +++ /dev/null @@ -1,19 +0,0 @@ -/* $Id$ */ - -/* core - very basic functionnalities of GRAS (logs, data container, ...) */ - -/* module's public interface exported within GRAS, but not to end user. */ - -/* Authors: Martin Quinson */ -/* Copyright (C) 2004 Martin Quinson. */ - -/* This program is free software; you can redistribute it and/or modify it - under the terms of the license (GNU LGPL) which comes with this package. */ - -#ifndef XBT_INTERFACE_H -#define XBT_INTERFACE_H - -/* Modules definitions */ -void gras_log_exit(void); - -#endif /* XBT_INTERFACE_H */ diff --git a/testsuite/gras/datadesc_usage.c b/testsuite/gras/datadesc_usage.c index d22e377b5a..458a3fa606 100644 --- a/testsuite/gras/datadesc_usage.c +++ b/testsuite/gras/datadesc_usage.c @@ -392,6 +392,7 @@ gras_error_t test_graph(gras_socket_t *sock, int direction) { i->l->l->l = i; j = NULL; + gras_datadesc_cycle_set(gras_datadesc_by_name("chained_list_t*")); TRY(write_read(gras_datadesc_by_name("chained_list_t*"), &i,&j, sock,direction)); if (direction == READ || direction == RW) { @@ -609,7 +610,7 @@ int main(int argc,char *argv[]) { TRYFAIL(declare_chained_list_type()); TRYFAIL(test_chain_list(sock,direction)); - /* TRYFAIL(test_graph(sock,direction)); */ + TRYFAIL(test_graph(sock,direction)); TRYFAIL(test_pbio(sock,direction)); diff --git a/testsuite/xbt/config_usage.c b/testsuite/xbt/config_usage.c index f4ff054c69..f03b44a645 100644 --- a/testsuite/xbt/config_usage.c +++ b/testsuite/xbt/config_usage.c @@ -13,7 +13,7 @@ gras_cfg_t *make_set(){ gras_cfg_t *set=NULL; gras_error_t errcode; - gras_cfg_new(&set); + set = gras_cfg_new(); TRYFAIL(gras_cfg_register_str(set,"speed:1_to_2_int")); TRYFAIL(gras_cfg_register_str(set,"hostname:1_to_1_string")); TRYFAIL(gras_cfg_register_str(set,"user:1_to_10_string")); diff --git a/testsuite/xbt/dict_crash.c b/testsuite/xbt/dict_crash.c index 124f3ee464..d97aaf456e 100644 --- a/testsuite/xbt/dict_crash.c +++ b/testsuite/xbt/dict_crash.c @@ -64,7 +64,7 @@ int main(int argc,char **argv) { printf(" (a point is a test)\n"); for (i=0;i<20;i++) { - gras_dict_new(&head); + head=gras_dict_new(); if (i%10) printf("."); else printf("%d",i/10); fflush(stdout); nb=0; for (j=0;j<1000;j++) { @@ -91,7 +91,7 @@ int main(int argc,char **argv) { } - gras_dict_new(&head); + head=gras_dict_new(); printf("\n Fill 20 000 elements, with keys being the number of element\n"); printf(" (a point is 1 000 elements)\n"); for (j=0;j