Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

proc: move rest of /proc/locks to fs/locks.c

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>

+21 -19
+21 -1
fs/locks.c
··· 2078 2078 EXPORT_SYMBOL_GPL(vfs_cancel_lock); 2079 2079 2080 2080 #ifdef CONFIG_PROC_FS 2081 + #include <linux/proc_fs.h> 2081 2082 #include <linux/seq_file.h> 2082 2083 2083 2084 static void lock_get_status(struct seq_file *f, struct file_lock *fl, ··· 2184 2183 unlock_kernel(); 2185 2184 } 2186 2185 2187 - struct seq_operations locks_seq_operations = { 2186 + static const struct seq_operations locks_seq_operations = { 2188 2187 .start = locks_start, 2189 2188 .next = locks_next, 2190 2189 .stop = locks_stop, 2191 2190 .show = locks_show, 2192 2191 }; 2192 + 2193 + static int locks_open(struct inode *inode, struct file *filp) 2194 + { 2195 + return seq_open(filp, &locks_seq_operations); 2196 + } 2197 + 2198 + static const struct file_operations proc_locks_operations = { 2199 + .open = locks_open, 2200 + .read = seq_read, 2201 + .llseek = seq_lseek, 2202 + .release = seq_release, 2203 + }; 2204 + 2205 + static int __init proc_locks_init(void) 2206 + { 2207 + proc_create("locks", 0, NULL, &proc_locks_operations); 2208 + return 0; 2209 + } 2210 + module_init(proc_locks_init); 2193 2211 #endif 2194 2212 2195 2213 /**
-17
fs/proc/proc_misc.c
··· 453 453 .release = seq_release, 454 454 }; 455 455 456 - #ifdef CONFIG_FILE_LOCKING 457 - static int locks_open(struct inode *inode, struct file *filp) 458 - { 459 - return seq_open(filp, &locks_seq_operations); 460 - } 461 - 462 - static const struct file_operations proc_locks_operations = { 463 - .open = locks_open, 464 - .read = seq_read, 465 - .llseek = seq_lseek, 466 - .release = seq_release, 467 - }; 468 - #endif /* CONFIG_FILE_LOCKING */ 469 - 470 456 #ifdef CONFIG_PROC_PAGE_MONITOR 471 457 #define KPMSIZE sizeof(u64) 472 458 #define KPMMASK (KPMSIZE - 1) ··· 591 605 proc_symlink("mounts", NULL, "self/mounts"); 592 606 593 607 /* And now for trickier ones */ 594 - #ifdef CONFIG_FILE_LOCKING 595 - proc_create("locks", 0, NULL, &proc_locks_operations); 596 - #endif 597 608 proc_create("devices", 0, NULL, &proc_devinfo_operations); 598 609 proc_create("cpuinfo", 0, NULL, &proc_cpuinfo_operations); 599 610 #ifdef CONFIG_BLOCK
-1
include/linux/fs.h
··· 1037 1037 extern int lease_modify(struct file_lock **, int); 1038 1038 extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 1039 1039 extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 1040 - extern struct seq_operations locks_seq_operations; 1041 1040 #else /* !CONFIG_FILE_LOCKING */ 1042 1041 #define fcntl_getlk(a, b) ({ -EINVAL; }) 1043 1042 #define fcntl_setlk(a, b, c, d) ({ -EACCES; })