Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
4ecf09fd
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
4ecf09fd
编写于
12月 24, 2009
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Unrot uml mconsole a bit
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
7b264fc2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
18 addition
and
31 deletion
+18
-31
arch/um/drivers/mconsole_kern.c
arch/um/drivers/mconsole_kern.c
+18
-31
未找到文件。
arch/um/drivers/mconsole_kern.c
浏览文件 @
4ecf09fd
...
...
@@ -125,50 +125,36 @@ void mconsole_log(struct mc_request *req)
void mconsole_proc(struct mc_request *req)
{
struct nameidata nd;
struct file_system_type *proc;
struct super_block *super;
struct vfsmount *mnt = current->nsproxy->pid_ns->proc_mnt;
struct file *file;
int n, err;
char *ptr = req->request.data, *buf;
mm_segment_t old_fs = get_fs();
ptr += strlen("proc");
ptr = skip_spaces(ptr);
proc = get_fs_type("proc"
);
if (
proc == NULL
) {
mconsole_reply(req, "
procfs not registered
", 1, 0);
err = vfs_path_lookup(mnt->mnt_root, mnt, ptr, LOOKUP_FOLLOW, &nd
);
if (
err
) {
mconsole_reply(req, "
Failed to look up file
", 1, 0);
goto out;
}
super = (*proc->get_sb)(proc, 0, NULL, NULL
);
put_filesystem(proc);
if (super == NULL) {
mconsole_reply(req, "Failed to get procfs superblock", 1, 0
);
err = may_open(&nd.path, MAY_READ, FMODE_READ
);
if (result) {
mconsole_reply(req, "Failed to open file", 1, 0);
path_put(&nd.path
);
goto out;
}
up_write(&super->s_umount);
nd.path.dentry = super->s_root;
nd.path.mnt = NULL;
nd.flags = O_RDONLY + 1;
nd.last_type = LAST_ROOT;
/* START: it was experienced that the stability problems are closed
* if commenting out these two calls + the below read cycle. To
* make UML crash again, it was enough to readd either one.*/
err = link_path_walk(ptr, &nd);
if (err) {
mconsole_reply(req, "Failed to look up file", 1, 0);
goto out_kill;
}
file = dentry_open(nd.path.dentry, nd.path.mnt, O_RDONLY,
current_cred());
err = PTR_ERR(file);
if (IS_ERR(file)) {
mconsole_reply(req, "Failed to open file", 1, 0);
goto out_kill;
path_put(&nd.path);
goto out;
}
/*END*/
buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (buf == NULL) {
...
...
@@ -176,10 +162,13 @@ void mconsole_proc(struct mc_request *req)
goto out_fput;
}
if (
(file->f_op != NULL) && (file->f_op->read != NULL)
) {
if (
file->f_op->read
) {
do {
n = (*file->f_op->read)(file, buf, PAGE_SIZE - 1,
&file->f_pos);
loff_t pos;
set_fs(KERNEL_DS);
n = vfs_read(file, buf, PAGE_SIZE - 1, &pos);
file_pos_write(file, pos);
set_fs(old_fs);
if (n >= 0) {
buf[n] = '\0';
mconsole_reply(req, buf, 0, (n > 0));
...
...
@@ -197,8 +186,6 @@ void mconsole_proc(struct mc_request *req)
kfree(buf);
out_fput:
fput(file);
out_kill:
deactivate_super(super);
out: ;
}
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录