/************************** Storage handling ***********************************/
XBT_PUBLIC(msg_host_t) MSG_get_storage_by_name(const char *name);
XBT_PUBLIC(const char *) MSG_storage_get_name(msg_storage_t storage);
-XBT_PUBLIC(sg_size_t) MSG_storage_get_free_size(const char* name);
-XBT_PUBLIC(sg_size_t) MSG_storage_get_used_size(const char* name);
+XBT_PUBLIC(sg_size_t) MSG_storage_get_free_size(msg_storage_t storage);
+XBT_PUBLIC(sg_size_t) MSG_storage_get_used_size(msg_storage_t storage);
XBT_PUBLIC(msg_storage_t) MSG_storage_get_by_name(const char *name);
XBT_PUBLIC(xbt_dict_t) MSG_storage_get_properties(msg_storage_t storage);
XBT_PUBLIC(void) MSG_storage_set_property_value(msg_storage_t storage, const char *name, char *value,void_f_pvoid_t free_ctn);
XBT_PUBLIC(int) simcall_file_seek(smx_file_t fd, sg_size_t offset, int origin);
XBT_PUBLIC(int) simcall_file_move(smx_file_t fd, const char* fullpath);
/***************************** Storage **********************************/
-XBT_PUBLIC(sg_size_t) simcall_storage_get_free_size (const char* name);
-XBT_PUBLIC(sg_size_t) simcall_storage_get_used_size (const char* name);
+XBT_PUBLIC(sg_size_t) simcall_storage_get_free_size (smx_storage_t storage);
+XBT_PUBLIC(sg_size_t) simcall_storage_get_used_size (smx_storage_t storage);
XBT_PUBLIC(xbt_dict_t) simcall_storage_get_properties(smx_storage_t storage);
XBT_PUBLIC(void*) SIMIX_storage_get_data(smx_storage_t storage);
XBT_PUBLIC(void) SIMIX_storage_set_data(smx_storage_t storage, void *data);
*/
XBT_PUBLIC(sg_size_t) surf_storage_get_size(surf_resource_t resource);
+/**
+ * @brief Get the available size in bytes of a storage
+ *
+ * @param resource The surf storage
+ * @return The available size in bytes of the storage
+ */
+XBT_PUBLIC(sg_size_t) surf_storage_get_free_size(surf_resource_t resource);
+
+/**
+ * @brief Get the size in bytes of a storage
+ *
+ * @param resource The surf storage
+ * @return The used size in bytes of the storage
+ */
+XBT_PUBLIC(sg_size_t) surf_storage_get_used_size(surf_resource_t resource);
+
+
/**
* @brief Get the data associated to the action
*
/** \ingroup msg_storage_management
* \brief Returns the free space size of a storage element
- * \param name the name of a storage
+ * \param storage a storage
* \return the free space size of the storage element (as a #sg_size_t)
*/
-sg_size_t MSG_storage_get_free_size(const char* name){
- return simcall_storage_get_free_size(name);
+sg_size_t MSG_storage_get_free_size(msg_storage_t storage){
+ return simcall_storage_get_free_size(storage);
}
/** \ingroup msg_storage_management
* \brief Returns the used space size of a storage element
- * \param name the name of a storage
+ * \param storage a storage
* \return the used space size of the storage element (as a #sg_size_t)
*/
-sg_size_t MSG_storage_get_used_size(const char* name){
- return simcall_storage_get_used_size(name);
+sg_size_t MSG_storage_get_used_size(msg_storage_t storage){
+ return simcall_storage_get_used_size(storage);
}
/** \ingroup msg_storage_management
file_seek True (int) (fd, void*, smx_file_t) (offset, sg_size_t) (origin, int)
file_get_info True (void*, xbt_dynar_t) (fd, void*, smx_file_t)
file_move True (int) (fd, void*, smx_file_t) (fullpath, const char*)
-storage_get_free_size True (sg_size_t) (name, const char*)
-storage_get_used_size True (sg_size_t) (name, const char*)
+storage_get_free_size True (sg_size_t) (storage, void*, smx_storage_t)
+storage_get_used_size True (sg_size_t) (name, void*, smx_storage_t)
storage_get_properties True (void*, xbt_dict_t) (storage, void*, smx_storage_t)
storage_get_content True (void*, xbt_dict_t) (storage, void*, smx_storage_t)
asr_get_properties True (void*, xbt_dict_t) (name, const char*)
static inline void simcall_file_move__set__fullpath(smx_simcall_t simcall, const char* arg){
simcall->args[1].cc = arg;
}
-static inline const char* simcall_storage_get_free_size__get__name(smx_simcall_t simcall){
- return simcall->args[0].cc;
+static inline smx_storage_t simcall_storage_get_free_size__get__storage(smx_simcall_t simcall){
+ return (smx_storage_t) simcall->args[0].dp;
}
-static inline void simcall_storage_get_free_size__set__name(smx_simcall_t simcall, const char* arg){
- simcall->args[0].cc = arg;
+static inline void simcall_storage_get_free_size__set__storage(smx_simcall_t simcall, void* arg){
+ simcall->args[0].dp = arg;
}
-static inline const char* simcall_storage_get_used_size__get__name(smx_simcall_t simcall){
- return simcall->args[0].cc;
+static inline smx_storage_t simcall_storage_get_used_size__get__name(smx_simcall_t simcall){
+ return (smx_storage_t) simcall->args[0].dp;
}
-static inline void simcall_storage_get_used_size__set__name(smx_simcall_t simcall, const char* arg){
- simcall->args[0].cc = arg;
+static inline void simcall_storage_get_used_size__set__name(smx_simcall_t simcall, void* arg){
+ simcall->args[0].dp = arg;
}
static inline smx_storage_t simcall_storage_get_properties__get__storage(smx_simcall_t simcall){
return (smx_storage_t) simcall->args[0].dp;
}
return self->simcall.result.i;
}
- inline static sg_size_t simcall_BODY_storage_get_free_size(const char* name) {
+ inline static sg_size_t simcall_BODY_storage_get_free_size(smx_storage_t storage) {
smx_process_t self = SIMIX_process_self();
self->simcall.call = SIMCALL_STORAGE_GET_FREE_SIZE;
memset(&self->simcall.result, 0, sizeof(self->simcall.result));
memset(self->simcall.args, 0, sizeof(self->simcall.args));
- self->simcall.args[0].cc = (const char*) name;
+ self->simcall.args[0].dp = (void*) storage;
if (self != simix_global->maestro_process) {
XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
}
return self->simcall.result.sgsz;
}
- inline static sg_size_t simcall_BODY_storage_get_used_size(const char* name) {
+ inline static sg_size_t simcall_BODY_storage_get_used_size(smx_storage_t name) {
smx_process_t self = SIMIX_process_self();
self->simcall.call = SIMCALL_STORAGE_GET_USED_SIZE;
memset(&self->simcall.result, 0, sizeof(self->simcall.result));
memset(self->simcall.args, 0, sizeof(self->simcall.args));
- self->simcall.args[0].cc = (const char*) name;
+ self->simcall.args[0].dp = (void*) name;
if (self != simix_global->maestro_process) {
XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
break;
case SIMCALL_STORAGE_GET_FREE_SIZE:
- simcall->result.sgsz = SIMIX_pre_storage_get_free_size(simcall , simcall->args[0].cc);
+ simcall->result.sgsz = SIMIX_pre_storage_get_free_size(simcall , (smx_storage_t) simcall->args[0].dp);
SIMIX_simcall_answer(simcall);
break;
case SIMCALL_STORAGE_GET_USED_SIZE:
- simcall->result.sgsz = SIMIX_pre_storage_get_used_size(simcall , simcall->args[0].cc);
+ simcall->result.sgsz = SIMIX_pre_storage_get_used_size(simcall , (smx_storage_t) simcall->args[0].dp);
SIMIX_simcall_answer(simcall);
break;
return surf_workstation_file_move(host, file->surf_file, fullpath);
}
-sg_size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall, const char* name)
+sg_size_t SIMIX_storage_get_size(smx_storage_t storage){
+ xbt_assert((storage != NULL), "Invalid parameters (simix storage is NULL)");
+ return surf_storage_get_size(storage);
+}
+
+sg_size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall, smx_storage_t storage)
{
- return SIMIX_storage_get_free_size(simcall->issuer, name);
+ return SIMIX_storage_get_free_size(simcall->issuer, storage);
}
-sg_size_t SIMIX_storage_get_free_size(smx_process_t process, const char* name)
+sg_size_t SIMIX_storage_get_free_size(smx_process_t process, smx_storage_t storage)
{
- smx_host_t host = process->smx_host;
- return surf_workstation_get_free_size(host, name);
+ return surf_storage_get_free_size(storage);
}
-sg_size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall, const char* name)
+sg_size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall, smx_storage_t storage)
{
- return SIMIX_storage_get_used_size(simcall->issuer, name);
+ return SIMIX_storage_get_used_size(simcall->issuer, storage);
}
-sg_size_t SIMIX_storage_get_used_size(smx_process_t process, const char* name)
+sg_size_t SIMIX_storage_get_used_size(smx_process_t process, smx_storage_t storage)
{
- smx_host_t host = process->smx_host;
- return surf_workstation_get_used_size(host, name);
+ return surf_storage_get_used_size(storage);
}
xbt_dict_t SIMIX_pre_storage_get_properties(smx_simcall_t simcall, smx_storage_t storage){
return surf_storage_get_content(storage);
}
-sg_size_t SIMIX_storage_get_size(smx_storage_t storage){
- xbt_assert((storage != NULL), "Invalid parameters (simix storage is NULL)");
- return surf_storage_get_size(storage);
-}
-
const char* SIMIX_pre_storage_get_host(smx_simcall_t simcall, smx_storage_t storage){
return SIMIX_storage_get_host(storage);
}
int SIMIX_file_seek(smx_process_t process, smx_file_t fd, sg_size_t offset, int origin);
int SIMIX_file_move(smx_process_t process, smx_file_t fd, const char* fullpath);
-sg_size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall,const char* name);
-sg_size_t SIMIX_storage_get_free_size(smx_process_t process,const char* name);
+sg_size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall,smx_storage_t storage);
+sg_size_t SIMIX_storage_get_free_size(smx_process_t process,smx_storage_t storage);
-sg_size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall,const char* name);
-sg_size_t SIMIX_storage_get_used_size(smx_process_t process,const char* name);
+sg_size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall,smx_storage_t storage);
+sg_size_t SIMIX_storage_get_used_size(smx_process_t process,smx_storage_t storage);
xbt_dict_t SIMIX_storage_get_properties(smx_storage_t storage);
xbt_dict_t SIMIX_pre_storage_get_properties(smx_simcall_t, smx_storage_t);
/**
* \ingroup simix_storage_management
* \brief Returns the free space size on a given storage element.
- * \param storage name
+ * \param storage a storage
* \return Return the free space size on a given storage element (as sg_size_t)
*/
-sg_size_t simcall_storage_get_free_size (const char* name){
- return simcall_BODY_storage_get_free_size(name);
+sg_size_t simcall_storage_get_free_size (smx_storage_t storage){
+ return simcall_BODY_storage_get_free_size(storage);
}
/**
* \ingroup simix_storage_management
* \brief Returns the used space size on a given storage element.
- * \param storage name
+ * \param storage a storage
* \return Return the used space size on a given storage element (as sg_size_t)
*/
-sg_size_t simcall_storage_get_used_size (const char* name){
- return simcall_BODY_storage_get_used_size(name);
+sg_size_t simcall_storage_get_used_size (smx_storage_t storage){
+ return simcall_BODY_storage_get_used_size(storage);
}
/**
return m_size;
}
+sg_size_t Storage::getFreeSize(){
+ return m_size - m_usedSize;
+}
+
+sg_size_t Storage::getUsedSize(){
+ return m_usedSize;
+}
+
/**********
* Action *
**********/
*/
virtual sg_size_t getSize();
+ /**
+ * @brief Get the available size in bytes of the current Storage
+ *
+ * @return The available size in bytes of the current Storage
+ */
+ virtual sg_size_t getFreeSize();
+
+ /**
+ * @brief Get the used size in bytes of the current Storage
+ *
+ * @return The used size in bytes of the current Storage
+ */
+ virtual sg_size_t getUsedSize();
+
+
xbt_dict_t parseContent(char *filename);
xbt_dynar_t p_writeActions;
return get_casted_workstation(resource)->getInfo(fd);
}
-sg_size_t surf_workstation_get_free_size(surf_resource_t resource, const char* name){
- return get_casted_workstation(resource)->getFreeSize(name);
-}
-
-sg_size_t surf_workstation_get_used_size(surf_resource_t resource, const char* name){
- return get_casted_workstation(resource)->getUsedSize(name);
-}
-
size_t surf_workstation_file_tell(surf_resource_t workstation, surf_file_t fd){
return get_casted_workstation(workstation)->fileTell(fd);
}
return static_cast<StoragePtr>(surf_storage_resource_priv(resource))->getSize();
}
+sg_size_t surf_storage_get_free_size(surf_resource_t resource){
+ return static_cast<StoragePtr>(surf_storage_resource_priv(resource))->getFreeSize();
+}
+
+sg_size_t surf_storage_get_used_size(surf_resource_t resource){
+ return static_cast<StoragePtr>(surf_storage_resource_priv(resource))->getUsedSize();
+}
+
const char* surf_storage_get_host(surf_resource_t resource){
return static_cast<StoragePtr>(surf_storage_resource_priv(resource))->p_attach;
}
}
}
-sg_size_t Workstation::getFreeSize(const char* name)
-{
- StoragePtr st = findStorageOnMountList(name);
- return st->m_size - st->m_usedSize;
-}
-
-sg_size_t Workstation::getUsedSize(const char* name)
-{
- StoragePtr st = findStorageOnMountList(name);
- return st->m_usedSize;
-}
-
xbt_dynar_t Workstation::getVms()
{
xbt_dynar_t dyn = xbt_dynar_new(sizeof(smx_host_t), NULL);
virtual sg_size_t fileTell(surf_file_t fd);
/**
- * @brief Get the available space of the storage at the mount point
- *
- * @param name The mount point
- * @return The amount of availble space in bytes
- */
- virtual sg_size_t getFreeSize(const char* name);
-
- /**
- * @brief Get the used space of the storage at the mount point
- *
- * @param name The mount point
- * @return The amount of used space in bytes
- */
- virtual sg_size_t getUsedSize(const char* name);
-
- /**
- * @brief Set the position indictator assiociated with the file descriptor to a new position
+ * @brief Set the position indicator associated with the file descriptor to a new position
* @details [long description]
*
* @param fd The file descriptor
{
XBT_INFO("\tStorage name: %s, mount name: %s", storage_name, mount_name);
- sg_size_t free_size = MSG_storage_get_free_size(mount_name);
- sg_size_t used_size = MSG_storage_get_used_size(mount_name);
+ storage = MSG_storage_get_by_name(storage_name);
+
+ sg_size_t free_size = MSG_storage_get_free_size(storage);
+ sg_size_t used_size = MSG_storage_get_used_size(storage);
XBT_INFO("\t\tFree size: %llu bytes", free_size);
XBT_INFO("\t\tUsed size: %llu bytes", used_size);
- storage = MSG_storage_get_by_name(storage_name);
display_storage_properties(storage);
dump_storage_by_name(storage_name);
}