]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - include/linux/fs.h
fs: introduce inode operation ->update_time
[mirror_ubuntu-zesty-kernel.git] / include / linux / fs.h
index 25c40b9f848afeac9313be994c6e8ad03683a0c5..57fc70574d20688caa4d3c23102bbf0f0af16c4f 100644 (file)
@@ -402,6 +402,7 @@ struct inodes_stat_t {
 #include <linux/atomic.h>
 #include <linux/shrinker.h>
 #include <linux/migrate_mode.h>
+#include <linux/uidgid.h>
 
 #include <asm/byteorder.h>
 
@@ -469,8 +470,8 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
 struct iattr {
        unsigned int    ia_valid;
        umode_t         ia_mode;
-       uid_t           ia_uid;
-       gid_t           ia_gid;
+       kuid_t          ia_uid;
+       kgid_t          ia_gid;
        loff_t          ia_size;
        struct timespec ia_atime;
        struct timespec ia_mtime;
@@ -761,8 +762,8 @@ struct posix_acl;
 struct inode {
        umode_t                 i_mode;
        unsigned short          i_opflags;
-       uid_t                   i_uid;
-       gid_t                   i_gid;
+       kuid_t                  i_uid;
+       kgid_t                  i_gid;
        unsigned int            i_flags;
 
 #ifdef CONFIG_FS_POSIX_ACL
@@ -927,6 +928,31 @@ static inline void i_size_write(struct inode *inode, loff_t i_size)
 #endif
 }
 
+/* Helper functions so that in most cases filesystems will
+ * not need to deal directly with kuid_t and kgid_t and can
+ * instead deal with the raw numeric values that are stored
+ * in the filesystem.
+ */
+static inline uid_t i_uid_read(const struct inode *inode)
+{
+       return from_kuid(&init_user_ns, inode->i_uid);
+}
+
+static inline gid_t i_gid_read(const struct inode *inode)
+{
+       return from_kgid(&init_user_ns, inode->i_gid);
+}
+
+static inline void i_uid_write(struct inode *inode, uid_t uid)
+{
+       inode->i_uid = make_kuid(&init_user_ns, uid);
+}
+
+static inline void i_gid_write(struct inode *inode, gid_t gid)
+{
+       inode->i_gid = make_kgid(&init_user_ns, gid);
+}
+
 static inline unsigned iminor(const struct inode *inode)
 {
        return MINOR(inode->i_rdev);
@@ -943,7 +969,7 @@ struct fown_struct {
        rwlock_t lock;          /* protects pid, uid, euid fields */
        struct pid *pid;        /* pid or -pgrp where SIGIO should be sent */
        enum pid_type pid_type; /* Kind of process group SIGIO should be sent to */
-       uid_t uid, euid;        /* uid/euid of process setting the owner */
+       kuid_t uid, euid;       /* uid/euid of process setting the owner */
        int signum;             /* posix.1b rt signal to be delivered on IO */
 };
 
@@ -1527,12 +1553,6 @@ enum {
 #define vfs_check_frozen(sb, level) \
        wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level)))
 
-/*
- * until VFS tracks user namespaces for inodes, just make all files
- * belong to init_user_ns
- */
-extern struct user_namespace init_user_ns;
-#define inode_userns(inode) (&init_user_ns)
 extern bool inode_owner_or_capable(const struct inode *inode);
 
 /* not quite ready to be deprecated, but... */
@@ -1664,6 +1684,7 @@ struct inode_operations {
        void (*truncate_range)(struct inode *, loff_t, loff_t);
        int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start,
                      u64 len);
+       int (*update_time)(struct inode *, struct timespec *, int);
 } ____cacheline_aligned;
 
 struct seq_file;
@@ -1744,8 +1765,8 @@ struct super_operations {
  * I_FREEING           Set when inode is about to be freed but still has dirty
  *                     pages or buffers attached or the inode itself is still
  *                     dirty.
- * I_CLEAR             Added by end_writeback().  In this state the inode is clean
- *                     and can be destroyed.  Inode keeps I_FREEING.
+ * I_CLEAR             Added by clear_inode().  In this state the inode is
+ *                     clean and can be destroyed.  Inode keeps I_FREEING.
  *
  *                     Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are
  *                     prohibited for many purposes.  iget() must wait for
@@ -1753,9 +1774,10 @@ struct super_operations {
  *                     anew.  Other functions will just ignore such inodes,
  *                     if appropriate.  I_NEW is used for waiting.
  *
- * I_SYNC              Synchonized write of dirty inode data.  The bits is
- *                     set during data writeback, and cleared with a wakeup
- *                     on the bit address once it is done.
+ * I_SYNC              Writeback of inode is running. The bit is set during
+ *                     data writeback, and cleared with a wakeup on the bit
+ *                     address once it is done. The bit is also used to pin
+ *                     the inode in memory for flusher thread.
  *
  * I_REFERENCED                Marks the inode as recently references on the LRU list.
  *
@@ -1822,6 +1844,13 @@ static inline void inode_inc_iversion(struct inode *inode)
        spin_unlock(&inode->i_lock);
 }
 
+enum file_time_flags {
+       S_ATIME = 1,
+       S_MTIME = 2,
+       S_CTIME = 4,
+       S_VERSION = 8,
+};
+
 extern void touch_atime(struct path *);
 static inline void file_accessed(struct file *file)
 {
@@ -2329,7 +2358,7 @@ extern unsigned int get_next_ino(void);
 
 extern void __iget(struct inode * inode);
 extern void iget_failed(struct inode *);
-extern void end_writeback(struct inode *);
+extern void clear_inode(struct inode *);
 extern void __destroy_inode(struct inode *);
 extern struct inode *new_inode_pseudo(struct super_block *sb);
 extern struct inode *new_inode(struct super_block *sb);
@@ -2558,7 +2587,7 @@ extern int inode_change_ok(const struct inode *, struct iattr *);
 extern int inode_newsize_ok(const struct inode *, loff_t offset);
 extern void setattr_copy(struct inode *inode, const struct iattr *attr);
 
-extern void file_update_time(struct file *file);
+extern int file_update_time(struct file *file);
 
 extern int generic_show_options(struct seq_file *m, struct dentry *root);
 extern void save_mount_options(struct super_block *sb, char *options);