/* * Copyright (c) 2013-2014 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow * * $HEADER$ */ #include "opal_config.h" #include #include #include "opal/util/show_help.h" #include "opal/constants.h" #include "opal/util/if.h" #include "btl_usnic_module.h" #include "btl_usnic_util.h" void opal_btl_usnic_exit(opal_btl_usnic_module_t *module) { if (NULL == module) { /* Find the first module with an error callback */ for (int i = 0; i < mca_btl_usnic_component.num_modules; ++i) { if (NULL != mca_btl_usnic_component.usnic_active_modules[i]->pml_error_callback) { module = mca_btl_usnic_component.usnic_active_modules[i]; break; } } /* If we didn't find a PML error callback, just exit. */ if (NULL == module) { exit(1); } } /* After discussion with George, we decided that it was safe to cast away the const from opal_proc_local_get() -- the error function needs to be smart enough to not take certain actions if the passed proc is yourself (e.g., don't call del_procs() on yourself). */ if (NULL != module->pml_error_callback) { module->pml_error_callback(&module->super, MCA_BTL_ERROR_FLAGS_FATAL, (opal_proc_t*) opal_proc_local_get(), "usnic"); } /* If the PML error callback returns (or if there wasn't one), just exit. Shrug. */ exit(1); } /* * Simple utility in a .c file, mainly so that inline functions in .h * files don't need to include the show_help header file. */ void opal_btl_usnic_util_abort(const char *msg, const char *file, int line) { opal_show_help("help-mpi-btl-usnic.txt", "internal error after init", true, opal_process_info.nodename, msg, file, line); opal_btl_usnic_exit(NULL); /* Never returns */ } void opal_btl_usnic_dump_hex(void *vaddr, int len) { char buf[128]; size_t bufspace; int i, ret; char *p; uint32_t sum=0; uint8_t *addr; addr = vaddr; p = buf; memset(buf, 0, sizeof(buf)); bufspace = sizeof(buf) - 1; for (i=0; ibConverted + max_len; rc = opal_convertor_clone_with_position(conv, &temp, 1, &position); if (OPAL_UNLIKELY(rc < 0)) { BTL_ERROR(("unexpected convertor error")); abort(); /* XXX */ } assert(position >= conv->bConverted); packable_len = position - conv->bConverted; OBJ_DESTRUCT(&temp); return packable_len; }