From 1a975ced4278c81b875165ded3d9b2254d1522aa Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Fri, 7 Feb 2020 10:49:59 +0100 Subject: [PATCH] introduce sg_host_disks --- include/simgrid/host.h | 1 + src/s4u/s4u_Host.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/include/simgrid/host.h b/include/simgrid/host.h index 843c0fcfb4..e5ad0eb50a 100644 --- a/include/simgrid/host.h +++ b/include/simgrid/host.h @@ -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. */ diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index a298510165..9ac3894aec 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -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 list = host->get_disks(); + *disk_count = list.size(); + *disks = static_cast(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"); -- 2.20.1