Commit 33738d1a authored by Rob Latham's avatar Rob Latham

clean up our use of margo instance ids

parent 443d60d8
...@@ -7,16 +7,17 @@ ...@@ -7,16 +7,17 @@
#ifndef MOBJECT_SERVER_H #ifndef MOBJECT_SERVER_H
#define MOBJECT_SERVER_H #define MOBJECT_SERVER_H
#include <margo.h>
/* server-side utilities and routines. Clients are looking for either /* server-side utilities and routines. Clients are looking for either
* libmobject-store.h or librados-mobject-store.h */ * libmobject-store.h or librados-mobject-store.h */
/** /**
* Start a mobject server instance * Start a mobject server instance
* *
* @param[in] addr_str * @param[in] mid
* @param[in poolname * @param[in poolname
* @returns 0 on success, negative error code on failure */ * @returns 0 on success, negative error code on failure */
int mobject_server_register(const char *addr_str, const char *poolname); int mobject_server_register(margo_instance_id mid, const char *poolname);
#endif #endif
...@@ -6,27 +6,24 @@ ...@@ -6,27 +6,24 @@
#include <mobject-server.h> #include <mobject-server.h>
int mobject_server_register(const char *addr_str, const char *poolname) int mobject_server_register(margo_instance_id mid, const char *poolname)
{ {
int ret=0; int ret=0;
margo_instance_id mid;
kv_context *metadata; kv_context *metadata;
struct bake_pool_info *pool_info; struct bake_pool_info *pool_info;
pool_info = bake_server_makepool(poolname); pool_info = bake_server_makepool(poolname);
mid = margo_init(addr_str, MARGO_SERVER_MODE, 0, -1);
bake_server_register(mid, pool_info); bake_server_register(mid, pool_info);
metadata = kv_server_register(mid); metadata = kv_server_register(mid);
return ret; return ret;
} }
int mobject_shutdown() int mobject_shutdown(margo_instance_id mid)
{ {
margo_wait_for_finalize(NULL); margo_wait_for_finalize(mid);
pmemobj_close(NULL); pmemobj_close(NULL);
return 0;
} }
...@@ -5,6 +5,6 @@ int main(int argc, char **argv) ...@@ -5,6 +5,6 @@ int main(int argc, char **argv)
{ {
margo_instance_id mid; margo_instance_id mid;
mid = margo_init(argv[1], MARGO_SERVER_MODE, 0, -1); mid = margo_init(argv[1], MARGO_SERVER_MODE, 0, -1);
mobject_server_register(argv[2], argv[3]); mobject_server_register(mid, argv[2]);
margo_wait_for_finalize(mid); margo_wait_for_finalize(mid);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment