Print this page
Implement ioctl _FIODIRECTIO
Kill flags arg in smbfs_purge_caches
5404 smbfs needs mmap support
Portions contributed by: Gordon Ross <gordon.w.ross@gmail.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_subr.h
+++ new/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_subr.h
1 1 /*
2 2 * Copyright (c) 2000-2001, Boris Popov
3 3 * All rights reserved.
4 4 *
5 5 * Redistribution and use in source and binary forms, with or without
6 6 * modification, are permitted provided that the following conditions
7 7 * are met:
8 8 * 1. Redistributions of source code must retain the above copyright
9 9 * notice, this list of conditions and the following disclaimer.
10 10 * 2. Redistributions in binary form must reproduce the above copyright
11 11 * notice, this list of conditions and the following disclaimer in the
12 12 * documentation and/or other materials provided with the distribution.
13 13 * 3. All advertising materials mentioning features or use of this software
14 14 * must display the following acknowledgement:
15 15 * This product includes software developed by Boris Popov.
16 16 * 4. Neither the name of the author nor the names of any co-contributors
17 17 * may be used to endorse or promote products derived from this software
18 18 * without specific prior written permission.
19 19 *
20 20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 30 * SUCH DAMAGE.
31 31 *
32 32 * $Id: smbfs_subr.h,v 1.25 2005/03/17 01:23:40 lindak Exp $
33 33 */
34 34
35 35 /*
36 36 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
37 37 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
38 38 * Use is subject to license terms.
39 39 */
40 40
41 41 #ifndef _FS_SMBFS_SMBFS_SUBR_H_
42 42 #define _FS_SMBFS_SMBFS_SUBR_H_
43 43
44 44 #include <sys/cmn_err.h>
45 45 #include <netsmb/mchain.h>
46 46 #include <netsmb/smb_subr.h>
47 47 #include <smbfs/smbfs_node.h>
48 48
49 49 #if defined(DEBUG) || defined(lint)
50 50 #define SMB_VNODE_DEBUG 1
51 51 #endif
52 52
53 53 #ifndef FALSE
54 54 #define FALSE (0)
55 55 #endif
56 56
57 57 #ifndef TRUE
58 58 #define TRUE (1)
59 59 #endif
60 60
61 61 /*
62 62 * Let's use C99 standard variadic macros!
63 63 * Also the C99 __func__ (function name) feature.
64 64 */
65 65 #define SMBFSERR(...) \
66 66 smb_errmsg(CE_NOTE, __func__, __VA_ARGS__)
67 67 #define SMBVDEBUG(...) \
68 68 smb_errmsg(CE_CONT, __func__, __VA_ARGS__)
69 69
70 70 /*
71 71 * Possible lock commands
72 72 */
73 73 #define SMB_LOCK_EXCL 0
74 74 #define SMB_LOCK_SHARED 1
75 75 #define SMB_LOCK_RELEASE 2
76 76
77 77 struct smb_cred;
78 78 struct smb_vc;
79 79 struct statvfs;
80 80 struct timespec;
81 81
82 82 /*
83 83 * Types of find_first, find_next context objects
84 84 */
85 85 typedef enum {
86 86 ft_LM1 = 1,
87 87 ft_LM2,
88 88 ft_XA
89 89 } smbfs_fctx_type_t;
90 90
91 91 /*
92 92 * Context to perform findfirst/findnext/findclose operations
93 93 */
94 94 #define SMBFS_RDD_FINDFIRST 0x01
95 95 #define SMBFS_RDD_EOF 0x02
96 96 #define SMBFS_RDD_FINDSINGLE 0x04
97 97 /* note SMBFS_RDD_USESEARCH 0x08 replaced by smbfs_fctx_type */
98 98 #define SMBFS_RDD_NOCLOSE 0x10
99 99
100 100 /*
101 101 * Search context supplied by server
102 102 */
103 103 #define SMB_SKEYLEN 21 /* search context */
104 104 #define SMB_DENTRYLEN (SMB_SKEYLEN + 22) /* entire entry */
105 105
106 106 struct smbfs_fctx {
107 107 /*
108 108 * Setable values
109 109 */
110 110 smbfs_fctx_type_t f_type;
111 111 int f_flags; /* SMBFS_RDD_ */
112 112 /*
113 113 * Return values
114 114 */
115 115 struct smbfattr f_attr; /* current attributes */
116 116 u_longlong_t f_inum; /* current I number */
117 117 char *f_name; /* current file name */
118 118 int f_nmlen; /* name len */
119 119 int f_namesz; /* memory allocated */
120 120 /*
121 121 * Internal variables
122 122 */
123 123 uint16_t f_limit; /* maximum number of entries */
124 124 uint16_t f_attrmask; /* SMB_FA_ */
125 125 int f_wclen;
126 126 const char *f_wildcard;
127 127 struct smbnode *f_dnp;
128 128 struct smb_cred *f_scred;
129 129 struct smb_share *f_ssp;
130 130 union {
131 131 struct smb_rq *uf_rq;
132 132 struct smb_t2rq *uf_t2;
133 133 } f_urq;
134 134 int f_left; /* entries left */
135 135 int f_ecnt; /* entries left in current response */
136 136 int f_eofs; /* entry offset in data block */
137 137 uchar_t f_skey[SMB_SKEYLEN]; /* server side search context */
138 138 uchar_t f_fname[8 + 1 + 3 + 1]; /* for 8.3 filenames */
139 139 uint16_t f_Sid; /* Search handle (like a FID) */
140 140 uint16_t f_infolevel;
141 141 int f_rnamelen;
142 142 char *f_rname; /* resume name */
143 143 int f_rnameofs;
144 144 int f_otws; /* # over-the-wire ops so far */
145 145 char *f_firstnm; /* first filename we got back */
146 146 int f_firstnmlen;
147 147 int f_rkey; /* resume key */
148 148 };
149 149 typedef struct smbfs_fctx smbfs_fctx_t;
150 150
151 151 #define f_rq f_urq.uf_rq
152 152 #define f_t2 f_urq.uf_t2
153 153
154 154 /*
155 155 * smb level (smbfs_smb.c)
156 156 */
157 157 int smbfs_smb_lock(struct smbnode *np, int op, caddr_t id,
158 158 offset_t start, uint64_t len, int largelock,
159 159 struct smb_cred *scrp, uint32_t timeout);
160 160 int smbfs_smb_qfsattr(struct smb_share *ssp, struct smb_fs_attr_info *,
161 161 struct smb_cred *scrp);
162 162 int smbfs_smb_statfs(struct smb_share *ssp, statvfs64_t *sbp,
163 163 struct smb_cred *scrp);
164 164
165 165 int smbfs_smb_setdisp(struct smbnode *np, uint16_t fid, uint8_t newdisp,
166 166 struct smb_cred *scrp);
167 167 int smbfs_smb_setfsize(struct smbnode *np, uint16_t fid, uint64_t newsize,
168 168 struct smb_cred *scrp);
169 169
170 170 int smbfs_smb_getfattr(struct smbnode *np, struct smbfattr *fap,
171 171 struct smb_cred *scrp);
172 172
173 173 int smbfs_smb_setfattr(struct smbnode *np, int fid,
174 174 uint32_t attr, struct timespec *mtime, struct timespec *atime,
175 175 struct smb_cred *scrp);
176 176
177 177 int smbfs_smb_open(struct smbnode *np, const char *name, int nmlen,
178 178 int xattr, uint32_t rights, struct smb_cred *scrp,
179 179 uint16_t *fidp, uint32_t *rightsp, struct smbfattr *fap);
180 180 int smbfs_smb_tmpopen(struct smbnode *np, uint32_t rights,
181 181 struct smb_cred *scrp, uint16_t *fidp);
182 182 int smbfs_smb_close(struct smb_share *ssp, uint16_t fid,
183 183 struct timespec *mtime, struct smb_cred *scrp);
184 184 int smbfs_smb_tmpclose(struct smbnode *ssp, uint16_t fid,
185 185 struct smb_cred *scrp);
186 186 int smbfs_smb_create(struct smbnode *dnp, const char *name, int nmlen,
187 187 int xattr, uint32_t disp, struct smb_cred *scrp, uint16_t *fidp);
188 188 int smbfs_smb_delete(struct smbnode *np, struct smb_cred *scrp,
189 189 const char *name, int len, int xattr);
190 190 int smbfs_smb_rename(struct smbnode *src, struct smbnode *tdnp,
191 191 const char *tname, int tnmlen, struct smb_cred *scrp);
192 192 int smbfs_smb_t2rename(struct smbnode *np, const char *tname, int tnmlen,
193 193 struct smb_cred *scrp, uint16_t fid, int replace);
194 194 int smbfs_smb_move(struct smbnode *src, struct smbnode *tdnp,
195 195 const char *tname, int tnmlen, uint16_t flags, struct smb_cred *scrp);
196 196 int smbfs_smb_mkdir(struct smbnode *dnp, const char *name, int len,
197 197 struct smb_cred *scrp);
198 198 int smbfs_smb_rmdir(struct smbnode *np, struct smb_cred *scrp);
199 199 int smbfs_smb_findopen(struct smbnode *dnp, const char *wildcard, int wclen,
200 200 int attr, struct smb_cred *scrp, struct smbfs_fctx **ctxpp);
201 201 int smbfs_smb_findnext(struct smbfs_fctx *ctx, int limit,
202 202 struct smb_cred *scrp);
203 203 int smbfs_smb_findclose(struct smbfs_fctx *ctx, struct smb_cred *scrp);
204 204 int smbfs_fullpath(struct mbchain *mbp, struct smb_vc *vcp,
205 205 struct smbnode *dnp, const char *name, int nmlen, uint8_t sep);
206 206 int smbfs_smb_lookup(struct smbnode *dnp, const char **namep, int *nmlenp,
207 207 struct smbfattr *fap, struct smb_cred *scrp);
208 208 int smbfs_smb_hideit(struct smbnode *np, const char *name, int len,
209 209 struct smb_cred *scrp);
210 210 int smbfs_smb_unhideit(struct smbnode *np, const char *name, int len,
211 211 struct smb_cred *scrp);
212 212 int smbfs_smb_flush(struct smbnode *np, struct smb_cred *scrp);
213 213 int smbfs_0extend(vnode_t *vp, uint16_t fid, len_t from, len_t to,
214 214 struct smb_cred *scredp, int timo);
215 215
216 216 /* get/set security descriptor */
217 217 int smbfs_smb_getsec_m(struct smb_share *ssp, uint16_t fid,
218 218 struct smb_cred *scrp, uint32_t selector,
219 219 mblk_t **res, uint32_t *reslen);
220 220 int smbfs_smb_setsec_m(struct smb_share *ssp, uint16_t fid,
221 221 struct smb_cred *scrp, uint32_t selector, mblk_t **mp);
222 222
223 223 /*
224 224 * VFS-level init, fini stuff
225 225 */
226 226
227 227 int smbfs_vfsinit(void);
228 228 void smbfs_vfsfini(void);
229 229 int smbfs_subrinit(void);
↓ open down ↓ |
229 lines elided |
↑ open up ↑ |
230 230 void smbfs_subrfini(void);
231 231 int smbfs_clntinit(void);
232 232 void smbfs_clntfini(void);
233 233
234 234 void smbfs_zonelist_add(smbmntinfo_t *smi);
235 235 void smbfs_zonelist_remove(smbmntinfo_t *smi);
236 236
237 237 int smbfs_check_table(struct vfs *vfsp, struct smbnode *srp);
238 238 void smbfs_destroy_table(struct vfs *vfsp);
239 239 void smbfs_rflush(struct vfs *vfsp, cred_t *cr);
240 +void smbfs_flushall(cred_t *cr);
240 241
242 +int smbfs_directio(vnode_t *vp, int cmd, cred_t *cr);
243 +
241 244 uint32_t smbfs_newnum(void);
242 245 int smbfs_newname(char *buf, size_t buflen);
243 246
244 247 /*
245 248 * Function definitions - those having to do with
246 249 * smbfs nodes, vnodes, etc
247 250 */
248 251
249 252 void smbfs_attrcache_prune(struct smbnode *np);
250 253 void smbfs_attrcache_remove(struct smbnode *np);
251 254 void smbfs_attrcache_rm_locked(struct smbnode *np);
252 255 #ifndef DEBUG
253 256 #define smbfs_attrcache_rm_locked(np) (np)->r_attrtime = gethrtime()
254 257 #endif
255 258 void smbfs_attr_touchdir(struct smbnode *dnp);
256 259 void smbfs_attrcache_fa(vnode_t *vp, struct smbfattr *fap);
257 -void smbfs_cache_check(struct vnode *vp, struct smbfattr *fap);
258 260
261 +int smbfs_validate_caches(struct vnode *vp, cred_t *cr);
262 +void smbfs_purge_caches(struct vnode *vp, cred_t *cr);
263 +
259 264 void smbfs_addfree(struct smbnode *sp);
260 265 void smbfs_rmhash(struct smbnode *);
261 266
262 267 /* See avl_create in smbfs_vfsops.c */
263 268 void smbfs_init_hash_avl(avl_tree_t *);
264 269
265 270 uint32_t smbfs_gethash(const char *rpath, int prlen);
266 271 uint32_t smbfs_getino(struct smbnode *dnp, const char *name, int nmlen);
267 272
268 273 extern struct smbfattr smbfs_fattr0;
269 274 smbnode_t *smbfs_node_findcreate(smbmntinfo_t *mi,
270 275 const char *dir, int dirlen,
271 276 const char *name, int nmlen,
272 277 char sep, struct smbfattr *fap);
273 278
274 279 int smbfs_nget(vnode_t *dvp, const char *name, int nmlen,
275 280 struct smbfattr *fap, vnode_t **vpp);
↓ open down ↓ |
7 lines elided |
↑ open up ↑ |
276 281
277 282 void smbfs_fname_tolocal(struct smbfs_fctx *ctx);
278 283 char *smbfs_name_alloc(const char *name, int nmlen);
279 284 void smbfs_name_free(const char *name, int nmlen);
280 285
281 286 int smbfs_readvnode(vnode_t *, uio_t *, cred_t *, struct vattr *);
282 287 int smbfs_writevnode(vnode_t *vp, uio_t *uiop, cred_t *cr,
283 288 int ioflag, int timo);
284 289 int smbfsgetattr(vnode_t *vp, struct vattr *vap, cred_t *cr);
285 290
291 +/* nfs: writerp writenp */
292 +/* nfs_putpages? */
293 +void smbfs_invalidate_pages(vnode_t *vp, u_offset_t off, cred_t *cr);
294 +
286 295 /* smbfs ACL support */
287 296 int smbfs_acl_getids(vnode_t *, cred_t *);
288 297 int smbfs_acl_setids(vnode_t *, vattr_t *, cred_t *);
289 298 int smbfs_acl_getvsa(vnode_t *, vsecattr_t *, int, cred_t *);
290 299 int smbfs_acl_setvsa(vnode_t *, vsecattr_t *, int, cred_t *);
291 300 int smbfs_acl_iocget(vnode_t *, intptr_t, int, cred_t *);
292 301 int smbfs_acl_iocset(vnode_t *, intptr_t, int, cred_t *);
293 302
294 303 /* smbfs_xattr.c */
295 304 int smbfs_get_xattrdir(vnode_t *dvp, vnode_t **vpp, cred_t *cr, int);
296 305 int smbfs_xa_parent(vnode_t *vp, vnode_t **vpp);
297 306 int smbfs_xa_exists(vnode_t *vp, cred_t *cr);
298 307 int smbfs_xa_getfattr(struct smbnode *np, struct smbfattr *fap,
299 308 struct smb_cred *scrp);
300 309 int smbfs_xa_findopen(struct smbfs_fctx *ctx, struct smbnode *dnp,
301 310 const char *name, int nmlen);
302 311 int smbfs_xa_findnext(struct smbfs_fctx *ctx, uint16_t limit);
303 312 int smbfs_xa_findclose(struct smbfs_fctx *ctx);
304 313
305 314 /* For Solaris, interruptible rwlock */
306 315 int smbfs_rw_enter_sig(smbfs_rwlock_t *l, krw_t rw, int intr);
307 316 int smbfs_rw_tryenter(smbfs_rwlock_t *l, krw_t rw);
308 317 void smbfs_rw_exit(smbfs_rwlock_t *l);
309 318 int smbfs_rw_lock_held(smbfs_rwlock_t *l, krw_t rw);
310 319 void smbfs_rw_init(smbfs_rwlock_t *l, char *name, krw_type_t type, void *arg);
311 320 void smbfs_rw_destroy(smbfs_rwlock_t *l);
312 321
313 322 #endif /* !_FS_SMBFS_SMBFS_SUBR_H_ */
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX