diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2009-10-01 18:43:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-01 19:11:11 -0400 |
commit | 828c09509b9695271bcbdc53e9fc9a6a737148d2 (patch) | |
tree | 072ffad6f02db7bf4095e07e2b90247cfa042998 /drivers/scsi/sg.c | |
parent | 1c4115e595dec42aa0e81ba47ef46e35b34ed428 (diff) |
const: constify remaining file_operations
[akpm@linux-foundation.org: fix KVM]
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r-- | drivers/scsi/sg.c | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 0cb049f5cc56..747a5e5c1276 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -1317,7 +1317,7 @@ static void sg_rq_end_io(struct request *rq, int uptodate) | |||
1317 | } | 1317 | } |
1318 | } | 1318 | } |
1319 | 1319 | ||
1320 | static struct file_operations sg_fops = { | 1320 | static const struct file_operations sg_fops = { |
1321 | .owner = THIS_MODULE, | 1321 | .owner = THIS_MODULE, |
1322 | .read = sg_read, | 1322 | .read = sg_read, |
1323 | .write = sg_write, | 1323 | .write = sg_write, |
@@ -2194,9 +2194,11 @@ static int sg_proc_seq_show_int(struct seq_file *s, void *v); | |||
2194 | static int sg_proc_single_open_adio(struct inode *inode, struct file *file); | 2194 | static int sg_proc_single_open_adio(struct inode *inode, struct file *file); |
2195 | static ssize_t sg_proc_write_adio(struct file *filp, const char __user *buffer, | 2195 | static ssize_t sg_proc_write_adio(struct file *filp, const char __user *buffer, |
2196 | size_t count, loff_t *off); | 2196 | size_t count, loff_t *off); |
2197 | static struct file_operations adio_fops = { | 2197 | static const struct file_operations adio_fops = { |
2198 | /* .owner, .read and .llseek added in sg_proc_init() */ | 2198 | .owner = THIS_MODULE, |
2199 | .open = sg_proc_single_open_adio, | 2199 | .open = sg_proc_single_open_adio, |
2200 | .read = seq_read, | ||
2201 | .llseek = seq_lseek, | ||
2200 | .write = sg_proc_write_adio, | 2202 | .write = sg_proc_write_adio, |
2201 | .release = single_release, | 2203 | .release = single_release, |
2202 | }; | 2204 | }; |
@@ -2204,23 +2206,32 @@ static struct file_operations adio_fops = { | |||
2204 | static int sg_proc_single_open_dressz(struct inode *inode, struct file *file); | 2206 | static int sg_proc_single_open_dressz(struct inode *inode, struct file *file); |
2205 | static ssize_t sg_proc_write_dressz(struct file *filp, | 2207 | static ssize_t sg_proc_write_dressz(struct file *filp, |
2206 | const char __user *buffer, size_t count, loff_t *off); | 2208 | const char __user *buffer, size_t count, loff_t *off); |
2207 | static struct file_operations dressz_fops = { | 2209 | static const struct file_operations dressz_fops = { |
2210 | .owner = THIS_MODULE, | ||
2208 | .open = sg_proc_single_open_dressz, | 2211 | .open = sg_proc_single_open_dressz, |
2212 | .read = seq_read, | ||
2213 | .llseek = seq_lseek, | ||
2209 | .write = sg_proc_write_dressz, | 2214 | .write = sg_proc_write_dressz, |
2210 | .release = single_release, | 2215 | .release = single_release, |
2211 | }; | 2216 | }; |
2212 | 2217 | ||
2213 | static int sg_proc_seq_show_version(struct seq_file *s, void *v); | 2218 | static int sg_proc_seq_show_version(struct seq_file *s, void *v); |
2214 | static int sg_proc_single_open_version(struct inode *inode, struct file *file); | 2219 | static int sg_proc_single_open_version(struct inode *inode, struct file *file); |
2215 | static struct file_operations version_fops = { | 2220 | static const struct file_operations version_fops = { |
2221 | .owner = THIS_MODULE, | ||
2216 | .open = sg_proc_single_open_version, | 2222 | .open = sg_proc_single_open_version, |
2223 | .read = seq_read, | ||
2224 | .llseek = seq_lseek, | ||
2217 | .release = single_release, | 2225 | .release = single_release, |
2218 | }; | 2226 | }; |
2219 | 2227 | ||
2220 | static int sg_proc_seq_show_devhdr(struct seq_file *s, void *v); | 2228 | static int sg_proc_seq_show_devhdr(struct seq_file *s, void *v); |
2221 | static int sg_proc_single_open_devhdr(struct inode *inode, struct file *file); | 2229 | static int sg_proc_single_open_devhdr(struct inode *inode, struct file *file); |
2222 | static struct file_operations devhdr_fops = { | 2230 | static const struct file_operations devhdr_fops = { |
2231 | .owner = THIS_MODULE, | ||
2223 | .open = sg_proc_single_open_devhdr, | 2232 | .open = sg_proc_single_open_devhdr, |
2233 | .read = seq_read, | ||
2234 | .llseek = seq_lseek, | ||
2224 | .release = single_release, | 2235 | .release = single_release, |
2225 | }; | 2236 | }; |
2226 | 2237 | ||
@@ -2229,8 +2240,11 @@ static int sg_proc_open_dev(struct inode *inode, struct file *file); | |||
2229 | static void * dev_seq_start(struct seq_file *s, loff_t *pos); | 2240 | static void * dev_seq_start(struct seq_file *s, loff_t *pos); |
2230 | static void * dev_seq_next(struct seq_file *s, void *v, loff_t *pos); | 2241 | static void * dev_seq_next(struct seq_file *s, void *v, loff_t *pos); |
2231 | static void dev_seq_stop(struct seq_file *s, void *v); | 2242 | static void dev_seq_stop(struct seq_file *s, void *v); |
2232 | static struct file_operations dev_fops = { | 2243 | static const struct file_operations dev_fops = { |
2244 | .owner = THIS_MODULE, | ||
2233 | .open = sg_proc_open_dev, | 2245 | .open = sg_proc_open_dev, |
2246 | .read = seq_read, | ||
2247 | .llseek = seq_lseek, | ||
2234 | .release = seq_release, | 2248 | .release = seq_release, |
2235 | }; | 2249 | }; |
2236 | static const struct seq_operations dev_seq_ops = { | 2250 | static const struct seq_operations dev_seq_ops = { |
@@ -2242,8 +2256,11 @@ static const struct seq_operations dev_seq_ops = { | |||
2242 | 2256 | ||
2243 | static int sg_proc_seq_show_devstrs(struct seq_file *s, void *v); | 2257 | static int sg_proc_seq_show_devstrs(struct seq_file *s, void *v); |
2244 | static int sg_proc_open_devstrs(struct inode *inode, struct file *file); | 2258 | static int sg_proc_open_devstrs(struct inode *inode, struct file *file); |
2245 | static struct file_operations devstrs_fops = { | 2259 | static const struct file_operations devstrs_fops = { |
2260 | .owner = THIS_MODULE, | ||
2246 | .open = sg_proc_open_devstrs, | 2261 | .open = sg_proc_open_devstrs, |
2262 | .read = seq_read, | ||
2263 | .llseek = seq_lseek, | ||
2247 | .release = seq_release, | 2264 | .release = seq_release, |
2248 | }; | 2265 | }; |
2249 | static const struct seq_operations devstrs_seq_ops = { | 2266 | static const struct seq_operations devstrs_seq_ops = { |
@@ -2255,8 +2272,11 @@ static const struct seq_operations devstrs_seq_ops = { | |||
2255 | 2272 | ||
2256 | static int sg_proc_seq_show_debug(struct seq_file *s, void *v); | 2273 | static int sg_proc_seq_show_debug(struct seq_file *s, void *v); |
2257 | static int sg_proc_open_debug(struct inode *inode, struct file *file); | 2274 | static int sg_proc_open_debug(struct inode *inode, struct file *file); |
2258 | static struct file_operations debug_fops = { | 2275 | static const struct file_operations debug_fops = { |
2276 | .owner = THIS_MODULE, | ||
2259 | .open = sg_proc_open_debug, | 2277 | .open = sg_proc_open_debug, |
2278 | .read = seq_read, | ||
2279 | .llseek = seq_lseek, | ||
2260 | .release = seq_release, | 2280 | .release = seq_release, |
2261 | }; | 2281 | }; |
2262 | static const struct seq_operations debug_seq_ops = { | 2282 | static const struct seq_operations debug_seq_ops = { |
@@ -2269,7 +2289,7 @@ static const struct seq_operations debug_seq_ops = { | |||
2269 | 2289 | ||
2270 | struct sg_proc_leaf { | 2290 | struct sg_proc_leaf { |
2271 | const char * name; | 2291 | const char * name; |
2272 | struct file_operations * fops; | 2292 | const struct file_operations * fops; |
2273 | }; | 2293 | }; |
2274 | 2294 | ||
2275 | static struct sg_proc_leaf sg_proc_leaf_arr[] = { | 2295 | static struct sg_proc_leaf sg_proc_leaf_arr[] = { |
@@ -2295,9 +2315,6 @@ sg_proc_init(void) | |||
2295 | for (k = 0; k < num_leaves; ++k) { | 2315 | for (k = 0; k < num_leaves; ++k) { |
2296 | leaf = &sg_proc_leaf_arr[k]; | 2316 | leaf = &sg_proc_leaf_arr[k]; |
2297 | mask = leaf->fops->write ? S_IRUGO | S_IWUSR : S_IRUGO; | 2317 | mask = leaf->fops->write ? S_IRUGO | S_IWUSR : S_IRUGO; |
2298 | leaf->fops->owner = THIS_MODULE; | ||
2299 | leaf->fops->read = seq_read; | ||
2300 | leaf->fops->llseek = seq_lseek; | ||
2301 | proc_create(leaf->name, mask, sg_proc_sgp, leaf->fops); | 2318 | proc_create(leaf->name, mask, sg_proc_sgp, leaf->fops); |
2302 | } | 2319 | } |
2303 | return 0; | 2320 | return 0; |