From: Sean Hefty Date: Mon, 6 Dec 2010 19:27:36 +0000 (-0800) Subject: rename X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=ac9c228b837523e966accd1677ef83a25e3e5d63;p=~shefty%2Fibacm.git rename --- diff --git a/meta b/meta index a7d6d6f..fac46d4 100644 --- a/meta +++ b/meta @@ -1,5 +1,5 @@ Version: 1 -Previous: 9fd798cb1cffc438ccc422057302cb74ac5f12d8 +Previous: 3dbdc44d4c08efbb020cfcf69b6b6471e971f794 Head: 45d0dbe31df5f9be4ecdb6db28e050537c97dd31 Applied: logging: 549692c49922dce3911d97dcc6d0a2fc583ab5f7 @@ -11,7 +11,7 @@ Applied: locking: 558e5577364aec3531c54b28def6e16f0c926524 verbose: 15cf7a7a260a694923bcb5c9181b10b0f02108f7 dbg_1: 0b650c149079cd8e1593504492a9940521fb9c6d - no_active: 45d0dbe31df5f9be4ecdb6db28e050537c97dd31 + no_addr: 45d0dbe31df5f9be4ecdb6db28e050537c97dd31 Unapplied: acme_verbose: 45cba0846874c93ef7af156bf0afe59f43d82ea6 1.0.4: 9f452b8e59adb21b90fbdda980d25a54d4360d37 diff --git a/patches/no_active b/patches/no_active deleted file mode 100644 index e03e12e..0000000 --- a/patches/no_active +++ /dev/null @@ -1,95 +0,0 @@ -Bottom: 5e7b11ab34ad911d8a6551337d36c51be1b092b4 -Top: a307944fa3171b48a0b7c8ad9cb0218ce45d24c2 -Author: Sean Hefty -Date: 2010-12-06 11:06:47 -0800 - -ibacm: exit if no endpoints are active - -Exit the service if no endpoints can be found to activate. This -may be caused by a missing address configuration file. - -Signed-off-by: Sean Hefty - - ---- - -diff --git a/src/acm.c b/src/acm.c -index 9ff81c4..14cbfd6 100644 ---- a/src/acm.c -+++ b/src/acm.c -@@ -203,6 +203,7 @@ static SOCKET listen_socket; - static struct acm_client client[FD_SETSIZE - 1]; - - static FILE *flog; -+static FILE *faddr; - static lock_t log_lock; - PER_THREAD char log_data[ACM_MAX_ADDRESS]; - -@@ -2261,11 +2262,7 @@ static int acm_assign_ep_names(struct acm_ep *ep) - acm_log(1, "device %s, port %d, pkey 0x%x\n", - dev_name, ep->port->port_num, ep->pkey); - -- if (!(f = fopen(addr_file, "r"))) { -- acm_log(0, "ERROR - unable to open acm_addr.cfg file\n"); -- return ACM_STATUS_ENODATA; -- } -- -+ rewind(faddr); - while (fgets(s, sizeof s, f)) { - if (s[0] == '#') - continue; -@@ -2310,7 +2307,6 @@ static int acm_assign_ep_names(struct acm_ep *ep) - } - } - -- fclose(f); - return !index; - } - -@@ -2722,6 +2718,22 @@ static FILE *acm_open_log(void) - return f; - } - -+static FILE *acm_open_addr_file(void) -+{ -+ FILE *f; -+ -+ if ((f = fopen(addr_file, "r")) -+ return f; -+ -+ acm_log(0, "notice - generating acm_addr.cfg file\n"); -+ if (!(f = popen("ib_acm -A", "r"))) { -+ acm_log(0, "ERROR - cannot generate acm_addr.cfg\n"); -+ return NULL; -+ } -+ pclose(f); -+ return fopen(addr_file, "r"); -+} -+ - static int acm_open_lock_file(void) - { - int lock_fd; -@@ -2813,6 +2825,11 @@ int CDECL_FUNC main(int argc, char **argv) - DListInit(&timeout_list); - event_init(&timeout_event); - -+ if (faddr = acm_open_addr_file()) { -+ acm_log(0, "ERROR - address file not found\n"); -+ return -1 -+ } -+ - umad_init(); - ibdev = ibv_get_device_list(&dev_cnt); - if (!ibdev) { -@@ -2825,6 +2842,11 @@ int CDECL_FUNC main(int argc, char **argv) - acm_open_dev(ibdev[i]); - - ibv_free_device_list(ibdev); -+ fclose(faddr); -+ if (DListEmpty(&dev_list)) { -+ acm_log(0, "ERROR - no active devices\n"); -+ return -1; -+ } - - acm_log(1, "initiating multicast joins\n"); - acm_join_groups(); diff --git a/patches/no_addr b/patches/no_addr new file mode 100644 index 0000000..e03e12e --- /dev/null +++ b/patches/no_addr @@ -0,0 +1,95 @@ +Bottom: 5e7b11ab34ad911d8a6551337d36c51be1b092b4 +Top: a307944fa3171b48a0b7c8ad9cb0218ce45d24c2 +Author: Sean Hefty +Date: 2010-12-06 11:06:47 -0800 + +ibacm: exit if no endpoints are active + +Exit the service if no endpoints can be found to activate. This +may be caused by a missing address configuration file. + +Signed-off-by: Sean Hefty + + +--- + +diff --git a/src/acm.c b/src/acm.c +index 9ff81c4..14cbfd6 100644 +--- a/src/acm.c ++++ b/src/acm.c +@@ -203,6 +203,7 @@ static SOCKET listen_socket; + static struct acm_client client[FD_SETSIZE - 1]; + + static FILE *flog; ++static FILE *faddr; + static lock_t log_lock; + PER_THREAD char log_data[ACM_MAX_ADDRESS]; + +@@ -2261,11 +2262,7 @@ static int acm_assign_ep_names(struct acm_ep *ep) + acm_log(1, "device %s, port %d, pkey 0x%x\n", + dev_name, ep->port->port_num, ep->pkey); + +- if (!(f = fopen(addr_file, "r"))) { +- acm_log(0, "ERROR - unable to open acm_addr.cfg file\n"); +- return ACM_STATUS_ENODATA; +- } +- ++ rewind(faddr); + while (fgets(s, sizeof s, f)) { + if (s[0] == '#') + continue; +@@ -2310,7 +2307,6 @@ static int acm_assign_ep_names(struct acm_ep *ep) + } + } + +- fclose(f); + return !index; + } + +@@ -2722,6 +2718,22 @@ static FILE *acm_open_log(void) + return f; + } + ++static FILE *acm_open_addr_file(void) ++{ ++ FILE *f; ++ ++ if ((f = fopen(addr_file, "r")) ++ return f; ++ ++ acm_log(0, "notice - generating acm_addr.cfg file\n"); ++ if (!(f = popen("ib_acm -A", "r"))) { ++ acm_log(0, "ERROR - cannot generate acm_addr.cfg\n"); ++ return NULL; ++ } ++ pclose(f); ++ return fopen(addr_file, "r"); ++} ++ + static int acm_open_lock_file(void) + { + int lock_fd; +@@ -2813,6 +2825,11 @@ int CDECL_FUNC main(int argc, char **argv) + DListInit(&timeout_list); + event_init(&timeout_event); + ++ if (faddr = acm_open_addr_file()) { ++ acm_log(0, "ERROR - address file not found\n"); ++ return -1 ++ } ++ + umad_init(); + ibdev = ibv_get_device_list(&dev_cnt); + if (!ibdev) { +@@ -2825,6 +2842,11 @@ int CDECL_FUNC main(int argc, char **argv) + acm_open_dev(ibdev[i]); + + ibv_free_device_list(ibdev); ++ fclose(faddr); ++ if (DListEmpty(&dev_list)) { ++ acm_log(0, "ERROR - no active devices\n"); ++ return -1; ++ } + + acm_log(1, "initiating multicast joins\n"); + acm_join_groups();