Function report |
Source Code:kernel\power\swap.c |
Create Date:2022-07-28 10:03:10 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:load_image_lzo - Load compressed image data and decompress them with LZO.*@handle: Swap map handle to use for loading data.*@snapshot: Image to copy uncompressed data into.*@nr_to_read: Number of pages to load.
Proto:static int load_image_lzo(struct swap_map_handle *handle, struct snapshot_handle *snapshot, unsigned int nr_to_read)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct swap_map_handle * | handle | |
| struct snapshot_handle * | snapshot | |
| unsigned int | nr_to_read |
| 1159 | ret = 0 |
| 1160 | eof = 0 |
| 1169 | read_pages = 0 |
| 1170 | unsigned char * * page = NULL |
| 1174 | hib_init_batch( & hb) |
| 1180 | nr_threads = num_online_cpus() - 1 |
| 1184 | If Not page Then |
| 1191 | If Not data Then |
| 1199 | crc = Allocation memory |
| 1200 | If Not crc Then |
| 1207 | clean_pages_on_decompress = true |
| 1212 | When thr < nr_threads cycle |
| 1213 | init_waitqueue_head( & start decompression ) |
| 1214 | init_waitqueue_head( & decompression done ) |
| 1230 | init_waitqueue_head( & start crc update ) |
| 1231 | init_waitqueue_head( & crc update done ) |
| 1233 | crc32 = 0 |
| 1234 | points to handle's crc32 = crc32 |
| 1235 | When thr < nr_threads cycle |
| 1236 | uncompressed data [thr] = unc |
| 1237 | uncompressed lengths [thr] = uncompressed length |
| 1255 | If Number of free pages that are not high. > snapshot_get_image_size() Then read_pages = (Number of free pages that are not high. - snapshot_get_image_size()) / 2 |
| 1259 | When i < read_pages cycle |
| 1278 | pr_info("Using %u thread(s) for decompression\n", nr_threads) |
| 1279 | pr_info("Loading and decompressing image data (%u pages)...\n", nr_to_read) |
| 1281 | m = nr_to_read / 10 |
| 1284 | nr_pages = 0 |
| 1288 | If ret <= 0 Then Go to out_finish |
| 1291 | cycle |
| 1294 | If ret Then |
| 1316 | If Not have Then |
| 1317 | If Not asked Then Break |
| 1320 | ret = hib_wait_io( & hb) |
| 1321 | If ret Then Go to out_finish |
| 1324 | asked = 0 |
| 1329 | If r current threads Then |
| 1331 | atomic_set( & ady to stop flag , 0) |
| 1332 | r current threads = 0 |
| 1335 | When have && thr < nr_threads cycle |
| 1336 | compressed length = page[pg] |
| 1345 | need = DIV_ROUND_UP(compressed length + We need to remember how much compressed data we need to read. , PAGE_SIZE) |
| 1366 | atomic_set( & ady to start flag , 1) |
| 1367 | wake_up( & start decompression ) |
| 1373 | If have < Number of pages/bytes we need for compressed data (worst case). && asked Then |
| 1383 | When thr < run_threads cycle |
| 1386 | atomic_set( & ady to stop flag , 0) |
| 1390 | If ret < 0 Then |
| 1391 | pr_err("LZO decompression failed\n") |
| 1392 | Go to out_finish |
| 1395 | If Value for the false possibility is greater at compile time(!uncompressed length || uncompressed length > LZO_UNC_SIZE || uncompressed length & (PAGE_SIZE - 1)) Then |
| 1403 | When off < uncompressed length cycle |
| 1411 | nr_pages++ |
| 1414 | If ret <= 0 Then |
| 1415 | r current threads = thr + 1 |
| 1416 | atomic_set( & ady to start flag , 1) |
| 1417 | wake_up( & start crc update ) |
| 1418 | Go to out_finish |
| 1423 | r current threads = thr |
| 1424 | atomic_set( & ady to start flag , 1) |
| 1425 | wake_up( & start crc update ) |
| 1428 | out_finish : |
| 1429 | If r current threads Then |
| 1431 | atomic_set( & ady to stop flag , 0) |
| 1434 | If Not ret Then |
| 1435 | pr_info("Image loading done\n") |
| 1437 | If Not snapshot_image_loaded(snapshot) Then ret = -ENODATA |
| 1439 | If Not ret Then |
| 1440 | If Flags to pass to the "boot" kernel & SF_CRC32_MODE Then |
| 1449 | out_clean : |
| 1452 | If crc Then |
| 1453 | If hread Then stop a thread |
| 1457 | If data Then |
| 1465 | Return ret |
| Name | Describe |
|---|---|
| swsusp_read | swsusp_read - read the hibernation image.*@flags_p: flags passed by the "frozen" kernel in the image header should* be written into this memory location |
| 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 |