coda_psdev.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:4k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. #ifndef __CODA_PSDEV_H
  2. #define __CODA_PSDEV_H
  3. #define CODA_PSDEV_MAJOR 67
  4. #define MAX_CODADEVS  5    /* how many do we allow */
  5. #define CODA_SUPER_MAGIC 0x73757245
  6. struct coda_sb_info
  7. {
  8. struct venus_comm * sbi_vcomm;
  9. struct super_block *sbi_sb;
  10. struct list_head    sbi_cihead;
  11. struct semaphore    sbi_iget4_mutex;
  12. };
  13. /* communication pending/processing queues */
  14. struct venus_comm {
  15. u_long     vc_seq;
  16. wait_queue_head_t   vc_waitq; /* Venus wait queue */
  17. struct list_head    vc_pending;
  18. struct list_head    vc_processing;
  19. int                 vc_inuse;
  20. struct super_block *vc_sb;
  21. };
  22. static inline struct coda_sb_info *coda_sbp(struct super_block *sb)
  23. {
  24.     return ((struct coda_sb_info *)((sb)->u.generic_sbp));
  25. }
  26. /* upcalls */
  27. int venus_rootfid(struct super_block *sb, ViceFid *fidp);
  28. int venus_getattr(struct super_block *sb, struct ViceFid *fid, 
  29.      struct coda_vattr *attr);
  30. int venus_setattr(struct super_block *, struct ViceFid *, 
  31.      struct coda_vattr *);
  32. int venus_lookup(struct super_block *sb, struct ViceFid *fid, 
  33.     const char *name, int length, int *type, 
  34.     struct ViceFid *resfid);
  35. int venus_store(struct super_block *sb, struct ViceFid *fid, int flags,
  36. struct coda_cred *);
  37. int venus_release(struct super_block *sb, struct ViceFid *fid, int flags);
  38. int venus_close(struct super_block *sb, struct ViceFid *fid, int flags,
  39. struct coda_cred *);
  40. int venus_open(struct super_block *sb, struct ViceFid *fid,
  41. int flags, struct file **f);
  42. int venus_mkdir(struct super_block *sb, struct ViceFid *dirfid, 
  43.   const char *name, int length, 
  44.   struct ViceFid *newfid, struct coda_vattr *attrs);
  45. int venus_create(struct super_block *sb, struct ViceFid *dirfid, 
  46.     const char *name, int length, int excl, int mode, int rdev,
  47.     struct ViceFid *newfid, struct coda_vattr *attrs) ;
  48. int venus_rmdir(struct super_block *sb, struct ViceFid *dirfid, 
  49.     const char *name, int length);
  50. int venus_remove(struct super_block *sb, struct ViceFid *dirfid, 
  51.  const char *name, int length);
  52. int venus_readlink(struct super_block *sb, struct ViceFid *fid, 
  53.    char *buffer, int *length);
  54. int venus_rename(struct super_block *, struct ViceFid *new_fid, 
  55.  struct ViceFid *old_fid, size_t old_length, 
  56.  size_t new_length, const char *old_name, 
  57.  const char *new_name);
  58. int venus_link(struct super_block *sb, struct ViceFid *fid, 
  59.   struct ViceFid *dirfid, const char *name, int len );
  60. int venus_symlink(struct super_block *sb, struct ViceFid *fid,
  61.   const char *name, int len, const char *symname, int symlen);
  62. int venus_access(struct super_block *sb, struct ViceFid *fid, int mask);
  63. int venus_pioctl(struct super_block *sb, struct ViceFid *fid,
  64.  unsigned int cmd, struct PioctlData *data);
  65. int coda_downcall(int opcode, union outputArgs *out, struct super_block *sb);
  66. int venus_fsync(struct super_block *sb, struct ViceFid *fid);
  67. int venus_statfs(struct super_block *sb, struct statfs *sfs);
  68. /* messages between coda filesystem in kernel and Venus */
  69. extern int coda_hard;
  70. extern unsigned long coda_timeout;
  71. struct upc_req {
  72. struct list_head    uc_chain;
  73. caddr_t             uc_data;
  74. u_short             uc_flags;
  75. u_short             uc_inSize;  /* Size is at most 5000 bytes */
  76. u_short             uc_outSize;
  77. u_short             uc_opcode;  /* copied from data to save lookup */
  78. int     uc_unique;
  79. wait_queue_head_t   uc_sleep;   /* process' wait queue */
  80. unsigned long       uc_posttime;
  81. };
  82. #define REQ_ASYNC  0x1
  83. #define REQ_READ   0x2
  84. #define REQ_WRITE  0x4
  85. #define REQ_ABORT  0x8
  86. /*
  87.  * Statistics
  88.  */
  89. struct coda_upcallstats {
  90. int ncalls; /* client requests */
  91. int nbadcalls; /* upcall failures */
  92. int reqs[CODA_NCALLS]; /* count of each request */
  93. } ;
  94. extern struct coda_upcallstats coda_callstats;
  95. extern struct venus_comm coda_comms[];
  96. static inline void clstats(int opcode)
  97. {
  98.     coda_callstats.ncalls++;
  99.     if ( (0 <= opcode) && (opcode <= CODA_NCALLS) )
  100. coda_callstats.reqs[opcode]++;
  101.     else
  102. printk("clstats called with bad opcode %dn", opcode); 
  103. }
  104. static inline void badclstats(void)
  105. {
  106.     coda_callstats.nbadcalls++;
  107. }
  108. #endif