Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 1 | /* |
John Gregor | 87427da | 2007-06-11 10:21:14 -0700 | [diff] [blame] | 2 | * Copyright (c) 2006, 2007 QLogic Corporation. All rights reserved. |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 3 | * Copyright (c) 2006 PathScale, Inc. All rights reserved. |
| 4 | * |
| 5 | * This software is available to you under a choice of one of two |
| 6 | * licenses. You may choose to be licensed under the terms of the GNU |
| 7 | * General Public License (GPL) Version 2, available from the file |
| 8 | * COPYING in the main directory of this source tree, or the |
| 9 | * OpenIB.org BSD license below: |
| 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or |
| 12 | * without modification, are permitted provided that the following |
| 13 | * conditions are met: |
| 14 | * |
| 15 | * - Redistributions of source code must retain the above |
| 16 | * copyright notice, this list of conditions and the following |
| 17 | * disclaimer. |
| 18 | * |
| 19 | * - Redistributions in binary form must reproduce the above |
| 20 | * copyright notice, this list of conditions and the following |
| 21 | * disclaimer in the documentation and/or other materials |
| 22 | * provided with the distribution. |
| 23 | * |
| 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 31 | * SOFTWARE. |
| 32 | */ |
| 33 | |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 34 | #include <linux/module.h> |
| 35 | #include <linux/fs.h> |
| 36 | #include <linux/mount.h> |
| 37 | #include <linux/pagemap.h> |
| 38 | #include <linux/init.h> |
| 39 | #include <linux/namei.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 40 | #include <linux/slab.h> |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 41 | |
| 42 | #include "ipath_kernel.h" |
| 43 | |
| 44 | #define IPATHFS_MAGIC 0x726a77 |
| 45 | |
| 46 | static struct super_block *ipath_super; |
| 47 | |
| 48 | static int ipathfs_mknod(struct inode *dir, struct dentry *dentry, |
Arjan van de Ven | 2b8693c | 2007-02-12 00:55:32 -0800 | [diff] [blame] | 49 | int mode, const struct file_operations *fops, |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 50 | void *data) |
| 51 | { |
| 52 | int error; |
| 53 | struct inode *inode = new_inode(dir->i_sb); |
| 54 | |
| 55 | if (!inode) { |
| 56 | error = -EPERM; |
| 57 | goto bail; |
| 58 | } |
| 59 | |
Christoph Hellwig | 85fe402 | 2010-10-23 11:19:54 -0400 | [diff] [blame] | 60 | inode->i_ino = get_next_ino(); |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 61 | inode->i_mode = mode; |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 62 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
Theodore Ts'o | 8e18e29 | 2006-09-27 01:50:46 -0700 | [diff] [blame] | 63 | inode->i_private = data; |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 64 | if ((mode & S_IFMT) == S_IFDIR) { |
| 65 | inode->i_op = &simple_dir_inode_operations; |
Dave Hansen | d8c76e6 | 2006-09-30 23:29:04 -0700 | [diff] [blame] | 66 | inc_nlink(inode); |
| 67 | inc_nlink(dir); |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | inode->i_fop = fops; |
| 71 | |
| 72 | d_instantiate(dentry, inode); |
| 73 | error = 0; |
| 74 | |
| 75 | bail: |
| 76 | return error; |
| 77 | } |
| 78 | |
| 79 | static int create_file(const char *name, mode_t mode, |
| 80 | struct dentry *parent, struct dentry **dentry, |
Arjan van de Ven | 2b8693c | 2007-02-12 00:55:32 -0800 | [diff] [blame] | 81 | const struct file_operations *fops, void *data) |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 82 | { |
| 83 | int error; |
| 84 | |
| 85 | *dentry = NULL; |
| 86 | mutex_lock(&parent->d_inode->i_mutex); |
| 87 | *dentry = lookup_one_len(name, parent, strlen(name)); |
Michael Ellerman | 64f22fa | 2008-12-01 20:59:07 -0800 | [diff] [blame] | 88 | if (!IS_ERR(*dentry)) |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 89 | error = ipathfs_mknod(parent->d_inode, *dentry, |
| 90 | mode, fops, data); |
| 91 | else |
| 92 | error = PTR_ERR(dentry); |
| 93 | mutex_unlock(&parent->d_inode->i_mutex); |
| 94 | |
| 95 | return error; |
| 96 | } |
| 97 | |
| 98 | static ssize_t atomic_stats_read(struct file *file, char __user *buf, |
| 99 | size_t count, loff_t *ppos) |
| 100 | { |
| 101 | return simple_read_from_buffer(buf, count, ppos, &ipath_stats, |
| 102 | sizeof ipath_stats); |
| 103 | } |
| 104 | |
Arjan van de Ven | 2b8693c | 2007-02-12 00:55:32 -0800 | [diff] [blame] | 105 | static const struct file_operations atomic_stats_ops = { |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 106 | .read = atomic_stats_read, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 107 | .llseek = default_llseek, |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 108 | }; |
| 109 | |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 110 | static ssize_t atomic_counters_read(struct file *file, char __user *buf, |
| 111 | size_t count, loff_t *ppos) |
| 112 | { |
Ralph Campbell | 3029fcc | 2008-01-06 21:02:34 -0800 | [diff] [blame] | 113 | struct infinipath_counters counters; |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 114 | struct ipath_devdata *dd; |
| 115 | |
Josef Sipek | 1cfd6e6 | 2006-12-08 02:37:10 -0800 | [diff] [blame] | 116 | dd = file->f_path.dentry->d_inode->i_private; |
Ralph Campbell | 3029fcc | 2008-01-06 21:02:34 -0800 | [diff] [blame] | 117 | dd->ipath_f_read_counters(dd, &counters); |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 118 | |
Ralph Campbell | 3029fcc | 2008-01-06 21:02:34 -0800 | [diff] [blame] | 119 | return simple_read_from_buffer(buf, count, ppos, &counters, |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 120 | sizeof counters); |
| 121 | } |
| 122 | |
Arjan van de Ven | 2b8693c | 2007-02-12 00:55:32 -0800 | [diff] [blame] | 123 | static const struct file_operations atomic_counters_ops = { |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 124 | .read = atomic_counters_read, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 125 | .llseek = default_llseek, |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 126 | }; |
| 127 | |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 128 | static ssize_t flash_read(struct file *file, char __user *buf, |
| 129 | size_t count, loff_t *ppos) |
| 130 | { |
| 131 | struct ipath_devdata *dd; |
| 132 | ssize_t ret; |
| 133 | loff_t pos; |
| 134 | char *tmp; |
| 135 | |
| 136 | pos = *ppos; |
| 137 | |
| 138 | if ( pos < 0) { |
| 139 | ret = -EINVAL; |
| 140 | goto bail; |
| 141 | } |
| 142 | |
| 143 | if (pos >= sizeof(struct ipath_flash)) { |
| 144 | ret = 0; |
| 145 | goto bail; |
| 146 | } |
| 147 | |
| 148 | if (count > sizeof(struct ipath_flash) - pos) |
| 149 | count = sizeof(struct ipath_flash) - pos; |
| 150 | |
| 151 | tmp = kmalloc(count, GFP_KERNEL); |
| 152 | if (!tmp) { |
| 153 | ret = -ENOMEM; |
| 154 | goto bail; |
| 155 | } |
| 156 | |
Josef Sipek | 1cfd6e6 | 2006-12-08 02:37:10 -0800 | [diff] [blame] | 157 | dd = file->f_path.dentry->d_inode->i_private; |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 158 | if (ipath_eeprom_read(dd, pos, tmp, count)) { |
| 159 | ipath_dev_err(dd, "failed to read from flash\n"); |
| 160 | ret = -ENXIO; |
| 161 | goto bail_tmp; |
| 162 | } |
| 163 | |
| 164 | if (copy_to_user(buf, tmp, count)) { |
| 165 | ret = -EFAULT; |
| 166 | goto bail_tmp; |
| 167 | } |
| 168 | |
| 169 | *ppos = pos + count; |
| 170 | ret = count; |
| 171 | |
| 172 | bail_tmp: |
| 173 | kfree(tmp); |
| 174 | |
| 175 | bail: |
| 176 | return ret; |
| 177 | } |
| 178 | |
| 179 | static ssize_t flash_write(struct file *file, const char __user *buf, |
| 180 | size_t count, loff_t *ppos) |
| 181 | { |
| 182 | struct ipath_devdata *dd; |
| 183 | ssize_t ret; |
| 184 | loff_t pos; |
| 185 | char *tmp; |
| 186 | |
| 187 | pos = *ppos; |
| 188 | |
Bryan O'Sullivan | 7dae5bf | 2006-09-28 09:00:05 -0700 | [diff] [blame] | 189 | if (pos != 0) { |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 190 | ret = -EINVAL; |
| 191 | goto bail; |
| 192 | } |
| 193 | |
Bryan O'Sullivan | 7dae5bf | 2006-09-28 09:00:05 -0700 | [diff] [blame] | 194 | if (count != sizeof(struct ipath_flash)) { |
| 195 | ret = -EINVAL; |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 196 | goto bail; |
| 197 | } |
| 198 | |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 199 | tmp = kmalloc(count, GFP_KERNEL); |
| 200 | if (!tmp) { |
| 201 | ret = -ENOMEM; |
| 202 | goto bail; |
| 203 | } |
| 204 | |
| 205 | if (copy_from_user(tmp, buf, count)) { |
| 206 | ret = -EFAULT; |
| 207 | goto bail_tmp; |
| 208 | } |
| 209 | |
Josef Sipek | 1cfd6e6 | 2006-12-08 02:37:10 -0800 | [diff] [blame] | 210 | dd = file->f_path.dentry->d_inode->i_private; |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 211 | if (ipath_eeprom_write(dd, pos, tmp, count)) { |
| 212 | ret = -ENXIO; |
| 213 | ipath_dev_err(dd, "failed to write to flash\n"); |
| 214 | goto bail_tmp; |
| 215 | } |
| 216 | |
| 217 | *ppos = pos + count; |
| 218 | ret = count; |
| 219 | |
| 220 | bail_tmp: |
| 221 | kfree(tmp); |
| 222 | |
| 223 | bail: |
| 224 | return ret; |
| 225 | } |
| 226 | |
Arjan van de Ven | 2b8693c | 2007-02-12 00:55:32 -0800 | [diff] [blame] | 227 | static const struct file_operations flash_ops = { |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 228 | .read = flash_read, |
| 229 | .write = flash_write, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 230 | .llseek = default_llseek, |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 231 | }; |
| 232 | |
| 233 | static int create_device_files(struct super_block *sb, |
| 234 | struct ipath_devdata *dd) |
| 235 | { |
| 236 | struct dentry *dir, *tmp; |
| 237 | char unit[10]; |
| 238 | int ret; |
| 239 | |
| 240 | snprintf(unit, sizeof unit, "%02d", dd->ipath_unit); |
| 241 | ret = create_file(unit, S_IFDIR|S_IRUGO|S_IXUGO, sb->s_root, &dir, |
Jan Engelhardt | f7fca1e | 2008-01-22 20:45:30 +0100 | [diff] [blame] | 242 | &simple_dir_operations, dd); |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 243 | if (ret) { |
| 244 | printk(KERN_ERR "create_file(%s) failed: %d\n", unit, ret); |
| 245 | goto bail; |
| 246 | } |
| 247 | |
| 248 | ret = create_file("atomic_counters", S_IFREG|S_IRUGO, dir, &tmp, |
| 249 | &atomic_counters_ops, dd); |
| 250 | if (ret) { |
| 251 | printk(KERN_ERR "create_file(%s/atomic_counters) " |
| 252 | "failed: %d\n", unit, ret); |
| 253 | goto bail; |
| 254 | } |
| 255 | |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 256 | ret = create_file("flash", S_IFREG|S_IWUSR|S_IRUGO, dir, &tmp, |
| 257 | &flash_ops, dd); |
| 258 | if (ret) { |
| 259 | printk(KERN_ERR "create_file(%s/flash) " |
| 260 | "failed: %d\n", unit, ret); |
| 261 | goto bail; |
| 262 | } |
| 263 | |
| 264 | bail: |
| 265 | return ret; |
| 266 | } |
| 267 | |
Bryan O'Sullivan | fae8773 | 2007-03-21 15:18:14 -0700 | [diff] [blame] | 268 | static int remove_file(struct dentry *parent, char *name) |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 269 | { |
| 270 | struct dentry *tmp; |
Bryan O'Sullivan | fae8773 | 2007-03-21 15:18:14 -0700 | [diff] [blame] | 271 | int ret; |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 272 | |
| 273 | tmp = lookup_one_len(name, parent, strlen(name)); |
| 274 | |
Bryan O'Sullivan | fae8773 | 2007-03-21 15:18:14 -0700 | [diff] [blame] | 275 | if (IS_ERR(tmp)) { |
| 276 | ret = PTR_ERR(tmp); |
| 277 | goto bail; |
| 278 | } |
| 279 | |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 280 | spin_lock(&tmp->d_lock); |
| 281 | if (!(d_unhashed(tmp) && tmp->d_inode)) { |
Nick Piggin | dc0474b | 2011-01-07 17:49:43 +1100 | [diff] [blame] | 282 | dget_dlock(tmp); |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 283 | __d_drop(tmp); |
| 284 | spin_unlock(&tmp->d_lock); |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 285 | simple_unlink(parent->d_inode, tmp); |
Nick Piggin | b5c84bf | 2011-01-07 17:49:38 +1100 | [diff] [blame] | 286 | } else |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 287 | spin_unlock(&tmp->d_lock); |
Bryan O'Sullivan | fae8773 | 2007-03-21 15:18:14 -0700 | [diff] [blame] | 288 | |
| 289 | ret = 0; |
| 290 | bail: |
| 291 | /* |
| 292 | * We don't expect clients to care about the return value, but |
| 293 | * it's there if they need it. |
| 294 | */ |
| 295 | return ret; |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 296 | } |
| 297 | |
| 298 | static int remove_device_files(struct super_block *sb, |
| 299 | struct ipath_devdata *dd) |
| 300 | { |
| 301 | struct dentry *dir, *root; |
| 302 | char unit[10]; |
| 303 | int ret; |
| 304 | |
| 305 | root = dget(sb->s_root); |
| 306 | mutex_lock(&root->d_inode->i_mutex); |
| 307 | snprintf(unit, sizeof unit, "%02d", dd->ipath_unit); |
| 308 | dir = lookup_one_len(unit, root, strlen(unit)); |
| 309 | |
| 310 | if (IS_ERR(dir)) { |
| 311 | ret = PTR_ERR(dir); |
| 312 | printk(KERN_ERR "Lookup of %s failed\n", unit); |
| 313 | goto bail; |
| 314 | } |
| 315 | |
| 316 | remove_file(dir, "flash"); |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 317 | remove_file(dir, "atomic_counters"); |
| 318 | d_delete(dir); |
| 319 | ret = simple_rmdir(root->d_inode, dir); |
| 320 | |
| 321 | bail: |
| 322 | mutex_unlock(&root->d_inode->i_mutex); |
| 323 | dput(root); |
| 324 | return ret; |
| 325 | } |
| 326 | |
| 327 | static int ipathfs_fill_super(struct super_block *sb, void *data, |
| 328 | int silent) |
| 329 | { |
| 330 | struct ipath_devdata *dd, *tmp; |
| 331 | unsigned long flags; |
| 332 | int ret; |
| 333 | |
| 334 | static struct tree_descr files[] = { |
Jeff Layton | 1a1c9bb | 2007-05-08 00:32:31 -0700 | [diff] [blame] | 335 | [2] = {"atomic_stats", &atomic_stats_ops, S_IRUGO}, |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 336 | {""}, |
| 337 | }; |
| 338 | |
| 339 | ret = simple_fill_super(sb, IPATHFS_MAGIC, files); |
| 340 | if (ret) { |
| 341 | printk(KERN_ERR "simple_fill_super failed: %d\n", ret); |
| 342 | goto bail; |
| 343 | } |
| 344 | |
| 345 | spin_lock_irqsave(&ipath_devs_lock, flags); |
| 346 | |
| 347 | list_for_each_entry_safe(dd, tmp, &ipath_dev_list, ipath_list) { |
| 348 | spin_unlock_irqrestore(&ipath_devs_lock, flags); |
| 349 | ret = create_device_files(sb, dd); |
Al Viro | 12e9a45 | 2010-01-25 18:44:58 -0500 | [diff] [blame] | 350 | if (ret) |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 351 | goto bail; |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 352 | spin_lock_irqsave(&ipath_devs_lock, flags); |
| 353 | } |
| 354 | |
| 355 | spin_unlock_irqrestore(&ipath_devs_lock, flags); |
| 356 | |
| 357 | bail: |
| 358 | return ret; |
| 359 | } |
| 360 | |
Al Viro | fc14f2f | 2010-07-25 01:48:30 +0400 | [diff] [blame] | 361 | static struct dentry *ipathfs_mount(struct file_system_type *fs_type, |
| 362 | int flags, const char *dev_name, void *data) |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 363 | { |
Al Viro | fc14f2f | 2010-07-25 01:48:30 +0400 | [diff] [blame] | 364 | struct dentry *ret; |
| 365 | ret = mount_single(fs_type, flags, data, ipathfs_fill_super); |
| 366 | if (!IS_ERR(ret)) |
| 367 | ipath_super = ret->d_sb; |
David Howells | 454e239 | 2006-06-23 02:02:57 -0700 | [diff] [blame] | 368 | return ret; |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 369 | } |
| 370 | |
| 371 | static void ipathfs_kill_super(struct super_block *s) |
| 372 | { |
| 373 | kill_litter_super(s); |
| 374 | ipath_super = NULL; |
| 375 | } |
| 376 | |
| 377 | int ipathfs_add_device(struct ipath_devdata *dd) |
| 378 | { |
| 379 | int ret; |
| 380 | |
| 381 | if (ipath_super == NULL) { |
| 382 | ret = 0; |
| 383 | goto bail; |
| 384 | } |
| 385 | |
| 386 | ret = create_device_files(ipath_super, dd); |
| 387 | |
| 388 | bail: |
| 389 | return ret; |
| 390 | } |
| 391 | |
| 392 | int ipathfs_remove_device(struct ipath_devdata *dd) |
| 393 | { |
| 394 | int ret; |
| 395 | |
| 396 | if (ipath_super == NULL) { |
| 397 | ret = 0; |
| 398 | goto bail; |
| 399 | } |
| 400 | |
| 401 | ret = remove_device_files(ipath_super, dd); |
| 402 | |
| 403 | bail: |
| 404 | return ret; |
| 405 | } |
| 406 | |
| 407 | static struct file_system_type ipathfs_fs_type = { |
| 408 | .owner = THIS_MODULE, |
| 409 | .name = "ipathfs", |
Al Viro | fc14f2f | 2010-07-25 01:48:30 +0400 | [diff] [blame] | 410 | .mount = ipathfs_mount, |
Bryan O'Sullivan | 3e9b4a5 | 2006-03-29 15:23:30 -0800 | [diff] [blame] | 411 | .kill_sb = ipathfs_kill_super, |
| 412 | }; |
| 413 | |
| 414 | int __init ipath_init_ipathfs(void) |
| 415 | { |
| 416 | return register_filesystem(&ipathfs_fs_type); |
| 417 | } |
| 418 | |
| 419 | void __exit ipath_exit_ipathfs(void) |
| 420 | { |
| 421 | unregister_filesystem(&ipathfs_fs_type); |
| 422 | } |