Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 1 | /* |
| 2 | FUSE: Filesystem in Userspace |
Miklos Szeredi | 1729a16 | 2008-11-26 12:03:54 +0100 | [diff] [blame] | 3 | Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu> |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 4 | |
| 5 | This program can be distributed under the terms of the GNU GPL. |
| 6 | See the file COPYING. |
| 7 | */ |
| 8 | |
| 9 | #include "fuse_i.h" |
| 10 | |
| 11 | #include <linux/init.h> |
| 12 | #include <linux/module.h> |
| 13 | |
| 14 | #define FUSE_CTL_SUPER_MAGIC 0x65735543 |
| 15 | |
| 16 | /* |
| 17 | * This is non-NULL when the single instance of the control filesystem |
| 18 | * exists. Protected by fuse_mutex |
| 19 | */ |
| 20 | static struct super_block *fuse_control_sb; |
| 21 | |
| 22 | static struct fuse_conn *fuse_ctl_file_conn_get(struct file *file) |
| 23 | { |
| 24 | struct fuse_conn *fc; |
| 25 | mutex_lock(&fuse_mutex); |
Al Viro | 496ad9a | 2013-01-23 17:07:38 -0500 | [diff] [blame] | 26 | fc = file_inode(file)->i_private; |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 27 | if (fc) |
| 28 | fc = fuse_conn_get(fc); |
| 29 | mutex_unlock(&fuse_mutex); |
| 30 | return fc; |
| 31 | } |
| 32 | |
| 33 | static ssize_t fuse_conn_abort_write(struct file *file, const char __user *buf, |
| 34 | size_t count, loff_t *ppos) |
| 35 | { |
| 36 | struct fuse_conn *fc = fuse_ctl_file_conn_get(file); |
| 37 | if (fc) { |
Szymon Lukasz | 3b7008b | 2017-11-09 21:23:35 +0100 | [diff] [blame] | 38 | fuse_abort_conn(fc, true); |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 39 | fuse_conn_put(fc); |
| 40 | } |
| 41 | return count; |
| 42 | } |
| 43 | |
| 44 | static ssize_t fuse_conn_waiting_read(struct file *file, char __user *buf, |
| 45 | size_t len, loff_t *ppos) |
| 46 | { |
| 47 | char tmp[32]; |
| 48 | size_t size; |
| 49 | |
| 50 | if (!*ppos) { |
Miklos Szeredi | 1729a16 | 2008-11-26 12:03:54 +0100 | [diff] [blame] | 51 | long value; |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 52 | struct fuse_conn *fc = fuse_ctl_file_conn_get(file); |
| 53 | if (!fc) |
| 54 | return 0; |
| 55 | |
Miklos Szeredi | 1729a16 | 2008-11-26 12:03:54 +0100 | [diff] [blame] | 56 | value = atomic_read(&fc->num_waiting); |
| 57 | file->private_data = (void *)value; |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 58 | fuse_conn_put(fc); |
| 59 | } |
| 60 | size = sprintf(tmp, "%ld\n", (long)file->private_data); |
| 61 | return simple_read_from_buffer(buf, len, ppos, tmp, size); |
| 62 | } |
| 63 | |
Csaba Henk | 79a9d99 | 2009-08-26 19:18:24 +0200 | [diff] [blame] | 64 | static ssize_t fuse_conn_limit_read(struct file *file, char __user *buf, |
| 65 | size_t len, loff_t *ppos, unsigned val) |
| 66 | { |
| 67 | char tmp[32]; |
| 68 | size_t size = sprintf(tmp, "%u\n", val); |
| 69 | |
| 70 | return simple_read_from_buffer(buf, len, ppos, tmp, size); |
| 71 | } |
| 72 | |
| 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) |
| 76 | { |
| 77 | unsigned long t; |
Csaba Henk | 79a9d99 | 2009-08-26 19:18:24 +0200 | [diff] [blame] | 78 | unsigned limit = (1 << 16) - 1; |
| 79 | int err; |
| 80 | |
Peter Huewe | e269069 | 2012-04-15 02:20:27 +0200 | [diff] [blame] | 81 | if (*ppos) |
Csaba Henk | 79a9d99 | 2009-08-26 19:18:24 +0200 | [diff] [blame] | 82 | return -EINVAL; |
| 83 | |
Peter Huewe | e269069 | 2012-04-15 02:20:27 +0200 | [diff] [blame] | 84 | err = kstrtoul_from_user(buf, count, 0, &t); |
Csaba Henk | 79a9d99 | 2009-08-26 19:18:24 +0200 | [diff] [blame] | 85 | if (err) |
| 86 | return err; |
| 87 | |
| 88 | if (!capable(CAP_SYS_ADMIN)) |
| 89 | limit = min(limit, global_limit); |
| 90 | |
| 91 | if (t > limit) |
| 92 | return -EINVAL; |
| 93 | |
| 94 | *val = t; |
| 95 | |
| 96 | return count; |
| 97 | } |
| 98 | |
| 99 | static ssize_t fuse_conn_max_background_read(struct file *file, |
| 100 | char __user *buf, size_t len, |
| 101 | loff_t *ppos) |
| 102 | { |
| 103 | struct fuse_conn *fc; |
| 104 | unsigned val; |
| 105 | |
| 106 | fc = fuse_ctl_file_conn_get(file); |
| 107 | if (!fc) |
| 108 | return 0; |
| 109 | |
Kirill Tkhai | 2a23f2b | 2018-08-27 18:29:29 +0300 | [diff] [blame] | 110 | val = READ_ONCE(fc->max_background); |
Csaba Henk | 79a9d99 | 2009-08-26 19:18:24 +0200 | [diff] [blame] | 111 | fuse_conn_put(fc); |
| 112 | |
| 113 | return fuse_conn_limit_read(file, buf, len, ppos, val); |
| 114 | } |
| 115 | |
| 116 | static ssize_t fuse_conn_max_background_write(struct file *file, |
| 117 | const char __user *buf, |
| 118 | size_t count, loff_t *ppos) |
| 119 | { |
Daniel Mack | 381bf7c | 2012-08-28 10:38:03 +0200 | [diff] [blame] | 120 | unsigned uninitialized_var(val); |
Csaba Henk | 79a9d99 | 2009-08-26 19:18:24 +0200 | [diff] [blame] | 121 | ssize_t ret; |
| 122 | |
| 123 | ret = fuse_conn_limit_write(file, buf, count, ppos, &val, |
| 124 | max_user_bgreq); |
| 125 | if (ret > 0) { |
| 126 | struct fuse_conn *fc = fuse_ctl_file_conn_get(file); |
| 127 | if (fc) { |
Kirill Tkhai | ae2dffa | 2018-08-27 18:29:46 +0300 | [diff] [blame] | 128 | spin_lock(&fc->bg_lock); |
Csaba Henk | 79a9d99 | 2009-08-26 19:18:24 +0200 | [diff] [blame] | 129 | fc->max_background = val; |
Kirill Tkhai | 2b30a53 | 2018-08-27 18:29:37 +0300 | [diff] [blame] | 130 | fc->blocked = fc->num_background >= fc->max_background; |
| 131 | if (!fc->blocked) |
| 132 | wake_up(&fc->blocked_waitq); |
Kirill Tkhai | ae2dffa | 2018-08-27 18:29:46 +0300 | [diff] [blame] | 133 | spin_unlock(&fc->bg_lock); |
Csaba Henk | 79a9d99 | 2009-08-26 19:18:24 +0200 | [diff] [blame] | 134 | fuse_conn_put(fc); |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | return ret; |
| 139 | } |
| 140 | |
| 141 | static ssize_t fuse_conn_congestion_threshold_read(struct file *file, |
| 142 | char __user *buf, size_t len, |
| 143 | loff_t *ppos) |
| 144 | { |
| 145 | struct fuse_conn *fc; |
| 146 | unsigned val; |
| 147 | |
| 148 | fc = fuse_ctl_file_conn_get(file); |
| 149 | if (!fc) |
| 150 | return 0; |
| 151 | |
Kirill Tkhai | 2a23f2b | 2018-08-27 18:29:29 +0300 | [diff] [blame] | 152 | val = READ_ONCE(fc->congestion_threshold); |
Csaba Henk | 79a9d99 | 2009-08-26 19:18:24 +0200 | [diff] [blame] | 153 | fuse_conn_put(fc); |
| 154 | |
| 155 | return fuse_conn_limit_read(file, buf, len, ppos, val); |
| 156 | } |
| 157 | |
| 158 | static ssize_t fuse_conn_congestion_threshold_write(struct file *file, |
| 159 | const char __user *buf, |
| 160 | size_t count, loff_t *ppos) |
| 161 | { |
Daniel Mack | 381bf7c | 2012-08-28 10:38:03 +0200 | [diff] [blame] | 162 | unsigned uninitialized_var(val); |
Kirill Tkhai | 2b30a53 | 2018-08-27 18:29:37 +0300 | [diff] [blame] | 163 | struct fuse_conn *fc; |
Csaba Henk | 79a9d99 | 2009-08-26 19:18:24 +0200 | [diff] [blame] | 164 | ssize_t ret; |
| 165 | |
| 166 | ret = fuse_conn_limit_write(file, buf, count, ppos, &val, |
| 167 | max_user_congthresh); |
Kirill Tkhai | 2b30a53 | 2018-08-27 18:29:37 +0300 | [diff] [blame] | 168 | if (ret <= 0) |
| 169 | goto out; |
| 170 | fc = fuse_ctl_file_conn_get(file); |
| 171 | if (!fc) |
| 172 | goto out; |
| 173 | |
Kirill Tkhai | ae2dffa | 2018-08-27 18:29:46 +0300 | [diff] [blame] | 174 | spin_lock(&fc->bg_lock); |
Kirill Tkhai | 2b30a53 | 2018-08-27 18:29:37 +0300 | [diff] [blame] | 175 | fc->congestion_threshold = val; |
| 176 | if (fc->sb) { |
| 177 | if (fc->num_background < fc->congestion_threshold) { |
| 178 | clear_bdi_congested(fc->sb->s_bdi, BLK_RW_SYNC); |
| 179 | clear_bdi_congested(fc->sb->s_bdi, BLK_RW_ASYNC); |
| 180 | } else { |
| 181 | set_bdi_congested(fc->sb->s_bdi, BLK_RW_SYNC); |
| 182 | set_bdi_congested(fc->sb->s_bdi, BLK_RW_ASYNC); |
Csaba Henk | 79a9d99 | 2009-08-26 19:18:24 +0200 | [diff] [blame] | 183 | } |
| 184 | } |
Kirill Tkhai | ae2dffa | 2018-08-27 18:29:46 +0300 | [diff] [blame] | 185 | spin_unlock(&fc->bg_lock); |
Kirill Tkhai | 2b30a53 | 2018-08-27 18:29:37 +0300 | [diff] [blame] | 186 | fuse_conn_put(fc); |
| 187 | out: |
Csaba Henk | 79a9d99 | 2009-08-26 19:18:24 +0200 | [diff] [blame] | 188 | return ret; |
| 189 | } |
| 190 | |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 191 | static const struct file_operations fuse_ctl_abort_ops = { |
| 192 | .open = nonseekable_open, |
| 193 | .write = fuse_conn_abort_write, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 194 | .llseek = no_llseek, |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 195 | }; |
| 196 | |
| 197 | static const struct file_operations fuse_ctl_waiting_ops = { |
| 198 | .open = nonseekable_open, |
| 199 | .read = fuse_conn_waiting_read, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 200 | .llseek = no_llseek, |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 201 | }; |
| 202 | |
Csaba Henk | 79a9d99 | 2009-08-26 19:18:24 +0200 | [diff] [blame] | 203 | static const struct file_operations fuse_conn_max_background_ops = { |
| 204 | .open = nonseekable_open, |
| 205 | .read = fuse_conn_max_background_read, |
| 206 | .write = fuse_conn_max_background_write, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 207 | .llseek = no_llseek, |
Csaba Henk | 79a9d99 | 2009-08-26 19:18:24 +0200 | [diff] [blame] | 208 | }; |
| 209 | |
| 210 | static const struct file_operations fuse_conn_congestion_threshold_ops = { |
| 211 | .open = nonseekable_open, |
| 212 | .read = fuse_conn_congestion_threshold_read, |
| 213 | .write = fuse_conn_congestion_threshold_write, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 214 | .llseek = no_llseek, |
Csaba Henk | 79a9d99 | 2009-08-26 19:18:24 +0200 | [diff] [blame] | 215 | }; |
| 216 | |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 217 | static struct dentry *fuse_ctl_add_dentry(struct dentry *parent, |
| 218 | struct fuse_conn *fc, |
| 219 | const char *name, |
| 220 | int mode, int nlink, |
Arjan van de Ven | 754661f | 2007-02-12 00:55:38 -0800 | [diff] [blame] | 221 | const struct inode_operations *iop, |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 222 | const struct file_operations *fop) |
| 223 | { |
| 224 | struct dentry *dentry; |
| 225 | struct inode *inode; |
| 226 | |
| 227 | BUG_ON(fc->ctl_ndents >= FUSE_CTL_NUM_DENTRIES); |
| 228 | dentry = d_alloc_name(parent, name); |
| 229 | if (!dentry) |
| 230 | return NULL; |
| 231 | |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 232 | inode = new_inode(fuse_control_sb); |
Miklos Szeredi | 6becdb6 | 2018-05-31 12:26:10 +0200 | [diff] [blame] | 233 | if (!inode) { |
| 234 | dput(dentry); |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 235 | return NULL; |
Miklos Szeredi | 6becdb6 | 2018-05-31 12:26:10 +0200 | [diff] [blame] | 236 | } |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 237 | |
Christoph Hellwig | 85fe402 | 2010-10-23 11:19:54 -0400 | [diff] [blame] | 238 | inode->i_ino = get_next_ino(); |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 239 | inode->i_mode = mode; |
| 240 | inode->i_uid = fc->user_id; |
| 241 | inode->i_gid = fc->group_id; |
Deepa Dinamani | 078cd82 | 2016-09-14 07:48:04 -0700 | [diff] [blame] | 242 | inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 243 | /* setting ->i_op to NULL is not allowed */ |
| 244 | if (iop) |
| 245 | inode->i_op = iop; |
| 246 | inode->i_fop = fop; |
Miklos Szeredi | bfe8684 | 2011-10-28 14:13:29 +0200 | [diff] [blame] | 247 | set_nlink(inode, nlink); |
Theodore Ts'o | 8e18e29 | 2006-09-27 01:50:46 -0700 | [diff] [blame] | 248 | inode->i_private = fc; |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 249 | d_add(dentry, inode); |
Miklos Szeredi | 6becdb6 | 2018-05-31 12:26:10 +0200 | [diff] [blame] | 250 | |
| 251 | fc->ctl_dentry[fc->ctl_ndents++] = dentry; |
| 252 | |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 253 | return dentry; |
| 254 | } |
| 255 | |
| 256 | /* |
| 257 | * Add a connection to the control filesystem (if it exists). Caller |
Miklos Szeredi | 873302c | 2006-07-30 03:04:10 -0700 | [diff] [blame] | 258 | * must hold fuse_mutex |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 259 | */ |
| 260 | int fuse_ctl_add_conn(struct fuse_conn *fc) |
| 261 | { |
| 262 | struct dentry *parent; |
| 263 | char name[32]; |
| 264 | |
| 265 | if (!fuse_control_sb) |
| 266 | return 0; |
| 267 | |
| 268 | parent = fuse_control_sb->s_root; |
David Howells | 2b0143b | 2015-03-17 22:25:59 +0000 | [diff] [blame] | 269 | inc_nlink(d_inode(parent)); |
Miklos Szeredi | b6f2fcb | 2008-04-30 00:54:34 -0700 | [diff] [blame] | 270 | sprintf(name, "%u", fc->dev); |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 271 | parent = fuse_ctl_add_dentry(parent, fc, name, S_IFDIR | 0500, 2, |
| 272 | &simple_dir_inode_operations, |
| 273 | &simple_dir_operations); |
| 274 | if (!parent) |
| 275 | goto err; |
| 276 | |
| 277 | if (!fuse_ctl_add_dentry(parent, fc, "waiting", S_IFREG | 0400, 1, |
Csaba Henk | 79a9d99 | 2009-08-26 19:18:24 +0200 | [diff] [blame] | 278 | NULL, &fuse_ctl_waiting_ops) || |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 279 | !fuse_ctl_add_dentry(parent, fc, "abort", S_IFREG | 0200, 1, |
Csaba Henk | 79a9d99 | 2009-08-26 19:18:24 +0200 | [diff] [blame] | 280 | NULL, &fuse_ctl_abort_ops) || |
| 281 | !fuse_ctl_add_dentry(parent, fc, "max_background", S_IFREG | 0600, |
| 282 | 1, NULL, &fuse_conn_max_background_ops) || |
| 283 | !fuse_ctl_add_dentry(parent, fc, "congestion_threshold", |
| 284 | S_IFREG | 0600, 1, NULL, |
| 285 | &fuse_conn_congestion_threshold_ops)) |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 286 | goto err; |
| 287 | |
| 288 | return 0; |
| 289 | |
| 290 | err: |
| 291 | fuse_ctl_remove_conn(fc); |
| 292 | return -ENOMEM; |
| 293 | } |
| 294 | |
| 295 | /* |
| 296 | * Remove a connection from the control filesystem (if it exists). |
Miklos Szeredi | 873302c | 2006-07-30 03:04:10 -0700 | [diff] [blame] | 297 | * Caller must hold fuse_mutex |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 298 | */ |
| 299 | void fuse_ctl_remove_conn(struct fuse_conn *fc) |
| 300 | { |
| 301 | int i; |
| 302 | |
| 303 | if (!fuse_control_sb) |
| 304 | return; |
| 305 | |
| 306 | for (i = fc->ctl_ndents - 1; i >= 0; i--) { |
| 307 | struct dentry *dentry = fc->ctl_dentry[i]; |
David Howells | 2b0143b | 2015-03-17 22:25:59 +0000 | [diff] [blame] | 308 | d_inode(dentry)->i_private = NULL; |
Miklos Szeredi | 6becdb6 | 2018-05-31 12:26:10 +0200 | [diff] [blame] | 309 | if (!i) { |
| 310 | /* Get rid of submounts: */ |
| 311 | d_invalidate(dentry); |
| 312 | } |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 313 | dput(dentry); |
| 314 | } |
David Howells | 2b0143b | 2015-03-17 22:25:59 +0000 | [diff] [blame] | 315 | drop_nlink(d_inode(fuse_control_sb->s_root)); |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 316 | } |
| 317 | |
| 318 | static int fuse_ctl_fill_super(struct super_block *sb, void *data, int silent) |
| 319 | { |
Eric Biggers | cda3712 | 2017-03-25 21:15:37 -0700 | [diff] [blame] | 320 | static const struct tree_descr empty_descr = {""}; |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 321 | struct fuse_conn *fc; |
| 322 | int err; |
| 323 | |
| 324 | err = simple_fill_super(sb, FUSE_CTL_SUPER_MAGIC, &empty_descr); |
| 325 | if (err) |
| 326 | return err; |
| 327 | |
| 328 | mutex_lock(&fuse_mutex); |
| 329 | BUG_ON(fuse_control_sb); |
| 330 | fuse_control_sb = sb; |
| 331 | list_for_each_entry(fc, &fuse_conn_list, entry) { |
| 332 | err = fuse_ctl_add_conn(fc); |
| 333 | if (err) { |
| 334 | fuse_control_sb = NULL; |
| 335 | mutex_unlock(&fuse_mutex); |
| 336 | return err; |
| 337 | } |
| 338 | } |
| 339 | mutex_unlock(&fuse_mutex); |
| 340 | |
| 341 | return 0; |
| 342 | } |
| 343 | |
Al Viro | fc14f2f | 2010-07-25 01:48:30 +0400 | [diff] [blame] | 344 | static struct dentry *fuse_ctl_mount(struct file_system_type *fs_type, |
| 345 | int flags, const char *dev_name, void *raw_data) |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 346 | { |
Al Viro | fc14f2f | 2010-07-25 01:48:30 +0400 | [diff] [blame] | 347 | return mount_single(fs_type, flags, raw_data, fuse_ctl_fill_super); |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 348 | } |
| 349 | |
| 350 | static void fuse_ctl_kill_sb(struct super_block *sb) |
| 351 | { |
Miklos Szeredi | ff79544 | 2007-01-29 13:19:54 -0800 | [diff] [blame] | 352 | struct fuse_conn *fc; |
| 353 | |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 354 | mutex_lock(&fuse_mutex); |
| 355 | fuse_control_sb = NULL; |
Miklos Szeredi | ff79544 | 2007-01-29 13:19:54 -0800 | [diff] [blame] | 356 | list_for_each_entry(fc, &fuse_conn_list, entry) |
| 357 | fc->ctl_ndents = 0; |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 358 | mutex_unlock(&fuse_mutex); |
| 359 | |
| 360 | kill_litter_super(sb); |
| 361 | } |
| 362 | |
| 363 | static struct file_system_type fuse_ctl_fs_type = { |
| 364 | .owner = THIS_MODULE, |
| 365 | .name = "fusectl", |
Al Viro | fc14f2f | 2010-07-25 01:48:30 +0400 | [diff] [blame] | 366 | .mount = fuse_ctl_mount, |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 367 | .kill_sb = fuse_ctl_kill_sb, |
| 368 | }; |
Eric W. Biederman | 7f78e03 | 2013-03-02 19:39:14 -0800 | [diff] [blame] | 369 | MODULE_ALIAS_FS("fusectl"); |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 370 | |
| 371 | int __init fuse_ctl_init(void) |
| 372 | { |
| 373 | return register_filesystem(&fuse_ctl_fs_type); |
| 374 | } |
| 375 | |
Fabian Frederick | 7736e8c | 2014-04-23 18:14:42 +0200 | [diff] [blame] | 376 | void __exit fuse_ctl_cleanup(void) |
Miklos Szeredi | bafa965 | 2006-06-25 05:48:51 -0700 | [diff] [blame] | 377 | { |
| 378 | unregister_filesystem(&fuse_ctl_fs_type); |
| 379 | } |