vnode.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* vnode.h: AFS vnode record
  2. *
  3. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #ifndef _LINUX_AFS_VNODE_H
  12. #define _LINUX_AFS_VNODE_H
  13. #include <linux/fs.h>
  14. #include "server.h"
  15. #include "kafstimod.h"
  16. #include "cache.h"
  17. #ifdef __KERNEL__
  18. struct afs_rxfs_fetch_descriptor;
  19. /*****************************************************************************/
  20. /*
  21. * vnode catalogue entry
  22. */
  23. struct afs_cache_vnode
  24. {
  25. afs_vnodeid_t vnode_id; /* vnode ID */
  26. unsigned vnode_unique; /* vnode ID uniquifier */
  27. afs_dataversion_t data_version; /* data version */
  28. };
  29. #ifdef AFS_CACHING_SUPPORT
  30. extern struct cachefs_index_def afs_vnode_cache_index_def;
  31. #endif
  32. /*****************************************************************************/
  33. /*
  34. * AFS inode private data
  35. */
  36. struct afs_vnode
  37. {
  38. struct inode vfs_inode; /* the VFS's inode record */
  39. struct afs_volume *volume; /* volume on which vnode resides */
  40. struct afs_fid fid; /* the file identifier for this inode */
  41. struct afs_file_status status; /* AFS status info for this file */
  42. #ifdef AFS_CACHING_SUPPORT
  43. struct cachefs_cookie *cache; /* caching cookie */
  44. #endif
  45. wait_queue_head_t update_waitq; /* status fetch waitqueue */
  46. unsigned update_cnt; /* number of outstanding ops that will update the
  47. * status */
  48. spinlock_t lock; /* waitqueue/flags lock */
  49. unsigned flags;
  50. #define AFS_VNODE_CHANGED 0x00000001 /* set if vnode reported changed by callback */
  51. #define AFS_VNODE_DELETED 0x00000002 /* set if vnode deleted on server */
  52. #define AFS_VNODE_MOUNTPOINT 0x00000004 /* set if vnode is a mountpoint symlink */
  53. /* outstanding callback notification on this file */
  54. struct afs_server *cb_server; /* server that made the current promise */
  55. struct list_head cb_link; /* link in server's promises list */
  56. struct list_head cb_hash_link; /* link in master callback hash */
  57. struct afs_timer cb_timeout; /* timeout on promise */
  58. unsigned cb_version; /* callback version */
  59. unsigned cb_expiry; /* callback expiry time */
  60. afs_callback_type_t cb_type; /* type of callback */
  61. };
  62. static inline struct afs_vnode *AFS_FS_I(struct inode *inode)
  63. {
  64. return container_of(inode,struct afs_vnode,vfs_inode);
  65. }
  66. static inline struct inode *AFS_VNODE_TO_I(struct afs_vnode *vnode)
  67. {
  68. return &vnode->vfs_inode;
  69. }
  70. extern int afs_vnode_fetch_status(struct afs_vnode *vnode);
  71. extern int afs_vnode_fetch_data(struct afs_vnode *vnode,
  72. struct afs_rxfs_fetch_descriptor *desc);
  73. extern int afs_vnode_give_up_callback(struct afs_vnode *vnode);
  74. extern struct afs_timer_ops afs_vnode_cb_timed_out_ops;
  75. #endif /* __KERNEL__ */
  76. #endif /* _LINUX_AFS_VNODE_H */