NAME

nbdkit_export_name - get the NBD export name for nbdkit

SYNOPSIS

 #include <nbdkit-plugin.h>

 const char *nbdkit_export_name (void);

DESCRIPTION

Return the optional NBD export name if one was negotiated with the current client (this uses thread-local magic so no parameter is required).

The export name is a free-form text string, it is not necessarily a path or filename and it does not need to begin with a '/' character. The NBD protocol describes the empty string ("") as a representing a "default export" or to be used in cases where the export name does not make sense.

The export name is untrusted client data, be cautious when parsing it.

RETURN VALUE

The function returns a string. The returned string is valid at least through the .close of the current connection, but if you need to store it in the plugin for use by more than one client you must copy it.

If there is an error it calls nbdkit_error(3) and returns NULL.

LANGUAGE BINDINGS

In nbdkit-ocaml-plugin(3):

 NBDKit.export_name : unit -> string

In nbdkit-python-plugin(3):

 import nbdkit
 name = nbdkit.export_name()

In nbdkit-rust-plugin(3):

 use nbdkit::*;
 pub fn export_name() -> std::result::Result<String, Box<dyn error::Error>>

In nbdkit-sh-plugin(3) the export name is available as parameter $3 of the open method.

HISTORY

nbdkit_export_name was added in nbdkit 1.16.

SEE ALSO

nbdkit(1), nbdkit_is_tls(3), nbdkit-plugin(3), nbdkit-filter(3).

AUTHORS

Richard W.M. Jones

COPYRIGHT

Copyright Red Hat

LICENSE

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.