1139776Simp/*-
2206361Sjoel * Copyright (c) 2000-2001 Boris Popov
375374Sbp * All rights reserved.
475374Sbp *
575374Sbp * Redistribution and use in source and binary forms, with or without
675374Sbp * modification, are permitted provided that the following conditions
775374Sbp * are met:
875374Sbp * 1. Redistributions of source code must retain the above copyright
975374Sbp *    notice, this list of conditions and the following disclaimer.
1075374Sbp * 2. Redistributions in binary form must reproduce the above copyright
1175374Sbp *    notice, this list of conditions and the following disclaimer in the
1275374Sbp *    documentation and/or other materials provided with the distribution.
1375374Sbp *
1475374Sbp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1575374Sbp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1675374Sbp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1775374Sbp * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1875374Sbp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1975374Sbp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2075374Sbp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2175374Sbp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2275374Sbp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2375374Sbp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2475374Sbp * SUCH DAMAGE.
2575374Sbp *
2675374Sbp * $FreeBSD$
2775374Sbp */
2875374Sbp#ifndef _SMBFS_SMBFS_H_
2975374Sbp#define _SMBFS_SMBFS_H_
3075374Sbp
3175374Sbp#define SMBFS_VERMAJ	1
3275374Sbp#define SMBFS_VERMIN	1012
3375374Sbp#define SMBFS_VERSION	(SMBFS_VERMAJ*100000 + SMBFS_VERMIN)
3475374Sbp#define	SMBFS_VFSNAME	"smbfs"
3575374Sbp
3675374Sbp/* Values for flags */
3775374Sbp#define SMBFS_MOUNT_SOFT	0x0001
3875374Sbp#define SMBFS_MOUNT_INTR	0x0002
3975374Sbp#define SMBFS_MOUNT_STRONG	0x0004
4075374Sbp#define	SMBFS_MOUNT_HAVE_NLS	0x0008
4175374Sbp#define	SMBFS_MOUNT_NO_LONG	0x0010
4275374Sbp
4375374Sbp#define	SMBFS_MAXPATHCOMP	256	/* maximum number of path components */
4475374Sbp
4575374Sbp
46103533Sbp/* Layout of the mount control block for an smb file system. */
4775374Sbpstruct smbfs_args {
4875374Sbp	int		version;
4975374Sbp	int		dev;
5075374Sbp	u_int		flags;
5175374Sbp	char		mount_point[MAXPATHLEN];
5275374Sbp	u_char		root_path[512+1];
5375374Sbp	uid_t		uid;
5475374Sbp	gid_t 		gid;
5575374Sbp	mode_t 		file_mode;
5675374Sbp	mode_t 		dir_mode;
5775374Sbp	int		caseopt;
5875374Sbp};
5975374Sbp
6075374Sbp#ifdef _KERNEL
6175374Sbp
62176744Srwatson#include <sys/_sx.h>
63176744Srwatson
6475374Sbp#ifdef MALLOC_DECLARE
6575374SbpMALLOC_DECLARE(M_SMBFSMNT);
6675374Sbp#endif
6775374Sbp
6875374Sbpstruct smbnode;
6975374Sbpstruct smb_share;
7075374Sbpstruct u_cred;
71110533Stjrstruct vop_ioctl_args;
7275374Sbpstruct buf;
7375374Sbp
7475374Sbpstruct smbmount {
75138490Sphk	/* struct smbfs_args	sm_args; */
76138490Sphk	uid_t			sm_uid;
77138490Sphk	gid_t 			sm_gid;
78138490Sphk	mode_t 			sm_file_mode;
79138490Sphk	mode_t 			sm_dir_mode;
8075374Sbp	struct mount * 		sm_mp;
8175374Sbp	struct smbnode *	sm_root;
8275374Sbp	struct ucred *		sm_owner;
83224290Smckusick	uint64_t		sm_flags;
8475374Sbp	long			sm_nextino;
8575374Sbp	struct smb_share * 	sm_share;
8675374Sbp/*	struct simplelock	sm_npslock;*/
8775374Sbp	struct smbnode *	sm_npstack[SMBFS_MAXPATHCOMP];
8875374Sbp	int			sm_caseopt;
89176744Srwatson	struct sx		sm_hashlock;
9075374Sbp	LIST_HEAD(smbnode_hashhead, smbnode) *sm_hash;
9175374Sbp	u_long			sm_hashlen;
92107842Stjr	int			sm_didrele;
9375374Sbp};
9475374Sbp
9575374Sbp#define VFSTOSMBFS(mp)		((struct smbmount *)((mp)->mnt_data))
9675374Sbp#define SMBFSTOVFS(smp)		((struct mount *)((smp)->sm_mp))
9775374Sbp#define VTOVFS(vp)		((vp)->v_mount)
9875374Sbp#define	VTOSMBFS(vp)		(VFSTOSMBFS(VTOVFS(vp)))
9975374Sbp
100110533Stjrint smbfs_ioctl(struct vop_ioctl_args *ap);
101134897Sphkint smbfs_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td);
102140223Sphkint smbfs_vinvalbuf(struct vnode *vp, struct thread *td);
10375374Sbp#endif	/* KERNEL */
10475374Sbp
10575374Sbp#endif /* _SMBFS_SMBFS_H_ */
106