# 3.9.0 -> release 3.9
# 3.9.90 -> release 3.10pre1
# 3.10.0 -> release 3.10
+# 3.11.0 -> release 3.11
set(SIMGRID_VERSION_MAJOR "3")
-set(SIMGRID_VERSION_MINOR "10")
+set(SIMGRID_VERSION_MINOR "11")
set(SIMGRID_VERSION_PATCH "0")
-set(SIMGRID_VERSION_EXTRA "-rc2") # Extra words to add to version string (e.g. -rc1)
+set(SIMGRID_VERSION_EXTRA "-devel") # Extra words to add to version string (e.g. -rc1)
set(SIMGRID_VERSION_DATE "2013") # Year for copyright information
+SimGrid (3.11) NOT RELEASED; urgency=low
+
+ TENTATIVE RELEASE GOALS for 3.11:
+ * Consider the removal of Supernovae mode if no user has manifested since the
+ release of version 3.10.
+ * Switch to tesh.pl, and kill the now unused parts of xbt that seem fragile
+ * Switch to surf++, and reintegrate the hypervisor branch on top of it
+
+ -- $date Da SimGrid team <simgrid-devel@lists.gforge.inria.fr>
+
SimGrid (3.10-rc2) unstable; urgency=low
The Clean Diaper Release, a.k.a. SimGrid is leak-free.
+ _ _____ _ _
+__ _____ _ __ ___(_) ___ _ __ |___ / / / |
+\ \ / / _ \ '__/ __| |/ _ \| '_ \ |_ \ | | |
+ \ V / __/ | \__ \ | (_) | | | | ___) || | |
+ \_/ \___|_| |___/_|\___/|_| |_| |____(_)_|_|
+
+(to complete)
_ _____ _ ___
__ _____ _ __ ___(_) ___ _ __ |___ / / |/ _ \
\ \ / / _ \ '__/ __| |/ _ \| '_ \ |_ \ | | | | |
--- /dev/null
+/* Copyright (c) 2006-2013. The SimGrid Team.
+ * All rights reserved. */
+
+/* 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. */
+
+/********************* Files and Storage handling ****************************
+ * This example implements all main storage and file functions of the MSG API
+ *
+ * Scenario :
+ * - display information on the disks mounted by the current host
+ * - create a 200,000 bytes file
+ * - completely read the created file
+ * - write 100,000 more bytes in the file
+ * - rename the created file
+ * - attach some user data to a disk
+ * - dump disk's contents
+ *
+******************************************************************************/
+
+#include "msg/msg.h"
+#include "xbt/log.h"
+
+ /* To use PRIu64 format specifier for printing uint64_t (sg_storage_size_t) */
+#include <inttypes.h>
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(storage,"Messages specific for this simulation");
+
+int host(int argc, char *argv[]){
+ const char* host_name = MSG_host_get_name(MSG_host_self());
+
+ // display information on the disks mounted by the current host
+ XBT_INFO("*** Storage info on %s ***", host_name);
+
+ xbt_dict_cursor_t cursor = NULL;
+ char* mount_name;
+ char* storage_name;
+ msg_storage_t storage;
+
+ // Retrieve all mount points of current host
+ xbt_dict_t storage_list = MSG_host_get_storage_list(MSG_host_self());
+
+ xbt_dict_foreach(storage_list,cursor,mount_name,storage_name) {
+ // For each disk mounted on host
+
+ XBT_INFO("Storage name: %s, mount name: %s", storage_name, mount_name);
+ storage = MSG_storage_get_by_name(storage_name);
+
+ // Retrieve disk's information
+ sg_storage_size_t free_size = MSG_storage_get_free_size(mount_name);
+ sg_storage_size_t used_size = MSG_storage_get_used_size(mount_name);
+ sg_storage_size_t size = MSG_storage_get_size(storage);
+
+ XBT_INFO("Total size: %"PRIu64" bytes", size);
+ XBT_INFO("Free size: %"PRIu64" bytes", free_size);
+ XBT_INFO("Used size: %"PRIu64" bytes", used_size);
+ }
+ xbt_free(storage_list);
+
+
+ // Create a 200,000 bytes file named './tmp/data.txt' on /sd1
+
+ char* mount = xbt_strdup("/sd1");
+ char* file_name = xbt_strdup("./tmp/data.txt");
+ msg_file_t file = NULL;
+ sg_storage_size_t write, read, file_size;
+
+ // Open an non-existing file amounts to create it!
+ file = MSG_file_open(mount, file_name, NULL);
+ write = MSG_file_write(file, 200000); // Write 200,000 bytes
+ XBT_INFO("Create a %"PRIu64" bytes file named '%s' on /sd1", write, file_name);
+ MSG_file_dump(file);
+
+ // check that sizes have changed
+ XBT_INFO("Total size: %"PRIu64" bytes", MSG_storage_get_free_size("/sd1"));
+ XBT_INFO("Free size: %"PRIu64" bytes", MSG_storage_get_used_size("/sd1"));
+
+
+ // Now retrieve the size of created file and read it completely
+ file_size = MSG_file_get_size(file);
+ read = MSG_file_read(file, file_size);
+ XBT_INFO("Read %"PRIu64" bytes on %s", read, file_name);
+
+ // Now write 100,000 more bytes in tmp/data.txt
+ write = MSG_file_write(file, 100000); // Write 100,000 bytes
+ XBT_INFO("Write %"PRIu64" more bytes on %s", write, file_name);
+ MSG_file_dump(file);
+
+ MSG_file_close(file);
+ free(mount);
+ free(file_name);
+
+ // Now rename file from /tmp/data.txt to /tmp/simgrid.readme
+ msg_storage_t st = MSG_storage_get_by_name("/sd1");
+ MSG_storage_file_rename(st, "/tmp/data.txt", "/tmp/simgrid.readme");
+
+ // Now attach some user data to disk1
+ storage_name = xbt_strdup("disk1");
+ XBT_INFO("*** Get/set data for storage element: %s ***",storage_name);
+
+ storage = MSG_storage_get_by_name(storage_name);
+ char *data = MSG_storage_get_data(storage);
+
+ XBT_INFO("Get data: '%s'", data);
+
+ MSG_storage_set_data(storage,strdup("Some user data"));
+ data = MSG_storage_get_data(storage);
+ XBT_INFO("Set and get data: '%s'", data);
+ free(storage_name);
+
+
+ // Dump disks contents
+ XBT_INFO("*** Dump content of %s ***",MSG_host_get_name(MSG_host_self()));
+ xbt_dict_t contents = NULL;
+ contents = MSG_host_get_storage_content(MSG_host_self()); // contents is a dict of dicts
+ xbt_dict_cursor_t curs, curs2 = NULL;
+ char* mountname;
+ xbt_dict_t content;
+ char* path;
+ sg_storage_size_t *size;
+ xbt_dict_foreach(contents, curs, mountname, content){
+ XBT_INFO("Print the content of mount point: %s",mountname);
+ xbt_dict_foreach(content,curs2,path,size){
+ XBT_INFO("%s size: %"PRIu64" bytes", path,*((sg_storage_size_t*)size));
+ }
+ }
+
+ return 1;
+}
+
+
+int main(int argc, char *argv[])
+{
+
+ MSG_init(&argc, argv);
+ /* Check the arguments */
+ if (argc < 3) {
+ printf("Usage: %s platform_file deployment_file \n", argv[0]);
+ return -1;
+ }
+
+ const char *platform_file = argv[1];
+ const char *deployment_file = argv[2];
+
+ MSG_create_environment(platform_file);
+ MSG_function_register("host", host);
+ MSG_launch_application(deployment_file);
+
+ msg_error_t res = MSG_main();
+ XBT_INFO("Simulated time: %g", MSG_get_clock());
+
+ if (res == MSG_OK)
+ return 0;
+ else
+ return 1;
+}
XBT_PUBLIC(void) MSG_file_dump(msg_file_t fd);
XBT_PUBLIC(int) MSG_file_unlink(msg_file_t fd);
XBT_PUBLIC(xbt_dict_t) MSG_file_ls(const char *mount, const char *path);
-XBT_PUBLIC(msg_error_t) MSG_file_move (msg_file_t fd, msg_host_t dest, char* mount, char* fullname);
-XBT_PUBLIC(msg_error_t) MSG_file_seek (msg_file_t fd, sg_storage_size_t offset, int whence);
-XBT_PUBLIC(msg_error_t) MSG_file_rename (msg_file_t fd, char* new_name);
+XBT_PUBLIC(msg_error_t) MSG_file_seek(msg_file_t fd, sg_storage_size_t offset, int whence);
XBT_PUBLIC(void) __MSG_file_get_info(msg_file_t fd);
/************************** Storage handling ***********************************/
XBT_PUBLIC(msg_host_t) MSG_get_storage_by_name(const char *name);
XBT_PUBLIC(void *) MSG_storage_get_data(msg_storage_t storage);
XBT_PUBLIC(xbt_dict_t) MSG_storage_get_content(msg_storage_t storage);
XBT_PUBLIC(sg_storage_size_t) MSG_storage_get_size(msg_storage_t storage);
+XBT_PUBLIC(msg_error_t) MSG_storage_file_move(msg_file_t fd, msg_host_t dest, char* mount, char* fullname);
+XBT_PUBLIC(msg_error_t) MSG_storage_file_rename(msg_storage_t storage, const char* src, const char* dest);
/************************** AS Router handling ************************************/
XBT_PUBLIC(const char *) MSG_as_router_get_property_value(const char* asr, const char *name);
XBT_PUBLIC(xbt_dict_t) MSG_as_router_get_properties(const char* asr);
XBT_PUBLIC(xbt_dict_t) simcall_file_ls(const char* mount, const char* path);
XBT_PUBLIC(sg_storage_size_t) simcall_file_get_size(smx_file_t fd);
XBT_PUBLIC(xbt_dynar_t) simcall_file_get_info(smx_file_t fd);
-
/***************************** Storage **********************************/
XBT_PUBLIC(sg_storage_size_t) simcall_storage_get_free_size (const char* name);
XBT_PUBLIC(sg_storage_size_t) simcall_storage_get_used_size (const char* name);
XBT_PUBLIC(xbt_dict_t) simcall_storage_get_content(smx_storage_t storage);
XBT_PUBLIC(const char*) SIMIX_storage_get_name(smx_host_t host);
XBT_PUBLIC(sg_storage_size_t) SIMIX_storage_get_size(smx_storage_t storage);
+XBT_PUBLIC(void) simcall_storage_file_rename(smx_storage_t storage, const char* src, const char* dest);
/************************** AS router **********************************/
XBT_PUBLIC(xbt_dict_t) SIMIX_asr_get_properties(const char *name);
/************************** AS router simcalls ***************************/
surf_action_t(*stat) (void *storage, surf_file_t fd);
surf_action_t(*ls) (void *storage, const char *path);
xbt_dict_t(*get_properties) (const void *storage);
+ void (*rename) (const void *storage, const char *src, const char *dest);
xbt_dict_t(*get_content) (void *storage);
sg_storage_size_t(*get_size) (void *storage);
} s_surf_model_extension_storage_t;
surf_action_t(*ls) (void *workstation, const char* mount, const char *path);
sg_storage_size_t (*get_size) (void *workstation, surf_file_t fd);
xbt_dynar_t (*get_info) (void *workstation, surf_file_t fd);
-
int (*link_shared) (const void *link);
xbt_dict_t(*get_properties) (const void *resource);
void (*add_traces) (void);
return simcall_file_ls(mount, path);
}
-/*
- * Move a file to another location. Depending on the values of dest, dest, mount,
- * and fullname, this move can be local or remote and, within a host, on the same
- * mounted disk or between mounted disks.
- *
- */
-msg_error_t MSG_file_move (msg_file_t fd, msg_host_t dest, char* mount, char* fullname)
-{
- THROW_UNIMPLEMENTED;
- return MSG_OK;
-}
-
/*
* Set the file position indicator in the msg_file_t by adding offset bytes
* to the position specified by whence (either SEEK_SET, SEEK_CUR, or SEEK_END).
return MSG_OK;
}
-/*
- * Rename the file in the contents of its associated storage.
- */
-msg_error_t MSG_file_rename (msg_file_t fd, char* new_name)
-{
- THROW_UNIMPLEMENTED;
- return MSG_OK;
-}
-
/********************************* Storage **************************************/
/** @addtogroup msg_storage_management
return SIMIX_storage_get_size(storage);
}
+/*
+ * Rename the file in the contents of its associated storage.
+ */
+msg_error_t MSG_storage_file_rename(msg_storage_t storage, const char* src, const char* dest)
+{
+ simcall_storage_file_rename(storage, src, dest);
+ return MSG_OK;
+}
+
+/*
+ * Move a file to another location. Depending on the values of dest, dest, mount,
+ * and fullname, this move can be local or remote and, within a host, on the same
+ * mounted disk or between mounted disks.
+ *
+ */
+msg_error_t MSG_storage_file_move (msg_file_t fd, msg_host_t dest, char* mount, char* fullname)
+{
+ THROW_UNIMPLEMENTED;
+ return MSG_OK;
+}
fd->surf_file);
}
+void SIMIX_pre_storage_file_rename(smx_simcall_t simcall, smx_storage_t storage, const char* src, const char* dest)
+{
+ return SIMIX_storage_file_rename(simcall->issuer, storage, src, dest);
+}
+
+void SIMIX_storage_file_rename(smx_process_t process, smx_storage_t storage, const char* src, const char* dest)
+{
+ return surf_workstation_model->extension.storage.rename(storage, src, dest);
+}
+
sg_storage_size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall, const char* name)
{
return SIMIX_storage_get_free_size(simcall->issuer, name);
const char* mount, const char* path);
sg_storage_size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd);
xbt_dynar_t SIMIX_pre_file_get_info(smx_simcall_t simcall, smx_file_t fd);
+void SIMIX_pre_storage_file_rename(smx_simcall_t simcall,smx_storage_t storage, const char* src, const char* dest);
void* SIMIX_file_get_data(smx_file_t fd);
void SIMIX_file_set_data(smx_file_t fd, void *data);
const char *path);
sg_storage_size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd);
xbt_dynar_t SIMIX_file_get_info(smx_process_t process, smx_file_t fd);
+void SIMIX_storage_file_rename(smx_process_t process, smx_storage_t storage, const char* src, const char* dest);
sg_storage_size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall,const char* name);
sg_storage_size_t SIMIX_storage_get_free_size(smx_process_t process,const char* name);
ACTION(SIMCALL_FILE_LS, file_ls, WITHOUT_ANSWER, TSPEC(result, xbt_dict_t), TSTRING(mount), TSTRING(path)) sep \
ACTION(SIMCALL_FILE_GET_SIZE, file_get_size, WITH_ANSWER, TSIZE(result), TSPEC(fd, smx_file_t)) sep \
ACTION(SIMCALL_FILE_GET_INFO, file_get_info, WITH_ANSWER, TSPEC(result, xbt_dynar_t), TSPEC(fd, smx_file_t)) sep \
+ACTION(SIMCALL_STORAGE_FILE_RENAME, storage_file_rename, WITH_ANSWER, TVOID(result), TSPEC(storage, smx_storage_t), TSTRING(src), TSTRING(dest)) sep \
ACTION(SIMCALL_STORAGE_GET_FREE_SIZE, storage_get_free_size, WITH_ANSWER, TSIZE(result), TSTRING(name)) sep \
ACTION(SIMCALL_STORAGE_GET_USED_SIZE, storage_get_used_size, WITH_ANSWER, TSIZE(result), TSTRING(name)) sep \
ACTION(SIMCALL_STORAGE_GET_PROPERTIES, storage_get_properties, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSPEC(storage, smx_storage_t)) sep \
return simcall_BODY_file_get_info(fd);
}
+/**
+ * \ingroup simix_file_management
+ *
+ */
+void simcall_storage_file_rename(smx_storage_t storage, const char* src, const char* dest)
+{
+ return simcall_BODY_storage_file_rename(storage, src, dest);
+}
+
/**
* \ingroup simix_storage_management
* \brief Returns the free space size on a given storage element.
return ((storage_t)storage_resource)->size;
}
+static void storage_file_rename(const void *storage, const char *src, const char *dest)
+{
+ void *storage_resource = surf_storage_resource_priv(storage);
+
+ sg_storage_size_t *psize;
+ psize = (sg_storage_size_t*) xbt_dict_get_or_null(((storage_t)storage_resource)->content,src);
+ if (psize){// src file exists
+ xbt_dict_remove(((storage_t)storage_resource)->content, src);
+ xbt_dict_set(((storage_t)storage_resource)->content, dest, psize,NULL);
+ XBT_DEBUG("Change file name from %s to %s, size '%" PRIu64 "'",src, dest, *psize);
+ }
+ else
+ XBT_DEBUG("File %s doesn't exist",src);
+}
+
+
static void* storage_create_resource(const char* id, const char* model,
const char* type_id, const char* content_name, const char* content_type, xbt_dict_t properties){
storage_t storage = NULL;
surf_storage_model->extension.storage.get_properties = storage_get_properties;
surf_storage_model->extension.storage.get_content = storage_get_content;
surf_storage_model->extension.storage.get_size = storage_get_size;
+ surf_storage_model->extension.storage.rename = storage_file_rename;
if (!storage_maxmin_system) {
storage_maxmin_system = lmm_system_new(storage_selective_update);
}
#include "storage_private.h"
#include "surf/surf_resource.h"
#include "simgrid/sg_config.h"
+#include <inttypes.h>
typedef struct workstation_CLM03 {
s_surf_resource_t generic_resource; /* Must remain first to add this to a trace */