Function report | 
Source Code:kernel\power\user.c | 
Create Date:2022-07-28 10:03:55 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:snapshot_ioctl
Proto:static long snapshot_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
Type:long
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct file * | filp | |
| unsigned int | cmd | |
| unsigned long | arg | 
| 204 | error = 0 | 
| 209 | If _IOC_TYPE(cmd) != SNAPSHOT_IOC_MAGIC Then Return -ENOTTY | 
| 211 | If _IOC_NR(cmd) > SNAPSHOT_IOC_MAXNR Then Return -ENOTTY | 
| 213 | If Not Check operation authority Then Return -EPERM | 
| 216 | If Not mutex_trylock - try to acquire the mutex, without waiting*@lock: the mutex to be acquired* Try to acquire the mutex atomically Then Return -EBUSY | 
| 219 | lock_device_hotplug() | 
| 224 | Case cmd == SNAPSHOT_FREEZE | 
| 225 | If frozen Then Break | 
| 228 | ksys_sync_helper() | 
| 231 | If error Then Break | 
| 235 | If error Then thaw_processes() | 
| 237 | Else frozen = true | 
| 240 | Break | 
| 242 | Case cmd == SNAPSHOT_UNFREEZE | 
| 245 | pm_restore_gfp_mask() | 
| 247 | free_bitmaps = false | 
| 248 | thaw_processes() | 
| 249 | frozen = false | 
| 250 | Break | 
| 252 | Case cmd == SNAPSHOT_CREATE_IMAGE | 
| 257 | pm_restore_gfp_mask() | 
| 259 | If Not error Then | 
| 260 | error = Write a simple value into user space(in_suspend, (int__user * )arg) | 
| 261 | ready = Not freezer_test_done && Not error | 
| 262 | freezer_test_done = false | 
| 264 | Break | 
| 266 | Case cmd == SNAPSHOT_ATOMIC_RESTORE | 
| 268 | If mode != O_WRONLY || Not frozen || Not snapshot_image_loaded( & handle) Then | 
| 274 | Break | 
| 276 | Case cmd == SNAPSHOT_FREE | 
| 278 | memset( & handle, 0, sizeof(structsnapshot_handle)) | 
| 279 | ready = false | 
| 288 | thaw_kernel_threads() | 
| 289 | Break | 
| 291 | Case cmd == SNAPSHOT_PREF_IMAGE_SIZE | 
| 293 | Break | 
| 295 | Case cmd == SNAPSHOT_GET_IMAGE_SIZE | 
| 305 | Case cmd == SNAPSHOT_AVAIL_SWAP_SIZE | 
| 306 | size = count_swap_pages(swap, 1) | 
| 309 | Break | 
| 311 | Case cmd == SNAPSHOT_ALLOC_SWAP_PAGE | 
| 312 | If swap < 0 || swap >= MAX_SWAPFILES Then | 
| 316 | offset = alloc_swapdev_block - allocate a swap page and register that it has* been allocated, so that it can be freed in case of an error. | 
| 317 | If offset Then | 
| 320 | Else | 
| 323 | Break | 
| 325 | Case cmd == SNAPSHOT_FREE_SWAP_PAGES | 
| 326 | If swap < 0 || swap >= MAX_SWAPFILES Then | 
| 331 | Break | 
| 333 | Case cmd == SNAPSHOT_S2RAM | 
| 334 | If Not frozen Then | 
| 342 | error = suspend_devices_and_enter - Suspend devices and enter system sleep state.*@state: System sleep state to enter. | 
| 343 | ready = false | 
| 344 | Break | 
| 346 | Case cmd == SNAPSHOT_PLATFORM_SUPPORT | 
| 347 | platform_support = Not Not arg | 
| 348 | Break | 
| 350 | Case cmd == SNAPSHOT_POWER_OFF | 
| 351 | If platform_support Then error = hibernation_platform_enter - Power off the system using the platform driver. | 
| 353 | Break | 
| 355 | Case cmd == SNAPSHOT_SET_SWAP_AREA | 
| 356 | If swsusp_swap_in_use() Then | 
| 358 | Else | 
| 362 | error = copy_from_user( & swap_area, (void__user * )arg, sizeof(structresume_swap_area)) | 
| 364 | If error Then | 
| 373 | swdev = new_decode_dev(dev) | 
| 374 | If swdev Then | 
| 376 | swap = swap_type_of(swdev, offset, NULL) | 
| 379 | Else | 
| 384 | Break | 
| 386 | Default | 
| 391 | unlock_device_hotplug() | 
| 394 | Return error | 
| Name | Describe | 
|---|---|
| snapshot_compat_ioctl | 
| 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  |