1nbd_aio_trim(3)                     LIBNBD                     nbd_aio_trim(3)
2
3
4

NAME

6       nbd_aio_trim - send trim command to the NBD server
7

SYNOPSIS

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_trim (struct nbd_handle *h, uint64_t count,
18                              uint64_t offset,
19                              nbd_completion_callback completion_callback,
20                              uint32_t flags);
21

DESCRIPTION

23       Issue a trim command to the NBD server.
24
25       To check if the command completed, call nbd_aio_command_completed(3).
26       Or supply the optional "completion_callback" which will be invoked as
27       described in "Completion callbacks" in libnbd(3).
28
29       Other parameters behave as documented in nbd_trim(3).
30
31       By default, libnbd will reject attempts to use this function with
32       parameters that are likely to result in server failure, such as
33       requesting an unknown command flag.  The nbd_set_strict_mode(3)
34       function can be used to alter which scenarios should await a server
35       reply rather than failing fast.
36

RETURN VALUE

38       This call returns the 64 bit cookie of the command.  The cookie is ≥ 1.
39       Cookies are unique (per libnbd handle, not globally).
40

ERRORS

42       On error "-1" is returned.
43
44       Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
45       of the error.
46

HANDLE STATE

48       The handle must be connected with the server, otherwise this call will
49       return an error.
50

VERSION

52       This function first appeared in libnbd 1.0.
53
54       If you need to test if this function is available at compile time check
55       if the following macro is defined:
56
57        #define LIBNBD_HAVE_NBD_AIO_TRIM 1
58

SEE ALSO

60       nbd_aio_command_completed(3), nbd_can_trim(3), nbd_create(3),
61       nbd_set_strict_mode(3), nbd_trim(3), "Issuing asynchronous commands" in
62       libnbd(3), libnbd(3).
63

AUTHORS

65       Eric Blake
66
67       Richard W.M. Jones
68
70       Copyright (C) 2019-2021 Red Hat Inc.
71

LICENSE

73       This library is free software; you can redistribute it and/or modify it
74       under the terms of the GNU Lesser General Public License as published
75       by the Free Software Foundation; either version 2 of the License, or
76       (at your option) any later version.
77
78       This library is distributed in the hope that it will be useful, but
79       WITHOUT ANY WARRANTY; without even the implied warranty of
80       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
81       Lesser General Public License for more details.
82
83       You should have received a copy of the GNU Lesser General Public
84       License along with this library; if not, write to the Free Software
85       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
86       02110-1301 USA
87
88
89
90libnbd-1.7.12                     2021-05-29                   nbd_aio_trim(3)
Impressum