[PATCH 20/35] fabrics: export arg_str(), parse_conn_arg(), and remove_ctrl()

mwilck
2021-01-26T20:35:20Z

From: Martin Wilck <mwilck@suse.com>

These functions are used by the monitor functionality that will
be added in follow-up commits.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
fabrics.c | 6 +++---
fabrics.h | 4 ++++
2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/fabrics.c b/fabrics.c
index e3d2a3a..e2629d5 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -102,7 +102,7 @@ static const match_table_t opt_tokens = {
{ OPT_ERR, NULL },
};

-static const char *arg_str(const char * const *strings,
+const char *arg_str(const char * const *strings,
size_t array_size, size_t idx)
{
if (idx < array_size && strings[idx])
@@ -208,7 +208,7 @@ int do_discover(char *argstr, bool connect);
* If field found, return string containing field value. If field
* not found, return an empty string.
*/
-static char *parse_conn_arg(char *conargs, const char delim, const char *field)
+char *parse_conn_arg(char *conargs, const char delim, const char *field)
{
char *s, *e;
size_t cnt;
@@ -476,7 +476,7 @@ out:
return ret;
}

-static int remove_ctrl(int instance)
+int remove_ctrl(int instance)
{
char *sysfs_path;
int ret;
diff --git a/fabrics.h b/fabrics.h
index 1dfbd67..ddc7423 100644
--- a/fabrics.h
+++ b/fabrics.h
@@ -12,6 +12,8 @@ extern int fabrics_disconnect_all(const char *desc, int argc, char **argv);

/* Symbols used by monitor.c */

+const char *arg_str(const char * const *strings, size_t array_size, size_t idx);
+
struct config {
const char *nqn;
const char *transport;
@@ -44,5 +46,7 @@ extern struct config cfg;
int build_options(char *argstr, int max_len, bool discover);
int do_discover(char *argstr, bool connect);
int ctrl_instance(const char *device);
+char *parse_conn_arg(char *conargs, const char delim, const char *field);
+int remove_ctrl(int instance);

#endif
--
2.29.2