Remove sysctl.h from fs.h
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / linux / fs.h
index 9562a59b3703132302a01d8bd6e481345c001f21..8b3580d0664e41f63d0a2d6cfd32a59ac99c97d5 100644 (file)
@@ -283,7 +283,6 @@ extern int dir_notify_enable;
 #include <linux/init.h>
 #include <linux/pid.h>
 #include <linux/mutex.h>
-#include <linux/sysctl.h>
 #include <linux/capability.h>
 
 #include <asm/atomic.h>
@@ -381,7 +380,7 @@ struct iattr {
  *                     trying again.  The aop will be taking reasonable
  *                     precautions not to livelock.  If the caller held a page
  *                     reference, it should drop it before retrying.  Returned
- *                     by readpage(), prepare_write(), and commit_write().
+ *                     by readpage().
  *
  * address_space_operation functions return these large constants to indicate
  * special semantics to the caller.  These are much larger than the bytes in a
@@ -394,6 +393,9 @@ enum positive_aop_returns {
        AOP_TRUNCATED_PAGE      = 0x80001,
 };
 
+#define AOP_FLAG_UNINTERRUPTIBLE       0x0001 /* will not do a short write */
+#define AOP_FLAG_CONT_EXPAND           0x0002 /* called from cont_expand */
+
 /*
  * oh the beauties of C type declarations.
  */
@@ -401,6 +403,39 @@ struct page;
 struct address_space;
 struct writeback_control;
 
+struct iov_iter {
+       const struct iovec *iov;
+       unsigned long nr_segs;
+       size_t iov_offset;
+       size_t count;
+};
+
+size_t iov_iter_copy_from_user_atomic(struct page *page,
+               struct iov_iter *i, unsigned long offset, size_t bytes);
+size_t iov_iter_copy_from_user(struct page *page,
+               struct iov_iter *i, unsigned long offset, size_t bytes);
+void iov_iter_advance(struct iov_iter *i, size_t bytes);
+int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes);
+size_t iov_iter_single_seg_count(struct iov_iter *i);
+
+static inline void iov_iter_init(struct iov_iter *i,
+                       const struct iovec *iov, unsigned long nr_segs,
+                       size_t count, size_t written)
+{
+       i->iov = iov;
+       i->nr_segs = nr_segs;
+       i->iov_offset = 0;
+       i->count = count + written;
+
+       iov_iter_advance(i, written);
+}
+
+static inline size_t iov_iter_count(struct iov_iter *i)
+{
+       return i->count;
+}
+
+
 struct address_space_operations {
        int (*writepage)(struct page *page, struct writeback_control *wbc);
        int (*readpage)(struct file *, struct page *);
@@ -421,6 +456,14 @@ struct address_space_operations {
         */
        int (*prepare_write)(struct file *, struct page *, unsigned, unsigned);
        int (*commit_write)(struct file *, struct page *, unsigned, unsigned);
+
+       int (*write_begin)(struct file *, struct address_space *mapping,
+                               loff_t pos, unsigned len, unsigned flags,
+                               struct page **pagep, void **fsdata);
+       int (*write_end)(struct file *, struct address_space *mapping,
+                               loff_t pos, unsigned len, unsigned copied,
+                               struct page *page, void *fsdata);
+
        /* Unfortunately this kludge is needed for FIBMAP. Don't use it */
        sector_t (*bmap)(struct address_space *, sector_t);
        void (*invalidatepage) (struct page *, unsigned long);
@@ -435,6 +478,18 @@ struct address_space_operations {
        int (*launder_page) (struct page *);
 };
 
+/*
+ * pagecache_write_begin/pagecache_write_end must be used by general code
+ * to write into the pagecache.
+ */
+int pagecache_write_begin(struct file *, struct address_space *mapping,
+                               loff_t pos, unsigned len, unsigned flags,
+                               struct page **pagep, void **fsdata);
+
+int pagecache_write_end(struct file *, struct address_space *mapping,
+                               loff_t pos, unsigned len, unsigned copied,
+                               struct page *page, void *fsdata);
+
 struct backing_dev_info;
 struct address_space {
        struct inode            *host;          /* owner: inode, block_device */
@@ -697,20 +752,24 @@ struct fown_struct {
  * Track a single file's readahead state
  */
 struct file_ra_state {
-       unsigned long start;            /* Current window */
-       unsigned long size;
-       unsigned long flags;            /* ra flags RA_FLAG_xxx*/
-       unsigned long cache_hit;        /* cache hit count*/
-       unsigned long prev_index;       /* Cache last read() position */
-       unsigned long ahead_start;      /* Ahead window */
-       unsigned long ahead_size;
-       unsigned long ra_pages;         /* Maximum readahead window */
-       unsigned long mmap_hit;         /* Cache hit stat for mmap accesses */
-       unsigned long mmap_miss;        /* Cache miss stat for mmap accesses */
-       unsigned int prev_offset;       /* Offset where last read() ended in a page */
+       pgoff_t start;                  /* where readahead started */
+       unsigned int size;              /* # of readahead pages */
+       unsigned int async_size;        /* do asynchronous readahead when
+                                          there are only # of pages ahead */
+
+       unsigned int ra_pages;          /* Maximum readahead window */
+       int mmap_miss;                  /* Cache miss stat for mmap accesses */
+       loff_t prev_pos;                /* Cache last read() position */
 };
-#define RA_FLAG_MISS 0x01      /* a cache miss occured against this file */
-#define RA_FLAG_INCACHE 0x02   /* file is already in cache */
+
+/*
+ * Check if @index falls in the readahead windows.
+ */
+static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index)
+{
+       return (index >= ra->start &&
+               index <  ra->start + ra->size);
+}
 
 struct file {
        /*
@@ -872,11 +931,12 @@ extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
 extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
 extern int __break_lease(struct inode *inode, unsigned int flags);
 extern void lease_get_mtime(struct inode *, struct timespec *time);
-extern int setlease(struct file *, long, struct file_lock **);
+extern int generic_setlease(struct file *, long, struct file_lock **);
 extern int vfs_setlease(struct file *, long, struct file_lock **);
 extern int lease_modify(struct file_lock **, int);
 extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
 extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
+extern struct seq_operations locks_seq_operations;
 
 struct fasync_struct {
        int     magic;
@@ -1296,8 +1356,14 @@ struct file_system_type {
        struct module *owner;
        struct file_system_type * next;
        struct list_head fs_supers;
+
        struct lock_class_key s_lock_key;
        struct lock_class_key s_umount_key;
+
+       struct lock_class_key i_lock_key;
+       struct lock_class_key i_mutex_key;
+       struct lock_class_key i_mutex_dir_key;
+       struct lock_class_key i_alloc_sem_key;
 };
 
 extern int get_sb_bdev(struct file_system_type *fs_type,
@@ -1363,12 +1429,25 @@ extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size
  * Candidates for mandatory locking have the setgid bit set
  * but no group execute bit -  an otherwise meaningless combination.
  */
-#define MANDATORY_LOCK(inode) \
-       (IS_MANDLOCK(inode) && ((inode)->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
+
+static inline int __mandatory_lock(struct inode *ino)
+{
+       return (ino->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID;
+}
+
+/*
+ * ... and these candidates should be on MS_MANDLOCK mounted fs,
+ * otherwise these will be advisory locks
+ */
+
+static inline int mandatory_lock(struct inode *ino)
+{
+       return IS_MANDLOCK(ino) && __mandatory_lock(ino);
+}
 
 static inline int locks_verify_locked(struct inode *inode)
 {
-       if (MANDATORY_LOCK(inode))
+       if (mandatory_lock(inode))
                return locks_mandatory_locked(inode);
        return 0;
 }
@@ -1379,7 +1458,7 @@ static inline int locks_verify_truncate(struct inode *inode,
                                    struct file *filp,
                                    loff_t size)
 {
-       if (inode->i_flock && MANDATORY_LOCK(inode))
+       if (inode->i_flock && mandatory_lock(inode))
                return locks_mandatory_area(
                        FLOCK_VERIFY_WRITE, inode, filp,
                        size < inode->i_size ? size : inode->i_size,
@@ -1463,7 +1542,7 @@ extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *);
 extern int register_chrdev_region(dev_t, unsigned, const char *);
 extern int register_chrdev(unsigned int, const char *,
                           const struct file_operations *);
-extern int unregister_chrdev(unsigned int, const char *);
+extern void unregister_chrdev(unsigned int, const char *);
 extern void unregister_chrdev_region(dev_t, unsigned);
 extern int chrdev_open(struct inode *, struct file *);
 extern void chrdev_show(struct seq_file *,off_t);
@@ -1653,7 +1732,6 @@ extern int sb_min_blocksize(struct super_block *, int);
 extern int generic_file_mmap(struct file *, struct vm_area_struct *);
 extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
 extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
-extern int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
 int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
 extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t);
 extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t);
@@ -1810,6 +1888,12 @@ extern int simple_prepare_write(struct file *file, struct page *page,
                        unsigned offset, unsigned to);
 extern int simple_commit_write(struct file *file, struct page *page,
                                unsigned offset, unsigned to);
+extern int simple_write_begin(struct file *file, struct address_space *mapping,
+                       loff_t pos, unsigned len, unsigned flags,
+                       struct page **pagep, void **fsdata);
+extern int simple_write_end(struct file *file, struct address_space *mapping,
+                       loff_t pos, unsigned len, unsigned copied,
+                       struct page *page, void *fsdata);
 
 extern struct dentry *simple_lookup(struct inode *, struct dentry *, struct nameidata *);
 extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);
@@ -1947,7 +2031,8 @@ static inline void free_secdata(void *secdata)
 { }
 #endif /* CONFIG_SECURITY */
 
-int proc_nr_files(ctl_table *table, int write, struct file *filp,
+struct ctl_table;
+int proc_nr_files(struct ctl_table *table, int write, struct file *filp,
                  void __user *buffer, size_t *lenp, loff_t *ppos);