Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Linux-御风守护者
linux
提交
9643f5d9
L
linux
项目概览
Linux-御风守护者
/
linux
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9643f5d9
编写于
3月 03, 2010
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'for-fsnotify' into for-linus
上级
2bd3a997
c44dcc56
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
23 addition
and
76 deletion
+23
-76
fs/debugfs/inode.c
fs/debugfs/inode.c
+1
-1
fs/namei.c
fs/namei.c
+3
-5
fs/notify/inotify/inotify_user.c
fs/notify/inotify/inotify_user.c
+6
-53
include/linux/audit.h
include/linux/audit.h
+5
-6
include/linux/fsnotify.h
include/linux/fsnotify.h
+6
-5
include/linux/magic.h
include/linux/magic.h
+0
-1
kernel/auditsc.c
kernel/auditsc.c
+2
-5
未找到文件。
fs/debugfs/inode.c
浏览文件 @
9643f5d9
...
...
@@ -496,7 +496,7 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
}
d_move
(
old_dentry
,
dentry
);
fsnotify_move
(
old_dir
->
d_inode
,
new_dir
->
d_inode
,
old_name
,
old_dentry
->
d_name
.
name
,
S_ISDIR
(
old_dentry
->
d_inode
->
i_mode
),
S_ISDIR
(
old_dentry
->
d_inode
->
i_mode
),
NULL
,
old_dentry
);
fsnotify_oldname_free
(
old_name
);
unlock_rename
(
new_dir
,
old_dir
);
...
...
fs/namei.c
浏览文件 @
9643f5d9
...
...
@@ -1334,7 +1334,7 @@ static int may_delete(struct inode *dir,struct dentry *victim,int isdir)
return
-
ENOENT
;
BUG_ON
(
victim
->
d_parent
->
d_inode
!=
dir
);
audit_inode_child
(
victim
->
d_name
.
name
,
victim
,
dir
);
audit_inode_child
(
victim
,
dir
);
error
=
inode_permission
(
dir
,
MAY_WRITE
|
MAY_EXEC
);
if
(
error
)
...
...
@@ -2663,11 +2663,9 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
error
=
vfs_rename_dir
(
old_dir
,
old_dentry
,
new_dir
,
new_dentry
);
else
error
=
vfs_rename_other
(
old_dir
,
old_dentry
,
new_dir
,
new_dentry
);
if
(
!
error
)
{
const
char
*
new_name
=
old_dentry
->
d_name
.
name
;
fsnotify_move
(
old_dir
,
new_dir
,
old_name
,
new_name
,
is_dir
,
if
(
!
error
)
fsnotify_move
(
old_dir
,
new_dir
,
old_name
,
is_dir
,
new_dentry
->
d_inode
,
old_dentry
);
}
fsnotify_oldname_free
(
old_name
);
return
error
;
...
...
fs/notify/inotify/inotify_user.c
浏览文件 @
9643f5d9
...
...
@@ -29,14 +29,12 @@
#include <linux/init.h>
/* module_init */
#include <linux/inotify.h>
#include <linux/kernel.h>
/* roundup() */
#include <linux/magic.h>
/* superblock magic number */
#include <linux/mount.h>
/* mntget */
#include <linux/namei.h>
/* LOOKUP_FOLLOW */
#include <linux/path.h>
/* struct path */
#include <linux/sched.h>
/* struct user */
#include <linux/slab.h>
/* struct kmem_cache */
#include <linux/syscalls.h>
#include <linux/types.h>
#include <linux/anon_inodes.h>
#include <linux/uaccess.h>
#include <linux/poll.h>
#include <linux/wait.h>
...
...
@@ -45,8 +43,6 @@
#include <asm/ioctls.h>
static
struct
vfsmount
*
inotify_mnt
__read_mostly
;
/* these are configurable via /proc/sys/fs/inotify/ */
static
int
inotify_max_user_instances
__read_mostly
;
static
int
inotify_max_queued_events
__read_mostly
;
...
...
@@ -645,9 +641,7 @@ SYSCALL_DEFINE1(inotify_init1, int, flags)
{
struct
fsnotify_group
*
group
;
struct
user_struct
*
user
;
struct
file
*
filp
;
struct
path
path
;
int
fd
,
ret
;
int
ret
;
/* Check the IN_* constants for consistency. */
BUILD_BUG_ON
(
IN_CLOEXEC
!=
O_CLOEXEC
);
...
...
@@ -656,10 +650,6 @@ SYSCALL_DEFINE1(inotify_init1, int, flags)
if
(
flags
&
~
(
IN_CLOEXEC
|
IN_NONBLOCK
))
return
-
EINVAL
;
fd
=
get_unused_fd_flags
(
flags
&
O_CLOEXEC
);
if
(
fd
<
0
)
return
fd
;
user
=
get_current_user
();
if
(
unlikely
(
atomic_read
(
&
user
->
inotify_devs
)
>=
inotify_max_user_instances
))
{
...
...
@@ -676,27 +666,14 @@ SYSCALL_DEFINE1(inotify_init1, int, flags)
atomic_inc
(
&
user
->
inotify_devs
);
path
.
mnt
=
inotify_mnt
;
path
.
dentry
=
inotify_mnt
->
mnt_root
;
path_get
(
&
path
);
filp
=
alloc_file
(
&
path
,
FMODE_READ
,
&
inotify_fops
);
if
(
!
filp
)
goto
Enfile
;
filp
->
f_flags
=
O_RDONLY
|
(
flags
&
O_NONBLOCK
);
filp
->
private_data
=
group
;
fd_install
(
fd
,
filp
);
return
fd
;
ret
=
anon_inode_getfd
(
"inotify"
,
&
inotify_fops
,
group
,
O_RDONLY
|
flags
);
if
(
ret
>=
0
)
return
ret
;
Enfile:
ret
=
-
ENFILE
;
path_put
(
&
path
);
atomic_dec
(
&
user
->
inotify_devs
);
out_free_uid:
free_uid
(
user
);
put_unused_fd
(
fd
);
return
ret
;
}
...
...
@@ -783,20 +760,6 @@ SYSCALL_DEFINE2(inotify_rm_watch, int, fd, __s32, wd)
return
ret
;
}
static
int
inotify_get_sb
(
struct
file_system_type
*
fs_type
,
int
flags
,
const
char
*
dev_name
,
void
*
data
,
struct
vfsmount
*
mnt
)
{
return
get_sb_pseudo
(
fs_type
,
"inotify"
,
NULL
,
INOTIFYFS_SUPER_MAGIC
,
mnt
);
}
static
struct
file_system_type
inotify_fs_type
=
{
.
name
=
"inotifyfs"
,
.
get_sb
=
inotify_get_sb
,
.
kill_sb
=
kill_anon_super
,
};
/*
* inotify_user_setup - Our initialization function. Note that we cannnot return
* error because we have compiled-in VFS hooks. So an (unlikely) failure here
...
...
@@ -804,16 +767,6 @@ static struct file_system_type inotify_fs_type = {
*/
static
int
__init
inotify_user_setup
(
void
)
{
int
ret
;
ret
=
register_filesystem
(
&
inotify_fs_type
);
if
(
unlikely
(
ret
))
panic
(
"inotify: register_filesystem returned %d!
\n
"
,
ret
);
inotify_mnt
=
kern_mount
(
&
inotify_fs_type
);
if
(
IS_ERR
(
inotify_mnt
))
panic
(
"inotify: kern_mount ret %ld!
\n
"
,
PTR_ERR
(
inotify_mnt
));
inotify_inode_mark_cachep
=
KMEM_CACHE
(
inotify_inode_mark_entry
,
SLAB_PANIC
);
event_priv_cachep
=
KMEM_CACHE
(
inotify_event_private_data
,
SLAB_PANIC
);
...
...
include/linux/audit.h
浏览文件 @
9643f5d9
...
...
@@ -424,7 +424,7 @@ extern void audit_syscall_exit(int failed, long return_code);
extern
void
__audit_getname
(
const
char
*
name
);
extern
void
audit_putname
(
const
char
*
name
);
extern
void
__audit_inode
(
const
char
*
name
,
const
struct
dentry
*
dentry
);
extern
void
__audit_inode_child
(
const
char
*
dname
,
const
struct
dentry
*
dentry
,
extern
void
__audit_inode_child
(
const
struct
dentry
*
dentry
,
const
struct
inode
*
parent
);
extern
void
__audit_ptrace
(
struct
task_struct
*
t
);
...
...
@@ -442,11 +442,10 @@ static inline void audit_inode(const char *name, const struct dentry *dentry) {
if
(
unlikely
(
!
audit_dummy_context
()))
__audit_inode
(
name
,
dentry
);
}
static
inline
void
audit_inode_child
(
const
char
*
dname
,
const
struct
dentry
*
dentry
,
static
inline
void
audit_inode_child
(
const
struct
dentry
*
dentry
,
const
struct
inode
*
parent
)
{
if
(
unlikely
(
!
audit_dummy_context
()))
__audit_inode_child
(
d
name
,
d
entry
,
parent
);
__audit_inode_child
(
dentry
,
parent
);
}
void
audit_core_dumps
(
long
signr
);
...
...
@@ -544,9 +543,9 @@ extern int audit_signals;
#define audit_getname(n) do { ; } while (0)
#define audit_putname(n) do { ; } while (0)
#define __audit_inode(n,d) do { ; } while (0)
#define __audit_inode_child(
d,
i,p) do { ; } while (0)
#define __audit_inode_child(i,p) do { ; } while (0)
#define audit_inode(n,d) do { ; } while (0)
#define audit_inode_child(
d,
i,p) do { ; } while (0)
#define audit_inode_child(i,p) do { ; } while (0)
#define audit_core_dumps(i) do { ; } while (0)
#define auditsc_get_stamp(c,t,s) (0)
#define audit_get_loginuid(t) (-1)
...
...
include/linux/fsnotify.h
浏览文件 @
9643f5d9
...
...
@@ -65,7 +65,7 @@ static inline void fsnotify_link_count(struct inode *inode)
* fsnotify_move - file old_name at old_dir was moved to new_name at new_dir
*/
static
inline
void
fsnotify_move
(
struct
inode
*
old_dir
,
struct
inode
*
new_dir
,
const
char
*
old_name
,
const
char
*
new_name
,
const
char
*
old_name
,
int
isdir
,
struct
inode
*
target
,
struct
dentry
*
moved
)
{
struct
inode
*
source
=
moved
->
d_inode
;
...
...
@@ -73,6 +73,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
u32
fs_cookie
=
fsnotify_get_cookie
();
__u32
old_dir_mask
=
(
FS_EVENT_ON_CHILD
|
FS_MOVED_FROM
);
__u32
new_dir_mask
=
(
FS_EVENT_ON_CHILD
|
FS_MOVED_TO
);
const
char
*
new_name
=
moved
->
d_name
.
name
;
if
(
old_dir
==
new_dir
)
old_dir_mask
|=
FS_DN_RENAME
;
...
...
@@ -103,7 +104,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
inotify_inode_queue_event
(
source
,
IN_MOVE_SELF
,
0
,
NULL
,
NULL
);
fsnotify
(
source
,
FS_MOVE_SELF
,
moved
->
d_inode
,
FSNOTIFY_EVENT_INODE
,
NULL
,
0
);
}
audit_inode_child
(
new_name
,
moved
,
new_dir
);
audit_inode_child
(
moved
,
new_dir
);
}
/*
...
...
@@ -146,7 +147,7 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
{
inotify_inode_queue_event
(
inode
,
IN_CREATE
,
0
,
dentry
->
d_name
.
name
,
dentry
->
d_inode
);
audit_inode_child
(
dentry
->
d_name
.
name
,
dentry
,
inode
);
audit_inode_child
(
dentry
,
inode
);
fsnotify
(
inode
,
FS_CREATE
,
dentry
->
d_inode
,
FSNOTIFY_EVENT_INODE
,
dentry
->
d_name
.
name
,
0
);
}
...
...
@@ -161,7 +162,7 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct
inotify_inode_queue_event
(
dir
,
IN_CREATE
,
0
,
new_dentry
->
d_name
.
name
,
inode
);
fsnotify_link_count
(
inode
);
audit_inode_child
(
new_dentry
->
d_name
.
name
,
new_dentry
,
dir
);
audit_inode_child
(
new_dentry
,
dir
);
fsnotify
(
dir
,
FS_CREATE
,
inode
,
FSNOTIFY_EVENT_INODE
,
new_dentry
->
d_name
.
name
,
0
);
}
...
...
@@ -175,7 +176,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
struct
inode
*
d_inode
=
dentry
->
d_inode
;
inotify_inode_queue_event
(
inode
,
mask
,
0
,
dentry
->
d_name
.
name
,
d_inode
);
audit_inode_child
(
dentry
->
d_name
.
name
,
dentry
,
inode
);
audit_inode_child
(
dentry
,
inode
);
fsnotify
(
inode
,
mask
,
d_inode
,
FSNOTIFY_EVENT_INODE
,
dentry
->
d_name
.
name
,
0
);
}
...
...
include/linux/magic.h
浏览文件 @
9643f5d9
...
...
@@ -52,7 +52,6 @@
#define CGROUP_SUPER_MAGIC 0x27e0eb
#define FUTEXFS_SUPER_MAGIC 0xBAD1DEA
#define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA
#define STACK_END_MAGIC 0x57AC6E9D
...
...
kernel/auditsc.c
浏览文件 @
9643f5d9
...
...
@@ -1988,7 +1988,6 @@ void __audit_inode(const char *name, const struct dentry *dentry)
/**
* audit_inode_child - collect inode info for created/removed objects
* @dname: inode's dentry name
* @dentry: dentry being audited
* @parent: inode of dentry parent
*
...
...
@@ -2000,13 +1999,14 @@ void __audit_inode(const char *name, const struct dentry *dentry)
* must be hooked prior, in order to capture the target inode during
* unsuccessful attempts.
*/
void
__audit_inode_child
(
const
char
*
dname
,
const
struct
dentry
*
dentry
,
void
__audit_inode_child
(
const
struct
dentry
*
dentry
,
const
struct
inode
*
parent
)
{
int
idx
;
struct
audit_context
*
context
=
current
->
audit_context
;
const
char
*
found_parent
=
NULL
,
*
found_child
=
NULL
;
const
struct
inode
*
inode
=
dentry
->
d_inode
;
const
char
*
dname
=
dentry
->
d_name
.
name
;
int
dirlen
=
0
;
if
(
!
context
->
in_syscall
)
...
...
@@ -2014,9 +2014,6 @@ void __audit_inode_child(const char *dname, const struct dentry *dentry,
if
(
inode
)
handle_one
(
inode
);
/* determine matching parent */
if
(
!
dname
)
goto
add_names
;
/* parent is more likely, look for it first */
for
(
idx
=
0
;
idx
<
context
->
name_count
;
idx
++
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录