ufsmount.h revision 136979
1296633Sdes/*
257429Smarkm * Copyright (c) 1982, 1986, 1989, 1993
357429Smarkm *	The Regents of the University of California.  All rights reserved.
457429Smarkm *
557429Smarkm * Redistribution and use in source and binary forms, with or without
657429Smarkm * modification, are permitted provided that the following conditions
765668Skris * are met:
865668Skris * 1. Redistributions of source code must retain the above copyright
965668Skris *    notice, this list of conditions and the following disclaimer.
1065668Skris * 2. Redistributions in binary form must reproduce the above copyright
1165668Skris *    notice, this list of conditions and the following disclaimer in the
1265668Skris *    documentation and/or other materials provided with the distribution.
1365668Skris * 4. Neither the name of the University nor the names of its contributors
1465668Skris *    may be used to endorse or promote products derived from this software
1592559Sdes *    without specific prior written permission.
1665668Skris *
1765668Skris * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1865668Skris * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1965668Skris * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2065668Skris * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2165668Skris * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2265668Skris * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2365668Skris * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2465668Skris * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2565668Skris * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2665668Skris * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2765668Skris * SUCH DAMAGE.
2865668Skris *
2965668Skris *	@(#)ufsmount.h	8.6 (Berkeley) 3/30/95
3065668Skris * $FreeBSD: head/sys/ufs/ufs/ufsmount.h 136979 2004-10-26 20:12:00Z phk $
3165668Skris */
3265668Skris
3365668Skris#ifndef _UFS_UFS_UFSMOUNT_H_
3465668Skris#define _UFS_UFS_UFSMOUNT_H_
3565668Skris
3657429Smarkm/*
3757429Smarkm * Arguments to mount UFS-based filesystems
3857429Smarkm */
3957429Smarkmstruct ufs_args {
40162856Sdes	char	*fspec;			/* block special device to mount */
41162856Sdes	struct	export_args export;	/* network export information */
42162856Sdes};
4365668Skris
44181111Sdes#ifdef _KERNEL
4560573Skris
46294332Sdes#ifdef MALLOC_DECLARE
47162856SdesMALLOC_DECLARE(M_UFSMNT);
48162856Sdes#endif
49162856Sdes
50162856Sdesstruct buf;
51162856Sdesstruct inode;
52162856Sdesstruct nameidata;
53162856Sdesstruct timeval;
54294332Sdesstruct ucred;
55162856Sdesstruct uio;
56162856Sdesstruct vnode;
5776262Sgreenstruct ufs_extattr_per_mount;
5857429Smarkm
5976262Sgreen/* This structure describes the UFS specific mount structure data. */
60294332Sdesstruct ufsmount {
61294332Sdes	struct	mount *um_mountp;		/* filesystem vfs structure */
6257429Smarkm	struct cdev *um_dev;			/* device mounted */
6360573Skris	struct	vnode *um_devvp;		/* block device mounted vnode */
6476262Sgreen	u_long	um_fstype;			/* type of filesystem */
6598684Sdes	struct	fs *um_fs;			/* pointer to superblock */
66294328Sdes	struct	vnode *um_quotas[MAXQUOTAS];	/* pointer to quota files */
67294332Sdes	struct	ucred *um_cred[MAXQUOTAS];	/* quota file access cred */
6857429Smarkm	struct	ufs_extattr_per_mount um_extattr;	/* extended attrs */
6992559Sdes	u_long	um_nindir;			/* indirect ptrs per block */
7092559Sdes	u_long	um_bptrtodb;			/* indir ptr to disk block */
7192559Sdes	u_long	um_seqinc;			/* inc between seq blocks */
7292559Sdes	long	um_numindirdeps;		/* indirdeps for this filesys */
7392559Sdes	time_t	um_btime[MAXQUOTAS];		/* block quota time limit */
74294332Sdes	time_t	um_itime[MAXQUOTAS];		/* inode quota time limit */
7592559Sdes	char	um_qflags[MAXQUOTAS];		/* quota specific flags */
7692559Sdes	int64_t	um_savedmaxfilesize;		/* XXX - limit maxfilesize */
77221420Sdes	int	(*um_balloc)(struct vnode *, off_t, int, struct ucred *, int, struct buf **);
78221420Sdes	int	(*um_blkatoff)(struct vnode *, off_t, char **, struct buf **);
79221420Sdes	int	(*um_truncate)(struct vnode *, off_t, int, struct ucred *, struct thread *);
80294332Sdes	int	(*um_update)(struct vnode *, int);
81261320Sdes	int	(*um_valloc)(struct vnode *, int, struct ucred *, struct vnode **);
82294336Sdes	int	(*um_vfree)(struct vnode *, ino_t, int);
8398684Sdes	void	(*um_ifree)(struct ufsmount *, struct inode *);
84294336Sdes};
8592559Sdes
8692559Sdes#define UFS_BALLOC(aa, bb, cc, dd, ee, ff) VFSTOUFS((aa)->v_mount)->um_balloc(aa, bb, cc, dd, ee, ff)
8792559Sdes#define UFS_BLKATOFF(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_blkatoff(aa, bb, cc, dd)
88294332Sdes#define UFS_TRUNCATE(aa, bb, cc, dd, ee) VFSTOUFS((aa)->v_mount)->um_truncate(aa, bb, cc, dd, ee)
89294332Sdes#define UFS_UPDATE(aa, bb) VFSTOUFS((aa)->v_mount)->um_update(aa, bb)
9098684Sdes#define UFS_VALLOC(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_valloc(aa, bb, cc, dd)
9198684Sdes#define UFS_VFREE(aa, bb, cc) VFSTOUFS((aa)->v_mount)->um_vfree(aa, bb, cc)
9292559Sdes#define UFS_IFREE(aa, bb) ((aa)->um_ifree(aa, bb))
93113911Sdes
94113911Sdes/*
95113911Sdes * Filesystem types
96296633Sdes */
9776262Sgreen#define UFS1	1
9892559Sdes#define UFS2	2
9976262Sgreen
10076262Sgreen/*
10176262Sgreen * Flags describing the state of quotas.
102263712Sdes */
103255767Sdes#define	QTF_OPENING	0x01			/* Q_QUOTAON in progress */
10476262Sgreen#define	QTF_CLOSING	0x02			/* Q_QUOTAOFF in progress */
10576262Sgreen
10676262Sgreen/* Convert mount ptr to ufsmount ptr. */
10776262Sgreen#define VFSTOUFS(mp)	((struct ufsmount *)((mp)->mnt_data))
10892559Sdes
109294332Sdes/*
11057429Smarkm * Macros to access filesystem parameters in the ufsmount structure.
111294332Sdes * Used by ufs_bmap.
112248619Sdes */
113294332Sdes#define MNINDIR(ump)			((ump)->um_nindir)
11457429Smarkm#define	blkptrtodb(ump, b)		((b) << (ump)->um_bptrtodb)
115294332Sdes#define	is_sequential(ump, a, b)	((b) == (a) + ump->um_seqinc)
116294332Sdes#endif /* _KERNEL */
11792559Sdes
11857429Smarkm#endif
119294332Sdes