Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
introduce sg_host_disks
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 7 Feb 2020 09:49:59 +0000 (10:49 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 7 Feb 2020 09:49:59 +0000 (10:49 +0100)
include/simgrid/host.h
src/s4u/s4u_Host.cpp

index 843c0fc..e5ad0eb 100644 (file)
@@ -68,6 +68,7 @@ XBT_PUBLIC xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host);
  * @return a dynar containing all storages (name) attached to the host
  */
 XBT_PUBLIC xbt_dynar_t sg_host_get_attached_storage_list(const_sg_host_t host);
+XBT_PUBLIC void sg_host_disks(sg_host_t host, unsigned int* disk_count, sg_disk_t** disks);
 
 // =========== user-level functions ===============
 /** @brief Return the speed of the processor (in flop/s), regardless of the current load on the machine. */
index a298510..9ac3894 100644 (file)
@@ -382,6 +382,15 @@ void sg_host_user_destroy(sg_host_t host) // deprecated
 }
 
 // ========= storage related functions ============
+void sg_host_disks(sg_host_t host, unsigned int* disk_count, sg_disk_t** disks)
+{
+  std::vector<sg_disk_t> list = host->get_disks();
+  *disk_count                 = list.size();
+  *disks                      = static_cast<sg_disk_t*>(xbt_malloc(sizeof(sg_disk_t) * (*disk_count)));
+  for (size_t i = 0; i < *disk_count; i++)
+    (*disks)[i] = list[i];
+}
+
 xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host)
 {
   xbt_assert((host != nullptr), "Invalid parameters");