proc: protect mm start_code/end_code in /proc/pid/stat
[firefly-linux-kernel-4.4.55.git] / fs / 9p / v9fs.h
index 21bd803a3cc0e84c541e85de037c670c38902718..9665c2b840e6442a11b550f59da6ddf0ed73f256 100644 (file)
@@ -20,6 +20,9 @@
  *  Boston, MA  02111-1301  USA
  *
  */
+#ifndef FS_9P_V9FS_H
+#define FS_9P_V9FS_H
+
 #include <linux/backing-dev.h>
 
 /**
@@ -116,6 +119,26 @@ struct v9fs_session_info {
        struct p9_fid *root_fid; /* Used for file system sync */
 };
 
+/* cache_validity flags */
+#define V9FS_INO_INVALID_ATTR 0x01
+
+struct v9fs_inode {
+#ifdef CONFIG_9P_FSCACHE
+       spinlock_t fscache_lock;
+       struct fscache_cookie *fscache;
+       struct p9_qid *fscache_key;
+#endif
+       unsigned int cache_validity;
+       struct p9_fid *writeback_fid;
+       struct mutex v_mutex;
+       struct inode vfs_inode;
+};
+
+static inline struct v9fs_inode *V9FS_I(const struct inode *inode)
+{
+       return container_of(inode, struct v9fs_inode, vfs_inode);
+}
+
 struct p9_fid *v9fs_session_init(struct v9fs_session_info *, const char *,
                                                                        char *);
 extern void v9fs_session_close(struct v9fs_session_info *v9ses);
@@ -129,16 +152,15 @@ extern int v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
                        struct inode *new_dir, struct dentry *new_dentry);
 extern void v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd,
                        void *p);
-extern struct inode *v9fs_inode(struct v9fs_session_info *v9ses,
-                       struct p9_fid *fid,
-                       struct super_block *sb);
-
+extern struct inode *v9fs_inode_from_fid(struct v9fs_session_info *v9ses,
+                                        struct p9_fid *fid,
+                                        struct super_block *sb);
 extern const struct inode_operations v9fs_dir_inode_operations_dotl;
 extern const struct inode_operations v9fs_file_inode_operations_dotl;
 extern const struct inode_operations v9fs_symlink_inode_operations_dotl;
-extern struct inode *v9fs_inode_dotl(struct v9fs_session_info *v9ses,
-                       struct p9_fid *fid,
-                       struct super_block *sb);
+extern struct inode *v9fs_inode_from_fid_dotl(struct v9fs_session_info *v9ses,
+                                             struct p9_fid *fid,
+                                             struct super_block *sb);
 
 /* other default globals */
 #define V9FS_PORT      564
@@ -152,6 +174,11 @@ static inline struct v9fs_session_info *v9fs_inode2v9ses(struct inode *inode)
        return (inode->i_sb->s_fs_info);
 }
 
+static inline struct v9fs_session_info *v9fs_dentry2v9ses(struct dentry *dentry)
+{
+       return dentry->d_sb->s_fs_info;
+}
+
 static inline int v9fs_proto_dotu(struct v9fs_session_info *v9ses)
 {
        return v9ses->flags & V9FS_PROTO_2000U;
@@ -163,7 +190,7 @@ static inline int v9fs_proto_dotl(struct v9fs_session_info *v9ses)
 }
 
 /**
- * v9fs_inode_from_fid - Helper routine to populate an inode by
+ * v9fs_get_inode_from_fid - Helper routine to populate an inode by
  * issuing a attribute request
  * @v9ses: session information
  * @fid: fid to issue attribute request for
@@ -171,11 +198,12 @@ static inline int v9fs_proto_dotl(struct v9fs_session_info *v9ses)
  *
  */
 static inline struct inode *
-v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid,
-                               struct super_block *sb)
+v9fs_get_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid,
+                       struct super_block *sb)
 {
        if (v9fs_proto_dotl(v9ses))
-               return v9fs_inode_dotl(v9ses, fid, sb);
+               return v9fs_inode_from_fid_dotl(v9ses, fid, sb);
        else
-               return v9fs_inode(v9ses, fid, sb);
+               return v9fs_inode_from_fid(v9ses, fid, sb);
 }
+#endif