Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge tag 'v3_10_rc2'
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 8 Nov 2013 23:00:32 +0000 (00:00 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 8 Nov 2013 23:00:32 +0000 (00:00 +0100)
Conflicts:
CMakeLists.txt
ChangeLog

14 files changed:
CMakeLists.txt
ChangeLog
NEWS
examples/msg/io/storage.c [new file with mode: 0644]
include/msg/msg.h
include/simgrid/simix.h
src/include/surf/surf.h
src/msg/msg_io.c
src/simix/smx_io.c
src/simix/smx_io_private.h
src/simix/smx_smurf_private.h
src/simix/smx_user.c
src/surf/storage.c
src/surf/workstation.c

index a21be2a..a00593a 100644 (file)
@@ -47,11 +47,12 @@ set(CMAKE_Fortran_LINK_FLAGS "" CACHE TYPE INTERNAL FORCE)
 # 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
 
index 0b9ae9e..0fa5331 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+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.
diff --git a/NEWS b/NEWS
index d601309..0d72f6b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+                    _               _____  _ _
+__   _____ _ __ ___(_) ___  _ __   |___ / / / |
+\ \ / / _ \ '__/ __| |/ _ \| '_ \    |_ \ | | |
+ \ V /  __/ |  \__ \ | (_) | | | |  ___) || | |
+  \_/ \___|_|  |___/_|\___/|_| |_| |____(_)_|_|
+
+(to complete)
                     _               _____  _  ___
 __   _____ _ __ ___(_) ___  _ __   |___ / / |/ _ \
 \ \ / / _ \ '__/ __| |/ _ \| '_ \    |_ \ | | | | |
diff --git a/examples/msg/io/storage.c b/examples/msg/io/storage.c
new file mode 100644 (file)
index 0000000..c011805
--- /dev/null
@@ -0,0 +1,156 @@
+/* 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;
+}
index 144d42b..4a845f3 100644 (file)
@@ -92,9 +92,7 @@ XBT_PUBLIC(sg_storage_size_t) MSG_file_get_size(msg_file_t fd);
 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);
@@ -109,6 +107,8 @@ XBT_PUBLIC(msg_error_t) MSG_storage_set_data(msg_storage_t host, void *data);
 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);
index ecdd1d6..07b4052 100644 (file)
@@ -489,7 +489,6 @@ XBT_PUBLIC(int) simcall_file_unlink(smx_file_t fd);
 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);
@@ -500,6 +499,7 @@ XBT_PUBLIC(xbt_dict_t) SIMIX_storage_get_content(smx_storage_t storage);
 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 ***************************/
index 0f0694a..9de02be 100644 (file)
@@ -238,6 +238,7 @@ typedef struct surf_storage_model_extension_public {
   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;
@@ -287,7 +288,6 @@ typedef struct surf_workstation_model_extension_public {
   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);
index cb2018a..0b816a1 100644 (file)
@@ -191,18 +191,6 @@ xbt_dict_t MSG_file_ls(const char *mount, const char *path)
   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).
@@ -213,15 +201,6 @@ msg_error_t MSG_file_seek (msg_file_t fd, sg_storage_size_t offset, int whence)
   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
@@ -370,3 +349,23 @@ sg_storage_size_t MSG_storage_get_size(msg_storage_t storage)
   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;
+}
index 07a354c..6755bba 100644 (file)
@@ -300,6 +300,16 @@ xbt_dynar_t SIMIX_file_get_info(smx_process_t process, smx_file_t fd)
       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);
index a3fea00..864656b 100644 (file)
@@ -34,6 +34,7 @@ void SIMIX_pre_file_ls(smx_simcall_t simcall,
                        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);
@@ -47,6 +48,7 @@ smx_action_t SIMIX_file_ls(smx_process_t process, const char *mount,
                            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);
index 1e191f7..a57a798 100644 (file)
@@ -357,6 +357,7 @@ ACTION(SIMCALL_FILE_UNLINK, file_unlink, WITH_ANSWER, TINT(result), TSPEC(fd, sm
 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 \
index a4453a8..9694523 100644 (file)
@@ -1273,6 +1273,15 @@ xbt_dynar_t simcall_file_get_info(smx_file_t fd)
   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.
index 5369136..79974c7 100644 (file)
@@ -226,6 +226,22 @@ static sg_storage_size_t storage_get_size(void *storage){
   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;
@@ -538,6 +554,7 @@ static void surf_storage_model_init_internal(void)
   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);
   }
index f50cf05..69255a4 100644 (file)
@@ -11,6 +11,7 @@
 #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 */