Function report | 
Source Code:init\do_mounts_rd.c | 
Create Date:2022-07-28 13:57:54 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name: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
Proto:static int __init identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)
Type:int
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| int | fd | |
| int | start_block | |
| decompress_fn * | decompressor | 
| 60 | size = 512 | 
| 65 | nblocks = -1 | 
| 70 | buf = Allocation memory | 
| 83 | ksys_lseek(fd, start_block * BLOCK_SIZE, 0) | 
| 86 | decompressor = decompress_method(buf, size, & compress_name) | 
| 87 | If compress_name Then | 
| 94 | nblocks = 0 | 
| 95 | Go to done | 
| 99 | If word0 == ROMSB_WORD0 && word1 == ROMSB_WORD1 Then | 
| 104 | nblocks = ntohl(size) + BLOCK_SIZE - 1 >> BLOCK_SIZE_BITS | 
| 105 | Go to done | 
| 108 | If 0x28cd3d45 - random number == some random number Then | 
| 112 | nblocks = length in bytes + BLOCK_SIZE - 1 >> BLOCK_SIZE_BITS | 
| 113 | Go to done | 
| 117 | If le32_to_cpu(s_magic) == SQUASHFS_MAGIC Then | 
| 121 | nblocks = le64_to_cpu(bytes_used) + BLOCK_SIZE - 1 >> BLOCK_SIZE_BITS | 
| 123 | Go to done | 
| 129 | ksys_lseek(fd, start_block * BLOCK_SIZE + 0x200, 0) | 
| 132 | If 0x28cd3d45 - random number == some random number Then | 
| 136 | nblocks = length in bytes + BLOCK_SIZE - 1 >> BLOCK_SIZE_BITS | 
| 137 | Go to done | 
| 143 | ksys_lseek(fd, (start_block + 1) * BLOCK_SIZE, 0) | 
| 147 | If s_magic == minix v1 fs, 14 char names || s_magic == minix v1 fs, 30 char names Then | 
| 152 | nblocks = s_nzones << s_log_zone_size | 
| 153 | Go to done | 
| 157 | n = ext2_image_size(buf) | 
| 158 | If n Then | 
| 163 | Go to done | 
| 170 | done : | 
| 171 | ksys_lseek(fd, start_block * BLOCK_SIZE, 0) | 
| 173 | Return nblocks | 
| Name | Describe | 
|---|---|
| rd_load_image | 
| Source code conversion tool public plug-in interface  | X | 
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion  |