14 #include <linux/module.h>
18 #include <asm/uaccess.h>
22 #define OPROFILEFS_MAGIC 0x6f70726f
121 .read = ulong_read_file,
122 .write = ulong_write_file,
129 .read = ulong_read_file,
135 static int __oprofilefs_create_file(
struct super_block *sb,
145 inode = oprofilefs_get_inode(sb,
S_IFREG | perm);
151 d_add(dentry, inode);
158 char const *name,
unsigned long *
val)
160 return __oprofilefs_create_file(sb, root, name,
161 &ulong_fops, 0644, val);
166 char const *name,
unsigned long *
val)
168 return __oprofilefs_create_file(sb, root, name,
169 &ulong_ro_fops, 0444, val);
173 static ssize_t atomic_read_file(
struct file *file,
char __user *buf,
size_t count, loff_t *offset)
181 .read = atomic_read_file,
190 return __oprofilefs_create_file(sb, root, name,
191 &atomic_ro_fops, 0444, val);
198 return __oprofilefs_create_file(sb, root, name, fops, 0644,
NULL);
205 return __oprofilefs_create_file(sb, root, name, fops, perm,
NULL);
210 struct dentry *root,
char const *name)
212 struct dentry *dentry;
218 inode = oprofilefs_get_inode(sb,
S_IFDIR | 0755);
225 d_add(dentry, inode);
230 static int oprofilefs_fill_super(
struct super_block *sb,
void *
data,
int silent)
232 struct inode *root_inode;
240 root_inode = oprofilefs_get_inode(sb,
S_IFDIR | 0755);
257 int flags,
const char *dev_name,
void *data)
259 return mount_single(fs_type, flags, data, oprofilefs_fill_super);
265 .name =
"oprofilefs",
266 .mount = oprofilefs_mount,