public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
blob 343448c84df1736f84bf74d0983fc38e66790465 2589 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
 
/* SPDX-License-Identifier: GPL-2.0-or-later
 * Copyright (c) 2025 Red Hat GmbH
 * Author: Stefano Brivio <sbrivio@redhat.com>
 */
 
#ifndef MIGRATE_H
#define MIGRATE_H

typedef char migrate_magic_t[8];

/**
 * struct migrate_header - Initial header used for all protocol versions
 * @magic:		'{passty}' as a byte array
 * @version:		Version of the protocol used by sender, network order
 * @compat_version:	Lowest compatible protocol version, network order
 */
struct migrate_header {
	migrate_magic_t magic;
	uint32_t version;
	uint32_t compat_version;
};

/**
 * union migrate_header_v1 - Migration header from source
 * @endian:		0x12345678, source host order
 * @voidp_size:		sizeof(void *), network order
 * @time_t_size:	sizeof(time_t), network order
 * @flow_size:		sizeof(union flow), network order
 * @flow_sidx_size:	sizeof(struct flow_sidx_t), network order
 * @unused:		Go figure
 */
union migrate_header_v1 {
	struct {
		uint32_t endian;
		uint32_t voidp_size;
		uint32_t time_t_size;
		uint32_t flow_size;
		uint32_t flow_sidx_size;
	};
	uint8_t unused[65536];
};

struct migrate_meta;

/**
 * struct migrate_handler - Function to handle a specific data section
 * @fn:			Function pointer taking pointer to context and metadata
 */
struct migrate_handler {
	int (*fn)(struct ctx *c, struct migrate_meta *m);
};

/**
 * struct migrate_version - Handlers and data sections for a protocol version
 * @v:			Source version this applies to, host order
 * @read_header_v:	Read version specific header(s)
 * @pre:		Set of functions to execute in target before data copy
 * @sections:		Array of data sections, NULL-terminated
 * @post:		Set of functions to execute in target after data copy
 */
struct migrate_version {
	uint32_t v;
	int (*read_header_v)(int fd, struct migrate_meta *m);
	struct migrate_handler *pre;
	struct iovec *sections;
	struct migrate_handler *post;
};

/**
 * struct migrate_meta - Migration metadata
 * @version:		Version number, host order
 * @v:			Version information
 * @bswap:		Source has opposite endianness
 * @peer_64b:		Source uses 64-bit void *
 * @time_64b:		Source uses 64-bit time_t
 * @flow_size:		Size of union flow in source
 * @flow_sidx_size:	Size of struct flow_sidx in source
 */
struct migrate_meta {
	uint32_t version;
	const struct migrate_version *v;
	bool bswap;
	bool source_64b;
	bool time_64b;
	size_t flow_size;
	size_t flow_sidx_size;
};


void migrate_init(struct ctx *c);
void migrate_close(struct ctx *c);
void migrate_request(struct ctx *c, int fd, bool target);
void migrate_handler(struct ctx *c);

#endif /* MIGRATE_H */

debug log:

solving 343448c8 ...
found 343448c8 in https://archives.passt.top/passt-dev/20250131045215.1368543-3-david@gibson.dropbear.id.au/
found b532bde0 in https://archives.passt.top/passt-dev/20250131045215.1368543-2-david@gibson.dropbear.id.au/
found 3432940d in https://archives.passt.top/passt-dev/20250130083330.917030-6-david@gibson.dropbear.id.au/
found b97e55e7 in https://archives.passt.top/passt-dev/20250130083330.917030-5-david@gibson.dropbear.id.au/
found edf6303e in https://archives.passt.top/passt-dev/20250130083330.917030-3-david@gibson.dropbear.id.au/
retrying f9635ac2 as f9635ac
found f9635ac in https://archives.passt.top/passt-dev/20250128233940.1235855-6-sbrivio@redhat.com/

applying [1/6] https://archives.passt.top/passt-dev/20250128233940.1235855-6-sbrivio@redhat.com/
diff --git a/migrate.h b/migrate.h
new file mode 100644
index 0000000..f9635ac


applying [2/6] https://archives.passt.top/passt-dev/20250130083330.917030-3-david@gibson.dropbear.id.au/
diff --git a/migrate.h b/migrate.h
index f9635ac2..edf6303e 100644


applying [3/6] https://archives.passt.top/passt-dev/20250130083330.917030-5-david@gibson.dropbear.id.au/
diff --git a/migrate.h b/migrate.h
index edf6303e..b97e55e7 100644


applying [4/6] https://archives.passt.top/passt-dev/20250130083330.917030-6-david@gibson.dropbear.id.au/
diff --git a/migrate.h b/migrate.h
index b97e55e7..3432940d 100644


applying [5/6] https://archives.passt.top/passt-dev/20250131045215.1368543-2-david@gibson.dropbear.id.au/
diff --git a/migrate.h b/migrate.h
index 3432940d..b532bde0 100644


applying [6/6] https://archives.passt.top/passt-dev/20250131045215.1368543-3-david@gibson.dropbear.id.au/
diff --git a/migrate.h b/migrate.h
index b532bde0..343448c8 100644

6:11: trailing whitespace.
 
Checking patch migrate.h...
Applied patch migrate.h cleanly.
Checking patch migrate.h...
Applied patch migrate.h cleanly.
Checking patch migrate.h...
Applied patch migrate.h cleanly.
Checking patch migrate.h...
Applied patch migrate.h cleanly.
Checking patch migrate.h...
Applied patch migrate.h cleanly.
Checking patch migrate.h...
Applied patch migrate.h cleanly.
warning: 1 line adds whitespace errors.

index at:
100644 343448c84df1736f84bf74d0983fc38e66790465	migrate.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).