函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:This routine tries to find a RAM disk image to load, and returns the* number of blocks to read for a non-compressed image, 0 if the image* is a compressed image, and -1 if an image with the right magic* numbers could not be found

函数原型:static int __init identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)

返回类型:int

参数:

类型参数名称
intfd
intstart_block
decompress_fn *decompressor
60  size等于512
65  nblocks等于负1
70  buf等于开辟内存
71  如果非buf则返回:负ENOMEM
74  minixsb等于buf
75  romfsb等于buf
76  cramfsb等于buf
77  squashfsb等于buf
78  memset(buf, 0xe5, size)
83  ksys_lseek(fd, start_block * BLOCK_SIZE, 0)
84  ksys_read(fd, buf, size)
86  decompressor等于decompress_method(buf, size, & compress_name)
87  如果compress_name
88  printk - print a kernel message*@fmt: format string* This is printk(). It can be called from any context. We want it to work.* We try to grab the console_lock. If we succeed, it's easy - we log the* output and call the console drivers
90  如果非decompressorprintk - print a kernel message*@fmt: format string* This is printk(). It can be called from any context. We want it to work.* We try to grab the console_lock. If we succeed, it's easy - we log the* output and call the console drivers
94  nblocks等于0
95  转到:done
99  如果word0恒等于ROMSB_WORD0word1恒等于ROMSB_WORD1
101  printk - print a kernel message*@fmt: format string* This is printk(). It can be called from any context. We want it to work.* We try to grab the console_lock. If we succeed, it's easy - we log the* output and call the console drivers
104  nblocks等于ntohl(size)加BLOCK_SIZE减1右移BLOCK_SIZE_BITS
105  转到:done
108  如果0x28cd3d45 - random number 恒等于some random number
109  printk - print a kernel message*@fmt: format string* This is printk(). It can be called from any context. We want it to work.* We try to grab the console_lock. If we succeed, it's easy - we log the* output and call the console drivers
112  nblocks等于length in bytes BLOCK_SIZE减1右移BLOCK_SIZE_BITS
113  转到:done
117  如果le32_to_cpu(s_magic)恒等于SQUASHFS_MAGIC
118  printk - print a kernel message*@fmt: format string* This is printk(). It can be called from any context. We want it to work.* We try to grab the console_lock. If we succeed, it's easy - we log the* output and call the console drivers
121  nblocks等于le64_to_cpu(bytes_used)加BLOCK_SIZE减1右移BLOCK_SIZE_BITS
123  转到:done
129  ksys_lseek(fd, start_block * BLOCK_SIZE + 0x200, 0)
130  ksys_read(fd, buf, size)
132  如果0x28cd3d45 - random number 恒等于some random number
133  printk - print a kernel message*@fmt: format string* This is printk(). It can be called from any context. We want it to work.* We try to grab the console_lock. If we succeed, it's easy - we log the* output and call the console drivers
136  nblocks等于length in bytes BLOCK_SIZE减1右移BLOCK_SIZE_BITS
137  转到:done
143  ksys_lseek(fd, (start_block + 1) * BLOCK_SIZE, 0)
144  ksys_read(fd, buf, size)
147  如果s_magic恒等于minix v1 fs, 14 char names s_magic恒等于minix v1 fs, 30 char names
149  printk - print a kernel message*@fmt: format string* This is printk(). It can be called from any context. We want it to work.* We try to grab the console_lock. If we succeed, it's easy - we log the* output and call the console drivers
152  nblocks等于s_nzones左移s_log_zone_size
153  转到:done
157  n等于ext2_image_size(buf)
158  如果n
159  printk - print a kernel message*@fmt: format string* This is printk(). It can be called from any context. We want it to work.* We try to grab the console_lock. If we succeed, it's easy - we log the* output and call the console drivers
162  nblocks等于n
163  转到:done
166  printk - print a kernel message*@fmt: format string* This is printk(). It can be called from any context. We want it to work.* We try to grab the console_lock. If we succeed, it's easy - we log the* output and call the console drivers
170  done :
171  ksys_lseek(fd, start_block * BLOCK_SIZE, 0)
172  释放内存
173  返回:nblocks
调用者
名称描述
rd_load_image