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