Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
8854e82d
L
linux
项目概览
xiphi1978
/
linux
通知
2
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,发现更多精彩内容 >>
提交
8854e82d
编写于
8月 09, 2009
作者:
T
Trond Myklebust
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SUNRPC: Add an rpc_pipefs front end for the sunrpc cache code
Signed-off-by:
N
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
上级
173912a6
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
190 addition
and
0 deletion
+190
-0
include/linux/sunrpc/cache.h
include/linux/sunrpc/cache.h
+13
-0
include/linux/sunrpc/rpc_pipe_fs.h
include/linux/sunrpc/rpc_pipe_fs.h
+8
-0
net/sunrpc/cache.c
net/sunrpc/cache.c
+126
-0
net/sunrpc/rpc_pipe.c
net/sunrpc/rpc_pipe.c
+43
-0
未找到文件。
include/linux/sunrpc/cache.h
浏览文件 @
8854e82d
...
...
@@ -64,6 +64,10 @@ struct cache_detail_procfs {
struct
proc_dir_entry
*
flush_ent
,
*
channel_ent
,
*
content_ent
;
};
struct
cache_detail_pipefs
{
struct
dentry
*
dir
;
};
struct
cache_detail
{
struct
module
*
owner
;
int
hash_size
;
...
...
@@ -110,6 +114,7 @@ struct cache_detail {
union
{
struct
cache_detail_procfs
procfs
;
struct
cache_detail_pipefs
pipefs
;
}
u
;
};
...
...
@@ -135,6 +140,10 @@ struct cache_deferred_req {
};
extern
const
struct
file_operations
cache_file_operations_pipefs
;
extern
const
struct
file_operations
content_file_operations_pipefs
;
extern
const
struct
file_operations
cache_flush_operations_pipefs
;
extern
struct
cache_head
*
sunrpc_cache_lookup
(
struct
cache_detail
*
detail
,
struct
cache_head
*
key
,
int
hash
);
...
...
@@ -186,6 +195,10 @@ extern void cache_purge(struct cache_detail *detail);
extern
int
cache_register
(
struct
cache_detail
*
cd
);
extern
void
cache_unregister
(
struct
cache_detail
*
cd
);
extern
int
sunrpc_cache_register_pipefs
(
struct
dentry
*
parent
,
const
char
*
,
mode_t
,
struct
cache_detail
*
);
extern
void
sunrpc_cache_unregister_pipefs
(
struct
cache_detail
*
);
extern
void
qword_add
(
char
**
bpp
,
int
*
lp
,
char
*
str
);
extern
void
qword_addhex
(
char
**
bpp
,
int
*
lp
,
char
*
buf
,
int
blen
);
extern
int
qword_get
(
char
**
bpp
,
char
*
dest
,
int
bufsize
);
...
...
include/linux/sunrpc/rpc_pipe_fs.h
浏览文件 @
8854e82d
...
...
@@ -47,6 +47,14 @@ extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
struct
rpc_clnt
;
extern
struct
dentry
*
rpc_create_client_dir
(
struct
dentry
*
,
struct
qstr
*
,
struct
rpc_clnt
*
);
extern
int
rpc_remove_client_dir
(
struct
dentry
*
);
struct
cache_detail
;
extern
struct
dentry
*
rpc_create_cache_dir
(
struct
dentry
*
,
struct
qstr
*
,
mode_t
umode
,
struct
cache_detail
*
);
extern
void
rpc_remove_cache_dir
(
struct
dentry
*
);
extern
struct
dentry
*
rpc_mkpipe
(
struct
dentry
*
,
const
char
*
,
void
*
,
const
struct
rpc_pipe_ops
*
,
int
flags
);
extern
int
rpc_unlink
(
struct
dentry
*
);
...
...
net/sunrpc/cache.c
浏览文件 @
8854e82d
...
...
@@ -32,6 +32,7 @@
#include <linux/sunrpc/types.h>
#include <linux/sunrpc/cache.h>
#include <linux/sunrpc/stats.h>
#include <linux/sunrpc/rpc_pipe_fs.h>
#define RPCDBG_FACILITY RPCDBG_CACHE
...
...
@@ -1438,3 +1439,128 @@ void cache_unregister(struct cache_detail *cd)
sunrpc_destroy_cache_detail
(
cd
);
}
EXPORT_SYMBOL_GPL
(
cache_unregister
);
static
ssize_t
cache_read_pipefs
(
struct
file
*
filp
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
struct
cache_detail
*
cd
=
RPC_I
(
filp
->
f_path
.
dentry
->
d_inode
)
->
private
;
return
cache_read
(
filp
,
buf
,
count
,
ppos
,
cd
);
}
static
ssize_t
cache_write_pipefs
(
struct
file
*
filp
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
struct
cache_detail
*
cd
=
RPC_I
(
filp
->
f_path
.
dentry
->
d_inode
)
->
private
;
return
cache_write
(
filp
,
buf
,
count
,
ppos
,
cd
);
}
static
unsigned
int
cache_poll_pipefs
(
struct
file
*
filp
,
poll_table
*
wait
)
{
struct
cache_detail
*
cd
=
RPC_I
(
filp
->
f_path
.
dentry
->
d_inode
)
->
private
;
return
cache_poll
(
filp
,
wait
,
cd
);
}
static
int
cache_ioctl_pipefs
(
struct
inode
*
inode
,
struct
file
*
filp
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
struct
cache_detail
*
cd
=
RPC_I
(
inode
)
->
private
;
return
cache_ioctl
(
inode
,
filp
,
cmd
,
arg
,
cd
);
}
static
int
cache_open_pipefs
(
struct
inode
*
inode
,
struct
file
*
filp
)
{
struct
cache_detail
*
cd
=
RPC_I
(
inode
)
->
private
;
return
cache_open
(
inode
,
filp
,
cd
);
}
static
int
cache_release_pipefs
(
struct
inode
*
inode
,
struct
file
*
filp
)
{
struct
cache_detail
*
cd
=
RPC_I
(
inode
)
->
private
;
return
cache_release
(
inode
,
filp
,
cd
);
}
const
struct
file_operations
cache_file_operations_pipefs
=
{
.
owner
=
THIS_MODULE
,
.
llseek
=
no_llseek
,
.
read
=
cache_read_pipefs
,
.
write
=
cache_write_pipefs
,
.
poll
=
cache_poll_pipefs
,
.
ioctl
=
cache_ioctl_pipefs
,
/* for FIONREAD */
.
open
=
cache_open_pipefs
,
.
release
=
cache_release_pipefs
,
};
static
int
content_open_pipefs
(
struct
inode
*
inode
,
struct
file
*
filp
)
{
struct
cache_detail
*
cd
=
RPC_I
(
inode
)
->
private
;
return
content_open
(
inode
,
filp
,
cd
);
}
const
struct
file_operations
content_file_operations_pipefs
=
{
.
open
=
content_open_pipefs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
seq_release_private
,
};
static
ssize_t
read_flush_pipefs
(
struct
file
*
filp
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
struct
cache_detail
*
cd
=
RPC_I
(
filp
->
f_path
.
dentry
->
d_inode
)
->
private
;
return
read_flush
(
filp
,
buf
,
count
,
ppos
,
cd
);
}
static
ssize_t
write_flush_pipefs
(
struct
file
*
filp
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
struct
cache_detail
*
cd
=
RPC_I
(
filp
->
f_path
.
dentry
->
d_inode
)
->
private
;
return
write_flush
(
filp
,
buf
,
count
,
ppos
,
cd
);
}
const
struct
file_operations
cache_flush_operations_pipefs
=
{
.
open
=
nonseekable_open
,
.
read
=
read_flush_pipefs
,
.
write
=
write_flush_pipefs
,
};
int
sunrpc_cache_register_pipefs
(
struct
dentry
*
parent
,
const
char
*
name
,
mode_t
umode
,
struct
cache_detail
*
cd
)
{
struct
qstr
q
;
struct
dentry
*
dir
;
int
ret
=
0
;
sunrpc_init_cache_detail
(
cd
);
q
.
name
=
name
;
q
.
len
=
strlen
(
name
);
q
.
hash
=
full_name_hash
(
q
.
name
,
q
.
len
);
dir
=
rpc_create_cache_dir
(
parent
,
&
q
,
umode
,
cd
);
if
(
!
IS_ERR
(
dir
))
cd
->
u
.
pipefs
.
dir
=
dir
;
else
{
sunrpc_destroy_cache_detail
(
cd
);
ret
=
PTR_ERR
(
dir
);
}
return
ret
;
}
EXPORT_SYMBOL_GPL
(
sunrpc_cache_register_pipefs
);
void
sunrpc_cache_unregister_pipefs
(
struct
cache_detail
*
cd
)
{
rpc_remove_cache_dir
(
cd
->
u
.
pipefs
.
dir
);
cd
->
u
.
pipefs
.
dir
=
NULL
;
sunrpc_destroy_cache_detail
(
cd
);
}
EXPORT_SYMBOL_GPL
(
sunrpc_cache_unregister_pipefs
);
net/sunrpc/rpc_pipe.c
浏览文件 @
8854e82d
...
...
@@ -26,6 +26,7 @@
#include <linux/sunrpc/clnt.h>
#include <linux/workqueue.h>
#include <linux/sunrpc/rpc_pipe_fs.h>
#include <linux/sunrpc/cache.h>
static
struct
vfsmount
*
rpc_mount
__read_mostly
;
static
int
rpc_mount_count
;
...
...
@@ -882,6 +883,48 @@ int rpc_remove_client_dir(struct dentry *dentry)
return
rpc_rmdir_depopulate
(
dentry
,
rpc_clntdir_depopulate
);
}
static
const
struct
rpc_filelist
cache_pipefs_files
[
3
]
=
{
[
0
]
=
{
.
name
=
"channel"
,
.
i_fop
=
&
cache_file_operations_pipefs
,
.
mode
=
S_IFIFO
|
S_IRUSR
|
S_IWUSR
,
},
[
1
]
=
{
.
name
=
"content"
,
.
i_fop
=
&
content_file_operations_pipefs
,
.
mode
=
S_IFREG
|
S_IRUSR
,
},
[
2
]
=
{
.
name
=
"flush"
,
.
i_fop
=
&
cache_flush_operations_pipefs
,
.
mode
=
S_IFREG
|
S_IRUSR
|
S_IWUSR
,
},
};
static
int
rpc_cachedir_populate
(
struct
dentry
*
dentry
,
void
*
private
)
{
return
rpc_populate
(
dentry
,
cache_pipefs_files
,
0
,
3
,
private
);
}
static
void
rpc_cachedir_depopulate
(
struct
dentry
*
dentry
)
{
rpc_depopulate
(
dentry
,
cache_pipefs_files
,
0
,
3
);
}
struct
dentry
*
rpc_create_cache_dir
(
struct
dentry
*
parent
,
struct
qstr
*
name
,
mode_t
umode
,
struct
cache_detail
*
cd
)
{
return
rpc_mkdir_populate
(
parent
,
name
,
umode
,
NULL
,
rpc_cachedir_populate
,
cd
);
}
void
rpc_remove_cache_dir
(
struct
dentry
*
dentry
)
{
rpc_rmdir_depopulate
(
dentry
,
rpc_cachedir_depopulate
);
}
/*
* populate the filesystem
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录