Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Prefer the C-ish sg_host_get_name() over sg_host_name()
[simgrid.git] / src / simix / smx_io.c
index 0dce9cb..241e569 100644 (file)
@@ -1,11 +1,10 @@
-/* Copyright (c) 2007-2010, 2012-2014. The SimGrid Team.
+/* Copyright (c) 2007-2010, 2012-2015. 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. */
 
 #include "smx_private.h"
-//#include "surf/storage_private.h"
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "xbt/dict.h"
@@ -50,21 +49,21 @@ void SIMIX_storage_destroy(void *s)
 }
 
 //SIMIX FILE READ
-void simcall_HANDLER_file_read(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, smx_host_t host)
+void simcall_HANDLER_file_read(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, sg_host_t host)
 {
   smx_synchro_t synchro = SIMIX_file_read(fd, size, host);
   xbt_fifo_push(synchro->simcalls, simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
-smx_synchro_t SIMIX_file_read(smx_file_t fd, sg_size_t size, smx_host_t host)
+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_resource_get_state(surf_host_resource_priv(host)) != SURF_RESOURCE_ON) {
+  if (surf_host_get_state(surf_host_resource_priv(host)) != SURF_RESOURCE_ON) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
-           sg_host_name(host));
+           sg_host_get_name(host));
   }
 
   synchro = xbt_mallocator_get(simix_global->synchro_mallocator);
@@ -82,21 +81,21 @@ smx_synchro_t SIMIX_file_read(smx_file_t fd, sg_size_t size, smx_host_t host)
 }
 
 //SIMIX FILE WRITE
-void simcall_HANDLER_file_write(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, smx_host_t host)
+void simcall_HANDLER_file_write(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, sg_host_t host)
 {
   smx_synchro_t synchro = SIMIX_file_write(fd,  size, host);
   xbt_fifo_push(synchro->simcalls, simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
-smx_synchro_t SIMIX_file_write(smx_file_t fd, sg_size_t size, smx_host_t host)
+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_resource_get_state(surf_host_resource_priv(host)) != SURF_RESOURCE_ON) {
+  if (surf_host_get_state(surf_host_resource_priv(host)) != SURF_RESOURCE_ON) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
-           sg_host_name(host));
+           sg_host_get_name(host));
   }
 
   synchro = xbt_mallocator_get(simix_global->synchro_mallocator);
@@ -114,21 +113,21 @@ smx_synchro_t SIMIX_file_write(smx_file_t fd, sg_size_t size, smx_host_t host)
 }
 
 //SIMIX FILE OPEN
-void simcall_HANDLER_file_open(smx_simcall_t simcall, const char* fullpath, smx_host_t host)
+void simcall_HANDLER_file_open(smx_simcall_t simcall, const char* fullpath, sg_host_t host)
 {
   smx_synchro_t synchro = SIMIX_file_open(fullpath, host);
   xbt_fifo_push(synchro->simcalls, simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
-smx_synchro_t SIMIX_file_open(const char* fullpath, smx_host_t host)
+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_resource_get_state(surf_host_resource_priv(host)) != SURF_RESOURCE_ON) {
+  if (surf_host_get_state(surf_host_resource_priv(host)) != SURF_RESOURCE_ON) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
-           sg_host_name(host));
+           sg_host_get_name(host));
   }
 
   synchro = xbt_mallocator_get(simix_global->synchro_mallocator);
@@ -146,21 +145,21 @@ smx_synchro_t SIMIX_file_open(const char* fullpath, smx_host_t host)
 }
 
 //SIMIX FILE CLOSE
-void simcall_HANDLER_file_close(smx_simcall_t simcall, smx_file_t fd, smx_host_t host)
+void simcall_HANDLER_file_close(smx_simcall_t simcall, smx_file_t fd, sg_host_t host)
 {
   smx_synchro_t synchro = SIMIX_file_close(fd, host);
   xbt_fifo_push(synchro->simcalls, simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
-smx_synchro_t SIMIX_file_close(smx_file_t fd, smx_host_t host)
+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_resource_get_state(surf_host_resource_priv(host)) != SURF_RESOURCE_ON) {
+  if (surf_host_get_state(surf_host_resource_priv(host)) != SURF_RESOURCE_ON) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
-           sg_host_name(host));
+           sg_host_get_name(host));
   }
 
   synchro = xbt_mallocator_get(simix_global->synchro_mallocator);
@@ -179,12 +178,12 @@ smx_synchro_t SIMIX_file_close(smx_file_t fd, smx_host_t host)
 
 
 //SIMIX FILE UNLINK
-int SIMIX_file_unlink(smx_file_t fd, smx_host_t host)
+int SIMIX_file_unlink(smx_file_t fd, sg_host_t host)
 {
   /* check if the host is active */
-  if (surf_resource_get_state(surf_host_resource_priv(host)) != SURF_RESOURCE_ON) {
+  if (surf_host_get_state(surf_host_resource_priv(host)) != SURF_RESOURCE_ON) {
     THROWF(host_error, 0, "Host %s failed, you cannot call this function",
-           sg_host_name(host));
+           sg_host_get_name(host));
   }
 
   int res = surf_host_unlink(host, fd->surf_file);
@@ -199,7 +198,7 @@ sg_size_t simcall_HANDLER_file_get_size(smx_simcall_t simcall, smx_file_t fd)
 
 sg_size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd)
 {
-  smx_host_t host = process->smx_host;
+  sg_host_t host = process->host;
   return  surf_host_get_size(host, fd->surf_file);
 }
 
@@ -210,7 +209,7 @@ sg_size_t simcall_HANDLER_file_tell(smx_simcall_t simcall, smx_file_t fd)
 
 sg_size_t SIMIX_file_tell(smx_process_t process, smx_file_t fd)
 {
-  smx_host_t host = process->smx_host;
+  sg_host_t host = process->host;
   return  surf_host_file_tell(host, fd->surf_file);
 }
 
@@ -222,7 +221,7 @@ xbt_dynar_t simcall_HANDLER_file_get_info(smx_simcall_t simcall, smx_file_t fd)
 
 xbt_dynar_t SIMIX_file_get_info(smx_process_t process, smx_file_t fd)
 {
-  smx_host_t host = process->smx_host;
+  sg_host_t host = process->host;
   return  surf_host_get_info(host, fd->surf_file);
 }
 
@@ -233,7 +232,7 @@ int simcall_HANDLER_file_seek(smx_simcall_t simcall, smx_file_t fd, sg_offset_t
 
 int SIMIX_file_seek(smx_process_t process, smx_file_t fd, sg_offset_t offset, int origin)
 {
-  smx_host_t host = process->smx_host;
+  sg_host_t host = process->host;
   return  surf_host_file_seek(host, fd->surf_file, offset, origin);
 }
 
@@ -244,7 +243,7 @@ int simcall_HANDLER_file_move(smx_simcall_t simcall, smx_file_t file, const char
 
 int SIMIX_file_move(smx_process_t process, smx_file_t file, const char* fullpath)
 {
-  smx_host_t host = process->smx_host;
+  sg_host_t host = process->host;
   return  surf_host_file_move(host, file->surf_file, fullpath);
 }
 
@@ -375,7 +374,7 @@ void SIMIX_io_finish(smx_synchro_t synchro)
             (int)synchro->state);
     }
 
-    if (surf_resource_get_state(surf_host_resource_priv(simcall->issuer->smx_host)) != SURF_RESOURCE_ON) {
+    if (surf_host_get_state(surf_host_resource_priv(simcall->issuer->host)) != SURF_RESOURCE_ON) {
       simcall->issuer->context->iwannadie = 1;
     }