diff options
Diffstat (limited to 'serverboot/minix_file_io.c')
-rw-r--r-- | serverboot/minix_file_io.c | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/serverboot/minix_file_io.c b/serverboot/minix_file_io.c index 0a18092b..17beb18c 100644 --- a/serverboot/minix_file_io.c +++ b/serverboot/minix_file_io.c @@ -849,118 +849,3 @@ minix_remove_file_direct(fdp) fdp->fd_blocks = 0; /* sanity */ /* xxx should lose a ref to fdp->fd_dev here (and elsewhere) xxx */ } - -/* - * Special read and write routines for default pager. - * Assume that all offsets and sizes are multiples - * of DEV_BSIZE. - */ - -#define minix_fdir_blkoff(fdp, offset) /* offset % fd_bsize */ \ - ((offset) & ((fdp)->fd_bsize - 1)) -#define minix_fdir_lblkno(fdp, offset) /* offset / fd_bsize */ \ - ((offset) >> (fdp)->fd_bshift) - -#define minix_fdir_fsbtodb(fdp, block) /* offset * fd_bsize / DEV_BSIZE */ \ - ((block) << (fdp)->fd_fsbtodb) - -/* - * Read all or part of a data block, and - * return a pointer to the appropriate part. - * Caller must deallocate the block when done. - */ -int -minix_page_read_file_direct(fdp, offset, size, addr, size_read) - register struct file_direct *fdp; - vm_offset_t offset; - vm_size_t size; - vm_offset_t *addr; /* out */ - mach_msg_type_number_t *size_read; /* out */ -{ - vm_offset_t off; - register minix_daddr_t file_block; - minix_daddr_t disk_block; - - if (offset % DEV_BSIZE != 0 || - size % DEV_BSIZE != 0) - panic("page_read_file_direct"); - - if (offset >= (fdp->fd_size << fdp->fd_bshift)) - return (FS_NOT_IN_FILE); - - off = minix_fdir_blkoff(fdp, offset); - file_block = minix_fdir_lblkno(fdp, offset); - - if (file_is_device(fdp)) { - disk_block = file_block; - } else { - disk_block = ((minix_daddr_t *)fdp->fd_blocks)[file_block]; - if (disk_block == 0) - return (FS_NOT_IN_FILE); - } - - if (size > fdp->fd_bsize) - size = fdp->fd_bsize; - - return (device_read(fdp->fd_dev, - 0, - (recnum_t) (minix_fdir_fsbtodb(fdp, disk_block) + btodb(off)), - (int) size, - (char **) addr, - size_read)); -} - -/* - * Write all or part of a data block, and - * return the amount written. - */ -int -minix_page_write_file_direct(fdp, offset, addr, size, size_written) - register struct file_direct *fdp; - vm_offset_t offset; - vm_offset_t addr; - vm_size_t size; - vm_offset_t *size_written; /* out */ -{ - vm_offset_t off; - register minix_daddr_t file_block; - minix_daddr_t disk_block; - int rc, num_written; - vm_offset_t block_size; - - if (offset % DEV_BSIZE != 0 || - size % DEV_BSIZE != 0) - panic("page_write_file"); - - if (offset >= (fdp->fd_size << fdp->fd_bshift)) - return (FS_NOT_IN_FILE); - - off = minix_fdir_blkoff(fdp, offset); - file_block = minix_fdir_lblkno(fdp, offset); - - if (file_is_device(fdp)) { - disk_block = file_block; - } else { - disk_block = ((minix_daddr_t *)fdp->fd_blocks)[file_block]; - if (disk_block == 0) - return (FS_NOT_IN_FILE); - } - - if (size > fdp->fd_bsize) - size = fdp->fd_bsize; - - /* - * Write the data. Wait for completion to keep - * reads from getting ahead of writes and reading - * stale data. - */ - rc = device_write( - fdp->fd_dev, - 0, - (recnum_t) (minix_fdir_fsbtodb(fdp, disk_block) + btodb(off)), - (char *) addr, - size, - &num_written); - *size_written = num_written; - return rc; -} |