public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
blob a2f449c837b3c92dcb704fc12d1a89ed53b8d597 1708 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
 
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * iov.c - helpers for using (partial) iovecs.
 *
 * Copyrigh Red Hat
 * Author: Laurent Vivier <lvivier@redhat.com>
 *
 * This file also contains code originally from QEMU include/qemu/iov.h:
 *
 * Author(s):
 *  Amit Shah <amit.shah@redhat.com>
 *  Michael Tokarev <mjt@tls.msk.ru>
 */

#ifndef IOVEC_H
#define IOVEC_H

#include <unistd.h>
#include <string.h>

#define IOV_OF_LVALUE(lval) \
	(struct iovec){ .iov_base = &(lval), .iov_len = sizeof(lval) }

size_t iov_skip_bytes(const struct iovec *iov, size_t n,
		      size_t skip, size_t *offset);
size_t iov_from_buf(const struct iovec *iov, size_t iov_cnt,
                    size_t offset, const void *buf, size_t bytes);
size_t iov_to_buf(const struct iovec *iov, size_t iov_cnt,
                  size_t offset, void *buf, size_t bytes);
size_t iov_size(const struct iovec *iov, size_t iov_cnt);

/**
 * struct iov_tail - Represents the fail portion of an IO vector
 * @iov:	IO vector
 * @cnt:	Number of entries in @iov
 * @off:	Current offset in @iov
 */
struct iov_tail {
	const struct iovec *iov;
	size_t cnt, off;
};

#define IOV_TAIL(iov_, cnt_, off_) \
	(struct iov_tail){ .iov = (iov_), .cnt = (cnt_), .off = (off_) }

bool iov_tail_shorten(struct iov_tail *tail);
size_t iov_tail_size(struct iov_tail *tail);
void *iov_peek_header_(struct iov_tail *tail, size_t len, size_t align);
#define IOV_PEEK_HEADER(tail_, ty_) \
	((ty_ *)(iov_peek_header_((tail_), sizeof(ty_), __alignof__(ty_))))
void *iov_pull_header_(struct iov_tail *tail, size_t len, size_t align);
#define IOV_PULL_HEADER(tail_, ty_) \
	((ty_ *)(iov_pull_header_((tail_), sizeof(ty_), __alignof__(ty_))))

#endif /* IOVEC_H */

debug log:

solving a2f449c ...
found a2f449c in https://archives.passt.top/passt-dev/20241105023222.698658-2-david@gibson.dropbear.id.au/
found a9e1722 in https://passt.top/passt
preparing index
index prepared:
100644 a9e1722713b3e27125e6d7f3b5c8a513a750c61b	iov.h

applying [1/1] https://archives.passt.top/passt-dev/20241105023222.698658-2-david@gibson.dropbear.id.au/
diff --git a/iov.h b/iov.h
index a9e1722..a2f449c 100644

Checking patch iov.h...
Applied patch iov.h cleanly.

index at:
100644 a2f449c837b3c92dcb704fc12d1a89ed53b8d597	iov.h

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).