Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=99fc06df72fe1c9ad3ec274720dcb5658c40bfd2
Commit:     99fc06df72fe1c9ad3ec274720dcb5658c40bfd2
Parent:     17973f5af741f1758ed57c5115ca394c22bee159
Author:     Changli Gao <[EMAIL PROTECTED]>
AuthorDate: Sun Jul 15 23:40:09 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon Jul 16 09:05:43 2007 -0700

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/proc/generic.c |   20 +++++++-------------
 1 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 4f8e535..b5e7155 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
                return -EAGAIN;
        dp->low_ino = i;
 
-       spin_lock(&proc_subdir_lock);
-       dp->next = dir->subdir;
-       dp->parent = dir;
-       dir->subdir = dp;
-       spin_unlock(&proc_subdir_lock);
-
        if (S_ISDIR(dp->mode)) {
                if (dp->proc_iops == NULL) {
                        dp->proc_fops = &proc_dir_operations;
@@ -551,6 +545,13 @@ static int proc_register(struct proc_dir_entry * dir, 
struct proc_dir_entry * dp
                if (dp->proc_iops == NULL)
                        dp->proc_iops = &proc_file_inode_operations;
        }
+
+       spin_lock(&proc_subdir_lock);
+       dp->next = dir->subdir;
+       dp->parent = dir;
+       dir->subdir = dp;
+       spin_unlock(&proc_subdir_lock);
+
        return 0;
 }
 
@@ -653,9 +654,6 @@ struct proc_dir_entry *proc_mkdir_mode(const char *name, 
mode_t mode,
 
        ent = proc_create(&parent, name, S_IFDIR | mode, 2);
        if (ent) {
-               ent->proc_fops = &proc_dir_operations;
-               ent->proc_iops = &proc_dir_inode_operations;
-
                if (proc_register(parent, ent) < 0) {
                        kfree(ent);
                        ent = NULL;
@@ -690,10 +688,6 @@ struct proc_dir_entry *create_proc_entry(const char *name, 
mode_t mode,
 
        ent = proc_create(&parent,name,mode,nlink);
        if (ent) {
-               if (S_ISDIR(mode)) {
-                       ent->proc_fops = &proc_dir_operations;
-                       ent->proc_iops = &proc_dir_inode_operations;
-               }
                if (proc_register(parent, ent) < 0) {
                        kfree(ent);
                        ent = NULL;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to