1nbd_block_status_filter(3) LIBNBD nbd_block_status_filter(3)
2
3
4
6 nbd_block_status_filter - send filtered block status command, with
7 64-bit callback
8
10 #include <libnbd.h>
11
12 typedef struct {
13 int (*callback) (void *user_data,
14 const char *metacontext,
15 uint64_t offset, nbd_extent *entries,
16 size_t nr_entries, int *error);
17 void *user_data;
18 void (*free) (void *user_data);
19 } nbd_extent64_callback;
20
21 int nbd_block_status_filter (
22 struct nbd_handle *h, uint64_t count,
23 uint64_t offset, char **contexts,
24 nbd_extent64_callback extent64_callback,
25 uint32_t flags
26 );
27
29 Issue a filtered block status command to the NBD server. If supported
30 by the server (see nbd_can_block_status_payload(3)), this causes
31 metadata context information about blocks beginning from the specified
32 offset to be returned, and with the result limited to just the contexts
33 specified in "filter". Note that all strings in "filter" must be
34 supported by nbd_can_meta_context(3).
35
36 All other parameters to this function have the same semantics as in
37 nbd_block_status_64(3); except that for convenience, unless
38 <nbd_set_strict_flags(3)> was used to disable
39 "LIBNBD_STRICT_AUTO_FLAG", libnbd ignores the presence or absence of
40 the flag "LIBNBD_CMD_FLAG_PAYLOAD_LEN" in "flags", while correctly
41 using the flag over the wire.
42
43 By default, libnbd will reject attempts to use this function with
44 parameters that are likely to result in server failure, such as
45 requesting an unknown command flag. The nbd_set_strict_mode(3)
46 function can be used to alter which scenarios should await a server
47 reply rather than failing fast.
48
50 If the call is successful the function returns 0.
51
53 On error -1 is returned.
54
55 Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
56 of the error.
57
58 The following parameters must not be NULL: "h", "contexts". For more
59 information see "Non-NULL parameters" in libnbd(3).
60
62 The handle must be connected with the server, otherwise this call will
63 return an error.
64
66 This function first appeared in libnbd 1.18.
67
68 If you need to test if this function is available at compile time check
69 if the following macro is defined:
70
71 #define LIBNBD_HAVE_NBD_BLOCK_STATUS_FILTER 1
72
74 nbd_aio_block_status_filter(3), nbd_block_status_64(3),
75 nbd_can_block_status_payload(3), nbd_can_meta_context(3),
76 nbd_create(3), nbd_set_strict_mode(3), libnbd(3).
77
79 Eric Blake
80
81 Richard W.M. Jones
82
84 Copyright Red Hat
85
87 This library is free software; you can redistribute it and/or modify it
88 under the terms of the GNU Lesser General Public License as published
89 by the Free Software Foundation; either version 2 of the License, or
90 (at your option) any later version.
91
92 This library is distributed in the hope that it will be useful, but
93 WITHOUT ANY WARRANTY; without even the implied warranty of
94 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
95 Lesser General Public License for more details.
96
97 You should have received a copy of the GNU Lesser General Public
98 License along with this library; if not, write to the Free Software
99 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
100 02110-1301 USA
101
102
103
104libnbd-1.18.1 2023-10-31 nbd_block_status_filter(3)