Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 44 lines 1.3 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2 3/* 4 * Copyright (c) 2025, Google LLC. 5 * Pasha Tatashin <pasha.tatashin@soleen.com> 6 * 7 * Utility functions for LUO kselftests. 8 */ 9 10#ifndef LUO_TEST_UTILS_H 11#define LUO_TEST_UTILS_H 12 13#include <errno.h> 14#include <string.h> 15#include <linux/liveupdate.h> 16#include "../kselftest.h" 17 18#define LUO_DEVICE "/dev/liveupdate" 19 20#define fail_exit(fmt, ...) \ 21 ksft_exit_fail_msg("[%s:%d] " fmt " (errno: %s)\n", \ 22 __func__, __LINE__, ##__VA_ARGS__, strerror(errno)) 23 24int luo_open_device(void); 25int luo_create_session(int luo_fd, const char *name); 26int luo_retrieve_session(int luo_fd, const char *name); 27int luo_session_finish(int session_fd); 28 29int create_and_preserve_memfd(int session_fd, int token, const char *data); 30int restore_and_verify_memfd(int session_fd, int token, const char *expected_data); 31 32void create_state_file(int luo_fd, const char *session_name, int token, 33 int next_stage); 34void restore_and_read_stage(int state_session_fd, int token, int *stage); 35 36void daemonize_and_wait(void); 37 38typedef void (*luo_test_stage1_fn)(int luo_fd); 39typedef void (*luo_test_stage2_fn)(int luo_fd, int state_session_fd); 40 41int luo_test(int argc, char *argv[], const char *state_session_name, 42 luo_test_stage1_fn stage1, luo_test_stage2_fn stage2); 43 44#endif /* LUO_TEST_UTILS_H */