For character device i/o, FS does a so-called 'magic' grant to let the driver copy from or to user space. As this is done in FS address space, the driver is told to do this in FS address space. The redirection to the right user process then happens at copy-time in the kernel, using the FS grant table. This also happens for DEV_READ and DEV_WRITE on block devices. For other block device i/o, which happens from/to FS buffers, FS does a 'direct' grant to its own address space for the driver. After the i/o returns, this access has to be K-I-L-L-E-D, revoked. Sometimes this is after a SUSPEND and DEV_REVIVE, in which case the revoking happens in pipe.c. This conversion happens in safe_io_conversion() in device.c, called by dev_io and dev_bio. FS has to pre-allocate its own space for these grant tables. This happens in main.c.
230 lines
9.3 KiB
C
230 lines
9.3 KiB
C
/* Function prototypes. */
|
|
|
|
#include "timers.h"
|
|
|
|
#include <minix/safecopies.h>
|
|
|
|
/* Structs used in prototypes must be declared as such first. */
|
|
struct buf;
|
|
struct filp;
|
|
struct fproc;
|
|
struct inode;
|
|
struct super_block;
|
|
|
|
/* cache.c */
|
|
_PROTOTYPE( zone_t alloc_zone, (Dev_t dev, zone_t z) );
|
|
_PROTOTYPE( void flushall, (Dev_t dev) );
|
|
_PROTOTYPE( void free_zone, (Dev_t dev, zone_t numb) );
|
|
_PROTOTYPE( struct buf *get_block, (Dev_t dev, block_t block,int only_search));
|
|
_PROTOTYPE( void invalidate, (Dev_t device) );
|
|
_PROTOTYPE( void put_block, (struct buf *bp, int block_type) );
|
|
_PROTOTYPE( void rw_scattered, (Dev_t dev,
|
|
struct buf **bufq, int bufqsize, int rw_flag) );
|
|
|
|
#if ENABLE_CACHE2
|
|
/* cache2.c */
|
|
_PROTOTYPE( void init_cache2, (unsigned long size) );
|
|
_PROTOTYPE( int get_block2, (struct buf *bp, int only_search) );
|
|
_PROTOTYPE( void put_block2, (struct buf *bp) );
|
|
_PROTOTYPE( void invalidate2, (Dev_t device) );
|
|
#endif
|
|
|
|
/* device.c */
|
|
_PROTOTYPE( int dev_open, (Dev_t dev, int proc, int flags) );
|
|
_PROTOTYPE( void dev_close, (Dev_t dev) );
|
|
_PROTOTYPE( int dev_bio, (int op, Dev_t dev, int proc, void *buf,
|
|
off_t pos, int bytes) );
|
|
_PROTOTYPE( int dev_io, (int op, Dev_t dev, int proc, void *buf,
|
|
off_t pos, int bytes, int flags) );
|
|
_PROTOTYPE( int gen_opcl, (int op, Dev_t dev, int proc, int flags) );
|
|
_PROTOTYPE( int gen_io, (int task_nr, message *mess_ptr) );
|
|
_PROTOTYPE( int no_dev, (int op, Dev_t dev, int proc, int flags) );
|
|
_PROTOTYPE( int no_dev_io, (int, message *) );
|
|
_PROTOTYPE( int tty_opcl, (int op, Dev_t dev, int proc, int flags) );
|
|
_PROTOTYPE( int ctty_opcl, (int op, Dev_t dev, int proc, int flags) );
|
|
_PROTOTYPE( int clone_opcl, (int op, Dev_t dev, int proc, int flags) );
|
|
_PROTOTYPE( int ctty_io, (int task_nr, message *mess_ptr) );
|
|
_PROTOTYPE( int do_ioctl, (void) );
|
|
_PROTOTYPE( void pm_setsid, (int proc_e) );
|
|
_PROTOTYPE( void dev_status, (message *) );
|
|
_PROTOTYPE( void dev_up, (int major) );
|
|
|
|
/* dmp.c */
|
|
_PROTOTYPE( int do_fkey_pressed, (void) );
|
|
|
|
/* dmap.c */
|
|
_PROTOTYPE( int do_devctl, (void) );
|
|
_PROTOTYPE( int fs_devctl, (int req, int dev, int proc_nr_e, int style,
|
|
int force) );
|
|
_PROTOTYPE( void build_dmap, (void) );
|
|
_PROTOTYPE( int map_driver, (int major, int proc_nr, int dev_style,
|
|
int force) );
|
|
_PROTOTYPE( int dmap_driver_match, (int proc, int major) );
|
|
_PROTOTYPE( void dmap_unmap_by_endpt, (int proc_nr) );
|
|
_PROTOTYPE( void dmap_endpt_up, (int proc_nr) );
|
|
|
|
/* exec.c */
|
|
_PROTOTYPE( int pm_exec, (int proc_e, char *path, vir_bytes path_len,
|
|
char *frame, vir_bytes frame_len) );
|
|
|
|
/* filedes.c */
|
|
_PROTOTYPE( struct filp *find_filp, (struct inode *rip, mode_t bits) );
|
|
_PROTOTYPE( int get_fd, (int start, mode_t bits, int *k, struct filp **fpt) );
|
|
_PROTOTYPE( struct filp *get_filp, (int fild) );
|
|
_PROTOTYPE( struct filp *get_filp2, (struct fproc *rfp, int fild) );
|
|
_PROTOTYPE( int inval_filp, (struct filp *) );
|
|
|
|
/* inode.c */
|
|
_PROTOTYPE( struct inode *alloc_inode, (dev_t dev, mode_t bits) );
|
|
_PROTOTYPE( void dup_inode, (struct inode *ip) );
|
|
_PROTOTYPE( void free_inode, (Dev_t dev, Ino_t numb) );
|
|
_PROTOTYPE( struct inode *get_inode, (Dev_t dev, int numb) );
|
|
_PROTOTYPE( void put_inode, (struct inode *rip) );
|
|
_PROTOTYPE( void update_times, (struct inode *rip) );
|
|
_PROTOTYPE( void rw_inode, (struct inode *rip, int rw_flag) );
|
|
_PROTOTYPE( void wipe_inode, (struct inode *rip) );
|
|
|
|
/* link.c */
|
|
_PROTOTYPE( int do_link, (void) );
|
|
_PROTOTYPE( int do_unlink, (void) );
|
|
_PROTOTYPE( int do_rename, (void) );
|
|
_PROTOTYPE( int do_truncate, (void) );
|
|
_PROTOTYPE( int do_ftruncate, (void) );
|
|
_PROTOTYPE( int truncate_inode, (struct inode *rip, off_t len) );
|
|
_PROTOTYPE( int freesp_inode, (struct inode *rip, off_t st, off_t end) );
|
|
|
|
/* lock.c */
|
|
_PROTOTYPE( int lock_op, (struct filp *f, int req) );
|
|
_PROTOTYPE( void lock_revive, (void) );
|
|
|
|
/* main.c */
|
|
_PROTOTYPE( int main, (void) );
|
|
_PROTOTYPE( void reply, (int whom, int result) );
|
|
|
|
/* misc.c */
|
|
_PROTOTYPE( int do_dup, (void) );
|
|
_PROTOTYPE( void pm_exit, (int proc) );
|
|
_PROTOTYPE( int do_fcntl, (void) );
|
|
_PROTOTYPE( void pm_fork, (int pproc, int cproc, int cpid) );
|
|
_PROTOTYPE( void pm_setgid, (int proc_e, int egid, int rgid) );
|
|
_PROTOTYPE( void pm_setuid, (int proc_e, int euid, int ruid) );
|
|
_PROTOTYPE( int do_sync, (void) );
|
|
_PROTOTYPE( int do_fsync, (void) );
|
|
_PROTOTYPE( void pm_reboot, (void) );
|
|
_PROTOTYPE( int do_svrctl, (void) );
|
|
_PROTOTYPE( int do_getsysinfo, (void) );
|
|
_PROTOTYPE( int pm_dumpcore, (int proc_e, struct mem_map *seg_ptr) );
|
|
|
|
/* mount.c */
|
|
_PROTOTYPE( int do_mount, (void) );
|
|
_PROTOTYPE( int do_umount, (void) );
|
|
_PROTOTYPE( int unmount, (Dev_t dev) );
|
|
|
|
/* open.c */
|
|
_PROTOTYPE( int do_close, (void) );
|
|
_PROTOTYPE( int close_fd, (struct fproc *rfp, int fd_nr) );
|
|
_PROTOTYPE( int do_creat, (void) );
|
|
_PROTOTYPE( int do_lseek, (void) );
|
|
_PROTOTYPE( int do_mknod, (void) );
|
|
_PROTOTYPE( int do_mkdir, (void) );
|
|
_PROTOTYPE( int do_open, (void) );
|
|
_PROTOTYPE( int do_slink, (void) );
|
|
_PROTOTYPE( struct inode *new_node, (struct inode **ldirp,
|
|
char *path, mode_t bits, zone_t z0, int opaque, char *string) );
|
|
|
|
/* path.c */
|
|
_PROTOTYPE( struct inode *advance,(struct inode **dirp, char string[NAME_MAX]));
|
|
_PROTOTYPE( int search_dir, (struct inode *ldir_ptr,
|
|
char string [NAME_MAX], ino_t *numb, int flag) );
|
|
_PROTOTYPE( struct inode *eat_path, (char *path) );
|
|
_PROTOTYPE( struct inode *last_dir, (char *path, char string [NAME_MAX]));
|
|
_PROTOTYPE( struct inode *parse_path, (char *path, char string[NAME_MAX],
|
|
int action) );
|
|
|
|
/* pipe.c */
|
|
_PROTOTYPE( int do_pipe, (void) );
|
|
_PROTOTYPE( int do_unpause, (void) );
|
|
_PROTOTYPE( int unpause, (int proc_nr_e) );
|
|
_PROTOTYPE( int pipe_check, (struct inode *rip, int rw_flag,
|
|
int oflags, int bytes, off_t position, int *canwrite, int notouch));
|
|
_PROTOTYPE( void release, (struct inode *ip, int call_nr, int count) );
|
|
_PROTOTYPE( void revive, (int proc_nr, int bytes) );
|
|
_PROTOTYPE( void suspend, (int task) );
|
|
_PROTOTYPE( int select_request_pipe, (struct filp *f, int *ops, int bl) );
|
|
_PROTOTYPE( int select_cancel_pipe, (struct filp *f) );
|
|
_PROTOTYPE( int select_match_pipe, (struct filp *f) );
|
|
_PROTOTYPE( void unsuspend_by_endpt, (int) );
|
|
|
|
/* protect.c */
|
|
_PROTOTYPE( int do_access, (void) );
|
|
_PROTOTYPE( int do_chmod, (void) );
|
|
_PROTOTYPE( int do_chown, (void) );
|
|
_PROTOTYPE( int do_umask, (void) );
|
|
_PROTOTYPE( int forbidden, (struct inode *rip, mode_t access_desired) );
|
|
_PROTOTYPE( int read_only, (struct inode *ip) );
|
|
|
|
/* read.c */
|
|
_PROTOTYPE( int do_read, (void) );
|
|
_PROTOTYPE( struct buf *rahead, (struct inode *rip, block_t baseblock,
|
|
off_t position, unsigned bytes_ahead) );
|
|
_PROTOTYPE( void read_ahead, (void) );
|
|
_PROTOTYPE( block_t read_map, (struct inode *rip, off_t pos) );
|
|
_PROTOTYPE( int read_write, (int rw_flag) );
|
|
_PROTOTYPE( zone_t rd_indir, (struct buf *bp, int index) );
|
|
|
|
/* stadir.c */
|
|
_PROTOTYPE( int do_chdir, (void) );
|
|
_PROTOTYPE( int do_fchdir, (void) );
|
|
_PROTOTYPE( int do_chroot, (void) );
|
|
_PROTOTYPE( int do_fstat, (void) );
|
|
_PROTOTYPE( int do_stat, (void) );
|
|
_PROTOTYPE( int do_fstatfs, (void) );
|
|
_PROTOTYPE( int do_rdlink, (void) );
|
|
_PROTOTYPE( int do_lstat, (void) );
|
|
|
|
/* super.c */
|
|
_PROTOTYPE( bit_t alloc_bit, (struct super_block *sp, int map, bit_t origin));
|
|
_PROTOTYPE( void free_bit, (struct super_block *sp, int map,
|
|
bit_t bit_returned) );
|
|
_PROTOTYPE( struct super_block *get_super, (Dev_t dev) );
|
|
_PROTOTYPE( int mounted, (struct inode *rip) );
|
|
_PROTOTYPE( int read_super, (struct super_block *sp) );
|
|
_PROTOTYPE( int get_block_size, (dev_t dev) );
|
|
|
|
/* time.c */
|
|
_PROTOTYPE( int do_stime, (void) );
|
|
_PROTOTYPE( int do_utime, (void) );
|
|
|
|
/* utility.c */
|
|
_PROTOTYPE( time_t clock_time, (void) );
|
|
_PROTOTYPE( unsigned conv2, (int norm, int w) );
|
|
_PROTOTYPE( long conv4, (int norm, long x) );
|
|
_PROTOTYPE( int fetch_name, (char *path, int len, int flag) );
|
|
_PROTOTYPE( int no_sys, (void) );
|
|
_PROTOTYPE( int isokendpt_f, (char *f, int l, int e, int *p, int ft));
|
|
_PROTOTYPE( void panic, (char *who, char *mess, int num) );
|
|
|
|
#define okendpt(e, p) isokendpt_f(__FILE__, __LINE__, (e), (p), 1)
|
|
#define isokendpt(e, p) isokendpt_f(__FILE__, __LINE__, (e), (p), 0)
|
|
|
|
/* write.c */
|
|
_PROTOTYPE( void clear_zone, (struct inode *rip, off_t pos, int flag) );
|
|
_PROTOTYPE( int do_write, (void) );
|
|
_PROTOTYPE( struct buf *new_block, (struct inode *rip, off_t position) );
|
|
_PROTOTYPE( void zero_block, (struct buf *bp) );
|
|
_PROTOTYPE( int write_map, (struct inode *, off_t, zone_t, int) );
|
|
|
|
/* select.c */
|
|
_PROTOTYPE( int do_select, (void) );
|
|
_PROTOTYPE( int select_callback, (struct filp *, int ops) );
|
|
_PROTOTYPE( void select_forget, (int fproc) );
|
|
_PROTOTYPE( void select_timeout_check, (timer_t *) );
|
|
_PROTOTYPE( void init_select, (void) );
|
|
_PROTOTYPE( void select_unsuspend_by_endpt, (int proc) );
|
|
_PROTOTYPE( int select_notified, (int major, int minor, int ops) );
|
|
|
|
/* timers.c */
|
|
_PROTOTYPE( void fs_set_timer, (timer_t *tp, int delta, tmr_func_t watchdog, int arg));
|
|
_PROTOTYPE( void fs_expire_timers, (clock_t now) );
|
|
_PROTOTYPE( void fs_cancel_timer, (timer_t *tp) );
|
|
_PROTOTYPE( void fs_init_timer, (timer_t *tp) );
|