DebugFS : coding style fixes
[powerpc.git] / fs / debugfs / inode.c
index 269e649..05d1a9c 100644 (file)
 #include <linux/mount.h>
 #include <linux/pagemap.h>
 #include <linux/init.h>
+#include <linux/kobject.h>
 #include <linux/namei.h>
 #include <linux/debugfs.h>
+#include <linux/fsnotify.h>
 
 #define DEBUGFS_MAGIC  0x64626720
 
@@ -53,8 +55,9 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d
                        inode->i_op = &simple_dir_inode_operations;
                        inode->i_fop = &simple_dir_operations;
 
-                       /* directory inodes start off with i_nlink == 2 (for "." entry) */
-                       inode->i_nlink++;
+                       /* directory inodes start off with i_nlink == 2
+                        * (for "." entry) */
+                       inc_nlink(inode);
                        break;
                }
        }
@@ -86,15 +89,22 @@ static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 
        mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR;
        res = debugfs_mknod(dir, dentry, mode, 0);
-       if (!res)
-               dir->i_nlink++;
+       if (!res) {
+               inc_nlink(dir);
+               fsnotify_mkdir(dir, dentry);
+       }
        return res;
 }
 
 static int debugfs_create(struct inode *dir, struct dentry *dentry, int mode)
 {
+       int res;
+
        mode = (mode & S_IALLUGO) | S_IFREG;
-       return debugfs_mknod(dir, dentry, mode, 0);
+       res = debugfs_mknod(dir, dentry, mode, 0);
+       if (!res)
+               fsnotify_create(dir, dentry);
+       return res;
 }
 
 static inline int debugfs_positive(struct dentry *dentry)
@@ -134,7 +144,7 @@ static int debugfs_create_by_name(const char *name, mode_t mode,
         * block. A pointer to that is in the struct vfsmount that we
         * have around.
         */
-       if (!parent ) {
+       if (!parent) {
                if (debugfs_mount && debugfs_mount->mnt_sb) {
                        parent = debugfs_mount->mnt_sb->s_root;
                }
@@ -147,13 +157,13 @@ static int debugfs_create_by_name(const char *name, mode_t mode,
        *dentry = NULL;
        mutex_lock(&parent->d_inode->i_mutex);
        *dentry = lookup_one_len(name, parent, strlen(name));
-       if (!IS_ERR(dentry)) {
+       if (!IS_ERR(*dentry)) {
                if ((mode & S_IFMT) == S_IFDIR)
                        error = debugfs_mkdir(parent->d_inode, *dentry, mode);
                else 
                        error = debugfs_create(parent->d_inode, *dentry, mode);
        } else
-               error = PTR_ERR(dentry);
+               error = PTR_ERR(*dentry);
        mutex_unlock(&parent->d_inode->i_mutex);
 
        return error;
@@ -252,7 +262,7 @@ EXPORT_SYMBOL_GPL(debugfs_create_dir);
  *
  * This function removes a file or directory in debugfs that was previously
  * created with a call to another debugfs function (like
- * debufs_create_file() or variants thereof.)
+ * debugfs_create_file() or variants thereof.)
  *
  * This function is required to be called in order for the file to be
  * removed, no automatic cleanup of files will happen when a module is