1nbd_aio_pwrite(3) LIBNBD nbd_aio_pwrite(3)
2
3
4
6 nbd_aio_pwrite - write to the NBD server
7
9 #include <libnbd.h>
10
11 typedef struct {
12 int (*callback) (void *user_data, int *error);
13 void *user_data;
14 void (*free) (void *user_data);
15 } nbd_completion_callback;
16
17 int64_t nbd_aio_pwrite (
18 struct nbd_handle *h, const void *buf,
19 size_t count, uint64_t offset,
20 nbd_completion_callback completion_callback,
21 uint32_t flags
22 );
23
25 Issue a write command to the NBD server.
26
27 To check if the command completed, call nbd_aio_command_completed(3).
28 Or supply the optional "completion_callback" which will be invoked as
29 described in "Completion callbacks" in libnbd(3).
30
31 Note that you must ensure "buf" is valid until the command has
32 completed. Other parameters behave as documented in nbd_pwrite(3).
33
34 By default, libnbd will reject attempts to use this function with
35 parameters that are likely to result in server failure, such as
36 requesting an unknown command flag. The nbd_set_strict_mode(3)
37 function can be used to alter which scenarios should await a server
38 reply rather than failing fast.
39
41 This call returns the 64 bit cookie of the command. The cookie is ≥ 1.
42 Cookies are unique (per libnbd handle, not globally).
43
45 On error -1 is returned.
46
47 Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
48 of the error.
49
50 The following parameters must not be NULL: "h", "buf". For more
51 information see "Non-NULL parameters" in libnbd(3).
52
54 The handle must be connected with the server, otherwise this call will
55 return an error.
56
58 This function first appeared in libnbd 1.0.
59
60 If you need to test if this function is available at compile time check
61 if the following macro is defined:
62
63 #define LIBNBD_HAVE_NBD_AIO_PWRITE 1
64
66 nbd_aio_command_completed(3), nbd_create(3), nbd_is_read_only(3),
67 nbd_pwrite(3), nbd_set_strict_mode(3), "Issuing asynchronous commands"
68 in libnbd(3), libnbd(3).
69
71 Eric Blake
72
73 Richard W.M. Jones
74
76 Copyright Red Hat
77
79 This library is free software; you can redistribute it and/or modify it
80 under the terms of the GNU Lesser General Public License as published
81 by the Free Software Foundation; either version 2 of the License, or
82 (at your option) any later version.
83
84 This library is distributed in the hope that it will be useful, but
85 WITHOUT ANY WARRANTY; without even the implied warranty of
86 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
87 Lesser General Public License for more details.
88
89 You should have received a copy of the GNU Lesser General Public
90 License along with this library; if not, write to the Free Software
91 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
92 02110-1301 USA
93
94
95
96libnbd-1.16.5 2023-09-26 nbd_aio_pwrite(3)