xref: /freebsd/sys/fs/smbfs/smbfs.h (revision 4d846d260e2b9a3d4d0a701462568268cbfe7a5b)
1d167cf6fSWarner Losh /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3d63027b6SPedro F. Giffuni  *
4d122d784SJoel Dahl  * Copyright (c) 2000-2001 Boris Popov
5681a5bbeSBoris Popov  * All rights reserved.
6681a5bbeSBoris Popov  *
7681a5bbeSBoris Popov  * Redistribution and use in source and binary forms, with or without
8681a5bbeSBoris Popov  * modification, are permitted provided that the following conditions
9681a5bbeSBoris Popov  * are met:
10681a5bbeSBoris Popov  * 1. Redistributions of source code must retain the above copyright
11681a5bbeSBoris Popov  *    notice, this list of conditions and the following disclaimer.
12681a5bbeSBoris Popov  * 2. Redistributions in binary form must reproduce the above copyright
13681a5bbeSBoris Popov  *    notice, this list of conditions and the following disclaimer in the
14681a5bbeSBoris Popov  *    documentation and/or other materials provided with the distribution.
15681a5bbeSBoris Popov  *
16681a5bbeSBoris Popov  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17681a5bbeSBoris Popov  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18681a5bbeSBoris Popov  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19681a5bbeSBoris Popov  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20681a5bbeSBoris Popov  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21681a5bbeSBoris Popov  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22681a5bbeSBoris Popov  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23681a5bbeSBoris Popov  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24681a5bbeSBoris Popov  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25681a5bbeSBoris Popov  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26681a5bbeSBoris Popov  * SUCH DAMAGE.
27681a5bbeSBoris Popov  *
28681a5bbeSBoris Popov  * $FreeBSD$
29681a5bbeSBoris Popov  */
30681a5bbeSBoris Popov #ifndef _SMBFS_SMBFS_H_
31681a5bbeSBoris Popov #define _SMBFS_SMBFS_H_
32681a5bbeSBoris Popov 
33681a5bbeSBoris Popov #define SMBFS_VERMAJ	1
34681a5bbeSBoris Popov #define SMBFS_VERMIN	1012
35681a5bbeSBoris Popov #define SMBFS_VERSION	(SMBFS_VERMAJ*100000 + SMBFS_VERMIN)
36681a5bbeSBoris Popov #define	SMBFS_VFSNAME	"smbfs"
37681a5bbeSBoris Popov 
38681a5bbeSBoris Popov /* Values for flags */
39681a5bbeSBoris Popov #define SMBFS_MOUNT_SOFT	0x0001
40681a5bbeSBoris Popov #define SMBFS_MOUNT_INTR	0x0002
41681a5bbeSBoris Popov #define SMBFS_MOUNT_STRONG	0x0004
42681a5bbeSBoris Popov #define	SMBFS_MOUNT_HAVE_NLS	0x0008
43681a5bbeSBoris Popov #define	SMBFS_MOUNT_NO_LONG	0x0010
44681a5bbeSBoris Popov 
45681a5bbeSBoris Popov #define	SMBFS_MAXPATHCOMP	256	/* maximum number of path components */
46681a5bbeSBoris Popov 
473c2f5c3cSBoris Popov /* Layout of the mount control block for an smb file system. */
48681a5bbeSBoris Popov struct smbfs_args {
49681a5bbeSBoris Popov 	int		version;
50681a5bbeSBoris Popov 	int		dev;
51681a5bbeSBoris Popov 	u_int		flags;
52681a5bbeSBoris Popov 	char		mount_point[MAXPATHLEN];
53681a5bbeSBoris Popov 	u_char		root_path[512+1];
54681a5bbeSBoris Popov 	uid_t		uid;
55681a5bbeSBoris Popov 	gid_t 		gid;
56681a5bbeSBoris Popov 	mode_t 		file_mode;
57681a5bbeSBoris Popov 	mode_t 		dir_mode;
58681a5bbeSBoris Popov 	int		caseopt;
59681a5bbeSBoris Popov };
60681a5bbeSBoris Popov 
61681a5bbeSBoris Popov #ifdef _KERNEL
62681a5bbeSBoris Popov 
637947229fSRobert Watson #include <sys/_sx.h>
647947229fSRobert Watson 
65681a5bbeSBoris Popov struct smbnode;
66681a5bbeSBoris Popov struct smb_share;
67681a5bbeSBoris Popov struct u_cred;
688e67c454STim J. Robbins struct vop_ioctl_args;
69681a5bbeSBoris Popov struct buf;
70681a5bbeSBoris Popov 
71681a5bbeSBoris Popov struct smbmount {
72d14c8441SPoul-Henning Kamp 	/* struct smbfs_args	sm_args; */
73d14c8441SPoul-Henning Kamp 	uid_t			sm_uid;
74d14c8441SPoul-Henning Kamp 	gid_t 			sm_gid;
75d14c8441SPoul-Henning Kamp 	mode_t 			sm_file_mode;
76d14c8441SPoul-Henning Kamp 	mode_t 			sm_dir_mode;
77681a5bbeSBoris Popov 	struct mount * 		sm_mp;
78681a5bbeSBoris Popov 	struct smbnode *	sm_root;
7992a4d9bcSDavide Italiano 	struct smb_dev *	sm_dev;
80681a5bbeSBoris Popov 	struct ucred *		sm_owner;
816beb3bb4SKirk McKusick 	uint64_t		sm_flags;
82681a5bbeSBoris Popov 	long			sm_nextino;
83681a5bbeSBoris Popov 	struct smb_share * 	sm_share;
84681a5bbeSBoris Popov 	struct smbnode *	sm_npstack[SMBFS_MAXPATHCOMP];
85681a5bbeSBoris Popov 	int			sm_caseopt;
86578dcf0cSTim J. Robbins 	int			sm_didrele;
87681a5bbeSBoris Popov };
88681a5bbeSBoris Popov 
89681a5bbeSBoris Popov #define VFSTOSMBFS(mp)		((struct smbmount *)((mp)->mnt_data))
90681a5bbeSBoris Popov #define SMBFSTOVFS(smp)		((struct mount *)((smp)->sm_mp))
91681a5bbeSBoris Popov #define VTOVFS(vp)		((vp)->v_mount)
92681a5bbeSBoris Popov #define	VTOSMBFS(vp)		(VFSTOSMBFS(VTOVFS(vp)))
93681a5bbeSBoris Popov 
948e67c454STim J. Robbins int smbfs_ioctl(struct vop_ioctl_args *ap);
95066a8feaSPoul-Henning Kamp int smbfs_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td);
96e50508dfSPoul-Henning Kamp int smbfs_vinvalbuf(struct vnode *vp, struct thread *td);
97681a5bbeSBoris Popov #endif	/* KERNEL */
98681a5bbeSBoris Popov 
99681a5bbeSBoris Popov #endif /* _SMBFS_SMBFS_H_ */
100