1nbd_zero(3)                         LIBNBD                         nbd_zero(3)
2
3
4

NAME

6       nbd_zero - send write zeroes command to the NBD server
7

SYNOPSIS

9        #include <libnbd.h>
10
11        int nbd_zero (struct nbd_handle *h, uint64_t count,
12                      uint64_t offset, uint32_t flags);
13

DESCRIPTION

15       Issue a write zeroes command to the NBD server, which if supported by
16       the server causes a zeroes to be written efficiently starting at
17       "offset" and ending at "offset" + "count" - 1.  The call returns when
18       the command has been acknowledged by the server, or there is an error.
19       Note this will generally return an error if nbd_can_zero(3) is false or
20       nbd_is_read_only(3) is true.
21
22       The "flags" parameter may be 0 for no flags, or may contain
23       "LIBNBD_CMD_FLAG_FUA" meaning that the server should not return until
24       the data has been committed to permanent storage (if that is supported
25       - some servers cannot do this, see nbd_can_fua(3)),
26       "LIBNBD_CMD_FLAG_NO_HOLE" meaning that the server should favor writing
27       actual allocated zeroes over punching a hole, and/or
28       "LIBNBD_CMD_FLAG_FAST_ZERO" meaning that the server must fail quickly
29       if writing zeroes is no faster than a normal write (if that is
30       supported - some servers cannot do this, see nbd_can_fast_zero(3)).
31
32       By default, libnbd will reject attempts to use this function with
33       parameters that are likely to result in server failure, such as
34       requesting an unknown command flag.  The nbd_set_strict_mode(3)
35       function can be used to alter which scenarios should await a server
36       reply rather than failing fast.
37

RETURN VALUE

39       If the call is successful the function returns 0.
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_ZERO 1
58

SEE ALSO

60       nbd_aio_zero(3), nbd_can_fast_zero(3), nbd_can_fua(3), nbd_can_zero(3),
61       nbd_create(3), nbd_is_read_only(3), nbd_set_strict_mode(3), libnbd(3).
62

AUTHORS

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

LICENSE

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