public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
blob 32c0b3f424b67f9fdbfb33a62b14d3c2a1a96c18 2566 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
96
 
/* 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

struct migrate_version;

/**
 * struct migrate_meta - Migration metadata
 * @version:		Chosen migration data version, host order
 * @v:			Migration 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;
};

/**
 * union migrate_header - Migration header from source
 * @magic:		0xB1BB1D1B0BB1D1B0, host order
 * @version:		Source sends highest known, target aborts if unsupported
 * @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 {
	struct {
		uint64_t magic;
		uint32_t version;
		uint32_t voidp_size;
		uint32_t time_t_size;
		uint32_t flow_size;
		uint32_t flow_sidx_size;
	};
	uint8_t unused[4096];
} __attribute__((packed));

struct migrate_stage;

/**
 * migrate_cb_t - Callback function to implement one migration stage
 */
typedef int (*migrate_cb_t)(struct ctx *c, struct migrate_meta *m,
			    const struct migrate_stage *stage, int fd);

/**
 * struct migrate_stage - Callbacks and parameters for one stage of migration
 * @name:	Stage name (for debugging)
 * @source:	Callback to implement this stage on the source
 * @target:	Callback to implement this stage on the target
 * @v:		Source version this applies to, host order
 * @sections:	Array of data sections, NULL-terminated
 */
struct migrate_stage {
	const char *name;
	migrate_cb_t source;
	migrate_cb_t target;
	/* FIXME: rollback callbacks? */
	union {
		struct iovec iov;
	};
};

/**
 * struct migrate_version - Stages for a particular protocol version
 * @version:	Version number this implements
 * @stages:	Ordered array of stages
 * @nstages:	Length of @stages
 */
struct migrate_version {
	uint32_t version;
	const struct migrate_stage *stages;
	unsigned nstages;
};

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 32c0b3f4 ...
found 32c0b3f4 in https://archives.passt.top/passt-dev/20250203092615.500163-7-david@gibson.dropbear.id.au/
retrying 158241f3 as 158241f
found 158241f in https://archives.passt.top/passt-dev/20250131193953.3034031-15-sbrivio@redhat.com/
found a222c48 in https://archives.passt.top/passt-dev/20250131193953.3034031-14-sbrivio@redhat.com/
found 21de70d in https://archives.passt.top/passt-dev/20250131193953.3034031-12-sbrivio@redhat.com/
found 9a68f17 in https://archives.passt.top/passt-dev/20250131193953.3034031-8-sbrivio@redhat.com/

applying [1/5] https://archives.passt.top/passt-dev/20250131193953.3034031-8-sbrivio@redhat.com/
diff --git a/migrate.h b/migrate.h
new file mode 100644
index 0000000..9a68f17


applying [2/5] https://archives.passt.top/passt-dev/20250131193953.3034031-12-sbrivio@redhat.com/
diff --git a/migrate.h b/migrate.h
index 9a68f17..21de70d 100644


applying [3/5] https://archives.passt.top/passt-dev/20250131193953.3034031-14-sbrivio@redhat.com/
diff --git a/migrate.h b/migrate.h
index 21de70d..a222c48 100644


applying [4/5] https://archives.passt.top/passt-dev/20250131193953.3034031-15-sbrivio@redhat.com/
diff --git a/migrate.h b/migrate.h
index a222c48..158241f 100644


applying [5/5] https://archives.passt.top/passt-dev/20250203092615.500163-7-david@gibson.dropbear.id.au/
diff --git a/migrate.h b/migrate.h
index 158241f3..32c0b3f4 100644

5: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.
warning: 1 line adds whitespace errors.

index at:
100644 32c0b3f424b67f9fdbfb33a62b14d3c2a1a96c18	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).