Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
give simgrid::Host a getState() method, and use it
[simgrid.git] / src / simix / smx_io.cpp
index 3866492b030fb067fb496e2899a7bde9c8b5d471..9bac80e889f8d5860d116c83709a6eeff244ab1f 100644 (file)
@@ -61,7 +61,7 @@ smx_synchro_t SIMIX_file_read(smx_file_t fd, sg_size_t size, sg_host_t host)
   smx_synchro_t synchro;
 
   /* check if the host is active */
-  if (surf_host_get_state(surf_host_resource_priv(host)) != SURF_RESOURCE_ON) {
+  if (host->getState() != SURF_RESOURCE_ON) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
            sg_host_get_name(host));
   }
@@ -93,7 +93,7 @@ smx_synchro_t SIMIX_file_write(smx_file_t fd, sg_size_t size, sg_host_t host)
   smx_synchro_t synchro;
 
   /* check if the host is active */
-  if (surf_host_get_state(surf_host_resource_priv(host)) != SURF_RESOURCE_ON) {
+  if (host->getState() != SURF_RESOURCE_ON) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
            sg_host_get_name(host));
   }
@@ -125,7 +125,7 @@ smx_synchro_t SIMIX_file_open(const char* fullpath, sg_host_t host)
   smx_synchro_t synchro;
 
   /* check if the host is active */
-  if (surf_host_get_state(surf_host_resource_priv(host)) != SURF_RESOURCE_ON) {
+  if (host->getState() != SURF_RESOURCE_ON) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
            sg_host_get_name(host));
   }
@@ -157,7 +157,7 @@ smx_synchro_t SIMIX_file_close(smx_file_t fd, sg_host_t host)
   smx_synchro_t synchro;
 
   /* check if the host is active */
-  if (surf_host_get_state(surf_host_resource_priv(host)) != SURF_RESOURCE_ON) {
+  if (host->getState() != SURF_RESOURCE_ON) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
            sg_host_get_name(host));
   }
@@ -181,7 +181,7 @@ smx_synchro_t SIMIX_file_close(smx_file_t fd, sg_host_t host)
 int SIMIX_file_unlink(smx_file_t fd, sg_host_t host)
 {
   /* check if the host is active */
-  if (surf_host_get_state(surf_host_resource_priv(host)) != SURF_RESOURCE_ON) {
+  if (host->getState() != SURF_RESOURCE_ON) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
            sg_host_get_name(host));
   }
@@ -273,9 +273,7 @@ sg_size_t SIMIX_storage_get_used_size(smx_process_t process, smx_storage_t stora
 }
 
 xbt_dict_t SIMIX_storage_get_properties(smx_storage_t storage){
-  xbt_assert((storage != NULL), "Invalid parameters (simix storage is NULL)");
-  return (xbt_dict_t) surf_resource_get_properties((surf_cpp_resource_t)
-    surf_storage_resource_priv(storage));
+  return surf_storage_get_properties(storage);
 }
 
 const char* SIMIX_storage_get_name(smx_storage_t storage){
@@ -375,7 +373,7 @@ void SIMIX_io_finish(smx_synchro_t synchro)
             (int)synchro->state);
     }
 
-    if (surf_host_get_state(surf_host_resource_priv(simcall->issuer->host)) != SURF_RESOURCE_ON) {
+    if (simcall->issuer->host->getState() != SURF_RESOURCE_ON) {
       simcall->issuer->context->iwannadie = 1;
     }