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" 12e3b8d4bbSDavid van Moolenbroek #include "type.h" 13433d6423SLionel Sambuc 14433d6423SLionel Sambuc /* Structs used in prototypes must be declared as such first. */ 15433d6423SLionel Sambuc struct filp; 16433d6423SLionel Sambuc struct fproc; 17433d6423SLionel Sambuc struct timespec; 18433d6423SLionel Sambuc struct vmnt; 19433d6423SLionel Sambuc struct vnode; 20433d6423SLionel Sambuc struct lookup; 21433d6423SLionel Sambuc struct worker_thread; 22433d6423SLionel Sambuc struct job; 23433d6423SLionel Sambuc 2489a4204bSDavid van Moolenbroek /* bdev.c */ 2589a4204bSDavid van Moolenbroek int bdev_open(dev_t dev, int access); 2689a4204bSDavid van Moolenbroek int bdev_close(dev_t dev); 2789a4204bSDavid van Moolenbroek int bdev_ioctl(dev_t dev, endpoint_t proc_e, unsigned long req, vir_bytes buf); 2889a4204bSDavid van Moolenbroek void bdev_reply(void); 2989a4204bSDavid van Moolenbroek void bdev_up(devmajor_t major); 3089a4204bSDavid van Moolenbroek 3189a4204bSDavid van Moolenbroek /* cdev.c */ 3289a4204bSDavid van Moolenbroek dev_t cdev_map(dev_t dev, struct fproc *rfp); 3389a4204bSDavid van Moolenbroek int cdev_open(int fd, dev_t dev, int flags); 3489a4204bSDavid van Moolenbroek int cdev_close(dev_t dev); 3589a4204bSDavid van Moolenbroek int cdev_io(int op, dev_t dev, endpoint_t proc_e, vir_bytes buf, off_t pos, 3689a4204bSDavid van Moolenbroek unsigned long bytes, int flags); 3789a4204bSDavid van Moolenbroek int cdev_select(dev_t dev, int ops); 3889a4204bSDavid van Moolenbroek int cdev_cancel(dev_t dev, endpoint_t endpt, cp_grant_id_t grant); 3989a4204bSDavid van Moolenbroek void cdev_reply(void); 4089a4204bSDavid van Moolenbroek 41433d6423SLionel Sambuc /* comm.c */ 42433d6423SLionel Sambuc int drv_sendrec(endpoint_t drv_e, message *reqm); 43433d6423SLionel Sambuc void fs_cancel(struct vmnt *vmp); 44433d6423SLionel Sambuc int fs_sendrec(endpoint_t fs_e, message *reqm); 45433d6423SLionel Sambuc int vm_sendrec(message *reqm); 46433d6423SLionel Sambuc void fs_sendmore(struct vmnt *vmp); 47433d6423SLionel Sambuc void send_work(void); 48433d6423SLionel Sambuc int vm_vfs_procctl_handlemem(endpoint_t ep, vir_bytes mem, vir_bytes len, int flags); 49433d6423SLionel Sambuc 50433d6423SLionel Sambuc /* device.c */ 51433d6423SLionel Sambuc int do_ioctl(void); 5289a4204bSDavid van Moolenbroek cp_grant_id_t make_ioctl_grant(endpoint_t driver_e, endpoint_t user_e, 5389a4204bSDavid van Moolenbroek vir_bytes buf, unsigned long request); 54433d6423SLionel Sambuc 55433d6423SLionel Sambuc /* dmap.c */ 56433d6423SLionel Sambuc void lock_dmap(struct dmap *dp); 57433d6423SLionel Sambuc void unlock_dmap(struct dmap *dp); 58433d6423SLionel Sambuc int do_mapdriver(void); 59433d6423SLionel Sambuc void init_dmap(void); 603b468884SDavid van Moolenbroek int dmap_driver_match(endpoint_t proc, devmajor_t major); 61433d6423SLionel Sambuc void dmap_endpt_up(endpoint_t proc_nr, int is_blk); 62e3b8d4bbSDavid van Moolenbroek struct dmap *get_dmap_by_endpt(endpoint_t proc_e); 633b468884SDavid van Moolenbroek struct dmap *get_dmap_by_major(devmajor_t major); 64433d6423SLionel Sambuc void dmap_unmap_by_endpt(endpoint_t proc_nr); 65433d6423SLionel Sambuc int map_service(struct rprocpub *rpub); 66433d6423SLionel Sambuc 67433d6423SLionel Sambuc /* elf_core_dump.c */ 68433d6423SLionel Sambuc void write_elf_core_file(struct filp *f, int csig, char *exe_name); 69433d6423SLionel Sambuc 70433d6423SLionel Sambuc /* exec.c */ 71433d6423SLionel Sambuc int pm_exec(vir_bytes path, size_t path_len, vir_bytes frame, size_t frame_len, 72433d6423SLionel Sambuc vir_bytes *pc, vir_bytes *newsp, vir_bytes *ps_str); 73433d6423SLionel Sambuc 74433d6423SLionel Sambuc /* filedes.c */ 75433d6423SLionel Sambuc void check_filp_locks(void); 76433d6423SLionel Sambuc void check_filp_locks_by_me(void); 77433d6423SLionel Sambuc void init_filps(void); 78433d6423SLionel Sambuc struct filp *find_filp(struct vnode *vp, mode_t bits); 79e3b8d4bbSDavid van Moolenbroek struct filp *find_filp_by_sock_dev(dev_t dev); 80e3b8d4bbSDavid van Moolenbroek int check_fds(struct fproc *rfp, int nfds); 81433d6423SLionel Sambuc int get_fd(struct fproc *rfp, int start, mode_t bits, int *k, 82433d6423SLionel Sambuc struct filp **fpt); 83433d6423SLionel Sambuc struct filp *get_filp(int fild, tll_access_t locktype); 84433d6423SLionel Sambuc struct filp *get_filp2(struct fproc *rfp, int fild, tll_access_t locktype); 85433d6423SLionel Sambuc void lock_filp(struct filp *filp, tll_access_t locktype); 86433d6423SLionel Sambuc void unlock_filp(struct filp *filp); 87433d6423SLionel Sambuc void unlock_filps(struct filp *filp1, struct filp *filp2); 88433d6423SLionel Sambuc void invalidate_filp(struct filp *); 89433d6423SLionel Sambuc void invalidate_filp_by_endpt(endpoint_t proc_e); 903b468884SDavid van Moolenbroek void invalidate_filp_by_char_major(devmajor_t major); 91e3b8d4bbSDavid van Moolenbroek void invalidate_filp_by_sock_drv(unsigned int num); 92491d647aSDavid van Moolenbroek int close_filp(struct filp *fp, int may_suspend); 93433d6423SLionel Sambuc int do_copyfd(void); 94433d6423SLionel Sambuc 95433d6423SLionel Sambuc /* fscall.c */ 96433d6423SLionel Sambuc void nested_fs_call(message *m); 97433d6423SLionel Sambuc 98433d6423SLionel Sambuc /* link.c */ 99433d6423SLionel Sambuc int do_link(void); 100433d6423SLionel Sambuc int do_unlink(void); 101433d6423SLionel Sambuc int do_rename(void); 102433d6423SLionel Sambuc int do_truncate(void); 103433d6423SLionel Sambuc int do_ftruncate(void); 104433d6423SLionel Sambuc int truncate_vnode(struct vnode *vp, off_t newsize); 105433d6423SLionel Sambuc int rdlink_direct(char *orig_path, char *link_path, struct fproc *rfp); 106433d6423SLionel Sambuc 107433d6423SLionel Sambuc /* lock.c */ 108232819ddSDavid van Moolenbroek int lock_op(int fd, int req, vir_bytes arg); 109433d6423SLionel Sambuc void lock_revive(void); 110433d6423SLionel Sambuc 111433d6423SLionel Sambuc /* main.c */ 112433d6423SLionel Sambuc int main(void); 113433d6423SLionel Sambuc void lock_proc(struct fproc *rfp); 114433d6423SLionel Sambuc void unlock_proc(struct fproc *rfp); 115e3b8d4bbSDavid van Moolenbroek void reply(message *m_out, endpoint_t whom, int result); 116433d6423SLionel Sambuc void replycode(endpoint_t whom, int result); 117433d6423SLionel Sambuc void service_pm_postponed(void); 118433d6423SLionel Sambuc void thread_cleanup(void); 119433d6423SLionel Sambuc 120433d6423SLionel Sambuc /* misc.c */ 121433d6423SLionel Sambuc void pm_exit(void); 122433d6423SLionel Sambuc int do_fcntl(void); 123433d6423SLionel Sambuc void pm_fork(endpoint_t pproc, endpoint_t cproc, pid_t cpid); 124433d6423SLionel Sambuc void pm_setgid(endpoint_t proc_e, int egid, int rgid); 125433d6423SLionel Sambuc void pm_setuid(endpoint_t proc_e, int euid, int ruid); 126433d6423SLionel Sambuc void pm_setgroups(endpoint_t proc_e, int ngroups, gid_t *addr); 127433d6423SLionel Sambuc void pm_setsid(endpoint_t proc_e); 128433d6423SLionel Sambuc int do_sync(void); 129433d6423SLionel Sambuc int do_fsync(void); 130433d6423SLionel Sambuc void pm_reboot(void); 131433d6423SLionel Sambuc int do_svrctl(void); 132433d6423SLionel Sambuc int do_getsysinfo(void); 133433d6423SLionel Sambuc int do_vm_call(void); 134433d6423SLionel Sambuc int pm_dumpcore(int sig, vir_bytes exe_name); 135433d6423SLionel Sambuc void ds_event(void); 136433d6423SLionel Sambuc int dupvm(struct fproc *fp, int pfd, int *vmfd, struct filp **f); 137433d6423SLionel Sambuc int do_getrusage(void); 138433d6423SLionel Sambuc 139433d6423SLionel Sambuc /* mount.c */ 140433d6423SLionel Sambuc int do_mount(void); 141433d6423SLionel Sambuc int do_umount(void); 142433d6423SLionel Sambuc int is_nonedev(dev_t dev); 143433d6423SLionel Sambuc void mount_pfs(void); 144433d6423SLionel Sambuc int mount_fs(dev_t dev, char mount_dev[PATH_MAX], char mount_path[PATH_MAX], 145433d6423SLionel Sambuc endpoint_t fs_e, int rdonly, char mount_type[FSTYPE_MAX], 146433d6423SLionel Sambuc char mount_label[LABEL_MAX]); 147433d6423SLionel Sambuc int unmount(dev_t dev, char label[LABEL_MAX]); 148433d6423SLionel Sambuc void unmount_all(int force); 149433d6423SLionel Sambuc 150433d6423SLionel Sambuc /* open.c */ 151433d6423SLionel Sambuc int do_close(void); 152491d647aSDavid van Moolenbroek int close_fd(struct fproc *rfp, int fd_nr, int may_suspend); 15356ac45c1SDavid van Moolenbroek int common_open(char path[PATH_MAX], int oflags, mode_t omode, int for_exec); 154433d6423SLionel Sambuc int do_creat(void); 155433d6423SLionel Sambuc int do_lseek(void); 156433d6423SLionel Sambuc int do_mknod(void); 157433d6423SLionel Sambuc int do_mkdir(void); 158433d6423SLionel Sambuc int do_open(void); 159433d6423SLionel Sambuc int do_creat(void); 160433d6423SLionel Sambuc int do_slink(void); 161433d6423SLionel Sambuc int actual_lseek(struct fproc *rfp, int seekfd, int seekwhence, off_t offset, 162433d6423SLionel Sambuc off_t *newposp); 163433d6423SLionel Sambuc 164433d6423SLionel Sambuc /* path.c */ 165433d6423SLionel Sambuc struct vnode *advance(struct vnode *dirp, struct lookup *resolve, struct 166433d6423SLionel Sambuc fproc *rfp); 167433d6423SLionel Sambuc struct vnode *eat_path(struct lookup *resolve, struct fproc *rfp); 168433d6423SLionel Sambuc struct vnode *last_dir(struct lookup *resolve, struct fproc *rfp); 169433d6423SLionel Sambuc void lookup_init(struct lookup *resolve, char *path, int flags, struct 170433d6423SLionel Sambuc vmnt **vmp, struct vnode **vp); 171433d6423SLionel Sambuc int get_name(struct vnode *dirp, struct vnode *entry, char *_name); 172433d6423SLionel Sambuc int canonical_path(char *orig_path, struct fproc *rfp); 173*dd969671SDavid van Moolenbroek int do_socketpath(void); 174433d6423SLionel Sambuc 175433d6423SLionel Sambuc /* pipe.c */ 176433d6423SLionel Sambuc int do_pipe2(void); 177433d6423SLionel Sambuc int map_vnode(struct vnode *vp, endpoint_t fs_e); 178433d6423SLionel Sambuc void unpause(void); 179433d6423SLionel Sambuc int pipe_check(struct filp *filp, int rw_flag, int oflags, int bytes, 180433d6423SLionel Sambuc int notouch); 181433d6423SLionel Sambuc void release(struct vnode *vp, int op, int count); 182433d6423SLionel Sambuc void revive(endpoint_t proc_e, int returned); 183433d6423SLionel Sambuc void suspend(int why); 184232819ddSDavid van Moolenbroek void pipe_suspend(int callnr, int fd, vir_bytes buf, size_t size, 185232819ddSDavid van Moolenbroek size_t cum_io); 186433d6423SLionel Sambuc void unsuspend_by_endpt(endpoint_t proc_e); 187433d6423SLionel Sambuc 188433d6423SLionel Sambuc /* protect.c */ 189433d6423SLionel Sambuc int do_access(void); 190433d6423SLionel Sambuc int do_chmod(void); 191433d6423SLionel Sambuc int do_chown(void); 192433d6423SLionel Sambuc int do_umask(void); 193433d6423SLionel Sambuc int forbidden(struct fproc *rfp, struct vnode *vp, mode_t 194433d6423SLionel Sambuc access_desired); 195433d6423SLionel Sambuc int read_only(struct vnode *vp); 196433d6423SLionel Sambuc 197433d6423SLionel Sambuc /* read.c */ 198433d6423SLionel Sambuc int do_read(void); 199433d6423SLionel Sambuc int do_getdents(void); 200433d6423SLionel Sambuc void lock_bsf(void); 201433d6423SLionel Sambuc void unlock_bsf(void); 202433d6423SLionel Sambuc void check_bsf_lock(void); 203433d6423SLionel Sambuc int do_read_write_peek(int rw_flag, int fd, vir_bytes buf, size_t bytes); 204232819ddSDavid van Moolenbroek int actual_read_write_peek(struct fproc *rfp, int rw_flag, int fd, 205232819ddSDavid van Moolenbroek vir_bytes buf, size_t bytes); 206232819ddSDavid van Moolenbroek int read_write(struct fproc *rfp, int rw_flag, int fd, struct filp *f, 207232819ddSDavid van Moolenbroek vir_bytes buffer, size_t nbytes, endpoint_t for_e); 208232819ddSDavid van Moolenbroek int rw_pipe(int rw_flag, endpoint_t usr, struct filp *f, int callnr, int fd, 209232819ddSDavid van Moolenbroek vir_bytes buf, size_t nbytes, size_t cum_io); 210433d6423SLionel Sambuc 211433d6423SLionel Sambuc /* request.c */ 212433d6423SLionel Sambuc int req_breadwrite(endpoint_t fs_e, endpoint_t user_e, dev_t dev, off_t pos, 213433d6423SLionel Sambuc unsigned int num_of_bytes, vir_bytes user_addr, int rw_flag, 2143c8950ccSBen Gras off_t *new_posp, size_t *cum_iop); 215433d6423SLionel Sambuc int req_chmod(endpoint_t fs_e, ino_t inode_nr, mode_t rmode, 216433d6423SLionel Sambuc mode_t *new_modep); 217433d6423SLionel Sambuc int req_chown(endpoint_t fs_e, ino_t inode_nr, uid_t newuid, gid_t newgid, 218433d6423SLionel Sambuc mode_t *new_modep); 219433d6423SLionel Sambuc int req_create(endpoint_t fs_e, ino_t inode_nr, int omode, uid_t uid, 220433d6423SLionel Sambuc gid_t gid, char *path, node_details_t *res); 221433d6423SLionel Sambuc int req_flush(endpoint_t fs_e, dev_t dev); 222433d6423SLionel Sambuc int req_statvfs(endpoint_t fs_e, struct statvfs *buf); 223433d6423SLionel Sambuc int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end); 224433d6423SLionel Sambuc int req_getdents(endpoint_t fs_e, ino_t inode_nr, off_t pos, vir_bytes buf, 225433d6423SLionel Sambuc size_t size, off_t *new_pos, int direct); 226433d6423SLionel Sambuc int req_inhibread(endpoint_t fs_e, ino_t inode_nr); 227433d6423SLionel Sambuc int req_link(endpoint_t fs_e, ino_t link_parent, char *lastc, 228433d6423SLionel Sambuc ino_t linked_file); 229433d6423SLionel Sambuc int req_lookup(endpoint_t fs_e, ino_t dir_ino, ino_t root_ino, uid_t uid, 230433d6423SLionel Sambuc gid_t gid, struct lookup *resolve, lookup_res_t *res, 231433d6423SLionel Sambuc struct fproc *rfp); 232433d6423SLionel Sambuc int req_mkdir(endpoint_t fs_e, ino_t inode_nr, char *lastc, uid_t uid, 233433d6423SLionel Sambuc gid_t gid, mode_t dmode); 234433d6423SLionel Sambuc int req_mknod(endpoint_t fs_e, ino_t inode_nr, char *lastc, uid_t uid, 235433d6423SLionel Sambuc gid_t gid, mode_t dmode, dev_t dev); 236433d6423SLionel Sambuc int req_mountpoint(endpoint_t fs_e, ino_t inode_nr); 237433d6423SLionel Sambuc int req_newnode(endpoint_t fs_e, uid_t uid, gid_t gid, mode_t dmode, 238433d6423SLionel Sambuc dev_t dev, struct node_details *res); 239433d6423SLionel Sambuc int req_putnode(int fs_e, ino_t inode_nr, int count); 240433d6423SLionel Sambuc int req_rdlink(endpoint_t fs_e, ino_t inode_nr, endpoint_t proc_e, 241433d6423SLionel Sambuc vir_bytes buf, size_t len, int direct); 242433d6423SLionel Sambuc int req_readsuper(struct vmnt *vmp, char *driver_name, dev_t dev, int readonly, 243433d6423SLionel Sambuc int isroot, struct node_details *res_nodep, unsigned int *fs_flags); 244433d6423SLionel Sambuc int req_readwrite(endpoint_t fs_e, ino_t inode_nr, off_t pos, int rw_flag, 245433d6423SLionel Sambuc endpoint_t user_e, vir_bytes user_addr, unsigned int num_of_bytes, 2463c8950ccSBen Gras off_t *new_posp, size_t *cum_iop); 247433d6423SLionel Sambuc int req_bpeek(endpoint_t fs_e, dev_t dev, off_t pos, unsigned int num_of_bytes); 248433d6423SLionel Sambuc int req_peek(endpoint_t fs_e, ino_t inode_nr, off_t pos, unsigned int bytes); 249433d6423SLionel Sambuc int req_rename(endpoint_t fs_e, ino_t old_dir, char *old_name, ino_t new_dir, 250433d6423SLionel Sambuc char *new_name); 251433d6423SLionel Sambuc int req_rmdir(endpoint_t fs_e, ino_t inode_nr, char *lastc); 252433d6423SLionel Sambuc int req_slink(endpoint_t fs_e, ino_t inode_nr, char *lastc, endpoint_t proc_e, 253433d6423SLionel Sambuc vir_bytes path_addr, size_t path_length, uid_t uid, gid_t gid); 254433d6423SLionel Sambuc int req_stat(endpoint_t fs_e, ino_t inode_nr, endpoint_t proc_e, vir_bytes buf); 255433d6423SLionel Sambuc int req_sync(endpoint_t fs_e); 256433d6423SLionel Sambuc int req_unlink(endpoint_t fs_e, ino_t inode_nr, char *lastc); 257433d6423SLionel Sambuc int req_unmount(endpoint_t fs_e); 258433d6423SLionel Sambuc int req_utime(endpoint_t fs_e, ino_t inode_nr, struct timespec * actv, 259433d6423SLionel Sambuc struct timespec * modtv); 260433d6423SLionel Sambuc int req_newdriver(endpoint_t fs_e, dev_t dev, char *label); 261433d6423SLionel Sambuc 262e3b8d4bbSDavid van Moolenbroek /* sdev.c */ 263e3b8d4bbSDavid van Moolenbroek int sdev_socket(int domain, int type, int protocol, dev_t *dev, int pair); 264e3b8d4bbSDavid van Moolenbroek int sdev_bind(dev_t dev, vir_bytes addr, unsigned int addr_len, 265e3b8d4bbSDavid van Moolenbroek int filp_flags); 266e3b8d4bbSDavid van Moolenbroek int sdev_connect(dev_t dev, vir_bytes addr, unsigned int addr_len, 267e3b8d4bbSDavid van Moolenbroek int filp_flags); 268e3b8d4bbSDavid van Moolenbroek int sdev_listen(dev_t dev, int backlog); 269e3b8d4bbSDavid van Moolenbroek int sdev_accept(dev_t dev, vir_bytes addr, unsigned int addr_len, 270e3b8d4bbSDavid van Moolenbroek int filp_flags, int fd); 271e3b8d4bbSDavid van Moolenbroek int sdev_readwrite(dev_t dev, vir_bytes data_buf, size_t data_len, 272e3b8d4bbSDavid van Moolenbroek vir_bytes ctl_buf, unsigned int ctl_len, vir_bytes addr_buf, 273e3b8d4bbSDavid van Moolenbroek unsigned int addr_len, int flags, int rw_flag, int filp_flags, 274e3b8d4bbSDavid van Moolenbroek vir_bytes user_buf); 275e3b8d4bbSDavid van Moolenbroek int sdev_ioctl(dev_t dev, unsigned long request, vir_bytes buf, 276e3b8d4bbSDavid van Moolenbroek int filp_flags); 277e3b8d4bbSDavid van Moolenbroek int sdev_setsockopt(dev_t dev, int level, int name, vir_bytes addr, 278e3b8d4bbSDavid van Moolenbroek unsigned int len); 279e3b8d4bbSDavid van Moolenbroek int sdev_getsockopt(dev_t dev, int level, int name, vir_bytes addr, 280e3b8d4bbSDavid van Moolenbroek unsigned int *len); 281e3b8d4bbSDavid van Moolenbroek int sdev_getsockname(dev_t dev, vir_bytes addr, unsigned int *addr_len); 282e3b8d4bbSDavid van Moolenbroek int sdev_getpeername(dev_t dev, vir_bytes addr, unsigned int *addr_len); 283e3b8d4bbSDavid van Moolenbroek int sdev_shutdown(dev_t dev, int how); 284491d647aSDavid van Moolenbroek int sdev_close(dev_t dev, int may_suspend); 285e3b8d4bbSDavid van Moolenbroek int sdev_select(dev_t dev, int ops); 286e3b8d4bbSDavid van Moolenbroek void sdev_stop(struct fproc *rfp); 287e3b8d4bbSDavid van Moolenbroek void sdev_cancel(void); 288e3b8d4bbSDavid van Moolenbroek void sdev_reply(void); 289e3b8d4bbSDavid van Moolenbroek 290e3b8d4bbSDavid van Moolenbroek /* smap.c */ 291e3b8d4bbSDavid van Moolenbroek void init_smap(void); 292e3b8d4bbSDavid van Moolenbroek int smap_map(const char *label, endpoint_t endpt, const int *domains, 293e3b8d4bbSDavid van Moolenbroek unsigned int ndomains); 294e3b8d4bbSDavid van Moolenbroek void smap_unmap_by_endpt(endpoint_t endpt); 295e3b8d4bbSDavid van Moolenbroek void smap_endpt_up(endpoint_t endpt); 296e3b8d4bbSDavid van Moolenbroek dev_t make_smap_dev(struct smap *sp, sockid_t sockid); 297e3b8d4bbSDavid van Moolenbroek struct smap *get_smap_by_endpt(endpoint_t endpt); 298e3b8d4bbSDavid van Moolenbroek struct smap *get_smap_by_domain(int domain); 299e3b8d4bbSDavid van Moolenbroek struct smap *get_smap_by_dev(dev_t dev, sockid_t * sockidp); 300e3b8d4bbSDavid van Moolenbroek 301c38dbb97SDavid van Moolenbroek /* socket.c */ 302c38dbb97SDavid van Moolenbroek int do_socket(void); 303c38dbb97SDavid van Moolenbroek int do_socketpair(void); 304c38dbb97SDavid van Moolenbroek int do_bind(void); 305c38dbb97SDavid van Moolenbroek int do_connect(void); 306c38dbb97SDavid van Moolenbroek int do_listen(void); 307c38dbb97SDavid van Moolenbroek int do_accept(void); 308c38dbb97SDavid van Moolenbroek void resume_accept(struct fproc *rfp, int status, dev_t dev, 309c38dbb97SDavid van Moolenbroek unsigned int addr_len, int listen_fd); 310c38dbb97SDavid van Moolenbroek int do_sendto(void); 311c38dbb97SDavid van Moolenbroek int do_recvfrom(void); 312c38dbb97SDavid van Moolenbroek void resume_recvfrom(struct fproc *rfp, int status, unsigned int addr_len); 313c38dbb97SDavid van Moolenbroek int do_sockmsg(void); 314c38dbb97SDavid van Moolenbroek void resume_recvmsg(struct fproc *rfp, int status, unsigned int ctl_len, 315c38dbb97SDavid van Moolenbroek unsigned int addr_len, int flags, vir_bytes msg_buf); 316c38dbb97SDavid van Moolenbroek int do_setsockopt(void); 317c38dbb97SDavid van Moolenbroek int do_getsockopt(void); 318c38dbb97SDavid van Moolenbroek int do_getsockname(void); 319c38dbb97SDavid van Moolenbroek int do_getpeername(void); 320c38dbb97SDavid van Moolenbroek int do_shutdown(void); 321c38dbb97SDavid van Moolenbroek 322433d6423SLionel Sambuc /* stadir.c */ 323433d6423SLionel Sambuc int do_chdir(void); 324433d6423SLionel Sambuc int do_fchdir(void); 325433d6423SLionel Sambuc int do_chroot(void); 326433d6423SLionel Sambuc int do_fstat(void); 327433d6423SLionel Sambuc int do_stat(void); 328433d6423SLionel Sambuc int do_statvfs(void); 329433d6423SLionel Sambuc int do_fstatvfs(void); 330433d6423SLionel Sambuc int do_getvfsstat(void); 331433d6423SLionel Sambuc int do_rdlink(void); 332433d6423SLionel Sambuc int do_lstat(void); 333433d6423SLionel Sambuc int update_statvfs(struct vmnt *vmp, struct statvfs *buf); 334433d6423SLionel Sambuc 335433d6423SLionel Sambuc /* time.c */ 336433d6423SLionel Sambuc int do_utimens(void); 337433d6423SLionel Sambuc 338433d6423SLionel Sambuc /* tll.c */ 339433d6423SLionel Sambuc void tll_downgrade(tll_t *tllp); 340433d6423SLionel Sambuc int tll_haspendinglock(tll_t *tllp); 341433d6423SLionel Sambuc void tll_init(tll_t *tllp); 342433d6423SLionel Sambuc int tll_islocked(tll_t *tllp); 343433d6423SLionel Sambuc int tll_lock(tll_t *tllp, tll_access_t locktype); 344433d6423SLionel Sambuc int tll_locked_by_me(tll_t *tllp); 345433d6423SLionel Sambuc void tll_lockstat(tll_t *tllp); 346433d6423SLionel Sambuc int tll_unlock(tll_t *tllp); 347433d6423SLionel Sambuc void tll_upgrade(tll_t *tllp); 348433d6423SLionel Sambuc 349433d6423SLionel Sambuc /* utility.c */ 350433d6423SLionel Sambuc int copy_path(char *dest, size_t size); 351433d6423SLionel Sambuc int fetch_name(vir_bytes path, size_t len, char *dest); 352433d6423SLionel Sambuc int isokendpt_f(const char *f, int l, endpoint_t e, int *p, int ft); 353433d6423SLionel Sambuc int in_group(struct fproc *rfp, gid_t grp); 35489a4204bSDavid van Moolenbroek int sys_datacopy_wrapper(endpoint_t src, vir_bytes srcv, endpoint_t dst, 35589a4204bSDavid van Moolenbroek vir_bytes dstv, size_t len); 356433d6423SLionel Sambuc 357433d6423SLionel Sambuc #define okendpt(e, p) isokendpt_f(__FILE__, __LINE__, (e), (p), 1) 358433d6423SLionel Sambuc #define isokendpt(e, p) isokendpt_f(__FILE__, __LINE__, (e), (p), 0) 359433d6423SLionel Sambuc 360433d6423SLionel Sambuc /* vmnt.c */ 361433d6423SLionel Sambuc void check_vmnt_locks(void); 362433d6423SLionel Sambuc void check_vmnt_locks_by_me(struct fproc *rfp); 363433d6423SLionel Sambuc void mark_vmnt_free(struct vmnt *vmp); 364433d6423SLionel Sambuc struct vmnt *get_free_vmnt(void); 365433d6423SLionel Sambuc struct vmnt *find_vmnt(endpoint_t fs_e); 366433d6423SLionel Sambuc struct vmnt *get_locked_vmnt(struct fproc *rfp); 367433d6423SLionel Sambuc void init_vmnts(void); 368433d6423SLionel Sambuc int lock_vmnt(struct vmnt *vp, tll_access_t locktype); 369433d6423SLionel Sambuc void unlock_vmnt(struct vmnt *vp); 370433d6423SLionel Sambuc void vmnt_unmap_by_endpt(endpoint_t proc_e); 371433d6423SLionel Sambuc void fetch_vmnt_paths(void); 372433d6423SLionel Sambuc void upgrade_vmnt_lock(struct vmnt *vmp); 373433d6423SLionel Sambuc void downgrade_vmnt_lock(struct vmnt *vmp); 374433d6423SLionel Sambuc 375433d6423SLionel Sambuc /* vnode.c */ 376433d6423SLionel Sambuc void check_vnode_locks(void); 377433d6423SLionel Sambuc void check_vnode_locks_by_me(struct fproc *rfp); 378433d6423SLionel Sambuc struct vnode *get_free_vnode(void); 379433d6423SLionel Sambuc struct vnode *find_vnode(int fs_e, ino_t inode); 380433d6423SLionel Sambuc void init_vnodes(void); 381433d6423SLionel Sambuc int is_vnode_locked(struct vnode *vp); 382433d6423SLionel Sambuc int lock_vnode(struct vnode *vp, tll_access_t locktype); 383433d6423SLionel Sambuc void unlock_vnode(struct vnode *vp); 384433d6423SLionel Sambuc void dup_vnode(struct vnode *vp); 385433d6423SLionel Sambuc void put_vnode(struct vnode *vp); 386433d6423SLionel Sambuc void vnode_clean_refs(struct vnode *vp); 387433d6423SLionel Sambuc void upgrade_vnode_lock(struct vnode *vp); 388433d6423SLionel Sambuc 389433d6423SLionel Sambuc /* write.c */ 390433d6423SLionel Sambuc int do_write(void); 391433d6423SLionel Sambuc 392433d6423SLionel Sambuc /* gcov.c */ 393433d6423SLionel Sambuc int do_gcov_flush(void); 394433d6423SLionel Sambuc #if ! USE_COVERAGE 395433d6423SLionel Sambuc #define do_gcov_flush NULL 396433d6423SLionel Sambuc #endif 397433d6423SLionel Sambuc 398433d6423SLionel Sambuc /* select.c */ 399433d6423SLionel Sambuc int do_select(void); 400433d6423SLionel Sambuc void init_select(void); 401433d6423SLionel Sambuc void select_callback(struct filp *, int ops); 402433d6423SLionel Sambuc void select_forget(void); 403e3b8d4bbSDavid van Moolenbroek void select_cdev_reply1(endpoint_t driver_e, devminor_t minor, int status); 404e3b8d4bbSDavid van Moolenbroek void select_cdev_reply2(endpoint_t driver_e, devminor_t minor, int status); 405e3b8d4bbSDavid van Moolenbroek void select_sdev_reply1(dev_t dev, int status); 406e3b8d4bbSDavid van Moolenbroek void select_sdev_reply2(dev_t dev, int status); 407433d6423SLionel Sambuc void select_unsuspend_by_endpt(endpoint_t proc); 40863faa8feSDavid van Moolenbroek void select_dump(void); 409433d6423SLionel Sambuc 410433d6423SLionel Sambuc /* worker.c */ 411433d6423SLionel Sambuc void worker_init(void); 412728b0e5bSDavid van Moolenbroek void worker_cleanup(void); 413728b0e5bSDavid van Moolenbroek int worker_idle(void); 414433d6423SLionel Sambuc int worker_available(void); 4157eb698eaSDavid van Moolenbroek void worker_allow(int allow); 416433d6423SLionel Sambuc struct worker_thread *worker_get(thread_t worker_tid); 417433d6423SLionel Sambuc void worker_signal(struct worker_thread *worker); 418433d6423SLionel Sambuc int worker_can_start(struct fproc *rfp); 419433d6423SLionel Sambuc void worker_start(struct fproc *rfp, void (*func)(void), message *m_ptr, 420433d6423SLionel Sambuc int use_spare); 421433d6423SLionel Sambuc void worker_stop(struct worker_thread *worker); 422433d6423SLionel Sambuc void worker_stop_by_endpt(endpoint_t proc_e); 423728b0e5bSDavid van Moolenbroek void worker_yield(void); 424433d6423SLionel Sambuc void worker_wait(void); 425433d6423SLionel Sambuc struct worker_thread *worker_suspend(void); 426433d6423SLionel Sambuc void worker_resume(struct worker_thread *org_self); 427433d6423SLionel Sambuc void worker_set_proc(struct fproc *rfp); 428433d6423SLionel Sambuc #endif 429