tools/testing/selftests/liveupdate/luo_test_utils.h

Source file repositories/reference/linux-study-clean/tools/testing/selftests/liveupdate/luo_test_utils.h

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/liveupdate/luo_test_utils.h
Extension
.h
Size
1377 bytes
Lines
47
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#ifndef LUO_TEST_UTILS_H
#define LUO_TEST_UTILS_H

#include <errno.h>
#include <string.h>
#include <linux/liveupdate.h>
#include "../kselftest.h"

#define LUO_DEVICE "/dev/liveupdate"

#define fail_exit(fmt, ...)						\
	ksft_exit_fail_msg("[%s:%d] " fmt " (errno: %s)\n",	\
			   __func__, __LINE__, ##__VA_ARGS__, strerror(errno))

int luo_open_device(void);
int luo_create_session(int luo_fd, const char *name);
int luo_retrieve_session(int luo_fd, const char *name);
int luo_session_finish(int session_fd);

int luo_ensure_nofile_limit(long min_limit);

int create_and_preserve_memfd(int session_fd, int token, const char *data);
int restore_and_verify_memfd(int session_fd, int token, const char *expected_data);

void create_state_file(int luo_fd, const char *session_name, int token,
		       int next_stage);
void restore_and_read_stage(int state_session_fd, int token, int *stage);

void daemonize_and_wait(void);

typedef void (*luo_test_stage1_fn)(int luo_fd);
typedef void (*luo_test_stage2_fn)(int luo_fd, int state_session_fd);

int luo_test(int argc, char *argv[], const char *state_session_name,
	     luo_test_stage1_fn stage1, luo_test_stage2_fn stage2);

#endif /* LUO_TEST_UTILS_H */

Annotation

Implementation Notes