From cd9afc60ec3df55d0d3fb2625517269d8f93a73e Mon Sep 17 00:00:00 2001 From: eeb Date: Mon, 16 May 2005 07:58:32 +0000 Subject: [PATCH] * removed any trace of route table file * changed 'routes=' syntax to drop 'route' keyword: syntax is now just a list of directives separated by newlines or ';', with comments (#), where each directive is [ ...] --- lnet/include/lnet/lib-lnet.h | 1 - lnet/include/lnet/lib-p30.h | 1 - lnet/lnet/config.c | 41 ++++++++++++++--------------------------- lnet/router/router.c | 18 +++--------------- 4 files changed, 17 insertions(+), 44 deletions(-) diff --git a/lnet/include/lnet/lib-lnet.h b/lnet/include/lnet/lib-lnet.h index e6a8e72..61e6dc0 100644 --- a/lnet/include/lnet/lib-lnet.h +++ b/lnet/include/lnet/lib-lnet.h @@ -462,7 +462,6 @@ extern void ptl_register_nal(ptl_nal_t *nal); extern void ptl_unregister_nal(ptl_nal_t *nal); #endif -extern ptl_err_t ptl_read_route_table(char *route_table); extern ptl_err_t ptl_parse_routes (char *route_str); extern ptl_err_t ptl_parse_networks (struct list_head *nilist, char *networks); diff --git a/lnet/include/lnet/lib-p30.h b/lnet/include/lnet/lib-p30.h index e6a8e72..61e6dc0 100644 --- a/lnet/include/lnet/lib-p30.h +++ b/lnet/include/lnet/lib-p30.h @@ -462,7 +462,6 @@ extern void ptl_register_nal(ptl_nal_t *nal); extern void ptl_unregister_nal(ptl_nal_t *nal); #endif -extern ptl_err_t ptl_read_route_table(char *route_table); extern ptl_err_t ptl_parse_routes (char *route_str); extern ptl_err_t ptl_parse_networks (struct list_head *nilist, char *networks); diff --git a/lnet/lnet/config.c b/lnet/lnet/config.c index 62e10b6..d59e2fd 100644 --- a/lnet/lnet/config.c +++ b/lnet/lnet/config.c @@ -409,12 +409,17 @@ ptl_str2tbs_sep (struct list_head *tbs, char *str) struct list_head pending; char *sep; int nob; + int i; ptl_text_buf_t *ptb; INIT_LIST_HEAD(&pending); /* Split 'str' into separate commands */ for (;;) { + /* skip leading whitespace */ + while (ptl_iswhite(*str)) + str++; + /* scan for separator or comment */ for (sep = str; *sep != 0; sep++) if (ptl_issep(*sep) || *sep == '#') @@ -428,7 +433,12 @@ ptl_str2tbs_sep (struct list_head *tbs, char *str) return -1; } - memcpy(ptb->ptb_text, str, nob); + for (i = 0; i < nob; i++) + if (ptl_iswhite(str[i])) + ptb->ptb_text[i] = ' '; + else + ptb->ptb_text[i] = str[i]; + ptb->ptb_text[nob] = 0; list_add_tail(&ptb->ptb_list, &pending); @@ -589,7 +599,7 @@ ptl_parse_route (char *str) while (ptl_iswhite(*sep)) sep++; if (*sep == 0) { - if (ntokens < 3) + if (ntokens < 2) goto token_error; break; } @@ -603,13 +613,7 @@ ptl_parse_route (char *str) if (*sep != 0) *sep++ = 0; - if (ntokens == 1) { - if (!strcmp(token, "route")) - continue; - goto token_error; - } - - if (ntokens == 2) + if (ntokens == 1) tmp2 = &nets; /* expanding nets */ else tmp2 = &gateways; /* expanding gateways */ @@ -637,7 +641,7 @@ ptl_parse_route (char *str) continue; } - if (ntokens == 2) { + if (ntokens == 1) { net = libcfs_str2net(ptb->ptb_text); if (net == PTL_NIDNET(PTL_NID_ANY)) goto token_error; @@ -722,20 +726,3 @@ ptl_parse_routes (char *routes) LASSERT (ptl_tbnob == 0); return rc; } - -ptl_err_t -ptl_read_route_table (char *fname) -{ - int rc = PTL_FAIL; - - /* read chunks into a page buffer - * ptl_str2tbs_sep(buffer) - * if last ptb is partial, copy to start of buffer - * and read next chunk from there - * then just ptl_parse_route_tbs() - */ - - LASSERT (ptl_tbnob == 0); - return rc; -} - diff --git a/lnet/router/router.c b/lnet/router/router.c index 92daed4..e072434 100644 --- a/lnet/router/router.c +++ b/lnet/router/router.c @@ -33,10 +33,6 @@ static char *routes = ""; CFS_MODULE_PARM(routes, "s", charp, 0444, "routes to non-local networks"); -static char *route_table = ""; -CFS_MODULE_PARM(route_table, "s", charp, 0444, - "file containing routes"); - int kpr_forwarding () { @@ -804,17 +800,9 @@ kpr_initialise (void) rwlock_init(&kpr_state.kpr_rwlock); spin_lock_init(&kpr_state.kpr_stats_lock); - if (routes[0] != 0 && - route_table[0] != 0) { - LCONSOLE_ERROR("Please set either 'routes' or " - "'route_table' but not both\n"); - return -EINVAL; - } - - if (route_table[0] != 0) - rc = ptl_read_route_table(route_table); - else - rc = ptl_parse_routes(routes); + rc = ptl_parse_routes(routes); + if (rc != PTL_OK) + kpr_finalise(); #ifdef __KERNEL__ if (rc == PTL_OK) -- 1.8.3.1