函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:rd_load_image

函数原型:int __init rd_load_image(char *from)

返回类型:int

参数:

类型参数名称
char *from
178  res等于0
182  char * buf = NULL
183  rotate等于0
184  decompress_fn decompressor = NULL
186  char rotator[4] = {'|', '/', '-', '\\'}
189  out_fd等于ksys_open("/dev/ram", O_RDWR, 0)
190  如果out_fd小于0则转到:out
193  in_fd等于ksys_open(from, O_RDONLY, 0)
194  如果in_fd小于0则转到:noclose_input
197  nblocks等于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
198  如果nblocks小于0则转到:done
201  如果nblocks恒等于0则
202  如果crd_load(in_fd, out_fd, decompressor)恒等于0则转到:successful_load
204  转到:done
211  如果ksys_ioctl(out_fd, urn device size /512 (long *arg) , (unsignedlong) & rd_blocks)小于0则rd_blocks等于0
213  否则rd_blocks右移等于1位
216  如果nblocks大于rd_blocks
217  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
219  转到:done
225  如果ksys_ioctl(in_fd, urn device size /512 (long *arg) , (unsignedlong) & devblocks)小于0则devblocks等于0
227  否则devblocks右移等于1位
230  如果字符串比较恒等于0则devblocks等于nblocks
233  如果devblocks恒等于0则
234  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
235  转到:done
238  buf等于开辟内存
239  如果非buf
240  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
241  转到:done
244  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
246 i小于nblocks循环
247  如果ii取模devblocks恒等于0则
248  打印标准信息("done disk #%d.\n", disk++)
249  rotate等于0
254  change_floppy("disk #%d", disk)
255  in_fd等于ksys_open(from, O_RDONLY, 0)
256  如果in_fd小于0则
262  ksys_read(in_fd, buf, BLOCK_SIZE)
263  ksys_write(out_fd, buf, BLOCK_SIZE)
265  如果非i与16的模则
266  打印标准信息("%c\b", rotator[rotate & 0x3])
267  rotate自加
271  打印标准信息("done.\n")
273  successful_load :
274  res等于1
275  done :
276  In contrast to sys_close(), this stub does not check whether the syscall* should or should not be restarted, but returns the raw error codes from* __close_fd().
277  noclose_input :
278  In contrast to sys_close(), this stub does not check whether the syscall* should or should not be restarted, but returns the raw error codes from* __close_fd().
279  out :
280  释放内存
281  ksys_unlink("/dev/ram")
282  返回:res
调用者
名称描述
rd_load_disk
initrd_load