* 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:
#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>
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);
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);
.commit_write = udf_adinicb_commit_write,
};
-static ssize_t udf_file_write(struct file * file, const char * buf,
+static ssize_t udf_file_write(struct file * file, const char __user * buf,
size_t count, loff_t *ppos)
{
ssize_t retval;
{
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);
switch (cmd)
{
case UDF_GETVOLIDENT:
- return copy_to_user((char *)arg,
+ return copy_to_user((char __user *)arg,
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 *)arg)) return -EFAULT;
+ 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 *)arg);
+ result = put_user(new, (long __user *)arg);
return result;
}
case UDF_GETEASIZE:
- result = put_user(UDF_I_LENEATTR(inode), (int *)arg);
+ result = put_user(UDF_I_LENEATTR(inode), (int __user *)arg);
break;
case UDF_GETEABLOCK:
- result = copy_to_user((char *)arg, UDF_I_DATA(inode),
+ result = copy_to_user((char __user *)arg, UDF_I_DATA(inode),
UDF_I_LENEATTR(inode)) ? -EFAULT : 0;
break;
}
return 0;
}
-/*
- * udf_open_file
- *
- * PURPOSE
- * Called when an inode is about to be open.
- *
- * DESCRIPTION
- * Use this to disallow opening RW large files on 32 bit systems.
- * On 64 bit systems we force on O_LARGEFILE in sys_open.
- *
- * HISTORY
- *
- */
-static int udf_open_file(struct inode * inode, struct file * filp)
-{
- if ((inode->i_size & 0xFFFFFFFF80000000ULL) && !(filp->f_flags & O_LARGEFILE))
- return -EFBIG;
- return 0;
-}
-
-struct file_operations udf_file_operations = {
+const struct file_operations udf_file_operations = {
.read = generic_file_read,
.ioctl = udf_ioctl,
- .open = udf_open_file,
+ .open = generic_file_open,
.mmap = generic_file_mmap,
.write = udf_file_write,
.release = udf_release_file,