public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
8e6b43d4a5deaba945b8b8b0ca3d16e393e5601d blob 1221 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
56
57
58
59
60
61
62
 
// SPDX-License-Identifier: GPL-2.0-or-later

/* ASST - Plug A Simple Socket Transport
 *  for qemu/UNIX domain socket mode
 *
 * PASTA - Pack A Subtle Tap Abstraction
 *  for network namespace/tap device mode
 *
 * PESTO - Programmable Extensible Socket Translation Orchestrator
 *  front-end for passt(1) and pasta(1) forwarding configuration
 *
 * pesto_util.c - Helpers used by both passt/pasta and pesto
 *
 * Copyright Red Hat
 * Author: Stefano Brivio <sbrivio@redhat.com>
 * Author: David Gibson <david@gibson.dropbear.id.au>
 */

#include <assert.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>

#include "pesto_util.h"

/**
 * read_all_buf() - Fill a whole buffer from a file descriptor
 * @fd:		File descriptor
 * @buf:	Pointer to base of buffer
 * @len:	Length of buffer
 *
 * Return: 0 on success, -1 on error (with errno set)
 *
 * #syscalls read
 */
int read_all_buf(int fd, void *buf, size_t len)
{
	size_t left = len;
	char *p = buf;

	while (left) {
		ssize_t rc;

		assert(left <= len);

		do
			rc = read(fd, p, left);
		while ((rc < 0) && errno == EINTR);

		if (rc < 0)
			return -1;

		if (rc == 0) {
			errno = ENODATA;
			return -1;
		}

		p += rc;
		left -= rc;
	}
	return 0;
}
debug log:

solving 8e6b43d4 ...
found 8e6b43d4 in https://archives.passt.top/passt-dev/20260316054629.239002-6-david@gibson.dropbear.id.au/

applying [1/1] https://archives.passt.top/passt-dev/20260316054629.239002-6-david@gibson.dropbear.id.au/
diff --git a/pesto_util.c b/pesto_util.c
new file mode 100644
index 00000000..8e6b43d4

Checking patch pesto_util.c...
Applied patch pesto_util.c cleanly.

index at:
100644 8e6b43d4a5deaba945b8b8b0ca3d16e393e5601d	pesto_util.c

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).