Import 2.3.10pre5
[davej-history.git] / include / linux / coda_psdev.h
blobf23a8e9b9c82fdcdda3ee5b3ed6d763bb9d5dffd
1 #ifndef __CODA_PSDEV_H
2 #define __CODA_PSDEV_H
4 #define CODA_PSDEV_MAJOR 67
5 #define MAX_CODADEVS 5 /* how many do we allow */
7 extern struct venus_comm coda_upc_comm;
8 extern struct coda_sb_info coda_super_info;
9 #define CODA_SUPER_MAGIC 0x73757245
11 struct coda_sb_info
13 struct inode * sbi_psdev; /* /dev/cfs? Venus/kernel device */
14 struct inode * sbi_ctlcp; /* control magic file */
15 int sbi_refct;
16 struct venus_comm * sbi_vcomm;
17 struct inode * sbi_root;
18 struct super_block *sbi_sb;
19 struct list_head sbi_cchead;
20 struct list_head sbi_volroothead;
23 /* communication pending/processing queues */
24 struct venus_comm {
25 u_long vc_seq;
26 wait_queue_head_t vc_waitq; /* Venus wait queue */
27 struct list_head vc_pending;
28 struct list_head vc_processing;
29 int vc_inuse;
30 pid_t vc_pid; /* Venus pid */
34 static inline struct coda_sb_info *coda_sbp(struct super_block *sb)
36 return ((struct coda_sb_info *)((sb)->u.generic_sbp));
41 extern void coda_psdev_detach(int unit);
42 extern int init_coda_psdev(void);
45 /* upcalls */
46 int venus_rootfid(struct super_block *sb, ViceFid *fidp);
47 int venus_getattr(struct super_block *sb, struct ViceFid *fid,
48 struct coda_vattr *attr);
49 int venus_setattr(struct super_block *, struct ViceFid *,
50 struct coda_vattr *);
51 int venus_lookup(struct super_block *sb, struct ViceFid *fid,
52 const char *name, int length, int *type,
53 struct ViceFid *resfid);
54 int venus_release(struct super_block *sb, struct ViceFid *fid, int flags,
55 struct coda_cred *);
56 int venus_open(struct super_block *sb, struct ViceFid *fid,
57 int flags, ino_t *ino, dev_t *dev);
58 int venus_mkdir(struct super_block *sb, struct ViceFid *dirfid,
59 const char *name, int length,
60 struct ViceFid *newfid, struct coda_vattr *attrs);
61 int venus_create(struct super_block *sb, struct ViceFid *dirfid,
62 const char *name, int length, int excl, int mode, int rdev,
63 struct ViceFid *newfid, struct coda_vattr *attrs) ;
64 int venus_rmdir(struct super_block *sb, struct ViceFid *dirfid,
65 const char *name, int length);
66 int venus_remove(struct super_block *sb, struct ViceFid *dirfid,
67 const char *name, int length);
68 int venus_readlink(struct super_block *sb, struct ViceFid *fid,
69 char *buffer, int *length);
70 int venus_rename(struct super_block *, struct ViceFid *new_fid,
71 struct ViceFid *old_fid, size_t old_length,
72 size_t new_length, const char *old_name,
73 const char *new_name);
74 int venus_link(struct super_block *sb, struct ViceFid *fid,
75 struct ViceFid *dirfid, const char *name, int len );
76 int venus_symlink(struct super_block *sb, struct ViceFid *fid,
77 const char *name, int len, const char *symname, int symlen);
78 int venus_access(struct super_block *sb, struct ViceFid *fid, int mask);
79 int venus_pioctl(struct super_block *sb, struct ViceFid *fid,
80 unsigned int cmd, struct PioctlData *data);
81 int coda_downcall(int opcode, union outputArgs *out, struct super_block *sb);
82 int venus_fsync(struct super_block *sb, struct ViceFid *fid);
83 int venus_statfs(struct super_block *sb, struct statfs *sfs);
86 /* messages between coda filesystem in kernel and Venus */
87 extern int coda_hard;
88 extern unsigned long coda_timeout;
89 struct upc_req {
90 struct list_head uc_chain;
91 caddr_t uc_data;
92 u_short uc_flags;
93 u_short uc_inSize; /* Size is at most 5000 bytes */
94 u_short uc_outSize;
95 u_short uc_opcode; /* copied from data to save lookup */
96 int uc_unique;
97 wait_queue_head_t uc_sleep; /* process' wait queue */
98 unsigned long uc_posttime;
101 #define REQ_ASYNC 0x1
102 #define REQ_READ 0x2
103 #define REQ_WRITE 0x4
107 * Statistics
109 struct coda_upcallstats {
110 int ncalls; /* client requests */
111 int nbadcalls; /* upcall failures */
112 int reqs[CODA_NCALLS]; /* count of each request */
115 extern struct coda_upcallstats coda_callstats;
117 static inline void clstats(int opcode)
119 coda_callstats.ncalls++;
120 if ( (0 <= opcode) && (opcode <= CODA_NCALLS) )
121 coda_callstats.reqs[opcode]++;
122 else
123 printk("clstats called with bad opcode %d\n", opcode);
126 static inline void badclstats(void)
128 coda_callstats.nbadcalls++;
131 #endif