summaryrefslogtreecommitdiffstats
path: root/fs/udf/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf/file.c')
-rw-r--r--fs/udf/file.c72
1 files changed, 34 insertions, 38 deletions
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 67bf36bd3e6e..5d7a4ea27753 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -30,7 +30,7 @@
#include <linux/udf_fs.h>
#include <asm/uaccess.h>
#include <linux/kernel.h>
-#include <linux/string.h> /* memset */
+#include <linux/string.h> /* memset */
#include <linux/capability.h>
#include <linux/errno.h>
#include <linux/smp_lock.h>
@@ -55,11 +55,11 @@ static int udf_adinicb_readpage(struct file *file, struct page *page)
SetPageUptodate(page);
kunmap(page);
unlock_page(page);
+
return 0;
}
-static int udf_adinicb_writepage(struct page *page,
- struct writeback_control *wbc)
+static int udf_adinicb_writepage(struct page *page, struct writeback_control *wbc)
{
struct inode *inode = page->mapping->host;
char *kaddr;
@@ -72,6 +72,7 @@ static int udf_adinicb_writepage(struct page *page,
SetPageUptodate(page);
kunmap(page);
unlock_page(page);
+
return 0;
}
@@ -100,11 +101,11 @@ static int udf_adinicb_commit_write(struct file *file, struct page *page,
}
const struct address_space_operations udf_adinicb_aops = {
- .readpage = udf_adinicb_readpage,
- .writepage = udf_adinicb_writepage,
- .sync_page = block_sync_page,
- .prepare_write = udf_adinicb_prepare_write,
- .commit_write = udf_adinicb_commit_write,
+ .readpage = udf_adinicb_readpage,
+ .writepage = udf_adinicb_writepage,
+ .sync_page = block_sync_page,
+ .prepare_write = udf_adinicb_prepare_write,
+ .commit_write = udf_adinicb_commit_write,
};
static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
@@ -122,8 +123,8 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
else
pos = ppos;
- if (inode->i_sb->s_blocksize <
- (udf_file_entry_alloc_offset(inode) + pos + count)) {
+ if (inode->i_sb->s_blocksize < (udf_file_entry_alloc_offset(inode) +
+ pos + count)) {
udf_expand_file_adinicb(inode, pos + count, &err);
if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) {
udf_debug("udf_expand_adinicb: err=%d\n", err);
@@ -138,9 +139,9 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
}
retval = generic_file_aio_write(iocb, iov, nr_segs, ppos);
-
if (retval > 0)
mark_inode_dirty(inode);
+
return retval;
}
@@ -181,10 +182,12 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
+ long old_block, new_block;
int result = -EINVAL;
if (file_permission(filp, MAY_READ) != 0) {
- udf_debug("no permission to access inode %lu\n", inode->i_ino);
+ udf_debug("no permission to access inode %lu\n",
+ inode->i_ino);
return -EPERM;
}
@@ -196,26 +199,19 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
switch (cmd) {
case UDF_GETVOLIDENT:
return copy_to_user((char __user *)arg,
- UDF_SB_VOLIDENT(inode->i_sb),
- 32) ? -EFAULT : 0;
+ UDF_SB_VOLIDENT(inode->i_sb), 32) ? -EFAULT : 0;
case UDF_RELOCATE_BLOCKS:
- {
- long old, new;
-
- if (!capable(CAP_SYS_ADMIN))
- return -EACCES;
- if (get_user(old, (long __user *)arg))
- return -EFAULT;
- if ((result = udf_relocate_blocks(inode->i_sb,
- old, &new)) == 0)
- result = put_user(new, (long __user *)arg);
-
- return result;
- }
+ if (!capable(CAP_SYS_ADMIN))
+ return -EACCES;
+ if (get_user(old_block, (long __user *)arg))
+ return -EFAULT;
+ if ((result = udf_relocate_blocks(inode->i_sb,
+ old_block, &new_block)) == 0)
+ result = put_user(new_block, (long __user *)arg);
+ return result;
case UDF_GETEASIZE:
result = put_user(UDF_I_LENEATTR(inode), (int __user *)arg);
break;
-
case UDF_GETEABLOCK:
result = copy_to_user((char __user *)arg, UDF_I_DATA(inode),
UDF_I_LENEATTR(inode)) ? -EFAULT : 0;
@@ -248,16 +244,16 @@ static int udf_release_file(struct inode *inode, struct file *filp)
}
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 = do_sync_write,
- .aio_write = udf_file_aio_write,
- .release = udf_release_file,
- .fsync = udf_fsync_file,
- .splice_read = generic_file_splice_read,
+ .read = do_sync_read,
+ .aio_read = generic_file_aio_read,
+ .ioctl = udf_ioctl,
+ .open = generic_file_open,
+ .mmap = generic_file_mmap,
+ .write = do_sync_write,
+ .aio_write = udf_file_aio_write,
+ .release = udf_release_file,
+ .fsync = udf_fsync_file,
+ .splice_read = generic_file_splice_read,
};
const struct inode_operations udf_file_inode_operations = {