函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\kexec_file.c Create Date:2022-07-27 12:05:36
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:kimage_file_alloc_init

函数原型: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)

返回类型:int

参数:

类型参数名称
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  如果非image则返回:负ENOMEM
326  If set, we are using file mode kexec syscall 等于1
328  如果kexec_on_panic
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  如果ret则转到:out_free_image
339  ret等于sanity_check_segment_list(image)
340  如果ret则转到: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  如果非control_code_page
347  打印错误信息("Could not allocate control_code_buffer\n")
348  转到:out_free_post_load_bufs
351  如果非kexec_on_panic
352  swap_page等于kimage_alloc_control_pages(image, 0)
353  如果非swap_page
354  打印错误信息("Could not allocate swap buffer\n")
355  转到:out_free_control_pages
359  rimage等于image
360  返回: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  返回:ret
调用者
名称描述
SYSCALL_DEFINE5