1*cfe60390STomohiro Kusumi /*- 2*cfe60390STomohiro Kusumi * SPDX-License-Identifier: BSD-3-Clause 3*cfe60390STomohiro Kusumi * 4*cfe60390STomohiro Kusumi * Copyright (c) 1982, 1986, 1989, 1993 5*cfe60390STomohiro Kusumi * The Regents of the University of California. All rights reserved. 6*cfe60390STomohiro Kusumi * 7*cfe60390STomohiro Kusumi * Redistribution and use in source and binary forms, with or without 8*cfe60390STomohiro Kusumi * modification, are permitted provided that the following conditions 9*cfe60390STomohiro Kusumi * are met: 10*cfe60390STomohiro Kusumi * 1. Redistributions of source code must retain the above copyright 11*cfe60390STomohiro Kusumi * notice, this list of conditions and the following disclaimer. 12*cfe60390STomohiro Kusumi * 2. Redistributions in binary form must reproduce the above copyright 13*cfe60390STomohiro Kusumi * notice, this list of conditions and the following disclaimer in the 14*cfe60390STomohiro Kusumi * documentation and/or other materials provided with the distribution. 15*cfe60390STomohiro Kusumi * 3. Neither the name of the University nor the names of its contributors 16*cfe60390STomohiro Kusumi * may be used to endorse or promote products derived from this software 17*cfe60390STomohiro Kusumi * without specific prior written permission. 18*cfe60390STomohiro Kusumi * 19*cfe60390STomohiro Kusumi * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20*cfe60390STomohiro Kusumi * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21*cfe60390STomohiro Kusumi * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22*cfe60390STomohiro Kusumi * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23*cfe60390STomohiro Kusumi * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24*cfe60390STomohiro Kusumi * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25*cfe60390STomohiro Kusumi * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26*cfe60390STomohiro Kusumi * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27*cfe60390STomohiro Kusumi * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28*cfe60390STomohiro Kusumi * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29*cfe60390STomohiro Kusumi * SUCH DAMAGE. 30*cfe60390STomohiro Kusumi * 31*cfe60390STomohiro Kusumi * @(#)ufsmount.h 8.6 (Berkeley) 3/30/95 32*cfe60390STomohiro Kusumi * $FreeBSD$ 33*cfe60390STomohiro Kusumi */ 34*cfe60390STomohiro Kusumi 35*cfe60390STomohiro Kusumi #ifndef _FS_EXT2FS_EXT2_MOUNT_H_ 36*cfe60390STomohiro Kusumi #define _FS_EXT2FS_EXT2_MOUNT_H_ 37*cfe60390STomohiro Kusumi 38*cfe60390STomohiro Kusumi #ifdef _KERNEL 39*cfe60390STomohiro Kusumi 40*cfe60390STomohiro Kusumi #ifdef MALLOC_DECLARE 41*cfe60390STomohiro Kusumi MALLOC_DECLARE(M_EXT2NODE); 42*cfe60390STomohiro Kusumi #endif 43*cfe60390STomohiro Kusumi 44*cfe60390STomohiro Kusumi struct vnode; 45*cfe60390STomohiro Kusumi 46*cfe60390STomohiro Kusumi /* 47*cfe60390STomohiro Kusumi * Arguments to mount UFS-based filesystems 48*cfe60390STomohiro Kusumi */ 49*cfe60390STomohiro Kusumi struct ext2_args { 50*cfe60390STomohiro Kusumi char *fspec; /* block special device to mount */ 51*cfe60390STomohiro Kusumi struct export_args export; /* network export information */ 52*cfe60390STomohiro Kusumi }; 53*cfe60390STomohiro Kusumi 54*cfe60390STomohiro Kusumi /* This structure describes the ext2fs specific mount structure data. */ 55*cfe60390STomohiro Kusumi struct ext2mount { 56*cfe60390STomohiro Kusumi struct mount *um_mountp; /* filesystem vfs structure */ 57*cfe60390STomohiro Kusumi struct cdev *um_dev; /* device mounted */ 58*cfe60390STomohiro Kusumi struct vnode *um_devvp; /* block device mounted vnode */ 59*cfe60390STomohiro Kusumi 60*cfe60390STomohiro Kusumi struct m_ext2fs *um_e2fs; /* EXT2FS */ 61*cfe60390STomohiro Kusumi 62*cfe60390STomohiro Kusumi u_long um_nindir; /* indirect ptrs per block */ 63*cfe60390STomohiro Kusumi u_long um_bptrtodb; /* indir ptr to disk block */ 64*cfe60390STomohiro Kusumi u_long um_seqinc; /* inc between seq blocks */ 65*cfe60390STomohiro Kusumi 66*cfe60390STomohiro Kusumi struct mtx um_lock; /* Protects ext2mount & fs */ 67*cfe60390STomohiro Kusumi 68*cfe60390STomohiro Kusumi struct g_consumer *um_cp; 69*cfe60390STomohiro Kusumi struct bufobj *um_bo; 70*cfe60390STomohiro Kusumi 71*cfe60390STomohiro Kusumi struct netexport um_export; /* export information */ 72*cfe60390STomohiro Kusumi }; 73*cfe60390STomohiro Kusumi 74*cfe60390STomohiro Kusumi #define EXT2_LOCK(aa) mtx_lock(&(aa)->um_lock) 75*cfe60390STomohiro Kusumi #define EXT2_UNLOCK(aa) mtx_unlock(&(aa)->um_lock) 76*cfe60390STomohiro Kusumi #define EXT2_MTX(aa) (&(aa)->um_lock) 77*cfe60390STomohiro Kusumi 78*cfe60390STomohiro Kusumi /* Convert mount ptr to ext2fsmount ptr. */ 79*cfe60390STomohiro Kusumi #define VFSTOEXT2(mp) ((struct ext2mount *)((mp)->mnt_data)) 80*cfe60390STomohiro Kusumi 81*cfe60390STomohiro Kusumi /* 82*cfe60390STomohiro Kusumi * Macros to access file system parameters in the ufsmount structure. 83*cfe60390STomohiro Kusumi * Used by ufs_bmap. 84*cfe60390STomohiro Kusumi */ 85*cfe60390STomohiro Kusumi #define MNINDIR(ump) ((ump)->um_nindir) 86*cfe60390STomohiro Kusumi #define blkptrtodb(ump, b) ((b) << (ump)->um_bptrtodb) 87*cfe60390STomohiro Kusumi #define is_sequential(ump, a, b) ((b) == (a) + ump->um_seqinc) 88*cfe60390STomohiro Kusumi #endif /* _KERNEL */ 89*cfe60390STomohiro Kusumi 90*cfe60390STomohiro Kusumi #endif /* !_FS_EXT2FS_EXT2_MOUNT_H_ */ 91