]> rtime.felk.cvut.cz Git - frescor/frsh.git/blobdiff - fres/resalloc/fres_vres.h
Implemented support for contract renegotiation
[frescor/frsh.git] / fres / resalloc / fres_vres.h
index de4839a27788055c91a945d8dd31649a6cbdc55d..95e85452394c6436fc34d8340348ed994563fd27 100644 (file)
@@ -57,6 +57,8 @@
 #ifndef FRES_VRES_H
 #define FRES_VRES_H
 
+#include <fosa.h>
+
 #include <fres_contract_idl.h>
 #include <ul_gavlcust.h>
 
@@ -66,12 +68,12 @@ struct fres_allocator;
 typedef struct fres_vres {
        /** Contracts IDs of this VRES. */
        fres_contract_id_t id;
-       
+
        /**
         * Stores actual allocation of the resource. During a mode
         * change, the callbacks can compare this old allocation with
-        * the changed (stored in @a new) one and depending on the
-        * kind of difference, it can apply the change
+        * the changed one (stored in @a new) and depending on the
+        * kind of difference, they can apply the change
         * differently. Callbacks must not change this field. as well as
         * the @a perceived field.
         */
@@ -89,12 +91,12 @@ typedef struct fres_vres {
 
        /**
         * The schedulable contract received by the allocator. The
-        * shceduler callback should use this contract to
+        * allocator callbacks should use this contract to
         * create/change VRES and must not change the value of this
         * field.
         */
        struct fres_contract *new;
-       
+
        struct fres_allocator *allocator;
        void *priv;             /**< Resource allocator private data */
        gavl_node_t node;
@@ -103,5 +105,29 @@ typedef struct fres_vres {
 fres_vres_t *fres_vres_new(fres_contract_id_t *id);
 void fres_vres_destroy(fres_vres_t *vres);
 
+/**
+ * Representation of thread to VRES binding.
+ */
+typedef struct fres_thread_vres {
+       fosa_thread_id_t id;
+       fres_vres_t *vres;
+
+       fosa_abs_time_t job_start_time;
+       fosa_abs_time_t job_cpu_time;
+
+       gavl_node_t node;
+} fres_thread_vres_t;
+
+static inline
+int fres_thread_vres_cmp(const fosa_thread_id_t *a, const fosa_thread_id_t *b)
+{
+       return fosa_thread_equal(*a, *b);
+}
+
+fres_thread_vres_t *fres_thread_vres_new
+  (const fosa_thread_id_t *id,
+   fres_vres_t *vres);
+
+void fres_thread_vres_destroy(fres_thread_vres_t *th_vres);
 
 #endif