1 /*
2  * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of version 2 of the GNU General Public License as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it would be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  *
12  * Further, this software is distributed without any warranty that it is
13  * free of the rightful claim of any third person regarding infringement
14  * or the like.  Any license provided herein, whether implied or
15  * otherwise, applies only to this software file.  Patent licenses, if
16  * any, provided herein do not apply to combinations of this program with
17  * other software, or any other product whatsoever.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write the Free Software Foundation, Inc., 59
21  * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22  *
23  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24  * Mountain View, CA  94043, or:
25  *
26  * http://www.sgi.com
27  *
28  * For further information regarding this notice, see:
29  *
30  * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31  */
32 #ifndef __XFS_SUPER_H__
33 #define __XFS_SUPER_H__
34 
35 #ifdef CONFIG_XFS_DMAPI
36 # define vfs_insertdmapi(vfs)	vfs_insertops(vfsp, &xfs_dmops)
37 # define vfs_initdmapi()	dmapi_init()
38 # define vfs_exitdmapi()	dmapi_uninit()
39 #else
40 # define vfs_insertdmapi(vfs)	do { } while (0)
41 # define vfs_initdmapi()	do { } while (0)
42 # define vfs_exitdmapi()	do { } while (0)
43 #endif
44 
45 #ifdef CONFIG_XFS_QUOTA
46 # define vfs_insertquota(vfs)	vfs_insertops(vfsp, &xfs_qmops)
47 extern void xfs_qm_init(void);
48 extern void xfs_qm_exit(void);
49 # define vfs_initquota()	xfs_qm_init()
50 # define vfs_exitquota()	xfs_qm_exit()
51 #else
52 # define vfs_insertquota(vfs)	do { } while (0)
53 # define vfs_initquota()	do { } while (0)
54 # define vfs_exitquota()	do { } while (0)
55 #endif
56 
57 #ifdef CONFIG_XFS_POSIX_ACL
58 # define XFS_ACL_STRING		"ACLs, "
59 # define set_posix_acl_flag(sb)	((sb)->s_flags |= MS_POSIXACL)
60 #else
61 # define XFS_ACL_STRING
62 # define set_posix_acl_flag(sb)	do { } while (0)
63 #endif
64 
65 #ifdef CONFIG_XFS_SECURITY
66 # define XFS_SECURITY_STRING	"security attributes, "
67 # define ENOSECURITY		0
68 #else
69 # define XFS_SECURITY_STRING
70 # define ENOSECURITY		EOPNOTSUPP
71 #endif
72 
73 #ifdef CONFIG_XFS_RT
74 # define XFS_REALTIME_STRING	"realtime, "
75 #else
76 # define XFS_REALTIME_STRING
77 #endif
78 
79 #if XFS_BIG_BLKNOS
80 # if XFS_BIG_INUMS
81 #  define XFS_BIGFS_STRING	"large block/inode numbers, "
82 # else
83 #  define XFS_BIGFS_STRING	"large block numbers, "
84 # endif
85 #else
86 # define XFS_BIGFS_STRING
87 #endif
88 
89 #ifdef CONFIG_XFS_TRACE
90 # define XFS_TRACE_STRING	"tracing, "
91 #else
92 # define XFS_TRACE_STRING
93 #endif
94 
95 #ifdef CONFIG_XFS_DMAPI
96 # define XFS_DMAPI_STRING	"dmapi support, "
97 #else
98 # define XFS_DMAPI_STRING
99 #endif
100 
101 #ifdef DEBUG
102 # define XFS_DBG_STRING		"debug"
103 #else
104 # define XFS_DBG_STRING		"no debug"
105 #endif
106 
107 #define XFS_BUILD_OPTIONS	XFS_ACL_STRING \
108 				XFS_SECURITY_STRING \
109 				XFS_REALTIME_STRING \
110 				XFS_BIGFS_STRING \
111 				XFS_TRACE_STRING \
112 				XFS_DMAPI_STRING \
113 				XFS_DBG_STRING /* DBG must be last */
114 
115 #define LINVFS_GET_VFS(s) \
116 	(vfs_t *)((s)->u.generic_sbp)
117 #define LINVFS_SET_VFS(s, vfsp) \
118 	((s)->u.generic_sbp = vfsp)
119 
120 struct xfs_inode;
121 struct xfs_mount;
122 struct xfs_buftarg;
123 struct block_device;
124 
125 extern __uint64_t xfs_max_file_offset(unsigned int);
126 
127 extern struct inode *xfs_get_inode(bhv_desc_t *, xfs_ino_t, int);
128 extern void xfs_initialize_vnode(bhv_desc_t *, vnode_t *, bhv_desc_t *, int);
129 
130 extern void xfs_flush_inode(struct xfs_inode *);
131 extern void xfs_flush_device(struct xfs_inode *);
132 
133 extern int  xfs_blkdev_get(struct xfs_mount *, const char *,
134 				struct block_device **);
135 extern void xfs_blkdev_put(struct block_device *);
136 
137 /* matching a 2.6 kernel export, thus no xfs_ prefix */
138 extern struct dentry *d_alloc_anon(struct inode *inode);
139 extern struct super_block *freeze_bdev(struct block_device *bdev);
140 extern void thaw_bdev(struct block_device *bdev, struct super_block *sb);
141 
142 #endif	/* __XFS_SUPER_H__ */
143