]> nv-tegra.nvidia Code Review - linux-3.10.git/blobdiff - fs/9p/fid.h
fs/9p: Add OS dependent open flags in 9p protocol
[linux-3.10.git] / fs / 9p / fid.h
index 84c673a44c831a3a1ec977e26b1a65d2aed82506..bb0b6e7f58fc0662525ca445d3cf4f5e4708ff24 100644 (file)
@@ -4,9 +4,8 @@
  *  Copyright (C) 2005 by Eric Van Hensbergen <ericvh@gmail.com>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  Boston, MA  02111-1301  USA
  *
  */
-
+#ifndef FS_9P_FID_H
+#define FS_9P_FID_H
 #include <linux/list.h>
 
-#define FID_OP   0
-#define FID_WALK 1
-#define FID_CREATE 2
-
-struct v9fs_fid {
-       struct list_head list;   /* list of fids associated with a dentry */
-       struct list_head active; /* XXX - debug */
-
-       u32 fid;
-       unsigned char fidopen;    /* set when fid is opened */
-       unsigned char fidcreate;  /* set when fid was just created */
-       unsigned char fidclunked; /* set when fid has already been clunked */
-
-       struct v9fs_qid qid;
-       u32 iounit;
-
-       /* readdir stuff */
-       int rdir_fpos;
-       loff_t rdir_pos;
-       struct v9fs_fcall *rdir_fcall;
-
-       /* management stuff */
-       pid_t pid;              /* thread associated with this fid */
-       uid_t uid;              /* user associated with this fid */
-
-       /* private data */
-       struct file *filp;      /* backpointer to File struct for open files */
-       struct v9fs_session_info *v9ses;        /* session info for this FID */
+/**
+ * struct v9fs_dentry - 9p private data stored in dentry d_fsdata
+ * @lock: protects the fidlist
+ * @fidlist: list of FIDs currently associated with this dentry
+ *
+ * This structure defines the 9p private data associated with
+ * a particular dentry.  In particular, this private data is used
+ * to lookup which 9P FID handle should be used for a particular VFS
+ * operation.  FID handles are associated with dentries instead of
+ * inodes in order to more closely map functionality to the Plan 9
+ * expected behavior for FID reclaimation and tracking.
+ *
+ * See Also: Mapping FIDs to Linux VFS model in
+ * Design and Implementation of the Linux 9P File System documentation
+ */
+struct v9fs_dentry {
+       spinlock_t lock; /* protect fidlist */
+       struct list_head fidlist;
 };
 
-struct v9fs_fid *v9fs_fid_lookup(struct dentry *dentry);
-struct v9fs_fid *v9fs_fid_get_created(struct dentry *);
-void v9fs_fid_destroy(struct v9fs_fid *fid);
-struct v9fs_fid *v9fs_fid_create(struct dentry *,
-       struct v9fs_session_info *v9ses, int fid, int create);
+struct p9_fid *v9fs_fid_lookup(struct dentry *dentry);
+struct p9_fid *v9fs_fid_clone(struct dentry *dentry);
+int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid);
+struct p9_fid *v9fs_writeback_fid(struct dentry *dentry);
+#endif