diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-10-21 20:13:41 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-10-22 13:27:02 +0200 |
commit | 3cafbf3cfe5c58a6988dbfc4c29148ebb804f5c2 (patch) | |
tree | 881da180b8d801c38ba0fbad2fc9f387a70ec016 /src/ipcpd/normal | |
parent | d5a52f3951fff7ee272bd0d4cd95cd122d07fa64 (diff) | |
download | ouroboros-3cafbf3cfe5c58a6988dbfc4c29148ebb804f5c2.tar.gz ouroboros-3cafbf3cfe5c58a6988dbfc4c29148ebb804f5c2.zip |
build: Compile with strict conversion
This has the code checked with -Wcast-qual and -Wconversion flags.
These flags were removed because SWIG generated code fails.
Diffstat (limited to 'src/ipcpd/normal')
-rw-r--r-- | src/ipcpd/normal/cdap_request.c | 3 | ||||
-rw-r--r-- | src/ipcpd/normal/fmgr.h | 10 | ||||
-rw-r--r-- | src/ipcpd/normal/frct.c | 19 | ||||
-rw-r--r-- | src/ipcpd/normal/frct.h | 7 | ||||
-rw-r--r-- | src/ipcpd/normal/ribmgr.h | 11 | ||||
-rw-r--r-- | src/ipcpd/normal/shm_pci.c | 16 |
6 files changed, 41 insertions, 25 deletions
diff --git a/src/ipcpd/normal/cdap_request.c b/src/ipcpd/normal/cdap_request.c index 5839360b..8409b508 100644 --- a/src/ipcpd/normal/cdap_request.c +++ b/src/ipcpd/normal/cdap_request.c @@ -134,8 +134,7 @@ int cdap_request_wait(struct cdap_request * creq) return ret; } -void cdap_request_respond(struct cdap_request * creq, - int response) +void cdap_request_respond(struct cdap_request * creq, int response) { if (creq == NULL) return; diff --git a/src/ipcpd/normal/fmgr.h b/src/ipcpd/normal/fmgr.h index f97cf858..faa8a0e4 100644 --- a/src/ipcpd/normal/fmgr.h +++ b/src/ipcpd/normal/fmgr.h @@ -34,28 +34,34 @@ #define MGMT_AE "Management" #define DT_AE "Data transfer" -int fmgr_init(); -int fmgr_fini(); +int fmgr_init(void); + +int fmgr_fini(void); int fmgr_np1_alloc(int fd, char * dst_ap_name, char * src_ae_name, enum qos_cube qos); + int fmgr_np1_alloc_resp(int fd, int response); + int fmgr_np1_dealloc(int fd); int fmgr_np1_post_buf(cep_id_t id, buffer_t * buf); + int fmgr_np1_post_sdu(cep_id_t id, struct shm_du_buff * sdb); int fmgr_nm1_mgmt_flow(char * dst_name); + int fmgr_nm1_dt_flow(char * dst_name, enum qos_cube qos); int fmgr_nm1_write_sdu(struct pci * pci, struct shm_du_buff * sdb); + int fmgr_nm1_write_buf(struct pci * pci, buffer_t * buf); diff --git a/src/ipcpd/normal/frct.c b/src/ipcpd/normal/frct.c index 9daf8755..3f80f91e 100644 --- a/src/ipcpd/normal/frct.c +++ b/src/ipcpd/normal/frct.c @@ -42,7 +42,7 @@ enum conn_state { struct frct_i { uint32_t cep_id; - uint32_t r_address; + uint64_t r_address; uint32_t r_cep_id; enum qos_cube cube; uint64_t seqno; @@ -58,18 +58,20 @@ struct { pthread_mutex_t cep_ids_lock; } frct; -static int next_cep_id() +static cep_id_t next_cep_id(void) { - int ret; + cep_id_t ret; pthread_mutex_lock(&frct.cep_ids_lock); ret = bmp_allocate(frct.cep_ids); + if (!bmp_is_id_valid(frct.cep_ids, ret)) + ret = INVALID_CEP_ID; pthread_mutex_unlock(&frct.cep_ids_lock); return ret; } -static int release_cep_id(int id) +static int release_cep_id(cep_id_t id) { int ret; @@ -117,7 +119,7 @@ int frct_fini() return 0; } -static struct frct_i * create_frct_i(uint32_t address, +static struct frct_i * create_frct_i(uint64_t address, cep_id_t r_cep_id) { struct frct_i * instance; @@ -128,6 +130,11 @@ static struct frct_i * create_frct_i(uint32_t address, return NULL; id = next_cep_id(); + if (id == INVALID_CEP_ID) { + free(instance); + return NULL; + } + instance->r_address = address; instance->cep_id = id; instance->r_cep_id = r_cep_id; @@ -191,7 +198,7 @@ static void destroy_frct_i(struct frct_i * instance) free(instance); } -cep_id_t frct_i_create(uint32_t address, +cep_id_t frct_i_create(uint64_t address, buffer_t * buf, enum qos_cube cube) { diff --git a/src/ipcpd/normal/frct.h b/src/ipcpd/normal/frct.h index b9e70d0f..572c1f61 100644 --- a/src/ipcpd/normal/frct.h +++ b/src/ipcpd/normal/frct.h @@ -30,10 +30,11 @@ struct frct_i; -int frct_init(); -int frct_fini(); +int frct_init(void); -cep_id_t frct_i_create(uint32_t address, +int frct_fini(void); + +cep_id_t frct_i_create(uint64_t address, buffer_t * buf, enum qos_cube cube); diff --git a/src/ipcpd/normal/ribmgr.h b/src/ipcpd/normal/ribmgr.h index ed8bae03..01bfcb40 100644 --- a/src/ipcpd/normal/ribmgr.h +++ b/src/ipcpd/normal/ribmgr.h @@ -27,10 +27,12 @@ #include "dt_const.h" -int ribmgr_init(); -int ribmgr_fini(); +int ribmgr_init(void); + +int ribmgr_fini(void); int ribmgr_add_flow(int fd); + int ribmgr_remove_flow(int fd); int ribmgr_bootstrap(struct dif_config * conf); @@ -39,7 +41,8 @@ int ribmgr_bootstrap(struct dif_config * conf); * FIXME: Should we expose the RIB? * Else we may end up with a lot of getters and setters */ -struct dt_const * ribmgr_dt_const(); -uint32_t ribmgr_address(); +struct dt_const * ribmgr_dt_const(void); + +uint32_t ribmgr_address(void); #endif diff --git a/src/ipcpd/normal/shm_pci.c b/src/ipcpd/normal/shm_pci.c index 3a16a2da..aa18fa38 100644 --- a/src/ipcpd/normal/shm_pci.c +++ b/src/ipcpd/normal/shm_pci.c @@ -39,13 +39,12 @@ #define TTL_SIZE 1 #define CHK_SIZE 4 -static int shm_pci_head_size(struct dt_const * dtc) +static size_t shm_pci_head_size(struct dt_const * dtc) { - int len = 0; + size_t len = 0; len = dtc->addr_size * 2 + dtc->cep_id_size * 2 - + dtc->pdu_length_size + dtc->seqno_size - + QOS_ID_SIZE; + + dtc->pdu_length_size + dtc->seqno_size + QOS_ID_SIZE; if (dtc->has_ttl) len += TTL_SIZE; @@ -53,7 +52,7 @@ static int shm_pci_head_size(struct dt_const * dtc) return len; } -static int shm_pci_tail_size(struct dt_const * dtc) +static size_t shm_pci_tail_size(struct dt_const * dtc) { return dtc->has_chk ? CHK_SIZE : 0; } @@ -162,10 +161,11 @@ struct pci * shm_pci_des(struct shm_du_buff * sdb) int offset = 0; struct dt_const * dtc; - head = shm_du_buff_head(sdb); - if (head == NULL) + if (sdb == NULL) return NULL; + head = shm_du_buff_head(sdb); + dtc = ribmgr_dt_const(); if (dtc == NULL) return NULL; @@ -221,7 +221,7 @@ int shm_pci_shrink(struct shm_du_buff * sdb) int shm_pci_dec_ttl(struct shm_du_buff * sdb) { struct dt_const * dtc; - int offset = 0; + size_t offset = 0; uint8_t * head; uint8_t * tail; |