#include <simgrid/forward.h>
-typedef struct vm_params {
+struct vm_params {
int ncpus;
sg_size_t ramsize;
int overcommit;
/* set migration speed */
double mig_speed;
-} s_vm_params_t, *vm_params_t;
+};
+typedef struct vm_params s_vm_params_t;
+typedef struct vm_params* vm_params_t;
#endif /* SIMGRID_DATATYPES_H_ */
extern int MSG_FILE_LEVEL;
typedef struct simdata_file *simdata_file_t;
-typedef struct msg_file_priv {
+struct msg_file_priv {
char *fullpath;
sg_size_t size;
char* mount_point;
int desc_id;
void *data;
simdata_file_t simdata;
-} s_msg_file_priv_t, *msg_file_priv_t;
+};
+typedef struct msg_file_priv s_msg_file_priv_t;
+typedef struct msg_file_priv* msg_file_priv_t;
static inline msg_file_priv_t MSG_file_priv(msg_file_t file){
return (msg_file_priv_t )xbt_lib_get_level(file, MSG_FILE_LEVEL);
typedef xbt_dictelm_t msg_storage_t;
typedef s_xbt_dictelm_t s_msg_storage_t;
-typedef struct msg_storage_priv {
+struct msg_storage_priv {
const char *hostname;
void *data;
-} s_msg_storage_priv_t, *msg_storage_priv_t;
+};
+typedef struct msg_storage_priv s_msg_storage_priv_t;
+typedef struct msg_storage_priv* msg_storage_priv_t;
static inline msg_storage_priv_t MSG_storage_priv(msg_storage_t storage){
return (msg_storage_priv_t )xbt_lib_get_level(storage, MSG_STORAGE_LEVEL);
typedef struct RngStream_InfoState * RngStream;
struct RngStream_InfoState {
- double Cg[6], Bg[6], Ig[6];
+ double Cg[6];
+ double Bg[6];
+ double Ig[6];
int Anti;
int IncPrec;
char *name;
* xbt_lib_set(foo_lib, id, AUTH_FOO_LEVEL, auth);
* </pre>
*/
-typedef struct s_xbt_lib {
+struct s_xbt_lib {
xbt_dict_t dict;
int levels;
void_f_pvoid_t *free_f; /* This is actually a table */
-} s_xbt_lib_t, *xbt_lib_t;
+};
+typedef struct s_xbt_lib s_xbt_lib_t;
+typedef struct s_xbt_lib* xbt_lib_t;
#define xbt_lib_cursor_t xbt_dict_cursor_t
XBT_PUBLIC(void) xbt_log_control_set(const char *cs);
/* Forward declarations */
-typedef struct xbt_log_appender_s s_xbt_log_appender_t, *xbt_log_appender_t;
-typedef struct xbt_log_layout_s s_xbt_log_layout_t, *xbt_log_layout_t;
-typedef struct xbt_log_event_s s_xbt_log_event_t, *xbt_log_event_t;
-typedef struct xbt_log_category_s s_xbt_log_category_t, *xbt_log_category_t;
+typedef struct xbt_log_appender_s s_xbt_log_appender_t;
+typedef struct xbt_log_appender_s* xbt_log_appender_t;
+typedef struct xbt_log_layout_s s_xbt_log_layout_t;
+typedef struct xbt_log_layout_s* xbt_log_layout_t;
+typedef struct xbt_log_event_s s_xbt_log_event_t;
+typedef struct xbt_log_event_s* xbt_log_event_t;
+typedef struct xbt_log_category_s s_xbt_log_category_t;
+typedef struct xbt_log_category_s* xbt_log_category_t;
/* Do NOT access any members of this structure directly. FIXME: move to private? */
SG_BEGIN_DECL()
/** Buffer code **/
-typedef struct {
+struct xbt_strbuff {
char *data;
int used, size;
-} s_xbt_strbuff_t, *xbt_strbuff_t;
+};
+typedef struct xbt_strbuff s_xbt_strbuff_t;
+typedef struct xbt_strbuff* xbt_strbuff_t;
XBT_PUBLIC(void) xbt_strbuff_empty(xbt_strbuff_t b);
XBT_PUBLIC(xbt_strbuff_t) xbt_strbuff_new(void);
*/
typedef s_xbt_swag_hookup_t *xbt_swag_hookup_t;
-typedef struct xbt_swag {
+struct xbt_swag {
void *head;
void *tail;
size_t offset;
int count;
-} s_xbt_swag_t, *xbt_swag_t;
+};
+typedef struct xbt_swag s_xbt_swag_t;
+typedef struct xbt_swag* xbt_swag_t;
+
/**< A typical swag */
/* @} */
}
xbt_dict_cursor_t cursor=NULL;
- const char *mount_name, *storage_name;
+ const char* mount_name;
+ const char* storage_name;
xbt_dict_foreach(dict,cursor,mount_name,storage_name) {
jname = env->NewStringUTF(storage_name);
SG_BEGIN_DECL()
-typedef struct s_stack_region{
+struct s_stack_region{
void *address;
#if HAVE_UCONTEXT_H
ucontext_t* context;
size_t size;
int block;
int process_index;
-}s_stack_region_t, *stack_region_t;
+};
+typedef struct s_stack_region s_stack_region_t;
+typedef struct s_stack_region* stack_region_t;
SG_END_DECL()
/** \brief MPI collective description */
-typedef struct mpi_coll_description {
+struct mpi_coll_description {
const char *name;
const char *description;
void *coll;
-} s_mpi_coll_description_t, *mpi_coll_description_t;
+};
+typedef struct mpi_coll_description s_mpi_coll_description_t;
+typedef struct mpi_coll_description* mpi_coll_description_t;
/** \ingroup MPI gather
* \brief The list of all available allgather collectives
/** \brief Resource model description
*/
-typedef struct surf_model_description {
+struct surf_model_description {
const char *name;
const char *description;
void_f_void_t model_init_preparse;
-} s_surf_model_description_t, *surf_model_description_t;
+};
+typedef struct surf_model_description s_surf_model_description_t;
+typedef struct surf_model_description* surf_model_description_t;
XBT_PUBLIC(int) find_model_description(s_surf_model_description_t * table, const char *name);
XBT_PUBLIC(void) model_help(const char *category, s_surf_model_description_t * table);
THROWF (tracing_error, 0, "can't get type with a NULL name or from a NULL father");
}
- type_t ret = NULL, child;
+ type_t ret = NULL;
+ type_t child;
char *child_name;
xbt_dict_cursor_t cursor = NULL;
xbt_dict_foreach(father->children, cursor, child_name, child) {
#include <xbt/base.h>
-typedef struct s_smx_simcall s_smx_simcall_t, *smx_simcall_t;
+typedef struct s_smx_simcall s_smx_simcall_t;
+typedef struct s_smx_simcall* smx_simcall_t;
#ifdef __cplusplus
* This is the basic structure shared by all messages: all message start with a message
* type.
*/
-typedef struct s_mc_message {
+struct s_mc_message {
e_mc_message_type type;
-} s_mc_message_t, *mc_message_t;
+};
+typedef struct s_mc_message s_mc_message_t;
+typedef struct s_mc_message* mc_message_t;
-typedef struct s_mc_int_message {
+struct s_mc_int_message {
e_mc_message_type type;
uint64_t value;
-} s_mc_int_message_t, *mc_int_message_t;
+};
+typedef struct s_mc_int_message s_mc_int_message_t;
+typedef struct s_mc_int_message* mc_int_message_t;
-typedef struct s_mc_ignore_heap_message {
+struct s_mc_ignore_heap_message {
e_mc_message_type type;
int block;
int fragment;
void *address;
size_t size;
-} s_mc_ignore_heap_message_t, *mc_ignore_heap_message_t;
+};
+typedef struct s_mc_ignore_heap_message s_mc_ignore_heap_message_t;
+typedef struct s_mc_ignore_heap_message* mc_ignore_heap_message_t;
-typedef struct s_mc_ignore_memory_message {
+struct s_mc_ignore_memory_message {
e_mc_message_type type;
uint64_t addr;
size_t size;
-} s_mc_ignore_memory_message_t, *mc_ignore_memory_message_t;
+};
+typedef struct s_mc_ignore_memory_message s_mc_ignore_memory_message_t;
+typedef struct s_mc_ignore_memory_message* mc_ignore_memory_message_t;
-typedef struct s_mc_stack_region_message {
+struct s_mc_stack_region_message {
e_mc_message_type type;
s_stack_region_t stack_region;
-} s_mc_stack_region_message_t, *mc_stack_region_message_t;
+};
+typedef struct s_mc_stack_region_message s_mc_stack_region_message_t;
+typedef struct s_mc_stack_region_message* mc_stack_region_message_t;
-typedef struct s_mc_simcall_handle_message {
+struct s_mc_simcall_handle_message {
e_mc_message_type type;
unsigned long pid;
int value;
-} s_mc_simcall_handle_message_t, *mc_simcall_handle_message;
+};
+typedef struct s_mc_simcall_handle_message s_mc_simcall_handle_message_t;
+typedef struct s_mc_simcall_handle_message* mc_simcall_handle_message;
-typedef struct s_mc_register_symbol_message {
+struct s_mc_register_symbol_message {
e_mc_message_type type;
char name[128];
int (*callback)(void*);
void* data;
-} s_mc_register_symbol_message_t, * mc_register_symbol_message_t;
+};
+typedef struct s_mc_register_symbol_message s_mc_register_symbol_message_t;
+typedef struct s_mc_register_symbol_message* mc_register_symbol_message_t;
-typedef struct s_mc_restore_message {
+struct s_mc_restore_message {
e_mc_message_type type;
int index;
-} s_mc_restore_message_t, *mc_restore_message_t;
+};
+typedef struct s_mc_restore_message s_mc_restore_message_t;
+typedef struct s_mc_restore_message* mc_restore_message_t;
XBT_PRIVATE const char* MC_message_type_name(e_mc_message_type type);
sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size)
{
msg_file_priv_t file_priv = MSG_file_priv(fd);
- sg_size_t write_size, offset;
/* Find the host where the file is physically located (remote or local)*/
msg_storage_t storage_src =(msg_storage_t) xbt_lib_get_elm_or_null(storage_lib, file_priv->storageId);
}
}
/* Write file on local or remote host */
- offset = simcall_file_tell(file_priv->simdata->smx_file);
- write_size = simcall_file_write(file_priv->simdata->smx_file, size, attached_host);
+ sg_size_t offset = simcall_file_tell(file_priv->simdata->smx_file);
+ sg_size_t write_size = simcall_file_write(file_priv->simdata->smx_file, size, attached_host);
file_priv->size = offset+write_size;
return write_size;
/* Find the real host destination where the file will be physically stored */
xbt_dict_cursor_t cursor = NULL;
- char *mount_name, *storage_name, *file_mount_name, *host_name_dest;
msg_storage_t storage_dest = NULL;
msg_host_t host_dest;
size_t longest_prefix_length = 0;
xbt_dict_t storage_list = host->mountedStoragesAsDict();
+ char *mount_name, *storage_name;
xbt_dict_foreach(storage_list,cursor,mount_name,storage_name){
- file_mount_name = (char *) xbt_malloc ((strlen(mount_name)+1));
+ char* file_mount_name = (char *) xbt_malloc ((strlen(mount_name)+1));
strncpy(file_mount_name,fullpath,strlen(mount_name)+1);
file_mount_name[strlen(mount_name)] = '\0';
}
xbt_dict_free(&storage_list);
+ char* host_name_dest = nullptr;
if(longest_prefix_length>0){
/* Mount point found, retrieve the host the storage is attached to */
msg_storage_priv_t storage_dest_priv = MSG_storage_priv(storage_dest);
host_name_dest = (char*)storage_dest_priv->hostname;
host_dest = MSG_host_by_name(host_name_dest);
-
}else{
XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, sg_host_get_name(host));
return MSG_TASK_CANCELED;