Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\power\user.c Create Date:2022-07-28 10:03:42
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:snapshot_open

Proto:static int snapshot_open(struct inode *inode, struct file *filp)

Type:int

Parameter:

TypeParameterName
struct inode *inode
struct file *filp
47  nr_calls = 0
49  If Not hibernation_available() Then Return -EPERM
52  lock_system_sleep()
54  If Not atomic_add_unless - add unless the number is already a given value*@v: pointer of type atomic_t*@a: the amount to add to v...*@u: ...unless v is equal to u.* Atomically adds @a to @v, if @v was not already @u.* Returns true if the addition was done. Then
55  error = -EBUSY
56  Go to Unlock
59  If (f_flags & O_ACCMODE) == O_RDWR Then
60  atomic_inc( & snapshot_device_available)
61  error = -ENOSYS
62  Go to Unlock
64  nonseekable_open(inode, filp)
65  data = snapshot_state
66  needed for tty driver, and maybe others = data
67  memset( & handle, 0, sizeof(structsnapshot_handle))
68  If (f_flags & O_ACCMODE) == O_RDONLY Then
70  swap = If swsusp_resume_device Then swap_type_of(swsusp_resume_device, 0, NULL) Else -1
72  mode = O_RDONLY
73  free_bitmaps = false
74  error = __pm_notifier_call_chain(Going to hibernate , - 1, & nr_calls)
75  If error Then __pm_notifier_call_chain(Hibernation finished , --nr_calls, NULL)
77  Else
82  wait_for_device_probe()
84  swap = -1
85  mode = O_WRONLY
86  error = __pm_notifier_call_chain(Going to restore a saved image , - 1, & nr_calls)
87  If Not error Then
89  free_bitmaps = Not error
90  Else nr_calls--
93  If error Then __pm_notifier_call_chain(Restore failed , nr_calls, NULL)
96  If error Then atomic_inc( & snapshot_device_available)
99  frozen = false
100  ready = false
101  platform_support = false
103  Unlock :
104  unlock_system_sleep()
106  Return error