Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
fceef393
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 2 年 前同步成功
通知
173
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看板
提交
fceef393
编写于
12月 29, 2015
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
switch ->get_link() to delayed_call, kill ->put_link()
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
cd3417c8
变更
43
隐藏空白更改
内联
并排
Showing
43 changed file
with
206 addition
and
218 deletion
+206
-218
Documentation/filesystems/Locking
Documentation/filesystems/Locking
+0
-2
Documentation/filesystems/porting
Documentation/filesystems/porting
+6
-0
Documentation/filesystems/vfs.txt
Documentation/filesystems/vfs.txt
+10
-11
drivers/staging/lustre/lustre/llite/symlink.c
drivers/staging/lustre/lustre/llite/symlink.c
+9
-9
fs/9p/vfs_inode.c
fs/9p/vfs_inode.c
+5
-4
fs/9p/vfs_inode_dotl.c
fs/9p/vfs_inode_dotl.c
+5
-4
fs/affs/symlink.c
fs/affs/symlink.c
+0
-1
fs/autofs4/symlink.c
fs/autofs4/symlink.c
+2
-1
fs/btrfs/inode.c
fs/btrfs/inode.c
+0
-1
fs/cifs/cifsfs.c
fs/cifs/cifsfs.c
+0
-1
fs/cifs/cifsfs.h
fs/cifs/cifsfs.h
+2
-1
fs/cifs/link.c
fs/cifs/link.c
+4
-2
fs/coda/cnode.c
fs/coda/cnode.c
+0
-1
fs/configfs/symlink.c
fs/configfs/symlink.c
+9
-8
fs/ecryptfs/inode.c
fs/ecryptfs/inode.c
+4
-3
fs/ext2/symlink.c
fs/ext2/symlink.c
+0
-1
fs/ext4/symlink.c
fs/ext4/symlink.c
+4
-4
fs/f2fs/namei.c
fs/f2fs/namei.c
+9
-7
fs/fuse/dir.c
fs/fuse/dir.c
+3
-3
fs/gfs2/inode.c
fs/gfs2/inode.c
+4
-4
fs/hostfs/hostfs_kern.c
fs/hostfs/hostfs_kern.c
+6
-10
fs/jfs/symlink.c
fs/jfs/symlink.c
+0
-1
fs/kernfs/symlink.c
fs/kernfs/symlink.c
+10
-9
fs/libfs.c
fs/libfs.c
+5
-4
fs/minix/inode.c
fs/minix/inode.c
+0
-1
fs/namei.c
fs/namei.c
+26
-37
fs/ncpfs/inode.c
fs/ncpfs/inode.c
+0
-1
fs/nfs/symlink.c
fs/nfs/symlink.c
+3
-3
fs/nilfs2/namei.c
fs/nilfs2/namei.c
+0
-1
fs/ocfs2/symlink.c
fs/ocfs2/symlink.c
+0
-1
fs/overlayfs/inode.c
fs/overlayfs/inode.c
+3
-42
fs/proc/base.c
fs/proc/base.c
+5
-3
fs/proc/inode.c
fs/proc/inode.c
+8
-8
fs/proc/namespaces.c
fs/proc/namespaces.c
+2
-1
fs/proc/self.c
fs/proc/self.c
+4
-3
fs/proc/thread_self.c
fs/proc/thread_self.c
+4
-3
fs/reiserfs/namei.c
fs/reiserfs/namei.c
+0
-1
fs/squashfs/symlink.c
fs/squashfs/symlink.c
+0
-1
fs/sysv/inode.c
fs/sysv/inode.c
+0
-1
fs/xfs/xfs_iops.c
fs/xfs/xfs_iops.c
+3
-3
include/linux/delayed_call.h
include/linux/delayed_call.h
+34
-0
include/linux/fs.h
include/linux/fs.h
+8
-6
mm/shmem.c
mm/shmem.c
+9
-10
未找到文件。
Documentation/filesystems/Locking
浏览文件 @
fceef393
...
@@ -51,7 +51,6 @@ prototypes:
...
@@ -51,7 +51,6 @@ prototypes:
struct inode *, struct dentry *, unsigned int);
struct inode *, struct dentry *, unsigned int);
int (*readlink) (struct dentry *, char __user *,int);
int (*readlink) (struct dentry *, char __user *,int);
const char *(*get_link) (struct dentry *, struct inode *, void **);
const char *(*get_link) (struct dentry *, struct inode *, void **);
void (*put_link) (struct inode *, void *);
void (*truncate) (struct inode *);
void (*truncate) (struct inode *);
int (*permission) (struct inode *, int, unsigned int);
int (*permission) (struct inode *, int, unsigned int);
int (*get_acl)(struct inode *, int);
int (*get_acl)(struct inode *, int);
...
@@ -84,7 +83,6 @@ rename: yes (all) (see below)
...
@@ -84,7 +83,6 @@ rename: yes (all) (see below)
rename2: yes (all) (see below)
rename2: yes (all) (see below)
readlink: no
readlink: no
get_link: no
get_link: no
put_link: no
setattr: yes
setattr: yes
permission: no (may not block if called in rcu-walk mode)
permission: no (may not block if called in rcu-walk mode)
get_acl: no
get_acl: no
...
...
Documentation/filesystems/porting
浏览文件 @
fceef393
...
@@ -515,3 +515,9 @@ in your dentry operations instead.
...
@@ -515,3 +515,9 @@ in your dentry operations instead.
* ->get_link() gets inode as a separate argument
* ->get_link() gets inode as a separate argument
* ->get_link() may be called in RCU mode - in that case NULL
* ->get_link() may be called in RCU mode - in that case NULL
dentry is passed
dentry is passed
--
[mandatory]
->get_link() gets struct delayed_call *done now, and should do
set_delayed_call() where it used to set *cookie.
->put_link() is gone - just give the destructor to set_delayed_call()
in ->get_link().
Documentation/filesystems/vfs.txt
浏览文件 @
fceef393
...
@@ -350,8 +350,8 @@ struct inode_operations {
...
@@ -350,8 +350,8 @@ struct inode_operations {
int (*rename2) (struct inode *, struct dentry *,
int (*rename2) (struct inode *, struct dentry *,
struct inode *, struct dentry *, unsigned int);
struct inode *, struct dentry *, unsigned int);
int (*readlink) (struct dentry *, char __user *,int);
int (*readlink) (struct dentry *, char __user *,int);
const char *(*
follow_link) (struct dentry *, void **);
const char *(*
get_link) (struct dentry *, struct inode *,
void (*put_link) (struct inode *, void
*);
struct delayed_call
*);
int (*permission) (struct inode *, int);
int (*permission) (struct inode *, int);
int (*get_acl)(struct inode *, int);
int (*get_acl)(struct inode *, int);
int (*setattr) (struct dentry *, struct iattr *);
int (*setattr) (struct dentry *, struct iattr *);
...
@@ -434,20 +434,19 @@ otherwise noted.
...
@@ -434,20 +434,19 @@ otherwise noted.
readlink: called by the readlink(2) system call. Only required if
readlink: called by the readlink(2) system call. Only required if
you want to support reading symbolic links
you want to support reading symbolic links
follow
_link: called by the VFS to follow a symbolic link to the
get
_link: called by the VFS to follow a symbolic link to the
inode it points to. Only required if you want to support
inode it points to. Only required if you want to support
symbolic links. This method returns the symlink body
symbolic links. This method returns the symlink body
to traverse (and possibly resets the current position with
to traverse (and possibly resets the current position with
nd_jump_link()). If the body won't go away until the inode
nd_jump_link()). If the body won't go away until the inode
is gone, nothing else is needed; if it needs to be otherwise
is gone, nothing else is needed; if it needs to be otherwise
pinned, the data needed to release whatever we'd grabbed
pinned, arrange for its release by having get_link(..., ..., done)
is to be stored in void * variable passed by address to
do set_delayed_call(done, destructor, argument).
follow_link() instance.
In that case destructor(argument) will be called once VFS is
done with the body you've returned.
put_link: called by the VFS to release resources allocated by
May be called in RCU mode; that is indicated by NULL dentry
follow_link(). The cookie stored by follow_link() is passed
argument. If request can't be handled without leaving RCU mode,
to this method as the last parameter; only called when
have it return ERR_PTR(-ECHILD).
cookie isn't NULL.
permission: called by the VFS to check for access rights on a POSIX-like
permission: called by the VFS to check for access rights on a POSIX-like
filesystem.
filesystem.
...
...
drivers/staging/lustre/lustre/llite/symlink.c
浏览文件 @
fceef393
...
@@ -118,8 +118,14 @@ static int ll_readlink_internal(struct inode *inode,
...
@@ -118,8 +118,14 @@ static int ll_readlink_internal(struct inode *inode,
return
rc
;
return
rc
;
}
}
static
void
ll_put_link
(
void
*
p
)
{
ptlrpc_req_finished
(
p
);
}
static
const
char
*
ll_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
ll_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
struct
ptlrpc_request
*
request
=
NULL
;
struct
ptlrpc_request
*
request
=
NULL
;
int
rc
;
int
rc
;
...
@@ -137,22 +143,16 @@ static const char *ll_get_link(struct dentry *dentry,
...
@@ -137,22 +143,16 @@ static const char *ll_get_link(struct dentry *dentry,
}
}
/* symname may contain a pointer to the request message buffer,
/* symname may contain a pointer to the request message buffer,
* we delay request releasing
until ll_put_link
then.
* we delay request releasing then.
*/
*/
*
cookie
=
request
;
set_delayed_call
(
done
,
ll_put_link
,
request
)
;
return
symname
;
return
symname
;
}
}
static
void
ll_put_link
(
struct
inode
*
unused
,
void
*
cookie
)
{
ptlrpc_req_finished
(
cookie
);
}
struct
inode_operations
ll_fast_symlink_inode_operations
=
{
struct
inode_operations
ll_fast_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
setattr
=
ll_setattr
,
.
setattr
=
ll_setattr
,
.
get_link
=
ll_get_link
,
.
get_link
=
ll_get_link
,
.
put_link
=
ll_put_link
,
.
getattr
=
ll_getattr
,
.
getattr
=
ll_getattr
,
.
permission
=
ll_inode_permission
,
.
permission
=
ll_inode_permission
,
.
setxattr
=
ll_setxattr
,
.
setxattr
=
ll_setxattr
,
...
...
fs/9p/vfs_inode.c
浏览文件 @
fceef393
...
@@ -1226,11 +1226,12 @@ ino_t v9fs_qid2ino(struct p9_qid *qid)
...
@@ -1226,11 +1226,12 @@ ino_t v9fs_qid2ino(struct p9_qid *qid)
* v9fs_vfs_get_link - follow a symlink path
* v9fs_vfs_get_link - follow a symlink path
* @dentry: dentry for symlink
* @dentry: dentry for symlink
* @inode: inode for symlink
* @inode: inode for symlink
* @
cookie: place to pass the data to put_link()
* @
done: delayed call for when we are done with the return value
*/
*/
static
const
char
*
v9fs_vfs_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
v9fs_vfs_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
struct
v9fs_session_info
*
v9ses
;
struct
v9fs_session_info
*
v9ses
;
struct
p9_fid
*
fid
;
struct
p9_fid
*
fid
;
...
@@ -1266,7 +1267,8 @@ static const char *v9fs_vfs_get_link(struct dentry *dentry,
...
@@ -1266,7 +1267,8 @@ static const char *v9fs_vfs_get_link(struct dentry *dentry,
p9stat_free
(
st
);
p9stat_free
(
st
);
kfree
(
st
);
kfree
(
st
);
return
*
cookie
=
res
;
set_delayed_call
(
done
,
kfree_link
,
res
);
return
res
;
}
}
/**
/**
...
@@ -1460,7 +1462,6 @@ static const struct inode_operations v9fs_file_inode_operations = {
...
@@ -1460,7 +1462,6 @@ static const struct inode_operations v9fs_file_inode_operations = {
static
const
struct
inode_operations
v9fs_symlink_inode_operations
=
{
static
const
struct
inode_operations
v9fs_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
v9fs_vfs_get_link
,
.
get_link
=
v9fs_vfs_get_link
,
.
put_link
=
kfree_put_link
,
.
getattr
=
v9fs_vfs_getattr
,
.
getattr
=
v9fs_vfs_getattr
,
.
setattr
=
v9fs_vfs_setattr
,
.
setattr
=
v9fs_vfs_setattr
,
};
};
...
...
fs/9p/vfs_inode_dotl.c
浏览文件 @
fceef393
...
@@ -902,12 +902,13 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
...
@@ -902,12 +902,13 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
* v9fs_vfs_get_link_dotl - follow a symlink path
* v9fs_vfs_get_link_dotl - follow a symlink path
* @dentry: dentry for symlink
* @dentry: dentry for symlink
* @inode: inode for symlink
* @inode: inode for symlink
* @
cookie: place to pass the data to put_link()
* @
done: destructor for return value
*/
*/
static
const
char
*
static
const
char
*
v9fs_vfs_get_link_dotl
(
struct
dentry
*
dentry
,
v9fs_vfs_get_link_dotl
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
struct
p9_fid
*
fid
;
struct
p9_fid
*
fid
;
char
*
target
;
char
*
target
;
...
@@ -924,7 +925,8 @@ v9fs_vfs_get_link_dotl(struct dentry *dentry,
...
@@ -924,7 +925,8 @@ v9fs_vfs_get_link_dotl(struct dentry *dentry,
retval
=
p9_client_readlink
(
fid
,
&
target
);
retval
=
p9_client_readlink
(
fid
,
&
target
);
if
(
retval
)
if
(
retval
)
return
ERR_PTR
(
retval
);
return
ERR_PTR
(
retval
);
return
*
cookie
=
target
;
set_delayed_call
(
done
,
kfree_link
,
target
);
return
target
;
}
}
int
v9fs_refresh_inode_dotl
(
struct
p9_fid
*
fid
,
struct
inode
*
inode
)
int
v9fs_refresh_inode_dotl
(
struct
p9_fid
*
fid
,
struct
inode
*
inode
)
...
@@ -991,7 +993,6 @@ const struct inode_operations v9fs_file_inode_operations_dotl = {
...
@@ -991,7 +993,6 @@ const struct inode_operations v9fs_file_inode_operations_dotl = {
const
struct
inode_operations
v9fs_symlink_inode_operations_dotl
=
{
const
struct
inode_operations
v9fs_symlink_inode_operations_dotl
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
v9fs_vfs_get_link_dotl
,
.
get_link
=
v9fs_vfs_get_link_dotl
,
.
put_link
=
kfree_put_link
,
.
getattr
=
v9fs_vfs_getattr_dotl
,
.
getattr
=
v9fs_vfs_getattr_dotl
,
.
setattr
=
v9fs_vfs_setattr_dotl
,
.
setattr
=
v9fs_vfs_setattr_dotl
,
.
setxattr
=
generic_setxattr
,
.
setxattr
=
generic_setxattr
,
...
...
fs/affs/symlink.c
浏览文件 @
fceef393
...
@@ -72,6 +72,5 @@ const struct address_space_operations affs_symlink_aops = {
...
@@ -72,6 +72,5 @@ const struct address_space_operations affs_symlink_aops = {
const
struct
inode_operations
affs_symlink_inode_operations
=
{
const
struct
inode_operations
affs_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
page_get_link
,
.
get_link
=
page_get_link
,
.
put_link
=
page_put_link
,
.
setattr
=
affs_notify_change
,
.
setattr
=
affs_notify_change
,
};
};
fs/autofs4/symlink.c
浏览文件 @
fceef393
...
@@ -13,7 +13,8 @@
...
@@ -13,7 +13,8 @@
#include "autofs_i.h"
#include "autofs_i.h"
static
const
char
*
autofs4_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
autofs4_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
struct
autofs_sb_info
*
sbi
;
struct
autofs_sb_info
*
sbi
;
struct
autofs_info
*
ino
;
struct
autofs_info
*
ino
;
...
...
fs/btrfs/inode.c
浏览文件 @
fceef393
...
@@ -10097,7 +10097,6 @@ static const struct inode_operations btrfs_special_inode_operations = {
...
@@ -10097,7 +10097,6 @@ static const struct inode_operations btrfs_special_inode_operations = {
static
const
struct
inode_operations
btrfs_symlink_inode_operations
=
{
static
const
struct
inode_operations
btrfs_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
page_get_link
,
.
get_link
=
page_get_link
,
.
put_link
=
page_put_link
,
.
getattr
=
btrfs_getattr
,
.
getattr
=
btrfs_getattr
,
.
setattr
=
btrfs_setattr
,
.
setattr
=
btrfs_setattr
,
.
permission
=
btrfs_permission
,
.
permission
=
btrfs_permission
,
...
...
fs/cifs/cifsfs.c
浏览文件 @
fceef393
...
@@ -901,7 +901,6 @@ const struct inode_operations cifs_file_inode_ops = {
...
@@ -901,7 +901,6 @@ const struct inode_operations cifs_file_inode_ops = {
const
struct
inode_operations
cifs_symlink_inode_ops
=
{
const
struct
inode_operations
cifs_symlink_inode_ops
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
cifs_get_link
,
.
get_link
=
cifs_get_link
,
.
put_link
=
kfree_put_link
,
.
permission
=
cifs_permission
,
.
permission
=
cifs_permission
,
/* BB add the following two eventually */
/* BB add the following two eventually */
/* revalidate: cifs_revalidate,
/* revalidate: cifs_revalidate,
...
...
fs/cifs/cifsfs.h
浏览文件 @
fceef393
...
@@ -120,7 +120,8 @@ extern struct vfsmount *cifs_dfs_d_automount(struct path *path);
...
@@ -120,7 +120,8 @@ extern struct vfsmount *cifs_dfs_d_automount(struct path *path);
#endif
#endif
/* Functions related to symlinks */
/* Functions related to symlinks */
extern
const
char
*
cifs_get_link
(
struct
dentry
*
,
struct
inode
*
,
void
**
);
extern
const
char
*
cifs_get_link
(
struct
dentry
*
,
struct
inode
*
,
struct
delayed_call
*
);
extern
int
cifs_symlink
(
struct
inode
*
inode
,
struct
dentry
*
direntry
,
extern
int
cifs_symlink
(
struct
inode
*
inode
,
struct
dentry
*
direntry
,
const
char
*
symname
);
const
char
*
symname
);
extern
int
cifs_removexattr
(
struct
dentry
*
,
const
char
*
);
extern
int
cifs_removexattr
(
struct
dentry
*
,
const
char
*
);
...
...
fs/cifs/link.c
浏览文件 @
fceef393
...
@@ -627,7 +627,8 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
...
@@ -627,7 +627,8 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
}
}
const
char
*
const
char
*
cifs_get_link
(
struct
dentry
*
direntry
,
struct
inode
*
inode
,
void
**
cookie
)
cifs_get_link
(
struct
dentry
*
direntry
,
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
int
rc
=
-
ENOMEM
;
int
rc
=
-
ENOMEM
;
unsigned
int
xid
;
unsigned
int
xid
;
...
@@ -680,7 +681,8 @@ cifs_get_link(struct dentry *direntry, struct inode *inode, void **cookie)
...
@@ -680,7 +681,8 @@ cifs_get_link(struct dentry *direntry, struct inode *inode, void **cookie)
kfree
(
target_path
);
kfree
(
target_path
);
return
ERR_PTR
(
rc
);
return
ERR_PTR
(
rc
);
}
}
return
*
cookie
=
target_path
;
set_delayed_call
(
done
,
kfree_link
,
target_path
);
return
target_path
;
}
}
int
int
...
...
fs/coda/cnode.c
浏览文件 @
fceef393
...
@@ -19,7 +19,6 @@ static inline int coda_fideq(struct CodaFid *fid1, struct CodaFid *fid2)
...
@@ -19,7 +19,6 @@ static inline int coda_fideq(struct CodaFid *fid1, struct CodaFid *fid2)
static
const
struct
inode_operations
coda_symlink_inode_operations
=
{
static
const
struct
inode_operations
coda_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
page_get_link
,
.
get_link
=
page_get_link
,
.
put_link
=
page_put_link
,
.
setattr
=
coda_setattr
,
.
setattr
=
coda_setattr
,
};
};
...
...
fs/configfs/symlink.c
浏览文件 @
fceef393
...
@@ -280,31 +280,32 @@ static int configfs_getlink(struct dentry *dentry, char * path)
...
@@ -280,31 +280,32 @@ static int configfs_getlink(struct dentry *dentry, char * path)
}
}
static
const
char
*
configfs_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
configfs_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
char
*
page
;
char
*
body
;
int
error
;
int
error
;
if
(
!
dentry
)
if
(
!
dentry
)
return
ERR_PTR
(
-
ECHILD
);
return
ERR_PTR
(
-
ECHILD
);
page
=
kzalloc
(
PAGE_SIZE
,
GFP_KERNEL
);
body
=
kzalloc
(
PAGE_SIZE
,
GFP_KERNEL
);
if
(
!
page
)
if
(
!
body
)
return
ERR_PTR
(
-
ENOMEM
);
return
ERR_PTR
(
-
ENOMEM
);
error
=
configfs_getlink
(
dentry
,
page
);
error
=
configfs_getlink
(
dentry
,
body
);
if
(
!
error
)
{
if
(
!
error
)
{
return
*
cookie
=
page
;
set_delayed_call
(
done
,
kfree_link
,
body
);
return
body
;
}
}
kfree
(
page
);
kfree
(
body
);
return
ERR_PTR
(
error
);
return
ERR_PTR
(
error
);
}
}
const
struct
inode_operations
configfs_symlink_inode_operations
=
{
const
struct
inode_operations
configfs_symlink_inode_operations
=
{
.
get_link
=
configfs_get_link
,
.
get_link
=
configfs_get_link
,
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
put_link
=
kfree_put_link
,
.
setattr
=
configfs_setattr
,
.
setattr
=
configfs_setattr
,
};
};
fs/ecryptfs/inode.c
浏览文件 @
fceef393
...
@@ -675,7 +675,8 @@ static char *ecryptfs_readlink_lower(struct dentry *dentry, size_t *bufsiz)
...
@@ -675,7 +675,8 @@ static char *ecryptfs_readlink_lower(struct dentry *dentry, size_t *bufsiz)
}
}
static
const
char
*
ecryptfs_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
ecryptfs_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
size_t
len
;
size_t
len
;
char
*
buf
;
char
*
buf
;
...
@@ -689,7 +690,8 @@ static const char *ecryptfs_get_link(struct dentry *dentry,
...
@@ -689,7 +690,8 @@ static const char *ecryptfs_get_link(struct dentry *dentry,
fsstack_copy_attr_atime
(
d_inode
(
dentry
),
fsstack_copy_attr_atime
(
d_inode
(
dentry
),
d_inode
(
ecryptfs_dentry_to_lower
(
dentry
)));
d_inode
(
ecryptfs_dentry_to_lower
(
dentry
)));
buf
[
len
]
=
'\0'
;
buf
[
len
]
=
'\0'
;
return
*
cookie
=
buf
;
set_delayed_call
(
done
,
kfree_link
,
buf
);
return
buf
;
}
}
/**
/**
...
@@ -1102,7 +1104,6 @@ static int ecryptfs_removexattr(struct dentry *dentry, const char *name)
...
@@ -1102,7 +1104,6 @@ static int ecryptfs_removexattr(struct dentry *dentry, const char *name)
const
struct
inode_operations
ecryptfs_symlink_iops
=
{
const
struct
inode_operations
ecryptfs_symlink_iops
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
ecryptfs_get_link
,
.
get_link
=
ecryptfs_get_link
,
.
put_link
=
kfree_put_link
,
.
permission
=
ecryptfs_permission
,
.
permission
=
ecryptfs_permission
,
.
setattr
=
ecryptfs_setattr
,
.
setattr
=
ecryptfs_setattr
,
.
getattr
=
ecryptfs_getattr_link
,
.
getattr
=
ecryptfs_getattr_link
,
...
...
fs/ext2/symlink.c
浏览文件 @
fceef393
...
@@ -23,7 +23,6 @@
...
@@ -23,7 +23,6 @@
const
struct
inode_operations
ext2_symlink_inode_operations
=
{
const
struct
inode_operations
ext2_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
page_get_link
,
.
get_link
=
page_get_link
,
.
put_link
=
page_put_link
,
.
setattr
=
ext2_setattr
,
.
setattr
=
ext2_setattr
,
#ifdef CONFIG_EXT2_FS_XATTR
#ifdef CONFIG_EXT2_FS_XATTR
.
setxattr
=
generic_setxattr
,
.
setxattr
=
generic_setxattr
,
...
...
fs/ext4/symlink.c
浏览文件 @
fceef393
...
@@ -24,7 +24,8 @@
...
@@ -24,7 +24,8 @@
#ifdef CONFIG_EXT4_FS_ENCRYPTION
#ifdef CONFIG_EXT4_FS_ENCRYPTION
static
const
char
*
ext4_encrypted_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
ext4_encrypted_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
struct
page
*
cpage
=
NULL
;
struct
page
*
cpage
=
NULL
;
char
*
caddr
,
*
paddr
=
NULL
;
char
*
caddr
,
*
paddr
=
NULL
;
...
@@ -80,7 +81,8 @@ static const char *ext4_encrypted_get_link(struct dentry *dentry,
...
@@ -80,7 +81,8 @@ static const char *ext4_encrypted_get_link(struct dentry *dentry,
paddr
[
res
]
=
'\0'
;
paddr
[
res
]
=
'\0'
;
if
(
cpage
)
if
(
cpage
)
page_cache_release
(
cpage
);
page_cache_release
(
cpage
);
return
*
cookie
=
paddr
;
set_delayed_call
(
done
,
kfree_link
,
paddr
);
return
paddr
;
errout:
errout:
if
(
cpage
)
if
(
cpage
)
page_cache_release
(
cpage
);
page_cache_release
(
cpage
);
...
@@ -91,7 +93,6 @@ static const char *ext4_encrypted_get_link(struct dentry *dentry,
...
@@ -91,7 +93,6 @@ static const char *ext4_encrypted_get_link(struct dentry *dentry,
const
struct
inode_operations
ext4_encrypted_symlink_inode_operations
=
{
const
struct
inode_operations
ext4_encrypted_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
ext4_encrypted_get_link
,
.
get_link
=
ext4_encrypted_get_link
,
.
put_link
=
kfree_put_link
,
.
setattr
=
ext4_setattr
,
.
setattr
=
ext4_setattr
,
.
setxattr
=
generic_setxattr
,
.
setxattr
=
generic_setxattr
,
.
getxattr
=
generic_getxattr
,
.
getxattr
=
generic_getxattr
,
...
@@ -103,7 +104,6 @@ const struct inode_operations ext4_encrypted_symlink_inode_operations = {
...
@@ -103,7 +104,6 @@ const struct inode_operations ext4_encrypted_symlink_inode_operations = {
const
struct
inode_operations
ext4_symlink_inode_operations
=
{
const
struct
inode_operations
ext4_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
page_get_link
,
.
get_link
=
page_get_link
,
.
put_link
=
page_put_link
,
.
setattr
=
ext4_setattr
,
.
setattr
=
ext4_setattr
,
.
setxattr
=
generic_setxattr
,
.
setxattr
=
generic_setxattr
,
.
getxattr
=
generic_getxattr
,
.
getxattr
=
generic_getxattr
,
...
...
fs/f2fs/namei.c
浏览文件 @
fceef393
...
@@ -316,12 +316,14 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
...
@@ -316,12 +316,14 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
}
}
static
const
char
*
f2fs_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
f2fs_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
const
char
*
link
=
page_get_link
(
dentry
,
inode
,
cooki
e
);
const
char
*
link
=
page_get_link
(
dentry
,
inode
,
don
e
);
if
(
!
IS_ERR
(
link
)
&&
!*
link
)
{
if
(
!
IS_ERR
(
link
)
&&
!*
link
)
{
/* this is broken symlink case */
/* this is broken symlink case */
page_put_link
(
NULL
,
*
cookie
);
do_delayed_call
(
done
);
clear_delayed_call
(
done
);
link
=
ERR_PTR
(
-
ENOENT
);
link
=
ERR_PTR
(
-
ENOENT
);
}
}
return
link
;
return
link
;
...
@@ -926,7 +928,8 @@ static int f2fs_rename2(struct inode *old_dir, struct dentry *old_dentry,
...
@@ -926,7 +928,8 @@ static int f2fs_rename2(struct inode *old_dir, struct dentry *old_dentry,
#ifdef CONFIG_F2FS_FS_ENCRYPTION
#ifdef CONFIG_F2FS_FS_ENCRYPTION
static
const
char
*
f2fs_encrypted_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
f2fs_encrypted_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
struct
page
*
cpage
=
NULL
;
struct
page
*
cpage
=
NULL
;
char
*
caddr
,
*
paddr
=
NULL
;
char
*
caddr
,
*
paddr
=
NULL
;
...
@@ -988,7 +991,8 @@ static const char *f2fs_encrypted_get_link(struct dentry *dentry,
...
@@ -988,7 +991,8 @@ static const char *f2fs_encrypted_get_link(struct dentry *dentry,
paddr
[
res
]
=
'\0'
;
paddr
[
res
]
=
'\0'
;
page_cache_release
(
cpage
);
page_cache_release
(
cpage
);
return
*
cookie
=
paddr
;
set_delayed_call
(
done
,
kfree_link
,
paddr
);
return
paddr
;
errout:
errout:
kfree
(
cstr
.
name
);
kfree
(
cstr
.
name
);
f2fs_fname_crypto_free_buffer
(
&
pstr
);
f2fs_fname_crypto_free_buffer
(
&
pstr
);
...
@@ -999,7 +1003,6 @@ static const char *f2fs_encrypted_get_link(struct dentry *dentry,
...
@@ -999,7 +1003,6 @@ static const char *f2fs_encrypted_get_link(struct dentry *dentry,
const
struct
inode_operations
f2fs_encrypted_symlink_inode_operations
=
{
const
struct
inode_operations
f2fs_encrypted_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
f2fs_encrypted_get_link
,
.
get_link
=
f2fs_encrypted_get_link
,
.
put_link
=
kfree_put_link
,
.
getattr
=
f2fs_getattr
,
.
getattr
=
f2fs_getattr
,
.
setattr
=
f2fs_setattr
,
.
setattr
=
f2fs_setattr
,
.
setxattr
=
generic_setxattr
,
.
setxattr
=
generic_setxattr
,
...
@@ -1035,7 +1038,6 @@ const struct inode_operations f2fs_dir_inode_operations = {
...
@@ -1035,7 +1038,6 @@ const struct inode_operations f2fs_dir_inode_operations = {
const
struct
inode_operations
f2fs_symlink_inode_operations
=
{
const
struct
inode_operations
f2fs_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
f2fs_get_link
,
.
get_link
=
f2fs_get_link
,
.
put_link
=
page_put_link
,
.
getattr
=
f2fs_getattr
,
.
getattr
=
f2fs_getattr
,
.
setattr
=
f2fs_setattr
,
.
setattr
=
f2fs_setattr
,
#ifdef CONFIG_F2FS_FS_XATTR
#ifdef CONFIG_F2FS_FS_XATTR
...
...
fs/fuse/dir.c
浏览文件 @
fceef393
...
@@ -1366,7 +1366,8 @@ static int fuse_readdir(struct file *file, struct dir_context *ctx)
...
@@ -1366,7 +1366,8 @@ static int fuse_readdir(struct file *file, struct dir_context *ctx)
}
}
static
const
char
*
fuse_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
fuse_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
struct
fuse_conn
*
fc
=
get_fuse_conn
(
inode
);
struct
fuse_conn
*
fc
=
get_fuse_conn
(
inode
);
FUSE_ARGS
(
args
);
FUSE_ARGS
(
args
);
...
@@ -1392,7 +1393,7 @@ static const char *fuse_get_link(struct dentry *dentry,
...
@@ -1392,7 +1393,7 @@ static const char *fuse_get_link(struct dentry *dentry,
link
=
ERR_PTR
(
ret
);
link
=
ERR_PTR
(
ret
);
}
else
{
}
else
{
link
[
ret
]
=
'\0'
;
link
[
ret
]
=
'\0'
;
*
cookie
=
link
;
set_delayed_call
(
done
,
kfree_link
,
link
)
;
}
}
fuse_invalidate_atime
(
inode
);
fuse_invalidate_atime
(
inode
);
return
link
;
return
link
;
...
@@ -1913,7 +1914,6 @@ static const struct inode_operations fuse_common_inode_operations = {
...
@@ -1913,7 +1914,6 @@ static const struct inode_operations fuse_common_inode_operations = {
static
const
struct
inode_operations
fuse_symlink_inode_operations
=
{
static
const
struct
inode_operations
fuse_symlink_inode_operations
=
{
.
setattr
=
fuse_setattr
,
.
setattr
=
fuse_setattr
,
.
get_link
=
fuse_get_link
,
.
get_link
=
fuse_get_link
,
.
put_link
=
kfree_put_link
,
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
getattr
=
fuse_getattr
,
.
getattr
=
fuse_getattr
,
.
setxattr
=
fuse_setxattr
,
.
setxattr
=
fuse_setxattr
,
...
...
fs/gfs2/inode.c
浏览文件 @
fceef393
...
@@ -1715,7 +1715,7 @@ static int gfs2_rename2(struct inode *odir, struct dentry *odentry,
...
@@ -1715,7 +1715,7 @@ static int gfs2_rename2(struct inode *odir, struct dentry *odentry,
* gfs2_get_link - Follow a symbolic link
* gfs2_get_link - Follow a symbolic link
* @dentry: The dentry of the link
* @dentry: The dentry of the link
* @inode: The inode of the link
* @inode: The inode of the link
* @
cookie: place to store the information for ->put_link()
* @
done: destructor for return value
*
*
* This can handle symlinks of any size.
* This can handle symlinks of any size.
*
*
...
@@ -1723,7 +1723,8 @@ static int gfs2_rename2(struct inode *odir, struct dentry *odentry,
...
@@ -1723,7 +1723,8 @@ static int gfs2_rename2(struct inode *odir, struct dentry *odentry,
*/
*/
static
const
char
*
gfs2_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
gfs2_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
struct
gfs2_inode
*
ip
=
GFS2_I
(
inode
);
struct
gfs2_inode
*
ip
=
GFS2_I
(
inode
);
struct
gfs2_holder
i_gh
;
struct
gfs2_holder
i_gh
;
...
@@ -1764,7 +1765,7 @@ static const char *gfs2_get_link(struct dentry *dentry,
...
@@ -1764,7 +1765,7 @@ static const char *gfs2_get_link(struct dentry *dentry,
out:
out:
gfs2_glock_dq_uninit
(
&
i_gh
);
gfs2_glock_dq_uninit
(
&
i_gh
);
if
(
!
IS_ERR
(
buf
))
if
(
!
IS_ERR
(
buf
))
*
cookie
=
buf
;
set_delayed_call
(
done
,
kfree_link
,
buf
)
;
return
buf
;
return
buf
;
}
}
...
@@ -2138,7 +2139,6 @@ const struct inode_operations gfs2_dir_iops = {
...
@@ -2138,7 +2139,6 @@ const struct inode_operations gfs2_dir_iops = {
const
struct
inode_operations
gfs2_symlink_iops
=
{
const
struct
inode_operations
gfs2_symlink_iops
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
gfs2_get_link
,
.
get_link
=
gfs2_get_link
,
.
put_link
=
kfree_put_link
,
.
permission
=
gfs2_permission
,
.
permission
=
gfs2_permission
,
.
setattr
=
gfs2_setattr
,
.
setattr
=
gfs2_setattr
,
.
getattr
=
gfs2_getattr
,
.
getattr
=
gfs2_getattr
,
...
...
fs/hostfs/hostfs_kern.c
浏览文件 @
fceef393
...
@@ -893,12 +893,13 @@ static const struct inode_operations hostfs_dir_iops = {
...
@@ -893,12 +893,13 @@ static const struct inode_operations hostfs_dir_iops = {
};
};
static
const
char
*
hostfs_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
hostfs_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
char
*
link
;
char
*
link
;
if
(
!
dentry
)
if
(
!
dentry
)
return
ERR_PTR
(
-
ECHILD
);
return
ERR_PTR
(
-
ECHILD
);
link
=
__getname
(
);
link
=
kmalloc
(
PATH_MAX
,
GFP_KERNEL
);
if
(
link
)
{
if
(
link
)
{
char
*
path
=
dentry_name
(
dentry
);
char
*
path
=
dentry_name
(
dentry
);
int
err
=
-
ENOMEM
;
int
err
=
-
ENOMEM
;
...
@@ -909,25 +910,20 @@ static const char *hostfs_get_link(struct dentry *dentry,
...
@@ -909,25 +910,20 @@ static const char *hostfs_get_link(struct dentry *dentry,
__putname
(
path
);
__putname
(
path
);
}
}
if
(
err
<
0
)
{
if
(
err
<
0
)
{
__putnam
e
(
link
);
kfre
e
(
link
);
return
ERR_PTR
(
err
);
return
ERR_PTR
(
err
);
}
}
}
else
{
}
else
{
return
ERR_PTR
(
-
ENOMEM
);
return
ERR_PTR
(
-
ENOMEM
);
}
}
return
*
cookie
=
link
;
set_delayed_call
(
done
,
kfree_link
,
link
);
}
return
link
;
static
void
hostfs_put_link
(
struct
inode
*
unused
,
void
*
cookie
)
{
__putname
(
cookie
);
}
}
static
const
struct
inode_operations
hostfs_link_iops
=
{
static
const
struct
inode_operations
hostfs_link_iops
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
hostfs_get_link
,
.
get_link
=
hostfs_get_link
,
.
put_link
=
hostfs_put_link
,
};
};
static
int
hostfs_fill_sb_common
(
struct
super_block
*
sb
,
void
*
d
,
int
silent
)
static
int
hostfs_fill_sb_common
(
struct
super_block
*
sb
,
void
*
d
,
int
silent
)
...
...
fs/jfs/symlink.c
浏览文件 @
fceef393
...
@@ -34,7 +34,6 @@ const struct inode_operations jfs_fast_symlink_inode_operations = {
...
@@ -34,7 +34,6 @@ const struct inode_operations jfs_fast_symlink_inode_operations = {
const
struct
inode_operations
jfs_symlink_inode_operations
=
{
const
struct
inode_operations
jfs_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
page_get_link
,
.
get_link
=
page_get_link
,
.
put_link
=
page_put_link
,
.
setattr
=
jfs_setattr
,
.
setattr
=
jfs_setattr
,
.
setxattr
=
jfs_setxattr
,
.
setxattr
=
jfs_setxattr
,
.
getxattr
=
jfs_getxattr
,
.
getxattr
=
jfs_getxattr
,
...
...
fs/kernfs/symlink.c
浏览文件 @
fceef393
...
@@ -113,22 +113,24 @@ static int kernfs_getlink(struct dentry *dentry, char *path)
...
@@ -113,22 +113,24 @@ static int kernfs_getlink(struct dentry *dentry, char *path)
}
}
static
const
char
*
kernfs_iop_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
kernfs_iop_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
int
error
=
-
ENOMEM
;
char
*
body
;
char
*
page
;
int
error
;
if
(
!
dentry
)
if
(
!
dentry
)
return
ERR_PTR
(
-
ECHILD
);
return
ERR_PTR
(
-
ECHILD
);
page
=
kzalloc
(
PAGE_SIZE
,
GFP_KERNEL
);
body
=
kzalloc
(
PAGE_SIZE
,
GFP_KERNEL
);
if
(
!
page
)
if
(
!
body
)
return
ERR_PTR
(
-
ENOMEM
);
return
ERR_PTR
(
-
ENOMEM
);
error
=
kernfs_getlink
(
dentry
,
page
);
error
=
kernfs_getlink
(
dentry
,
body
);
if
(
unlikely
(
error
<
0
))
{
if
(
unlikely
(
error
<
0
))
{
kfree
(
page
);
kfree
(
body
);
return
ERR_PTR
(
error
);
return
ERR_PTR
(
error
);
}
}
return
*
cookie
=
page
;
set_delayed_call
(
done
,
kfree_link
,
body
);
return
body
;
}
}
const
struct
inode_operations
kernfs_symlink_iops
=
{
const
struct
inode_operations
kernfs_symlink_iops
=
{
...
@@ -138,7 +140,6 @@ const struct inode_operations kernfs_symlink_iops = {
...
@@ -138,7 +140,6 @@ const struct inode_operations kernfs_symlink_iops = {
.
listxattr
=
kernfs_iop_listxattr
,
.
listxattr
=
kernfs_iop_listxattr
,
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
kernfs_iop_get_link
,
.
get_link
=
kernfs_iop_get_link
,
.
put_link
=
kfree_put_link
,
.
setattr
=
kernfs_iop_setattr
,
.
setattr
=
kernfs_iop_setattr
,
.
getattr
=
kernfs_iop_getattr
,
.
getattr
=
kernfs_iop_getattr
,
.
permission
=
kernfs_iop_permission
,
.
permission
=
kernfs_iop_permission
,
...
...
fs/libfs.c
浏览文件 @
fceef393
...
@@ -1019,11 +1019,12 @@ int noop_fsync(struct file *file, loff_t start, loff_t end, int datasync)
...
@@ -1019,11 +1019,12 @@ int noop_fsync(struct file *file, loff_t start, loff_t end, int datasync)
}
}
EXPORT_SYMBOL
(
noop_fsync
);
EXPORT_SYMBOL
(
noop_fsync
);
void
kfree_put_link
(
struct
inode
*
unused
,
void
*
cookie
)
/* Because kfree isn't assignment-compatible with void(void*) ;-/ */
void
kfree_link
(
void
*
p
)
{
{
kfree
(
cookie
);
kfree
(
p
);
}
}
EXPORT_SYMBOL
(
kfree_
put_
link
);
EXPORT_SYMBOL
(
kfree_link
);
/*
/*
* nop .set_page_dirty method so that people can use .page_mkwrite on
* nop .set_page_dirty method so that people can use .page_mkwrite on
...
@@ -1087,7 +1088,7 @@ simple_nosetlease(struct file *filp, long arg, struct file_lock **flp,
...
@@ -1087,7 +1088,7 @@ simple_nosetlease(struct file *filp, long arg, struct file_lock **flp,
EXPORT_SYMBOL
(
simple_nosetlease
);
EXPORT_SYMBOL
(
simple_nosetlease
);
const
char
*
simple_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
const
char
*
simple_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cooki
e
)
struct
delayed_call
*
don
e
)
{
{
return
inode
->
i_link
;
return
inode
->
i_link
;
}
}
...
...
fs/minix/inode.c
浏览文件 @
fceef393
...
@@ -436,7 +436,6 @@ static const struct address_space_operations minix_aops = {
...
@@ -436,7 +436,6 @@ static const struct address_space_operations minix_aops = {
static
const
struct
inode_operations
minix_symlink_inode_operations
=
{
static
const
struct
inode_operations
minix_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
page_get_link
,
.
get_link
=
page_get_link
,
.
put_link
=
page_put_link
,
.
getattr
=
minix_getattr
,
.
getattr
=
minix_getattr
,
};
};
...
...
fs/namei.c
浏览文件 @
fceef393
...
@@ -505,13 +505,13 @@ struct nameidata {
...
@@ -505,13 +505,13 @@ struct nameidata {
int
total_link_count
;
int
total_link_count
;
struct
saved
{
struct
saved
{
struct
path
link
;
struct
path
link
;
void
*
cooki
e
;
struct
delayed_call
don
e
;
const
char
*
name
;
const
char
*
name
;
struct
inode
*
inode
;
unsigned
seq
;
unsigned
seq
;
}
*
stack
,
internal
[
EMBEDDED_LEVELS
];
}
*
stack
,
internal
[
EMBEDDED_LEVELS
];
struct
filename
*
name
;
struct
filename
*
name
;
struct
nameidata
*
saved
;
struct
nameidata
*
saved
;
struct
inode
*
link_inode
;
unsigned
root_seq
;
unsigned
root_seq
;
int
dfd
;
int
dfd
;
};
};
...
@@ -592,11 +592,8 @@ static void drop_links(struct nameidata *nd)
...
@@ -592,11 +592,8 @@ static void drop_links(struct nameidata *nd)
int
i
=
nd
->
depth
;
int
i
=
nd
->
depth
;
while
(
i
--
)
{
while
(
i
--
)
{
struct
saved
*
last
=
nd
->
stack
+
i
;
struct
saved
*
last
=
nd
->
stack
+
i
;
struct
inode
*
inode
=
last
->
inode
;
do_delayed_call
(
&
last
->
done
);
if
(
last
->
cookie
&&
inode
->
i_op
->
put_link
)
{
clear_delayed_call
(
&
last
->
done
);
inode
->
i_op
->
put_link
(
inode
,
last
->
cookie
);
last
->
cookie
=
NULL
;
}
}
}
}
}
...
@@ -858,9 +855,7 @@ void nd_jump_link(struct path *path)
...
@@ -858,9 +855,7 @@ void nd_jump_link(struct path *path)
static
inline
void
put_link
(
struct
nameidata
*
nd
)
static
inline
void
put_link
(
struct
nameidata
*
nd
)
{
{
struct
saved
*
last
=
nd
->
stack
+
--
nd
->
depth
;
struct
saved
*
last
=
nd
->
stack
+
--
nd
->
depth
;
struct
inode
*
inode
=
last
->
inode
;
do_delayed_call
(
&
last
->
done
);
if
(
last
->
cookie
&&
inode
->
i_op
->
put_link
)
inode
->
i_op
->
put_link
(
inode
,
last
->
cookie
);
if
(
!
(
nd
->
flags
&
LOOKUP_RCU
))
if
(
!
(
nd
->
flags
&
LOOKUP_RCU
))
path_put
(
&
last
->
link
);
path_put
(
&
last
->
link
);
}
}
...
@@ -892,7 +887,7 @@ static inline int may_follow_link(struct nameidata *nd)
...
@@ -892,7 +887,7 @@ static inline int may_follow_link(struct nameidata *nd)
return
0
;
return
0
;
/* Allowed if owner and follower match. */
/* Allowed if owner and follower match. */
inode
=
nd
->
stack
[
0
].
inode
;
inode
=
nd
->
link_
inode
;
if
(
uid_eq
(
current_cred
()
->
fsuid
,
inode
->
i_uid
))
if
(
uid_eq
(
current_cred
()
->
fsuid
,
inode
->
i_uid
))
return
0
;
return
0
;
...
@@ -983,7 +978,7 @@ const char *get_link(struct nameidata *nd)
...
@@ -983,7 +978,7 @@ const char *get_link(struct nameidata *nd)
{
{
struct
saved
*
last
=
nd
->
stack
+
nd
->
depth
-
1
;
struct
saved
*
last
=
nd
->
stack
+
nd
->
depth
-
1
;
struct
dentry
*
dentry
=
last
->
link
.
dentry
;
struct
dentry
*
dentry
=
last
->
link
.
dentry
;
struct
inode
*
inode
=
last
->
inode
;
struct
inode
*
inode
=
nd
->
link_
inode
;
int
error
;
int
error
;
const
char
*
res
;
const
char
*
res
;
...
@@ -1004,23 +999,21 @@ const char *get_link(struct nameidata *nd)
...
@@ -1004,23 +999,21 @@ const char *get_link(struct nameidata *nd)
nd
->
last_type
=
LAST_BIND
;
nd
->
last_type
=
LAST_BIND
;
res
=
inode
->
i_link
;
res
=
inode
->
i_link
;
if
(
!
res
)
{
if
(
!
res
)
{
const
char
*
(
*
get
)(
struct
dentry
*
,
struct
inode
*
,
struct
delayed_call
*
);
get
=
inode
->
i_op
->
get_link
;
if
(
nd
->
flags
&
LOOKUP_RCU
)
{
if
(
nd
->
flags
&
LOOKUP_RCU
)
{
res
=
inode
->
i_op
->
get_link
(
NULL
,
inode
,
res
=
get
(
NULL
,
inode
,
&
last
->
done
);
&
last
->
cookie
);
if
(
res
==
ERR_PTR
(
-
ECHILD
))
{
if
(
res
==
ERR_PTR
(
-
ECHILD
))
{
if
(
unlikely
(
unlazy_walk
(
nd
,
NULL
,
0
)))
if
(
unlikely
(
unlazy_walk
(
nd
,
NULL
,
0
)))
return
ERR_PTR
(
-
ECHILD
);
return
ERR_PTR
(
-
ECHILD
);
res
=
inode
->
i_op
->
get_link
(
dentry
,
inode
,
res
=
get
(
dentry
,
inode
,
&
last
->
done
);
&
last
->
cookie
);
}
}
}
else
{
}
else
{
res
=
inode
->
i_op
->
get_link
(
dentry
,
inode
,
res
=
get
(
dentry
,
inode
,
&
last
->
done
);
&
last
->
cookie
);
}
}
if
(
IS_ERR_OR_NULL
(
res
))
{
if
(
IS_ERR_OR_NULL
(
res
))
last
->
cookie
=
NULL
;
return
res
;
return
res
;
}
}
}
if
(
*
res
==
'/'
)
{
if
(
*
res
==
'/'
)
{
if
(
nd
->
flags
&
LOOKUP_RCU
)
{
if
(
nd
->
flags
&
LOOKUP_RCU
)
{
...
@@ -1699,8 +1692,8 @@ static int pick_link(struct nameidata *nd, struct path *link,
...
@@ -1699,8 +1692,8 @@ static int pick_link(struct nameidata *nd, struct path *link,
last
=
nd
->
stack
+
nd
->
depth
++
;
last
=
nd
->
stack
+
nd
->
depth
++
;
last
->
link
=
*
link
;
last
->
link
=
*
link
;
last
->
cookie
=
NULL
;
clear_delayed_call
(
&
last
->
done
)
;
last
->
inode
=
inode
;
nd
->
link_
inode
=
inode
;
last
->
seq
=
seq
;
last
->
seq
=
seq
;
return
1
;
return
1
;
}
}
...
@@ -4508,26 +4501,25 @@ EXPORT_SYMBOL(readlink_copy);
...
@@ -4508,26 +4501,25 @@ EXPORT_SYMBOL(readlink_copy);
*/
*/
int
generic_readlink
(
struct
dentry
*
dentry
,
char
__user
*
buffer
,
int
buflen
)
int
generic_readlink
(
struct
dentry
*
dentry
,
char
__user
*
buffer
,
int
buflen
)
{
{
void
*
cookie
;
DEFINE_DELAYED_CALL
(
done
)
;
struct
inode
*
inode
=
d_inode
(
dentry
);
struct
inode
*
inode
=
d_inode
(
dentry
);
const
char
*
link
=
inode
->
i_link
;
const
char
*
link
=
inode
->
i_link
;
int
res
;
int
res
;
if
(
!
link
)
{
if
(
!
link
)
{
link
=
inode
->
i_op
->
get_link
(
dentry
,
inode
,
&
cooki
e
);
link
=
inode
->
i_op
->
get_link
(
dentry
,
inode
,
&
don
e
);
if
(
IS_ERR
(
link
))
if
(
IS_ERR
(
link
))
return
PTR_ERR
(
link
);
return
PTR_ERR
(
link
);
}
}
res
=
readlink_copy
(
buffer
,
buflen
,
link
);
res
=
readlink_copy
(
buffer
,
buflen
,
link
);
if
(
inode
->
i_op
->
put_link
)
do_delayed_call
(
&
done
);
inode
->
i_op
->
put_link
(
inode
,
cookie
);
return
res
;
return
res
;
}
}
EXPORT_SYMBOL
(
generic_readlink
);
EXPORT_SYMBOL
(
generic_readlink
);
/* get the link contents into pagecache */
/* get the link contents into pagecache */
const
char
*
page_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
const
char
*
page_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
delayed_call
*
callback
)
{
{
char
*
kaddr
;
char
*
kaddr
;
struct
page
*
page
;
struct
page
*
page
;
...
@@ -4546,7 +4538,7 @@ const char *page_get_link(struct dentry *dentry, struct inode *inode,
...
@@ -4546,7 +4538,7 @@ const char *page_get_link(struct dentry *dentry, struct inode *inode,
if
(
IS_ERR
(
page
))
if
(
IS_ERR
(
page
))
return
(
char
*
)
page
;
return
(
char
*
)
page
;
}
}
*
cookie
=
page
;
set_delayed_call
(
callback
,
page_put_link
,
page
)
;
BUG_ON
(
mapping_gfp_mask
(
mapping
)
&
__GFP_HIGHMEM
);
BUG_ON
(
mapping_gfp_mask
(
mapping
)
&
__GFP_HIGHMEM
);
kaddr
=
page_address
(
page
);
kaddr
=
page_address
(
page
);
nd_terminate_link
(
kaddr
,
inode
->
i_size
,
PAGE_SIZE
-
1
);
nd_terminate_link
(
kaddr
,
inode
->
i_size
,
PAGE_SIZE
-
1
);
...
@@ -4555,21 +4547,19 @@ const char *page_get_link(struct dentry *dentry, struct inode *inode,
...
@@ -4555,21 +4547,19 @@ const char *page_get_link(struct dentry *dentry, struct inode *inode,
EXPORT_SYMBOL
(
page_get_link
);
EXPORT_SYMBOL
(
page_get_link
);
void
page_put_link
(
struct
inode
*
unused
,
void
*
cookie
)
void
page_put_link
(
void
*
arg
)
{
{
struct
page
*
page
=
cookie
;
put_page
(
arg
);
page_cache_release
(
page
);
}
}
EXPORT_SYMBOL
(
page_put_link
);
EXPORT_SYMBOL
(
page_put_link
);
int
page_readlink
(
struct
dentry
*
dentry
,
char
__user
*
buffer
,
int
buflen
)
int
page_readlink
(
struct
dentry
*
dentry
,
char
__user
*
buffer
,
int
buflen
)
{
{
void
*
cookie
=
NULL
;
DEFINE_DELAYED_CALL
(
done
)
;
int
res
=
readlink_copy
(
buffer
,
buflen
,
int
res
=
readlink_copy
(
buffer
,
buflen
,
page_get_link
(
dentry
,
d_inode
(
dentry
),
page_get_link
(
dentry
,
d_inode
(
dentry
),
&
cookie
));
&
done
));
if
(
cookie
)
do_delayed_call
(
&
done
);
page_put_link
(
NULL
,
cookie
);
return
res
;
return
res
;
}
}
EXPORT_SYMBOL
(
page_readlink
);
EXPORT_SYMBOL
(
page_readlink
);
...
@@ -4619,6 +4609,5 @@ EXPORT_SYMBOL(page_symlink);
...
@@ -4619,6 +4609,5 @@ EXPORT_SYMBOL(page_symlink);
const
struct
inode_operations
page_symlink_inode_operations
=
{
const
struct
inode_operations
page_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
page_get_link
,
.
get_link
=
page_get_link
,
.
put_link
=
page_put_link
,
};
};
EXPORT_SYMBOL
(
page_symlink_inode_operations
);
EXPORT_SYMBOL
(
page_symlink_inode_operations
);
fs/ncpfs/inode.c
浏览文件 @
fceef393
...
@@ -245,7 +245,6 @@ static void ncp_set_attr(struct inode *inode, struct ncp_entry_info *nwinfo)
...
@@ -245,7 +245,6 @@ static void ncp_set_attr(struct inode *inode, struct ncp_entry_info *nwinfo)
static
const
struct
inode_operations
ncp_symlink_inode_operations
=
{
static
const
struct
inode_operations
ncp_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
page_get_link
,
.
get_link
=
page_get_link
,
.
put_link
=
page_put_link
,
.
setattr
=
ncp_notify_change
,
.
setattr
=
ncp_notify_change
,
};
};
#endif
#endif
...
...
fs/nfs/symlink.c
浏览文件 @
fceef393
...
@@ -43,7 +43,8 @@ static int nfs_symlink_filler(struct inode *inode, struct page *page)
...
@@ -43,7 +43,8 @@ static int nfs_symlink_filler(struct inode *inode, struct page *page)
}
}
static
const
char
*
nfs_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
nfs_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
struct
page
*
page
;
struct
page
*
page
;
void
*
err
;
void
*
err
;
...
@@ -68,7 +69,7 @@ static const char *nfs_get_link(struct dentry *dentry,
...
@@ -68,7 +69,7 @@ static const char *nfs_get_link(struct dentry *dentry,
if
(
IS_ERR
(
page
))
if
(
IS_ERR
(
page
))
return
ERR_CAST
(
page
);
return
ERR_CAST
(
page
);
}
}
*
cookie
=
page
;
set_delayed_call
(
done
,
page_put_link
,
page
)
;
return
page_address
(
page
);
return
page_address
(
page
);
}
}
...
@@ -78,7 +79,6 @@ static const char *nfs_get_link(struct dentry *dentry,
...
@@ -78,7 +79,6 @@ static const char *nfs_get_link(struct dentry *dentry,
const
struct
inode_operations
nfs_symlink_inode_operations
=
{
const
struct
inode_operations
nfs_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
nfs_get_link
,
.
get_link
=
nfs_get_link
,
.
put_link
=
page_put_link
,
.
getattr
=
nfs_getattr
,
.
getattr
=
nfs_getattr
,
.
setattr
=
nfs_setattr
,
.
setattr
=
nfs_setattr
,
};
};
fs/nilfs2/namei.c
浏览文件 @
fceef393
...
@@ -570,7 +570,6 @@ const struct inode_operations nilfs_special_inode_operations = {
...
@@ -570,7 +570,6 @@ const struct inode_operations nilfs_special_inode_operations = {
const
struct
inode_operations
nilfs_symlink_inode_operations
=
{
const
struct
inode_operations
nilfs_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
page_get_link
,
.
get_link
=
page_get_link
,
.
put_link
=
page_put_link
,
.
permission
=
nilfs_permission
,
.
permission
=
nilfs_permission
,
};
};
...
...
fs/ocfs2/symlink.c
浏览文件 @
fceef393
...
@@ -89,7 +89,6 @@ const struct address_space_operations ocfs2_fast_symlink_aops = {
...
@@ -89,7 +89,6 @@ const struct address_space_operations ocfs2_fast_symlink_aops = {
const
struct
inode_operations
ocfs2_symlink_inode_operations
=
{
const
struct
inode_operations
ocfs2_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
page_get_link
,
.
get_link
=
page_get_link
,
.
put_link
=
page_put_link
,
.
getattr
=
ocfs2_getattr
,
.
getattr
=
ocfs2_getattr
,
.
setattr
=
ocfs2_setattr
,
.
setattr
=
ocfs2_setattr
,
.
setxattr
=
generic_setxattr
,
.
setxattr
=
generic_setxattr
,
...
...
fs/overlayfs/inode.c
浏览文件 @
fceef393
...
@@ -131,19 +131,12 @@ int ovl_permission(struct inode *inode, int mask)
...
@@ -131,19 +131,12 @@ int ovl_permission(struct inode *inode, int mask)
return
err
;
return
err
;
}
}
struct
ovl_link_data
{
struct
dentry
*
realdentry
;
void
*
cookie
;
};
static
const
char
*
ovl_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
ovl_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
struct
dentry
*
realdentry
;
struct
dentry
*
realdentry
;
struct
inode
*
realinode
;
struct
inode
*
realinode
;
struct
ovl_link_data
*
data
=
NULL
;
const
char
*
ret
;
if
(
!
dentry
)
if
(
!
dentry
)
return
ERR_PTR
(
-
ECHILD
);
return
ERR_PTR
(
-
ECHILD
);
...
@@ -154,38 +147,7 @@ static const char *ovl_get_link(struct dentry *dentry,
...
@@ -154,38 +147,7 @@ static const char *ovl_get_link(struct dentry *dentry,
if
(
WARN_ON
(
!
realinode
->
i_op
->
get_link
))
if
(
WARN_ON
(
!
realinode
->
i_op
->
get_link
))
return
ERR_PTR
(
-
EPERM
);
return
ERR_PTR
(
-
EPERM
);
if
(
realinode
->
i_op
->
put_link
)
{
return
realinode
->
i_op
->
get_link
(
realdentry
,
realinode
,
done
);
data
=
kmalloc
(
sizeof
(
struct
ovl_link_data
),
GFP_KERNEL
);
if
(
!
data
)
return
ERR_PTR
(
-
ENOMEM
);
data
->
realdentry
=
realdentry
;
}
ret
=
realinode
->
i_op
->
get_link
(
realdentry
,
realinode
,
cookie
);
if
(
IS_ERR_OR_NULL
(
ret
))
{
kfree
(
data
);
return
ret
;
}
if
(
data
)
data
->
cookie
=
*
cookie
;
*
cookie
=
data
;
return
ret
;
}
static
void
ovl_put_link
(
struct
inode
*
unused
,
void
*
c
)
{
struct
inode
*
realinode
;
struct
ovl_link_data
*
data
=
c
;
if
(
!
data
)
return
;
realinode
=
data
->
realdentry
->
d_inode
;
realinode
->
i_op
->
put_link
(
realinode
,
data
->
cookie
);
kfree
(
data
);
}
}
static
int
ovl_readlink
(
struct
dentry
*
dentry
,
char
__user
*
buf
,
int
bufsiz
)
static
int
ovl_readlink
(
struct
dentry
*
dentry
,
char
__user
*
buf
,
int
bufsiz
)
...
@@ -383,7 +345,6 @@ static const struct inode_operations ovl_file_inode_operations = {
...
@@ -383,7 +345,6 @@ static const struct inode_operations ovl_file_inode_operations = {
static
const
struct
inode_operations
ovl_symlink_inode_operations
=
{
static
const
struct
inode_operations
ovl_symlink_inode_operations
=
{
.
setattr
=
ovl_setattr
,
.
setattr
=
ovl_setattr
,
.
get_link
=
ovl_get_link
,
.
get_link
=
ovl_get_link
,
.
put_link
=
ovl_put_link
,
.
readlink
=
ovl_readlink
,
.
readlink
=
ovl_readlink
,
.
getattr
=
ovl_getattr
,
.
getattr
=
ovl_getattr
,
.
setxattr
=
ovl_setxattr
,
.
setxattr
=
ovl_setxattr
,
...
...
fs/proc/base.c
浏览文件 @
fceef393
...
@@ -1565,7 +1565,8 @@ static int proc_exe_link(struct dentry *dentry, struct path *exe_path)
...
@@ -1565,7 +1565,8 @@ static int proc_exe_link(struct dentry *dentry, struct path *exe_path)
}
}
static
const
char
*
proc_pid_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
proc_pid_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
struct
path
path
;
struct
path
path
;
int
error
=
-
EACCES
;
int
error
=
-
EACCES
;
...
@@ -1949,12 +1950,13 @@ struct map_files_info {
...
@@ -1949,12 +1950,13 @@ struct map_files_info {
*/
*/
static
const
char
*
static
const
char
*
proc_map_files_get_link
(
struct
dentry
*
dentry
,
proc_map_files_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
if
(
!
capable
(
CAP_SYS_ADMIN
))
if
(
!
capable
(
CAP_SYS_ADMIN
))
return
ERR_PTR
(
-
EPERM
);
return
ERR_PTR
(
-
EPERM
);
return
proc_pid_get_link
(
dentry
,
inode
,
NULL
);
return
proc_pid_get_link
(
dentry
,
inode
,
done
);
}
}
/*
/*
...
...
fs/proc/inode.c
浏览文件 @
fceef393
...
@@ -393,25 +393,25 @@ static const struct file_operations proc_reg_file_ops_no_compat = {
...
@@ -393,25 +393,25 @@ static const struct file_operations proc_reg_file_ops_no_compat = {
};
};
#endif
#endif
static
void
proc_put_link
(
void
*
p
)
{
unuse_pde
(
p
);
}
static
const
char
*
proc_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
proc_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
struct
proc_dir_entry
*
pde
=
PDE
(
inode
);
struct
proc_dir_entry
*
pde
=
PDE
(
inode
);
if
(
unlikely
(
!
use_pde
(
pde
)))
if
(
unlikely
(
!
use_pde
(
pde
)))
return
ERR_PTR
(
-
EINVAL
);
return
ERR_PTR
(
-
EINVAL
);
*
cookie
=
pde
;
set_delayed_call
(
done
,
proc_put_link
,
pde
)
;
return
pde
->
data
;
return
pde
->
data
;
}
}
static
void
proc_put_link
(
struct
inode
*
unused
,
void
*
p
)
{
unuse_pde
(
p
);
}
const
struct
inode_operations
proc_link_inode_operations
=
{
const
struct
inode_operations
proc_link_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
proc_get_link
,
.
get_link
=
proc_get_link
,
.
put_link
=
proc_put_link
,
};
};
struct
inode
*
proc_get_inode
(
struct
super_block
*
sb
,
struct
proc_dir_entry
*
de
)
struct
inode
*
proc_get_inode
(
struct
super_block
*
sb
,
struct
proc_dir_entry
*
de
)
...
...
fs/proc/namespaces.c
浏览文件 @
fceef393
...
@@ -31,7 +31,8 @@ static const struct proc_ns_operations *ns_entries[] = {
...
@@ -31,7 +31,8 @@ static const struct proc_ns_operations *ns_entries[] = {
};
};
static
const
char
*
proc_ns_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
proc_ns_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
const
struct
proc_ns_operations
*
ns_ops
=
PROC_I
(
inode
)
->
ns_ops
;
const
struct
proc_ns_operations
*
ns_ops
=
PROC_I
(
inode
)
->
ns_ops
;
struct
task_struct
*
task
;
struct
task_struct
*
task
;
...
...
fs/proc/self.c
浏览文件 @
fceef393
...
@@ -19,7 +19,8 @@ static int proc_self_readlink(struct dentry *dentry, char __user *buffer,
...
@@ -19,7 +19,8 @@ static int proc_self_readlink(struct dentry *dentry, char __user *buffer,
}
}
static
const
char
*
proc_self_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
proc_self_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
struct
pid_namespace
*
ns
=
inode
->
i_sb
->
s_fs_info
;
struct
pid_namespace
*
ns
=
inode
->
i_sb
->
s_fs_info
;
pid_t
tgid
=
task_tgid_nr_ns
(
current
,
ns
);
pid_t
tgid
=
task_tgid_nr_ns
(
current
,
ns
);
...
@@ -32,13 +33,13 @@ static const char *proc_self_get_link(struct dentry *dentry,
...
@@ -32,13 +33,13 @@ static const char *proc_self_get_link(struct dentry *dentry,
if
(
unlikely
(
!
name
))
if
(
unlikely
(
!
name
))
return
dentry
?
ERR_PTR
(
-
ENOMEM
)
:
ERR_PTR
(
-
ECHILD
);
return
dentry
?
ERR_PTR
(
-
ENOMEM
)
:
ERR_PTR
(
-
ECHILD
);
sprintf
(
name
,
"%d"
,
tgid
);
sprintf
(
name
,
"%d"
,
tgid
);
return
*
cookie
=
name
;
set_delayed_call
(
done
,
kfree_link
,
name
);
return
name
;
}
}
static
const
struct
inode_operations
proc_self_inode_operations
=
{
static
const
struct
inode_operations
proc_self_inode_operations
=
{
.
readlink
=
proc_self_readlink
,
.
readlink
=
proc_self_readlink
,
.
get_link
=
proc_self_get_link
,
.
get_link
=
proc_self_get_link
,
.
put_link
=
kfree_put_link
,
};
};
static
unsigned
self_inum
;
static
unsigned
self_inum
;
...
...
fs/proc/thread_self.c
浏览文件 @
fceef393
...
@@ -20,7 +20,8 @@ static int proc_thread_self_readlink(struct dentry *dentry, char __user *buffer,
...
@@ -20,7 +20,8 @@ static int proc_thread_self_readlink(struct dentry *dentry, char __user *buffer,
}
}
static
const
char
*
proc_thread_self_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
proc_thread_self_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
struct
pid_namespace
*
ns
=
inode
->
i_sb
->
s_fs_info
;
struct
pid_namespace
*
ns
=
inode
->
i_sb
->
s_fs_info
;
pid_t
tgid
=
task_tgid_nr_ns
(
current
,
ns
);
pid_t
tgid
=
task_tgid_nr_ns
(
current
,
ns
);
...
@@ -34,13 +35,13 @@ static const char *proc_thread_self_get_link(struct dentry *dentry,
...
@@ -34,13 +35,13 @@ static const char *proc_thread_self_get_link(struct dentry *dentry,
if
(
unlikely
(
!
name
))
if
(
unlikely
(
!
name
))
return
dentry
?
ERR_PTR
(
-
ENOMEM
)
:
ERR_PTR
(
-
ECHILD
);
return
dentry
?
ERR_PTR
(
-
ENOMEM
)
:
ERR_PTR
(
-
ECHILD
);
sprintf
(
name
,
"%d/task/%d"
,
tgid
,
pid
);
sprintf
(
name
,
"%d/task/%d"
,
tgid
,
pid
);
return
*
cookie
=
name
;
set_delayed_call
(
done
,
kfree_link
,
name
);
return
name
;
}
}
static
const
struct
inode_operations
proc_thread_self_inode_operations
=
{
static
const
struct
inode_operations
proc_thread_self_inode_operations
=
{
.
readlink
=
proc_thread_self_readlink
,
.
readlink
=
proc_thread_self_readlink
,
.
get_link
=
proc_thread_self_get_link
,
.
get_link
=
proc_thread_self_get_link
,
.
put_link
=
kfree_put_link
,
};
};
static
unsigned
thread_self_inum
;
static
unsigned
thread_self_inum
;
...
...
fs/reiserfs/namei.c
浏览文件 @
fceef393
...
@@ -1666,7 +1666,6 @@ const struct inode_operations reiserfs_dir_inode_operations = {
...
@@ -1666,7 +1666,6 @@ const struct inode_operations reiserfs_dir_inode_operations = {
const
struct
inode_operations
reiserfs_symlink_inode_operations
=
{
const
struct
inode_operations
reiserfs_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
page_get_link
,
.
get_link
=
page_get_link
,
.
put_link
=
page_put_link
,
.
setattr
=
reiserfs_setattr
,
.
setattr
=
reiserfs_setattr
,
.
setxattr
=
reiserfs_setxattr
,
.
setxattr
=
reiserfs_setxattr
,
.
getxattr
=
reiserfs_getxattr
,
.
getxattr
=
reiserfs_getxattr
,
...
...
fs/squashfs/symlink.c
浏览文件 @
fceef393
...
@@ -120,7 +120,6 @@ const struct address_space_operations squashfs_symlink_aops = {
...
@@ -120,7 +120,6 @@ const struct address_space_operations squashfs_symlink_aops = {
const
struct
inode_operations
squashfs_symlink_inode_ops
=
{
const
struct
inode_operations
squashfs_symlink_inode_ops
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
page_get_link
,
.
get_link
=
page_get_link
,
.
put_link
=
page_put_link
,
.
getxattr
=
generic_getxattr
,
.
getxattr
=
generic_getxattr
,
.
listxattr
=
squashfs_listxattr
.
listxattr
=
squashfs_listxattr
};
};
...
...
fs/sysv/inode.c
浏览文件 @
fceef393
...
@@ -147,7 +147,6 @@ static inline void write3byte(struct sysv_sb_info *sbi,
...
@@ -147,7 +147,6 @@ static inline void write3byte(struct sysv_sb_info *sbi,
static
const
struct
inode_operations
sysv_symlink_inode_operations
=
{
static
const
struct
inode_operations
sysv_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
page_get_link
,
.
get_link
=
page_get_link
,
.
put_link
=
page_put_link
,
.
getattr
=
sysv_getattr
,
.
getattr
=
sysv_getattr
,
};
};
...
...
fs/xfs/xfs_iops.c
浏览文件 @
fceef393
...
@@ -417,7 +417,7 @@ STATIC const char *
...
@@ -417,7 +417,7 @@ STATIC const char *
xfs_vn_get_link
(
xfs_vn_get_link
(
struct
dentry
*
dentry
,
struct
dentry
*
dentry
,
struct
inode
*
inode
,
struct
inode
*
inode
,
void
**
cooki
e
)
struct
delayed_call
*
don
e
)
{
{
char
*
link
;
char
*
link
;
int
error
=
-
ENOMEM
;
int
error
=
-
ENOMEM
;
...
@@ -433,7 +433,8 @@ xfs_vn_get_link(
...
@@ -433,7 +433,8 @@ xfs_vn_get_link(
if
(
unlikely
(
error
))
if
(
unlikely
(
error
))
goto
out_kfree
;
goto
out_kfree
;
return
*
cookie
=
link
;
set_delayed_call
(
done
,
kfree_link
,
link
);
return
link
;
out_kfree:
out_kfree:
kfree
(
link
);
kfree
(
link
);
...
@@ -1177,7 +1178,6 @@ static const struct inode_operations xfs_dir_ci_inode_operations = {
...
@@ -1177,7 +1178,6 @@ static const struct inode_operations xfs_dir_ci_inode_operations = {
static
const
struct
inode_operations
xfs_symlink_inode_operations
=
{
static
const
struct
inode_operations
xfs_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
xfs_vn_get_link
,
.
get_link
=
xfs_vn_get_link
,
.
put_link
=
kfree_put_link
,
.
getattr
=
xfs_vn_getattr
,
.
getattr
=
xfs_vn_getattr
,
.
setattr
=
xfs_vn_setattr
,
.
setattr
=
xfs_vn_setattr
,
.
setxattr
=
generic_setxattr
,
.
setxattr
=
generic_setxattr
,
...
...
include/linux/delayed_call.h
0 → 100644
浏览文件 @
fceef393
#ifndef _DELAYED_CALL_H
#define _DELAYED_CALL_H
/*
* Poor man's closures; I wish we could've done them sanely polymorphic,
* but...
*/
struct
delayed_call
{
void
(
*
fn
)(
void
*
);
void
*
arg
;
};
#define DEFINE_DELAYED_CALL(name) struct delayed_call name = {NULL, NULL}
/* I really wish we had closures with sane typechecking... */
static
inline
void
set_delayed_call
(
struct
delayed_call
*
call
,
void
(
*
fn
)(
void
*
),
void
*
arg
)
{
call
->
fn
=
fn
;
call
->
arg
=
arg
;
}
static
inline
void
do_delayed_call
(
struct
delayed_call
*
call
)
{
if
(
call
->
fn
)
call
->
fn
(
call
->
arg
);
}
static
inline
void
clear_delayed_call
(
struct
delayed_call
*
call
)
{
call
->
fn
=
NULL
;
}
#endif
include/linux/fs.h
浏览文件 @
fceef393
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include <linux/blk_types.h>
#include <linux/blk_types.h>
#include <linux/workqueue.h>
#include <linux/workqueue.h>
#include <linux/percpu-rwsem.h>
#include <linux/percpu-rwsem.h>
#include <linux/delayed_call.h>
#include <asm/byteorder.h>
#include <asm/byteorder.h>
#include <uapi/linux/fs.h>
#include <uapi/linux/fs.h>
...
@@ -1633,12 +1634,11 @@ struct file_operations {
...
@@ -1633,12 +1634,11 @@ struct file_operations {
struct
inode_operations
{
struct
inode_operations
{
struct
dentry
*
(
*
lookup
)
(
struct
inode
*
,
struct
dentry
*
,
unsigned
int
);
struct
dentry
*
(
*
lookup
)
(
struct
inode
*
,
struct
dentry
*
,
unsigned
int
);
const
char
*
(
*
get_link
)
(
struct
dentry
*
,
struct
inode
*
,
void
*
*
);
const
char
*
(
*
get_link
)
(
struct
dentry
*
,
struct
inode
*
,
struct
delayed_call
*
);
int
(
*
permission
)
(
struct
inode
*
,
int
);
int
(
*
permission
)
(
struct
inode
*
,
int
);
struct
posix_acl
*
(
*
get_acl
)(
struct
inode
*
,
int
);
struct
posix_acl
*
(
*
get_acl
)(
struct
inode
*
,
int
);
int
(
*
readlink
)
(
struct
dentry
*
,
char
__user
*
,
int
);
int
(
*
readlink
)
(
struct
dentry
*
,
char
__user
*
,
int
);
void
(
*
put_link
)
(
struct
inode
*
,
void
*
);
int
(
*
create
)
(
struct
inode
*
,
struct
dentry
*
,
umode_t
,
bool
);
int
(
*
create
)
(
struct
inode
*
,
struct
dentry
*
,
umode_t
,
bool
);
int
(
*
link
)
(
struct
dentry
*
,
struct
inode
*
,
struct
dentry
*
);
int
(
*
link
)
(
struct
dentry
*
,
struct
inode
*
,
struct
dentry
*
);
...
@@ -2736,13 +2736,14 @@ extern const struct file_operations generic_ro_fops;
...
@@ -2736,13 +2736,14 @@ extern const struct file_operations generic_ro_fops;
extern
int
readlink_copy
(
char
__user
*
,
int
,
const
char
*
);
extern
int
readlink_copy
(
char
__user
*
,
int
,
const
char
*
);
extern
int
page_readlink
(
struct
dentry
*
,
char
__user
*
,
int
);
extern
int
page_readlink
(
struct
dentry
*
,
char
__user
*
,
int
);
extern
const
char
*
page_get_link
(
struct
dentry
*
,
struct
inode
*
,
void
**
);
extern
const
char
*
page_get_link
(
struct
dentry
*
,
struct
inode
*
,
extern
void
page_put_link
(
struct
inode
*
,
void
*
);
struct
delayed_call
*
);
extern
void
page_put_link
(
void
*
);
extern
int
__page_symlink
(
struct
inode
*
inode
,
const
char
*
symname
,
int
len
,
extern
int
__page_symlink
(
struct
inode
*
inode
,
const
char
*
symname
,
int
len
,
int
nofs
);
int
nofs
);
extern
int
page_symlink
(
struct
inode
*
inode
,
const
char
*
symname
,
int
len
);
extern
int
page_symlink
(
struct
inode
*
inode
,
const
char
*
symname
,
int
len
);
extern
const
struct
inode_operations
page_symlink_inode_operations
;
extern
const
struct
inode_operations
page_symlink_inode_operations
;
extern
void
kfree_
put_link
(
struct
inode
*
,
void
*
);
extern
void
kfree_
link
(
void
*
);
extern
int
generic_readlink
(
struct
dentry
*
,
char
__user
*
,
int
);
extern
int
generic_readlink
(
struct
dentry
*
,
char
__user
*
,
int
);
extern
void
generic_fillattr
(
struct
inode
*
,
struct
kstat
*
);
extern
void
generic_fillattr
(
struct
inode
*
,
struct
kstat
*
);
int
vfs_getattr_nosec
(
struct
path
*
path
,
struct
kstat
*
stat
);
int
vfs_getattr_nosec
(
struct
path
*
path
,
struct
kstat
*
stat
);
...
@@ -2753,7 +2754,8 @@ void __inode_sub_bytes(struct inode *inode, loff_t bytes);
...
@@ -2753,7 +2754,8 @@ void __inode_sub_bytes(struct inode *inode, loff_t bytes);
void
inode_sub_bytes
(
struct
inode
*
inode
,
loff_t
bytes
);
void
inode_sub_bytes
(
struct
inode
*
inode
,
loff_t
bytes
);
loff_t
inode_get_bytes
(
struct
inode
*
inode
);
loff_t
inode_get_bytes
(
struct
inode
*
inode
);
void
inode_set_bytes
(
struct
inode
*
inode
,
loff_t
bytes
);
void
inode_set_bytes
(
struct
inode
*
inode
,
loff_t
bytes
);
const
char
*
simple_get_link
(
struct
dentry
*
,
struct
inode
*
,
void
**
);
const
char
*
simple_get_link
(
struct
dentry
*
,
struct
inode
*
,
struct
delayed_call
*
);
extern
const
struct
inode_operations
simple_symlink_inode_operations
;
extern
const
struct
inode_operations
simple_symlink_inode_operations
;
extern
int
iterate_dir
(
struct
file
*
,
struct
dir_context
*
);
extern
int
iterate_dir
(
struct
file
*
,
struct
dir_context
*
);
...
...
mm/shmem.c
浏览文件 @
fceef393
...
@@ -2496,8 +2496,15 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s
...
@@ -2496,8 +2496,15 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s
return
0
;
return
0
;
}
}
static
void
shmem_put_link
(
void
*
arg
)
{
mark_page_accessed
(
arg
);
put_page
(
arg
);
}
static
const
char
*
shmem_get_link
(
struct
dentry
*
dentry
,
static
const
char
*
shmem_get_link
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
void
**
cookie
)
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
{
struct
page
*
page
=
NULL
;
struct
page
*
page
=
NULL
;
int
error
;
int
error
;
...
@@ -2515,17 +2522,10 @@ static const char *shmem_get_link(struct dentry *dentry,
...
@@ -2515,17 +2522,10 @@ static const char *shmem_get_link(struct dentry *dentry,
return
ERR_PTR
(
error
);
return
ERR_PTR
(
error
);
unlock_page
(
page
);
unlock_page
(
page
);
}
}
*
cookie
=
page
;
set_delayed_call
(
done
,
shmem_put_link
,
page
)
;
return
page_address
(
page
);
return
page_address
(
page
);
}
}
static
void
shmem_put_link
(
struct
inode
*
unused
,
void
*
cookie
)
{
struct
page
*
page
=
cookie
;
mark_page_accessed
(
page
);
page_cache_release
(
page
);
}
#ifdef CONFIG_TMPFS_XATTR
#ifdef CONFIG_TMPFS_XATTR
/*
/*
* Superblocks without xattr inode operations may get some security.* xattr
* Superblocks without xattr inode operations may get some security.* xattr
...
@@ -2680,7 +2680,6 @@ static const struct inode_operations shmem_short_symlink_operations = {
...
@@ -2680,7 +2680,6 @@ static const struct inode_operations shmem_short_symlink_operations = {
static
const
struct
inode_operations
shmem_symlink_inode_operations
=
{
static
const
struct
inode_operations
shmem_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
readlink
=
generic_readlink
,
.
get_link
=
shmem_get_link
,
.
get_link
=
shmem_get_link
,
.
put_link
=
shmem_put_link
,
#ifdef CONFIG_TMPFS_XATTR
#ifdef CONFIG_TMPFS_XATTR
.
setxattr
=
shmem_setxattr
,
.
setxattr
=
shmem_setxattr
,
.
getxattr
=
shmem_getxattr
,
.
getxattr
=
shmem_getxattr
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录