Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:init\do_mounts_rd.c Create Date:2022-07-28 13:58:01
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:rd_load_image

Proto:int __init rd_load_image(char *from)

Type:int

Parameter:

TypeParameterName
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  If out_fd < 0 Then Go to out
193  in_fd = ksys_open(from, O_RDONLY, 0)
194  If in_fd < 0 Then Go to 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  If nblocks < 0 Then Go to done
201  If nblocks == 0 Then
202  If crd_load(in_fd, out_fd, decompressor) == 0 Then Go to successful_load
204  Go to done
211  If ksys_ioctl(out_fd, urn device size /512 (long *arg) , (unsignedlong) & rd_blocks) < 0 Then rd_blocks = 0
213  Else rd_blocks >>= 1
216  If nblocks > rd_blocks Then
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  Go to done
225  If ksys_ioctl(in_fd, urn device size /512 (long *arg) , (unsignedlong) & devblocks) < 0 Then devblocks = 0
227  Else devblocks >>= 1
230  If strcmp(from, "/initrd.image") == 0 Then devblocks = nblocks
233  If devblocks == 0 Then
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  Go to done
238  buf = Allocation memory
239  If Not buf Then
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  Go to 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  When i < nblocks cycle
247  If i && i % devblocks == 0 Then
249  rotate = 0
254  change_floppy("disk #%d", disk)
255  in_fd = ksys_open(from, O_RDONLY, 0)
256  If in_fd < 0 Then
262  ksys_read(in_fd, buf, BLOCK_SIZE)
263  ksys_write(out_fd, buf, BLOCK_SIZE)
265  If Not (i % 16) Then
267  rotate++
271  Like KERN_CONT, pr_cont() should only be used when continuing* a line with no newline ('\n') enclosed. Otherwise it defaults* back to KERN_DEFAULT.("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  free previously allocated memory
281  ksys_unlink("/dev/ram")
282  Return res
Caller
NameDescribe
rd_load_disk
initrd_load