]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/configfs/file.c
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[linux-2.6-omap-h63xx.git] / fs / configfs / file.c
index af1ffc9a15c0b402695b96a54ccdb1c3c1e0d85a..f499803743e04add3d576dc919e0a54752d00ba1 100644 (file)
@@ -26,7 +26,6 @@
 
 #include <linux/fs.h>
 #include <linux/module.h>
-#include <linux/dnotify.h>
 #include <linux/slab.h>
 #include <asm/uaccess.h>
 #include <asm/semaphore.h>
@@ -150,7 +149,7 @@ out:
 /**
  *     fill_write_buffer - copy buffer from userspace.
  *     @buffer:        data buffer for file.
- *     @userbuf:       data from user.
+ *     @buf:           data from user.
  *     @count:         number of bytes in @userbuf.
  *
  *     Allocate @buffer->page if it hasn't been already, then
@@ -177,8 +176,9 @@ fill_write_buffer(struct configfs_buffer * buffer, const char __user * buf, size
 
 /**
  *     flush_write_buffer - push buffer to config_item.
- *     @file:          file pointer.
+ *     @dentry:        dentry to the attribute
  *     @buffer:        data buffer for file.
+ *     @count:         number of bytes
  *
  *     Get the correct pointers for the config_item and the attribute we're
  *     dealing with, then call the store() method for the attribute,
@@ -217,15 +217,16 @@ static ssize_t
 configfs_write_file(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
        struct configfs_buffer * buffer = file->private_data;
+       ssize_t len;
 
        down(&buffer->sem);
-       count = fill_write_buffer(buffer,buf,count);
-       if (count > 0)
-               count = flush_write_buffer(file->f_dentry,buffer,count);
-       if (count > 0)
-               *ppos += count;
+       len = fill_write_buffer(buffer, buf, count);
+       if (len > 0)
+               len = flush_write_buffer(file->f_dentry, buffer, count);
+       if (len > 0)
+               *ppos += len;
        up(&buffer->sem);
-       return count;
+       return len;
 }
 
 static int check_perm(struct inode * inode, struct file * file)
@@ -321,7 +322,7 @@ static int configfs_release(struct inode * inode, struct file * filp)
        return 0;
 }
 
-struct file_operations configfs_file_operations = {
+const struct file_operations configfs_file_operations = {
        .read           = configfs_read_file,
        .write          = configfs_write_file,
        .llseek         = generic_file_llseek,
@@ -336,9 +337,9 @@ int configfs_add_file(struct dentry * dir, const struct configfs_attribute * att
        umode_t mode = (attr->ca_mode & S_IALLUGO) | S_IFREG;
        int error = 0;
 
-       down(&dir->d_inode->i_sem);
+       mutex_lock(&dir->d_inode->i_mutex);
        error = configfs_make_dirent(parent_sd, NULL, (void *) attr, mode, type);
-       up(&dir->d_inode->i_sem);
+       mutex_unlock(&dir->d_inode->i_mutex);
 
        return error;
 }