]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/iovec-util.h
f1e4be88d43d1be8f68c461707a809180401a89d
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
4 #include <sys/uio.h> /* IWYU pragma: export */
7 #include "iovec-util-fundamental.h" /* IWYU pragma: export */
9 extern const struct iovec iovec_nul_byte
; /* Points to a single NUL byte */
10 extern const struct iovec iovec_empty
; /* Points to an empty, but valid (i.e. non-NULL) pointer */
12 size_t iovec_total_size(const struct iovec
*iovec
, size_t n
) _nonnull_if_nonzero_(1, 2);
14 bool iovec_increment(struct iovec
*iovec
, size_t n
, size_t k
) _nonnull_if_nonzero_(1, 2);
16 struct iovec
* iovec_make_string(struct iovec
*iovec
, const char *s
);
18 #define IOVEC_MAKE_STRING(s) \
19 *iovec_make_string(&(struct iovec) {}, s)
21 #define CONST_IOVEC_MAKE_STRING(s) \
22 (const struct iovec) { \
23 .iov_base = (char*) s, \
24 .iov_len = STRLEN(s), \
27 void iovec_done_erase(struct iovec
*iovec
);
29 char* set_iovec_string_field(struct iovec
*iovec
, size_t *n_iovec
, const char *field
, const char *value
);
30 char* set_iovec_string_field_free(struct iovec
*iovec
, size_t *n_iovec
, const char *field
, char *value
);
32 void iovec_array_free(struct iovec
*iovec
, size_t n_iovec
) _nonnull_if_nonzero_(1, 2);
34 int iovec_memcmp(const struct iovec
*a
, const struct iovec
*b
) _pure_
;
36 struct iovec
* iovec_memdup(const struct iovec
*source
, struct iovec
*ret
);
38 struct iovec
* iovec_append(struct iovec
*iovec
, const struct iovec
*append
);