Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add model storage to surf and add a tag storage to dtd.
[simgrid.git] / src / include / surf / surf.h
index 84f17e7..2c0d086 100644 (file)
@@ -25,7 +25,7 @@ typedef enum {
   SURF_NETWORK_ELEMENT_NULL = 0,        /* NULL */
   SURF_NETWORK_ELEMENT_HOST,    /* host type */
   SURF_NETWORK_ELEMENT_ROUTER,  /* router type */
-  SURF_NETWORK_ELEMENT_AS,      /* AS type */
+  SURF_NETWORK_ELEMENT_AS       /* AS type */
 } e_surf_network_element_type_t;
 
 XBT_PUBLIC(e_surf_network_element_type_t)
@@ -199,6 +199,24 @@ typedef struct s_surf_file {
 } s_surf_file_t;
 typedef struct s_surf_file *surf_file_t;
 
+/* Storage model */
+
+/** \brief Storage model extension public
+ *  \ingroup SURF_models
+ *
+ *  Public functions specific to the Storage model.
+ */
+
+typedef struct surf_storage_model_extension_public {
+  surf_action_t(*open) (void *workstation, const char* path, const char* mode);
+  surf_action_t(*close) (void *workstation, surf_file_t fp);
+  surf_action_t(*read) (void *workstation, void* ptr, size_t size, size_t nmemb, surf_file_t stream);
+  surf_action_t(*write) (void *workstation, const void* ptr, size_t size, size_t nmemb, surf_file_t stream);
+  surf_action_t(*stat) (void *workstation, int fd, void* buf);
+  void* (*create_resource) (const char* id, const char* model,
+      const char* content, xbt_dict_t properties);
+} s_surf_model_extension_storage_t;
+
      /** \brief Workstation model extension public
       *  \ingroup SURF_models
       *
@@ -294,6 +312,7 @@ typedef struct surf_model {
   union extension {
     s_surf_model_extension_cpu_t cpu;
     s_surf_model_extension_network_t network;
+    s_surf_model_extension_storage_t storage;
     s_surf_model_extension_workstation_t workstation;
   } extension;
 } s_surf_model_t;
@@ -310,6 +329,9 @@ static inline void *surf_workstation_resource_by_name(const char *name){
 static inline void *surf_network_resource_by_name(const char *name){
        return xbt_lib_get_or_null(link_lib, name, SURF_LINK_LEVEL);
 }
+static inline void *surf_storage_resource_by_name(const char *name) {
+    return xbt_lib_get_or_null(storage_lib, name, SURF_STORAGE_LEVEL);
+}
 
 typedef struct surf_resource {
   surf_model_t model;
@@ -317,8 +339,6 @@ typedef struct surf_resource {
   xbt_dict_t properties;
 } s_surf_resource_t, *surf_resource_t;
 
-
-
 /**
  * Resource which have a metric handled by a maxmin system
  */
@@ -553,6 +573,27 @@ XBT_PUBLIC_DATA(s_surf_model_description_t)
     surf_network_model_description[];
 
 
+
+
+
+
+/** \brief The storage model
+ *  \ingroup SURF_models
+ */
+XBT_PUBLIC(void) surf_storage_model_init_default(void);
+
+/** \brief The list of all available storage modes.
+ *  \ingroup SURF_models
+ *  This storage mode can be set using --cfg=storage/model:...
+ */
+XBT_PUBLIC_DATA(s_surf_model_description_t) surf_storage_model_description[];
+
+
+
+
+
+
+
 /** \brief The workstation model
  *  \ingroup SURF_models
  *