fid.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * V9FS FID Management
  3. *
  4. * Copyright (C) 2005 by Eric Van Hensbergen <ericvh@gmail.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2
  8. * as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to:
  17. * Free Software Foundation
  18. * 51 Franklin Street, Fifth Floor
  19. * Boston, MA 02111-1301 USA
  20. *
  21. */
  22. #include <linux/list.h>
  23. #define FID_OP 0
  24. #define FID_WALK 1
  25. #define FID_CREATE 2
  26. struct v9fs_fid {
  27. struct list_head list; /* list of fids associated with a dentry */
  28. struct list_head active; /* XXX - debug */
  29. struct semaphore lock;
  30. u32 fid;
  31. unsigned char fidopen; /* set when fid is opened */
  32. unsigned char fidclunked; /* set when fid has already been clunked */
  33. struct v9fs_qid qid;
  34. u32 iounit;
  35. /* readdir stuff */
  36. int rdir_fpos;
  37. loff_t rdir_pos;
  38. struct v9fs_fcall *rdir_fcall;
  39. /* management stuff */
  40. uid_t uid; /* user associated with this fid */
  41. /* private data */
  42. struct file *filp; /* backpointer to File struct for open files */
  43. struct v9fs_session_info *v9ses; /* session info for this FID */
  44. };
  45. struct v9fs_fid *v9fs_fid_lookup(struct dentry *dentry);
  46. struct v9fs_fid *v9fs_fid_get_created(struct dentry *);
  47. void v9fs_fid_destroy(struct v9fs_fid *fid);
  48. struct v9fs_fid *v9fs_fid_create(struct v9fs_session_info *, int fid);
  49. int v9fs_fid_insert(struct v9fs_fid *fid, struct dentry *dentry);
  50. struct v9fs_fid *v9fs_fid_clone(struct dentry *dentry);
  51. void v9fs_fid_clunk(struct v9fs_session_info *v9ses, struct v9fs_fid *fid);