Skip to content

opal: replace opal_convert_jobid_to_string with opal_snprintf_jobid #1302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions opal/mca/pmix/external/pmix_ext_server_north.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2015 Research Organization for Information Science
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014-2015 Mellanox Technologies, Inc.
* All rights reserved.
Expand Down Expand Up @@ -415,7 +415,7 @@ static void opal_lkupcbfunc(int status,
n=0;
OPAL_LIST_FOREACH(p, data, opal_pmix_pdata_t) {
/* convert the jobid */
(void)snprintf(d[n].proc.nspace, PMIX_MAX_NSLEN, "%s", opal_convert_jobid_to_string(p->proc.jobid));
(void)opal_snprintf_jobid(d[n].proc.nspace, PMIX_MAX_NSLEN, p->proc.jobid);
d[n].proc.rank = p->proc.vpid;
(void)strncpy(d[n].key, p->value.key, PMIX_MAX_KEYLEN);
pmix1_value_load(&d[n].value, &p->value);
Expand Down Expand Up @@ -534,7 +534,7 @@ static void opal_spncbfunc(int status, opal_jobid_t jobid, void *cbdata)
if (NULL != opalcaddy->spwncbfunc) {
rc = pmix1_convert_opalrc(status);
/* convert the jobid */
(void)snprintf(nspace, PMIX_MAX_NSLEN, "%s", opal_convert_jobid_to_string(jobid));
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid);
opalcaddy->spwncbfunc(rc, nspace, opalcaddy->cbdata);
}
OBJ_RELEASE(opalcaddy);
Expand Down
14 changes: 7 additions & 7 deletions opal/mca/pmix/external/pmix_ext_server_south.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2015 Research Organization for Information Science
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Mellanox Technologies, Inc.
Expand Down Expand Up @@ -209,7 +209,7 @@ int pmix1_server_register_nspace(opal_jobid_t jobid,
opal_pmix1_jobid_trkr_t *job;

/* convert the jobid */
(void)snprintf(nspace, PMIX_MAX_NSLEN, opal_convert_jobid_to_string(jobid));
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid);

/* store this job in our list of known nspaces */
job = OBJ_NEW(opal_pmix1_jobid_trkr_t);
Expand Down Expand Up @@ -295,7 +295,7 @@ int pmix1_server_register_client(const opal_process_name_t *proc,
op->cbdata = cbdata;

/* convert the jobid */
(void)strncpy(op->p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, proc->jobid);
op->p.rank = proc->vpid;

rc = PMIx_server_register_client(&op->p, uid, gid, server_object,
Expand Down Expand Up @@ -330,7 +330,7 @@ int pmix1_server_setup_fork(const opal_process_name_t *proc, char ***env)
pmix_proc_t p;

/* convert the jobid */
(void)strncpy(p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
(void)opal_snprintf_jobid(p.nspace, PMIX_MAX_NSLEN, proc->jobid);
p.rank = proc->vpid;

rc = PMIx_server_setup_fork(&p, env);
Expand Down Expand Up @@ -364,7 +364,7 @@ int pmix1_server_dmodex(const opal_process_name_t *proc,
op->cbdata = cbdata;

/* convert the jobid */
(void)strncpy(op->p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, proc->jobid);
op->p.rank = proc->vpid;

/* find the internally-cached data for this proc */
Expand Down Expand Up @@ -395,7 +395,7 @@ int pmix1_server_notify_error(int status,
PMIX_PROC_CREATE(ps, psz);
n = 0;
OPAL_LIST_FOREACH(nm, procs, opal_namelist_t) {
(void)snprintf(ps[n].nspace, PMIX_MAX_NSLEN, opal_convert_jobid_to_string(nm->name.jobid));
(void)opal_snprintf_jobid(ps[n].nspace, PMIX_MAX_NSLEN, nm->name.jobid);
ps[n].rank = (int)nm->name.vpid;
++n;
}
Expand All @@ -408,7 +408,7 @@ int pmix1_server_notify_error(int status,
PMIX_PROC_CREATE(eps, esz);
n = 0;
OPAL_LIST_FOREACH(nm, error_procs, opal_namelist_t) {
(void)snprintf(eps[n].nspace, PMIX_MAX_NSLEN, opal_convert_jobid_to_string(nm->name.jobid));
(void)opal_snprintf_jobid(eps[n].nspace, PMIX_MAX_NSLEN, nm->name.jobid);
eps[n].rank = (int)nm->name.vpid;
++n;
}
Expand Down
6 changes: 3 additions & 3 deletions opal/mca/pmix/pmix112/pmix1_server_north.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2015 Research Organization for Information Science
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014 Mellanox Technologies, Inc.
* All rights reserved.
Expand Down Expand Up @@ -415,7 +415,7 @@ static void opal_lkupcbfunc(int status,
n=0;
OPAL_LIST_FOREACH(p, data, opal_pmix_pdata_t) {
/* convert the jobid */
(void)snprintf(d[n].proc.nspace, PMIX_MAX_NSLEN, "%s", opal_convert_jobid_to_string(p->proc.jobid));
(void)opal_snprintf_jobid(d[n].proc.nspace, PMIX_MAX_NSLEN, p->proc.jobid);
d[n].proc.rank = p->proc.vpid;
(void)strncpy(d[n].key, p->value.key, PMIX_MAX_KEYLEN);
pmix1_value_load(&d[n].value, &p->value);
Expand Down Expand Up @@ -534,7 +534,7 @@ static void opal_spncbfunc(int status, opal_jobid_t jobid, void *cbdata)
if (NULL != opalcaddy->spwncbfunc) {
rc = pmix1_convert_opalrc(status);
/* convert the jobid */
(void)snprintf(nspace, PMIX_MAX_NSLEN, "%s", opal_convert_jobid_to_string(jobid));
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid);
opalcaddy->spwncbfunc(rc, nspace, opalcaddy->cbdata);
}
OBJ_RELEASE(opalcaddy);
Expand Down
14 changes: 7 additions & 7 deletions opal/mca/pmix/pmix112/pmix1_server_south.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2015 Research Organization for Information Science
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014 Mellanox Technologies, Inc.
* All rights reserved.
Expand Down Expand Up @@ -197,7 +197,7 @@ int pmix1_server_register_nspace(opal_jobid_t jobid,
opal_pmix1_jobid_trkr_t *job;

/* convert the jobid */
(void)snprintf(nspace, PMIX_MAX_NSLEN, opal_convert_jobid_to_string(jobid));
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid);

/* store this job in our list of known nspaces */
job = OBJ_NEW(opal_pmix1_jobid_trkr_t);
Expand Down Expand Up @@ -283,7 +283,7 @@ int pmix1_server_register_client(const opal_process_name_t *proc,
op->cbdata = cbdata;

/* convert the jobid */
(void)strncpy(op->p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, proc->jobid);
op->p.rank = proc->vpid;

rc = PMIx_server_register_client(&op->p, uid, gid, server_object,
Expand Down Expand Up @@ -318,7 +318,7 @@ int pmix1_server_setup_fork(const opal_process_name_t *proc, char ***env)
pmix_proc_t p;

/* convert the jobid */
(void)strncpy(p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
(void)opal_snprintf_jobid(p.nspace, PMIX_MAX_NSLEN, proc->jobid);
p.rank = proc->vpid;

rc = PMIx_server_setup_fork(&p, env);
Expand Down Expand Up @@ -352,7 +352,7 @@ int pmix1_server_dmodex(const opal_process_name_t *proc,
op->cbdata = cbdata;

/* convert the jobid */
(void)strncpy(op->p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, proc->jobid);
op->p.rank = proc->vpid;

/* find the internally-cached data for this proc */
Expand Down Expand Up @@ -383,7 +383,7 @@ int pmix1_server_notify_error(int status,
PMIX_PROC_CREATE(ps, psz);
n = 0;
OPAL_LIST_FOREACH(nm, procs, opal_namelist_t) {
(void)snprintf(ps[n].nspace, PMIX_MAX_NSLEN, opal_convert_jobid_to_string(nm->name.jobid));
(void)opal_snprintf_jobid(ps[n].nspace, PMIX_MAX_NSLEN, nm->name.jobid);
ps[n].rank = (int)nm->name.vpid;
++n;
}
Expand All @@ -396,7 +396,7 @@ int pmix1_server_notify_error(int status,
PMIX_PROC_CREATE(eps, esz);
n = 0;
OPAL_LIST_FOREACH(nm, error_procs, opal_namelist_t) {
(void)snprintf(eps[n].nspace, PMIX_MAX_NSLEN, opal_convert_jobid_to_string(nm->name.jobid));
(void)opal_snprintf_jobid(eps[n].nspace, PMIX_MAX_NSLEN, nm->name.jobid);
eps[n].rank = (int)nm->name.vpid;
++n;
}
Expand Down
6 changes: 3 additions & 3 deletions opal/mca/pmix/pmix120/pmix120_server_north.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2015 Research Organization for Information Science
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014 Mellanox Technologies, Inc.
* All rights reserved.
Expand Down Expand Up @@ -415,7 +415,7 @@ static void opal_lkupcbfunc(int status,
n=0;
OPAL_LIST_FOREACH(p, data, opal_pmix_pdata_t) {
/* convert the jobid */
(void)snprintf(d[n].proc.nspace, PMIX_MAX_NSLEN, "%s", opal_convert_jobid_to_string(p->proc.jobid));
(void)opal_snprintf_jobid(d[n].proc.nspace, PMIX_MAX_NSLEN, p->proc.jobid);
d[n].proc.rank = p->proc.vpid;
(void)strncpy(d[n].key, p->value.key, PMIX_MAX_KEYLEN);
pmix120_value_load(&d[n].value, &p->value);
Expand Down Expand Up @@ -534,7 +534,7 @@ static void opal_spncbfunc(int status, opal_jobid_t jobid, void *cbdata)
if (NULL != opalcaddy->spwncbfunc) {
rc = pmix120_convert_opalrc(status);
/* convert the jobid */
(void)snprintf(nspace, PMIX_MAX_NSLEN, "%s", opal_convert_jobid_to_string(jobid));
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid);
opalcaddy->spwncbfunc(rc, nspace, opalcaddy->cbdata);
}
OBJ_RELEASE(opalcaddy);
Expand Down
14 changes: 7 additions & 7 deletions opal/mca/pmix/pmix120/pmix120_server_south.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2015 Research Organization for Information Science
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014 Mellanox Technologies, Inc.
* All rights reserved.
Expand Down Expand Up @@ -140,7 +140,7 @@ int pmix120_server_register_nspace(opal_jobid_t jobid,
opal_pmix120_jobid_trkr_t *job;

/* convert the jobid */
(void)snprintf(nspace, PMIX_MAX_NSLEN, opal_convert_jobid_to_string(jobid));
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid);

/* store this job in our list of known nspaces */
job = OBJ_NEW(opal_pmix120_jobid_trkr_t);
Expand Down Expand Up @@ -226,7 +226,7 @@ int pmix120_server_register_client(const opal_process_name_t *proc,
op->cbdata = cbdata;

/* convert the jobid */
(void)strncpy(op->p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, proc->jobid);
op->p.rank = proc->vpid;

rc = PMIx_server_register_client(&op->p, uid, gid, server_object,
Expand Down Expand Up @@ -261,7 +261,7 @@ int pmix120_server_setup_fork(const opal_process_name_t *proc, char ***env)
pmix_proc_t p;

/* convert the jobid */
(void)strncpy(p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
(void)opal_snprintf_jobid(p.nspace, PMIX_MAX_NSLEN, proc->jobid);
p.rank = proc->vpid;

rc = PMIx_server_setup_fork(&p, env);
Expand Down Expand Up @@ -295,7 +295,7 @@ int pmix120_server_dmodex(const opal_process_name_t *proc,
op->cbdata = cbdata;

/* convert the jobid */
(void)strncpy(op->p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, proc->jobid);
op->p.rank = proc->vpid;

/* find the internally-cached data for this proc */
Expand Down Expand Up @@ -326,7 +326,7 @@ int pmix120_server_notify_error(int status,
PMIX_PROC_CREATE(ps, psz);
n = 0;
OPAL_LIST_FOREACH(nm, procs, opal_namelist_t) {
(void)snprintf(ps[n].nspace, PMIX_MAX_NSLEN, opal_convert_jobid_to_string(nm->name.jobid));
(void)opal_snprintf_jobid(ps[n].nspace, PMIX_MAX_NSLEN, nm->name.jobid);
ps[n].rank = (int)nm->name.vpid;
++n;
}
Expand All @@ -339,7 +339,7 @@ int pmix120_server_notify_error(int status,
PMIX_PROC_CREATE(eps, esz);
n = 0;
OPAL_LIST_FOREACH(nm, error_procs, opal_namelist_t) {
(void)snprintf(eps[n].nspace, PMIX_MAX_NSLEN, opal_convert_jobid_to_string(nm->name.jobid));
(void)opal_snprintf_jobid(eps[n].nspace, PMIX_MAX_NSLEN, nm->name.jobid);
eps[n].rank = (int)nm->name.vpid;
++n;
}
Expand Down
9 changes: 4 additions & 5 deletions opal/util/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* reserved.
* Copyright (c) 2013 Inria. All rights reserved.
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
Expand Down Expand Up @@ -154,10 +154,9 @@ static int opal_convert_process_name_to_string_should_never_be_called(char** nam
return OPAL_ERR_NOT_SUPPORTED;
}

static char* opal_convert_jobid_to_string_should_never_be_called(opal_jobid_t jobid)
static int opal_snprintf_jobid_should_never_be_called(char* name_string, size_t size, opal_jobid_t jobid)
{
char *str = strdup("My JOBID");
return str;
return strncpy(name_string, "My JOBID", size);
}

static int opal_convert_string_to_jobid_should_never_be_called(opal_jobid_t *jobid, const char *jobid_string)
Expand All @@ -175,7 +174,7 @@ char* (*opal_vpid_print)(const opal_vpid_t) = opal_vpid_print_should_never_be_ca
char* (*opal_jobid_print)(const opal_jobid_t) = opal_jobid_print_should_never_be_called;
int (*opal_convert_string_to_process_name)(opal_process_name_t *name, const char* name_string) = opal_convert_string_to_process_name_should_never_be_called;
int (*opal_convert_process_name_to_string)(char** name_string, const opal_process_name_t *name) = opal_convert_process_name_to_string_should_never_be_called;
char* (*opal_convert_jobid_to_string)(opal_jobid_t jobid) = opal_convert_jobid_to_string_should_never_be_called;
int (*opal_snprintf_jobid)(char* name_string, size_t size, opal_jobid_t jobid) = opal_snprintf_jobid_should_never_be_called;
int (*opal_convert_string_to_jobid)(opal_jobid_t *jobid, const char *jobid_string) = opal_convert_string_to_jobid_should_never_be_called;
struct opal_proc_t *(*opal_proc_for_name) (const opal_process_name_t name) = opal_proc_for_name_should_never_be_called;

Expand Down
4 changes: 2 additions & 2 deletions opal/util/proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* reserved.
* Copyright (c) 2013 Inria. All rights reserved.
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -133,7 +133,7 @@ OPAL_DECLSPEC extern int (*opal_convert_process_name_to_string)(char** name_stri
const opal_process_name_t *name);
OPAL_DECLSPEC extern char* (*opal_vpid_print)(const opal_vpid_t);
OPAL_DECLSPEC extern char* (*opal_jobid_print)(const opal_jobid_t);
OPAL_DECLSPEC extern char* (*opal_convert_jobid_to_string)(opal_jobid_t jobid);
OPAL_DECLSPEC extern int (*opal_snprintf_jobid)(char* name_string, size_t size, opal_jobid_t jobid);
OPAL_DECLSPEC extern int (*opal_convert_string_to_jobid)(opal_jobid_t *jobid, const char *jobid_string);

/**
Expand Down
4 changes: 2 additions & 2 deletions orte/orted/pmix/pmix_server_dyn.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -413,7 +413,7 @@ static void _cnct(int sd, short args, void *cbdata)
}
/* ask the global data server for the data - if we get it,
* then we can complete the request */
key = opal_convert_jobid_to_string(nm->name.jobid);
orte_util_convert_jobid_to_string(&key, nm->name.jobid);
opal_argv_append_nosize(&keys, key);
free(key);
if (ORTE_SUCCESS != (rc = pmix_server_lookup_fn(&nm->name, keys, cd->info, _cnlk, cd))) {
Expand Down
12 changes: 2 additions & 10 deletions orte/runtime/orte_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007-2008 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2015 Research Organization for Information Science
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
*
* $COPYRIGHT$
Expand Down Expand Up @@ -97,14 +97,6 @@ static int _convert_process_name_to_string(char** name_string,
return orte_util_convert_process_name_to_string(name_string, name);
}

static char*
_convert_jobid_to_string(opal_jobid_t jobid)
{
char *str;
orte_util_convert_jobid_to_string(&str, jobid);
return str;
}

static int
_convert_string_to_jobid(opal_jobid_t *jobid, const char *jobid_string)
{
Expand Down Expand Up @@ -156,7 +148,7 @@ int orte_init(int* pargc, char*** pargv, orte_proc_type_t flags)
opal_compare_proc = _process_name_compare;
opal_convert_string_to_process_name = _convert_string_to_process_name;
opal_convert_process_name_to_string = _convert_process_name_to_string;
opal_convert_jobid_to_string = _convert_jobid_to_string;
opal_snprintf_jobid = orte_util_snprintf_jobid;
opal_convert_string_to_jobid = _convert_string_to_jobid;

/* initialize the opal layer */
Expand Down
Loading