linux/init/initramfs.c

// SPDX-License-Identifier: GPL-2.0
#include <linux/init.h>
#include <linux/async.h>
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/delay.h>
#include <linux/string.h>
#include <linux/dirent.h>
#include <linux/syscalls.h>
#include <linux/utime.h>
#include <linux/file.h>
#include <linux/kstrtox.h>
#include <linux/memblock.h>
#include <linux/mm.h>
#include <linux/namei.h>
#include <linux/init_syscalls.h>
#include <linux/umh.h>

#include "do_mounts.h"

static __initdata bool csum_present;
static __initdata u32 io_csum;

static ssize_t __init xwrite(struct file *file, const unsigned char *p,
		size_t count, loff_t *pos)
{}

static __initdata char *message;
static void __init error(char *x)
{}

#define panic_show_mem(fmt, ...)

/* link hash */

#define N_ALIGN(len)

static __initdata struct hash {} *head[32];

static inline int hash(int major, int minor, int ino)
{}

static char __init *find_link(int major, int minor, int ino,
			      umode_t mode, char *name)
{}

static void __init free_hash(void)
{}

#ifdef CONFIG_INITRAMFS_PRESERVE_MTIME
static void __init do_utime(char *filename, time64_t mtime)
{}

static void __init do_utime_path(const struct path *path, time64_t mtime)
{}

static __initdata LIST_HEAD(dir_list);
struct dir_entry {};

static void __init dir_add(const char *name, time64_t mtime)
{}

static void __init dir_utime(void)
{}
#else
static void __init do_utime(char *filename, time64_t mtime) {}
static void __init do_utime_path(const struct path *path, time64_t mtime) {}
static void __init dir_add(const char *name, time64_t mtime) {}
static void __init dir_utime(void) {}
#endif

static __initdata time64_t mtime;

/* cpio header parsing */

static __initdata unsigned long ino, major, minor, nlink;
static __initdata umode_t mode;
static __initdata unsigned long body_len, name_len;
static __initdata uid_t uid;
static __initdata gid_t gid;
static __initdata unsigned rdev;
static __initdata u32 hdr_csum;

static void __init parse_header(char *s)
{}

/* FSM */

static __initdata enum state {} state, next_state;

static __initdata char *victim;
static unsigned long byte_count __initdata;
static __initdata loff_t this_header, next_header;

static inline void __init eat(unsigned n)
{}

static __initdata char *collected;
static long remains __initdata;
static __initdata char *collect;

static void __init read_into(char *buf, unsigned size, enum state next)
{}

static __initdata char *header_buf, *symlink_buf, *name_buf;

static int __init do_start(void)
{}

static int __init do_collect(void)
{}

static int __init do_header(void)
{}

static int __init do_skip(void)
{}

static int __init do_reset(void)
{}

static void __init clean_path(char *path, umode_t fmode)
{}

static int __init maybe_link(void)
{}

static __initdata struct file *wfile;
static __initdata loff_t wfile_pos;

static int __init do_name(void)
{}

static int __init do_copy(void)
{}

static int __init do_symlink(void)
{}

static __initdata int (*actions[])(void) =;

static long __init write_buffer(char *buf, unsigned long len)
{}

static long __init flush_buffer(void *bufv, unsigned long len)
{}

static unsigned long my_inptr __initdata; /* index of next byte to be processed in inbuf */

#include <linux/decompress/generic.h>

static char * __init unpack_to_rootfs(char *buf, unsigned long len)
{}

static int __initdata do_retain_initrd;

static int __init retain_initrd_param(char *str)
{}
__setup();

#ifdef CONFIG_ARCH_HAS_KEEPINITRD
static int __init keepinitrd_setup(char *__unused)
{
	do_retain_initrd = 1;
	return 1;
}
__setup("keepinitrd", keepinitrd_setup);
#endif

static bool __initdata initramfs_async =;
static int __init initramfs_async_setup(char *str)
{}
__setup();

extern char __initramfs_start[];
extern unsigned long __initramfs_size;
#include <linux/initrd.h>
#include <linux/kexec.h>

static BIN_ATTR(initrd, 0440, sysfs_bin_attr_simple_read, NULL, 0);

void __init reserve_initrd_mem(void)
{}

void __weak __init free_initrd_mem(unsigned long start, unsigned long end)
{}

#ifdef CONFIG_CRASH_RESERVE
static bool __init kexec_free_initrd(void)
{}
#else
static inline bool kexec_free_initrd(void)
{
	return false;
}
#endif /* CONFIG_KEXEC_CORE */

#ifdef CONFIG_BLK_DEV_RAM
static void __init populate_initrd_image(char *err)
{}
#endif /* CONFIG_BLK_DEV_RAM */

static void __init do_populate_rootfs(void *unused, async_cookie_t cookie)
{}

static ASYNC_DOMAIN_EXCLUSIVE(initramfs_domain);
static async_cookie_t initramfs_cookie;

void wait_for_initramfs(void)
{}
EXPORT_SYMBOL_GPL();

static int __init populate_rootfs(void)
{}
rootfs_initcall(populate_rootfs);