34 #include <linux/module.h>
40 #include <linux/slab.h>
44 #define IPATHFS_MAGIC 0x726a77
89 error = ipathfs_mknod(parent->
d_inode, *dentry,
92 error = PTR_ERR(*dentry);
99 size_t count, loff_t *ppos)
106 .read = atomic_stats_read,
111 size_t count, loff_t *ppos)
116 dd = file->
f_path.dentry->d_inode->i_private;
124 .read = atomic_counters_read,
128 static ssize_t flash_read(
struct file *file,
char __user *buf,
129 size_t count, loff_t *ppos)
157 dd = file->
f_path.dentry->d_inode->i_private;
180 size_t count, loff_t *ppos)
210 dd = file->
f_path.dentry->d_inode->i_private;
249 &atomic_counters_ops, dd);
252 "failed: %d\n", unit, ret);
260 "failed: %d\n", unit, ret);
268 static int remove_file(
struct dentry *parent,
char *name)
281 if (!(d_unhashed(tmp) && tmp->
d_inode)) {
284 spin_unlock(&tmp->
d_lock);
287 spin_unlock(&tmp->
d_lock);
298 static int remove_device_files(
struct super_block *sb,
301 struct dentry *dir, *
root;
316 remove_file(dir,
"flash");
317 remove_file(dir,
"atomic_counters");
327 static int ipathfs_fill_super(
struct super_block *sb,
void *data,
335 [2] = {
"atomic_stats", &atomic_stats_ops,
S_IRUGO},
348 spin_unlock_irqrestore(&ipath_devs_lock, flags);
349 ret = create_device_files(sb, dd);
355 spin_unlock_irqrestore(&ipath_devs_lock, flags);
362 int flags,
const char *dev_name,
void *data)
365 ret =
mount_single(fs_type, flags, data, ipathfs_fill_super);
367 ipath_super = ret->
d_sb;
381 if (ipath_super ==
NULL) {
386 ret = create_device_files(ipath_super, dd);
396 if (ipath_super ==
NULL) {
401 ret = remove_device_files(ipath_super, dd);
410 .mount = ipathfs_mount,
411 .kill_sb = ipathfs_kill_super,