This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / include / linux / fs.h
index 8971ae3..0f6c1e9 100644 (file)
 #include <linux/types.h>
 #include <linux/kdev_t.h>
 #include <linux/ioctl.h>
-#include <linux/list.h>
 #include <linux/dcache.h>
 #include <linux/stat.h>
 #include <linux/cache.h>
-#include <linux/radix-tree.h>
+#include <linux/prio_tree.h>
 #include <linux/kobject.h>
 #include <asm/atomic.h>
-#include <linux/audit.h>
 
 struct iovec;
 struct nameidata;
@@ -116,6 +114,7 @@ extern int leases_enable, dir_notify_enable, lease_break_time;
 #define MS_VERBOSE     32768
 #define MS_POSIXACL    (1<<16) /* VFS does not apply the umask */
 #define MS_ONE_SECOND  (1<<17) /* fs has 1 sec a/m/ctime resolution */
+#define MS_TAGXID      (1<<24) /* tag inodes with context information */
 #define MS_ACTIVE      (1<<30)
 #define MS_NOUSER      (1<<31)
 
@@ -142,6 +141,8 @@ extern int leases_enable, dir_notify_enable, lease_break_time;
 #define S_NOQUOTA      64      /* Inode is not counted to quota */
 #define S_DIRSYNC      128     /* Directory modifications are synchronous */
 #define S_NOCMTIME     256     /* Do not update file c/mtime */
+#define S_BARRIER      512     /* Barrier for chroot() */
+#define S_IUNLINK      1024    /* Immutable unlink */
 
 /*
  * Note that nosuid etc flags are inode-specific: setting some file-system
@@ -169,11 +170,14 @@ extern int leases_enable, dir_notify_enable, lease_break_time;
 #define IS_NOQUOTA(inode)      ((inode)->i_flags & S_NOQUOTA)
 #define IS_APPEND(inode)       ((inode)->i_flags & S_APPEND)
 #define IS_IMMUTABLE(inode)    ((inode)->i_flags & S_IMMUTABLE)
+#define IS_IUNLINK(inode)      ((inode)->i_flags & S_IUNLINK)
+#define IS_IXORUNLINK(inode)   ((IS_IUNLINK(inode) ? S_IMMUTABLE : 0) ^ IS_IMMUTABLE(inode))
 #define IS_NOATIME(inode)      (__IS_FLG(inode, MS_NOATIME) || ((inode)->i_flags & S_NOATIME))
 #define IS_NODIRATIME(inode)   __IS_FLG(inode, MS_NODIRATIME)
 #define IS_POSIXACL(inode)     __IS_FLG(inode, MS_POSIXACL)
 #define IS_ONE_SECOND(inode)   __IS_FLG(inode, MS_ONE_SECOND)
 
+#define IS_BARRIER(inode)      (S_ISDIR((inode)->i_mode) && ((inode)->i_flags & S_BARRIER))
 #define IS_DEADDIR(inode)      ((inode)->i_flags & S_DEAD)
 #define IS_NOCMTIME(inode)     ((inode)->i_flags & S_NOCMTIME)
 
@@ -213,6 +217,9 @@ extern int leases_enable, dir_notify_enable, lease_break_time;
 
 #ifdef __KERNEL__
 
+#include <linux/list.h>
+#include <linux/radix-tree.h>
+#include <linux/audit.h>
 #include <asm/semaphore.h>
 #include <asm/byteorder.h>
 
@@ -280,6 +287,9 @@ struct iattr {
 #define ATTR_FLAG_IMMUTABLE    8       /* Immutable file */
 #define ATTR_FLAG_NODIRATIME   16      /* Don't update atime for directory */
 
+#define ATTR_FLAG_BARRIER      512     /* Barrier for chroot() */
+#define ATTR_FLAG_IUNLINK      1024    /* Immutable unlink */
+
 /*
  * Includes for diskquotas.
  */
@@ -329,9 +339,10 @@ struct address_space {
        unsigned long           nrpages;        /* number of total pages */
        pgoff_t                 writeback_index;/* writeback starts here */
        struct address_space_operations *a_ops; /* methods */
-       struct list_head        i_mmap;         /* list of private mappings */
-       struct list_head        i_mmap_shared;  /* list of shared mappings */
-       struct semaphore        i_shared_sem;   /* protect both above lists */
+       struct prio_tree_root   i_mmap;         /* tree of private mappings */
+       unsigned int            i_mmap_writable;/* count VM_SHARED mappings */
+       struct list_head        i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
+       spinlock_t              i_mmap_lock;    /* protect tree, count, list */
        atomic_t                truncate_count; /* Cover race condition with truncate */
        unsigned long           flags;          /* error bits/gfp mask */
        struct backing_dev_info *backing_dev_info; /* device readahead, etc */
@@ -356,6 +367,7 @@ struct block_device {
        int                     bd_invalidated;
        struct gendisk *        bd_disk;
        struct list_head        bd_list;
+       struct backing_dev_info *bd_inode_backing_dev_info;
        /*
         * Private data.  You must have bd_claim'ed the block_device
         * to use this.  NOTE:  bd_claim allows an owner to claim
@@ -379,19 +391,19 @@ int mapping_tagged(struct address_space *mapping, int tag);
  */
 static inline int mapping_mapped(struct address_space *mapping)
 {
-       return  !list_empty(&mapping->i_mmap) ||
-               !list_empty(&mapping->i_mmap_shared);
+       return  !prio_tree_empty(&mapping->i_mmap) ||
+               !list_empty(&mapping->i_mmap_nonlinear);
 }
 
 /*
  * Might pages of this file have been modified in userspace?
- * Note that i_mmap_shared holds all the VM_SHARED vmas: do_mmap_pgoff
+ * Note that i_mmap_writable counts all VM_SHARED vmas: do_mmap_pgoff
  * marks vma as VM_SHARED if it is shared, and the file was opened for
  * writing i.e. vma may be mprotected writable even if now readonly.
  */
 static inline int mapping_writably_mapped(struct address_space *mapping)
 {
-       return  !list_empty(&mapping->i_mmap_shared);
+       return mapping->i_mmap_writable != 0;
 }
 
 /*
@@ -415,6 +427,7 @@ struct inode {
        unsigned int            i_nlink;
        uid_t                   i_uid;
        gid_t                   i_gid;
+       xid_t                   i_xid;
        dev_t                   i_rdev;
        loff_t                  i_size;
        struct timespec         i_atime;
@@ -529,8 +542,8 @@ struct fown_struct {
        rwlock_t lock;          /* protects pid, uid, euid fields */
        int pid;                /* pid or -pgrp where SIGIO should be sent */
        uid_t uid, euid;        /* uid/euid of process setting the owner */
-       int signum;             /* posix.1b rt signal to be delivered on IO */
        void *security;
+       int signum;             /* posix.1b rt signal to be delivered on IO */
 };
 
 /*
@@ -558,10 +571,10 @@ struct file {
        atomic_t                f_count;
        unsigned int            f_flags;
        mode_t                  f_mode;
+       int                     f_error;
        loff_t                  f_pos;
        struct fown_struct      f_owner;
        unsigned int            f_uid, f_gid;
-       int                     f_error;
        struct file_ra_state    f_ra;
 
        unsigned long           f_version;
@@ -596,7 +609,7 @@ extern void close_private_file(struct file *file);
 #if BITS_PER_LONG==32
 #define MAX_LFS_FILESIZE       (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) 
 #elif BITS_PER_LONG==64
-#define MAX_LFS_FILESIZE       0x7fffffffffffffff
+#define MAX_LFS_FILESIZE       0x7fffffffffffffffUL
 #endif
 
 #define FL_POSIX       1
@@ -795,7 +808,7 @@ static inline void unlock_super(struct super_block * sb)
 extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);
 extern int vfs_mkdir(struct inode *, struct dentry *, int);
 extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);
-extern int vfs_symlink(struct inode *, struct dentry *, const char *);
+extern int vfs_symlink(struct inode *, struct dentry *, const char *, int);
 extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
 extern int vfs_rmdir(struct inode *, struct dentry *);
 extern int vfs_unlink(struct inode *, struct dentry *);
@@ -897,6 +910,7 @@ struct inode_operations {
                        struct inode *, struct dentry *);
        int (*readlink) (struct dentry *, char __user *,int);
        int (*follow_link) (struct dentry *, struct nameidata *);
+       void (*put_link) (struct dentry *, struct nameidata *);
        void (*truncate) (struct inode *);
        int (*permission) (struct inode *, int, struct nameidata *);
        int (*setattr) (struct dentry *, struct iattr *);
@@ -1114,6 +1128,7 @@ struct super_block *sget(struct file_system_type *type,
                        void *data);
 struct super_block *get_sb_pseudo(struct file_system_type *, char *,
                        struct super_operations *ops, unsigned long);
+int __put_super(struct super_block *sb);
 void unnamed_dev_init(void);
 
 /* Alas, no aliases. Too much hassle with bringing module.h everywhere */
@@ -1125,6 +1140,7 @@ void unnamed_dev_init(void);
 extern int register_filesystem(struct file_system_type *);
 extern int unregister_filesystem(struct file_system_type *);
 extern struct vfsmount *kern_mount(struct file_system_type *);
+extern int may_umount_tree(struct vfsmount *);
 extern int may_umount(struct vfsmount *);
 extern long do_mount(char *, char *, char *, unsigned long, void *);
 
@@ -1229,7 +1245,6 @@ extern int blkdev_get(struct block_device *, mode_t, unsigned);
 extern int blkdev_put(struct block_device *);
 extern int bd_claim(struct block_device *, void *);
 extern void bd_release(struct block_device *);
-extern void blk_run_queues(void);
 
 /* fs/char_dev.c */
 extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, char *);
@@ -1399,7 +1414,7 @@ ssize_t generic_file_write_nolock(struct file *file, const struct iovec *iov,
 extern ssize_t generic_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void __user *);
 extern void do_generic_mapping_read(struct address_space *mapping,
                                    struct file_ra_state *, struct file *,
-                                   loff_t *, read_descriptor_t *, read_actor_t);
+                                   loff_t *, read_descriptor_t *, read_actor_t, int);
 extern void
 file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
 extern ssize_t generic_file_direct_IO(int rw, struct kiocb *iocb,
@@ -1415,14 +1430,15 @@ extern int generic_file_open(struct inode * inode, struct file * filp);
 
 static inline void do_generic_file_read(struct file * filp, loff_t *ppos,
                                        read_descriptor_t * desc,
-                                       read_actor_t actor)
+                                       read_actor_t actor, int nonblock)
 {
        do_generic_mapping_read(filp->f_mapping,
                                &filp->f_ra,
                                filp,
                                ppos,
                                desc,
-                               actor);
+                               actor,
+                               nonblock);
 }
 
 ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
@@ -1455,12 +1471,17 @@ extern struct file_operations generic_ro_fops;
 
 #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
 
+extern void nd_set_link(struct nameidata *, char *);
+extern char *nd_get_link(struct nameidata *);
 extern int vfs_readlink(struct dentry *, char __user *, int, const char *);
 extern int vfs_follow_link(struct nameidata *, const char *);
 extern int page_readlink(struct dentry *, char __user *, int);
 extern int page_follow_link(struct dentry *, struct nameidata *);
+extern int page_follow_link_light(struct dentry *, struct nameidata *);
+extern void page_put_link(struct dentry *, struct nameidata *);
 extern int page_symlink(struct inode *inode, const char *symname, int len);
 extern struct inode_operations page_symlink_inode_operations;
+extern int generic_readlink(struct dentry *, char __user *, int);
 extern void generic_fillattr(struct inode *, struct kstat *);
 extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
 void inode_add_bytes(struct inode *inode, loff_t bytes);