Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\kexec_file.c Create Date:2022-07-28 11:04:09
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:kimage_file_alloc_init

Proto:static int kimage_file_alloc_init(struct kimage **rimage, int kernel_fd, int initrd_fd, const char __user *cmdline_ptr, unsigned long cmdline_len, unsigned long flags)

Type:int

Parameter:

TypeParameterName
struct kimage **rimage
intkernel_fd
intinitrd_fd
const char __user *cmdline_ptr
unsigned longcmdline_len
unsigned longflags
320  kexec_on_panic = flags & KEXEC_FILE_ON_CRASH
322  image = do_kimage_alloc_init()
323  If Not image Then Return -ENOMEM
326  If set, we are using file mode kexec syscall = 1
328  If kexec_on_panic Then
330  Address of next control page to allocate for crash kernels. = start
331  Flags to indicate special processing = KEXEC_TYPE_CRASH
334  ret = In file mode list of segments is prepared by kernel. Copy relevant* data from user space, do error checking, prepare segment list
336  If ret Then Go to out_free_image
339  ret = sanity_check_segment_list(image)
340  If ret Then Go to out_free_post_load_bufs
343  ret = -ENOMEM
344  control_code_page = kimage_alloc_control_pages(image, get_order - Determine the allocation order of a memory size*@size: The size for which to get the order* Determine the allocation order of a particular sized block of memory)
346  If Not control_code_page Then
347  pr_err("Could not allocate control_code_buffer\n")
348  Go to out_free_post_load_bufs
351  If Not kexec_on_panic Then
352  swap_page = kimage_alloc_control_pages(image, 0)
353  If Not swap_page Then
354  pr_err("Could not allocate swap buffer\n")
359  rimage = image
360  Return 0
361  out_free_control_pages :
362  kimage_free_page_list( & control_pages)
363  out_free_post_load_bufs :
364  Free up memory used by kernel, initrd, and command line. This is temporary* memory allocation which is not needed any more after these buffers have* been loaded into separate segments and have been copied elsewhere.
365  out_free_image :
366  kfree(image)
367  Return ret
Caller
NameDescribe
SYSCALL_DEFINE5