summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2016-12-29 12:31:01 +0100
committerSander Vrijders <sander.vrijders@intec.ugent.be>2016-12-29 12:31:01 +0100
commit4ccd3e2c8af00963ac6d88aac587de016300ed90 (patch)
tree5c80c01627e76086aa48569c32a0c52a37e21a53 /src
parent43a3231b03aa0a639bcd8d61784c84095edfdb6e (diff)
parente8d6e91203b0521572b0ae32202e69944dde8f04 (diff)
downloadouroboros-4ccd3e2c8af00963ac6d88aac587de016300ed90.tar.gz
ouroboros-4ccd3e2c8af00963ac6d88aac587de016300ed90.zip
Merged in dstaesse/ouroboros/be-normal-dev (pull request #330)
ipcpd: Rename normal/path to normal/pathname
Diffstat (limited to 'src')
-rw-r--r--src/ipcpd/normal/CMakeLists.txt2
-rw-r--r--src/ipcpd/normal/dir.c2
-rw-r--r--src/ipcpd/normal/fmgr.c18
-rw-r--r--src/ipcpd/normal/main.c12
-rw-r--r--src/ipcpd/normal/pathname.c (renamed from src/ipcpd/normal/path.c)2
-rw-r--r--src/ipcpd/normal/pathname.h (renamed from src/ipcpd/normal/path.h)6
-rw-r--r--src/ipcpd/normal/pol/flat.c2
-rw-r--r--src/ipcpd/normal/ribmgr.c14
8 files changed, 31 insertions, 27 deletions
diff --git a/src/ipcpd/normal/CMakeLists.txt b/src/ipcpd/normal/CMakeLists.txt
index 5f85dd89..bdcb78ae 100644
--- a/src/ipcpd/normal/CMakeLists.txt
+++ b/src/ipcpd/normal/CMakeLists.txt
@@ -30,7 +30,7 @@ set(SOURCE_FILES
fmgr.c
frct.c
main.c
- path.c
+ pathname.c
pff.c
ribmgr.c
shm_pci.c
diff --git a/src/ipcpd/normal/dir.c b/src/ipcpd/normal/dir.c
index 905af2ed..47fb1f6e 100644
--- a/src/ipcpd/normal/dir.c
+++ b/src/ipcpd/normal/dir.c
@@ -28,7 +28,7 @@
#include "dir.h"
#include "ipcp.h"
#include "ro.h"
-#include "path.h"
+#include "pathname.h"
#include "ribmgr.h"
#include <stdlib.h>
diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c
index 7917d61a..d8190572 100644
--- a/src/ipcpd/normal/fmgr.c
+++ b/src/ipcpd/normal/fmgr.c
@@ -40,7 +40,7 @@
#include "ipcp.h"
#include "shm_pci.h"
#include "dir.h"
-#include "path.h"
+#include "pathname.h"
#include "ro.h"
#include "flow_alloc.pb-c.h"
@@ -78,16 +78,8 @@ static void * fmgr_nm1_acceptor(void * o)
(void) o;
while (true) {
- ipcp_wait_state(IPCP_OPERATIONAL, NULL);
-
- pthread_rwlock_rdlock(&ipcpi.state_lock);
-
- if (ipcp_get_state() == IPCP_SHUTDOWN) {
- pthread_rwlock_unlock(&ipcpi.state_lock);
+ if (ipcp_get_state() == IPCP_SHUTDOWN)
return 0;
- }
-
- pthread_rwlock_unlock(&ipcpi.state_lock);
fd = flow_accept(&ae_name, &qs);
if (fd < 0) {
@@ -594,8 +586,7 @@ int fmgr_np1_post_buf(cep_id_t cep_id, buffer_t * buf)
return ret;
}
-int fmgr_np1_post_sdu(cep_id_t cep_id,
- struct shm_du_buff * sdb)
+int fmgr_np1_post_sdu(cep_id_t cep_id, struct shm_du_buff * sdb)
{
int fd;
@@ -687,8 +678,7 @@ int fmgr_nm1_write_sdu(struct pci * pci, struct shm_du_buff * sdb)
return 0;
}
-int fmgr_nm1_write_buf(struct pci * pci,
- buffer_t * buf)
+int fmgr_nm1_write_buf(struct pci * pci, buffer_t * buf)
{
buffer_t * buffer;
diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c
index 4eb708b4..34ba52da 100644
--- a/src/ipcpd/normal/main.c
+++ b/src/ipcpd/normal/main.c
@@ -215,22 +215,24 @@ int main(int argc, char * argv[])
pthread_sigmask(SIG_UNBLOCK, &sigset, NULL);
- if (fmgr_init()) {
+ if (ribmgr_init()) {
+ fmgr_fini();
ipcp_fini();
close_logfile();
exit(EXIT_FAILURE);
}
- if (ribmgr_init()) {
+ if (ipcp_create_r(getpid())) {
+ LOG_ERR("Failed to notify IRMd we are initialized.");
fmgr_fini();
ipcp_fini();
close_logfile();
exit(EXIT_FAILURE);
}
- if (ipcp_create_r(getpid())) {
- LOG_ERR("Failed to notify IRMd we are initialized.");
- fmgr_fini();
+ ipcp_wait_state(IPCP_OPERATIONAL, NULL);
+
+ if (fmgr_init()) {
ipcp_fini();
close_logfile();
exit(EXIT_FAILURE);
diff --git a/src/ipcpd/normal/path.c b/src/ipcpd/normal/pathname.c
index ebd5719c..cf6e08b0 100644
--- a/src/ipcpd/normal/path.c
+++ b/src/ipcpd/normal/pathname.c
@@ -29,7 +29,7 @@
#include <string.h>
#include <assert.h>
-#include "path.h"
+#include "pathname.h"
char * pathname_create(const char * name)
{
diff --git a/src/ipcpd/normal/path.h b/src/ipcpd/normal/pathname.h
index 8689036f..dc91b7d9 100644
--- a/src/ipcpd/normal/path.h
+++ b/src/ipcpd/normal/pathname.h
@@ -19,8 +19,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifndef OUROBOROS_IPCPD_NORMAL_PATH_H
-#define OUROBOROS_IPCPD_NORMAL_PATH_H
+#ifndef OUROBOROS_IPCPD_NORMAL_PATHNAME_H
+#define OUROBOROS_IPCPD_NORMAL_PATHNAME_H
#define PATH_DELIMITER "/"
@@ -31,4 +31,4 @@ char * pathname_append(char * pname,
void pathname_destroy(char * pname);
-#endif /* OUROBOROS_IPCPD_NORMAL_PATH_H */
+#endif /* OUROBOROS_IPCPD_NORMAL_PATHNAME_H */
diff --git a/src/ipcpd/normal/pol/flat.c b/src/ipcpd/normal/pol/flat.c
index 82c7db93..13eaf215 100644
--- a/src/ipcpd/normal/pol/flat.c
+++ b/src/ipcpd/normal/pol/flat.c
@@ -29,7 +29,7 @@
#include "shm_pci.h"
#include "ribmgr.h"
#include "ro.h"
-#include "path.h"
+#include "pathname.h"
#include <time.h>
#include <stdlib.h>
diff --git a/src/ipcpd/normal/ribmgr.c b/src/ipcpd/normal/ribmgr.c
index 15c3957f..3b4a5784 100644
--- a/src/ipcpd/normal/ribmgr.c
+++ b/src/ipcpd/normal/ribmgr.c
@@ -42,7 +42,7 @@
#include "frct.h"
#include "ipcp.h"
#include "ro.h"
-#include "path.h"
+#include "pathname.h"
#include "dir.h"
#include "static_info.pb-c.h"
@@ -971,18 +971,23 @@ static void * cdap_req_handler(void * o)
if (opcode == CDAP_START) {
if (ribmgr_cdap_start(instance, key, name))
LOG_WARN("CDAP start failed.");
+ free(name);
continue;
}
else if (opcode == CDAP_STOP) {
if (ribmgr_cdap_stop(instance, key, name))
LOG_WARN("CDAP stop failed.");
+ free(name);
continue;
}
+ assert(len > 0);
+
msg = ro_msg__unpack(NULL, len, data);
if (msg == NULL) {
cdap_reply_send(instance, key, -1, NULL, 0);
LOG_WARN("Failed to unpack RO message");
+ free(data);
continue;
}
@@ -996,6 +1001,7 @@ static void * cdap_req_handler(void * o)
ro_msg__free_unpacked(msg, NULL);
cdap_reply_send(instance, key, 0, NULL, 0);
LOG_DBG("Already received this RO.");
+ free(name);
continue;
}
}
@@ -1005,6 +1011,7 @@ static void * cdap_req_handler(void * o)
if (ribmgr_cdap_create(instance, key, name, msg)) {
LOG_WARN("CDAP create failed.");
ro_msg__free_unpacked(msg, NULL);
+ free(name);
continue;
}
} else if (opcode == CDAP_WRITE) {
@@ -1012,24 +1019,28 @@ static void * cdap_req_handler(void * o)
msg, flags)) {
LOG_WARN("CDAP write failed.");
ro_msg__free_unpacked(msg, NULL);
+ free(name);
continue;
}
} else if (opcode == CDAP_DELETE) {
if (ribmgr_cdap_delete(instance, key, name)) {
LOG_WARN("CDAP delete failed.");
ro_msg__free_unpacked(msg, NULL);
+ free(name);
continue;
}
} else {
LOG_INFO("Unsupported opcode received.");
ro_msg__free_unpacked(msg, NULL);
cdap_reply_send(instance, key, -1, NULL, 0);
+ free(name);
continue;
}
if (ro_id_create(name, msg)) {
LOG_WARN("Failed to create RO id.");
ro_msg__free_unpacked(msg, NULL);
+ free(name);
continue;
}
@@ -1050,6 +1061,7 @@ static void * cdap_req_handler(void * o)
pthread_rwlock_unlock(&rib.flows_lock);
}
+ free(name);
ro_msg__free_unpacked(msg, NULL);
}