Print this page
*** NO COMMENTS ***
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/nfs/export.h
+++ new/usr/src/uts/common/nfs/export.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.
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 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 */
24 24
25 25 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
26 26 /* All Rights Reserved */
27 27
28 28 #ifndef _NFS_EXPORT_H
29 29 #define _NFS_EXPORT_H
30 30
31 31 #include <nfs/nfs_sec.h>
32 32 #include <nfs/auth.h>
33 33 #include <sys/vnode.h>
34 34 #include <nfs/nfs4.h>
35 35 #include <sys/kiconv.h>
36 36
37 37 #ifdef __cplusplus
38 38 extern "C" {
39 39 #endif
40 40
41 41 /*
42 42 * nfs pseudo flavor number is owned by IANA. Need to make sure the
43 43 * Solaris specific NFS_FLAVOR_NOMAP number will not overlap with any
44 44 * new IANA defined pseudo flavor numbers. The chance for the overlap
45 45 * is very small since the growth of new flavor numbers is expected
46 46 * to be limited.
47 47 */
48 48 #define NFS_FLAVOR_NOMAP 999999 /* no nfs flavor mapping */
49 49
50 50 /*
51 51 * As duplicate flavors can be passed into exportfs in the arguments, we
52 52 * allocate a cleaned up array with non duplicate flavors on the stack.
53 53 * So we need to know how much to allocate.
54 54 */
55 55 #define MAX_FLAVORS 6 /* none, sys, dh, krb5, krb5i krb5p */
56 56
57 57 /*
58 58 * Note: exported_lock is currently used to ensure the integrity of
59 59 * the secinfo fields.
60 60 */
61 61 struct secinfo {
62 62 seconfig_t s_secinfo; /* /etc/nfssec.conf entry */
63 63 unsigned int s_flags; /* flags (see below) */
64 64 int32_t s_refcnt; /* reference count for tracking */
65 65 /* how many children (self included) */
66 66 /* use this flavor. */
67 67 int s_window; /* window */
68 68 uint_t s_rootid; /* UID to use for authorized roots */
69 69 int s_rootcnt; /* count of root names */
70 70 caddr_t *s_rootnames; /* array of root names */
71 71 /* they are strings for AUTH_DES and */
72 72 /* rpc_gss_principal_t for RPCSEC_GSS */
73 73 };
74 74
75 75 #ifdef _SYSCALL32
76 76 struct secinfo32 {
77 77 seconfig32_t s_secinfo; /* /etc/nfssec.conf entry */
78 78 uint32_t s_flags; /* flags (see below) */
79 79 int32_t s_refcnt; /* reference count for tracking */
80 80 /* how many children (self included) */
81 81 /* use this flavor. */
82 82 int32_t s_window; /* window */
83 83 uint32_t s_rootid; /* UID to use for authorized roots */
84 84 int32_t s_rootcnt; /* count of root names */
85 85 caddr32_t s_rootnames; /* array of root names */
86 86 /* they are strings for AUTH_DES and */
87 87 /* rpc_gss_principal_t for RPCSEC_GSS */
88 88 };
89 89 #endif /* _SYSCALL32 */
90 90
91 91 /*
92 92 * security negotiation related
93 93 */
94 94
95 95 #define SEC_QUERY 0x01 /* query sec modes */
96 96
97 97 struct sec_ol {
98 98 int sec_flags; /* security nego flags */
99 99 uint_t sec_index; /* index into sec flavor array */
100 100 };
101 101
102 102 /*
103 103 * Per-mode flags (secinfo.s_flags)
104 104 */
105 105 #define M_RO 0x01 /* exported ro to all */
106 106 #define M_ROL 0x02 /* exported ro to all listed */
107 107 #define M_RW 0x04 /* exported rw to all */
108 108 #define M_RWL 0x08 /* exported ro to all listed */
109 109 #define M_ROOT 0x10 /* root list is defined */
110 110 #define M_4SEC_EXPORTED 0x20 /* this is an explicitly shared flavor */
111 111 #define M_NONE 0x40 /* none list is defined */
112 112
113 113 /* invalid secinfo reference count */
114 114 #define SEC_REF_INVALID(p) ((p)->s_refcnt < 1)
115 115
116 116 /* last secinfo reference */
117 117 #define SEC_REF_LAST(p) ((p)->s_refcnt == 1)
118 118
119 119 /* sec flavor explicitly shared for the exported node */
120 120 #define SEC_REF_EXPORTED(p) ((p)->s_flags & M_4SEC_EXPORTED)
121 121
122 122 /* the only reference count left is for referring itself */
123 123 #define SEC_REF_SELF(p) (SEC_REF_LAST(p) && SEC_REF_EXPORTED(p))
124 124
125 125 /*
126 126 * The export information passed to exportfs() (Version 2)
127 127 */
128 128 #define EX_CURRENT_VERSION 2 /* current version of exportdata struct */
129 129
130 130 struct exportdata {
131 131 int ex_version; /* structure version */
132 132 char *ex_path; /* exported path */
133 133 size_t ex_pathlen; /* path length */
134 134 int ex_flags; /* flags */
135 135 unsigned int ex_anon; /* uid for unauthenticated requests */
136 136 int ex_seccnt; /* count of security modes */
137 137 struct secinfo *ex_secinfo; /* security mode info */
138 138 char *ex_index; /* index file for public filesystem */
139 139 char *ex_log_buffer; /* path to logging buffer file */
140 140 size_t ex_log_bufferlen; /* buffer file path len */
141 141 char *ex_tag; /* tag used to identify log config */
142 142 size_t ex_taglen; /* tag length */
143 143 };
144 144
145 145 #ifdef _SYSCALL32
146 146 struct exportdata32 {
147 147 int32_t ex_version; /* structure version */
148 148 caddr32_t ex_path; /* exported path */
149 149 int32_t ex_pathlen; /* path length */
150 150 int32_t ex_flags; /* flags */
151 151 uint32_t ex_anon; /* uid for unauthenticated requests */
152 152 int32_t ex_seccnt; /* count of security modes */
153 153 caddr32_t ex_secinfo; /* security mode info */
154 154 caddr32_t ex_index; /* index file for public filesystem */
155 155 caddr32_t ex_log_buffer; /* path to logging buffer file */
156 156 int32_t ex_log_bufferlen; /* buffer file path len */
157 157 caddr32_t ex_tag; /* tag used to identify log config */
158 158 int32_t ex_taglen; /* tag length */
159 159 };
160 160 #endif /* _SYSCALL32 */
161 161
162 162 /*
163 163 * exported vfs flags.
164 164 */
165 165
166 166 #define EX_NOSUID 0x01 /* exported with unsetable set[ug]ids */
167 167 #define EX_ACLOK 0x02 /* exported with maximal access if acl exists */
168 168 #define EX_PUBLIC 0x04 /* exported with public filehandle */
169 169 #define EX_NOSUB 0x08 /* no nfs_getfh or MCL below export point */
170 170 #define EX_INDEX 0x10 /* exported with index file specified */
171 171 #define EX_LOG 0x20 /* logging enabled */
172 172 #define EX_LOG_ALLOPS 0x40 /* logging of all RPC operations enabled */
173 173 /* by default only operations which affect */
174 174 /* transaction logging are enabled */
175 175 #define EX_PSEUDO 0x80 /* pseudo filesystem export */
↓ open down ↓ |
175 lines elided |
↑ open up ↑ |
176 176 #ifdef VOLATILE_FH_TEST
177 177 #define EX_VOLFH 0x100 /* XXX nfsv4 fh may expire anytime */
178 178 #define EX_VOLRNM 0x200 /* XXX nfsv4 fh expire at rename */
179 179 #define EX_VOLMIG 0x400 /* XXX nfsv4 fh expire at migration */
180 180 #define EX_NOEXPOPEN 0x800 /* XXX nfsv4 fh no expire with open */
181 181 #endif /* VOLATILE_FH_TEST */
182 182
183 183 #define EX_CHARMAP 0x1000 /* NFS may need a character set conversion */
184 184 #define EX_NOACLFAB 0x2000 /* If set, NFSv2 and v3 servers doesn't */
185 185 /* fabricate ACL for VOP_GETSECATTR OTW call */
186 +#define EX_NOHIDE 0x4000 /* traversable from exported parent */
186 187
187 188 #ifdef _KERNEL
188 189
189 190 #define RPC_IDEMPOTENT 0x1 /* idempotent or not */
190 191 /*
191 192 * Be very careful about which NFS procedures get the RPC_ALLOWANON bit.
192 193 * Right now, it this bit is on, we ignore the results of per NFS request
193 194 * access control.
194 195 */
195 196 #define RPC_ALLOWANON 0x2 /* allow anonymous access */
196 197 #define RPC_MAPRESP 0x4 /* use mapped response buffer */
197 198 #define RPC_AVOIDWORK 0x8 /* do work avoidance for dups */
198 199 #define RPC_PUBLICFH_OK 0x10 /* allow use of public filehandle */
199 200
200 201 /*
201 202 * RPC_ALL is an or of all above bits to be used with "don't care"
202 203 * nfsv4 ops. The flags of an nfsv4 request is the bit-AND of the
203 204 * per-op flags.
204 205 */
205 206 #define RPC_ALL (RPC_IDEMPOTENT|RPC_ALLOWANON|RPC_AVOIDWORK|RPC_PUBLICFH_OK)
206 207
207 208
208 209 #ifdef VOLATILE_FH_TEST
209 210 struct ex_vol_rename {
210 211 nfs_fh4_fmt_t vrn_fh_fmt;
211 212 struct ex_vol_rename *vrn_next;
212 213 };
213 214 #endif /* VOLATILE_FH_TEST */
214 215
215 216 /*
216 217 * An auth cache entry can exist in 4 active states, with the inactive
217 218 * state being indicated by no entry in the cache.
218 219 *
219 220 * A FRESH entry is one which is either new or has been refreshed at
220 221 * least once.
221 222 *
222 223 * A STALE entry is one which has been detected to be too old. The
223 224 * transistion from FRESH to STALE prevents multiple threads from
224 225 * submitting refresh requests.
225 226 *
226 227 * A REFRESHING entry is one which is actively engaging the user land
227 228 * mountd code to re-authenticate the cache entry.
228 229 *
229 230 * An INVALID entry was one which was either STALE or REFRESHING
230 231 * and was deleted out of the encapsulating exi. Since we can't
231 232 * delete it yet, we mark it as INVALID, which lets the refreshq
232 233 * know not to work on it.
233 234 *
234 235 * Note that the auth state of the entry is always valid, even if the
235 236 * entry is STALE. Just as you can eat stale bread, you can consume
236 237 * a stale cache entry. The only time the contents change could be
237 238 * during the transistion from REFRESHING to FRESH.
238 239 */
239 240 typedef enum auth_state {
240 241 NFS_AUTH_FRESH,
241 242 NFS_AUTH_STALE,
242 243 NFS_AUTH_REFRESHING,
243 244 NFS_AUTH_INVALID
244 245 } auth_state_t;
245 246
246 247 /*
247 248 * An authorization cache entry
248 249 *
249 250 * Either the state in auth_state will protect the
250 251 * contents or auth_lock must be held.
251 252 */
252 253 struct auth_cache {
253 254 struct netbuf auth_addr;
254 255 int auth_flavor;
255 256 int auth_access;
256 257 time_t auth_time;
257 258 time_t auth_freshness;
258 259 auth_state_t auth_state;
259 260 char *auth_netid;
260 261 kmutex_t auth_lock;
261 262 struct auth_cache *auth_next;
262 263 };
263 264
264 265 #define AUTH_TABLESIZE 32
265 266
266 267 /*
267 268 * Structure containing log file meta-data.
268 269 */
269 270 struct log_file {
270 271 unsigned int lf_flags; /* flags (see below) */
271 272 int lf_writers; /* outstanding writers */
272 273 int lf_refcnt; /* references to this struct */
273 274 caddr_t lf_path; /* buffer file location */
274 275 vnode_t *lf_vp; /* vnode for the buffer file */
275 276 kmutex_t lf_lock;
276 277 kcondvar_t lf_cv_waiters;
277 278 };
278 279
279 280 /*
280 281 * log_file and log_buffer flags.
281 282 */
282 283 #define L_WAITING 0x01 /* flush of in-core data to stable */
283 284 /* storage in progress */
284 285 #define L_PRINTED 0x02 /* error message printed to console */
285 286 #define L_ERROR 0x04 /* error condition detected */
286 287
287 288 /*
288 289 * The logging buffer information.
289 290 * This structure may be shared by multiple exportinfo structures,
290 291 * if they share the same buffer file.
291 292 * This structure contains the basic information about the buffer, such
292 293 * as it's location in the filesystem.
293 294 *
294 295 * 'lb_lock' protects all the fields in this structure except for 'lb_path',
295 296 * and 'lb_next'.
296 297 * 'lb_path' is a write-once/read-many field which needs no locking, it is
297 298 * set before the structure is linked to any exportinfo structure.
298 299 * 'lb_next' is protected by the log_buffer_list_lock.
299 300 */
300 301 struct log_buffer {
301 302 unsigned int lb_flags; /* L_ONLIST set? */
302 303 int lb_refcnt; /* references to this struct */
303 304 unsigned int lb_rec_id; /* used to generate unique id */
304 305 caddr_t lb_path; /* buffer file pathname */
305 306 struct log_file *lb_logfile; /* points to log_file structure */
306 307 kmutex_t lb_lock;
307 308 struct log_buffer *lb_next;
308 309 kcondvar_t lb_cv_waiters;
309 310 caddr_t lb_records; /* linked list of records to write */
310 311 int lb_num_recs; /* # of records to write */
311 312 ssize_t lb_size_queued; /* number of bytes queued for write */
312 313 };
313 314
314 315 #define LOG_BUFFER_HOLD(lbp) { \
315 316 mutex_enter(&(lbp)->lb_lock); \
316 317 (lbp)->lb_refcnt++; \
317 318 mutex_exit(&(lbp)->lb_lock); \
318 319 }
319 320
320 321 #define LOG_BUFFER_RELE(lbp) { \
321 322 log_buffer_rele(lbp); \
322 323 }
323 324
324 325 /*
325 326 * Structure for character set conversion mapping based on client address.
326 327 */
327 328 struct charset_cache {
328 329 struct charset_cache *next;
329 330 kiconv_t inbound;
330 331 kiconv_t outbound;
331 332 struct sockaddr client_addr;
332 333 };
333 334
334 335 /* Forward declarations */
335 336 struct exportinfo;
336 337 struct exp_visible;
337 338 struct svc_req;
338 339
339 340 /*
340 341 * Treenodes are used to build tree representing every node which is part
341 342 * of nfs server pseudo namespace. They are connected with both exportinfo
342 343 * and exp_visible struct. They were introduced to avoid lookup of ".."
343 344 * in the underlying file system during unshare, which was failing if the
344 345 * file system was forcibly unmounted or if the directory was removed.
345 346 * One exp_visible_t can be shared via several treenode_t, i.e.
346 347 * different tree_vis can point to the same exp_visible_t.
347 348 * This will happen if some directory is on two different shared paths:
348 349 * E.g. after share /tmp/a/b1 and share /tmp/a/b2 there will be two treenodes
349 350 * corresponding to /tmp/a and both will have same value in tree_vis.
350 351 *
351 352 *
352 353 *
353 354 * NEW DATA STRUCT ORIGINAL DATA STRUCT
354 355 *
355 356 * ns_root +---+ +----------+
356 357 * | / | |PSEUDO EXP|-->+---+ +---+ +---+
357 358 * +---+--------- ----+----------+ | a |-->| k |-->| b |
358 359 * /\ +---+ +---+ +---+
359 360 * / \ . . .
360 361 * +---+...\......... ..................... . .
361 362 * *| a | \ +----------+ . .
362 363 * +---+-----\------- ----|REAL EXP a| . .
363 364 * / \ +----------+ . .
364 365 * / +===+... ............................. .
365 366 * / *| k | +----------+ .
366 367 * / +===+--- ----|REAL EXP k| .
367 368 * / +----------+ .
368 369 * +===+................ .....................................
369 370 * *| b | +----------+
370 371 * +===+---------------- ----|REAL EXP b|-->+---+
371 372 * \ +----------+ | d |
372 373 * +===+............. ...................+---+
373 374 * | d | +----------+
374 375 * +===+------------- ----|PSEUDO EXP|-->+---+ +---+
375 376 * / +----------+ | e |-->| g |
376 377 * +---+................. ...................+---+ +---+
377 378 * | e | .
378 379 * +---+ .
379 380 * \ .
380 381 * +---+.............. ............................
381 382 * *| g | +----------+
382 383 * +---+-------------- ----|REAL EXP g|
383 384 * +----------+
384 385 *
385 386 *
386 387 *
387 388 * +===+ +---+ +---+
388 389 * | b |..mountpoint | e |..directory/file *| a |..node is shared
389 390 * +===+ (VROOT) +---+ +---+
390 391 *
391 392 *
392 393 * Bi-directional interconnect:
393 394 * treenode_t::tree_exi --------- exportinfo_t::exi_tree
394 395 * One-way direction connection:
395 396 * treenode_t::tree_vis .........> exp_visible_t
396 397 */
397 398 /* Access to treenode_t is under protection of exported_lock RW_LOCK */
398 399 typedef struct treenode {
399 400 /* support for generic n-ary trees */
400 401 struct treenode *tree_parent;
401 402 struct treenode *tree_child_first;
402 403 struct treenode *tree_sibling; /* next sibling */
403 404 /* private, nfs specific part */
404 405 struct exportinfo *tree_exi;
405 406 struct exp_visible *tree_vis;
406 407 } treenode_t;
407 408
408 409 /*
409 410 * TREE_ROOT checks if the node corresponds to a filesystem root
410 411 * TREE_EXPORTED checks if the node is explicitly shared
411 412 */
412 413
413 414 #define TREE_ROOT(t) \
414 415 ((t)->tree_exi && (t)->tree_exi->exi_vp->v_flag & VROOT)
415 416
416 417 #define TREE_EXPORTED(t) \
417 418 ((t)->tree_exi && !PSEUDO((t)->tree_exi))
418 419
419 420 /* Root of nfs pseudo namespace */
420 421 extern treenode_t *ns_root;
421 422
422 423 #define EXPTABLESIZE 256
423 424
424 425 struct exp_hash {
425 426 struct exportinfo *prev; /* ptr to the previous exportinfo */
426 427 struct exportinfo *next; /* ptr to the next exportinfo */
427 428 struct exportinfo **bckt; /* backpointer to the hash bucket */
428 429 };
429 430
430 431 /*
431 432 * A node associated with an export entry on the
432 433 * list of exported filesystems.
433 434 *
434 435 * exi_count+exi_lock protects an individual exportinfo from being freed
435 436 * when in use.
436 437 *
437 438 * You must have the writer lock on exported_lock to add/delete an exportinfo
438 439 * structure to/from the list.
439 440 *
440 441 * exi_volatile_dev maps to VSW_VOLATILEDEV. It means that the
441 442 * underlying fs devno can change on each mount. When set, the server
442 443 * should not use va_fsid for a GETATTR(FATTR4_FSID) reply. It must
443 444 * use exi_fsid because it is guaranteed to be persistent. This isn't
444 445 * in any way related to NFS4 volatile filehandles.
445 446 */
446 447 struct exportinfo {
447 448 struct exportdata exi_export;
448 449 fsid_t exi_fsid;
449 450 struct fid exi_fid;
450 451 struct exp_hash fid_hash;
451 452 struct exp_hash path_hash;
452 453 struct treenode *exi_tree;
453 454 fhandle_t exi_fh;
454 455 krwlock_t exi_cache_lock;
455 456 kmutex_t exi_lock;
456 457 uint_t exi_count;
457 458 vnode_t *exi_vp;
458 459 vnode_t *exi_dvp;
459 460 struct auth_cache *exi_cache[AUTH_TABLESIZE];
460 461 struct log_buffer *exi_logbuffer;
461 462 struct exp_visible *exi_visible;
462 463 struct charset_cache *exi_charset;
463 464 unsigned exi_volatile_dev:1;
464 465 unsigned exi_moved:1;
465 466 #ifdef VOLATILE_FH_TEST
466 467 uint32_t exi_volatile_id;
467 468 struct ex_vol_rename *exi_vol_rename;
468 469 kmutex_t exi_vol_rename_lock;
469 470 #endif /* VOLATILE_FH_TEST */
470 471 };
471 472
472 473 typedef struct exportinfo exportinfo_t;
473 474 typedef struct exportdata exportdata_t;
474 475 typedef struct secinfo secinfo_t;
475 476
476 477 /*
477 478 * exp_visible is a visible list per filesystem. It is for filesystems
478 479 * that may need a limited view of its contents. A pseudo export and
479 480 * a real export at the mount point (VROOT) which has a subtree shared
480 481 * has a visible list.
481 482 *
482 483 * The exi_visible field is NULL for normal, non=pseudo filesystems
483 484 * which do not have any subtree exported. If the field is non-null,
484 485 * it points to a list of visible entries, identified by vis_fid and/or
485 486 * vis_ino. The presence of a "visible" list means that if this export
486 487 * can only have a limited view, it can only view the entries in the
487 488 * exp_visible list. The directories in the fid list comprise paths that
488 489 * lead to exported directories.
489 490 *
490 491 * The vis_count field records the number of paths in this filesystem
491 492 * that use this directory. The vis_exported field is non-zero if the
492 493 * entry is an exported directory (leaf node).
493 494 *
494 495 * exp_visible itself is not reference counted. Each exp_visible is
495 496 * referenced twice:
496 497 * 1) from treenode::tree_vis
497 498 * 2) linked from exportinfo::exi_visible
498 499 * The 'owner' of exp_visible is the exportinfo structure. exp_visible should
499 500 * be always freed only from exportinfo_t, never from treenode::tree_vis.
500 501 */
501 502
502 503 struct exp_visible {
503 504 vnode_t *vis_vp;
504 505 fid_t vis_fid;
505 506 u_longlong_t vis_ino;
506 507 int vis_count;
507 508 int vis_exported;
508 509 struct exp_visible *vis_next;
509 510 struct secinfo *vis_secinfo;
510 511 int vis_seccnt;
511 512 };
512 513 typedef struct exp_visible exp_visible_t;
513 514
514 515 #define PSEUDO(exi) ((exi)->exi_export.ex_flags & EX_PSEUDO)
515 516 #define EXP_LINKED(exi) ((exi)->fid_hash.bckt != NULL)
516 517
517 518 #define EQFSID(fsidp1, fsidp2) \
518 519 (((fsidp1)->val[0] == (fsidp2)->val[0]) && \
519 520 ((fsidp1)->val[1] == (fsidp2)->val[1]))
520 521
521 522 #define EQFID(fidp1, fidp2) \
522 523 ((fidp1)->fid_len == (fidp2)->fid_len && \
523 524 bcmp((char *)(fidp1)->fid_data, (char *)(fidp2)->fid_data, \
524 525 (uint_t)(fidp1)->fid_len) == 0)
525 526
526 527 #define exportmatch(exi, fsid, fid) \
527 528 (EQFSID(&(exi)->exi_fsid, (fsid)) && EQFID(&(exi)->exi_fid, (fid)))
528 529
529 530 /*
530 531 * Returns true iff exported filesystem is read-only to the given host.
531 532 *
532 533 * Note: this macro should be as fast as possible since it's called
533 534 * on each NFS modification request.
534 535 */
535 536 #define rdonly(exi, req) (nfsauth_access(exi, req) & NFSAUTH_RO)
536 537 #define rdonly4(exi, vp, req) \
537 538 (vn_is_readonly(vp) || \
538 539 (nfsauth4_access(exi, vp, req) & (NFSAUTH_RO | NFSAUTH_LIMITED)))
539 540
540 541 extern int nfsauth4_access(struct exportinfo *, vnode_t *,
541 542 struct svc_req *);
542 543 extern int nfsauth4_secinfo_access(struct exportinfo *,
543 544 struct svc_req *, int, int);
544 545 extern int nfs_fhbcmp(char *, char *, int);
545 546 extern int nfs_exportinit(void);
546 547 extern void nfs_exportfini(void);
547 548 extern int chk_clnt_sec(struct exportinfo *, struct svc_req *req);
548 549 extern int makefh(fhandle_t *, struct vnode *, struct exportinfo *);
549 550 extern int makefh_ol(fhandle_t *, struct exportinfo *, uint_t);
550 551 extern int makefh3(nfs_fh3 *, struct vnode *, struct exportinfo *);
551 552 extern int makefh3_ol(nfs_fh3 *, struct exportinfo *, uint_t);
552 553 extern vnode_t *nfs_fhtovp(fhandle_t *, struct exportinfo *);
553 554 extern vnode_t *nfs3_fhtovp(nfs_fh3 *, struct exportinfo *);
554 555 extern vnode_t *lm_fhtovp(fhandle_t *fh);
555 556 extern vnode_t *lm_nfs3_fhtovp(nfs_fh3 *fh);
556 557 extern struct exportinfo *checkexport(fsid_t *, struct fid *);
557 558 extern struct exportinfo *checkexport4(fsid_t *, struct fid *, vnode_t *vp);
558 559 extern void exi_hold(struct exportinfo *);
559 560 extern void exi_rele(struct exportinfo *);
560 561 extern struct exportinfo *nfs_vptoexi(vnode_t *, vnode_t *, cred_t *, int *,
561 562 int *, bool_t);
562 563 extern int nfs_check_vpexi(vnode_t *, vnode_t *, cred_t *,
563 564 struct exportinfo **);
564 565 extern void export_link(struct exportinfo *);
565 566 extern void export_unlink(struct exportinfo *);
566 567 extern vnode_t *untraverse(vnode_t *);
567 568 extern int vn_is_nfs_reparse(vnode_t *, cred_t *);
568 569 extern int client_is_downrev(struct svc_req *);
569 570 extern char *build_symlink(vnode_t *, cred_t *, size_t *);
570 571
571 572 /*
572 573 * Functions that handle the NFSv4 server namespace
573 574 */
574 575 extern exportinfo_t *vis2exi(treenode_t *);
575 576 extern int treeclimb_export(struct exportinfo *);
576 577 extern void treeclimb_unexport(struct exportinfo *);
577 578 extern int nfs_visible(struct exportinfo *, vnode_t *, int *);
578 579 extern int nfs_visible_inode(struct exportinfo *, ino64_t, int *);
579 580 extern int has_visible(struct exportinfo *, vnode_t *);
580 581 extern void free_visible(struct exp_visible *);
581 582 extern int nfs_exported(struct exportinfo *, vnode_t *);
582 583 extern struct exportinfo *pseudo_exportfs(vnode_t *, fid_t *,
583 584 struct exp_visible *, struct exportdata *);
584 585 extern int vop_fid_pseudo(vnode_t *, fid_t *fidp);
585 586 extern int nfs4_vget_pseudo(struct exportinfo *, vnode_t **, fid_t *);
586 587 /*
587 588 * Functions that handle the NFSv4 server namespace security flavors
588 589 * information.
589 590 */
590 591 extern void srv_secinfo_exp2pseu(struct exportdata *, struct exportdata *);
591 592 extern void srv_secinfo_list_free(struct secinfo *, int);
592 593
593 594 /*
594 595 * "public" and default (root) location for public filehandle
595 596 */
596 597 extern struct exportinfo *exi_public, *exi_root;
597 598 extern fhandle_t nullfh2; /* for comparing V2 filehandles */
598 599 extern krwlock_t exported_lock;
599 600 extern struct exportinfo *exptable[];
600 601
601 602 /*
602 603 * Two macros for identifying public filehandles.
603 604 * A v2 public filehandle is 32 zero bytes.
604 605 * A v3 public filehandle is zero length.
605 606 */
606 607 #define PUBLIC_FH2(fh) \
607 608 ((fh)->fh_fsid.val[1] == 0 && \
608 609 bcmp((fh), &nullfh2, sizeof (fhandle_t)) == 0)
609 610
610 611 #define PUBLIC_FH3(fh) \
611 612 ((fh)->fh3_length == 0)
612 613
613 614 extern int makefh4(nfs_fh4 *, struct vnode *, struct exportinfo *);
614 615 extern vnode_t *nfs4_fhtovp(nfs_fh4 *, struct exportinfo *, nfsstat4 *);
615 616
616 617 #endif /* _KERNEL */
617 618
618 619 #ifdef __cplusplus
619 620 }
620 621 #endif
621 622
622 623 #endif /* _NFS_EXPORT_H */
↓ open down ↓ |
427 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX