Skip to content
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
8 changes: 4 additions & 4 deletions fabrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ int fabrics_discovery(const char *desc, int argc, char **argv, bool connect)

out_free:
if (dump_config)
nvme_dump_config(ctx);
nvme_dump_config(ctx, NULL);

return ret;
}
Expand Down Expand Up @@ -714,7 +714,7 @@ int fabrics_connect(const char *desc, int argc, char **argv)
}

if (dump_config)
nvme_dump_config(ctx);
nvme_dump_config(ctx, NULL);

return 0;
}
Expand Down Expand Up @@ -1029,10 +1029,10 @@ int fabrics_config(const char *desc, int argc, char **argv)
}

if (update_config)
nvme_update_config(ctx);
nvme_dump_config(ctx, config_file);

if (dump_config)
nvme_dump_config(ctx);
nvme_dump_config(ctx, NULL);

return 0;
}
Expand Down
5 changes: 1 addition & 4 deletions libnvme/libnvme/nvme.i
Original file line number Diff line number Diff line change
Expand Up @@ -528,11 +528,8 @@ struct nvme_ns {
void refresh_topology() {
nvme_refresh_topology($self);
}
void update_config() {
nvme_update_config($self);
}
void dump_config() {
nvme_dump_config($self);
nvme_dump_config($self, NULL);
}
}

Expand Down
20 changes: 10 additions & 10 deletions libnvme/scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,18 @@ if [ "$build_doc" = true ]; then
git commit -s -m "doc: Regenerate all docs for $VERSION"
fi

declare -A maps
maps=(
[src/libnvme.map]=LIBNVME
declare -A ldscripts
ldscripts=(
[src/libnvme.ld]=LIBNVME
)

lib_ver="${ver//./_}"

for map_file in "${!maps[@]}"
for ld_file in "${!ldscripts[@]}"
do
lib_name=${maps[$map_file]}
lib_name=${ldscripts[$ld_file]}

if [ ! -f "${map_file}" ]; then
if [ ! -f "${ld_file}" ]; then
continue
fi

Expand All @@ -155,16 +155,16 @@ do
in_section && $0 ~ /\}/ { exit }
in_section && $0 !~ /^[[:space:]]*($|\/|\/\*|\*|#)/ { found = 1; exit }
END { exit !found }
' "${map_file}"; then
' "${ld_file}"; then
continue
fi

sed -i \
-e "s/^${lib_unreleased}\s*{/&\n};\n\n${lib_name}_${lib_ver} {/" \
"$map_file"
"$ld_file"

git add "${map_file}"
echo "${map_file} updated."
git add "${ld_file}"
echo "${ld_file} updated."
done

# update meson.build
Expand Down
15 changes: 5 additions & 10 deletions libnvme/src/libnvme.map → libnvme/src/libnvme.ld
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,9 @@
LIBNVME_UNRELEASED {
};

LIBNVME_1_16 {
global:
nvme_get_uuid_list;
nvme_set_etdas;
nvme_clear_etdas;
nvme_insert_tls_key_compat;
nvme_generate_tls_key_identity_compat;
};

LIBNVME_2_0 {
global:
nvme_clear_etdas;
nvme_close;
nvme_create_ctrl;
nvme_create_global_ctx;
Expand Down Expand Up @@ -83,6 +75,7 @@ LIBNVME_2_0 {
nvme_fw_download_seq;
nvme_gen_dhchap_key;
nvme_generate_tls_key_identity;
nvme_generate_tls_key_identity_compat;
nvme_get_ana_log_atomic;
nvme_get_ana_log_len;
nvme_get_ana_log_len_from_id_ctrl;
Expand All @@ -105,6 +98,7 @@ LIBNVME_2_0 {
nvme_get_subsys_attr;
nvme_get_telemetry_log;
nvme_get_telemetry_max;
nvme_get_uuid_list;
nvme_get_version;
nvme_host_get_dhchap_key;
nvme_host_get_global_ctx;
Expand All @@ -129,6 +123,7 @@ LIBNVME_2_0 {
nvme_init_dsm_range;
nvme_init_logging;
nvme_insert_tls_key;
nvme_insert_tls_key_compat;
nvme_insert_tls_key_versioned;
nvme_ipaddrs_eq;
nvme_lookup_ctrl;
Expand Down Expand Up @@ -241,6 +236,7 @@ LIBNVME_2_0 {
nvme_set_application;
nvme_set_debug;
nvme_set_dry_run;
nvme_set_etdas;
nvme_set_keyring;
nvme_set_property;
nvme_set_root;
Expand Down Expand Up @@ -279,7 +275,6 @@ LIBNVME_2_0 {
nvme_transport_handle_set_submit_entry;
nvme_transport_handle_set_submit_exit;
nvme_unlink_ctrl;
nvme_update_config;
nvme_update_key;
nvme_uuid_find;
nvme_uuid_from_string;
Expand Down
4 changes: 2 additions & 2 deletions libnvme/src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ deps = [
accessors_dep,
]

mapfile = 'libnvme.map'
ldfile = 'libnvme.ld'

libnvme = library(
'nvme', # produces libnvme.so
sources,
version: libnvme_so_version,
link_args: [
'-Wl,--version-script=@0@'.format(meson.current_source_dir() / mapfile),
'-Wl,--version-script=@0@'.format(meson.current_source_dir() / ldfile),
'-Wl,--version-script=@0@'.format(accessors_ld_full_path),
],
dependencies: deps,
Expand Down
54 changes: 27 additions & 27 deletions libnvme/src/nvme/fabrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -2141,9 +2141,9 @@ static int _nvmf_discovery(struct nvme_global_ctx *ctx,
.subsysnqn = e->subnqn,
.transport = nvmf_trtype_str(e->trtype),
.traddr = e->traddr,
.trsvcid = e->trsvcid,
.host_traddr = fctx->host_traddr,
.host_iface = fctx->host_iface,
.trsvcid = e->trsvcid,
};

/* Already connected ? */
Expand Down Expand Up @@ -2400,12 +2400,12 @@ int _discovery_config_json(struct nvme_global_ctx *ctx,
memcpy(&cfg, fctx->cfg, sizeof(cfg));

struct fabric_args trcfg = {
.subsysnqn = subsysnqn,
.transport = transport,
.traddr = traddr,
.host_traddr = host_traddr,
.host_iface = host_iface,
.trsvcid = trsvcid,
.subsysnqn = subsysnqn,
.transport = transport,
.traddr = traddr,
.trsvcid = trsvcid,
.host_traddr = host_traddr,
.host_iface = host_iface,
};

if (!force) {
Expand Down Expand Up @@ -2561,12 +2561,12 @@ int nvmf_discovery_config_file(struct nvme_global_ctx *ctx,
break;

struct fabric_args trcfg = {
.transport = fctx->transport,
.traddr = fctx->traddr,
.trsvcid = fctx->trsvcid,
.subsysnqn = fctx->subsysnqn,
.host_traddr = fctx->host_traddr,
.host_iface = fctx->host_iface,
.subsysnqn = fctx->subsysnqn,
.transport = fctx->transport,
.traddr = fctx->traddr,
.trsvcid = fctx->trsvcid,
.host_traddr = fctx->host_traddr,
.host_iface = fctx->host_iface,
};

if (!force) {
Expand Down Expand Up @@ -2929,9 +2929,9 @@ int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
.subsysnqn = (*ss)->subsys_nqn,
.transport = (*ss)->transport,
.traddr = (*ss)->traddr,
.trsvcid = (*ss)->trsvcid,
.host_traddr = host_traddr,
.host_iface = NULL,
.trsvcid = (*ss)->trsvcid,
};

rr = nbft_connect(ctx, fctx, h, NULL,
Expand Down Expand Up @@ -3019,9 +3019,9 @@ int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
.subsysnqn = NVME_DISC_SUBSYS_NAME,
.transport = uri->protocol,
.traddr = uri->host,
.trsvcid = trsvcid,
.host_traddr = host_traddr,
.host_iface = NULL,
.trsvcid = trsvcid,
};

/* Lookup existing discovery controller */
Expand Down Expand Up @@ -3224,12 +3224,12 @@ int nvmf_discovery(struct nvme_global_ctx *ctx, struct nvmf_context *fctx,
}

struct fabric_args trcfg = {
.subsysnqn = fctx->subsysnqn,
.transport = fctx->transport,
.traddr = fctx->traddr,
.host_traddr = fctx->host_traddr,
.host_iface = fctx->host_iface,
.trsvcid = fctx->trsvcid,
.subsysnqn = fctx->subsysnqn,
.transport = fctx->transport,
.traddr = fctx->traddr,
.trsvcid = fctx->trsvcid,
.host_traddr = fctx->host_traddr,
.host_iface = fctx->host_iface,
};

if (!c && !force) {
Expand Down Expand Up @@ -3301,12 +3301,12 @@ int nvmf_connect(struct nvme_global_ctx *ctx, struct nvmf_context *fctx)
return err;

struct fabric_args trcfg = {
.subsysnqn = fctx->subsysnqn,
.transport = fctx->transport,
.traddr = fctx->traddr,
.host_traddr = fctx->host_traddr,
.host_iface = fctx->host_iface,
.trsvcid = fctx->trsvcid,
.subsysnqn = fctx->subsysnqn,
.transport = fctx->transport,
.traddr = fctx->traddr,
.trsvcid = fctx->trsvcid,
.host_traddr = fctx->host_traddr,
.host_iface = fctx->host_iface,
};

c = lookup_ctrl(h, &trcfg);
Expand Down
3 changes: 1 addition & 2 deletions libnvme/src/nvme/private.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ struct nvme_global_ctx {
struct list_head endpoints; /* MI endpoints */
struct list_head hosts;
struct nvme_log log;
bool modified;
bool mi_probe_enabled;
bool create_only;
bool dry_run;
Expand Down Expand Up @@ -377,9 +376,9 @@ struct fabric_args {
const char *subsysnqn;
const char *transport;
const char *traddr;
const char *trsvcid;
const char *host_traddr;
const char *host_iface;
const char *trsvcid;
};

int nvme_set_attr(const char *dir, const char *attr, const char *value);
Expand Down
16 changes: 2 additions & 14 deletions libnvme/src/nvme/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,17 +404,9 @@ int nvme_scan(const char *config_file, struct nvme_global_ctx **ctxp)
return ret;
}

int nvme_update_config(struct nvme_global_ctx *ctx)
int nvme_dump_config(struct nvme_global_ctx *ctx, const char *config_file)
{
if (!ctx->modified || !ctx->config_file)
return 0;

return json_update_config(ctx, ctx->config_file);
}

int nvme_dump_config(struct nvme_global_ctx *ctx)
{
return json_update_config(ctx, NULL);
return json_update_config(ctx, config_file);
}

int nvme_dump_tree(struct nvme_global_ctx *ctx)
Expand Down Expand Up @@ -717,7 +709,6 @@ struct nvme_subsystem *nvme_alloc_subsystem(struct nvme_host *h,
list_head_init(&s->namespaces);
list_node_init(&s->entry);
list_add_tail(&h->subsystems, &s->entry);
h->ctx->modified = true;
return s;
}

Expand Down Expand Up @@ -756,7 +747,6 @@ static void __nvme_free_host(struct nvme_host *h)
free(h->hostid);
free(h->dhchap_key);
nvme_host_set_hostsymname(h, NULL);
h->ctx->modified = true;
free(h);
}

Expand Down Expand Up @@ -799,7 +789,6 @@ struct nvme_host *nvme_lookup_host(struct nvme_global_ctx *ctx, const char *host
list_node_init(&h->entry);
h->ctx = ctx;
list_add_tail(&ctx->hosts, &h->entry);
ctx->modified = true;

return h;
}
Expand Down Expand Up @@ -1870,7 +1859,6 @@ nvme_ctrl_t nvme_lookup_ctrl(nvme_subsystem_t s, const char *transport,

c->s = s;
list_add_tail(&s->ctrls, &c->entry);
s->h->ctx->modified = true;

return c;
}
Expand Down
16 changes: 4 additions & 12 deletions libnvme/src/nvme/tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -1453,26 +1453,18 @@ int nvme_read_config(struct nvme_global_ctx *ctx, const char *config_file);
*/
void nvme_refresh_topology(struct nvme_global_ctx *ctx);

/**
* nvme_update_config() - Update JSON configuration
* @ctx: &struct nvme_global_ctx object
*
* Updates the JSON configuration file with the contents of @r.
*
* Return: 0 on success, -1 on failure.
*/
int nvme_update_config(struct nvme_global_ctx *ctx);

/**
* nvme_dump_config() - Print the JSON configuration
* @ctx: &struct nvme_global_ctx object
* @config_file: JSON configuration file.
*
* Prints the current contents of the JSON configuration
* file to stdout.
* file to the config_file. If connfig_file is not provided it prints
* to stdout.
*
* Return: 0 on success, or negative error code otherwise.
*/
int nvme_dump_config(struct nvme_global_ctx *ctx);
int nvme_dump_config(struct nvme_global_ctx *ctx, const char *config_file);

/**
* nvme_dump_tree() - Dump internal object tree
Expand Down
Loading