| 99 | ****************************************************************************/ |
| 100 | |
| 101 | static int load_absmodule(FAR struct binary_s *bin, FAR const char *filename, |
| 102 | FAR const struct symtab_s *exports, int nexports) |
| 103 | { |
| 104 | FAR struct binfmt_s *binfmt; |
| 105 | int ret = -ENOENT; |
| 106 | |
| 107 | binfo("Loading %s\n", filename); |
| 108 | |
| 109 | /* Traverse the list of registered binary format handlers. Stop |
| 110 | * when either (1) a handler recognized and loads the format, or |
| 111 | * (2) no handler recognizes the format. |
| 112 | */ |
| 113 | |
| 114 | for (binfmt = g_binfmts; binfmt; binfmt = binfmt->next) |
| 115 | { |
| 116 | /* Use this handler to try to load the format */ |
| 117 | |
| 118 | ret = binfmt->load(bin, filename, exports, nexports); |
| 119 | if (ret == OK) |
| 120 | { |
| 121 | /* Successfully loaded -- break out with ret == 0 */ |
| 122 | |
| 123 | binfo("Successfully loaded module %s\n", filename); |
| 124 | |
| 125 | /* Save the filename of the loaded module */ |
| 126 | |
| 127 | #ifdef CONFIG_BINFMT_STORE_FILENAME |
| 128 | strlcpy(bin->fname, filename, sizeof(bin->fname)); |
| 129 | #endif |
| 130 | |
| 131 | /* Save the unload method for use by unload_module */ |
| 132 | |
| 133 | bin->unload = binfmt->unload; |
| 134 | binfmt_dumpmodule(bin); |
| 135 | break; |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | return ret; |
| 140 | } |
| 141 | |
| 142 | /**************************************************************************** |
| 143 | * Public Functions |
no test coverage detected