]> rtime.felk.cvut.cz Git - frescor/frsh.git/commitdiff
Fixed the number of available container blocks
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 27 Oct 2009 15:08:25 +0000 (16:08 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 27 Oct 2009 15:08:25 +0000 (16:08 +0100)
FRES_NUM_BLOCKS was also prefixed with __ to make the name distinguishable
from regular block identifiers.

fres/contract/fres_container.c
fres/contract/fres_container.h
fres/contract/fres_container_internal.h

index cd77459a9a925e31fd3d9b815bd9bce56ff3175c..f040f43d16c3dd385e0a8b6568b9b5ca6ef8db3f 100644 (file)
@@ -184,7 +184,7 @@ static const struct fres_block_desc desc_spare_capacity = {
  * Information about various block types
  * 
  */
-static const struct fres_block_desc *block_registry[FRES_NUM_BLOCKS] = {
+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,
@@ -291,7 +291,7 @@ fres_container_destroy(struct fres_container *container)
 {
        enum fres_block_type i;
        if (!container) return;
-       for (i=0; i<FRES_NUM_BLOCKS; i++) {
+       for (i=0; i<__FRES_NUM_BLOCKS; i++) {
                fres_container_del_block(container, i);
        }
 
@@ -363,7 +363,7 @@ fres_container_duplicate(const struct fres_container *source)
        dest = fres_container_new();
        if (!dest) return NULL;
 
-       for (type=0; type<FRES_NUM_BLOCKS; type++) {
+       for (type=0; type<__FRES_NUM_BLOCKS; type++) {
                ret = fres_block_duplicate(&dest->blocks[type], &source->blocks[type], type);
                if (ret) goto free_dest_err;
        }
@@ -531,14 +531,14 @@ fres_container_ptr_serialize(FORB_CDR_Codec *codec, const fres_container_ptr *co
        if (!container) goto err;
 
        count=0;
-       for (type=0; type<FRES_NUM_BLOCKS; type++) {
+       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<FRES_NUM_BLOCKS; type++) {
+       for (type=0; type<__FRES_NUM_BLOCKS; type++) {
                struct fres_block *b = &container->blocks[type];
                if (b->state != FRES_BLOCK_EMPTY) {
                        ret = serialize_block(codec, type, b);
@@ -617,7 +617,7 @@ fres_container_to_string(char *dest, size_t size, const struct fres_container *c
        int ret, written = 0;
        enum fres_block_type type;
        
-       for (type=0; type<FRES_NUM_BLOCKS; type++) {
+       for (type=0; type<__FRES_NUM_BLOCKS; type++) {
                const struct fres_block *b = &c->blocks[type];
                switch (b->state) {
                        case FRES_BLOCK_EMPTY:
@@ -673,7 +673,7 @@ fres_container_get_num_blocks(const struct fres_container *c)
        int num = 0;
        enum fres_block_type type;
        
-       for (type=0; type<FRES_NUM_BLOCKS; type++) {
+       for (type=0; type<__FRES_NUM_BLOCKS; type++) {
                if (c->blocks[type].state != FRES_BLOCK_EMPTY) {
                        num++;
                }
@@ -696,7 +696,7 @@ int fres_container_merge(struct fres_container *dest,
        enum fres_block_type type;
        int ret;
        
-       for (type=0; type<FRES_NUM_BLOCKS; type++) {
+       for (type=0; type<__FRES_NUM_BLOCKS; type++) {
                const struct fres_block *sb = &src->blocks[type];
                struct fres_block *db = &dest->blocks[type];
                
@@ -726,7 +726,7 @@ int fres_container_copy(struct fres_container *dest,
        enum fres_block_type type;
        int ret;
        
-       for (type=0; type<FRES_NUM_BLOCKS; type++) {
+       for (type=0; type<__FRES_NUM_BLOCKS; type++) {
                const struct fres_block *sb = &src->blocks[type];
                struct fres_block *db = &dest->blocks[type];
                
index ac99cda22bbef8940b9f13f6df8905164ceb46fb..212d5c6cf76ef04f95898b747f6f7657c15f9ce8 100644 (file)
@@ -91,8 +91,8 @@ enum fres_block_type {
        FRES_BLOCK_FWP_SCHED,
        FRES_BLOCK_ITEM_NODES, /**< resources/item/item_idl.idl */
        FRES_BLOCK_FPGA,       /**< resources/fpga/res_fpga_idl.idl */
-       FRES_NUM_BLOCKS,
        FRES_BLOCK_FWP,
+       __FRES_NUM_BLOCKS,
 };
 
 typedef CORBA_boolean (fres_block_serialize_fnc_t)(FORB_CDR_Codec *codec, const void *block_data);
index 8612541756115ec351359df63682f7145a82ca94..19ac8a8ad05f55ff1ec5bac4626d36deb329759c 100644 (file)
@@ -105,12 +105,12 @@ struct fres_block {
  * blocks of the same type.
  */
 struct fres_container {
-       struct fres_block blocks[FRES_NUM_BLOCKS];
+       struct fres_block blocks[__FRES_NUM_BLOCKS];
 };
 
 /** Checks wheder the @a type is valid number of the block */
 #define FRES_BLOCK_TYPE_VALID(type)    \
-       ((type) < FRES_NUM_BLOCKS &&    \
+       ((type) < __FRES_NUM_BLOCKS &&  \
         (type) >= 0)
 
 int