1 /* SPDX-License-Identifier: MIT */
2 
3 /*
4  * Live Update interfaces for Xen Store Daemon.
5  * Copyright (C) 2022 Juergen Gross, SUSE LLC
6  */
7 
8 struct live_update {
9 	/* For verification the correct connection is acting. */
10 	struct connection *conn;
11 
12 	/* Pointer to the command used to request LU */
13 	struct buffered_data *in;
14 
15 #ifdef __MINIOS__
16 	void *kernel;
17 	unsigned int kernel_size;
18 	unsigned int kernel_off;
19 
20 #endif
21 
22 	char *filename;
23 	char *cmdline;
24 
25 	/* Start parameters. */
26 	bool force;
27 	unsigned int timeout;
28 	unsigned int version;
29 	time_t started_at;
30 };
31 
32 extern struct live_update *lu_status;
33 
34 #ifndef NO_LIVE_UPDATE
35 struct connection *lu_get_connection(void);
36 bool lu_is_pending(void);
37 void lu_read_state(void);
38 
39 /* Write the "OK" response for the live-update command */
40 unsigned int lu_write_response(FILE *fp);
41 
42 int do_control_lu(const void *ctx, struct connection *conn, const char **vec,
43 		  int num);
44 
45 /* Live update private interfaces. */
46 char *lu_exec(const void *ctx, int argc, char **argv);
47 const char *lu_arch(const void *ctx, struct connection *conn, const char **vec,
48 		    int num);
49 const char *lu_begin(struct connection *conn);
50 #else
lu_get_connection(void)51 static inline struct connection *lu_get_connection(void)
52 {
53 	return NULL;
54 }
55 
lu_write_response(FILE * fp)56 static inline unsigned int lu_write_response(FILE *fp)
57 {
58 	return 0;
59 }
60 
lu_is_pending(void)61 static inline bool lu_is_pending(void)
62 {
63 	return false;
64 }
65 #endif
66