xref: /titanic_44/usr/src/uts/common/fs/smbclnt/smbfs/smbfs.h (revision d00756ccb34596a328f8a15d1965da5412d366d0)
1 /*
2  * Copyright (c) 2000-2001, Boris Popov
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *    This product includes software developed by Boris Popov.
16  * 4. Neither the name of the author nor the names of any co-contributors
17  *    may be used to endorse or promote products derived from this software
18  *    without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30  * SUCH DAMAGE.
31  *
32  * $Id: smbfs.h,v 1.30.100.1 2005/05/27 02:35:28 lindak Exp $
33  */
34 
35 /*
36  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
37  * Use is subject to license terms.
38  */
39 
40 #ifndef	_SMBFS_SMBFS_H
41 #define	_SMBFS_SMBFS_H
42 
43 #pragma ident	"%Z%%M%	%I%	%E% SMI"
44 
45 /*
46  * FS-specific VFS structures for smbfs.
47  * (per-mount stuff, etc.)
48  *
49  * This file used to have mount args stuff,
50  * but that's now in sys/fs/smbfs_mount.h
51  */
52 
53 #include <sys/list.h>
54 #include <sys/vfs.h>
55 #include <sys/fs/smbfs_mount.h>
56 
57 
58 /*
59  * SM_MAX_STATFSTIME is the maximum time to cache statvfs data. Since this
60  * should be a fast call on the server, the time the data cached is short.
61  * That lets the cache handle bursts of statvfs() requests without generating
62  * lots of network traffic.
63  */
64 #define	SM_MAX_STATFSTIME 2
65 
66 /* Mask values for smbmount structure sm_status field */
67 #define	SM_STATUS_STATFS_BUSY 0x00000001 /* statvfs is in progress */
68 #define	SM_STATUS_STATFS_WANT 0x00000002 /* statvfs wakeup is wanted */
69 #define	SM_STATUS_TIMEO 0x00000004 /* this mount is not responding */
70 #define	SM_STATUS_DEAD	0x00000010 /* connection gone - unmount this */
71 
72 extern const struct fs_operation_def	smbfs_vnodeops_template[];
73 extern struct vnodeops			*smbfs_vnodeops;
74 
75 struct smbnode;
76 struct smb_share;
77 
78 /*
79  * The values for smi_flags.
80  */
81 #define	SMI_INT		0x01		/* interrupts allowed */
82 #define	SMI_DEAD	0x02		/* zone shutting down */
83 #define	SMI_LLOCK	0x80		/* local locking only */
84 
85 /*
86  * Corresponds to Darwin: struct smbmount
87  */
88 typedef struct smbmntinfo {
89 	struct vfs		*smi_vfsp;	/* mount back pointer to vfs */
90 	struct smbnode		*smi_root;	/* the root node */
91 	struct smb_share	*smi_share;	/* netsmb SMB share conn data */
92 	kmutex_t		smi_lock;	/* mutex for flags, etc. */
93 	uint32_t		smi_flags;	/* NFS-derived flag bits */
94 	uint32_t		smi_fsattr;	/* acls & streams opts */
95 	uint32_t		smi_status;	/* status bits for this mount */
96 	hrtime_t		smi_statfstime;	/* sm_statvfsbuf cache time */
97 	statvfs64_t		smi_statvfsbuf;	/* cached statvfs data */
98 	kcondvar_t		smi_statvfs_cv;
99 
100 	/*
101 	 * Kstat statistics
102 	 */
103 	struct kstat    *smi_io_kstats;
104 	struct kstat    *smi_ro_kstats;
105 
106 	/*
107 	 * Zones support.
108 	 */
109 	struct zone		*smi_zone;	/* Zone mounted in */
110 	list_node_t		smi_zone_node;	/* Link to per-zone smi list */
111 	/* Lock for the list is: smi_globals_t -> smg_lock */
112 
113 	/*
114 	 * Copy of the args from mount.
115 	 */
116 	struct smbfs_args	smi_args;
117 } smbmntinfo_t;
118 
119 typedef struct smbfattr {
120 	int		fa_attr;
121 	len_t		fa_size;
122 	struct timespec fa_atime;
123 	struct timespec fa_ctime;
124 	struct timespec fa_mtime;
125 	ino64_t		fa_ino;
126 	struct timespec fa_reqtime;
127 } smbfattr_t;
128 
129 /*
130  * vnode pointer to mount info
131  */
132 #define	VTOSMI(vp)	((smbmntinfo_t *)(((vp)->v_vfsp)->vfs_data))
133 #define	VFTOSMI(vfsp)	((smbmntinfo_t *)((vfsp)->vfs_data))
134 #define	SMBINTR(vp)	(VTOSMI(vp)->smi_flags & SMI_INT)
135 
136 #endif	/* _SMBFS_SMBFS_H */
137