fix
authorMiklos Szeredi <miklos@szeredi.hu>
Sun, 3 Jul 2005 18:03:11 +0000 (18:03 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Sun, 3 Jul 2005 18:03:11 +0000 (18:03 +0000)
ChangeLog
Filesystems
doc/kernel.txt
kernel/file.c

index c1afe5bb91e0c410a4d790661e00e7c1b4ef1858..65597a8c98695c6eff89a53791ebf861d08845b6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-07-03  Miklos Szeredi <miklos@szeredi.hu>
+
+       * kernel: clean up 'direct_io' code
+
 2005-06-28  Miklos Szeredi <miklos@szeredi.hu>
 
        * Add 'mount.fuse' written by Petr Klima
index 273cac64a2d133bfb69b7b35fe08cc73fc603742..ddc71fb11b2927ccebc5848a1759ff5613561daa 100644 (file)
@@ -383,8 +383,21 @@ Homepage: http://smbnetfs.airm.net/
 
 Description:
 
-   SMBNetFS is a Linux filesystem that allow you to use
-   samba/microsoft network in the same manner as the network
-   neighborhood in Microsoft Windows.
+  SMBNetFS is a Linux filesystem that allow you to use samba/microsoft
+  network in the same manner as the network neighborhood in Microsoft
+  Windows.
+
+==============================================================================
+Name: NTFS-FUSE
+
+Author: Yura Pakhuchiy / pakhuchiy at gmail com
+
+Homepage: http://linux-ntfs.sf.net/
+
+Description:
+
+  NTFS-FUSE is part of ntfsprogs package (utily name - ntfsmount). It's rely
+  on libntfs. NTFS-FUSE support file overwrite changing it size and can
+  list/read/write/add/remove named data streams via xattr interface.
 
 ==============================================================================
index afd371fca417235a39303907b46a15911096b692..0331cccdcf9009b7275845bf11d15660c6083217 100644 (file)
@@ -38,6 +38,57 @@ non-privileged mounts.  This opens up new possibilities for the use of
 filesystems.  A good example is sshfs: a secure network filesystem
 using the sftp protocol.
 
+Mount options
+~~~~~~~~~~~~~
+
+'default_permissions'
+
+  By default FUSE doesn't check file access permissions, the
+  filesystem is free to implement it's access policy or leave it to
+  the underlying file access mechanism (e.g. in case of network
+  filesystems).  This option enables permission checking, restricting
+  access based on file mode.  This is option is usually useful
+  together with the 'allow_other' mount option.
+
+'allow_other'
+
+  This option overrides the security measure restricting file access
+  to the user mounting the filesystem.  This option is by default only
+  allowed to root, but this restriction can be removed with a
+  (userspace) configuration option.
+
+'kernel_cache'
+
+  This option disables flushing the cache of the file contents on
+  every open().  This should only be enabled on filesystems, where the
+  file data is never changed externally (not through the mounted FUSE
+  filesystem).  Thus it is not suitable for network filesystems and
+  other "intermediate" filesystems.
+
+  NOTE: if this option is not specified (and neither 'direct_io') data
+  is still cached after the open(), so a read() system call will not
+  always initiate a read operation.
+
+'direct_io'
+
+  This option disables the use of page cache (file content cache) in
+  the kernel for this filesystem.  This has several affects:
+
+     - Each read() or write() system call will initiate one or more
+       read or write operations, data will not be cached in the
+       kernel.
+
+     - The return value of the read() and write() system calls will
+       correspond to the return values of the read and write
+       operations.  This is useful for example if the file size is not
+       known in advance (before reading it).
+
+'max_read=N'
+
+  With this option the maximum size of read operations can be set.
+  The default is infinite.  Note that the size of read requests is
+  limited anyway to 32 pages (which is 128kbyte on i386).
+
 How do non-privileged mounts work?
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
index 5ebf025c8f51cc992e1c3dad7cbfc3261577091a..63e43809a22845c6c16dfd4a3fef0a68e99c3fad 100644 (file)
@@ -583,58 +583,44 @@ static ssize_t fuse_direct_io(struct file *file, const char __user *buf,
        return res;
 }
 
-static ssize_t fuse_file_read(struct file *file, char __user *buf,
-                             size_t count, loff_t *ppos)
+static ssize_t fuse_direct_read(struct file *file, char __user *buf,
+                                    size_t count, loff_t *ppos)
 {
-       struct inode *inode = file->f_dentry->d_inode;
-       struct fuse_conn *fc = get_fuse_conn(inode);
+       return fuse_direct_io(file, buf, count, ppos, 0);
+}
 
-       if (fc->flags & FUSE_DIRECT_IO)
-               return fuse_direct_io(file, buf, count, ppos, 0);
-#ifndef KERNEL_2_6
-       else {
-               if (fc->flags & FUSE_LARGE_READ) {
-                       int res;
-                       down(&inode->i_sem);
-                       res = fuse_file_bigread(file, inode, *ppos, count);
-                       up(&inode->i_sem);
-                       if (res)
-                               return res;
-               }
-               return generic_file_read(file, buf, count, ppos);
-       }
-#else
-       else
-               return generic_file_read(file, buf, count, ppos);
-#endif
+static ssize_t fuse_direct_write(struct file *file, const char __user *buf,
+                                size_t count, loff_t *ppos)
+{
+       struct inode *inode = file->f_dentry->d_inode;
+       ssize_t res;
+       /* Don't allow parallel writes to the same file */
+       down(&inode->i_sem);
+       res = fuse_direct_io(file, buf, count, ppos, 1);
+       up(&inode->i_sem);
+       return res;
 }
 
-static ssize_t fuse_file_write(struct file *file, const char __user *buf,
-                              size_t count, loff_t *ppos)
+#ifndef KERNEL_2_6
+static ssize_t fuse_file_read(struct file *file, char __user *buf,
+                             size_t count, loff_t *ppos)
 {
        struct inode *inode = file->f_dentry->d_inode;
        struct fuse_conn *fc = get_fuse_conn(inode);
 
-       if (fc->flags & FUSE_DIRECT_IO) {
-               ssize_t res;
-               /* Don't allow parallel writes to the same file */
+       if (fc->flags & FUSE_LARGE_READ) {
+               int res;
                down(&inode->i_sem);
-               res = fuse_direct_io(file, buf, count, ppos, 1);
+               res = fuse_file_bigread(file, inode, *ppos, count);
                up(&inode->i_sem);
-               return res;
+               if (res)
+                       return res;
        }
-       else
-               return generic_file_write(file, buf, count, ppos);
+       return generic_file_read(file, buf, count, ppos);
 }
-
+#endif
 static int fuse_file_mmap(struct file *file, struct vm_area_struct *vma)
 {
-       struct inode *inode = file->f_dentry->d_inode;
-       struct fuse_conn *fc = get_fuse_conn(inode);
-
-       if (fc->flags & FUSE_DIRECT_IO)
-               return -ENODEV;
-
        if ((vma->vm_flags & VM_SHARED)) {
                if ((vma->vm_flags & VM_WRITE))
                        return -ENODEV;
@@ -645,17 +631,6 @@ static int fuse_file_mmap(struct file *file, struct vm_area_struct *vma)
 }
 
 #ifdef KERNEL_2_6
-static ssize_t fuse_file_sendfile(struct file *file, loff_t *ppos,
-                                 size_t count, read_actor_t actor,
-                                 void *target)
-{
-       struct fuse_conn *fc = get_fuse_conn(file->f_dentry->d_inode);
-       if (fc->flags & FUSE_DIRECT_IO)
-               return -EINVAL;
-       else
-               return generic_file_sendfile(file, ppos, count, actor, target);
-}
-
 static int fuse_set_page_dirty(struct page *page)
 {
        printk("fuse_set_page_dirty: should not happen\n");
@@ -666,18 +641,33 @@ static int fuse_set_page_dirty(struct page *page)
 
 static struct file_operations fuse_file_operations = {
        .llseek         = generic_file_llseek,
+#ifdef KERNEL_2_6
+       .read           = generic_file_read,    
+#else
        .read           = fuse_file_read,
-       .write          = fuse_file_write,
+#endif
+       .write          = generic_file_write,
        .mmap           = fuse_file_mmap,
        .open           = fuse_open,
        .flush          = fuse_flush,
        .release        = fuse_release,
        .fsync          = fuse_fsync,
 #ifdef KERNEL_2_6
-       .sendfile       = fuse_file_sendfile,
+       .sendfile       = generic_file_sendfile,
 #endif
 };
 
+static struct file_operations fuse_direct_io_file_operations = {
+       .llseek         = generic_file_llseek,
+       .read           = fuse_direct_read,
+       .write          = fuse_direct_write,
+       .open           = fuse_open,
+       .flush          = fuse_flush,
+       .release        = fuse_release,
+       .fsync          = fuse_fsync,
+       /* no mmap and sendfile */
+};
+
 static struct address_space_operations fuse_file_aops  = {
        .readpage       = fuse_readpage,
        .prepare_write  = fuse_prepare_write,
@@ -690,6 +680,12 @@ static struct address_space_operations fuse_file_aops  = {
 
 void fuse_init_file_inode(struct inode *inode)
 {
-       inode->i_fop = &fuse_file_operations;
-       inode->i_data.a_ops = &fuse_file_aops;
+       struct fuse_conn *fc = get_fuse_conn(inode);
+
+       if (fc->flags & FUSE_DIRECT_IO)
+               inode->i_fop = &fuse_direct_io_file_operations;
+       else {
+               inode->i_fop = &fuse_file_operations;
+               inode->i_data.a_ops = &fuse_file_aops;
+       }
 }