This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / fs / udf / file.c
index 2faa417..33640a9 100644 (file)
@@ -254,10 +254,30 @@ static int udf_release_file(struct inode * inode, struct file * filp)
        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 = {
        .read                   = generic_file_read,
        .ioctl                  = udf_ioctl,
-       .open                   = generic_file_open,
+       .open                   = udf_open_file,
        .mmap                   = generic_file_mmap,
        .write                  = udf_file_write,
        .release                = udf_release_file,