xref: /freebsd/sys/fs/smbfs/smbfs.h (revision 8e67c4546268d5a80fc4c79d8701c5e8c29bbee5)
1681a5bbeSBoris Popov /*
2681a5bbeSBoris Popov  * Copyright (c) 2000-2001, Boris Popov
3681a5bbeSBoris Popov  * All rights reserved.
4681a5bbeSBoris Popov  *
5681a5bbeSBoris Popov  * Redistribution and use in source and binary forms, with or without
6681a5bbeSBoris Popov  * modification, are permitted provided that the following conditions
7681a5bbeSBoris Popov  * are met:
8681a5bbeSBoris Popov  * 1. Redistributions of source code must retain the above copyright
9681a5bbeSBoris Popov  *    notice, this list of conditions and the following disclaimer.
10681a5bbeSBoris Popov  * 2. Redistributions in binary form must reproduce the above copyright
11681a5bbeSBoris Popov  *    notice, this list of conditions and the following disclaimer in the
12681a5bbeSBoris Popov  *    documentation and/or other materials provided with the distribution.
13681a5bbeSBoris Popov  * 3. All advertising materials mentioning features or use of this software
14681a5bbeSBoris Popov  *    must display the following acknowledgement:
15681a5bbeSBoris Popov  *    This product includes software developed by Boris Popov.
16681a5bbeSBoris Popov  * 4. Neither the name of the author nor the names of any co-contributors
17681a5bbeSBoris Popov  *    may be used to endorse or promote products derived from this software
18681a5bbeSBoris Popov  *    without specific prior written permission.
19681a5bbeSBoris Popov  *
20681a5bbeSBoris Popov  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21681a5bbeSBoris Popov  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22681a5bbeSBoris Popov  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23681a5bbeSBoris Popov  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24681a5bbeSBoris Popov  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25681a5bbeSBoris Popov  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26681a5bbeSBoris Popov  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27681a5bbeSBoris Popov  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28681a5bbeSBoris Popov  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29681a5bbeSBoris Popov  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30681a5bbeSBoris Popov  * SUCH DAMAGE.
31681a5bbeSBoris Popov  *
32681a5bbeSBoris Popov  * $FreeBSD$
33681a5bbeSBoris Popov  */
34681a5bbeSBoris Popov #ifndef _SMBFS_SMBFS_H_
35681a5bbeSBoris Popov #define _SMBFS_SMBFS_H_
36681a5bbeSBoris Popov 
37681a5bbeSBoris Popov #define SMBFS_VERMAJ	1
38681a5bbeSBoris Popov #define SMBFS_VERMIN	1012
39681a5bbeSBoris Popov #define SMBFS_VERSION	(SMBFS_VERMAJ*100000 + SMBFS_VERMIN)
40681a5bbeSBoris Popov #define	SMBFS_VFSNAME	"smbfs"
41681a5bbeSBoris Popov 
42681a5bbeSBoris Popov /* Values for flags */
43681a5bbeSBoris Popov #define SMBFS_MOUNT_SOFT	0x0001
44681a5bbeSBoris Popov #define SMBFS_MOUNT_INTR	0x0002
45681a5bbeSBoris Popov #define SMBFS_MOUNT_STRONG	0x0004
46681a5bbeSBoris Popov #define	SMBFS_MOUNT_HAVE_NLS	0x0008
47681a5bbeSBoris Popov #define	SMBFS_MOUNT_NO_LONG	0x0010
48681a5bbeSBoris Popov 
49681a5bbeSBoris Popov #define	SMBFS_MAXPATHCOMP	256	/* maximum number of path components */
50681a5bbeSBoris Popov 
51681a5bbeSBoris Popov 
523c2f5c3cSBoris Popov /* Layout of the mount control block for an smb file system. */
53681a5bbeSBoris Popov struct smbfs_args {
54681a5bbeSBoris Popov 	int		version;
55681a5bbeSBoris Popov 	int		dev;
56681a5bbeSBoris Popov 	u_int		flags;
57681a5bbeSBoris Popov 	char		mount_point[MAXPATHLEN];
58681a5bbeSBoris Popov 	u_char		root_path[512+1];
59681a5bbeSBoris Popov 	uid_t		uid;
60681a5bbeSBoris Popov 	gid_t 		gid;
61681a5bbeSBoris Popov 	mode_t 		file_mode;
62681a5bbeSBoris Popov 	mode_t 		dir_mode;
63681a5bbeSBoris Popov 	int		caseopt;
64681a5bbeSBoris Popov };
65681a5bbeSBoris Popov 
66681a5bbeSBoris Popov #ifdef _KERNEL
67681a5bbeSBoris Popov 
68681a5bbeSBoris Popov #ifdef MALLOC_DECLARE
69681a5bbeSBoris Popov MALLOC_DECLARE(M_SMBFSMNT);
70681a5bbeSBoris Popov #endif
71681a5bbeSBoris Popov 
72681a5bbeSBoris Popov struct smbnode;
73681a5bbeSBoris Popov struct smb_share;
74681a5bbeSBoris Popov struct u_cred;
758e67c454STim J. Robbins struct vop_ioctl_args;
76681a5bbeSBoris Popov struct buf;
77681a5bbeSBoris Popov 
78681a5bbeSBoris Popov struct smbmount {
79681a5bbeSBoris Popov 	struct smbfs_args	sm_args;
80681a5bbeSBoris Popov 	struct mount * 		sm_mp;
81681a5bbeSBoris Popov 	struct smbnode *	sm_root;
82681a5bbeSBoris Popov 	struct ucred *		sm_owner;
83681a5bbeSBoris Popov 	int			sm_flags;
84681a5bbeSBoris Popov 	long			sm_nextino;
85681a5bbeSBoris Popov 	struct smb_share * 	sm_share;
86681a5bbeSBoris Popov /*	struct simplelock	sm_npslock;*/
87681a5bbeSBoris Popov 	struct smbnode *	sm_npstack[SMBFS_MAXPATHCOMP];
88681a5bbeSBoris Popov 	int			sm_caseopt;
89681a5bbeSBoris Popov 	struct lock		sm_hashlock;
90681a5bbeSBoris Popov 	LIST_HEAD(smbnode_hashhead, smbnode) *sm_hash;
91681a5bbeSBoris Popov 	u_long			sm_hashlen;
92578dcf0cSTim J. Robbins 	int			sm_didrele;
93681a5bbeSBoris Popov };
94681a5bbeSBoris Popov 
95681a5bbeSBoris Popov #define VFSTOSMBFS(mp)		((struct smbmount *)((mp)->mnt_data))
96681a5bbeSBoris Popov #define SMBFSTOVFS(smp)		((struct mount *)((smp)->sm_mp))
97681a5bbeSBoris Popov #define VTOVFS(vp)		((vp)->v_mount)
98681a5bbeSBoris Popov #define	VTOSMBFS(vp)		(VFSTOSMBFS(VTOVFS(vp)))
99681a5bbeSBoris Popov 
1008e67c454STim J. Robbins int smbfs_ioctl(struct vop_ioctl_args *ap);
101b1c996c4SBoris Popov int smbfs_doio(struct buf *bp, struct ucred *cr, struct thread *td);
102681a5bbeSBoris Popov int smbfs_vinvalbuf(struct vnode *vp, int flags, struct ucred *cred,
103b1c996c4SBoris Popov 	struct thread *td, int intrflg);
104681a5bbeSBoris Popov #endif	/* KERNEL */
105681a5bbeSBoris Popov 
106681a5bbeSBoris Popov #endif /* _SMBFS_SMBFS_H_ */
107