diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ipcpd/ipcp-ops.h | 2 | ||||
-rw-r--r-- | src/ipcpd/ipcp.c | 2 | ||||
-rw-r--r-- | src/irmd/main.c | 16 | ||||
-rw-r--r-- | src/lib/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/lib/dev.c | 20 | ||||
-rw-r--r-- | src/lib/ipcp.c | 13 | ||||
-rw-r--r-- | src/lib/ipcpd_messages.proto | 2 | ||||
-rw-r--r-- | src/lib/irm.c | 12 | ||||
-rw-r--r-- | src/lib/nsm.c (renamed from src/lib/da.c) | 25 |
9 files changed, 46 insertions, 48 deletions
diff --git a/src/ipcpd/ipcp-ops.h b/src/ipcpd/ipcp-ops.h index ffbc9cd7..a1d9f23f 100644 --- a/src/ipcpd/ipcp-ops.h +++ b/src/ipcpd/ipcp-ops.h @@ -30,7 +30,7 @@ struct ipcp_ops { int (* ipcp_bootstrap)(struct dif_config * conf); - int (* ipcp_enroll)(char * member_name, + int (* ipcp_enroll)(char * dif_name, char * n_1_dif); int (* ipcp_reg)(char ** dif_names, size_t len); diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c index 901abae6..b5108712 100644 --- a/src/ipcpd/ipcp.c +++ b/src/ipcpd/ipcp.c @@ -159,7 +159,7 @@ void * ipcp_main_loop(void * o) } ret_msg.has_result = true; ret_msg.result = - _ipcp->ops->ipcp_enroll(msg->member_name, + _ipcp->ops->ipcp_enroll(msg->dif_name, msg->n_1_dif); break; diff --git a/src/irmd/main.c b/src/irmd/main.c index 50055c4d..dff052a1 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -27,7 +27,7 @@ #include <ouroboros/sockets.h> #include <ouroboros/irm.h> #include <ouroboros/ipcp.h> -#include <ouroboros/da.h> +#include <ouroboros/nsm.h> #include <ouroboros/list.h> #include <ouroboros/instance_name.h> #include <ouroboros/utils.h> @@ -572,7 +572,6 @@ static int bootstrap_ipcp(instance_name_t * api, static int enroll_ipcp(instance_name_t * api, char * dif_name) { - char * member = NULL; char ** n_1_difs = NULL; ssize_t n_1_difs_size = 0; struct ipcp_entry * entry = NULL; @@ -596,16 +595,7 @@ static int enroll_ipcp(instance_name_t * api, return -1; } - member = da_resolve_daf(dif_name); - if (member == NULL) { - free(entry->dif_name); - entry->dif_name = NULL; - pthread_rwlock_unlock(&instance->reg_lock); - pthread_rwlock_unlock(&instance->state_lock); - return -1; - } - - n_1_difs_size = da_resolve_dap(member, n_1_difs); + n_1_difs_size = nsm_resolve(dif_name, n_1_difs); if (n_1_difs_size < 1) { free(entry->dif_name); entry->dif_name = NULL; @@ -615,7 +605,7 @@ static int enroll_ipcp(instance_name_t * api, return -1; } - if (ipcp_enroll(api->id, member, n_1_difs[0])) { + if (ipcp_enroll(api->id, dif_name, n_1_difs[0])) { free(entry->dif_name); entry->dif_name = NULL; pthread_rwlock_unlock(&instance->reg_lock); diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index ed7f2fc6..2a75ef17 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -25,13 +25,13 @@ set(SOURCE_FILES # Add source files here bitmap.c cdap.c - da.c dev.c du_buff.c instance_name.c ipcp.c irm.c list.c + nsm.c shm_ap_rbuff.c shm_du_map.c sockets.c diff --git a/src/lib/dev.c b/src/lib/dev.c index d0f29ade..ad311f7f 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -92,7 +92,7 @@ int ap_init(char * ap_name) instance_name_destroy(_ap_instance->api); bmp_destroy(_ap_instance->fds); free(_ap_instance); - return -ENOSHM; + return -1; } _ap_instance->rb = shm_ap_rbuff_create(); @@ -101,7 +101,7 @@ int ap_init(char * ap_name) shm_du_map_close(_ap_instance->dum); bmp_destroy(_ap_instance->fds); free(_ap_instance); - return -ENOSHM; + return -1; } for (i = 0; i < AP_MAX_FLOWS; ++i) { @@ -175,7 +175,7 @@ int flow_accept(char ** ae_name) recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) { - return -EIRM; + return -1; } if (!recv_msg->has_pid || !recv_msg->has_port_id) { @@ -200,7 +200,7 @@ int flow_accept(char ** ae_name) pthread_rwlock_unlock(&_ap_instance->flows_lock); pthread_rwlock_unlock(&_ap_instance->data_lock); irm_msg__free_unpacked(recv_msg, NULL); - return -ENOSHM; + return -1; } if (ae_name != NULL) { @@ -260,7 +260,7 @@ int flow_alloc_resp(int fd, recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) { pthread_rwlock_unlock(&_ap_instance->data_lock); - return -EIRM; + return -1; } if (!recv_msg->has_result) { @@ -305,7 +305,7 @@ int flow_alloc(char * dst_name, recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) { - return -EIRM; + return -1; } if (!recv_msg->has_pid || !recv_msg->has_port_id) { @@ -330,7 +330,7 @@ int flow_alloc(char * dst_name, pthread_rwlock_unlock(&_ap_instance->flows_lock); pthread_rwlock_unlock(&_ap_instance->data_lock); irm_msg__free_unpacked(recv_msg, NULL); - return -ENOSHM; + return -1; } _ap_instance->flows[fd].port_id = recv_msg->port_id; @@ -372,7 +372,7 @@ int flow_alloc_res(int fd) recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) { - return -EIRM; + return -1; } if (!recv_msg->has_result) { @@ -418,7 +418,7 @@ int flow_dealloc(int fd) recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) { pthread_rwlock_unlock(&_ap_instance->data_lock); - return -EIRM; + return -1; } if (!recv_msg->has_result) { @@ -511,7 +511,7 @@ ssize_t flow_write(int fd, void * buf, size_t count) shm_release_du_buff(_ap_instance->dum, index); pthread_rwlock_unlock(&_ap_instance->flows_lock); pthread_rwlock_unlock(&_ap_instance->data_lock); - return -ENOSHM; + return -1; } } else { /* blocking */ while ((index = shm_create_du_buff(_ap_instance->dum, diff --git a/src/lib/ipcp.c b/src/lib/ipcp.c index a43afd21..730880f9 100644 --- a/src/lib/ipcp.c +++ b/src/lib/ipcp.c @@ -275,35 +275,32 @@ int ipcp_bootstrap(pid_t pid, } int ipcp_enroll(pid_t pid, - char * member_name, + char * dif_name, char * n_1_dif) { ipcp_msg_t msg = IPCP_MSG__INIT; ipcp_msg_t * recv_msg = NULL; int ret = -1; - if (n_1_dif == NULL || member_name == NULL) + if (n_1_dif == NULL || dif_name == NULL) return -EINVAL; - msg.code = IPCP_MSG_CODE__IPCP_ENROLL; - msg.member_name = member_name; - msg.n_1_dif = n_1_dif; + msg.code = IPCP_MSG_CODE__IPCP_ENROLL; + msg.dif_name = dif_name; + msg.n_1_dif = n_1_dif; recv_msg = send_recv_ipcp_msg(pid, &msg); if (recv_msg == NULL) { - free(msg.member_name); return -1; } if (recv_msg->has_result == false) { ipcp_msg__free_unpacked(recv_msg, NULL); - free(msg.member_name); return -1; } ret = recv_msg->result; ipcp_msg__free_unpacked(recv_msg, NULL); - free(msg.member_name); return ret; } diff --git a/src/lib/ipcpd_messages.proto b/src/lib/ipcpd_messages.proto index 63e41986..9eb5707c 100644 --- a/src/lib/ipcpd_messages.proto +++ b/src/lib/ipcpd_messages.proto @@ -15,7 +15,7 @@ enum ipcp_msg_code { message ipcp_msg { required ipcp_msg_code code = 1; - optional string member_name = 2; + optional string dif_name = 2; optional string n_1_dif = 3; repeated string dif_names = 4; optional int32 len = 5; diff --git a/src/lib/irm.c b/src/lib/irm.c index 01ee498c..8fd0a7e7 100644 --- a/src/lib/irm.c +++ b/src/lib/irm.c @@ -48,7 +48,7 @@ pid_t irm_create_ipcp(char * ipcp_name, recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) - return -EIRM; + return -1; if (recv_msg->has_result == false) { irm_msg__free_unpacked(recv_msg, NULL); @@ -77,7 +77,7 @@ int irm_destroy_ipcp(instance_name_t * api) recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) - return -EIRM; + return -1; if (recv_msg->has_result == false) { irm_msg__free_unpacked(recv_msg, NULL); @@ -149,7 +149,7 @@ int irm_bootstrap_ipcp(instance_name_t * api, recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) { - return -EIRM; + return -1; } if (recv_msg->has_result == false) { @@ -188,7 +188,7 @@ int irm_enroll_ipcp(instance_name_t * api, recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) { free(msg.dif_name); - return -EIRM; + return -1; } if (recv_msg->has_result == false) { @@ -239,7 +239,7 @@ int irm_reg(char * name, recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) - return -EIRM; + return -1; if (recv_msg->has_result == false) { irm_msg__free_unpacked(recv_msg, NULL); @@ -285,7 +285,7 @@ int irm_unreg(char * name, recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) - return -EIRM; + return -1; if (recv_msg->has_result == false) { irm_msg__free_unpacked(recv_msg, NULL); diff --git a/src/lib/da.c b/src/lib/nsm.c index 8e7756d1..069db139 100644 --- a/src/lib/da.c +++ b/src/lib/nsm.c @@ -1,7 +1,7 @@ /* * Ouroboros - Copyright (C) 2016 * - * The API to instruct the DIF Allocator + * The API to instruct the global Namespace Manager * * Sander Vrijders <[email protected]> * @@ -20,15 +20,26 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <ouroboros/da.h> +#include <ouroboros/nsm.h> -char * da_resolve_daf(char * daf_name) +int nsm_reg(char * name, + char ** dafs, + size_t dafs_size) { - return NULL; + + return -1; +} + +int nsm_unreg(char * name, + char ** dafs, + size_t dafs_size) +{ + + return -1; } -ssize_t da_resolve_dap(char * name, - char ** n_1_difs) +ssize_t nsm_resolve(char * name, + char ** dafs) { - return 0; + return -1; } |