diff options
Diffstat (limited to 'src/nSocket')
-rw-r--r-- | src/nSocket/include/nstack_atomic.h | 2 | ||||
-rw-r--r-- | src/nSocket/include/nstack_dmm_api.h | 4 | ||||
-rw-r--r-- | src/nSocket/include/nstack_eventpoll.h | 4 | ||||
-rw-r--r-- | src/nSocket/include/nstack_rd_init.h | 2 | ||||
-rw-r--r-- | src/nSocket/include/nstack_select.h | 2 | ||||
-rw-r--r-- | src/nSocket/include/nstack_sockops.h | 2 | ||||
-rw-r--r-- | src/nSocket/kernel/linux_kernel_module.c | 2 | ||||
-rw-r--r-- | src/nSocket/nstack/event/epoll/nstack_eventpoll.c | 14 | ||||
-rw-r--r-- | src/nSocket/nstack/event/select/nstack_select.c | 18 | ||||
-rw-r--r-- | src/nSocket/nstack/nstack.c | 2 | ||||
-rw-r--r-- | src/nSocket/nstack/nstack_fd_mng.c | 6 | ||||
-rw-r--r-- | src/nSocket/nstack/nstack_fd_mng.h | 14 | ||||
-rw-r--r-- | src/nSocket/nstack/nstack_info_parse.c | 12 | ||||
-rw-r--r-- | src/nSocket/nstack/nstack_info_parse.h | 2 | ||||
-rw-r--r-- | src/nSocket/nstack/nstack_module.c | 28 | ||||
-rw-r--r-- | src/nSocket/nstack/nstack_module.h | 4 | ||||
-rw-r--r-- | src/nSocket/nstack/nstack_socket.c | 58 | ||||
-rw-r--r-- | src/nSocket/nstack_rd/nstack_rd.c | 24 | ||||
-rw-r--r-- | src/nSocket/nstack_rd/nstack_rd_priv.h | 2 |
19 files changed, 101 insertions, 101 deletions
diff --git a/src/nSocket/include/nstack_atomic.h b/src/nSocket/include/nstack_atomic.h index 37ab451..bb5ec13 100644 --- a/src/nSocket/include/nstack_atomic.h +++ b/src/nSocket/include/nstack_atomic.h @@ -46,7 +46,7 @@ typedef struct #define atomic_add(v, i) atomic_add_and_fetch(v, i) #define atomic_sub(v, i) atomic_sub_and_fetch(v,i) -#define cas(ptr, oldValue, exchage) __sync_bool_compare_and_swap(ptr, oldValue, exchage) +#define cas(ptr, oldValue, exchange) __sync_bool_compare_and_swap(ptr, oldValue, exchange) #ifdef __cplusplus /* *INDENT-OFF* */ diff --git a/src/nSocket/include/nstack_dmm_api.h b/src/nSocket/include/nstack_dmm_api.h index 4caeb5e..481e144 100644 --- a/src/nSocket/include/nstack_dmm_api.h +++ b/src/nSocket/include/nstack_dmm_api.h @@ -40,7 +40,7 @@ typedef struct __nstack_socket_ops typedef enum { STACK_FD_INVALID_CHECK, /*check wether fd is created by this stack */ - STACK_FD_FUNCALL_CHECK, /*check this stack surpport default call */ + STACK_FD_FUNCALL_CHECK, /*check this stack support default call */ } nstack_fd_check; typedef enum @@ -86,7 +86,7 @@ typedef struct __nstack_proc_cb nstack_extern_ops extern_ops; /*other proc callback */ } nstack_proc_cb; -typedef int (*nstack_stack_registe_fn) (nstack_proc_cb * proc_fun, +typedef int (*nstack_stack_register_fn) (nstack_proc_cb * proc_fun, nstack_event_cb * event_ops); #endif diff --git a/src/nSocket/include/nstack_eventpoll.h b/src/nSocket/include/nstack_eventpoll.h index 1abc055..afb0b05 100644 --- a/src/nSocket/include/nstack_eventpoll.h +++ b/src/nSocket/include/nstack_eventpoll.h @@ -81,7 +81,7 @@ struct eventpoll sys_sem_st sem; /* - * This sempaphore is used to block epoll_wait function + * This semaphore is used to block epoll_wait function */ sem_t waitSem; @@ -123,7 +123,7 @@ typedef struct u32 sleepTime; //add for NSTACK_SEM_SLEEP nsep_pidinfo pidinfo; nsfw_res res_chk; - void *private_data; /*add for degbu, just used to record extern infomation, for example sbr conn */ + void *private_data; /*add for debug, just used to record extern infomation, for example sbr conn */ i32 reserv[4]; } nsep_epollInfo_t; diff --git a/src/nSocket/include/nstack_rd_init.h b/src/nSocket/include/nstack_rd_init.h index cf5073e..a8b2e9e 100644 --- a/src/nSocket/include/nstack_rd_init.h +++ b/src/nSocket/include/nstack_rd_init.h @@ -36,7 +36,7 @@ typedef int (*nstack_get_route_data) (rd_route_data ** data, int *num); /* *rd init - *defualtid: if all module check fail, just return defualt id + *default id: if all module check fail, just return default id *return : 0 success, -1 fail */ int nstack_rd_init (nstack_stack_info * pstack, int num, diff --git a/src/nSocket/include/nstack_select.h b/src/nSocket/include/nstack_select.h index bb23105..5c84846 100644 --- a/src/nSocket/include/nstack_select.h +++ b/src/nSocket/include/nstack_select.h @@ -99,7 +99,7 @@ struct select_cb_p struct select_entry_info { i32 set_num; //how many select_c_p is set - i32 index; //the frist cb was set + i32 index; //the first cb was set }; struct select_entry diff --git a/src/nSocket/include/nstack_sockops.h b/src/nSocket/include/nstack_sockops.h index cc430d5..63fefee 100644 --- a/src/nSocket/include/nstack_sockops.h +++ b/src/nSocket/include/nstack_sockops.h @@ -31,7 +31,7 @@ extern "C"{ {\ if((retval = ((ops)->pf##fun args)) == -1)\ {\ - NSSOC_LOGDBG("function=%s excute failed,ret=%d.errno=%d.", #fun, retval, errno); \ + NSSOC_LOGDBG("function=%s execute failed,ret=%d.errno=%d.", #fun, retval, errno); \ }\ }\ else\ diff --git a/src/nSocket/kernel/linux_kernel_module.c b/src/nSocket/kernel/linux_kernel_module.c index 1943b18..6a262d0 100644 --- a/src/nSocket/kernel/linux_kernel_module.c +++ b/src/nSocket/kernel/linux_kernel_module.c @@ -43,7 +43,7 @@ kernel_stack_info_t g_ksInfo = {.thread_inited = ks_false,.epfd = only read is done simultaneously with no chance of other thread writing it. so no protection needed.*/ /* Custodial pointer not freed for events at end of this function */ -/* This can be ignored as this is a thread and reuns in infinite loop. Hence will never return */ +/* This can be ignored as this is a thread and runs in infinite loop. Hence will never return */ void * ks_ep_thread (void *arg) { diff --git a/src/nSocket/nstack/event/epoll/nstack_eventpoll.c b/src/nSocket/nstack/event/epoll/nstack_eventpoll.c index 989cdd7..9a753e9 100644 --- a/src/nSocket/nstack/event/epoll/nstack_eventpoll.c +++ b/src/nSocket/nstack/event/epoll/nstack_eventpoll.c @@ -124,7 +124,7 @@ nsep_epctl_triggle (struct epitem *epi, nsep_epollInfo_t * info, /* Now need to triggle userspace network stack events after add operation */ if (info->rmidx >= 0) { - /* fix overflow type codedex issue */ + /* fix overflow type codex issue */ if ((info->rmidx >= NSEP_SMOD_MAX) || (info->rmidx >= NSTACK_MAX_MODULE_NUM)) { @@ -516,7 +516,7 @@ nsep_remove_epfd (nsep_epollInfo_t * pinfo) struct free_list *fcurr = &flist; #else struct list_node **node_arry = NULL; - int lenth = NSTACK_MAX_EPOLL_INFO_NUM * sizeof (struct list_node *); + int length = NSTACK_MAX_EPOLL_INFO_NUM * sizeof (struct list_node *); #endif struct epitem *epi = NULL; struct epitem *tepi = NULL; @@ -532,7 +532,7 @@ nsep_remove_epfd (nsep_epollInfo_t * pinfo) #ifdef FREE_LIST_SIZE flist.next = 0; #else - node_arry = (struct list_node **) malloc (lenth); + node_arry = (struct list_node **) malloc (length); if (!node_arry) { NSSOC_LOGERR ("remove fd from ep malloc mem fail]fd=%d,ep=%p", @@ -540,7 +540,7 @@ nsep_remove_epfd (nsep_epollInfo_t * pinfo) return; } - int retVal = MEMSET_S (node_arry, lenth, 0, lenth); + int retVal = MEMSET_S (node_arry, length, 0, length); if (EOK != retVal) { NSSOC_LOGERR ("MEMSET_S failed]retVal=%d", retVal); @@ -1056,7 +1056,7 @@ nsep_attach_infoMem () hdl = nsep_ring_lookup (MP_NSTACK_EPINFO_RING_NAME); if (NULL == hdl) { - NSSOC_LOGERR ("Fail to loock up epoll info ring]name=%s", + NSSOC_LOGERR ("Fail to lock up epoll info ring]name=%s", MP_NSTACK_EPINFO_RING_NAME); return -1; } @@ -1079,7 +1079,7 @@ nsep_attach_epItemMem () hdl = nsep_ring_lookup (MP_NSTACK_EPITEM_RING_NAME); if (NULL == hdl) { - NSSOC_LOGERR ("Fail to loock up epoll info ring]name=%s", + NSSOC_LOGERR ("Fail to lock up epoll info ring]name=%s", MP_NSTACK_EPITEM_RING_NAME); return -1; } @@ -1102,7 +1102,7 @@ nsep_attach_eventpollMem () hdl = nsep_ring_lookup (MP_NSTACK_EVENTPOOL_RING_NAME); if (NULL == hdl) { - NSSOC_LOGERR ("Fail to loock up epoll info ring]name=%s", + NSSOC_LOGERR ("Fail to lock up epoll info ring]name=%s", MP_NSTACK_EVENTPOOL_RING_NAME); return -1; } diff --git a/src/nSocket/nstack/event/select/nstack_select.c b/src/nSocket/nstack/event/select/nstack_select.c index bb43dbe..ba64cff 100644 --- a/src/nSocket/nstack/event/select/nstack_select.c +++ b/src/nSocket/nstack/event/select/nstack_select.c @@ -107,7 +107,7 @@ select_cb_split_by_mod (i32 nfds, if (select_get_modindex (i) != inx) continue; } - NSSOC_LOGDBG ("fd is valiable i= %d fd = %d index = %d\n", i, fd, + NSSOC_LOGDBG ("fd is available i= %d fd = %d index = %d\n", i, fd, inx); if ((readfd) && (FD_ISSET (i, readfd))) { @@ -145,7 +145,7 @@ select_cb_split_by_mod (i32 nfds, /***************************************************************************** * Prototype : select_add_cb -* Description : add cb to gloab list +* Description : add cb to global list * Input : struct select_entry *entry * Output : None * Return Value : i32 @@ -185,7 +185,7 @@ select_add_cb (struct select_entry * entry) /***************************************************************************** * Prototype : select_rm_cb -* Description : rm the cb from gloab list +* Description : rm the cb from global list * Input : struct select_entry *entry * Output : None * Return Value : i32 @@ -230,10 +230,10 @@ select_rm_cb (struct select_entry * entry) return TRUE; } -/*get fd set from entrys*/ +/*get fd set from entry*/ /***************************************************************************** * Prototype : select_thread_get_fdset -* Description : get module listening fd form gloab list +* Description : get module listening fd form global list * Input : nstack_fd_set *readfd * nstack_fd_set *writefd * nstack_fd_set *exceptfd @@ -292,7 +292,7 @@ select_thread_get_fdset (nstack_fd_set * readfd, /***************************************************************************** * Prototype : select_thread_set_fdset -* Description : set ready event to gloab list +* Description : set ready event to global list * Input : i32 nfds * nstack_fd_set *readfd * nstack_fd_set *writefd @@ -344,7 +344,7 @@ select_thread_set_fdset (i32 nfds, /***************************************************************************** * Prototype : select_event_post -* Description : when event ready post sem to awaik nstack_select +* Description : when event ready post sem to awake nstack_select * Input : struct select_module_info *module * Output : None * Return Value : void @@ -589,7 +589,7 @@ lint_unlock () /***************************************************************************** * Prototype : nstack_select_thread -* Description : if gloab list not null scaning all modules ,need to think +* Description : if global list not null scaning all modules ,need to think about block mod * Input : void *arg * Output : None @@ -690,7 +690,7 @@ nstack_select_thread (void *arg) /***************************************************************************** * Prototype : nssct_create -* Description : create a select record for eveny fd +* Description : create a select record for event fd * Input : i32 cfd * i32 mfd * i32 inx diff --git a/src/nSocket/nstack/nstack.c b/src/nSocket/nstack/nstack.c index b54829e..749f06d 100644 --- a/src/nSocket/nstack/nstack.c +++ b/src/nSocket/nstack/nstack.c @@ -76,7 +76,7 @@ nstack_timeval2msec (struct timeval *pTime, u64_t * msec) { if (pTime->tv_sec < 0 || pTime->tv_usec < 0) { - NSSOC_LOGERR ("time->tv_sec is nagative"); + NSSOC_LOGERR ("time->tv_sec is negative"); return -1; } diff --git a/src/nSocket/nstack/nstack_fd_mng.c b/src/nSocket/nstack/nstack_fd_mng.c index 995b93a..ba9b8f1 100644 --- a/src/nSocket/nstack/nstack_fd_mng.c +++ b/src/nSocket/nstack/nstack_fd_mng.c @@ -40,16 +40,16 @@ nstack_reset_fdInf (nstack_fd_Inf * fdInf) fdInf->nxtfd = -1; fdInf->fd = -1; fdInf->attr = 0; - fdInf->ops = 0; /*opers of the fd, for save space we user opIdx here */ + fdInf->ops = 0; /*operations of the fd, for save space we user opIdx here */ fdInf->type = 0; /*the fd type like SOCK_STREAM|SOCK_NONBLOCK ... */ - NSTACK_SET_FD_BLOKING (fdInf); + NSTACK_SET_FD_BLOCKING (fdInf); for (loop = 0; loop < NSTACK_MAX_MODULE_NUM; loop++) { fdInf->protoFD[loop].fd = -1; fdInf->protoFD[loop].errCode = 0; fdInf->protoFD[loop].pad = 0; - fdInf->protoFD[loop].liststate = NSTACK_NO_LISENING; + fdInf->protoFD[loop].liststate = NSTACK_NO_LISTENING; } nstack_reset_fd_local_lock_info (&(fdInf->local_lock)); diff --git a/src/nSocket/nstack/nstack_fd_mng.h b/src/nSocket/nstack/nstack_fd_mng.h index 0b1cf8d..cb25e8e 100644 --- a/src/nSocket/nstack/nstack_fd_mng.h +++ b/src/nSocket/nstack/nstack_fd_mng.h @@ -70,8 +70,8 @@ typedef enum __nstack_fd_Stat #define NSTACK_LISTEN_SUCCESS 0 #define NSTACK_LISTEN_FAIL 1 #define NSTACK_BIND_FAIL 1 -#define NSTACK_LISENING 1 -#define NSTACK_NO_LISENING 0 +#define NSTACK_LISTENING 1 +#define NSTACK_NO_LISTENING 0 #define NSTACK_FD_INIT (0) #define NSTACK_FD_OPEN (1) @@ -88,7 +88,7 @@ typedef struct ns_int32 errCode; union { - struct reslt + struct result { ns_int32 brslt:8; ns_int32 lrslt:8; @@ -99,13 +99,13 @@ typedef struct ns_int32 liststate; } __attribute__ ((__packed__)) nstack_protoFD_t; -#define NSTACK_FD_ATTR_NONBLOKING 0x00000001 +#define NSTACK_FD_ATTR_NONBLOCKING 0x00000001 #define NSTACK_FD_ATTR_EPOLL_SOCKET 0x00000002 #define NSTACK_FD_ATTR_LISTEN_SOCKET 0x00000004 -#define NSTACK_IS_FD_NONBLOKING(inf) ((inf)->attr & NSTACK_FD_ATTR_NONBLOKING) -#define NSTACK_SET_FD_NONBLOKING(inf) ((inf)->attr |= NSTACK_FD_ATTR_NONBLOKING) -#define NSTACK_SET_FD_BLOKING(inf) ((inf)->attr &= (~NSTACK_FD_ATTR_NONBLOKING)) +#define NSTACK_IS_FD_NONBLOCKING(inf) ((inf)->attr & NSTACK_FD_ATTR_NONBLOCKING) +#define NSTACK_SET_FD_NONBLOCKING(inf) ((inf)->attr |= NSTACK_FD_ATTR_NONBLOCKING) +#define NSTACK_SET_FD_BLOCKING(inf) ((inf)->attr &= (~NSTACK_FD_ATTR_NONBLOCKING)) #define NSTACK_IS_FD_EPOLL_SOCKET(inf) ((inf)->attr & NSTACK_FD_ATTR_EPOLL_SOCKET) #define NSTACK_SET_FD_EPOLL_SOCKET(inf) ((inf)->attr |= NSTACK_FD_ATTR_EPOLL_SOCKET) diff --git a/src/nSocket/nstack/nstack_info_parse.c b/src/nSocket/nstack/nstack_info_parse.c index 99e6df7..989c3b8 100644 --- a/src/nSocket/nstack/nstack_info_parse.c +++ b/src/nSocket/nstack/nstack_info_parse.c @@ -30,7 +30,7 @@ #include "nstack_info_parse.h" /*get string value*/ -#define NSTACK_JSON_PARSE_STRING(obj, name, lent, reslt, index) do { \ +#define NSTACK_JSON_PARSE_STRING(obj, name, lent, result, index) do { \ struct json_object* temp_obj1 = NULL; \ (void)json_object_object_get_ex((obj), (name), &temp_obj1); \ if (temp_obj1) \ @@ -41,7 +41,7 @@ NSSOC_LOGERR("can't get value from %s index:%d", name, (index)); \ goto RETURN_ERROR; \ } \ - (void)STRNCPY_S((reslt), (lent), temp_value1, (lent)); \ + (void)STRNCPY_S((result), (lent), temp_value1, (lent)); \ } \ else \ { \ @@ -51,7 +51,7 @@ } while ( 0 ); /*get int value*/ -#define NSTACK_JSON_PARSE_INT(obj, name, lent, reslt, index) do { \ +#define NSTACK_JSON_PARSE_INT(obj, name, lent, result, index) do { \ struct json_object* temp_obj1 = NULL; \ (void)json_object_object_get_ex((obj), (name), &temp_obj1); \ if (temp_obj1) \ @@ -62,7 +62,7 @@ NSSOC_LOGERR("can't get value from %s index:%d", name, (index)); \ goto RETURN_ERROR; \ } \ - (reslt) = atoi(temp_value1); \ + (result) = atoi(temp_value1); \ } \ else \ { \ @@ -128,7 +128,7 @@ nstack_parse_module_cfg_json (char *param) NSTACK_JSON_PARSE_STRING (module_obj, "function_name", MODULE_NAME_MAX, &(g_nstack_module_desc - [icnt].registe_fn_name[0]), index); + [icnt].register_fn_name[0]), index); NSTACK_JSON_PARSE_STRING (module_obj, "libname", MODULE_NAME_MAX, &(g_nstack_module_desc[icnt].libPath[0]), index); @@ -168,7 +168,7 @@ nstack_parse_module_cfg_json (char *param) g_nstack_module_desc[icnt].default_stack = 1; } icnt++; - g_mudle_num = icnt; + g_module_num = icnt; } } ret = NSTACK_RETURN_OK; diff --git a/src/nSocket/nstack/nstack_info_parse.h b/src/nSocket/nstack/nstack_info_parse.h index 0522d2c..8b508b3 100644 --- a/src/nSocket/nstack/nstack_info_parse.h +++ b/src/nSocket/nstack/nstack_info_parse.h @@ -48,7 +48,7 @@ #define NSTACK_MOD_CFG_RD "NSTACK_MOD_CFG_RD" extern nstack_module_keys g_nstack_module_desc[NSTACK_MAX_MODULE_NUM]; -extern ns_uint32 g_mudle_num; +extern ns_uint32 g_module_num; extern int nstack_module_parse (); extern int nstack_stack_rd_parse (rd_route_data ** data, int *num); diff --git a/src/nSocket/nstack/nstack_module.c b/src/nSocket/nstack/nstack_module.c index 17da42d..91eda84 100644 --- a/src/nSocket/nstack/nstack_module.c +++ b/src/nSocket/nstack/nstack_module.c @@ -49,14 +49,14 @@ nstack_module_info g_nstack_modules = { /* *INDENT-ON* */ nstack_module_keys g_nstack_module_desc[NSTACK_MAX_MODULE_NUM]; -ns_uint32 g_mudle_num = 0; +ns_uint32 g_module_num = 0; int nstack_get_deploy_type () { int icnt = 0; int type = 0; - for (icnt = 0; icnt < g_mudle_num; icnt++) + for (icnt = 0; icnt < g_module_num; icnt++) { if (g_nstack_module_desc[icnt].deploytype > type) { @@ -71,7 +71,7 @@ nstack_register_one_module (nstack_module_keys * pKeys) { nstack_module *pmod = NULL; - nstack_stack_registe_fn stack_registe_fn = NULL; + nstack_stack_register_fn stack_register_fn = NULL; nstack_event_cb val = { 0 }; int retVal; int ret = 0; @@ -119,11 +119,11 @@ nstack_register_one_module (nstack_module_keys * pKeys) pmod->handle = RTLD_DEFAULT; } - stack_registe_fn = dlsym (pmod->handle, pKeys->registe_fn_name); - if (!stack_registe_fn) + stack_register_fn = dlsym (pmod->handle, pKeys->register_fn_name); + if (!stack_register_fn) { /* optimize dlopen err print */ - NSSOC_LOGERR ("registe function not found]err_string=%s", dlerror ()); + NSSOC_LOGERR ("register function not found]err_string=%s", dlerror ()); if (pmod->handle) { dlclose (pmod->handle); @@ -135,9 +135,9 @@ nstack_register_one_module (nstack_module_keys * pKeys) val.handle = pmod->handle; val.type = pKeys->modInx; val.event_cb = nstack_event_callback; - if (stack_registe_fn (&pmod->mops, &val)) + if (stack_register_fn (&pmod->mops, &val)) { - NSSOC_LOGERR ("registe function failed"); + NSSOC_LOGERR ("register function failed"); if (pmod->handle) { dlclose (pmod->handle); @@ -180,15 +180,15 @@ nstack_register_module () }; pstacks = - (nstack_stack_info *) malloc (sizeof (nstack_stack_info) * g_mudle_num); + (nstack_stack_info *) malloc (sizeof (nstack_stack_info) * g_module_num); if (!pstacks) { NSSOC_LOGERR ("malloc failed]"); return ns_fail; } ret = - MEMSET_S (pstacks, sizeof (nstack_stack_info) * g_mudle_num, 0, - sizeof (nstack_stack_info) * g_mudle_num); + MEMSET_S (pstacks, sizeof (nstack_stack_info) * g_module_num, 0, + sizeof (nstack_stack_info) * g_module_num); if (EOK != ret) { NSSOC_LOGERR ("MEMSET_S failed]ret=%d", ret); @@ -196,7 +196,7 @@ nstack_register_module () return ns_fail; } - for (idx = 0; idx < g_mudle_num; idx++) + for (idx = 0; idx < g_module_num; idx++) { if (0 != nstack_register_one_module (&g_nstack_module_desc[idx])) { @@ -235,7 +235,7 @@ nstack_register_module () return ns_fail; } - g_nstack_modules.modNum = g_mudle_num; + g_nstack_modules.modNum = g_module_num; /*rd module init */ if (ns_success != nstack_rd_init (pstacks, idx, rd_fun, @@ -253,7 +253,7 @@ int nstack_stack_module_init () { ns_uint32 idx; - for (idx = 0; idx < g_mudle_num; idx++) + for (idx = 0; idx < g_module_num; idx++) { if (g_nstack_modules.modules[idx].mops.extern_ops.module_init) { diff --git a/src/nSocket/nstack/nstack_module.h b/src/nSocket/nstack/nstack_module.h index ac0b57d..70b838f 100644 --- a/src/nSocket/nstack/nstack_module.h +++ b/src/nSocket/nstack/nstack_module.h @@ -51,7 +51,7 @@ extern "C"{ typedef struct __NSTACK_MODULE_KEYS { ns_char modName[MODULE_NAME_MAX]; /*stack name */ - ns_char registe_fn_name[MODULE_NAME_MAX]; /*stack regist fun name */ + ns_char register_fn_name[MODULE_NAME_MAX]; /*stack register fun name */ ns_char libPath[MODULE_NAME_MAX]; /*if libtype is dynamic, it is the path of lib */ ns_char deploytype; /*delpoly model type: model type1, model type2, model type3 */ ns_char libtype; /*dynamic lib or static lib */ @@ -81,7 +81,7 @@ typedef struct __NSTACK_MODULE typedef struct { - ns_int32 modNum; // Number of modules registed + ns_int32 modNum; // Number of modules registered ns_int32 fix_mid; nstack_module *defMod; // The default module nstack_module modules[NSTACK_MAX_MODULE_NUM]; diff --git a/src/nSocket/nstack/nstack_socket.c b/src/nSocket/nstack/nstack_socket.c index 5c3cacb..5841676 100644 --- a/src/nSocket/nstack/nstack_socket.c +++ b/src/nSocket/nstack/nstack_socket.c @@ -71,7 +71,7 @@ return -1; \ } -#define NSTACK_DOMAIN_CHEKRET(domainVal, fn, para) { \ +#define NSTACK_DOMAIN_CHECK_RET(domainVal, fn, para) { \ if ((domainVal != AF_INET) \ && (domainVal != PF_INET)) \ { \ @@ -156,7 +156,7 @@ nstack_socket (int domain, int itype, int protocol) protocol); /*if domain don't equal AF_INET , just call linux */ - NSTACK_DOMAIN_CHEKRET (domain, socket, (domain, itype, protocol)); + NSTACK_DOMAIN_CHECK_RET (domain, socket, (domain, itype, protocol)); nstack_each_modInx (modInx) { @@ -329,7 +329,7 @@ nstack_bind (int fd, const struct sockaddr *addr, socklen_t addrlen) if (fdInf->isBound) { nstack_set_errno (EINVAL); - NSPOL_LOGERR ("error, alread bind]fd=%d", fd); + NSPOL_LOGERR ("error, already bind]fd=%d", fd); UNLOCK_COMMON (fd, local_lock); return -1; } @@ -482,7 +482,7 @@ nstack_listen (int fd, int backlog) NSTACK_CAL_FUN (nstack_module_ops (modIdx), listen, (tfd, backlog), tem); if (ns_success == tem) { - nstack_set_listen_state (fdInf, modIdx, NSTACK_LISENING); + nstack_set_listen_state (fdInf, modIdx, NSTACK_LISTENING); NSTACK_SET_FD_LISTEN_SOCKET (fdInf); retval = ns_success; nstack_set_listen_ret (fdInf, modIdx, NSTACK_LISTEN_SUCCESS); @@ -492,7 +492,7 @@ nstack_listen (int fd, int backlog) NSSOC_LOGWAR ("listen fail]fd=%d,module=%s,tfd=%d", fd, nstack_get_module_name_by_idx (modIdx), tfd); nstack_set_listen_ret (fdInf, modIdx, NSTACK_LISTEN_FAIL); - nstack_set_listen_state (fdInf, modIdx, NSTACK_NO_LISENING); + nstack_set_listen_state (fdInf, modIdx, NSTACK_NO_LISTENING); } } @@ -539,7 +539,7 @@ nstack_accept (int fd, struct sockaddr *addr, socklen_t * addr_len) if ((!addr_len) || (*addr_len == NSTACK_MAX_U32_NUM)) { nstack_set_errno (EINVAL); - NSSOC_LOGERR ("addr_len inpurt error [return]"); + NSSOC_LOGERR ("addr_len input error [return]"); UNLOCK_ACCEPT (fd, local_lock); return -1; } @@ -554,7 +554,7 @@ nstack_accept (int fd, struct sockaddr *addr, socklen_t * addr_len) { nstack_set_errno (EINVAL); NSSOC_LOGERR - ("nstack accept fd=%d no mudle select, or bind/listen fail [return]", + ("nstack accept fd=%d no module select, or bind/listen fail [return]", fd); UNLOCK_ACCEPT (fd, local_lock); return -1; @@ -639,7 +639,7 @@ nstack_accept (int fd, struct sockaddr *addr, socklen_t * addr_len) nstack_set_routed_fd (accInf, accfd); accInf->ops = nstack_module_ops (apstfdInf->rmidx); - /*donot include SOCK_CLOEXEC SOCK_NONBLOCK */ + /*do not include SOCK_CLOEXEC SOCK_NONBLOCK */ accInf->type = apstfdInf->type & (~((ns_int32) SOCK_CLOEXEC | (ns_int32) SOCK_NONBLOCK)); nstack_set_router_protocol (accInf, apstfdInf->rmidx); @@ -692,7 +692,7 @@ nstack_accept4 (int fd, struct sockaddr *addr, if ((!addr_len) || (*addr_len == NSTACK_MAX_U32_NUM)) { nstack_set_errno (EINVAL); - NSSOC_LOGERR ("nstack accept4 addr_len inpurt error [return]"); + NSSOC_LOGERR ("nstack accept4 addr_len input error [return]"); UNLOCK_ACCEPT (fd, local_lock); return -1; } @@ -707,7 +707,7 @@ nstack_accept4 (int fd, struct sockaddr *addr, { nstack_set_errno (EINVAL); NSSOC_LOGERR - ("nstack accept4 fd:%d no mudle select, or bind/listen fail [return]", + ("nstack accept4 fd:%d no module select, or bind/listen fail [return]", fd); UNLOCK_ACCEPT (fd, local_lock); return -1; @@ -810,7 +810,7 @@ Parameters : fd addr len Return : -Description : use the rd select rlfd or default rlfd to Estblsh connection. the unused fd should closed +Description : use the rd select rlfd or default rlfd to Establish connection. the unused fd should closed *****************************************************************/ int nstack_connect (int fd, const struct sockaddr *addr, socklen_t addrlen) @@ -897,7 +897,7 @@ nstack_connect (int fd, const struct sockaddr *addr, socklen_t addrlen) NSSOC_LOGINF ("fd=%d addr=%s Select module=%s", fd, inet_ntoa (iaddr->sin_addr), nstack_get_module_name_by_idx (selectmod)); - /*in case of that multi-thread connect. if route was chosed by one thread, the other just use the first one */ + /*in case of that multi-thread connect. if route was chosen by one thread, the other just use the first one */ fdInf->rmidx = selectmod; fdInf->ops = nstack_module_ops (selectmod); nstack_set_routed_fd (fdInf, nstack_get_protoFd (fdInf, selectmod)); @@ -1072,7 +1072,7 @@ nstack_close (int fd) if (nstack_fix_fd_check () && nstack_fix_fd_check ()(fd, STACK_FD_FUNCALL_CHECK)) { - /*free epoll resouce */ + /*free epoll resoure */ nsep_epoll_close (fd); nssct_close (fd, nstack_get_fix_mid ()); @@ -1605,7 +1605,7 @@ nstack_getsockname (int fd, struct sockaddr *addr, socklen_t * addrlen) nstack_defmod_name (), tfd); if (-1 == ret) { - NSSOC_LOGERR ("return fail]mudle=%d,fd=%d [return]", + NSSOC_LOGERR ("return fail]module=%d,fd=%d [return]", nstack_defMod_inx (), tfd); } UNLOCK_COMMON (fd, local_lock); @@ -1625,7 +1625,7 @@ Parameters : fd addr len Return : -Description : getpeername only used by the fd who already Estblsh connection, so use first rlfd. +Description : getpeername only used by the fd who already Establish connection, so use first rlfd. *****************************************************************/ int nstack_getpeername (int fd, struct sockaddr *addr, socklen_t * addrlen) @@ -1659,7 +1659,7 @@ nstack_getpeername (int fd, struct sockaddr *addr, socklen_t * addrlen) fdInf->rlfd, ret); if (-1 == ret) { - NSSOC_LOGERR ("return fail]mudle=%d,fd=%d [return]", fdInf->rmidx, + NSSOC_LOGERR ("return fail]module=%d,fd=%d [return]", fdInf->rmidx, tfd); } UNLOCK_COMMON (fd, local_lock); @@ -1677,7 +1677,7 @@ nstack_getpeername (int fd, struct sockaddr *addr, socklen_t * addrlen) nstack_defmod_name (), tfd); if (-1 == ret) { - NSSOC_LOGERR ("return fail] mudle=%d,fd=%d [return]", + NSSOC_LOGERR ("return fail] module=%d,fd=%d [return]", nstack_defMod_inx (), tfd); } UNLOCK_COMMON (fd, local_lock); @@ -1801,7 +1801,7 @@ nstack_getsockopt (int fd, int level, int optname, void *optval, ret); if (-1 == ret) { - NSSOC_LOGERR ("return fail]mudle=%d,fd=%d [return]", fdInf->rmidx, + NSSOC_LOGERR ("return fail]module=%d,fd=%d [return]", fdInf->rmidx, tfd); } UNLOCK_COMMON (fd, local_lock); @@ -1821,7 +1821,7 @@ nstack_getsockopt (int fd, int level, int optname, void *optval, nstack_defmod_name (), tfd, level, optname, ret); if (-1 == ret) { - NSSOC_LOGERR ("return fail]mudle=%d,fd=%d [return]", + NSSOC_LOGERR ("return fail]module=%d,fd=%d [return]", nstack_defMod_inx (), tfd); } UNLOCK_COMMON (fd, local_lock); @@ -1835,7 +1835,7 @@ nstack_getsockopt (int fd, int level, int optname, void *optval, return ret; } -/* all rlfd need setsockopt, set opt failed still can Estblsh connection. so we not care suc/fail */ +/* all rlfd need setsockopt, set opt failed still can Establish connection. so we not care suc/fail */ /* Currently, if setsockopt is successfull either in kernel or stack-x, the below API returns SUCCESS */ int nstack_setsockopt (int fd, int level, int optname, const void *optval, @@ -1885,7 +1885,7 @@ nstack_setsockopt (int fd, int level, int optname, const void *optval, ret); if (-1 == ret) { - NSSOC_LOGERR ("return fail]mudle=%d,fd=%d [return]", fdInf->rmidx, + NSSOC_LOGERR ("return fail]module=%d,fd=%d [return]", fdInf->rmidx, itfd); } UNLOCK_COMMON (fd, local_lock); @@ -1962,7 +1962,7 @@ nstack_ioctl (int fd, unsigned long request, unsigned long argp) fdInf->rlfd, argp, ret); if (-1 == ret) { - NSSOC_LOGERR ("return fail]mudle=%d,fd=%d [return]", fdInf->rmidx, + NSSOC_LOGERR ("return fail]module=%d,fd=%d [return]", fdInf->rmidx, tfd); } @@ -2042,7 +2042,7 @@ nstack_fcntl (int fd, int cmd, unsigned long argp) tfd, argp, ret); if (-1 == ret) { - NSSOC_LOGERR ("return fail]mudle=%d,fd=%d", fdInf->rmidx, tfd); + NSSOC_LOGERR ("return fail]module=%d,fd=%d", fdInf->rmidx, tfd); } } else @@ -2091,7 +2091,7 @@ nstack_fcntl (int fd, int cmd, unsigned long argp) argp, ret); if (-1 == ret) { - NSSOC_LOGERR ("return fail]mudle=%d,fd=%d", + NSSOC_LOGERR ("return fail]module=%d,fd=%d", g_nstack_modules.defMod->modInx, tfd); } } @@ -2174,7 +2174,7 @@ nstack_select (int nfds, fd_set * readfds, fd_set * writefds, return nsfw_base_select (nfds, readfds, writefds, exceptfds, timeout); } - /*nstack select not support timer function and not check nfds so calling dufault select */ + /*nstack select not support timer function and not check nfds so calling default select */ if ((nfds <= 0) || ((NULL == readfds) && (NULL == writefds) && (NULL == exceptfds))) { @@ -2198,7 +2198,7 @@ nstack_select (int nfds, fd_set * readfds, fd_set * writefds, goto err_return; } - /* fix dead-code type Codedex issue */ + /* fix dead-code type Codex issue */ /*split select fd to each modules fd and save to entry */ (void) select_cb_split_by_mod (nfds, readfds, writefds, exceptfds, entry); @@ -2226,7 +2226,7 @@ nstack_select (int nfds, fd_set * readfds, fd_set * writefds, } } - /*cheching if event ready or not */ + /*checking if event ready or not */ if (FALSE == select_scan (entry)) { NSSOC_LOGERR ("select scan failed"); @@ -2406,7 +2406,7 @@ nstack_epoll_ctl (int epfd, int op, int fd, struct epoll_event *event) } else { - NSSOC_LOGWAR ("fd not registed before"); + NSSOC_LOGWAR ("fd not registered before"); errno = ENOENT; ret = -1; } @@ -2419,7 +2419,7 @@ nstack_epoll_ctl (int epfd, int op, int fd, struct epoll_event *event) } else { - NSSOC_LOGWAR ("fd not registed before"); + NSSOC_LOGWAR ("fd not registered before"); errno = ENOENT; ret = -1; } diff --git a/src/nSocket/nstack_rd/nstack_rd.c b/src/nSocket/nstack_rd/nstack_rd.c index ee598ad..eb38bca 100644 --- a/src/nSocket/nstack_rd/nstack_rd.c +++ b/src/nSocket/nstack_rd/nstack_rd.c @@ -62,12 +62,12 @@ rd_data_proc g_rd_cpy[RD_DATA_TYPE_MAX] = { }, }; -rd_data_defaut_ip g_defualt_ip_config[] = { +rd_data_defaut_ip g_default_ip_config[] = { {{"127.0.0.1"}, {RD_LINUX_PLANENAME}, 32}, {{"0.0.0.0"}, {RD_LINUX_PLANENAME}, 32}, }; -rd_data_defaut_protocol g_defualt_protcol[] = { +rd_data_defaut_protocol g_default_protcol[] = { {0xf001, {RD_STACKX_PLANENAME}}, }; @@ -122,9 +122,9 @@ nstack_rd_get_stackid (nstack_rd_key * pkey, int *stackid) *stackid = item.stack_id; return NSTACK_RD_SUCCESS; } - if (g_rd_cpy[type].rd_item_defualt) + if (g_rd_cpy[type].rd_item_default) { - *stackid = g_rd_cpy[type].rd_item_defualt ((void *) pkey); + *stackid = g_rd_cpy[type].rd_item_default ((void *) pkey); } else { @@ -137,7 +137,7 @@ nstack_rd_get_stackid (nstack_rd_key * pkey, int *stackid) /***************************************************************************** * Prototype : nstack_rd_sys_default -* Description : sys defualt rd info, +* Description : sys default rd info, * Input : None * Output : None * Return Value : int @@ -152,12 +152,12 @@ nstack_rd_sys_default () rd_data_defaut_protocol *pprotodata = NULL; int icnt = 0, iindex = 0; - /*get the ip defualt route */ + /*get the ip default route */ for (icnt = 0; - icnt < sizeof (g_defualt_ip_config) / sizeof (rd_data_defaut_ip); + icnt < sizeof (g_default_ip_config) / sizeof (rd_data_defaut_ip); icnt++) { - pdata = &g_defualt_ip_config[icnt]; + pdata = &g_default_ip_config[icnt]; for (iindex = 0; iindex < g_rd_map_num; iindex++) { if (0 == @@ -186,12 +186,12 @@ nstack_rd_sys_default () (RD_DATA_TYPE_IP), &item); } - /*get the protocol defualt route */ + /*get the protocol default route */ (void) MEMSET_S (&item, sizeof (item), 0, sizeof (item)); for (icnt = 0; - icnt < sizeof (g_defualt_protcol) / sizeof (rd_data_defaut_ip); icnt++) + icnt < sizeof (g_default_protcol) / sizeof (rd_data_defaut_ip); icnt++) { - pprotodata = &g_defualt_protcol[icnt]; + pprotodata = &g_default_protcol[icnt]; for (iindex = 0; iindex < g_rd_map_num; iindex++) { if (0 == @@ -346,7 +346,7 @@ nstack_rd_sys () return NSTACK_RD_FAIL; } - /*insert defualt rd info */ + /*insert default rd info */ nstack_rd_sys_default (); /*get from config file */ diff --git a/src/nSocket/nstack_rd/nstack_rd_priv.h b/src/nSocket/nstack_rd/nstack_rd_priv.h index 217f1d3..b3ed9b5 100644 --- a/src/nSocket/nstack_rd/nstack_rd_priv.h +++ b/src/nSocket/nstack_rd/nstack_rd_priv.h @@ -97,7 +97,7 @@ typedef struct __rd_data_proc int (*rd_item_age) (nstack_rd_list * hlist); int (*rd_item_find) (nstack_rd_list * hlist, void *rdkey, void *outitem); int (*rd_item_spec) (void *rdkey); - int (*rd_item_defualt) (void *rdkey); + int (*rd_item_default) (void *rdkey); } rd_data_proc; extern rd_local_data *g_rd_local_data; |