aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/oprofile/oprofilefs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/oprofile/oprofilefs.c')
-rw-r--r--drivers/oprofile/oprofilefs.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index 8543cb26cf34..ddc4c59f02dc 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -23,9 +23,9 @@
23 23
24DEFINE_SPINLOCK(oprofilefs_lock); 24DEFINE_SPINLOCK(oprofilefs_lock);
25 25
26static struct inode * oprofilefs_get_inode(struct super_block * sb, int mode) 26static struct inode *oprofilefs_get_inode(struct super_block *sb, int mode)
27{ 27{
28 struct inode * inode = new_inode(sb); 28 struct inode *inode = new_inode(sb);
29 29
30 if (inode) { 30 if (inode) {
31 inode->i_mode = mode; 31 inode->i_mode = mode;
@@ -44,7 +44,7 @@ static struct super_operations s_ops = {
44}; 44};
45 45
46 46
47ssize_t oprofilefs_str_to_user(char const * str, char __user * buf, size_t count, loff_t * offset) 47ssize_t oprofilefs_str_to_user(char const *str, char __user *buf, size_t count, loff_t *offset)
48{ 48{
49 return simple_read_from_buffer(buf, count, offset, str, strlen(str)); 49 return simple_read_from_buffer(buf, count, offset, str, strlen(str));
50} 50}
@@ -52,7 +52,7 @@ ssize_t oprofilefs_str_to_user(char const * str, char __user * buf, size_t count
52 52
53#define TMPBUFSIZE 50 53#define TMPBUFSIZE 50
54 54
55ssize_t oprofilefs_ulong_to_user(unsigned long val, char __user * buf, size_t count, loff_t * offset) 55ssize_t oprofilefs_ulong_to_user(unsigned long val, char __user *buf, size_t count, loff_t *offset)
56{ 56{
57 char tmpbuf[TMPBUFSIZE]; 57 char tmpbuf[TMPBUFSIZE];
58 size_t maxlen = snprintf(tmpbuf, TMPBUFSIZE, "%lu\n", val); 58 size_t maxlen = snprintf(tmpbuf, TMPBUFSIZE, "%lu\n", val);
@@ -62,7 +62,7 @@ ssize_t oprofilefs_ulong_to_user(unsigned long val, char __user * buf, size_t co
62} 62}
63 63
64 64
65int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, size_t count) 65int oprofilefs_ulong_from_user(unsigned long *val, char const __user *buf, size_t count)
66{ 66{
67 char tmpbuf[TMPBUFSIZE]; 67 char tmpbuf[TMPBUFSIZE];
68 unsigned long flags; 68 unsigned long flags;
@@ -85,16 +85,16 @@ int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, siz
85} 85}
86 86
87 87
88static ssize_t ulong_read_file(struct file * file, char __user * buf, size_t count, loff_t * offset) 88static ssize_t ulong_read_file(struct file *file, char __user *buf, size_t count, loff_t *offset)
89{ 89{
90 unsigned long * val = file->private_data; 90 unsigned long *val = file->private_data;
91 return oprofilefs_ulong_to_user(*val, buf, count, offset); 91 return oprofilefs_ulong_to_user(*val, buf, count, offset);
92} 92}
93 93
94 94
95static ssize_t ulong_write_file(struct file * file, char const __user * buf, size_t count, loff_t * offset) 95static ssize_t ulong_write_file(struct file *file, char const __user *buf, size_t count, loff_t *offset)
96{ 96{
97 unsigned long * value = file->private_data; 97 unsigned long *value = file->private_data;
98 int retval; 98 int retval;
99 99
100 if (*offset) 100 if (*offset)
@@ -108,7 +108,7 @@ static ssize_t ulong_write_file(struct file * file, char const __user * buf, siz
108} 108}
109 109
110 110
111static int default_open(struct inode * inode, struct file * filp) 111static int default_open(struct inode *inode, struct file *filp)
112{ 112{
113 if (inode->i_private) 113 if (inode->i_private)
114 filp->private_data = inode->i_private; 114 filp->private_data = inode->i_private;
@@ -129,12 +129,12 @@ static const struct file_operations ulong_ro_fops = {
129}; 129};
130 130
131 131
132static struct dentry * __oprofilefs_create_file(struct super_block * sb, 132static struct dentry *__oprofilefs_create_file(struct super_block *sb,
133 struct dentry * root, char const * name, const struct file_operations * fops, 133 struct dentry *root, char const *name, const struct file_operations *fops,
134 int perm) 134 int perm)
135{ 135{
136 struct dentry * dentry; 136 struct dentry *dentry;
137 struct inode * inode; 137 struct inode *inode;
138 138
139 dentry = d_alloc_name(root, name); 139 dentry = d_alloc_name(root, name);
140 if (!dentry) 140 if (!dentry)
@@ -150,10 +150,10 @@ static struct dentry * __oprofilefs_create_file(struct super_block * sb,
150} 150}
151 151
152 152
153int oprofilefs_create_ulong(struct super_block * sb, struct dentry * root, 153int oprofilefs_create_ulong(struct super_block *sb, struct dentry *root,
154 char const * name, unsigned long * val) 154 char const *name, unsigned long *val)
155{ 155{
156 struct dentry * d = __oprofilefs_create_file(sb, root, name, 156 struct dentry *d = __oprofilefs_create_file(sb, root, name,
157 &ulong_fops, 0644); 157 &ulong_fops, 0644);
158 if (!d) 158 if (!d)
159 return -EFAULT; 159 return -EFAULT;
@@ -163,10 +163,10 @@ int oprofilefs_create_ulong(struct super_block * sb, struct dentry * root,
163} 163}
164 164
165 165
166int oprofilefs_create_ro_ulong(struct super_block * sb, struct dentry * root, 166int oprofilefs_create_ro_ulong(struct super_block *sb, struct dentry *root,
167 char const * name, unsigned long * val) 167 char const *name, unsigned long *val)
168{ 168{
169 struct dentry * d = __oprofilefs_create_file(sb, root, name, 169 struct dentry *d = __oprofilefs_create_file(sb, root, name,
170 &ulong_ro_fops, 0444); 170 &ulong_ro_fops, 0444);
171 if (!d) 171 if (!d)
172 return -EFAULT; 172 return -EFAULT;
@@ -176,23 +176,23 @@ int oprofilefs_create_ro_ulong(struct super_block * sb, struct dentry * root,
176} 176}
177 177
178 178
179static ssize_t atomic_read_file(struct file * file, char __user * buf, size_t count, loff_t * offset) 179static ssize_t atomic_read_file(struct file *file, char __user *buf, size_t count, loff_t *offset)
180{ 180{
181 atomic_t * val = file->private_data; 181 atomic_t *val = file->private_data;
182 return oprofilefs_ulong_to_user(atomic_read(val), buf, count, offset); 182 return oprofilefs_ulong_to_user(atomic_read(val), buf, count, offset);
183} 183}
184 184
185 185
186static const struct file_operations atomic_ro_fops = { 186static const struct file_operations atomic_ro_fops = {
187 .read = atomic_read_file, 187 .read = atomic_read_file,
188 .open = default_open, 188 .open = default_open,
189}; 189};
190
191 190
192int oprofilefs_create_ro_atomic(struct super_block * sb, struct dentry * root, 191
193 char const * name, atomic_t * val) 192int oprofilefs_create_ro_atomic(struct super_block *sb, struct dentry *root,
193 char const *name, atomic_t *val)
194{ 194{
195 struct dentry * d = __oprofilefs_create_file(sb, root, name, 195 struct dentry *d = __oprofilefs_create_file(sb, root, name,
196 &atomic_ro_fops, 0444); 196 &atomic_ro_fops, 0444);
197 if (!d) 197 if (!d)
198 return -EFAULT; 198 return -EFAULT;
@@ -201,9 +201,9 @@ int oprofilefs_create_ro_atomic(struct super_block * sb, struct dentry * root,
201 return 0; 201 return 0;
202} 202}
203 203
204 204
205int oprofilefs_create_file(struct super_block * sb, struct dentry * root, 205int oprofilefs_create_file(struct super_block *sb, struct dentry *root,
206 char const * name, const struct file_operations * fops) 206 char const *name, const struct file_operations *fops)
207{ 207{
208 if (!__oprofilefs_create_file(sb, root, name, fops, 0644)) 208 if (!__oprofilefs_create_file(sb, root, name, fops, 0644))
209 return -EFAULT; 209 return -EFAULT;
@@ -211,8 +211,8 @@ int oprofilefs_create_file(struct super_block * sb, struct dentry * root,
211} 211}
212 212
213 213
214int oprofilefs_create_file_perm(struct super_block * sb, struct dentry * root, 214int oprofilefs_create_file_perm(struct super_block *sb, struct dentry *root,
215 char const * name, const struct file_operations * fops, int perm) 215 char const *name, const struct file_operations *fops, int perm)
216{ 216{
217 if (!__oprofilefs_create_file(sb, root, name, fops, perm)) 217 if (!__oprofilefs_create_file(sb, root, name, fops, perm))
218 return -EFAULT; 218 return -EFAULT;
@@ -220,11 +220,11 @@ int oprofilefs_create_file_perm(struct super_block * sb, struct dentry * root,
220} 220}
221 221
222 222
223struct dentry * oprofilefs_mkdir(struct super_block * sb, 223struct dentry *oprofilefs_mkdir(struct super_block *sb,
224 struct dentry * root, char const * name) 224 struct dentry *root, char const *name)
225{ 225{
226 struct dentry * dentry; 226 struct dentry *dentry;
227 struct inode * inode; 227 struct inode *inode;
228 228
229 dentry = d_alloc_name(root, name); 229 dentry = d_alloc_name(root, name);
230 if (!dentry) 230 if (!dentry)
@@ -241,10 +241,10 @@ struct dentry * oprofilefs_mkdir(struct super_block * sb,
241} 241}
242 242
243 243
244static int oprofilefs_fill_super(struct super_block * sb, void * data, int silent) 244static int oprofilefs_fill_super(struct super_block *sb, void *data, int silent)
245{ 245{
246 struct inode * root_inode; 246 struct inode *root_inode;
247 struct dentry * root_dentry; 247 struct dentry *root_dentry;
248 248
249 sb->s_blocksize = PAGE_CACHE_SIZE; 249 sb->s_blocksize = PAGE_CACHE_SIZE;
250 sb->s_blocksize_bits = PAGE_CACHE_SHIFT; 250 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;