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 (struct nbd_handle *h,
18 const void *buf, size_t count,
19 uint64_t offset,
20 nbd_completion_callback completion_callback,
21 uint32_t flags);
22
24 Issue a write command to the NBD server.
25
26 To check if the command completed, call nbd_aio_command_completed(3).
27 Or supply the optional "completion_callback" which will be invoked as
28 described in "Completion callbacks" in libnbd(3).
29
30 Note that you must ensure "buf" is valid until the command has
31 completed. Other parameters behave as documented in nbd_pwrite(3).
32
34 This call returns the 64 bit cookie of the command. The cookie is ≥ 1.
35 Cookies are unique (per libnbd handle, not globally).
36
38 On error "-1" is returned.
39
40 Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
41 of the error.
42
44 The handle must be connected and finished handshaking with the server,
45 otherwise this call will return an error.
46
48 This function first appeared in libnbd 1.0.
49
50 If you need to test if this function is available at compile time check
51 if the following macro is defined:
52
53 #define LIBNBD_HAVE_NBD_AIO_PWRITE 1
54
56 "Issuing asynchronous commands" in libnbd(3), nbd_can_write(3),
57 nbd_pwrite(3), nbd_create(3), libnbd(3).
58
60 Eric Blake
61
62 Richard W.M. Jones
63
65 Copyright (C) 2019 Red Hat Inc.
66
68 This library is free software; you can redistribute it and/or modify it
69 under the terms of the GNU Lesser General Public License as published
70 by the Free Software Foundation; either version 2 of the License, or
71 (at your option) any later version.
72
73 This library is distributed in the hope that it will be useful, but
74 WITHOUT ANY WARRANTY; without even the implied warranty of
75 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
76 Lesser General Public License for more details.
77
78 You should have received a copy of the GNU Lesser General Public
79 License along with this library; if not, write to the Free Software
80 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
81 02110-1301 USA
82
83
84
85libnbd-1.2.1 2019-11-14 nbd_aio_pwrite(3)