summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2016-10-22 11:33:20 +0000
committerSander Vrijders <[email protected]>2016-10-22 11:33:20 +0000
commit727efbe0c5e61862a870c71a2857b28eece3d369 (patch)
tree881da180b8d801c38ba0fbad2fc9f387a70ec016 /src/ipcpd/normal
parent482c44232d4deda3f89a7d85fbad99c1c64e80ec (diff)
parent3cafbf3cfe5c58a6988dbfc4c29148ebb804f5c2 (diff)
downloadouroboros-727efbe0c5e61862a870c71a2857b28eece3d369.tar.gz
ouroboros-727efbe0c5e61862a870c71a2857b28eece3d369.zip
Merged in dstaesse/ouroboros/be-extra (pull request #268)
build: Comply with -Wextra compiler flag
Diffstat (limited to 'src/ipcpd/normal')
-rw-r--r--src/ipcpd/normal/cdap_request.c3
-rw-r--r--src/ipcpd/normal/fmgr.c7
-rw-r--r--src/ipcpd/normal/fmgr.h10
-rw-r--r--src/ipcpd/normal/frct.c19
-rw-r--r--src/ipcpd/normal/frct.h7
-rw-r--r--src/ipcpd/normal/main.c2
-rw-r--r--src/ipcpd/normal/ribmgr.c18
-rw-r--r--src/ipcpd/normal/ribmgr.h11
-rw-r--r--src/ipcpd/normal/shm_pci.c16
9 files changed, 68 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.c b/src/ipcpd/normal/fmgr.c
index 3da392c5..46c72691 100644
--- a/src/ipcpd/normal/fmgr.c
+++ b/src/ipcpd/normal/fmgr.c
@@ -126,6 +126,8 @@ static void * fmgr_nm1_acceptor(void * o)
int fd;
char * ae_name;
+ (void) o;
+
while (true) {
ipcp_wait_state(IPCP_ENROLLED, NULL);
@@ -190,6 +192,8 @@ static void * fmgr_np1_sdu_reader(void * o)
if (fq == NULL)
return (void *) 1;
+ (void) o;
+
while (true) {
int ret = flow_event_wait(fmgr.np1_set, fq, &timeout);
if (ret == -ETIMEDOUT)
@@ -240,6 +244,9 @@ void * fmgr_nm1_sdu_reader(void * o)
fqueue_t * fq = fqueue_create();
if (fq == NULL)
return (void *) 1;
+
+ (void) o;
+
while (true) {
int ret = flow_event_wait(fmgr.nm1_set, fq, &timeout);
if (ret == -ETIMEDOUT)
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/main.c b/src/ipcpd/normal/main.c
index 0339eaf4..32aabdf2 100644
--- a/src/ipcpd/normal/main.c
+++ b/src/ipcpd/normal/main.c
@@ -47,6 +47,8 @@ int irmd_api;
void ipcp_sig_handler(int sig, siginfo_t * info, void * c)
{
+ (void) c;
+
switch(sig) {
case SIGINT:
case SIGTERM:
diff --git a/src/ipcpd/normal/ribmgr.c b/src/ipcpd/normal/ribmgr.c
index c69a59ce..cd12bcc6 100644
--- a/src/ipcpd/normal/ribmgr.c
+++ b/src/ipcpd/normal/ribmgr.c
@@ -167,6 +167,9 @@ int ribmgr_cdap_reply(struct cdap * instance,
{
struct list_head * pos, * n = NULL;
+ (void) data;
+ (void) len;
+
pthread_mutex_lock(&rib.cdap_reqs_lock);
list_for_each_safe(pos, n, &rib.cdap_reqs) {
@@ -202,6 +205,9 @@ int ribmgr_cdap_read(struct cdap * instance,
char * name)
{
LOG_MISSING;
+ (void) instance;
+ (void) invoke_id;
+ (void) name;
return -1;
}
@@ -216,6 +222,8 @@ int ribmgr_cdap_write(struct cdap * instance,
static_info_msg_t * msg;
int ret = 0;
+ (void) flags;
+
pthread_rwlock_wrlock(&ipcpi.state_lock);
if (ipcp_get_state() == IPCP_PENDING_ENROLL &&
strcmp(name, STATIC_INFO) == 0) {
@@ -272,6 +280,11 @@ int ribmgr_cdap_create(struct cdap * instance,
size_t len)
{
LOG_MISSING;
+ (void) instance;
+ (void) invoke_id;
+ (void) name;
+ (void) data;
+ (void) len;
return -1;
}
@@ -283,6 +296,11 @@ int ribmgr_cdap_delete(struct cdap * instance,
size_t len)
{
LOG_MISSING;
+ (void) instance;
+ (void) invoke_id;
+ (void) name;
+ (void) data;
+ (void) len;
return -1;
}
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;