函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:snapshot_ioctl

函数原型:static long snapshot_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)

返回类型:long

参数:

类型参数名称
struct file *filp
unsigned intcmd
unsigned longarg
204  error等于0
209  如果_IOC_TYPE(cmd)不等于SNAPSHOT_IOC_MAGIC则返回:负ENOTTY
211  如果_IOC_NR(cmd)大于SNAPSHOT_IOC_MAXNR则返回:负ENOTTY
213  如果非操作权限检查则返回:负EPERM
216  如果非mutex_trylock - try to acquire the mutex, without waiting*@lock: the mutex to be acquired* Try to acquire the mutex atomically则返回:负EBUSY
219  lock_device_hotplug()
220  data等于 needed for tty driver, and maybe others
224  :cmd恒等于SNAPSHOT_FREEZE
225  如果frozen退出
228  ksys_sync_helper()
230  error等于ze_processes - Signal user space processes to enter the refrigerator.* The current thread will not be frozen. The same process that calls* freeze_processes must later call thaw_processes.* On success, returns 0
231  如果error退出
234  error等于reate_basic_memory_bitmaps - Create bitmaps to hold basic page information
235  如果errorthaw_processes()
237  否则frozen = true
240  退出
242  :cmd恒等于SNAPSHOT_UNFREEZE
243  如果非frozenready退出
245  pm_restore_gfp_mask()
246  _basic_memory_bitmaps - Free memory bitmaps holding basic information.* Free memory bitmaps allocated by create_basic_memory_bitmaps(). The* auxiliary pointers are necessary so that the bitmaps themselves are not* referred to while they are being freed.
247  free_bitmaps = false
248  thaw_processes()
249  frozen = false
250  退出
252  :cmd恒等于SNAPSHOT_CREATE_IMAGE
253  如果mode不等于O_RDONLY或非frozenready
254  error等于负EPERM
255  退出
257  pm_restore_gfp_mask()
258  error等于hibernation_snapshot - Quiesce devices and create a hibernation image.*@platform_mode: If set, use platform driver to prepare for the transition.* This routine must be called with system_transition_mutex held.
259  如果非error
261  ready等于非freezer_test_done且非error
262  freezer_test_done = false
264  退出
266  :cmd恒等于SNAPSHOT_ATOMIC_RESTORE
267  snapshot_write_finalize - Complete the loading of a hibernation image.* Must be called after the last call to snapshot_write_next() in case the last* page in the image happens to be a highmem page and its contents should be* stored in highmem
268  如果mode不等于O_WRONLY或非frozen或非snapshot_image_loaded( & handle)则
270  error等于负EPERM
271  退出
273  error等于hibernation_restore - Quiesce devices and restore from a hibernation image
274  退出
276  :cmd恒等于SNAPSHOT_FREE
277  swsusp_free - Free pages allocated for hibernation image.* Image pages are alocated before snapshot creation, so they need to be* released after resume.
278  memset( & handle, 0, sizeof(structsnapshot_handle))
279  ready = false
288  thaw_kernel_threads()
289  退出
291  :cmd恒等于SNAPSHOT_PREF_IMAGE_SIZE
292  Preferred image size in bytes (tunable via /sys/power/image_size).* When it is set to N, swsusp will do its best to ensure the image* size will not exceed N bytes, but if that is impossible, it will* try to create the smallest image possible.等于arg
293  退出
295  :cmd恒等于SNAPSHOT_GET_IMAGE_SIZE
296  如果非ready
297  error等于负ENODATA
298  退出
300  size等于snapshot_get_image_size()
301  size左移等于PAGE_SHIFT determines the page size
302  error等于put_user - Write a simple value into user space(size, (loff_t__user * )arg)
303  退出
305  :cmd恒等于SNAPSHOT_AVAIL_SWAP_SIZE
306  size等于count_swap_pages(swap, 1)
307  size左移等于PAGE_SHIFT determines the page size
308  error等于put_user - Write a simple value into user space(size, (loff_t__user * )arg)
309  退出
311  :cmd恒等于SNAPSHOT_ALLOC_SWAP_PAGE
312  如果swap小于0或swap大于等于MAX_SWAPFILES
313  error等于负ENODEV
314  退出
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  如果offset
320  否则
321  error等于负ENOSPC
323  退出
325  :cmd恒等于SNAPSHOT_FREE_SWAP_PAGES
326  如果swap小于0或swap大于等于MAX_SWAPFILES
327  error等于负ENODEV
328  退出
330  _all_swap_pages - free swap pages allocated for saving image data.* It also frees the extents used to register which swap entries had been* allocated.
331  退出
333  :cmd恒等于SNAPSHOT_S2RAM
334  如果非frozen
335  error等于负EPERM
336  退出
342  error等于suspend_devices_and_enter - Suspend devices and enter system sleep state.*@state: System sleep state to enter.
343  ready = false
344  退出
346  :cmd恒等于SNAPSHOT_PLATFORM_SUPPORT
347  platform_support等于非非arg
348  退出
350  :cmd恒等于SNAPSHOT_POWER_OFF
351  如果platform_supporterror等于hibernation_platform_enter - Power off the system using the platform driver.
353  退出
355  :cmd恒等于SNAPSHOT_SET_SWAP_AREA
356  如果swsusp_swap_in_use()则
357  error等于负EPERM
358  否则
362  error等于copy_from_user( & swap_area, (void__user * )arg, sizeof(structresume_swap_area))
364  如果error
365  error等于负EFAULT
366  退出
373  swdev等于new_decode_dev(dev)
374  如果swdev
375  offset等于offset
376  swap等于swap_type_of(swdev, offset, NULL)
377  如果swap小于0则error等于负ENODEV
379  否则
380  swap等于负1
381  error等于负EINVAL
384  退出
386  默认
387  error等于负ENOTTY
391  unlock_device_hotplug()
392  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
394  返回:error
调用者
名称描述
snapshot_compat_ioctl