aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/generic.c
diff options
context:
space:
mode:
authorChangli Gao <xiaosuo@gmail.com>2007-07-16 02:40:09 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 12:05:43 -0400
commit99fc06df72fe1c9ad3ec274720dcb5658c40bfd2 (patch)
tree1a5913a12185031e2076618884988afc6ef5759e /fs/proc/generic.c
parent17973f5af741f1758ed57c5115ca394c22bee159 (diff)
procfs directory entry cleanup
Function proc_register() will assign proc_dir_operations and proc_dir_inode_operations to ent's members proc_fops and proc_iops correctly if ent is a directory. So the early assignment isn't necessary. Cc: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc/generic.c')
-rw-r--r--fs/proc/generic.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 4f8e53568b22..b5e7155d30d8 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -530,12 +530,6 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp
530 return -EAGAIN; 530 return -EAGAIN;
531 dp->low_ino = i; 531 dp->low_ino = i;
532 532
533 spin_lock(&proc_subdir_lock);
534 dp->next = dir->subdir;
535 dp->parent = dir;
536 dir->subdir = dp;
537 spin_unlock(&proc_subdir_lock);
538
539 if (S_ISDIR(dp->mode)) { 533 if (S_ISDIR(dp->mode)) {
540 if (dp->proc_iops == NULL) { 534 if (dp->proc_iops == NULL) {
541 dp->proc_fops = &proc_dir_operations; 535 dp->proc_fops = &proc_dir_operations;
@@ -551,6 +545,13 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp
551 if (dp->proc_iops == NULL) 545 if (dp->proc_iops == NULL)
552 dp->proc_iops = &proc_file_inode_operations; 546 dp->proc_iops = &proc_file_inode_operations;
553 } 547 }
548
549 spin_lock(&proc_subdir_lock);
550 dp->next = dir->subdir;
551 dp->parent = dir;
552 dir->subdir = dp;
553 spin_unlock(&proc_subdir_lock);
554
554 return 0; 555 return 0;
555} 556}
556 557
@@ -653,9 +654,6 @@ struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode,
653 654
654 ent = proc_create(&parent, name, S_IFDIR | mode, 2); 655 ent = proc_create(&parent, name, S_IFDIR | mode, 2);
655 if (ent) { 656 if (ent) {
656 ent->proc_fops = &proc_dir_operations;
657 ent->proc_iops = &proc_dir_inode_operations;
658
659 if (proc_register(parent, ent) < 0) { 657 if (proc_register(parent, ent) < 0) {
660 kfree(ent); 658 kfree(ent);
661 ent = NULL; 659 ent = NULL;
@@ -690,10 +688,6 @@ struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
690 688
691 ent = proc_create(&parent,name,mode,nlink); 689 ent = proc_create(&parent,name,mode,nlink);
692 if (ent) { 690 if (ent) {
693 if (S_ISDIR(mode)) {
694 ent->proc_fops = &proc_dir_operations;
695 ent->proc_iops = &proc_dir_inode_operations;
696 }
697 if (proc_register(parent, ent) < 0) { 691 if (proc_register(parent, ent) < 0) {
698 kfree(ent); 692 kfree(ent);
699 ent = NULL; 693 ent = NULL;