+ return storage_action_sleep(storage,5.0);
+}
+
+static surf_action_t storage_action_execute (void *storage, double size)
+{
+ surf_action_storage_t action = NULL;
+ storage_t STORAGE = storage;
+
+ XBT_IN("(%s,%g)", surf_resource_name(STORAGE), size);
+ action =
+ surf_action_new(sizeof(s_surf_action_storage_t), size, surf_storage_model,
+ STORAGE->state_current != SURF_RESOURCE_ON);
+
+ GENERIC_LMM_ACTION(action).suspended = 0; /* Should be useless because of the
+ calloc but it seems to help valgrind... */
+ GENERIC_LMM_ACTION(action).variable =
+ lmm_variable_new(storage_maxmin_system, action, 1.0, -1.0 , 1);
+ XBT_OUT();
+ return (surf_action_t) action;
+}
+
+static surf_action_t storage_action_sleep (void *storage, double duration)
+{
+ surf_action_storage_t action = NULL;
+
+ if (duration > 0)
+ duration = MAX(duration, MAXMIN_PRECISION);
+
+ XBT_IN("(%s,%g)", surf_resource_name(storage), duration);
+ action = (surf_action_storage_t) storage_action_execute(storage, 1.0);
+ GENERIC_ACTION(action).max_duration = duration;
+ GENERIC_LMM_ACTION(action).suspended = 2;
+ if (duration == NO_MAX_DURATION) {
+ /* Move to the *end* of the corresponding action set. This convention
+ is used to speed up update_resource_state */
+ xbt_swag_remove(action, ((surf_action_t) action)->state_set);
+ ((surf_action_t) action)->state_set =
+ storage_running_action_set_that_does_not_need_being_checked;
+ xbt_swag_insert(action, ((surf_action_t) action)->state_set);
+ }
+ XBT_OUT();
+ return (surf_action_t) action;