Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
c233523b
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
c233523b
编写于
1月 05, 2012
作者:
R
Rafael J. Wysocki
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'pm-sleep' into pm-for-linus
* pm-sleep: PM / Hibernate: Implement compat_ioctl for /dev/snapshot
上级
9ec23949
c336078b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
64 addition
and
0 deletion
+64
-0
kernel/power/user.c
kernel/power/user.c
+64
-0
未找到文件。
kernel/power/user.c
浏览文件 @
c233523b
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include <linux/swapops.h>
#include <linux/swapops.h>
#include <linux/pm.h>
#include <linux/pm.h>
#include <linux/fs.h>
#include <linux/fs.h>
#include <linux/compat.h>
#include <linux/console.h>
#include <linux/console.h>
#include <linux/cpu.h>
#include <linux/cpu.h>
#include <linux/freezer.h>
#include <linux/freezer.h>
...
@@ -380,6 +381,66 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
...
@@ -380,6 +381,66 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
return
error
;
return
error
;
}
}
#ifdef CONFIG_COMPAT
struct
compat_resume_swap_area
{
compat_loff_t
offset
;
u32
dev
;
}
__packed
;
static
long
snapshot_compat_ioctl
(
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
BUILD_BUG_ON
(
sizeof
(
loff_t
)
!=
sizeof
(
compat_loff_t
));
switch
(
cmd
)
{
case
SNAPSHOT_GET_IMAGE_SIZE
:
case
SNAPSHOT_AVAIL_SWAP_SIZE
:
case
SNAPSHOT_ALLOC_SWAP_PAGE
:
{
compat_loff_t
__user
*
uoffset
=
compat_ptr
(
arg
);
loff_t
offset
;
mm_segment_t
old_fs
;
int
err
;
old_fs
=
get_fs
();
set_fs
(
KERNEL_DS
);
err
=
snapshot_ioctl
(
file
,
cmd
,
(
unsigned
long
)
&
offset
);
set_fs
(
old_fs
);
if
(
!
err
&&
put_user
(
offset
,
uoffset
))
err
=
-
EFAULT
;
return
err
;
}
case
SNAPSHOT_CREATE_IMAGE
:
return
snapshot_ioctl
(
file
,
cmd
,
(
unsigned
long
)
compat_ptr
(
arg
));
case
SNAPSHOT_SET_SWAP_AREA
:
{
struct
compat_resume_swap_area
__user
*
u_swap_area
=
compat_ptr
(
arg
);
struct
resume_swap_area
swap_area
;
mm_segment_t
old_fs
;
int
err
;
err
=
get_user
(
swap_area
.
offset
,
&
u_swap_area
->
offset
);
err
|=
get_user
(
swap_area
.
dev
,
&
u_swap_area
->
dev
);
if
(
err
)
return
-
EFAULT
;
old_fs
=
get_fs
();
set_fs
(
KERNEL_DS
);
err
=
snapshot_ioctl
(
file
,
SNAPSHOT_SET_SWAP_AREA
,
(
unsigned
long
)
&
swap_area
);
set_fs
(
old_fs
);
return
err
;
}
default:
return
snapshot_ioctl
(
file
,
cmd
,
arg
);
}
}
#endif
/* CONFIG_COMPAT */
static
const
struct
file_operations
snapshot_fops
=
{
static
const
struct
file_operations
snapshot_fops
=
{
.
open
=
snapshot_open
,
.
open
=
snapshot_open
,
.
release
=
snapshot_release
,
.
release
=
snapshot_release
,
...
@@ -387,6 +448,9 @@ static const struct file_operations snapshot_fops = {
...
@@ -387,6 +448,9 @@ static const struct file_operations snapshot_fops = {
.
write
=
snapshot_write
,
.
write
=
snapshot_write
,
.
llseek
=
no_llseek
,
.
llseek
=
no_llseek
,
.
unlocked_ioctl
=
snapshot_ioctl
,
.
unlocked_ioctl
=
snapshot_ioctl
,
#ifdef CONFIG_COMPAT
.
compat_ioctl
=
snapshot_compat_ioctl
,
#endif
};
};
static
struct
miscdevice
snapshot_device
=
{
static
struct
miscdevice
snapshot_device
=
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录