search for: nbd_get_list_export_name

Displaying 11 results from an estimated 11 matches for "nbd_get_list_export_name".

2020 Aug 18
0
[libnbd PATCH v3 2/2] api: Add nbd_aio_opt_list
...n only be used if L<nbd_set_opt_mode(3)> enabled option mode. -In this mode, during connection we query the server for the list -of NBD exports and collect them in the handle. You can query -the list of exports provided by the server by calling -L<nbd_get_nr_list_exports(3)> and L<nbd_get_list_export_name(3)>. -After choosing the export you want, set the export name -(L<nbd_set_export_name(3)>), then finish connecting with L<nbd_opt_go(3)>. +The <list> function is called once per advertised export, with any +C<user_data> passed to this function, and with C<name> and...
2020 Aug 18
3
[libnbd PATCH v3 0/2] Implementing NBD_OPT_LIST
This is a subset of my v2 posting, but limited to just the NBD_OPT_LIST handling. The biggest change since v2 is the addition of added unit testing in all four language bindings (C, python, ocaml, golang). The tests require nbdkit built from git on PATH, and may not be entirely idiomatic, but I at least validated that they catch issues (for example, adding an exit statement near the end of the
2020 Aug 14
0
[libnbd PATCH v2 11/13] api: Add nbd_aio_opt_list
...n only be used if L<nbd_set_opt_mode(3)> enabled option mode. -In this mode, during connection we query the server for the list -of NBD exports and collect them in the handle. You can query -the list of exports provided by the server by calling -L<nbd_get_nr_list_exports(3)> and L<nbd_get_list_export_name(3)>. -After choosing the export you want, set the export name -(L<nbd_set_export_name(3)>), then finish connecting with L<nbd_opt_go(3)>. +The <list> function is called once per advertised export, with any +C<user_data> passed to this function, and with C<name> and...
2020 Jul 29
3
[libnbd PATCH 0/2] Expose export description
An incremental improvement on top of listing exports. I still think it's worth experimenting with revisiting how our API for list mode should actually work [1] (so that we can reuse a single connection for both grabbing the list and finally using NBD_OPT_GO), but this change was easier to whip together while still thinking about that. [1]
2020 Jul 20
2
[PATCH libnbd PROPOSAL] Add APIs for listing exports from an NBD server.
Proposal for new APIs to list exports. The general shape of the API can probably best be seen from the examples/list-exports.c example. Rich.
2020 Aug 14
0
[libnbd PATCH v2 09/13] info: Simplify by using nbd_opt_go
...nt == -1) { @@ -434,49 +432,38 @@ list_all_exports (struct nbd_handle *nbd1, const char *uri) printf ("\t\"exports\": []\n"); for (i = 0; i < count; ++i) { - char *name, *desc, *new_path, *new_uri; + char *name, *desc; struct nbd_handle *nbd2; name = nbd_get_list_export_name (nbd1, i); - if (name) { - /* We have to modify the original URI to change the export name. - * In the URI spec, paths always start with '/' (which is ignored). - */ - xmluri = xmlParseURI (uri); - if (!xmluri) { - fprintf (stderr, "unable to parse...
2020 Jul 29
0
[libnbd PATCH 2/2] info: Expose description in list mode
...t); @@ -402,7 +411,7 @@ list_all_exports (struct nbd_handle *nbd1, const char *uri) xmlURIPtr xmluri = NULL; for (i = 0; i < nbd_get_nr_list_exports (nbd1); ++i) { - char *name, *new_path, *new_uri; + char *name, *desc, *new_path, *new_uri; struct nbd_handle *nbd2; name = nbd_get_list_export_name (nbd1, i); @@ -437,10 +446,12 @@ list_all_exports (struct nbd_handle *nbd1, const char *uri) } /* List the metadata of this export. */ - list_one_export (nbd2); + desc = nbd_get_list_export_description (nbd1, i); + list_one_export (nbd2, desc); nbd_close (nbd2)...
2020 Jul 20
0
[PATCH libnbd PROPOSAL] Add APIs for listing exports from an NBD server.
..._get_nr_list_exports (nbd) == 0) { + fprintf (stderr, "Server does not support " + "listing exports.\n"); + exit (EXIT_FAILURE); + } + + /* Display the list of exports. */ + for (i = 0; + i < nbd_get_nr_list_exports (nbd); + i++) { + name = nbd_get_list_export_name (nbd, i); + printf ("[%d] %s\n", i, name); + free (name); + } + printf ("Which export to connect to? "); + if (scanf ("%d", &i) != 1) exit (EXIT_FAILURE); + name = nbd_get_list_export_name (nbd, i); + printf ("Connecting to %s ...\n", name); +...
2020 Jul 20
2
Re: [PATCH libnbd PROPOSAL] Add APIs for listing exports from an NBD server.
...tf (stderr, "Server does not support " > + "listing exports.\n"); > + exit (EXIT_FAILURE); > + } > + > + /* Display the list of exports. */ > + for (i = 0; > + i < nbd_get_nr_list_exports (nbd); > + i++) { > + name = nbd_get_list_export_name (nbd, i); > + printf ("[%d] %s\n", i, name); > + free (name); > + } Looks like a pretty simple way to do the iteration. > + printf ("Which export to connect to? "); > + if (scanf ("%d", &i) != 1) exit (EXIT_FAILURE); scanf("%d")...
2020 Aug 14
18
[libnbd PATCH v2 00/13] Adding nbd_set_opt_mode to improve nbdinfo
Well, I'm not quite done (I still want to get nbdinfo to work on a single nbd connection for all cases when reading the heads of the file is not required), but I'm happy with patches 1-11, and 12-13 show where I'm headed for getting NBD_OPT_INFO to work. Posting now to see if some of the earlier patches are ready to commit while I continue working on the latter half. Eric Blake (13):
2020 Aug 11
3
[libnbd PATCH] API: Add nbd_set_opt_mode to expose NEGOTIATING state
...onnect to? "); if (scanf ("%d", &i) != 1) exit (EXIT_FAILURE); + if (i == -1) { + if (nbd_opt_abort (nbd) == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + exit (EXIT_FAILURE); + } + nbd_close (nbd); + exit (EXIT_SUCCESS); + } name = nbd_get_list_export_name (nbd, i); + if (name == NULL) { + fprintf (stderr, "%s\n", nbd_get_error ()); + exit (EXIT_FAILURE); + } printf ("Connecting to %s ...\n", name); - nbd_close (nbd); - /* Connect again to the chosen export. */ - nbd2 = nbd_create (); - if (nbd2 == NULL) { + /* Re...