Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
handle modifications of the DTD in surf
authorsuter <frederic.suter@cc.in2p3.fr>
Tue, 9 Jul 2013 11:32:09 +0000 (13:32 +0200)
committersuter <frederic.suter@cc.in2p3.fr>
Tue, 9 Jul 2013 11:36:36 +0000 (13:36 +0200)
src/surf/storage.c
src/surf/storage_private.h
src/surf/surfxml_parse.c
src/surf/workstation.c

index 4684a82..210d355 100644 (file)
@@ -192,8 +192,8 @@ static surf_action_t storage_action_execute (void *storage, size_t size, e_surf_
   return (surf_action_t) action;
 }
 
-static void* storage_create_resource(const char* id, const char* model,const char* type_id,const char* content_name)
-{
+static void* storage_create_resource(const char* id, const char* model,
+    const char* type_id,const char* content_name){
   storage_t storage = NULL;
 
   xbt_assert(!surf_storage_resource_priv(surf_storage_resource_by_name(id)),
@@ -415,14 +415,20 @@ static void parse_storage_init(sg_platf_storage_cbarg_t storage)
   // if storage content is not specified use the content of storage_type if exist
   if(!strcmp(storage->content,"") && strcmp(((storage_type_t) stype)->content,"")){
     storage->content = ((storage_type_t) stype)->content;
-    XBT_DEBUG("For disk '%s' content is empty, use the content of storage type '%s'",storage->id,((storage_type_t) stype)->type_id);
+    storage->content_type = ((storage_type_t) stype)->content_type;
+    XBT_DEBUG("For disk '%s' content is empty, inherit the content (of type %s) from storage type '%s' ",
+        storage->id,((storage_type_t) stype)->content_type,
+        ((storage_type_t) stype)->type_id);
   }
 
-  XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s' \n\t\tmodel '%s' \n\t\tcontent '%s'\n\t\tproperties '%p'\n",
+  XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s' "
+      "\n\t\tmodel '%s' \n\t\tcontent '%s'\n\t\tcontent_type '%s' "
+      "\n\t\tproperties '%p'\n",
       storage->id,
       ((storage_type_t) stype)->model,
       ((storage_type_t) stype)->type_id,
       storage->content,
+      storage->content_type,
       ((storage_type_t) stype)->properties);
 
   storage_create_resource(storage->id,
@@ -567,13 +573,16 @@ static void storage_parse_storage_type(sg_platf_storage_type_cbarg_t storage_typ
   stype->model = xbt_strdup(storage_type->model);
   stype->properties = storage_type->properties;
   stype->content = xbt_strdup(storage_type->content);
+  stype->content_type = xbt_strdup(storage_type->content_type);
   stype->type_id = xbt_strdup(storage_type->id);
   stype->size = storage_type->size;
 
-  XBT_DEBUG("ROUTING Create a storage type id '%s' with model '%s' content '%s'",
+  XBT_DEBUG("ROUTING Create a storage type id '%s' with model '%s', "
+      "content '%s', and content_type '%s'",
       stype->type_id,
       stype->model,
-      storage_type->content);
+      storage_type->content,
+      storage_type->content_type);
 
   xbt_lib_set(storage_type_lib,
       stype->type_id,
@@ -608,14 +617,15 @@ static void storage_parse_mount(sg_platf_mount_cbarg_t mount)
 {
   // Verification of an existing storage
 #ifndef NDEBUG
-  void* storage = xbt_lib_get_or_null(storage_lib, mount->id,ROUTING_STORAGE_LEVEL);
+  void* storage = xbt_lib_get_or_null(storage_lib, mount->storageId,ROUTING_STORAGE_LEVEL);
 #endif
-  xbt_assert(storage,"Disk id \"%s\" does not exists", mount->id);
+  xbt_assert(storage,"Disk id \"%s\" does not exists", mount->storageId);
 
-  XBT_DEBUG("ROUTING Mount '%s' on '%s'",mount->id, mount->name);
+  XBT_DEBUG("ROUTING Mount '%s' on '%s'",mount->storageId, mount->name);
 
   s_mount_t mnt;
-  mnt.id = surf_storage_resource_priv(surf_storage_resource_by_name(mount->id));
+  mnt.storage =
+    surf_storage_resource_priv(surf_storage_resource_by_name(mount->storageId));
   mnt.name = xbt_strdup(mount->name);
 
   if(!mount_list){
@@ -631,6 +641,7 @@ static XBT_INLINE void routing_storage_type_free(void *r)
   free(stype->model);
   free(stype->type_id);
   free(stype->content);
+  free(stype->content_type);
   xbt_dict_free(&(stype->properties));
   free(stype);
 }
index 41b94c4..5fe1b8f 100644 (file)
 typedef struct s_storage_type {
   char *model;
   char *content;
+  char *content_type;
   char *type_id;
   xbt_dict_t properties;
   size_t size;
 } s_storage_type_t, *storage_type_t;
 
 typedef struct s_mount {
-  void *id;
+  void *storage;
   char *name;
 } s_mount_t, *mount_t;
 
index 36ddde5..661240f 100644 (file)
@@ -232,6 +232,7 @@ void ETag_surfxml_storage(void)
   storage.id = A_surfxml_storage_id;
   storage.type_id = A_surfxml_storage_typeId;
   storage.content = A_surfxml_storage_content;
+  storage.content_type = A_surfxml_storage_content___type;
   storage.properties = current_property_set;
   sg_platf_new_storage(&storage);
   current_property_set = NULL;
@@ -248,6 +249,7 @@ void ETag_surfxml_storage___type(void)
   memset(&storage_type,0,sizeof(storage_type));
 
   storage_type.content = A_surfxml_storage___type_content;
+  storage_type.content_type = A_surfxml_storage___type_content___type;
   storage_type.id = A_surfxml_storage___type_id;
   storage_type.model = A_surfxml_storage___type_model;
   storage_type.properties = current_property_set;
@@ -278,7 +280,7 @@ void ETag_surfxml_mount(void)
   memset(&mount,0,sizeof(mount));
 
   mount.name = A_surfxml_mount_name;
-  mount.id = A_surfxml_mount_id;
+  mount.storageId = A_surfxml_mount_storageId;
   sg_platf_new_mount(&mount);
 }
 
index 9496b25..ed841dc 100644 (file)
@@ -357,7 +357,7 @@ static storage_t find_storage_on_mount_list(void *workstation,const char* mount)
   {
     XBT_DEBUG("See '%s'",mnt.name);
     if(!strcmp(mount,mnt.name)){
-      st = mnt.id;
+      st = mnt.storage;
       break;
     }
   }