Navigation Menu

Skip to content

Commit

Permalink
connectors/shmem: drop setopt
Browse files Browse the repository at this point in the history
Problem: with recent changes to libflux unit tests, the
options for setting test credentials in the shmem://
connector have no users.

This was added to support the back-to-back shmem://
connectors in libflux/util.c, but that module is now
standalone.
  • Loading branch information
garlick committed Nov 10, 2018
1 parent f189cf3 commit 9b16eba
Showing 1 changed file with 2 additions and 60 deletions.
62 changes: 2 additions & 60 deletions src/connectors/shmem/shmem.c
Expand Up @@ -44,8 +44,6 @@ typedef struct {
flux_t *h;
char *argz;
size_t argz_len;
uint32_t testing_userid;
uint32_t testing_rolemask;
} shmem_ctx_t;

static const struct flux_handle_ops handle_ops;
Expand Down Expand Up @@ -76,35 +74,12 @@ static int op_pollfd (void *impl)
return zsock_fd (ctx->sock);
}

static int send_testing (shmem_ctx_t *ctx, const flux_msg_t *msg)
{
flux_msg_t *cpy;
int rc = -1;

if (!(cpy = flux_msg_copy (msg, true)))
goto done;
if (flux_msg_set_userid (cpy, ctx->testing_userid) < 0)
goto done;
if (flux_msg_set_rolemask (cpy, ctx->testing_rolemask) < 0)
goto done;
rc = flux_msg_sendzsock (ctx->sock, cpy);
done:
flux_msg_destroy (cpy);
return rc;
}

static int op_send (void *impl, const flux_msg_t *msg, int flags)
{
shmem_ctx_t *ctx = impl;
assert (ctx->magic == MODHANDLE_MAGIC);
int rc;

if (ctx->testing_userid != FLUX_USERID_UNKNOWN
|| ctx->testing_rolemask != FLUX_ROLE_NONE)
rc = send_testing (ctx, msg);
else
rc = flux_msg_sendzsock (ctx->sock, msg);
return rc;
return flux_msg_sendzsock (ctx->sock, msg);
}

static flux_msg_t *op_recv (void *impl, int flags)
Expand Down Expand Up @@ -169,37 +144,6 @@ static int op_event_unsubscribe (void *impl, const char *topic)
}


static int op_setopt (void *impl, const char *option,
const void *val, size_t size)
{
shmem_ctx_t *ctx = impl;
assert (ctx->magic == MODHANDLE_MAGIC);
size_t val_size;
int rc = -1;

if (option && !strcmp (option, FLUX_OPT_TESTING_USERID)) {
val_size = sizeof (ctx->testing_userid);
if (size != val_size) {
errno = EINVAL;
goto done;
}
memcpy (&ctx->testing_userid, val, val_size);
} else if (option && !strcmp (option, FLUX_OPT_TESTING_ROLEMASK)) {
val_size = sizeof (ctx->testing_rolemask);
if (size != val_size) {
errno = EINVAL;
goto done;
}
memcpy (&ctx->testing_rolemask, val, val_size);
} else {
errno = EINVAL;
goto done;
}
rc = 0;
done:
return rc;
}

static void op_fini (void *impl)
{
shmem_ctx_t *ctx = impl;
Expand Down Expand Up @@ -235,8 +179,6 @@ flux_t *connector_init (const char *path, int flags)
goto error;
}
ctx->magic = MODHANDLE_MAGIC;
ctx->testing_userid = FLUX_USERID_UNKNOWN;
ctx->testing_rolemask = FLUX_ROLE_NONE;
if ((e = argz_create_sep (path, '&', &ctx->argz, &ctx->argz_len)) != 0) {
errno = e;
goto error;
Expand Down Expand Up @@ -285,7 +227,7 @@ static const struct flux_handle_ops handle_ops = {
.send = op_send,
.recv = op_recv,
.getopt = NULL,
.setopt = op_setopt,
.setopt = NULL,
.event_subscribe = op_event_subscribe,
.event_unsubscribe = op_event_unsubscribe,
.impl_destroy = op_fini,
Expand Down

0 comments on commit 9b16eba

Please sign in to comment.