Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Change MSG_file_unlink() return type
authorPierre Veyre <pierre.veyre@cc.in2p3.fr>
Tue, 1 Apr 2014 09:08:39 +0000 (11:08 +0200)
committerPierre Veyre <pierre.veyre@cc.in2p3.fr>
Tue, 1 Apr 2014 09:08:39 +0000 (11:08 +0200)
include/msg/msg.h
src/msg/msg_io.c
src/surf/workstation_interface.cpp

index 04e23b2..8800100 100644 (file)
@@ -89,7 +89,7 @@ XBT_PUBLIC(msg_error_t) MSG_file_set_data(msg_file_t fd, void * data);
 XBT_PUBLIC(int) MSG_file_close(msg_file_t fd);
 XBT_PUBLIC(sg_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(msg_error_t) MSG_file_unlink(msg_file_t fd);
 XBT_PUBLIC(msg_error_t) MSG_file_seek(msg_file_t fd, sg_size_t offset, int origin);
 XBT_PUBLIC(sg_size_t) MSG_file_tell (msg_file_t fd);
 XBT_PUBLIC(void) __MSG_file_get_info(msg_file_t fd);
index 5ab29a3..c48fa55 100644 (file)
@@ -228,7 +228,7 @@ int MSG_file_close(msg_file_t fd)
  * \param fd is the file descriptor (#msg_file_t)
  * \return 0 on success or 1 on error
  */
-int MSG_file_unlink(msg_file_t fd)
+msg_error_t MSG_file_unlink(msg_file_t fd)
 {
   msg_file_priv_t priv = MSG_file_priv(fd);
   int res = simcall_file_unlink(priv->simdata->smx_file);
index cc7fb44..5f44530 100644 (file)
@@ -268,7 +268,7 @@ ActionPtr Workstation::write(surf_file_t fd, sg_size_t size) {
 int Workstation::unlink(surf_file_t fd) {
   if (!fd){
     XBT_WARN("No such file descriptor. Impossible to unlink");
-    return 0;
+    return MSG_TASK_CANCELED;
   } else {
 
     StoragePtr st = findStorageOnMountList(fd->mount);
@@ -276,7 +276,7 @@ int Workstation::unlink(surf_file_t fd) {
     if (!xbt_dict_get_or_null(st->p_content, fd->name)){
       XBT_WARN("File %s is not on disk %s. Impossible to unlink", fd->name,
           st->getName());
-      return 0;
+      return MSG_TASK_CANCELED;
     } else {
       XBT_DEBUG("UNLINK on disk '%s'",st->getName());
       st->m_usedSize -= fd->size;
@@ -287,7 +287,7 @@ int Workstation::unlink(surf_file_t fd) {
       free(fd->name);
       free(fd->mount);
       xbt_free(fd);
-      return 1;
+      return MSG_OK;
     }
   }
 }