1153323Srodrigc/* 2153323Srodrigc * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. 3153323Srodrigc * 4153323Srodrigc * This program is free software; you can redistribute it and/or modify it 5153323Srodrigc * under the terms of version 2 of the GNU General Public License as 6153323Srodrigc * published by the Free Software Foundation. 7153323Srodrigc * 8153323Srodrigc * This program is distributed in the hope that it would be useful, but 9153323Srodrigc * WITHOUT ANY WARRANTY; without even the implied warranty of 10153323Srodrigc * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11153323Srodrigc * 12153323Srodrigc * Further, this software is distributed without any warranty that it is 13153323Srodrigc * free of the rightful claim of any third person regarding infringement 14153323Srodrigc * or the like. Any license provided herein, whether implied or 15153323Srodrigc * otherwise, applies only to this software file. Patent licenses, if 16153323Srodrigc * any, provided herein do not apply to combinations of this program with 17153323Srodrigc * other software, or any other product whatsoever. 18153323Srodrigc * 19153323Srodrigc * You should have received a copy of the GNU General Public License along 20153323Srodrigc * with this program; if not, write the Free Software Foundation, Inc., 59 21153323Srodrigc * Temple Place - Suite 330, Boston MA 02111-1307, USA. 22153323Srodrigc * 23153323Srodrigc * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, 24153323Srodrigc * Mountain View, CA 94043, or: 25153323Srodrigc * 26153323Srodrigc * http://www.sgi.com 27153323Srodrigc * 28153323Srodrigc * For further information regarding this notice, see: 29153323Srodrigc * 30153323Srodrigc * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 31153323Srodrigc */ 32153323Srodrigc#ifndef __XFS_FRW_H__ 33153323Srodrigc#define __XFS_FRW_H__ 34153323Srodrigc 35153323Srodrigcstruct xfs_vnode; 36153323Srodrigcstruct bhv_desc; 37153323Srodrigcstruct xfs_mount; 38153323Srodrigcstruct xfs_iocore; 39153323Srodrigcstruct xfs_inode; 40153323Srodrigcstruct xfs_bmbt_irec; 41153323Srodrigcstruct xfs_buf; 42153323Srodrigcstruct xfs_iomap; 43153323Srodrigc 44153323Srodrigc#if defined(XFS_RW_TRACE) 45153323Srodrigc/* 46153323Srodrigc * Defines for the trace mechanisms in xfs_lrw.c. 47153323Srodrigc */ 48153323Srodrigc#define XFS_RW_KTRACE_SIZE 128 49153323Srodrigc 50153323Srodrigc#define XFS_READ_ENTER 1 51153323Srodrigc#define XFS_WRITE_ENTER 2 52153323Srodrigc#define XFS_IOMAP_READ_ENTER 3 53153323Srodrigc#define XFS_IOMAP_WRITE_ENTER 4 54153323Srodrigc#define XFS_IOMAP_READ_MAP 5 55153323Srodrigc#define XFS_IOMAP_WRITE_MAP 6 56153323Srodrigc#define XFS_IOMAP_WRITE_NOSPACE 7 57153323Srodrigc#define XFS_ITRUNC_START 8 58153323Srodrigc#define XFS_ITRUNC_FINISH1 9 59153323Srodrigc#define XFS_ITRUNC_FINISH2 10 60153323Srodrigc#define XFS_CTRUNC1 11 61153323Srodrigc#define XFS_CTRUNC2 12 62153323Srodrigc#define XFS_CTRUNC3 13 63153323Srodrigc#define XFS_CTRUNC4 14 64153323Srodrigc#define XFS_CTRUNC5 15 65153323Srodrigc#define XFS_CTRUNC6 16 66153323Srodrigc#define XFS_BUNMAPI 17 67153323Srodrigc#define XFS_INVAL_CACHED 18 68153323Srodrigc#define XFS_DIORD_ENTER 19 69153323Srodrigc#define XFS_DIOWR_ENTER 20 70153323Srodrigc#define XFS_SENDFILE_ENTER 21 71153323Srodrigc#define XFS_WRITEPAGE_ENTER 22 72153323Srodrigc#define XFS_RELEASEPAGE_ENTER 23 73153323Srodrigc#define XFS_IOMAP_ALLOC_ENTER 24 74153323Srodrigc#define XFS_IOMAP_ALLOC_MAP 25 75153323Srodrigc#define XFS_IOMAP_UNWRITTEN 26 76153323Srodrigcextern void xfs_rw_enter_trace(int, struct xfs_iocore *, 77153323Srodrigc const char *, size_t, loff_t, int); 78153323Srodrigcextern void xfs_inval_cached_trace(struct xfs_iocore *, 79153323Srodrigc xfs_off_t, xfs_off_t, xfs_off_t, xfs_off_t); 80153323Srodrigc#else 81153323Srodrigc#define xfs_rw_enter_trace(tag, io, buf, size, offset, ioflags) 82153323Srodrigc#define xfs_inval_cached_trace(io, offset, len, first, last) 83153323Srodrigc#endif 84153323Srodrigc 85153323Srodrigc/* 86153323Srodrigc * Maximum count of bmaps used by read and write paths. 87153323Srodrigc */ 88153323Srodrigc#define XFS_MAX_RW_NBMAPS 4 89153323Srodrigc 90153323Srodrigcextern int xfs_bmap(struct bhv_desc *, xfs_off_t, ssize_t, int, 91153323Srodrigc struct xfs_iomap *, int *); 92153323Srodrigcextern int xfsbdstrat(struct xfs_mount *, struct xfs_buf *); 93153323Srodrigcextern int xfs_bdstrat_cb(struct xfs_buf *); 94153323Srodrigc 95153323Srodrigcextern int xfs_zero_eof(struct xfs_vnode *, struct xfs_iocore *, xfs_off_t, 96153323Srodrigc xfs_fsize_t, xfs_fsize_t); 97153323Srodrigcextern void xfs_inval_cached_pages(struct xfs_vnode*, struct xfs_iocore *, 98153323Srodrigc xfs_off_t, int, int); 99153323Srodrigcextern ssize_t xfs_read(bhv_desc_t *, uio_t *, int, cred_t *); 100153323Srodrigcextern ssize_t xfs_write(bhv_desc_t *, uio_t *, int, cred_t *); 101153323Srodrigcextern int xfs_dev_is_read_only(struct xfs_mount *, char *); 102153323Srodrigc 103159451Srodrigcextern int xfs_read_file(struct xfs_mount *mp, struct xfs_inode *ip, struct uio *uio, 104159451Srodrigc int ioflag); 105159451Srodrigcextern int xfs_write_file(struct xfs_inode *, struct uio *, int); 106153323Srodrigc#endif /* __XFS_FRW_H__ */ 107