fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / fs / udf / file.c
index 2faa417..d81f2db 100644 (file)
@@ -4,11 +4,6 @@
  * PURPOSE
  *  File handling routines for the OSTA-UDF(tm) filesystem.
  *
- * CONTACTS
- *  E-mail regarding any portion of the Linux UDF file system should be
- *  directed to the development team mailing list (run by majordomo):
- *    linux_udf@hpesjro.fc.hp.com
- *
  * COPYRIGHT
  *  This file is distributed under the terms of the GNU General Public
  *  License (GPL). Copies of the GPL can be obtained from:
@@ -36,6 +31,7 @@
 #include <asm/uaccess.h>
 #include <linux/kernel.h>
 #include <linux/string.h> /* memset */
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/smp_lock.h>
 #include <linux/pagemap.h>
@@ -49,8 +45,7 @@ static int udf_adinicb_readpage(struct file *file, struct page * page)
        struct inode *inode = page->mapping->host;
        char *kaddr;
 
-       if (!PageLocked(page))
-               PAGE_BUG(page);
+       BUG_ON(!PageLocked(page));
 
        kaddr = kmap(page);
        memset(kaddr, 0, PAGE_CACHE_SIZE);
@@ -67,8 +62,7 @@ static int udf_adinicb_writepage(struct page *page, struct writeback_control *wb
        struct inode *inode = page->mapping->host;
        char *kaddr;
 
-       if (!PageLocked(page))
-               PAGE_BUG(page);
+       BUG_ON(!PageLocked(page));
 
        kaddr = kmap(page);
        memcpy(UDF_I_DATA(inode) + UDF_I_LENEATTR(inode), kaddr, inode->i_size);
@@ -101,7 +95,7 @@ static int udf_adinicb_commit_write(struct file *file, struct page *page, unsign
        return 0;
 }
 
-struct address_space_operations udf_adinicb_aops = {
+const struct address_space_operations udf_adinicb_aops = {
        .readpage               = udf_adinicb_readpage,
        .writepage              = udf_adinicb_writepage,
        .sync_page              = block_sync_page,
@@ -109,19 +103,21 @@ struct address_space_operations udf_adinicb_aops = {
        .commit_write           = udf_adinicb_commit_write,
 };
 
-static ssize_t udf_file_write(struct file * file, const char __user * buf,
-       size_t count, loff_t *ppos)
+static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
+                             unsigned long nr_segs, loff_t ppos)
 {
        ssize_t retval;
-       struct inode *inode = file->f_dentry->d_inode;
+       struct file *file = iocb->ki_filp;
+       struct inode *inode = file->f_path.dentry->d_inode;
        int err, pos;
+       size_t count = iocb->ki_left;
 
        if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB)
        {
                if (file->f_flags & O_APPEND)
                        pos = inode->i_size;
                else
-                       pos = *ppos;
+                       pos = ppos;
 
                if (inode->i_sb->s_blocksize < (udf_file_entry_alloc_offset(inode) +
                        pos + count))
@@ -142,7 +138,7 @@ static ssize_t udf_file_write(struct file * file, const char __user * buf,
                }
        }
 
-       retval = generic_file_write(file, buf, count, ppos);
+       retval = generic_file_aio_write(iocb, iov, nr_segs, ppos);
 
        if (retval > 0)
                mark_inode_dirty(inode);
@@ -188,7 +184,7 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
 {
        int result = -EINVAL;
 
-       if ( permission(inode, MAY_READ, NULL) != 0 )
+       if ( file_permission(filp, MAY_READ) != 0 )
        {
                udf_debug("no permission to access inode %lu\n",
                                                inode->i_ino);
@@ -254,12 +250,14 @@ static int udf_release_file(struct inode * inode, struct file * filp)
        return 0;
 }
 
-struct file_operations udf_file_operations = {
-       .read                   = generic_file_read,
+const struct file_operations udf_file_operations = {
+       .read                   = do_sync_read,
+       .aio_read               = generic_file_aio_read,
        .ioctl                  = udf_ioctl,
        .open                   = generic_file_open,
        .mmap                   = generic_file_mmap,
-       .write                  = udf_file_write,
+       .write                  = do_sync_write,
+       .aio_write              = udf_file_aio_write,
        .release                = udf_release_file,
        .fsync                  = udf_fsync_file,
        .sendfile               = generic_file_sendfile,