函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\swapfile.c Create Date:2022-07-27 16:49:57
Last Modify:2020-03-17 22:19:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:read_swap_header

函数原型:static unsigned long read_swap_header(struct swap_info_struct *p, union swap_header *swap_header, struct inode *inode)

返回类型:unsigned long

参数:

类型参数名称
struct swap_info_struct *p
union swap_header *swap_header
struct inode *inode
2947  如果内存比较
2948  打印错误信息("Unable to find swap-space signature\n")
2949  返回:0
2953  如果swab32(version)恒等于1则
2954  swab32s( & version)
2955  swab32s( & last_page)
2956  swab32s( & nr_badpages)
2957  如果nr_badpages大于Max bad pages in the new format..则返回:0
2959 i小于nr_badpages循环swab32s( & badpages[i])
2963  如果version不等于1则
2964  打印警告信息("Unable to handle swap header version %d\n", version)
2966  返回:0
2969  dex of first free in swap_map 等于1
2970  likely index for next allocation 等于1
2971  countdown to next cluster search 等于0
2973  maxpages等于Can be overridden by an architecture for additional checks.
2974  last_page等于last_page
2975  如果非last_page
2976  打印警告信息("Empty swap-file\n")
2977  返回:0
2979  如果last_page大于maxpages
2980  打印警告信息("Truncating oversized swap area, only using %luk out of %luk\n", maxpages << (PAGE_SHIFT determines the page size - 10), last_page << (PAGE_SHIFT determines the page size - 10))
2984  如果maxpages大于last_page
2985  maxpages等于last_page加1
2987  如果maxpages恒等于0则maxpages等于UINT_MAX
2990  dex of last free in swap_map 等于maxpages减1
2992  如果非maxpages则返回:0
2994  swapfilepages等于NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they 右移PAGE_SHIFT determines the page size
2995  如果swapfilepagesmaxpages大于swapfilepages
2996  打印警告信息("Swap area shorter than signature indicates\n")
2997  返回:0
2999  如果nr_badpagesS_ISREG(i_mode)则返回:0
3001  如果nr_badpages大于Max bad pages in the new format..则返回:0
3004  返回:maxpages
调用者
名称描述
SYSCALL_DEFINE2