12 #include <linux/module.h>
14 #define FUSE_CTL_SUPER_MAGIC 0x65735543
26 fc = file->
f_path.dentry->d_inode->i_private;
34 size_t count, loff_t *ppos)
36 struct fuse_conn *
fc = fuse_ctl_file_conn_get(file);
44 static ssize_t fuse_conn_waiting_read(
struct file *file,
char __user *buf,
45 size_t len, loff_t *ppos)
52 struct fuse_conn *fc = fuse_ctl_file_conn_get(file);
64 static ssize_t fuse_conn_limit_read(
struct file *file,
char __user *buf,
65 size_t len, loff_t *ppos,
unsigned val)
68 size_t size =
sprintf(tmp,
"%u\n", val);
73 static ssize_t fuse_conn_limit_write(
struct file *file,
const char __user *buf,
74 size_t count, loff_t *ppos,
unsigned *
val,
75 unsigned global_limit)
78 unsigned limit = (1 << 16) - 1;
89 limit =
min(limit, global_limit);
99 static ssize_t fuse_conn_max_background_read(
struct file *file,
100 char __user *buf,
size_t len,
106 fc = fuse_ctl_file_conn_get(file);
113 return fuse_conn_limit_read(file, buf, len, ppos, val);
116 static ssize_t fuse_conn_max_background_write(
struct file *file,
117 const char __user *buf,
118 size_t count, loff_t *ppos)
123 ret = fuse_conn_limit_write(file, buf, count, ppos, &val,
126 struct fuse_conn *fc = fuse_ctl_file_conn_get(file);
136 static ssize_t fuse_conn_congestion_threshold_read(
struct file *file,
137 char __user *buf,
size_t len,
143 fc = fuse_ctl_file_conn_get(file);
150 return fuse_conn_limit_read(file, buf, len, ppos, val);
153 static ssize_t fuse_conn_congestion_threshold_write(
struct file *file,
154 const char __user *buf,
155 size_t count, loff_t *ppos)
160 ret = fuse_conn_limit_write(file, buf, count, ppos, &val,
163 struct fuse_conn *fc = fuse_ctl_file_conn_get(file);
175 .write = fuse_conn_abort_write,
181 .read = fuse_conn_waiting_read,
187 .read = fuse_conn_max_background_read,
188 .write = fuse_conn_max_background_write,
192 static const struct file_operations fuse_conn_congestion_threshold_ops = {
194 .read = fuse_conn_congestion_threshold_read,
195 .write = fuse_conn_congestion_threshold_write,
199 static struct dentry *fuse_ctl_add_dentry(
struct dentry *parent,
230 d_add(dentry, inode);
240 struct dentry *parent;
243 if (!fuse_control_sb)
246 parent = fuse_control_sb->
s_root;
249 parent = fuse_ctl_add_dentry(parent, fc, name,
S_IFDIR | 0500, 2,
255 if (!fuse_ctl_add_dentry(parent, fc,
"waiting",
S_IFREG | 0400, 1,
256 NULL, &fuse_ctl_waiting_ops) ||
257 !fuse_ctl_add_dentry(parent, fc,
"abort",
S_IFREG | 0200, 1,
258 NULL, &fuse_ctl_abort_ops) ||
259 !fuse_ctl_add_dentry(parent, fc,
"max_background",
S_IFREG | 0600,
260 1,
NULL, &fuse_conn_max_background_ops) ||
261 !fuse_ctl_add_dentry(parent, fc,
"congestion_threshold",
263 &fuse_conn_congestion_threshold_ops))
281 if (!fuse_control_sb)
305 fuse_control_sb =
sb;
309 fuse_control_sb =
NULL;
320 int flags,
const char *dev_name,
void *raw_data)
322 return mount_single(fs_type, flags, raw_data, fuse_ctl_fill_super);
325 static void fuse_ctl_kill_sb(
struct super_block *sb)
330 fuse_control_sb =
NULL;
341 .mount = fuse_ctl_mount,
342 .kill_sb = fuse_ctl_kill_sb,