nbdkit_export_name - get the NBD export name for nbdkit
#include <nbdkit-plugin.h>
const char *nbdkit_export_name (void);
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.
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
.
NBDKit.export_name : unit -> string
import nbdkit
name = nbdkit.export_name()
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.
nbdkit_export_name
was added in nbdkit 1.16.
nbdkit(1), nbdkit_is_tls(3), nbdkit-plugin(3), nbdkit-filter(3).
Richard W.M. Jones
Copyright Red Hat
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of Red Hat nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
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.