]> rtime.felk.cvut.cz Git - frescor/frsh.git/commitdiff
Our sources now use the fres_ prefix
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 20 Oct 2008 10:20:35 +0000 (12:20 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 20 Oct 2008 10:20:35 +0000 (12:20 +0200)
33 files changed:
cm/contract/Makefile.omk [deleted file]
cm/contract/cm_container.h [deleted file]
cm/contract/cm_container_internal.h [deleted file]
cm/contract/cm_container_type.h [deleted file]
cm/contract/cm_contract.c [deleted file]
cm/contract/cm_contract.h [deleted file]
cm/contract/cm_contract_type.h [deleted file]
cm/rm.idl [deleted file]
cm/rs.idl [deleted file]
fres/Makefile [moved from cm/Makefile with 100% similarity]
fres/Makefile.omk [moved from cm/Makefile.omk with 100% similarity]
fres/cm.c [moved from cm/cm.c with 100% similarity]
fres/cm.idl [moved from cm/cm.idl with 85% similarity]
fres/contract/Makefile [moved from cm/contract/Makefile with 100% similarity]
fres/contract/Makefile.omk [new file with mode: 0644]
fres/contract/fres_blocks.idl [moved from cm/contract/cm_blocks.idl with 89% similarity]
fres/contract/fres_container.c [moved from cm/contract/cm_container.c with 53% similarity]
fres/contract/fres_container.h [new file with mode: 0644]
fres/contract/fres_container_internal.h [new file with mode: 0644]
fres/contract/fres_container_type.h [new file with mode: 0644]
fres/contract/fres_contract.c [new file with mode: 0644]
fres/contract/fres_contract.h [new file with mode: 0644]
fres/contract/fres_contract_idl.idl [moved from cm/contract/cm_contract_idl.idl with 64% similarity]
fres/contract/fres_contract_type.h [new file with mode: 0644]
fres/contract/idl_native.h [moved from cm/contract/idl_native.h with 98% similarity]
fres/contract/tests/Makefile [moved from cm/contract/tests/Makefile with 100% similarity]
fres/contract/tests/Makefile.omk [moved from cm/contract/tests/Makefile.omk with 100% similarity]
fres/contract/tests/contract.c [moved from cm/contract/tests/contract.c with 100% similarity]
fres/dtm.idl [moved from cm/dtm.idl with 84% similarity]
fres/rm.idl [new file with mode: 0644]
fres/rs.idl [new file with mode: 0644]
frsh_api/frsh_contract.c
frsh_api/frsh_opaque_types.h

diff --git a/cm/contract/Makefile.omk b/cm/contract/Makefile.omk
deleted file mode 100644 (file)
index bf81975..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-shared_LIBRARIES = contract
-
-contract_SOURCES = cm_contract.c cm_container.c
-contract_CLIENT_IDL = cm_contract_idl.idl cm_blocks.idl
-
-cm_contract_idl_IDLFLAGS = --include=cm_contract_type.h
-cm_blocks_IDLFLAGS = --include=idl_native.h
-
-include_HEADERS = cm_container.h cm_container_type.h           \
-                 cm_contract_type.h cm_container_internal.h    \
-                 idl_native.h cm_contract.h
-
-include_GEN_HEADERS = cm_contract_idl.h cm_blocks.h
-
-SUBDIRS=tests
diff --git a/cm/contract/cm_container.h b/cm/contract/cm_container.h
deleted file mode 100644 (file)
index 28504c6..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * @file   cm_container.h
- * @author Michal Sojka <sojkam1@fel.cvut.cz>
- * 
- * @brief  Container for managing contract blocks.
- * 
- * 
- */
-#ifndef CM_CONTAINER_H
-#define CM_CONTAINER_H
-
-
-#include <cm_container_type.h>
-#include <cm_blocks.h>
-#include <forb/basic_types.h>
-#include <forb/cdr_codec.h>
-#include <fosa_types.h>
-
-/*============================================================================*/
-
-/**
- * Identification of different contract blocks.
- *
- * All contract blocks should define their ID here. This is the
- * only place, where the different parameters (e.g. for different
- * kinds of resources) share a common source file. The declaration of
- * block struture can occur at any place (.h or better .idl).
- * 
- */
-enum cm_block_type {
-       CM_BLOCK_LABEL,
-       CM_BLOCK_RESOURCE,
-       CM_BLOCK_BASIC,
-       CM_BLOCK_TIMING_REQS,
-       CM_BLOCK_SPARE_CAPACITY,
-       CM_NUM_BLOCKS
-};
-
-typedef CORBA_boolean (cm_block_serialize_fnc_t)(CDR_Codec *codec, const void *block_data);
-typedef CORBA_boolean (cm_block_deserialize_fnc_t)(CDR_Codec *codec, void **block_data);
-                                            
-struct cm_block_desc {
-       size_t size;            /**< Size of the block (used by cm_block_duplicate_default() and cm_container_ptr_deserialize()) */
-       cm_block_serialize_fnc_t *serialize;
-       cm_block_deserialize_fnc_t *deserialize;
-       void *(*duplicate)(enum cm_block_type type, const void *block_data);
-};
-
-struct cm_container *
-cm_container_new(void);
-
-void
-cm_container_destroy(struct cm_container *container);
-
-struct cm_container *
-cm_container_duplicate(const struct cm_container *source);
-
-int
-cm_container_add_block(struct cm_container *container,
-                      enum cm_block_type type,
-                      void *block);
-
-void
-cm_container_del_block(struct cm_container *container,
-                      enum cm_block_type type);
-
-void *
-cm_container_get_block(struct cm_container *container,
-                      enum cm_block_type type);
-
-#define CM_CONTAINER_ACCESSOR(TYPE, type)                              \
-       static inline int                                               \
-       cm_container_add_##type(struct cm_container *container,         \
-                               cm_block_##type *block)                 \
-       {                                                               \
-               return cm_container_add_block(                          \
-                       container, CM_BLOCK_##TYPE, block);             \
-       }                                                               \
-       static inline cm_block_##type *                                 \
-       cm_container_get_##type(struct cm_container *container)         \
-       {                                                               \
-               return cm_container_get_block(                          \
-                       container, CM_BLOCK_##TYPE);                    \
-       }                                                               \
-       static inline void                                              \
-       cm_container_del_##type(struct cm_container *container)         \
-       {                                                               \
-               cm_container_del_block(container, CM_BLOCK_##TYPE);     \
-       }
-
-CM_CONTAINER_ACCESSOR(LABEL,          label)
-CM_CONTAINER_ACCESSOR(RESOURCE,       resource)
-CM_CONTAINER_ACCESSOR(BASIC,          basic)
-CM_CONTAINER_ACCESSOR(TIMING_REQS,    timing_reqs)
-CM_CONTAINER_ACCESSOR(SPARE_CAPACITY, spare_capacity)
-
-int
-cm_block_register(enum cm_block_type, const struct cm_block_desc *desc);
-
-#endif
diff --git a/cm/contract/cm_container_internal.h b/cm/contract/cm_container_internal.h
deleted file mode 100644 (file)
index 61be7d7..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * @file   cm_container_internal.h
- * @author Michal Sojka <sojkam1@fel.cvut.cz>
- * 
- * @brief  Internal interface to cm_container.
- *
- * This header should only be included by files in frsh/cm library.
- * 
- */
-#ifndef CM_CONTAINER_INTERNAL_H
-#define CM_CONTAINER_INTERNAL_H
-
-#include <cm_contract_idl.h>
-
-enum cm_block_state {
-       /** There is no such block in the container. */
-       CM_BLOCK_EMPTY,
-       /** The container contains the block in the deserialized
-        * form. */
-       CM_BLOCK_DATA,
-       /** The container contains the block in the serialized form
-        * (sequence of octets).*/
-       CM_BLOCK_STREAM
-};
-
-struct cm_block {
-       enum cm_block_state state;
-       union {
-               void *data; /**< Pointer to data according to param_type */
-               cm_block_stream stream; /**< Unserialized (unknown) data */
-       } u;
-};
-
-struct cm_container {
-       struct cm_block blocks[CM_NUM_BLOCKS];
-};
-
-#define CM_BLOCK_TYPE_VALID(type)      \
-       ((type) < CM_NUM_BLOCKS &&      \
-        (type) >= 0)
-
-
-#endif
diff --git a/cm/contract/cm_container_type.h b/cm/contract/cm_container_type.h
deleted file mode 100644 (file)
index 1ce9c57..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef CM_CONTAINER_TYPE_H
-#define CM_CONTAINER_TYPE_H
-
-#include <forb/basic_types.h>
-#include <forb/cdr_codec.h>
-
-/**
- * Data type for represenataion of contract container (imcomplete declaration).
- */
-typedef struct cm_container *cm_container_ptr;
-
-CORBA_boolean
-cm_container_ptr_serialize(CDR_Codec *codec,
-                          const cm_container_ptr *container);
-
-CORBA_boolean
-cm_container_ptr_deserialize(CDR_Codec *codec,
-                            cm_container_ptr *container);
-
-#endif
diff --git a/cm/contract/cm_contract.c b/cm/contract/cm_contract.c
deleted file mode 100644 (file)
index 62bd577..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-#include <cm_contract.h>
-#include <cm_container_internal.h>
-#include <string.h>
-
-/** 
- * Allocates new cm_contract structure. Use cm_contract_destroy to
- * deallocate the contract.
- * 
- * @param contract 
- * 
- * @return Zero on succes, -1 on error and errno is set appropriately.
- */
-struct cm_contract *
-cm_contract_new()
-{
-       struct cm_contract *c;
-
-       c = malloc(sizeof(*c));
-       if (!c) goto err;
-       memset(c, 0, sizeof(*c));
-       c->container = cm_container_new();
-       if (!c->container) goto free_err;
-       return c;
-free_err:
-       free(c);
-err:
-       return NULL;
-}
-
-void cm_contract_destroy(struct cm_contract *contract)
-{
-       cm_container_destroy(contract->container);
-       free(contract);
-}
-
-struct cm_contract *
-cm_contract_duplicate(struct cm_contract *src)
-{
-       struct cm_contract *dst;
-
-       dst = malloc(sizeof(*dst));
-       if (!dst) goto err;
-       memcpy(dst, src, sizeof(*dst));
-       dst->container = cm_container_duplicate(src->container);
-       if (!dst->container) goto free_err;
-       
-       return dst;
-free_err:
-       free(dst);
-err:
-       return NULL;
-}
-
-CORBA_boolean
-cm_contract_ptr_serialize(CDR_Codec *codec,
-                         const cm_contract_ptr *contract)
-{
-       CORBA_boolean cb;
-       cb = cm_contract_id_t_serialize(codec, &(*contract)->id);
-       if (!cb) goto err;
-       cb = cm_container_ptr_serialize(codec, &(*contract)->container);
-       if (!cb) goto err;
-       return CORBA_TRUE;
-err:
-       return CORBA_FALSE;
-}
-
-CORBA_boolean
-cm_contract_ptr_deserialize(CDR_Codec *codec,
-                           cm_contract_ptr *contract)
-{
-       CORBA_boolean cb;
-       struct cm_contract *c;
-
-       c = malloc(sizeof(*c));
-       if (!c) goto err;
-       
-       cb = cm_contract_id_t_deserialize(codec, &c->id);
-       if (!cb) goto free_err;
-       cb = cm_container_ptr_deserialize(codec, &c->container);
-       if (!cb) goto free_err;
-
-       *contract = c;
-       return CORBA_TRUE;
-free_err:
-       cm_contract_destroy(c);
-err:
-       return CORBA_FALSE;
-}
-
-void cm_contract_ptr_free(cm_contract_ptr contract)
-{
-       cm_contract_destroy(contract);
-}
diff --git a/cm/contract/cm_contract.h b/cm/contract/cm_contract.h
deleted file mode 100644 (file)
index 2a6905e..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef CM_CONTRACT_H
-#define CM_CONTRACT_H
-
-#include <cm_blocks.h>
-#include <cm_container.h>
-#include <ul_gavl.h>
-#include <cm_contract_type.h>
-#include <cm_contract_idl.h>
-
-struct cm_contract {
-       cm_contract_id_t id;
-       struct cm_container *container; /**< Pointer to the container (opaque type). */
-       gavl_node_t node;
-};
-
-struct cm_contract *cm_contract_new(void);
-void cm_contract_destroy(struct cm_contract *contract);
-struct cm_contract *cm_contract_duplicate(struct cm_contract *src);
-
-#define CM_CONTRACT_ACCESSOR(type)                                     \
-       static inline int                                               \
-       cm_contract_add_##type(struct cm_contract *contract,            \
-                              cm_block_##type *block)                  \
-       {                                                               \
-               return cm_container_add_##type(contract->container,     \
-                                              block);                  \
-       }                                                               \
-       static inline cm_block_##type *                                 \
-       cm_contract_get_##type(struct cm_contract *contract)            \
-       {                                                               \
-               return cm_container_get_##type(contract->container);    \
-       }                                                               \
-       static inline void                                              \
-       cm_contract_del_##type(struct cm_contract *contract)            \
-       {                                                               \
-               cm_container_del_##type(contract->container);           \
-       }
-
-CM_CONTRACT_ACCESSOR(label)
-CM_CONTRACT_ACCESSOR(resource)
-CM_CONTRACT_ACCESSOR(basic)
-CM_CONTRACT_ACCESSOR(timing_reqs)
-CM_CONTRACT_ACCESSOR(spare_capacity)
-
-#endif
diff --git a/cm/contract/cm_contract_type.h b/cm/contract/cm_contract_type.h
deleted file mode 100644 (file)
index a2975eb..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef CM_CONTRACT_TYPE_H
-#define CM_CONTRACT_TYPE_H
-
-#include <forb/basic_types.h>
-#include <forb/cdr_codec.h>
-
-/**
- * Data type for represenataion of contract (imcomplete declaration).
- */
-typedef struct cm_contract *cm_contract_ptr;
-
-CORBA_boolean
-cm_contract_ptr_serialize(CDR_Codec *codec,
-                         const cm_contract_ptr *contract);
-
-CORBA_boolean
-cm_contract_ptr_deserialize(CDR_Codec *codec,
-                           cm_contract_ptr *contract);
-
-void cm_contract_ptr_free(cm_contract_ptr contract);
-
-#endif
diff --git a/cm/rm.idl b/cm/rm.idl
deleted file mode 100644 (file)
index aaac0c2..0000000
--- a/cm/rm.idl
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "contract/cm_contract_idl.idl"
-
-module cm {
-       interface resource_manager {
-               long reserve_contract(in contract_t contract);
-               long commit_contract(in contract_handle_t handle, out contract_t contract_with_scheduler_data);
-               long cancel_contract(in contract_handle_t handle);
-       };
-};
diff --git a/cm/rs.idl b/cm/rs.idl
deleted file mode 100644 (file)
index 782042a..0000000
--- a/cm/rs.idl
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "contract/cm_contract_idl.idl"
-
-module cm {
-       interface resource_scheduler {
-               long create_vres(in contract_t contract);
-               long change_vres(in contract_handle_t handle);
-               long cancel_vres(in contract_handle_t handle);
-       };
-};
similarity index 100%
rename from cm/Makefile
rename to fres/Makefile
similarity index 100%
rename from cm/Makefile.omk
rename to fres/Makefile.omk
similarity index 100%
rename from cm/cm.c
rename to fres/cm.c
similarity index 85%
rename from cm/cm.idl
rename to fres/cm.idl
index bc8dd3738531d16fe94b043c84fe14b4047a0998..19a51c0db56a88ce9f301a08538c8463e06c20f4 100644 (file)
--- a/cm/cm.idl
 // covered by the GNU Public License.                                    //
 ////////////////////////////////////////////////////////////////////////////
 
-#include "contract/cm_contract_idl.idl"
+#ifndef _CM_IDL
+#define _CM_IDL
 
-interface contract_manager {
-       long negotiate_contract(in cm::contract_ptr contract, out cm::contract::id_t id);
+#include "contract/fres_contract_idl.idl"
+#include "contract/fres_blocks.idl"
+#include "rm.idl"
+#include "rs.idl"
+
+module fres {
+       interface contract_manager {
+               void register_manager(in frsh_resource_type_t restype,
+                                     in frsh_resource_id_t   resid,
+                                     in resource_manager     rm);
+               void register_scheduler(in frsh_resource_type_t restype,
+                                       in frsh_resource_id_t   resid,
+                                       in resource_scheduler   rs);
+               
+               long negotiate_contract(in contract::ptr contract, out fres::contract::id_t id);
+       };
 };
-                                                               
+
+#endif
similarity index 100%
rename from cm/contract/Makefile
rename to fres/contract/Makefile
diff --git a/fres/contract/Makefile.omk b/fres/contract/Makefile.omk
new file mode 100644 (file)
index 0000000..d86d16d
--- /dev/null
@@ -0,0 +1,15 @@
+shared_LIBRARIES = contract
+
+contract_SOURCES = fres_contract.c fres_container.c
+contract_CLIENT_IDL = fres_contract_idl.idl fres_blocks.idl
+
+fres_contract_idl_IDLFLAGS = --include=fres_contract_type.h
+fres_blocks_IDLFLAGS = --include=idl_native.h
+
+include_HEADERS = fres_container.h fres_container_type.h               \
+                 fres_contract_type.h fres_container_internal.h        \
+                 idl_native.h fres_contract.h
+
+include_GEN_HEADERS = fres_contract_idl.h fres_blocks.h
+
+SUBDIRS=tests
similarity index 89%
rename from cm/contract/cm_blocks.idl
rename to fres/contract/fres_blocks.idl
index 83c6a5dc8bfc111c31cb23cddc81fde1098212af..35037aee6dd8f20331036e95e5a9293386abdfaa 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * @file   cm_contract_idl.idl
+ * @file   fres_contract_idl.idl
  * @author Michal Sojka <sojkam1@fel.cvut.cz>
  * @date   Sun Sep  7 17:24:37 2008
  * 
@@ -7,7 +7,9 @@
  * 
  */
 
-// FRSH mirrored types
+// FRSH mirrored types. For simplicity and compatibility with FRSH, we
+// use the values declared in FRSH headers instead of the values
+// declared here.
 native fosa_rel_time_t;
 native fosa_abs_time_t;
 
@@ -40,7 +42,7 @@ enum frsh_granularity_t {
 typedef long frsh_signal_t;
 typedef long frsh_signal_info_t;
 
-module cm {
+module fres {
        native container_ptr;
 
        /// Blocks from which contracts are composed
similarity index 53%
rename from cm/contract/cm_container.c
rename to fres/contract/fres_container.c
index ff6fdfd89e1f60458fefdf436ce55f19ec79b5bd..66c2c62d98ec68ab4c166c39dea8a08ad89bf5af 100644 (file)
@@ -1,30 +1,30 @@
 /**
- * @file   cm_contract_container.c
+ * @file   fres_contract_container.c
  * @author Michal Sojka <sojkam1@fel.cvut.cz>
  * 
  * @brief  Functions for manipulating with forb-based contracts.
  * 
  * 
  */
-#include <cm_container.h>
-#include "cm_container_internal.h"
+#include <fres_container.h>
+#include "fres_container_internal.h"
 #include <stdbool.h>
 #include <ul_list.h>
 #include <string.h>
 #include <forb/cdr.h>
 
 static void *
-cm_block_duplicate_default(enum cm_block_type type, const void *block_data);
+fres_block_duplicate_default(enum fres_block_type type, const void *block_data);
 
 static void *
-cm_block_duplicate_spare_capacity(enum cm_block_type type, const void *block_data);
+fres_block_duplicate_spare_capacity(enum fres_block_type type, const void *block_data);
 
 #define desc_default(type)                                             \
-       struct cm_block_desc desc_default_##type = {                    \
-               .size        = sizeof(cm_block_##type),                 \
-               .serialize   = (cm_block_serialize_fnc_t*)cm_block_##type##_serialize, \
-               .deserialize = (cm_block_deserialize_fnc_t*)cm_block_##type##_deserialize, \
-               .duplicate   = cm_block_duplicate_default               \
+       struct fres_block_desc desc_default_##type = {                  \
+               .size        = sizeof(fres_block_##type),                       \
+               .serialize   = (fres_block_serialize_fnc_t*)fres_block_##type##_serialize, \
+               .deserialize = (fres_block_deserialize_fnc_t*)fres_block_##type##_deserialize, \
+               .duplicate   = fres_block_duplicate_default             \
        }
 
 static const desc_default(label);
@@ -32,30 +32,30 @@ static const desc_default(resource);
 static const desc_default(basic);
 static const desc_default(timing_reqs);
 
-static const struct cm_block_desc desc_spare_capacity = {
-       .size        = sizeof(cm_block_spare_capacity),
-       .serialize   = (cm_block_serialize_fnc_t*)cm_block_spare_capacity_serialize, \
-       .deserialize = (cm_block_deserialize_fnc_t*)cm_block_spare_capacity_deserialize, \
-       .duplicate   = cm_block_duplicate_spare_capacity
+static const struct fres_block_desc desc_spare_capacity = {
+       .size        = sizeof(fres_block_spare_capacity),
+       .serialize   = (fres_block_serialize_fnc_t*)fres_block_spare_capacity_serialize, \
+       .deserialize = (fres_block_deserialize_fnc_t*)fres_block_spare_capacity_deserialize, \
+       .duplicate   = fres_block_duplicate_spare_capacity
 };
 
 /**
  * Information about various block types
  * 
  */
-static const struct cm_block_desc *block_registry[CM_NUM_BLOCKS] = {
-       [CM_BLOCK_LABEL] = &desc_default_label,
-       [CM_BLOCK_RESOURCE] = &desc_default_resource,
-       [CM_BLOCK_BASIC] = &desc_default_basic,
-       [CM_BLOCK_TIMING_REQS] = &desc_default_timing_reqs,
+static const struct fres_block_desc *block_registry[FRES_NUM_BLOCKS] = {
+       [FRES_BLOCK_LABEL] = &desc_default_label,
+       [FRES_BLOCK_RESOURCE] = &desc_default_resource,
+       [FRES_BLOCK_BASIC] = &desc_default_basic,
+       [FRES_BLOCK_TIMING_REQS] = &desc_default_timing_reqs,
 };
 
 static void *
-cm_block_duplicate_default(enum cm_block_type type, const void *block_data)
+fres_block_duplicate_default(enum fres_block_type type, const void *block_data)
 {
        void *ret = NULL;
        size_t size;
-       if (!CM_BLOCK_TYPE_VALID(type) || !block_registry[type]) {
+       if (!FRES_BLOCK_TYPE_VALID(type) || !block_registry[type]) {
                goto err;
        }
        size = block_registry[type]->size;
@@ -69,21 +69,21 @@ err:
 }
 
 static void *
-cm_block_duplicate_spare_capacity(enum cm_block_type type, const void *block_data)
+fres_block_duplicate_spare_capacity(enum fres_block_type type, const void *block_data)
 {
-       const cm_block_spare_capacity *sc1 = block_data;
-       cm_block_spare_capacity       *sc2;
+       const fres_block_spare_capacity *sc1 = block_data;
+       fres_block_spare_capacity       *sc2;
        
-       sc2 = cm_block_duplicate_default(type, block_data);
+       sc2 = fres_block_duplicate_default(type, block_data);
        if (sc2) {
                unsigned i, len = sc1->variants._length;
                sc2->variants._buffer =
-                       CORBA_sequence_cm_container_ptr_allocbuf(len);
+                       CORBA_sequence_fres_container_ptr_allocbuf(len);
                sc2->variants._maximum = len;
                sc2->variants._length = len;
                for (i=0; i<len; i++) {
                        sc2->variants._buffer[i] =
-                               cm_container_duplicate(sc1->variants._buffer[i]);
+                               fres_container_duplicate(sc1->variants._buffer[i]);
                }
        }
        return sc2;
@@ -92,15 +92,15 @@ cm_block_duplicate_spare_capacity(enum cm_block_type type, const void *block_dat
 /** 
  * Regsiteres a custom block type.
  * 
- * @param cm_block_type Type identifier
+ * @param fres_block_type Type identifier
  * @param desc Description of the type
  * 
  * @return Zero on success, -1 on error.
  */
 int
-cm_block_register(enum cm_block_type type, const struct cm_block_desc *desc)
+fres_block_register(enum fres_block_type type, const struct fres_block_desc *desc)
 {
-       if (CM_BLOCK_TYPE_VALID(type) &&
+       if (FRES_BLOCK_TYPE_VALID(type) &&
            block_registry[type] == NULL) {
                block_registry[type] = desc;
                return 0;
@@ -114,10 +114,10 @@ cm_block_register(enum cm_block_type type, const struct cm_block_desc *desc)
  * @return Pointer to the container of NULL in case of error (errno is
  * set appropriately).
  */
-struct cm_container *
-cm_container_new(void)
+struct fres_container *
+fres_container_new(void)
 {
-       struct cm_container *c;
+       struct fres_container *c;
 
        c = malloc(sizeof(*c));
        if (c) {
@@ -132,11 +132,11 @@ cm_container_new(void)
  * @param container 
  */
 void
-cm_container_destroy(struct cm_container *container)
+fres_container_destroy(struct fres_container *container)
 {
-       enum cm_block_type i;
-       for (i=0; i<CM_NUM_BLOCKS; i++) {
-               cm_container_del_block(container, i);
+       enum fres_block_type i;
+       for (i=0; i<FRES_NUM_BLOCKS; i++) {
+               fres_container_del_block(container, i);
        }
 
        free(container);
@@ -150,30 +150,30 @@ cm_container_destroy(struct cm_container *container)
  * @return Pointer to the duplicated container or NULL in case of
  * error.
  */
-struct cm_container *
-cm_container_duplicate(const struct cm_container *source)
+struct fres_container *
+fres_container_duplicate(const struct fres_container *source)
 {
-       struct cm_container *dest;
-       enum cm_block_type type;
+       struct fres_container *dest;
+       enum fres_block_type type;
 
        if (!source) return NULL;
        
-       dest = cm_container_new();
+       dest = fres_container_new();
        if (!dest) return NULL;
 
-       for (type=0; type<CM_NUM_BLOCKS; type++) {
+       for (type=0; type<FRES_NUM_BLOCKS; type++) {
                switch (source->blocks[type].state) {
-                       case CM_BLOCK_EMPTY:
+                       case FRES_BLOCK_EMPTY:
                                /* nothing to do */
                                break;
-                       case CM_BLOCK_DATA: {
+                       case FRES_BLOCK_DATA: {
                                void *dup;
                                dup = block_registry[type]->duplicate(
                                        type,
                                        source->blocks[type].u.data);
-                               cm_container_add_block(dest, type, dup);
+                               fres_container_add_block(dest, type, dup);
                                break;
-                       case CM_BLOCK_STREAM:
+                       case FRES_BLOCK_STREAM:
                                /* TODO:  */
                                break;
                        }
@@ -195,19 +195,19 @@ cm_container_duplicate(const struct cm_container *source)
  * @return Zero on success, -1 on error and errno is set appropriately.
  */
 int
-cm_container_add_block(struct cm_container *container,
-                        enum cm_block_type type,
+fres_container_add_block(struct fres_container *container,
+                        enum fres_block_type type,
                         void *block)
 {
-       if (!CM_BLOCK_TYPE_VALID(type) ||
-           container->blocks[type].state != CM_BLOCK_EMPTY)
+       if (!FRES_BLOCK_TYPE_VALID(type) ||
+           container->blocks[type].state != FRES_BLOCK_EMPTY)
        {
                errno = EINVAL;
                return -1;
        }
 
        container->blocks[type].u.data = block;
-       container->blocks[type].state = CM_BLOCK_DATA;
+       container->blocks[type].state = FRES_BLOCK_DATA;
        return 0;
 }
 
@@ -218,22 +218,22 @@ cm_container_add_block(struct cm_container *container,
  * @param type 
  */
 void
-cm_container_del_block(struct cm_container *container,
-                        enum cm_block_type type)
+fres_container_del_block(struct fres_container *container,
+                        enum fres_block_type type)
 {
-       if (CM_BLOCK_TYPE_VALID(type)) {
+       if (FRES_BLOCK_TYPE_VALID(type)) {
                switch (container->blocks[type].state) {
-                       case CM_BLOCK_EMPTY:
+                       case FRES_BLOCK_EMPTY:
                                /* nothing to do */
                                break;
-                       case CM_BLOCK_DATA:
+                       case FRES_BLOCK_DATA:
                                free(container->blocks[type].u.data);
-                               container->blocks[type].state = CM_BLOCK_EMPTY;
+                               container->blocks[type].state = FRES_BLOCK_EMPTY;
                                break;
-                       case CM_BLOCK_STREAM:
+                       case FRES_BLOCK_STREAM:
                                /* FIXME: IDL compiler should generate stream_free() */
                                forb_free(container->blocks[type].u.stream._buffer);
-                               container->blocks[type].state = CM_BLOCK_EMPTY;
+                               container->blocks[type].state = FRES_BLOCK_EMPTY;
                                break;
                }
        }
@@ -249,12 +249,12 @@ cm_container_del_block(struct cm_container *container,
  * deserialized.
  */
 void *
-cm_container_get_block(struct cm_container *container,
-                        enum cm_block_type type)
+fres_container_get_block(struct fres_container *container,
+                        enum fres_block_type type)
 {
        if (container &&
-           CM_BLOCK_TYPE_VALID(type) &&
-           container->blocks[type].state == CM_BLOCK_DATA) {
+           FRES_BLOCK_TYPE_VALID(type) &&
+           container->blocks[type].state == FRES_BLOCK_DATA) {
                return container->blocks[type].u.data;
        } else {
                return NULL;
@@ -262,11 +262,11 @@ cm_container_get_block(struct cm_container *container,
 }
 
 static CORBA_boolean
-serialize_block(CDR_Codec *codec, enum cm_block_type type, const struct cm_block *b)
+serialize_block(CDR_Codec *codec, enum fres_block_type type, const struct fres_block *b)
 {
        CORBA_boolean ret;
        switch (b->state) {
-               case CM_BLOCK_DATA:
+               case FRES_BLOCK_DATA:
                        if (block_registry[type] &&
                            block_registry[type]->serialize) {
                                ret = block_registry[type]->serialize(codec, b->u.data);
@@ -274,8 +274,8 @@ serialize_block(CDR_Codec *codec, enum cm_block_type type, const struct cm_block
                                ret = CORBA_FALSE;
                        }
                        break;
-               case CM_BLOCK_STREAM:
-                       ret = cm_block_stream_serialize(codec, &b->u.stream);
+               case FRES_BLOCK_STREAM:
+                       ret = fres_block_stream_serialize(codec, &b->u.stream);
                        break;
                default:
                        ret = CORBA_FALSE;
@@ -286,26 +286,26 @@ serialize_block(CDR_Codec *codec, enum cm_block_type type, const struct cm_block
 
 
 CORBA_boolean
-cm_container_ptr_serialize(CDR_Codec *codec, const cm_container_ptr *container_ptr)
+fres_container_ptr_serialize(CDR_Codec *codec, const fres_container_ptr *container_ptr)
 {
        //CORBA_long l;
        CORBA_long count;
-       struct cm_container *container = *container_ptr;
+       struct fres_container *container = *container_ptr;
        CORBA_boolean ret;
-       enum cm_block_type type;
+       enum fres_block_type type;
        if (!container) goto err;
 
        count=0;
-       for (type=0; type<CM_NUM_BLOCKS; type++) {
-               if (container->blocks[type].state != CM_BLOCK_EMPTY)
+       for (type=0; type<FRES_NUM_BLOCKS; type++) {
+               if (container->blocks[type].state != FRES_BLOCK_EMPTY)
                        count++;
        }
 
        if (!CORBA_long_serialize(codec, &count)) goto err;
        
-       for (type=0; type<CM_NUM_BLOCKS; type++) {
-               struct cm_block *b = &container->blocks[type];
-               if (b->state != CM_BLOCK_EMPTY) {
+       for (type=0; type<FRES_NUM_BLOCKS; type++) {
+               struct fres_block *b = &container->blocks[type];
+               if (b->state != FRES_BLOCK_EMPTY) {
                        CORBA_long_serialize(codec, &type);
                        CDR_put_align(codec, 8); /* All blocks are 8 byte aligned */
 
@@ -319,23 +319,23 @@ err:
 }
 
 CORBA_boolean
-cm_container_ptr_deserialize(CDR_Codec *codec,
-                            cm_container_ptr *container)
+fres_container_ptr_deserialize(CDR_Codec *codec,
+                            fres_container_ptr *container)
 {
        CORBA_boolean ret;
-       struct cm_container *c;
+       struct fres_container *c;
        CORBA_long count;
-       enum cm_block_type type;
+       enum fres_block_type type;
        int i;
 
-       c = cm_container_new();
+       c = fres_container_new();
        if (!c) goto err;
 
        if (!CORBA_long_deserialize(codec, &count)) goto err;
 
        for (i=0; i<count; i++) {
                CORBA_long_deserialize(codec, (CORBA_long*)&type);
-               if (!CM_BLOCK_TYPE_VALID(type)) goto free_err;
+               if (!FRES_BLOCK_TYPE_VALID(type)) goto free_err;
                CDR_get_align(codec, 8); /* All blocks are 8 byte aligned */
                if (block_registry[type] &&
                    block_registry[type]->deserialize) {
@@ -344,7 +344,7 @@ cm_container_ptr_deserialize(CDR_Codec *codec,
                        if (!block) goto free_err;
                        ret = block_registry[type]->deserialize(codec, block);
                        if (!ret) goto free_err;
-                       cm_container_add_block(c, type, block);
+                       fres_container_add_block(c, type, block);
                } else {
                        /* TODO: store it as stream */
                }
@@ -354,7 +354,7 @@ cm_container_ptr_deserialize(CDR_Codec *codec,
        *container = c;
        return CORBA_TRUE;
 free_err:
-       cm_container_destroy(c);
+       fres_container_destroy(c);
 err:
        return CORBA_FALSE;
 }
diff --git a/fres/contract/fres_container.h b/fres/contract/fres_container.h
new file mode 100644 (file)
index 0000000..22d71fc
--- /dev/null
@@ -0,0 +1,100 @@
+/**
+ * @file   fres_container.h
+ * @author Michal Sojka <sojkam1@fel.cvut.cz>
+ * 
+ * @brief  Container for managing contract blocks.
+ * 
+ * 
+ */
+#ifndef FRES_CONTAINER_H
+#define FRES_CONTAINER_H
+
+
+#include <fres_container_type.h>
+#include <fres_blocks.h>
+#include <forb/basic_types.h>
+#include <forb/cdr_codec.h>
+#include <fosa_types.h>
+
+/*============================================================================*/
+
+/**
+ * Identification of different contract blocks.
+ *
+ * All contract blocks should define their ID here. This is the
+ * only place, where the different parameters (e.g. for different
+ * kinds of resources) share a common source file. The declaration of
+ * block struture can occur at any place (.h or better .idl).
+ * 
+ */
+enum fres_block_type {
+       FRES_BLOCK_LABEL,
+       FRES_BLOCK_RESOURCE,
+       FRES_BLOCK_BASIC,
+       FRES_BLOCK_TIMING_REQS,
+       FRES_BLOCK_SPARE_CAPACITY,
+       FRES_NUM_BLOCKS
+};
+
+typedef CORBA_boolean (fres_block_serialize_fnc_t)(CDR_Codec *codec, const void *block_data);
+typedef CORBA_boolean (fres_block_deserialize_fnc_t)(CDR_Codec *codec, void **block_data);
+                                            
+struct fres_block_desc {
+       size_t size;            /**< Size of the block (used by fres_block_duplicate_default() and fres_container_ptr_deserialize()) */
+       fres_block_serialize_fnc_t *serialize;
+       fres_block_deserialize_fnc_t *deserialize;
+       void *(*duplicate)(enum fres_block_type type, const void *block_data);
+};
+
+struct fres_container *
+fres_container_new(void);
+
+void
+fres_container_destroy(struct fres_container *container);
+
+struct fres_container *
+fres_container_duplicate(const struct fres_container *source);
+
+int
+fres_container_add_block(struct fres_container *container,
+                      enum fres_block_type type,
+                      void *block);
+
+void
+fres_container_del_block(struct fres_container *container,
+                      enum fres_block_type type);
+
+void *
+fres_container_get_block(struct fres_container *container,
+                      enum fres_block_type type);
+
+#define FRES_CONTAINER_ACCESSOR(TYPE, type)                            \
+       static inline int                                               \
+       fres_container_add_##type(struct fres_container *container,             \
+                               fres_block_##type *block)                       \
+       {                                                               \
+               return fres_container_add_block(                                \
+                       container, FRES_BLOCK_##TYPE, block);           \
+       }                                                               \
+       static inline fres_block_##type *                                       \
+       fres_container_get_##type(struct fres_container *container)             \
+       {                                                               \
+               return fres_container_get_block(                                \
+                       container, FRES_BLOCK_##TYPE);                  \
+       }                                                               \
+       static inline void                                              \
+       fres_container_del_##type(struct fres_container *container)             \
+       {                                                               \
+               fres_container_del_block(container, FRES_BLOCK_##TYPE); \
+       }
+
+FRES_CONTAINER_ACCESSOR(LABEL,          label)
+FRES_CONTAINER_ACCESSOR(RESOURCE,       resource)
+FRES_CONTAINER_ACCESSOR(BASIC,          basic)
+FRES_CONTAINER_ACCESSOR(TIMING_REQS,    timing_reqs)
+FRES_CONTAINER_ACCESSOR(SPARE_CAPACITY, spare_capacity)
+
+int
+fres_block_register(enum fres_block_type, const struct fres_block_desc *desc);
+
+#endif
diff --git a/fres/contract/fres_container_internal.h b/fres/contract/fres_container_internal.h
new file mode 100644 (file)
index 0000000..20feb8f
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * @file   fres_container_internal.h
+ * @author Michal Sojka <sojkam1@fel.cvut.cz>
+ * 
+ * @brief  Internal interface to fres_container.
+ *
+ * This header should only be included by files in frsh/cm library.
+ * 
+ */
+#ifndef FRES_CONTAINER_INTERNAL_H
+#define FRES_CONTAINER_INTERNAL_H
+
+#include <fres_contract_idl.h>
+
+enum fres_block_state {
+       /** There is no such block in the container. */
+       FRES_BLOCK_EMPTY,
+       /** The container contains the block in the deserialized
+        * form. */
+       FRES_BLOCK_DATA,
+       /** The container contains the block in the serialized form
+        * (sequence of octets).*/
+       FRES_BLOCK_STREAM
+};
+
+struct fres_block {
+       enum fres_block_state state;
+       union {
+               void *data; /**< Pointer to data according to param_type */
+               fres_block_stream stream; /**< Unserialized (unknown) data */
+       } u;
+};
+
+struct fres_container {
+       struct fres_block blocks[FRES_NUM_BLOCKS];
+};
+
+#define FRES_BLOCK_TYPE_VALID(type)    \
+       ((type) < FRES_NUM_BLOCKS &&    \
+        (type) >= 0)
+
+
+#endif
diff --git a/fres/contract/fres_container_type.h b/fres/contract/fres_container_type.h
new file mode 100644 (file)
index 0000000..de914b2
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef FRES_CONTAINER_TYPE_H
+#define FRES_CONTAINER_TYPE_H
+
+#include <forb/basic_types.h>
+#include <forb/cdr_codec.h>
+
+/**
+ * Data type for represenataion of contract container (imcomplete declaration).
+ */
+typedef struct fres_container *fres_container_ptr;
+
+CORBA_boolean
+fres_container_ptr_serialize(CDR_Codec *codec,
+                          const fres_container_ptr *container);
+
+CORBA_boolean
+fres_container_ptr_deserialize(CDR_Codec *codec,
+                            fres_container_ptr *container);
+
+#endif
diff --git a/fres/contract/fres_contract.c b/fres/contract/fres_contract.c
new file mode 100644 (file)
index 0000000..83acfa0
--- /dev/null
@@ -0,0 +1,94 @@
+#include <fres_contract.h>
+#include <fres_container_internal.h>
+#include <string.h>
+
+/** 
+ * Allocates new fres_contract structure. Use fres_contract_destroy to
+ * deallocate the contract.
+ * 
+ * @param contract 
+ * 
+ * @return Zero on succes, -1 on error and errno is set appropriately.
+ */
+struct fres_contract *
+fres_contract_new()
+{
+       struct fres_contract *c;
+
+       c = malloc(sizeof(*c));
+       if (!c) goto err;
+       memset(c, 0, sizeof(*c));
+       c->container = fres_container_new();
+       if (!c->container) goto free_err;
+       return c;
+free_err:
+       free(c);
+err:
+       return NULL;
+}
+
+void fres_contract_destroy(struct fres_contract *contract)
+{
+       fres_container_destroy(contract->container);
+       free(contract);
+}
+
+struct fres_contract *
+fres_contract_duplicate(struct fres_contract *src)
+{
+       struct fres_contract *dst;
+
+       dst = malloc(sizeof(*dst));
+       if (!dst) goto err;
+       memcpy(dst, src, sizeof(*dst));
+       dst->container = fres_container_duplicate(src->container);
+       if (!dst->container) goto free_err;
+       
+       return dst;
+free_err:
+       free(dst);
+err:
+       return NULL;
+}
+
+CORBA_boolean
+fres_contract_ptr_serialize(CDR_Codec *codec,
+                         const fres_contract_ptr *contract)
+{
+       CORBA_boolean cb;
+       cb = fres_contract_id_t_serialize(codec, &(*contract)->id);
+       if (!cb) goto err;
+       cb = fres_container_ptr_serialize(codec, &(*contract)->container);
+       if (!cb) goto err;
+       return CORBA_TRUE;
+err:
+       return CORBA_FALSE;
+}
+
+CORBA_boolean
+fres_contract_ptr_deserialize(CDR_Codec *codec,
+                           fres_contract_ptr *contract)
+{
+       CORBA_boolean cb;
+       struct fres_contract *c;
+
+       c = malloc(sizeof(*c));
+       if (!c) goto err;
+       
+       cb = fres_contract_id_t_deserialize(codec, &c->id);
+       if (!cb) goto free_err;
+       cb = fres_container_ptr_deserialize(codec, &c->container);
+       if (!cb) goto free_err;
+
+       *contract = c;
+       return CORBA_TRUE;
+free_err:
+       fres_contract_destroy(c);
+err:
+       return CORBA_FALSE;
+}
+
+void fres_contract_ptr_free(fres_contract_ptr contract)
+{
+       fres_contract_destroy(contract);
+}
diff --git a/fres/contract/fres_contract.h b/fres/contract/fres_contract.h
new file mode 100644 (file)
index 0000000..72a47e9
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef FRES_CONTRACT_H
+#define FRES_CONTRACT_H
+
+#include <fres_blocks.h>
+#include <fres_container.h>
+#include <ul_gavl.h>
+#include <fres_contract_type.h>
+#include <fres_contract_idl.h>
+
+struct fres_contract {
+       fres_contract_id_t id;
+       struct fres_container *container;       /**< Pointer to the container (opaque type). */
+       gavl_node_t node;
+};
+
+struct fres_contract *fres_contract_new(void);
+void fres_contract_destroy(struct fres_contract *contract);
+struct fres_contract *fres_contract_duplicate(struct fres_contract *src);
+
+#define FRES_CONTRACT_ACCESSOR(type)                                   \
+       static inline int                                               \
+       fres_contract_add_##type(struct fres_contract *contract,                \
+                              fres_block_##type *block)                        \
+       {                                                               \
+               return fres_container_add_##type(contract->container,   \
+                                              block);                  \
+       }                                                               \
+       static inline fres_block_##type *                                       \
+       fres_contract_get_##type(struct fres_contract *contract)                \
+       {                                                               \
+               return fres_container_get_##type(contract->container);  \
+       }                                                               \
+       static inline void                                              \
+       fres_contract_del_##type(struct fres_contract *contract)                \
+       {                                                               \
+               fres_container_del_##type(contract->container);         \
+       }
+
+FRES_CONTRACT_ACCESSOR(label)
+FRES_CONTRACT_ACCESSOR(resource)
+FRES_CONTRACT_ACCESSOR(basic)
+FRES_CONTRACT_ACCESSOR(timing_reqs)
+FRES_CONTRACT_ACCESSOR(spare_capacity)
+
+#endif
similarity index 64%
rename from cm/contract/cm_contract_idl.idl
rename to fres/contract/fres_contract_idl.idl
index e211edb2df7d89a67247b6a83c6f9e1584cc08e5..782f216b98842c0a97deef22af4dd588969bdb10 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * @file   cm_contract_idl.idl
+ * @file   fres_contract_idl.idl
  * @author Michal Sojka <sojkam1@fel.cvut.cz>
  * @date   Sun Sep  7 17:24:37 2008
  * 
@@ -7,15 +7,18 @@
  * 
  */
 
-// FRSH mirrored types
-
-module cm {
-       native contract_ptr;
-
+#ifndef _CONTRACT_IDL
+#define _CONTRACT_IDL
+module fres {
        module contract {
+               /// Pointer to the contract type
+               native ptr;
+               
                /// Globaly unique contract ID
                struct id_t {
                        char byte[8];
                };
        };
 };
+
+#endif
diff --git a/fres/contract/fres_contract_type.h b/fres/contract/fres_contract_type.h
new file mode 100644 (file)
index 0000000..aebf69d
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef FRES_CONTRACT_TYPE_H
+#define FRES_CONTRACT_TYPE_H
+
+#include <forb/basic_types.h>
+#include <forb/cdr_codec.h>
+
+/**
+ * Data type for represenataion of contract (imcomplete declaration).
+ */
+typedef struct fres_contract *fres_contract_ptr;
+
+CORBA_boolean
+fres_contract_ptr_serialize(CDR_Codec *codec,
+                         const fres_contract_ptr *contract);
+
+CORBA_boolean
+fres_contract_ptr_deserialize(CDR_Codec *codec,
+                           fres_contract_ptr *contract);
+
+void fres_contract_ptr_free(fres_contract_ptr contract);
+
+#endif
similarity index 98%
rename from cm/contract/idl_native.h
rename to fres/contract/idl_native.h
index cc2293b37c09e16f942a202d72236e4e21bf16f3..8cf16b40a1602c9a7f47b796a09efc1b48d94237 100644 (file)
@@ -2,7 +2,7 @@
 #define IDL_NATIVE_H
 
 #include <fosa.h>
-#include <cm_container_type.h>
+#include <fres_container_type.h>
 #include <frsh_core_types.h>
 #include <forb/cdr.h>
 
similarity index 84%
rename from cm/dtm.idl
rename to fres/dtm.idl
index 15be2e3295c6b1344e5d3dde884498f321736210..2f5aa2c06787d7a25c268fb24d12276c275b8c4f 100644 (file)
@@ -1,4 +1,7 @@
-#include "contract/cm_contract_idl.idl"
+#ifndef _DTM_IDL
+#define _DTM_IDL
+
+#include "contract/fres_contract_idl.idl"
 
 module cm {
        interface transaction {
@@ -14,3 +17,5 @@ module cm {
                void register_scheduler(in resource_type restype, in resource_scheduler r);
        };
 };
+
+#endif
diff --git a/fres/rm.idl b/fres/rm.idl
new file mode 100644 (file)
index 0000000..13f431c
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef _RM_IDL
+#define _RM_IDL
+
+#include "contract/fres_contract_idl.idl"
+
+module fres {
+       interface resource_manager {
+               long reserve_contract(in fres::contract::ptr contract);
+               long commit_contract(in fres::contract::id_t id, out fres::contract::ptr contract_with_scheduler_data);
+               long cancel_contract(in fres::contract::id_t id);
+       };
+};
+
+#endif
diff --git a/fres/rs.idl b/fres/rs.idl
new file mode 100644 (file)
index 0000000..df7bf4a
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef _RS_IDL
+#define _RS_IDL
+
+#include "contract/fres_contract_idl.idl"
+
+module fres {
+       interface resource_scheduler {
+               long create_vres(in fres::contract::ptr contract);
+               long change_vres(in fres::contract::id_t id, in fres::contract::ptr contract);
+               long cancel_vres(in fres::contract::id_t id);
+       };
+};
+
+#endif
index adc3c7b9ed5e9c9ae7e9877e710e4f36acad522b..45dfb5a600f240f1b3c8c1da6bde7067e801db04 100644 (file)
@@ -2,15 +2,15 @@
  * @file   frsh_contract.c
  * @author Michal Sojka <sojkam1@fel.cvut.cz>
  * 
- * @brief  Implementation of FRSH contract API on top of CM contracts.
+ * @brief  Implementation of FRSH contract API on top of FRES contracts.
  * 
  * 
  */
-#include <cm_contract.h>
-#include <cm_contract_idl.h>
+#include <fres_contract.h>
+#include <fres_contract_idl.h>
 #include <frsh_core.h>
 #include <frsh_error.h>
-#include <cm_blocks.h>
+#include <fres_blocks.h>
 #include <string.h>
 
 /**********************************/
@@ -22,7 +22,7 @@ frsh_contract_init(frsh_contract_t *contract)
 {
        if (!contract) return FRSH_ERR_BAD_ARGUMENT;
        
-       *contract = cm_contract_new();
+       *contract = fres_contract_new();
        
        return (*contract) ? 0 : errno;
 }
@@ -34,7 +34,7 @@ int frsh_contract_set_basic_params
    const frsh_workload_t      workload,
    const frsh_contract_type_t contract_type)
 {
-       cm_block_basic *b;
+       fres_block_basic *b;
        int ret;
        if (!contract ||
            !*contract ||
@@ -51,7 +51,7 @@ int frsh_contract_set_basic_params
        b->workload = workload;
        b->contract_type = contract_type;
 
-       ret = cm_contract_add_basic(*contract, b);
+       ret = fres_contract_add_basic(*contract, b);
 
        if (ret) {
                free(b);
@@ -67,8 +67,8 @@ int frsh_contract_set_resource_and_label
    const frsh_resource_id_t resource_id,
    const char *contract_label)
 {
-       cm_block_label *label;
-       cm_block_resource *r;
+       fres_block_label *label;
+       fres_block_resource *r;
        int ret;
        
        if (!contract || !*contract) return FRSH_ERR_BAD_ARGUMENT;
@@ -78,7 +78,7 @@ int frsh_contract_set_resource_and_label
        
        r->resource_type = resource_type;
        r->resource_id = resource_id;
-       ret = cm_contract_add_resource(*contract, r);
+       ret = fres_contract_add_resource(*contract, r);
 
        if (ret != 0) {
                free(r);
@@ -91,7 +91,7 @@ int frsh_contract_set_resource_and_label
                if (!label) return ENOMEM;
                strncpy(label->label, contract_label, sizeof(label->label));
                label->label[sizeof(label->label)-1] = '\0';
-               ret = cm_contract_add_label(*contract, label);
+               ret = fres_contract_add_label(*contract, label);
                if (ret) {
                        free(label);
                        return errno;
@@ -110,7 +110,7 @@ int frsh_contract_set_timing_reqs
    const frsh_signal_info_t     deadline_miss_siginfo)
 {
        int ret;
-       cm_block_timing_reqs *t;
+       fres_block_timing_reqs *t;
 
        if (!contract  || !*contract)
                return FRSH_ERR_BAD_ARGUMENT;
@@ -127,7 +127,7 @@ int frsh_contract_set_timing_reqs
                        return FRSH_ERR_BAD_ARGUMENT;
                }
        }
-       ret = cm_contract_add_timing_reqs(*contract, t);
+       ret = fres_contract_add_timing_reqs(*contract, t);
        if (ret) {
                free(t);
                return errno;
index 0314796710bc9901fcb4372422e3b4c38ac59e5e..53e7ce5a4f9048eebf7ca32c7517827d5ebeeafd 100644 (file)
@@ -74,7 +74,7 @@
 #ifndef _FRSH_OPAQUE_TYPES_H_
 #define _FRSH_OPAQUE_TYPES_H_
 
-#include <cm_contract_type.h>
+#include <fres_contract_type.h>
 #include <frsh_cpp_macros.h>
 
 FRSH_CPP_BEGIN_DECLS
@@ -99,7 +99,7 @@ FRSH_CPP_BEGIN_DECLS
  **/
 
 /** frsh_contract_parameters_t **/
-#define FRSH_CONTRACT_T_OPAQUE cm_contract_ptr
+#define FRSH_CONTRACT_T_OPAQUE fres_contract_ptr
 
 
 typedef int FRSH_SYNCHOBJ_HANDLE_T_OPAQUE;