xref: /minix3/minix/servers/vfs/proto.h (revision 89a4204b834be50e122142546a0287cd5586c9d6)
1433d6423SLionel Sambuc #ifndef __VFS_PROTO_H__
2433d6423SLionel Sambuc #define __VFS_PROTO_H__
3433d6423SLionel Sambuc 
4433d6423SLionel Sambuc /* Function prototypes. */
5433d6423SLionel Sambuc 
6433d6423SLionel Sambuc #include <minix/rs.h>
7433d6423SLionel Sambuc #include <minix/timers.h>
8433d6423SLionel Sambuc 
9433d6423SLionel Sambuc #include "request.h"
10433d6423SLionel Sambuc #include "threads.h"
11433d6423SLionel Sambuc #include "tll.h"
12433d6423SLionel Sambuc 
13433d6423SLionel Sambuc /* Structs used in prototypes must be declared as such first. */
14433d6423SLionel Sambuc struct filp;
15433d6423SLionel Sambuc struct fproc;
16433d6423SLionel Sambuc struct timespec;
17433d6423SLionel Sambuc struct vmnt;
18433d6423SLionel Sambuc struct vnode;
19433d6423SLionel Sambuc struct lookup;
20433d6423SLionel Sambuc struct worker_thread;
21433d6423SLionel Sambuc struct job;
22433d6423SLionel Sambuc 
23*89a4204bSDavid van Moolenbroek /* bdev.c */
24*89a4204bSDavid van Moolenbroek int bdev_open(dev_t dev, int access);
25*89a4204bSDavid van Moolenbroek int bdev_close(dev_t dev);
26*89a4204bSDavid van Moolenbroek int bdev_ioctl(dev_t dev, endpoint_t proc_e, unsigned long req, vir_bytes buf);
27*89a4204bSDavid van Moolenbroek void bdev_reply(void);
28*89a4204bSDavid van Moolenbroek void bdev_up(devmajor_t major);
29*89a4204bSDavid van Moolenbroek 
30*89a4204bSDavid van Moolenbroek /* cdev.c */
31*89a4204bSDavid van Moolenbroek dev_t cdev_map(dev_t dev, struct fproc *rfp);
32*89a4204bSDavid van Moolenbroek int cdev_open(int fd, dev_t dev, int flags);
33*89a4204bSDavid van Moolenbroek int cdev_close(dev_t dev);
34*89a4204bSDavid van Moolenbroek int cdev_io(int op, dev_t dev, endpoint_t proc_e, vir_bytes buf, off_t pos,
35*89a4204bSDavid van Moolenbroek 	unsigned long bytes, int flags);
36*89a4204bSDavid van Moolenbroek int cdev_select(dev_t dev, int ops);
37*89a4204bSDavid van Moolenbroek int cdev_cancel(dev_t dev, endpoint_t endpt, cp_grant_id_t grant);
38*89a4204bSDavid van Moolenbroek void cdev_reply(void);
39*89a4204bSDavid van Moolenbroek 
40433d6423SLionel Sambuc /* comm.c */
41433d6423SLionel Sambuc int drv_sendrec(endpoint_t drv_e, message *reqm);
42433d6423SLionel Sambuc void fs_cancel(struct vmnt *vmp);
43433d6423SLionel Sambuc int fs_sendrec(endpoint_t fs_e, message *reqm);
44433d6423SLionel Sambuc int vm_sendrec(message *reqm);
45433d6423SLionel Sambuc void fs_sendmore(struct vmnt *vmp);
46433d6423SLionel Sambuc void send_work(void);
47433d6423SLionel Sambuc int vm_vfs_procctl_handlemem(endpoint_t ep, vir_bytes mem, vir_bytes len, int flags);
48433d6423SLionel Sambuc 
49433d6423SLionel Sambuc /* device.c */
50433d6423SLionel Sambuc int do_ioctl(void);
51*89a4204bSDavid van Moolenbroek cp_grant_id_t make_ioctl_grant(endpoint_t driver_e, endpoint_t user_e,
52*89a4204bSDavid van Moolenbroek 	vir_bytes buf, unsigned long request);
53433d6423SLionel Sambuc 
54433d6423SLionel Sambuc /* dmap.c */
55433d6423SLionel Sambuc void lock_dmap(struct dmap *dp);
56433d6423SLionel Sambuc void unlock_dmap(struct dmap *dp);
57433d6423SLionel Sambuc int do_mapdriver(void);
58433d6423SLionel Sambuc void init_dmap(void);
593b468884SDavid van Moolenbroek int dmap_driver_match(endpoint_t proc, devmajor_t major);
60433d6423SLionel Sambuc void dmap_endpt_up(endpoint_t proc_nr, int is_blk);
61433d6423SLionel Sambuc struct dmap *get_dmap(endpoint_t proc_e);
623b468884SDavid van Moolenbroek struct dmap *get_dmap_by_major(devmajor_t major);
63433d6423SLionel Sambuc void dmap_unmap_by_endpt(endpoint_t proc_nr);
64433d6423SLionel Sambuc int map_service(struct rprocpub *rpub);
65433d6423SLionel Sambuc 
66433d6423SLionel Sambuc /* elf_core_dump.c */
67433d6423SLionel Sambuc void write_elf_core_file(struct filp *f, int csig, char *exe_name);
68433d6423SLionel Sambuc 
69433d6423SLionel Sambuc /* exec.c */
70433d6423SLionel Sambuc int pm_exec(vir_bytes path, size_t path_len, vir_bytes frame, size_t frame_len,
71433d6423SLionel Sambuc 	vir_bytes *pc, vir_bytes *newsp, vir_bytes *ps_str);
72433d6423SLionel Sambuc 
73433d6423SLionel Sambuc /* filedes.c */
74433d6423SLionel Sambuc void check_filp_locks(void);
75433d6423SLionel Sambuc void check_filp_locks_by_me(void);
76433d6423SLionel Sambuc void init_filps(void);
77433d6423SLionel Sambuc struct filp *find_filp(struct vnode *vp, mode_t bits);
78433d6423SLionel Sambuc int get_fd(struct fproc *rfp, int start, mode_t bits, int *k,
79433d6423SLionel Sambuc 	struct filp **fpt);
80433d6423SLionel Sambuc struct filp *get_filp(int fild, tll_access_t locktype);
81433d6423SLionel Sambuc struct filp *get_filp2(struct fproc *rfp, int fild, tll_access_t locktype);
82433d6423SLionel Sambuc void lock_filp(struct filp *filp, tll_access_t locktype);
83433d6423SLionel Sambuc void unlock_filp(struct filp *filp);
84433d6423SLionel Sambuc void unlock_filps(struct filp *filp1, struct filp *filp2);
85433d6423SLionel Sambuc void invalidate_filp(struct filp *);
86433d6423SLionel Sambuc void invalidate_filp_by_endpt(endpoint_t proc_e);
873b468884SDavid van Moolenbroek void invalidate_filp_by_char_major(devmajor_t major);
88433d6423SLionel Sambuc void close_filp(struct filp *fp);
89433d6423SLionel Sambuc int do_copyfd(void);
90433d6423SLionel Sambuc 
91433d6423SLionel Sambuc /* fscall.c */
92433d6423SLionel Sambuc void nested_fs_call(message *m);
93433d6423SLionel Sambuc 
94433d6423SLionel Sambuc /* link.c */
95433d6423SLionel Sambuc int do_link(void);
96433d6423SLionel Sambuc int do_unlink(void);
97433d6423SLionel Sambuc int do_rename(void);
98433d6423SLionel Sambuc int do_truncate(void);
99433d6423SLionel Sambuc int do_ftruncate(void);
100433d6423SLionel Sambuc int truncate_vnode(struct vnode *vp, off_t newsize);
101433d6423SLionel Sambuc int rdlink_direct(char *orig_path, char *link_path, struct fproc *rfp);
102433d6423SLionel Sambuc 
103433d6423SLionel Sambuc /* lock.c */
104232819ddSDavid van Moolenbroek int lock_op(int fd, int req, vir_bytes arg);
105433d6423SLionel Sambuc void lock_revive(void);
106433d6423SLionel Sambuc 
107433d6423SLionel Sambuc /* main.c */
108433d6423SLionel Sambuc int main(void);
109433d6423SLionel Sambuc void lock_proc(struct fproc *rfp);
110433d6423SLionel Sambuc void unlock_proc(struct fproc *rfp);
111433d6423SLionel Sambuc void replycode(endpoint_t whom, int result);
112433d6423SLionel Sambuc void service_pm_postponed(void);
113433d6423SLionel Sambuc void thread_cleanup(void);
114433d6423SLionel Sambuc 
115433d6423SLionel Sambuc /* misc.c */
116433d6423SLionel Sambuc void pm_exit(void);
117433d6423SLionel Sambuc int do_fcntl(void);
118433d6423SLionel Sambuc void pm_fork(endpoint_t pproc, endpoint_t cproc, pid_t cpid);
119433d6423SLionel Sambuc void pm_setgid(endpoint_t proc_e, int egid, int rgid);
120433d6423SLionel Sambuc void pm_setuid(endpoint_t proc_e, int euid, int ruid);
121433d6423SLionel Sambuc void pm_setgroups(endpoint_t proc_e, int ngroups, gid_t *addr);
122433d6423SLionel Sambuc void pm_setsid(endpoint_t proc_e);
123433d6423SLionel Sambuc int do_sync(void);
124433d6423SLionel Sambuc int do_fsync(void);
125433d6423SLionel Sambuc void pm_reboot(void);
126433d6423SLionel Sambuc int do_svrctl(void);
127433d6423SLionel Sambuc int do_getsysinfo(void);
128433d6423SLionel Sambuc int do_vm_call(void);
129433d6423SLionel Sambuc int pm_dumpcore(int sig, vir_bytes exe_name);
130433d6423SLionel Sambuc void ds_event(void);
131433d6423SLionel Sambuc int dupvm(struct fproc *fp, int pfd, int *vmfd, struct filp **f);
132433d6423SLionel Sambuc int do_getrusage(void);
133433d6423SLionel Sambuc 
134433d6423SLionel Sambuc /* mount.c */
135433d6423SLionel Sambuc int do_mount(void);
136433d6423SLionel Sambuc int do_umount(void);
137433d6423SLionel Sambuc int is_nonedev(dev_t dev);
138433d6423SLionel Sambuc void mount_pfs(void);
139433d6423SLionel Sambuc int mount_fs(dev_t dev, char mount_dev[PATH_MAX], char mount_path[PATH_MAX],
140433d6423SLionel Sambuc 	endpoint_t fs_e, int rdonly, char mount_type[FSTYPE_MAX],
141433d6423SLionel Sambuc 	char mount_label[LABEL_MAX]);
142433d6423SLionel Sambuc int unmount(dev_t dev, char label[LABEL_MAX]);
143433d6423SLionel Sambuc void unmount_all(int force);
144433d6423SLionel Sambuc 
145433d6423SLionel Sambuc /* open.c */
146433d6423SLionel Sambuc int do_close(void);
147433d6423SLionel Sambuc int close_fd(struct fproc *rfp, int fd_nr);
14856ac45c1SDavid van Moolenbroek int common_open(char path[PATH_MAX], int oflags, mode_t omode, int for_exec);
149433d6423SLionel Sambuc int do_creat(void);
150433d6423SLionel Sambuc int do_lseek(void);
151433d6423SLionel Sambuc int do_mknod(void);
152433d6423SLionel Sambuc int do_mkdir(void);
153433d6423SLionel Sambuc int do_open(void);
154433d6423SLionel Sambuc int do_creat(void);
155433d6423SLionel Sambuc int do_slink(void);
156433d6423SLionel Sambuc int actual_lseek(struct fproc *rfp, int seekfd, int seekwhence, off_t offset,
157433d6423SLionel Sambuc 	off_t *newposp);
158433d6423SLionel Sambuc 
159433d6423SLionel Sambuc /* path.c */
160433d6423SLionel Sambuc struct vnode *advance(struct vnode *dirp, struct lookup *resolve, struct
161433d6423SLionel Sambuc 	fproc *rfp);
162433d6423SLionel Sambuc struct vnode *eat_path(struct lookup *resolve, struct fproc *rfp);
163433d6423SLionel Sambuc struct vnode *last_dir(struct lookup *resolve, struct fproc *rfp);
164433d6423SLionel Sambuc void lookup_init(struct lookup *resolve, char *path, int flags, struct
165433d6423SLionel Sambuc 	vmnt **vmp, struct vnode **vp);
166433d6423SLionel Sambuc int get_name(struct vnode *dirp, struct vnode *entry, char *_name);
167433d6423SLionel Sambuc int canonical_path(char *orig_path, struct fproc *rfp);
168433d6423SLionel Sambuc int do_checkperms(void);
169433d6423SLionel Sambuc 
170433d6423SLionel Sambuc /* pipe.c */
171433d6423SLionel Sambuc int do_pipe2(void);
172433d6423SLionel Sambuc int map_vnode(struct vnode *vp, endpoint_t fs_e);
173433d6423SLionel Sambuc void unpause(void);
174433d6423SLionel Sambuc int pipe_check(struct filp *filp, int rw_flag, int oflags, int bytes,
175433d6423SLionel Sambuc 	int notouch);
176433d6423SLionel Sambuc void release(struct vnode *vp, int op, int count);
177433d6423SLionel Sambuc void revive(endpoint_t proc_e, int returned);
178433d6423SLionel Sambuc void suspend(int why);
179232819ddSDavid van Moolenbroek void pipe_suspend(int callnr, int fd, vir_bytes buf, size_t size,
180232819ddSDavid van Moolenbroek 	size_t cum_io);
181433d6423SLionel Sambuc void unsuspend_by_endpt(endpoint_t proc_e);
182433d6423SLionel Sambuc 
183433d6423SLionel Sambuc /* protect.c */
184433d6423SLionel Sambuc int do_access(void);
185433d6423SLionel Sambuc int do_chmod(void);
186433d6423SLionel Sambuc int do_chown(void);
187433d6423SLionel Sambuc int do_umask(void);
188433d6423SLionel Sambuc int forbidden(struct fproc *rfp, struct vnode *vp, mode_t
189433d6423SLionel Sambuc 	access_desired);
190433d6423SLionel Sambuc int read_only(struct vnode *vp);
191433d6423SLionel Sambuc 
192433d6423SLionel Sambuc /* read.c */
193433d6423SLionel Sambuc int do_read(void);
194433d6423SLionel Sambuc int do_getdents(void);
195433d6423SLionel Sambuc void lock_bsf(void);
196433d6423SLionel Sambuc void unlock_bsf(void);
197433d6423SLionel Sambuc void check_bsf_lock(void);
198433d6423SLionel Sambuc int do_read_write_peek(int rw_flag, int fd, vir_bytes buf, size_t bytes);
199232819ddSDavid van Moolenbroek int actual_read_write_peek(struct fproc *rfp, int rw_flag, int fd,
200232819ddSDavid van Moolenbroek 	vir_bytes buf, size_t bytes);
201232819ddSDavid van Moolenbroek int read_write(struct fproc *rfp, int rw_flag, int fd, struct filp *f,
202232819ddSDavid van Moolenbroek 	vir_bytes buffer, size_t nbytes, endpoint_t for_e);
203232819ddSDavid van Moolenbroek int rw_pipe(int rw_flag, endpoint_t usr, struct filp *f, int callnr, int fd,
204232819ddSDavid van Moolenbroek 	vir_bytes buf, size_t nbytes, size_t cum_io);
205433d6423SLionel Sambuc 
206433d6423SLionel Sambuc /* request.c */
207433d6423SLionel Sambuc int req_breadwrite(endpoint_t fs_e, endpoint_t user_e, dev_t dev, off_t pos,
208433d6423SLionel Sambuc 	unsigned int num_of_bytes, vir_bytes user_addr, int rw_flag,
2093c8950ccSBen Gras 	off_t *new_posp, size_t *cum_iop);
210433d6423SLionel Sambuc int req_chmod(endpoint_t fs_e, ino_t inode_nr, mode_t rmode,
211433d6423SLionel Sambuc 	mode_t *new_modep);
212433d6423SLionel Sambuc int req_chown(endpoint_t fs_e, ino_t inode_nr, uid_t newuid, gid_t newgid,
213433d6423SLionel Sambuc 	mode_t *new_modep);
214433d6423SLionel Sambuc int req_create(endpoint_t fs_e, ino_t inode_nr, int omode, uid_t uid,
215433d6423SLionel Sambuc 	gid_t gid, char *path, node_details_t *res);
216433d6423SLionel Sambuc int req_flush(endpoint_t fs_e, dev_t dev);
217433d6423SLionel Sambuc int req_statvfs(endpoint_t fs_e, struct statvfs *buf);
218433d6423SLionel Sambuc int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end);
219433d6423SLionel Sambuc int req_getdents(endpoint_t fs_e, ino_t inode_nr, off_t pos, vir_bytes buf,
220433d6423SLionel Sambuc 	size_t size, off_t *new_pos, int direct);
221433d6423SLionel Sambuc int req_inhibread(endpoint_t fs_e, ino_t inode_nr);
222433d6423SLionel Sambuc int req_link(endpoint_t fs_e, ino_t link_parent, char *lastc,
223433d6423SLionel Sambuc 	ino_t linked_file);
224433d6423SLionel Sambuc int req_lookup(endpoint_t fs_e, ino_t dir_ino, ino_t root_ino, uid_t uid,
225433d6423SLionel Sambuc 	gid_t gid, struct lookup *resolve, lookup_res_t *res,
226433d6423SLionel Sambuc 	struct fproc *rfp);
227433d6423SLionel Sambuc int req_mkdir(endpoint_t fs_e, ino_t inode_nr, char *lastc, uid_t uid,
228433d6423SLionel Sambuc 	gid_t gid, mode_t dmode);
229433d6423SLionel Sambuc int req_mknod(endpoint_t fs_e, ino_t inode_nr, char *lastc, uid_t uid,
230433d6423SLionel Sambuc 	gid_t gid, mode_t dmode, dev_t dev);
231433d6423SLionel Sambuc int req_mountpoint(endpoint_t fs_e, ino_t inode_nr);
232433d6423SLionel Sambuc int req_newnode(endpoint_t fs_e, uid_t uid, gid_t gid, mode_t dmode,
233433d6423SLionel Sambuc 	dev_t dev, struct node_details *res);
234433d6423SLionel Sambuc int req_putnode(int fs_e, ino_t inode_nr, int count);
235433d6423SLionel Sambuc int req_rdlink(endpoint_t fs_e, ino_t inode_nr, endpoint_t proc_e,
236433d6423SLionel Sambuc 	vir_bytes buf, size_t len, int direct);
237433d6423SLionel Sambuc int req_readsuper(struct vmnt *vmp, char *driver_name, dev_t dev, int readonly,
238433d6423SLionel Sambuc 	int isroot, struct node_details *res_nodep, unsigned int *fs_flags);
239433d6423SLionel Sambuc int req_readwrite(endpoint_t fs_e, ino_t inode_nr, off_t pos, int rw_flag,
240433d6423SLionel Sambuc 	endpoint_t user_e, vir_bytes user_addr, unsigned int num_of_bytes,
2413c8950ccSBen Gras 	off_t *new_posp, size_t *cum_iop);
242433d6423SLionel Sambuc int req_bpeek(endpoint_t fs_e, dev_t dev, off_t pos, unsigned int num_of_bytes);
243433d6423SLionel Sambuc int req_peek(endpoint_t fs_e, ino_t inode_nr, off_t pos, unsigned int bytes);
244433d6423SLionel Sambuc int req_rename(endpoint_t fs_e, ino_t old_dir, char *old_name, ino_t new_dir,
245433d6423SLionel Sambuc 	char *new_name);
246433d6423SLionel Sambuc int req_rmdir(endpoint_t fs_e, ino_t inode_nr, char *lastc);
247433d6423SLionel Sambuc int req_slink(endpoint_t fs_e, ino_t inode_nr, char *lastc, endpoint_t proc_e,
248433d6423SLionel Sambuc 	vir_bytes path_addr, size_t path_length, uid_t uid, gid_t gid);
249433d6423SLionel Sambuc int req_stat(endpoint_t fs_e, ino_t inode_nr, endpoint_t proc_e, vir_bytes buf);
250433d6423SLionel Sambuc int req_sync(endpoint_t fs_e);
251433d6423SLionel Sambuc int req_unlink(endpoint_t fs_e, ino_t inode_nr, char *lastc);
252433d6423SLionel Sambuc int req_unmount(endpoint_t fs_e);
253433d6423SLionel Sambuc int req_utime(endpoint_t fs_e, ino_t inode_nr, struct timespec * actv,
254433d6423SLionel Sambuc 	struct timespec * modtv);
255433d6423SLionel Sambuc int req_newdriver(endpoint_t fs_e, dev_t dev, char *label);
256433d6423SLionel Sambuc 
257c38dbb97SDavid van Moolenbroek /* socket.c */
258c38dbb97SDavid van Moolenbroek int do_socket(void);
259c38dbb97SDavid van Moolenbroek int do_socketpair(void);
260c38dbb97SDavid van Moolenbroek int do_bind(void);
261c38dbb97SDavid van Moolenbroek int do_connect(void);
262c38dbb97SDavid van Moolenbroek int do_listen(void);
263c38dbb97SDavid van Moolenbroek int do_accept(void);
264c38dbb97SDavid van Moolenbroek void resume_accept(struct fproc *rfp, int status, dev_t dev,
265c38dbb97SDavid van Moolenbroek 	unsigned int addr_len, int listen_fd);
266c38dbb97SDavid van Moolenbroek int do_sendto(void);
267c38dbb97SDavid van Moolenbroek int do_recvfrom(void);
268c38dbb97SDavid van Moolenbroek void resume_recvfrom(struct fproc *rfp, int status, unsigned int addr_len);
269c38dbb97SDavid van Moolenbroek int do_sockmsg(void);
270c38dbb97SDavid van Moolenbroek void resume_recvmsg(struct fproc *rfp, int status, unsigned int ctl_len,
271c38dbb97SDavid van Moolenbroek 	unsigned int addr_len, int flags, vir_bytes msg_buf);
272c38dbb97SDavid van Moolenbroek int do_setsockopt(void);
273c38dbb97SDavid van Moolenbroek int do_getsockopt(void);
274c38dbb97SDavid van Moolenbroek int do_getsockname(void);
275c38dbb97SDavid van Moolenbroek int do_getpeername(void);
276c38dbb97SDavid van Moolenbroek int do_shutdown(void);
277c38dbb97SDavid van Moolenbroek 
278433d6423SLionel Sambuc /* stadir.c */
279433d6423SLionel Sambuc int do_chdir(void);
280433d6423SLionel Sambuc int do_fchdir(void);
281433d6423SLionel Sambuc int do_chroot(void);
282433d6423SLionel Sambuc int do_fstat(void);
283433d6423SLionel Sambuc int do_stat(void);
284433d6423SLionel Sambuc int do_statvfs(void);
285433d6423SLionel Sambuc int do_fstatvfs(void);
286433d6423SLionel Sambuc int do_getvfsstat(void);
287433d6423SLionel Sambuc int do_rdlink(void);
288433d6423SLionel Sambuc int do_lstat(void);
289433d6423SLionel Sambuc int update_statvfs(struct vmnt *vmp, struct statvfs *buf);
290433d6423SLionel Sambuc 
291433d6423SLionel Sambuc /* time.c */
292433d6423SLionel Sambuc int do_utimens(void);
293433d6423SLionel Sambuc 
294433d6423SLionel Sambuc /* tll.c */
295433d6423SLionel Sambuc void tll_downgrade(tll_t *tllp);
296433d6423SLionel Sambuc int tll_haspendinglock(tll_t *tllp);
297433d6423SLionel Sambuc void tll_init(tll_t *tllp);
298433d6423SLionel Sambuc int tll_islocked(tll_t *tllp);
299433d6423SLionel Sambuc int tll_lock(tll_t *tllp, tll_access_t locktype);
300433d6423SLionel Sambuc int tll_locked_by_me(tll_t *tllp);
301433d6423SLionel Sambuc void tll_lockstat(tll_t *tllp);
302433d6423SLionel Sambuc int tll_unlock(tll_t *tllp);
303433d6423SLionel Sambuc void tll_upgrade(tll_t *tllp);
304433d6423SLionel Sambuc 
305433d6423SLionel Sambuc /* utility.c */
306433d6423SLionel Sambuc int copy_path(char *dest, size_t size);
307433d6423SLionel Sambuc int fetch_name(vir_bytes path, size_t len, char *dest);
308433d6423SLionel Sambuc int isokendpt_f(const char *f, int l, endpoint_t e, int *p, int ft);
309433d6423SLionel Sambuc int in_group(struct fproc *rfp, gid_t grp);
310*89a4204bSDavid van Moolenbroek int sys_datacopy_wrapper(endpoint_t src, vir_bytes srcv, endpoint_t dst,
311*89a4204bSDavid van Moolenbroek 	vir_bytes dstv, size_t len);
312433d6423SLionel Sambuc 
313433d6423SLionel Sambuc #define okendpt(e, p) isokendpt_f(__FILE__, __LINE__, (e), (p), 1)
314433d6423SLionel Sambuc #define isokendpt(e, p) isokendpt_f(__FILE__, __LINE__, (e), (p), 0)
315433d6423SLionel Sambuc 
316433d6423SLionel Sambuc /* vmnt.c */
317433d6423SLionel Sambuc void check_vmnt_locks(void);
318433d6423SLionel Sambuc void check_vmnt_locks_by_me(struct fproc *rfp);
319433d6423SLionel Sambuc void mark_vmnt_free(struct vmnt *vmp);
320433d6423SLionel Sambuc struct vmnt *get_free_vmnt(void);
321433d6423SLionel Sambuc struct vmnt *find_vmnt(endpoint_t fs_e);
322433d6423SLionel Sambuc struct vmnt *get_locked_vmnt(struct fproc *rfp);
323433d6423SLionel Sambuc void init_vmnts(void);
324433d6423SLionel Sambuc int lock_vmnt(struct vmnt *vp, tll_access_t locktype);
325433d6423SLionel Sambuc void unlock_vmnt(struct vmnt *vp);
326433d6423SLionel Sambuc void vmnt_unmap_by_endpt(endpoint_t proc_e);
327433d6423SLionel Sambuc void fetch_vmnt_paths(void);
328433d6423SLionel Sambuc void upgrade_vmnt_lock(struct vmnt *vmp);
329433d6423SLionel Sambuc void downgrade_vmnt_lock(struct vmnt *vmp);
330433d6423SLionel Sambuc 
331433d6423SLionel Sambuc /* vnode.c */
332433d6423SLionel Sambuc void check_vnode_locks(void);
333433d6423SLionel Sambuc void check_vnode_locks_by_me(struct fproc *rfp);
334433d6423SLionel Sambuc struct vnode *get_free_vnode(void);
335433d6423SLionel Sambuc struct vnode *find_vnode(int fs_e, ino_t inode);
336433d6423SLionel Sambuc void init_vnodes(void);
337433d6423SLionel Sambuc int is_vnode_locked(struct vnode *vp);
338433d6423SLionel Sambuc int lock_vnode(struct vnode *vp, tll_access_t locktype);
339433d6423SLionel Sambuc void unlock_vnode(struct vnode *vp);
340433d6423SLionel Sambuc void dup_vnode(struct vnode *vp);
341433d6423SLionel Sambuc void put_vnode(struct vnode *vp);
342433d6423SLionel Sambuc void vnode_clean_refs(struct vnode *vp);
343433d6423SLionel Sambuc void upgrade_vnode_lock(struct vnode *vp);
344433d6423SLionel Sambuc 
345433d6423SLionel Sambuc /* write.c */
346433d6423SLionel Sambuc int do_write(void);
347433d6423SLionel Sambuc 
348433d6423SLionel Sambuc /* gcov.c */
349433d6423SLionel Sambuc int do_gcov_flush(void);
350433d6423SLionel Sambuc #if ! USE_COVERAGE
351433d6423SLionel Sambuc #define do_gcov_flush NULL
352433d6423SLionel Sambuc #endif
353433d6423SLionel Sambuc 
354433d6423SLionel Sambuc /* select.c */
355433d6423SLionel Sambuc int do_select(void);
356433d6423SLionel Sambuc void init_select(void);
357433d6423SLionel Sambuc void select_callback(struct filp *, int ops);
358433d6423SLionel Sambuc void select_forget(void);
3593b468884SDavid van Moolenbroek void select_reply1(endpoint_t driver_e, devminor_t minor, int status);
3603b468884SDavid van Moolenbroek void select_reply2(endpoint_t driver_e, devminor_t minor, int status);
361433d6423SLionel Sambuc void select_unsuspend_by_endpt(endpoint_t proc);
36263faa8feSDavid van Moolenbroek void select_dump(void);
363433d6423SLionel Sambuc 
364433d6423SLionel Sambuc /* worker.c */
365433d6423SLionel Sambuc void worker_init(void);
366728b0e5bSDavid van Moolenbroek void worker_cleanup(void);
367728b0e5bSDavid van Moolenbroek int worker_idle(void);
368433d6423SLionel Sambuc int worker_available(void);
3697eb698eaSDavid van Moolenbroek void worker_allow(int allow);
370433d6423SLionel Sambuc struct worker_thread *worker_get(thread_t worker_tid);
371433d6423SLionel Sambuc void worker_signal(struct worker_thread *worker);
372433d6423SLionel Sambuc int worker_can_start(struct fproc *rfp);
373433d6423SLionel Sambuc void worker_start(struct fproc *rfp, void (*func)(void), message *m_ptr,
374433d6423SLionel Sambuc 	int use_spare);
375433d6423SLionel Sambuc void worker_stop(struct worker_thread *worker);
376433d6423SLionel Sambuc void worker_stop_by_endpt(endpoint_t proc_e);
377728b0e5bSDavid van Moolenbroek void worker_yield(void);
378433d6423SLionel Sambuc void worker_wait(void);
379433d6423SLionel Sambuc struct worker_thread *worker_suspend(void);
380433d6423SLionel Sambuc void worker_resume(struct worker_thread *org_self);
381433d6423SLionel Sambuc void worker_set_proc(struct fproc *rfp);
382433d6423SLionel Sambuc #endif
383