Print this page
8115 parallel zfs mount
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/vfs.h
+++ new/usr/src/uts/common/sys/vfs.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 * Copyright 2016 Toomas Soome <tsoome@me.com>
25 - * Copyright (c) 2016 by Delphix. All rights reserved.
25 + * Copyright (c) 2016, 2017 by Delphix. All rights reserved.
26 26 * Copyright 2016 Nexenta Systems, Inc.
27 27 */
28 28
29 29 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
30 30 /* All Rights Reserved */
31 31
32 32 /*
33 33 * Portions of this source code were derived from Berkeley 4.3 BSD
34 34 * under license from the Regents of the University of California.
35 35 */
36 36
37 37 #ifndef _SYS_VFS_H
38 38 #define _SYS_VFS_H
39 39
40 40 #include <sys/zone.h>
41 41 #include <sys/types.h>
42 42 #include <sys/t_lock.h>
43 43 #include <sys/cred.h>
44 44 #include <sys/vnode.h>
45 45 #include <sys/statvfs.h>
46 46 #include <sys/refstr.h>
47 47 #include <sys/avl.h>
48 48 #include <sys/time.h>
49 49
50 50 #ifdef __cplusplus
51 51 extern "C" {
52 52 #endif
53 53
54 54 /*
55 55 * Data associated with mounted file systems.
56 56 */
57 57
58 58 /*
59 59 * Operations vector. This is used internal to the kernel; file systems
60 60 * supply their list of operations via vfs_setfsops().
61 61 */
62 62
63 63 typedef struct vfsops vfsops_t;
64 64
65 65 /*
66 66 * File system identifier. Should be unique (at least per machine).
67 67 */
68 68 typedef struct {
69 69 int val[2]; /* file system id type */
70 70 } fsid_t;
71 71
72 72 /*
73 73 * File identifier. Should be unique per filesystem on a single
74 74 * machine. This is typically called by a stateless file server
75 75 * in order to generate "file handles".
76 76 *
77 77 * Many underlying file systems cast a struct fid into other
78 78 * file system dependent structures which may require 4 byte alignment.
79 79 * Because a fid starts with a short it may not be 4 byte aligned, the
80 80 * fid_pad will force the alignment.
81 81 */
82 82 #define MAXFIDSZ 64
83 83 #define OLD_MAXFIDSZ 16
84 84
85 85 typedef struct fid {
86 86 union {
87 87 long fid_pad;
88 88 struct {
89 89 ushort_t len; /* length of data in bytes */
90 90 char data[MAXFIDSZ]; /* data (variable len) */
91 91 } _fid;
92 92 } un;
93 93 } fid_t;
94 94
95 95 #ifdef _SYSCALL32
96 96 /*
97 97 * Solaris 64 - use old-style cache format with 32-bit aligned fid for on-disk
98 98 * struct compatibility.
99 99 */
100 100 typedef struct fid32 {
101 101 union {
102 102 int32_t fid_pad;
103 103 struct {
104 104 uint16_t len; /* length of data in bytes */
105 105 char data[MAXFIDSZ]; /* data (variable len) */
106 106 } _fid;
107 107 } un;
108 108 } fid32_t;
109 109 #else /* not _SYSCALL32 */
110 110 #define fid32 fid
111 111 typedef fid_t fid32_t;
112 112 #endif /* _SYSCALL32 */
113 113
114 114 #define fid_len un._fid.len
115 115 #define fid_data un._fid.data
116 116
117 117 /*
118 118 * Structure defining a mount option for a filesystem.
119 119 * option names are found in mntent.h
120 120 */
121 121 typedef struct mntopt {
122 122 char *mo_name; /* option name */
123 123 char **mo_cancel; /* list of options cancelled by this one */
124 124 char *mo_arg; /* argument string for this option */
125 125 int mo_flags; /* flags for this mount option */
126 126 void *mo_data; /* filesystem specific data */
127 127 } mntopt_t;
128 128
129 129 /*
130 130 * Flags that apply to mount options
131 131 */
132 132
133 133 #define MO_SET 0x01 /* option is set */
134 134 #define MO_NODISPLAY 0x02 /* option not listed in mnttab */
135 135 #define MO_HASVALUE 0x04 /* option takes a value */
136 136 #define MO_IGNORE 0x08 /* option ignored by parser */
137 137 #define MO_DEFAULT MO_SET /* option is on by default */
138 138 #define MO_TAG 0x10 /* flags a tag set by user program */
139 139 #define MO_EMPTY 0x20 /* empty space in option table */
140 140
141 141 #define VFS_NOFORCEOPT 0x01 /* honor MO_IGNORE (don't set option) */
142 142 #define VFS_DISPLAY 0x02 /* Turn off MO_NODISPLAY bit for opt */
143 143 #define VFS_NODISPLAY 0x04 /* Turn on MO_NODISPLAY bit for opt */
144 144 #define VFS_CREATEOPT 0x08 /* Create the opt if it's not there */
145 145
146 146 /*
147 147 * Structure holding mount option strings for the mounted file system.
148 148 */
149 149 typedef struct mntopts {
150 150 uint_t mo_count; /* number of entries in table */
151 151 mntopt_t *mo_list; /* list of mount options */
152 152 } mntopts_t;
153 153
154 154 /*
155 155 * The kstat structures associated with the vopstats are kept in an
156 156 * AVL tree. This is to avoid the case where a file system does not
157 157 * use a unique fsid_t for each vfs (e.g., namefs). In order to do
158 158 * this, we need a structure that the AVL tree can use that also
159 159 * references the kstat.
160 160 * Note that the vks_fsid is generated from the value reported by
161 161 * VFS_STATVFS().
162 162 */
163 163 typedef struct vskstat_anchor {
164 164 avl_node_t vsk_node; /* Required for use by AVL routines */
165 165 kstat_t *vsk_ksp; /* kstat structure for vopstats */
166 166 ulong_t vsk_fsid; /* fsid associated w/this FS */
167 167 } vsk_anchor_t;
168 168
169 169 extern avl_tree_t vskstat_tree;
170 170 extern kmutex_t vskstat_tree_lock;
171 171
172 172 /*
173 173 * Structure per mounted file system. Each mounted file system has
174 174 * an array of operations and an instance record.
175 175 *
176 176 * The file systems are kept on a doubly linked circular list headed by
177 177 * "rootvfs".
178 178 * File system implementations should not access this list;
179 179 * it's intended for use only in the kernel's vfs layer.
180 180 *
181 181 * Each zone also has its own list of mounts, containing filesystems mounted
182 182 * somewhere within the filesystem tree rooted at the zone's rootpath. The
183 183 * list is doubly linked to match the global list.
184 184 *
185 185 * mnttab locking: the in-kernel mnttab uses the vfs_mntpt, vfs_resource and
186 186 * vfs_mntopts fields in the vfs_t. mntpt and resource are refstr_ts that
187 187 * are set at mount time and can only be modified during a remount.
188 188 * It is safe to read these fields if you can prevent a remount on the vfs,
189 189 * or through the convenience funcs vfs_getmntpoint() and vfs_getresource().
190 190 * The mntopts field may only be accessed through the provided convenience
191 191 * functions, as it is protected by the vfs list lock. Modifying a mount
192 192 * option requires grabbing the vfs list write lock, which can be a very
193 193 * high latency lock.
194 194 */
195 195 struct zone; /* from zone.h */
196 196 struct fem_head; /* from fem.h */
197 197
198 198 typedef struct vfs {
199 199 struct vfs *vfs_next; /* next VFS in VFS list */
200 200 struct vfs *vfs_prev; /* prev VFS in VFS list */
201 201
202 202 /* vfs_op should not be used directly. Accessor functions are provided */
203 203 vfsops_t *vfs_op; /* operations on VFS */
204 204
205 205 struct vnode *vfs_vnodecovered; /* vnode mounted on */
206 206 uint_t vfs_flag; /* flags */
207 207 uint_t vfs_bsize; /* native block size */
208 208 int vfs_fstype; /* file system type index */
209 209 fsid_t vfs_fsid; /* file system id */
210 210 void *vfs_data; /* private data */
211 211 dev_t vfs_dev; /* device of mounted VFS */
212 212 ulong_t vfs_bcount; /* I/O count (accounting) */
213 213 struct vfs *vfs_list; /* sync list pointer */
214 214 struct vfs *vfs_hash; /* hash list pointer */
215 215 ksema_t vfs_reflock; /* mount/unmount/sync lock */
216 216 uint_t vfs_count; /* vfs reference count */
217 217 mntopts_t vfs_mntopts; /* options mounted with */
218 218 refstr_t *vfs_resource; /* mounted resource name */
219 219 refstr_t *vfs_mntpt; /* mount point name */
220 220 time_t vfs_mtime; /* time we were mounted */
221 221 struct vfs_impl *vfs_implp; /* impl specific data */
222 222 /*
223 223 * Zones support. Note that the zone that "owns" the mount isn't
224 224 * necessarily the same as the zone in which the zone is visible.
225 225 * That is, vfs_zone and (vfs_zone_next|vfs_zone_prev) may refer to
226 226 * different zones.
227 227 */
228 228 struct zone *vfs_zone; /* zone that owns the mount */
229 229 struct vfs *vfs_zone_next; /* next VFS visible in zone */
230 230 struct vfs *vfs_zone_prev; /* prev VFS visible in zone */
231 231
232 232 struct fem_head *vfs_femhead; /* fs monitoring */
233 233 uint32_t vfs_lofi_id; /* ID if lofi mount */
234 234 } vfs_t;
235 235
236 236 #define vfs_featureset vfs_implp->vi_featureset
237 237 #define vfs_vskap vfs_implp->vi_vskap
238 238 #define vfs_fstypevsp vfs_implp->vi_fstypevsp
239 239 #define vfs_vopstats vfs_implp->vi_vopstats
240 240 #define vfs_hrctime vfs_implp->vi_hrctime
241 241
242 242 /*
243 243 * VFS flags.
244 244 */
245 245 #define VFS_RDONLY 0x01 /* read-only vfs */
246 246 #define VFS_NOMNTTAB 0x02 /* vfs not seen in mnttab */
247 247 #define VFS_NOSETUID 0x08 /* setuid disallowed */
248 248 #define VFS_REMOUNT 0x10 /* modify mount options only */
249 249 #define VFS_NOTRUNC 0x20 /* does not truncate long file names */
250 250 #define VFS_UNLINKABLE 0x40 /* unlink(2) can be applied to root */
251 251 #define VFS_PXFS 0x80 /* clustering: global fs proxy vfs */
252 252 #define VFS_UNMOUNTED 0x100 /* file system has been unmounted */
253 253 #define VFS_NBMAND 0x200 /* allow non-blocking mandatory locks */
254 254 #define VFS_XATTR 0x400 /* fs supports extended attributes */
255 255 #define VFS_NODEVICES 0x800 /* device-special files disallowed */
256 256 #define VFS_NOEXEC 0x1000 /* executables disallowed */
257 257 #define VFS_STATS 0x2000 /* file system can collect stats */
258 258 #define VFS_XID 0x4000 /* file system supports extended ids */
259 259
260 260 #define VFS_NORESOURCE "unspecified_resource"
261 261 #define VFS_NOMNTPT "unspecified_mountpoint"
262 262
263 263 /*
264 264 * VFS features are implemented as bits set in the vfs_t.
265 265 * The vfs_feature_t typedef is a 64-bit number that will translate
266 266 * into an element in an array of bitmaps and a bit in that element.
267 267 * Developers must not depend on the implementation of this and
268 268 * need to use vfs_has_feature()/vfs_set_feature() routines.
269 269 */
270 270 typedef uint64_t vfs_feature_t;
271 271
272 272 #define VFSFT_XVATTR 0x100000001 /* Supports xvattr for attrs */
273 273 #define VFSFT_CASEINSENSITIVE 0x100000002 /* Supports case-insensitive */
274 274 #define VFSFT_NOCASESENSITIVE 0x100000004 /* NOT case-sensitive */
275 275 #define VFSFT_DIRENTFLAGS 0x100000008 /* Supports dirent flags */
276 276 #define VFSFT_ACLONCREATE 0x100000010 /* Supports ACL on create */
277 277 #define VFSFT_ACEMASKONACCESS 0x100000020 /* Can use ACEMASK for access */
278 278 #define VFSFT_SYSATTR_VIEWS 0x100000040 /* Supports sysattr view i/f */
279 279 #define VFSFT_ACCESS_FILTER 0x100000080 /* dirents filtered by access */
280 280 #define VFSFT_REPARSE 0x100000100 /* Supports reparse point */
281 281 #define VFSFT_ZEROCOPY_SUPPORTED 0x100000200
282 282 /* Support loaning /returning cache buffer */
283 283 /*
284 284 * Argument structure for mount(2).
285 285 *
286 286 * Flags are defined in <sys/mount.h>.
287 287 *
288 288 * Note that if the MS_SYSSPACE bit is set in flags, the pointer fields in
289 289 * this structure are to be interpreted as kernel addresses. File systems
290 290 * should be prepared for this possibility.
291 291 */
292 292 struct mounta {
293 293 char *spec;
294 294 char *dir;
295 295 int flags;
296 296 char *fstype;
297 297 char *dataptr;
298 298 int datalen;
299 299 char *optptr;
300 300 int optlen;
301 301 };
302 302
303 303 /*
304 304 * Reasons for calling the vfs_mountroot() operation.
305 305 */
306 306 enum whymountroot { ROOT_INIT, ROOT_REMOUNT, ROOT_UNMOUNT};
307 307 typedef enum whymountroot whymountroot_t;
308 308
309 309 /*
310 310 * Reasons for calling the VFS_VNSTATE():
311 311 */
312 312 enum vntrans {
313 313 VNTRANS_EXISTS,
314 314 VNTRANS_IDLED,
315 315 VNTRANS_RECLAIMED,
316 316 VNTRANS_DESTROYED
317 317 };
318 318 typedef enum vntrans vntrans_t;
319 319
320 320 /*
321 321 * VFS_OPS defines all the vfs operations. It is used to define
322 322 * the vfsops structure (below) and the fs_func_p union (vfs_opreg.h).
323 323 */
324 324 #define VFS_OPS \
325 325 int (*vfs_mount)(vfs_t *, vnode_t *, struct mounta *, cred_t *); \
326 326 int (*vfs_unmount)(vfs_t *, int, cred_t *); \
327 327 int (*vfs_root)(vfs_t *, vnode_t **); \
328 328 int (*vfs_statvfs)(vfs_t *, statvfs64_t *); \
329 329 int (*vfs_sync)(vfs_t *, short, cred_t *); \
330 330 int (*vfs_vget)(vfs_t *, vnode_t **, fid_t *); \
331 331 int (*vfs_mountroot)(vfs_t *, enum whymountroot); \
332 332 void (*vfs_freevfs)(vfs_t *); \
333 333 int (*vfs_vnstate)(vfs_t *, vnode_t *, vntrans_t) /* NB: No ";" */
334 334
335 335 /*
336 336 * Operations supported on virtual file system.
337 337 */
338 338 struct vfsops {
339 339 VFS_OPS; /* Signature of all vfs operations (vfsops) */
340 340 };
341 341
342 342 extern int fsop_mount(vfs_t *, vnode_t *, struct mounta *, cred_t *);
343 343 extern int fsop_unmount(vfs_t *, int, cred_t *);
344 344 extern int fsop_root(vfs_t *, vnode_t **);
345 345 extern int fsop_statfs(vfs_t *, statvfs64_t *);
346 346 extern int fsop_sync(vfs_t *, short, cred_t *);
347 347 extern int fsop_vget(vfs_t *, vnode_t **, fid_t *);
348 348 extern int fsop_mountroot(vfs_t *, enum whymountroot);
349 349 extern void fsop_freefs(vfs_t *);
350 350 extern int fsop_sync_by_kind(int, short, cred_t *);
351 351 extern int fsop_vnstate(vfs_t *, vnode_t *, vntrans_t);
352 352
353 353 #define VFS_MOUNT(vfsp, mvp, uap, cr) fsop_mount(vfsp, mvp, uap, cr)
354 354 #define VFS_UNMOUNT(vfsp, flag, cr) fsop_unmount(vfsp, flag, cr)
355 355 #define VFS_ROOT(vfsp, vpp) fsop_root(vfsp, vpp)
356 356 #define VFS_STATVFS(vfsp, sp) fsop_statfs(vfsp, sp)
357 357 #define VFS_SYNC(vfsp, flag, cr) fsop_sync(vfsp, flag, cr)
358 358 #define VFS_VGET(vfsp, vpp, fidp) fsop_vget(vfsp, vpp, fidp)
359 359 #define VFS_MOUNTROOT(vfsp, init) fsop_mountroot(vfsp, init)
360 360 #define VFS_FREEVFS(vfsp) fsop_freefs(vfsp)
361 361 #define VFS_VNSTATE(vfsp, vn, ns) fsop_vnstate(vfsp, vn, ns)
362 362
363 363 #define VFSNAME_MOUNT "mount"
364 364 #define VFSNAME_UNMOUNT "unmount"
365 365 #define VFSNAME_ROOT "root"
366 366 #define VFSNAME_STATVFS "statvfs"
367 367 #define VFSNAME_SYNC "sync"
368 368 #define VFSNAME_VGET "vget"
369 369 #define VFSNAME_MOUNTROOT "mountroot"
370 370 #define VFSNAME_FREEVFS "freevfs"
371 371 #define VFSNAME_VNSTATE "vnstate"
372 372 /*
373 373 * Filesystem type switch table.
374 374 */
375 375
376 376 typedef struct vfssw {
377 377 char *vsw_name; /* type name -- max len _ST_FSTYPSZ */
378 378 int (*vsw_init) (int, char *);
379 379 /* init routine (for non-loadable fs only) */
380 380 int vsw_flag; /* flags */
381 381 mntopts_t vsw_optproto; /* mount options table prototype */
382 382 uint_t vsw_count; /* count of references */
383 383 kmutex_t vsw_lock; /* lock to protect vsw_count */
384 384 vfsops_t vsw_vfsops; /* filesystem operations vector */
385 385 } vfssw_t;
386 386
387 387 /*
388 388 * Filesystem type definition record. All file systems must export a record
389 389 * of this type through their modlfs structure. N.B., changing the version
390 390 * number requires a change in sys/modctl.h.
391 391 */
392 392
393 393 typedef struct vfsdef_v5 {
394 394 int def_version; /* structure version, must be first */
395 395 char *name; /* filesystem type name */
396 396 int (*init) (int, char *); /* init routine */
397 397 int flags; /* filesystem flags */
398 398 mntopts_t *optproto; /* mount options table prototype */
399 399 } vfsdef_v5;
400 400
401 401 typedef struct vfsdef_v5 vfsdef_t;
402 402
403 403 enum {
404 404 VFSDEF_VERSION = 5
405 405 };
406 406
407 407 /*
408 408 * flags for vfssw and vfsdef
↓ open down ↓ |
373 lines elided |
↑ open up ↑ |
409 409 */
410 410 #define VSW_HASPROTO 0x01 /* struct has a mount options prototype */
411 411 #define VSW_CANRWRO 0x02 /* file system can transition from rw to ro */
412 412 #define VSW_CANREMOUNT 0x04 /* file system supports remounts */
413 413 #define VSW_NOTZONESAFE 0x08 /* zone_enter(2) should fail for these files */
414 414 #define VSW_VOLATILEDEV 0x10 /* vfs_dev can change each time fs is mounted */
415 415 #define VSW_STATS 0x20 /* file system can collect stats */
416 416 #define VSW_XID 0x40 /* file system supports extended ids */
417 417 #define VSW_CANLOFI 0x80 /* file system supports lofi mounts */
418 418 #define VSW_ZMOUNT 0x100 /* file system always allowed in a zone */
419 +#define VSW_MOUNTDEV 0x200 /* file system is mounted via device path */
419 420
420 421 #define VSW_INSTALLED 0x8000 /* this vsw is associated with a file system */
421 422
422 423 /*
423 424 * A flag for vfs_setpath().
424 425 */
425 426 #define VFSSP_VERBATIM 0x1 /* do not prefix the supplied path */
426 427
427 428 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
428 429
429 430 /*
430 431 * Private vfs data, NOT to be used by a file system implementation.
431 432 */
432 433
433 434 #define VFS_FEATURE_MAXSZ 4
434 435
435 436 typedef struct vfs_impl {
436 437 /* Counted array - Bitmap of vfs features */
437 438 uint32_t vi_featureset[VFS_FEATURE_MAXSZ];
438 439 /*
439 440 * Support for statistics on the vnode operations
440 441 */
441 442 vsk_anchor_t *vi_vskap; /* anchor for vopstats' kstat */
442 443 vopstats_t *vi_fstypevsp; /* ptr to per-fstype vopstats */
443 444 vopstats_t vi_vopstats; /* per-mount vnode op stats */
444 445
445 446 timespec_t vi_hrctime; /* High-res creation time */
446 447
447 448 zone_ref_t vi_zone_ref; /* reference to zone */
448 449 } vfs_impl_t;
449 450
450 451 /*
451 452 * Public operations.
452 453 */
453 454 struct umounta;
454 455 struct statvfsa;
455 456 struct fstatvfsa;
456 457
457 458 void vfs_freevfsops(vfsops_t *);
458 459 int vfs_freevfsops_by_type(int);
459 460 void vfs_setops(vfs_t *, vfsops_t *);
460 461 vfsops_t *vfs_getops(vfs_t *vfsp);
461 462 int vfs_matchops(vfs_t *, vfsops_t *);
462 463 int vfs_can_sync(vfs_t *vfsp);
463 464 vfs_t *vfs_alloc(int);
464 465 void vfs_free(vfs_t *);
465 466 void vfs_init(vfs_t *vfsp, vfsops_t *, void *);
466 467 void vfsimpl_setup(vfs_t *vfsp);
467 468 void vfsimpl_teardown(vfs_t *vfsp);
468 469 void vn_exists(vnode_t *);
469 470 void vn_idle(vnode_t *);
470 471 void vn_reclaim(vnode_t *);
471 472 void vn_invalid(vnode_t *);
472 473
473 474 int rootconf(void);
474 475 int domount(char *, struct mounta *, vnode_t *, struct cred *,
475 476 struct vfs **);
476 477 int dounmount(struct vfs *, int, cred_t *);
477 478 int vfs_lock(struct vfs *);
478 479 int vfs_rlock(struct vfs *);
479 480 void vfs_lock_wait(struct vfs *);
480 481 void vfs_rlock_wait(struct vfs *);
481 482 void vfs_unlock(struct vfs *);
482 483 int vfs_lock_held(struct vfs *);
483 484 struct _kthread *vfs_lock_owner(struct vfs *);
484 485 void sync(void);
485 486 void vfs_sync(int);
486 487 void vfs_mountroot(void);
487 488 void vfs_add(vnode_t *, struct vfs *, int);
488 489 void vfs_remove(struct vfs *);
489 490
490 491 /* VFS feature routines */
491 492 void vfs_set_feature(vfs_t *, vfs_feature_t);
492 493 void vfs_clear_feature(vfs_t *, vfs_feature_t);
493 494 int vfs_has_feature(vfs_t *, vfs_feature_t);
494 495 void vfs_propagate_features(vfs_t *, vfs_t *);
495 496
496 497 /* The following functions are not for general use by filesystems */
497 498
498 499 void vfs_createopttbl(mntopts_t *, const char *);
499 500 void vfs_copyopttbl(const mntopts_t *, mntopts_t *);
500 501 void vfs_mergeopttbl(const mntopts_t *, const mntopts_t *, mntopts_t *);
501 502 void vfs_freeopttbl(mntopts_t *);
502 503 void vfs_parsemntopts(mntopts_t *, char *, int);
503 504 int vfs_buildoptionstr(const mntopts_t *, char *, int);
504 505 struct mntopt *vfs_hasopt(const mntopts_t *, const char *);
505 506 void vfs_mnttab_modtimeupd(void);
506 507
507 508 void vfs_clearmntopt(struct vfs *, const char *);
508 509 void vfs_setmntopt(struct vfs *, const char *, const char *, int);
509 510 void vfs_setresource(struct vfs *, const char *, uint32_t);
510 511 void vfs_setmntpoint(struct vfs *, const char *, uint32_t);
511 512 refstr_t *vfs_getresource(const struct vfs *);
512 513 refstr_t *vfs_getmntpoint(const struct vfs *);
513 514 int vfs_optionisset(const struct vfs *, const char *, char **);
514 515 int vfs_settag(uint_t, uint_t, const char *, const char *, cred_t *);
515 516 int vfs_clrtag(uint_t, uint_t, const char *, const char *, cred_t *);
516 517 void vfs_syncall(void);
517 518 void vfsinit(void);
518 519 void vfs_unmountall(void);
519 520 void vfs_make_fsid(fsid_t *, dev_t, int);
520 521 void vfs_addmip(dev_t, struct vfs *);
521 522 void vfs_delmip(struct vfs *);
522 523 int vfs_devismounted(dev_t);
523 524 int vfs_devmounting(dev_t, struct vfs *);
524 525 int vfs_opsinuse(vfsops_t *);
525 526 struct vfs *getvfs(fsid_t *);
526 527 struct vfs *vfs_dev2vfsp(dev_t);
527 528 struct vfs *vfs_mntpoint2vfsp(const char *);
528 529 struct vfssw *allocate_vfssw(const char *);
529 530 struct vfssw *vfs_getvfssw(const char *);
530 531 struct vfssw *vfs_getvfsswbyname(const char *);
531 532 struct vfssw *vfs_getvfsswbyvfsops(vfsops_t *);
532 533 void vfs_refvfssw(struct vfssw *);
533 534 void vfs_unrefvfssw(struct vfssw *);
534 535 uint_t vf_to_stf(uint_t);
535 536 void vfs_mnttab_modtime(timespec_t *);
536 537 void vfs_mnttab_poll(timespec_t *, struct pollhead **);
537 538
538 539 void vfs_list_lock(void);
539 540 void vfs_list_read_lock(void);
540 541 void vfs_list_unlock(void);
541 542 void vfs_list_add(struct vfs *);
542 543 void vfs_list_remove(struct vfs *);
543 544 void vfs_hold(vfs_t *vfsp);
544 545 void vfs_rele(vfs_t *vfsp);
545 546 void fs_freevfs(vfs_t *);
546 547 void vfs_root_redev(vfs_t *vfsp, dev_t ndev, int fstype);
547 548
548 549 int vfs_zone_change_safe(vfs_t *);
549 550
550 551 int vfs_get_lofi(vfs_t *, vnode_t **);
551 552
552 553 #define VFSHASH(maj, min) (((int)((maj)+(min))) & (vfshsz - 1))
553 554 #define VFS_ON_LIST(vfsp) \
554 555 ((vfsp)->vfs_next != (vfsp) && (vfsp)->vfs_next != NULL)
555 556
556 557 /*
557 558 * Globals.
558 559 */
559 560
560 561 extern struct vfssw vfssw[]; /* table of filesystem types */
561 562 extern krwlock_t vfssw_lock;
562 563 extern char rootfstype[]; /* name of root fstype */
563 564 extern const int nfstype; /* # of elements in vfssw array */
564 565 extern vfsops_t *EIO_vfsops; /* operations for vfs being torn-down */
565 566
566 567 /*
567 568 * The following variables are private to the the kernel's vfs layer. File
568 569 * system implementations should not access them.
569 570 */
570 571 extern struct vfs *rootvfs; /* ptr to root vfs structure */
571 572 typedef struct {
572 573 struct vfs *rvfs_head; /* head vfs in chain */
573 574 kmutex_t rvfs_lock; /* mutex protecting this chain */
574 575 uint32_t rvfs_len; /* length of this chain */
575 576 } rvfs_t;
576 577 extern rvfs_t *rvfs_list;
577 578 extern int vfshsz; /* # of elements in rvfs_head array */
578 579 extern const mntopts_t vfs_mntopts; /* globally recognized options */
579 580
580 581 #endif /* defined(_KERNEL) */
581 582
582 583 #define VFS_HOLD(vfsp) { \
583 584 vfs_hold(vfsp); \
584 585 }
585 586
586 587 #define VFS_RELE(vfsp) { \
587 588 vfs_rele(vfsp); \
588 589 }
589 590
590 591 #define VFS_INIT(vfsp, op, data) { \
591 592 vfs_init((vfsp), (op), (data)); \
592 593 }
593 594
594 595
595 596 #define VFS_INSTALLED(vfsswp) (((vfsswp)->vsw_flag & VSW_INSTALLED) != 0)
596 597 #define ALLOCATED_VFSSW(vswp) ((vswp)->vsw_name[0] != '\0')
597 598 #define RLOCK_VFSSW() (rw_enter(&vfssw_lock, RW_READER))
598 599 #define RUNLOCK_VFSSW() (rw_exit(&vfssw_lock))
599 600 #define WLOCK_VFSSW() (rw_enter(&vfssw_lock, RW_WRITER))
600 601 #define WUNLOCK_VFSSW() (rw_exit(&vfssw_lock))
601 602 #define VFSSW_LOCKED() (RW_LOCK_HELD(&vfssw_lock))
602 603 #define VFSSW_WRITE_LOCKED() (RW_WRITE_HELD(&vfssw_lock))
603 604 /*
604 605 * VFS_SYNC flags.
605 606 */
606 607 #define SYNC_ATTR 0x01 /* sync attributes only */
607 608 #define SYNC_CLOSE 0x02 /* close open file */
608 609 #define SYNC_ALL 0x04 /* force to sync all fs */
609 610
610 611 #ifdef __cplusplus
611 612 }
612 613 #endif
613 614
614 615 #endif /* _SYS_VFS_H */
↓ open down ↓ |
186 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX