Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill code duplication, and doc tiny improvements
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Sat, 27 Oct 2007 08:36:33 +0000 (08:36 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Sat, 27 Oct 2007 08:36:33 +0000 (08:36 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@4898 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/msg/host.c
src/msg/m_process.c
src/simdag/sd_link.c
src/simdag/sd_workstation.c

index 2b933f9..2b16677 100644 (file)
@@ -187,11 +187,11 @@ double MSG_get_host_speed(m_host_t h)
 }
 
 /** \ingroup m_host_management
- * \brief Returns the value of a certain host property
+ * \brief Returns the value of a given host property
  *
  * \param host a host
  * \param name a property name
- * \return value of a property
+ * \return value of a property (or NULL if property not set)
  */
 const char* MSG_host_get_property_value(m_host_t host, char* name)
 {
index 8f3d6d5..900f4cb 100644 (file)
@@ -29,21 +29,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_process, msg,
  */
 
 /******************************** Process ************************************/
-/** \ingroup m_process_management
- * \brief Creates and runs a new #m_process_t.
- *
- * Does exactly the same as #MSG_process_create_with_arguments but without 
-   providing standard arguments (\a argc, \a argv, \a start_time, \a kill_time).
- * \sa MSG_process_create_with_arguments
- */
-m_process_t MSG_process_create(const char *name,
-                              xbt_main_func_t code, void *data,
-                              m_host_t host)
-{
-  return MSG_process_create_with_arguments(name, code, data, host, -1,
-                                          NULL);
-}
-
 void __MSG_process_cleanup(void *arg)
 {
   /* arg is a pointer to a simix process, we can get the msg process with the field data */
@@ -69,6 +54,21 @@ void *_MSG_process_create_from_SIMIX(const char *name,
                                                      argc, argv,properties);
 }
 
+/** \ingroup m_process_management
+ * \brief Creates and runs a new #m_process_t.
+ *
+ * Does exactly the same as #MSG_process_create_with_arguments but without 
+   providing standard arguments (\a argc, \a argv, \a start_time, \a kill_time).
+ * \sa MSG_process_create_with_arguments
+ */
+m_process_t MSG_process_create(const char *name,
+                              xbt_main_func_t code, void *data,
+                              m_host_t host)
+{
+  return MSG_process_create_with_environment(name, code, data, host, -1,
+                                            NULL,NULL);
+}
+
 /** \ingroup m_process_management
  * \brief Creates and runs a new #m_process_t.
 
@@ -99,36 +99,8 @@ m_process_t MSG_process_create_with_arguments(const char *name,
                                              void *data, m_host_t host,
                                              int argc, char **argv)
 {
-  simdata_process_t simdata = xbt_new0(s_simdata_process_t, 1);
-  m_process_t process = xbt_new0(s_m_process_t, 1);
-  xbt_assert0(((code != NULL) && (host != NULL)), "Invalid parameters");
-
-  /* Simulator Data */
-  simdata->PID = msg_global->PID++;
-  simdata->waiting_task = NULL;
-  simdata->m_host = host;
-  simdata->argc = argc;
-  simdata->argv = argv;
-  simdata->s_process = SIMIX_process_create(name, code,
-                                           (void *) process, host->name,
-                                           argc, argv, NULL);
-
-  if (SIMIX_process_self()) {
-    simdata->PPID = MSG_process_get_PID(SIMIX_process_self()->data);
-  } else {
-    simdata->PPID = -1;
-  }
-  simdata->last_errno = MSG_OK;
-
-
-  /* Process structure */
-  process->name = xbt_strdup(name);
-  process->simdata = simdata;
-  process->data = data ;
-
-  xbt_fifo_unshift(msg_global->process_list, process);
-
-  return process;
+  return MSG_process_create_with_environment(name, code, data, host, 
+                                            argc,argv,NULL);
 }
 
 /** \ingroup m_process_management
@@ -186,7 +158,7 @@ m_process_t MSG_process_create_with_environment(const char *name,
   /* Process structure */
   process->name = xbt_strdup(name);
   process->simdata = simdata;
-  process->data = data ;
+  process->data = data;
 
   xbt_fifo_unshift(msg_global->process_list, process);
 
@@ -349,11 +321,11 @@ const char *MSG_process_get_name(m_process_t process)
 }
 
 /** \ingroup m_process_management
- * \brief Returns the value of a certain process property
+ * \brief Returns the value of a given process property
  *
  * \param process a process
  * \param name a property name
- * \return value of a property
+ * \return value of a property (or NULL if the property is not set)
  */
 const char* MSG_process_get_property_value(m_process_t process, char* name)
 {
index e9637b5..4712b06 100644 (file)
@@ -118,11 +118,11 @@ double SD_link_get_current_bandwidth(SD_link_t link) {
 }
 
 /**
- * \brief Returns the value of a certain link property
+ * \brief Returns the value of a given link property
  *
  * \param workstation a workstation
  * \param name a property name
- * \return value of a property
+ * \return value of a property (or NULL if property not set)
  */
 const char* SD_link_get_property_value(SD_link_t link, char* name)
 {
@@ -130,7 +130,7 @@ const char* SD_link_get_property_value(SD_link_t link, char* name)
 }
 
 /**
- * \brief Returns a xbt_dynar_t consisting of the list of properties assigned to a link
+ * \brief Returns a #xbt_dict_t consisting of the list of properties assigned to a link
  *
  * \param link a link
  * \return the dictionary containing the properties associated with the link
index fab8673..fef8cf7 100644 (file)
@@ -130,11 +130,11 @@ const char* SD_workstation_get_name(SD_workstation_t workstation) {
 }
 
 /**
- * \brief Returns the value of a certain workstation property
+ * \brief Returns the value of a given workstation property
  *
  * \param workstation a workstation
  * \param name a property name
- * \return value of a property
+ * \return value of a property (or NULL if property not set)
  */
 const char* SD_workstation_get_property_value(SD_workstation_t ws, char* name)
 {
@@ -143,7 +143,7 @@ const char* SD_workstation_get_property_value(SD_workstation_t ws, char* name)
 
 
 /**
- * \brief Returns a xbt_dynar_t consisting of the list of properties assigned to this workstation
+ * \brief Returns a #xbt_dict_t consisting of the list of properties assigned to this workstation
  *
  * \param workstation a workstation
  * \return the dictionary containing the properties associated with the workstation