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
20       The "flags" parameter may be 0 for no flags, or may contain
21       "LIBNBD_CMD_FLAG_FUA" meaning that the server should not return until
22       the data has been committed to permanent storage (if that is supported
23       - some servers cannot do this, see nbd_can_fua(3)),
24       "LIBNBD_CMD_FLAG_NO_HOLE" meaning that the server should favor writing
25       actual allocated zeroes over punching a hole, and/or
26       "LIBNBD_CMD_FLAG_FAST_ZERO" meaning that the server must fail quickly
27       if writing zeroes is no faster than a normal write (if that is
28       supported - some servers cannot do this, see nbd_can_fast_zero(3)).
29

RETURN VALUE

31       If the call is successful the function returns 0.
32

ERRORS

34       On error "-1" is returned.
35
36       Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
37       of the error.
38

HANDLE STATE

40       The handle must be connected and finished handshaking with the server,
41       otherwise this call will return an error.
42

VERSION

44       This function first appeared in libnbd 1.0.
45
46       If you need to test if this function is available at compile time check
47       if the following macro is defined:
48
49        #define LIBNBD_HAVE_NBD_ZERO 1
50

SEE ALSO

52       nbd_can_fua(3), nbd_can_zero(3), nbd_can_fast_zero(3), nbd_aio_zero(3),
53       nbd_create(3), libnbd(3).
54

AUTHORS

56       Eric Blake
57
58       Richard W.M. Jones
59
61       Copyright (C) 2019 Red Hat Inc.
62

LICENSE

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