3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
24 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
25 * Copyright 2016 Jason King.
26 */
27
28 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
29 /* All Rights Reserved */
30
31 #ifndef _NFS_EXPORT_H
32 #define _NFS_EXPORT_H
33
34 #include <nfs/nfs_sec.h>
35 #include <nfs/auth.h>
36 #include <sys/vnode.h>
37 #include <nfs/nfs4.h>
38 #include <sys/kiconv.h>
39 #include <sys/avl.h>
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 /*
46 * nfs pseudo flavor number is owned by IANA. Need to make sure the
47 * Solaris specific NFS_FLAVOR_NOMAP number will not overlap with any
48 * new IANA defined pseudo flavor numbers. The chance for the overlap
49 * is very small since the growth of new flavor numbers is expected
50 * to be limited.
51 */
52 #define NFS_FLAVOR_NOMAP 999999 /* no nfs flavor mapping */
53
54 /*
55 * As duplicate flavors can be passed into exportfs in the arguments, we
56 * allocate a cleaned up array with non duplicate flavors on the stack.
57 * So we need to know how much to allocate.
58 */
59 #define MAX_FLAVORS 6 /* none, sys, dh, krb5, krb5i krb5p */
60
172 #define EX_ACLOK 0x02 /* exported with maximal access if acl exists */
173 #define EX_PUBLIC 0x04 /* exported with public filehandle */
174 #define EX_NOSUB 0x08 /* no nfs_getfh or MCL below export point */
175 #define EX_INDEX 0x10 /* exported with index file specified */
176 #define EX_LOG 0x20 /* logging enabled */
177 #define EX_LOG_ALLOPS 0x40 /* logging of all RPC operations enabled */
178 /* by default only operations which affect */
179 /* transaction logging are enabled */
180 #define EX_PSEUDO 0x80 /* pseudo filesystem export */
181 #ifdef VOLATILE_FH_TEST
182 #define EX_VOLFH 0x100 /* XXX nfsv4 fh may expire anytime */
183 #define EX_VOLRNM 0x200 /* XXX nfsv4 fh expire at rename */
184 #define EX_VOLMIG 0x400 /* XXX nfsv4 fh expire at migration */
185 #define EX_NOEXPOPEN 0x800 /* XXX nfsv4 fh no expire with open */
186 #endif /* VOLATILE_FH_TEST */
187
188 #define EX_CHARMAP 0x1000 /* NFS may need a character set conversion */
189 #define EX_NOACLFAB 0x2000 /* If set, NFSv2 and v3 servers won't */
190 /* fabricate an aclent_t ACL on file systems */
191 /* that don't support aclent_t ACLs */
192
193 #ifdef _KERNEL
194
195 #define RPC_IDEMPOTENT 0x1 /* idempotent or not */
196 /*
197 * Be very careful about which NFS procedures get the RPC_ALLOWANON bit.
198 * Right now, if this bit is on, we ignore the results of per NFS request
199 * access control.
200 */
201 #define RPC_ALLOWANON 0x2 /* allow anonymous access */
202 #define RPC_MAPRESP 0x4 /* use mapped response buffer */
203 #define RPC_AVOIDWORK 0x8 /* do work avoidance for dups */
204 #define RPC_PUBLICFH_OK 0x10 /* allow use of public filehandle */
205
206 /*
207 * RPC_ALL is an or of all above bits to be used with "don't care"
208 * nfsv4 ops. The flags of an nfsv4 request is the bit-AND of the
209 * per-op flags.
210 */
211 #define RPC_ALL (RPC_IDEMPOTENT|RPC_ALLOWANON|RPC_AVOIDWORK|RPC_PUBLICFH_OK)
459 /* support for generic n-ary trees */
460 struct treenode *tree_parent;
461 struct treenode *tree_child_first;
462 struct treenode *tree_sibling; /* next sibling */
463 /* private, nfs specific part */
464 struct exportinfo *tree_exi;
465 struct exp_visible *tree_vis;
466 } treenode_t;
467
468 /*
469 * TREE_ROOT checks if the node corresponds to a filesystem root
470 * TREE_EXPORTED checks if the node is explicitly shared
471 */
472
473 #define TREE_ROOT(t) \
474 ((t)->tree_exi && (t)->tree_exi->exi_vp->v_flag & VROOT)
475
476 #define TREE_EXPORTED(t) \
477 ((t)->tree_exi && !PSEUDO((t)->tree_exi))
478
479 /* Root of nfs pseudo namespace */
480 extern treenode_t *ns_root;
481
482 #define EXPTABLESIZE 256
483
484 struct exp_hash {
485 struct exportinfo *prev; /* ptr to the previous exportinfo */
486 struct exportinfo *next; /* ptr to the next exportinfo */
487 struct exportinfo **bckt; /* backpointer to the hash bucket */
488 };
489
490 /*
491 * A node associated with an export entry on the
492 * list of exported filesystems.
493 *
494 * exi_count+exi_lock protects an individual exportinfo from being freed
495 * when in use.
496 *
497 * You must have the writer lock on exported_lock to add/delete an exportinfo
498 * structure to/from the list.
499 *
500 * exi_volatile_dev maps to VSW_VOLATILEDEV. It means that the
501 * underlying fs devno can change on each mount. When set, the server
512 struct exp_hash fid_hash;
513 struct exp_hash path_hash;
514 struct treenode *exi_tree;
515 fhandle_t exi_fh;
516 krwlock_t exi_cache_lock;
517 kmutex_t exi_lock;
518 uint_t exi_count;
519 vnode_t *exi_vp;
520 vnode_t *exi_dvp;
521 avl_tree_t *exi_cache[AUTH_TABLESIZE];
522 struct log_buffer *exi_logbuffer;
523 struct exp_visible *exi_visible;
524 struct charset_cache *exi_charset;
525 unsigned exi_volatile_dev:1;
526 unsigned exi_moved:1;
527 #ifdef VOLATILE_FH_TEST
528 uint32_t exi_volatile_id;
529 struct ex_vol_rename *exi_vol_rename;
530 kmutex_t exi_vol_rename_lock;
531 #endif /* VOLATILE_FH_TEST */
532 };
533
534 typedef struct exportinfo exportinfo_t;
535 typedef struct exportdata exportdata_t;
536 typedef struct secinfo secinfo_t;
537
538 /*
539 * exp_visible is a visible list per filesystem. It is for filesystems
540 * that may need a limited view of its contents. A pseudo export and
541 * a real export at the mount point (VROOT) which has a subtree shared
542 * has a visible list.
543 *
544 * The exi_visible field is NULL for normal, non-pseudo filesystems
545 * which do not have any subtree exported. If the field is non-null,
546 * it points to a list of visible entries, identified by vis_fid and/or
547 * vis_ino. The presence of a "visible" list means that if this export
548 * can only have a limited view, it can only view the entries in the
549 * exp_visible list. The directories in the fid list comprise paths that
550 * lead to exported directories.
551 *
590 (EQFSID(&(exi)->exi_fsid, (fsid)) && EQFID(&(exi)->exi_fid, (fid)))
591
592 /*
593 * Returns true iff exported filesystem is read-only to the given host.
594 *
595 * Note: this macro should be as fast as possible since it's called
596 * on each NFS modification request.
597 */
598 #define rdonly(ro, vp) ((ro) || vn_is_readonly(vp))
599 #define rdonly4(req, cs) \
600 (vn_is_readonly((cs)->vp) || \
601 (nfsauth4_access((cs)->exi, (cs)->vp, (req), (cs)->basecr, NULL, \
602 NULL, NULL, NULL) & (NFSAUTH_RO | NFSAUTH_LIMITED)))
603
604 extern int nfsauth4_access(struct exportinfo *, vnode_t *,
605 struct svc_req *, cred_t *, uid_t *, gid_t *, uint_t *, gid_t **);
606 extern int nfsauth4_secinfo_access(struct exportinfo *,
607 struct svc_req *, int, int, cred_t *);
608 extern int nfsauth_cache_clnt_compar(const void *, const void *);
609 extern int nfs_fhbcmp(char *, char *, int);
610 extern int nfs_exportinit(void);
611 extern void nfs_exportfini(void);
612 extern int chk_clnt_sec(struct exportinfo *, struct svc_req *);
613 extern int makefh(fhandle_t *, struct vnode *, struct exportinfo *);
614 extern int makefh_ol(fhandle_t *, struct exportinfo *, uint_t);
615 extern int makefh3(nfs_fh3 *, struct vnode *, struct exportinfo *);
616 extern int makefh3_ol(nfs_fh3 *, struct exportinfo *, uint_t);
617 extern vnode_t *nfs_fhtovp(fhandle_t *, struct exportinfo *);
618 extern vnode_t *nfs3_fhtovp(nfs_fh3 *, struct exportinfo *);
619 extern struct exportinfo *checkexport(fsid_t *, struct fid *);
620 extern struct exportinfo *checkexport4(fsid_t *, struct fid *, vnode_t *);
621 extern void exi_hold(struct exportinfo *);
622 extern void exi_rele(struct exportinfo *);
623 extern struct exportinfo *nfs_vptoexi(vnode_t *, vnode_t *, cred_t *, int *,
624 int *, bool_t);
625 extern int nfs_check_vpexi(vnode_t *, vnode_t *, cred_t *,
626 struct exportinfo **);
627 extern void export_link(struct exportinfo *);
628 extern void export_unlink(struct exportinfo *);
629 extern vnode_t *untraverse(vnode_t *);
630 extern int vn_is_nfs_reparse(vnode_t *, cred_t *);
631 extern int client_is_downrev(struct svc_req *);
632 extern char *build_symlink(vnode_t *, cred_t *, size_t *);
633
634 /*
635 * Functions that handle the NFSv4 server namespace
636 */
637 extern exportinfo_t *vis2exi(treenode_t *);
638 extern int treeclimb_export(struct exportinfo *);
639 extern void treeclimb_unexport(struct exportinfo *);
640 extern int nfs_visible(struct exportinfo *, vnode_t *, int *);
641 extern int nfs_visible_inode(struct exportinfo *, ino64_t,
642 struct exp_visible **);
643 extern int has_visible(struct exportinfo *, vnode_t *);
644 extern void free_visible(struct exp_visible *);
645 extern int nfs_exported(struct exportinfo *, vnode_t *);
646 extern struct exportinfo *pseudo_exportfs(vnode_t *, fid_t *,
647 struct exp_visible *, struct exportdata *);
648 extern int vop_fid_pseudo(vnode_t *, fid_t *);
649 extern int nfs4_vget_pseudo(struct exportinfo *, vnode_t **, fid_t *);
650 extern bool_t nfs_visible_change(struct exportinfo *, vnode_t *,
651 timespec_t *);
652 extern void tree_update_change(treenode_t *, timespec_t *);
653 /*
654 * Functions that handle the NFSv4 server namespace security flavors
655 * information.
656 */
657 extern void srv_secinfo_exp2pseu(struct exportdata *, struct exportdata *);
658 extern void srv_secinfo_list_free(struct secinfo *, int);
659
660 /*
661 * "public" and default (root) location for public filehandle
662 */
663 extern struct exportinfo *exi_public, *exi_root;
664 extern fhandle_t nullfh2; /* for comparing V2 filehandles */
665 extern krwlock_t exported_lock;
666 extern struct exportinfo *exptable[];
667
668 /*
669 * Two macros for identifying public filehandles.
670 * A v2 public filehandle is 32 zero bytes.
671 * A v3 public filehandle is zero length.
672 */
673 #define PUBLIC_FH2(fh) \
674 ((fh)->fh_fsid.val[1] == 0 && \
675 bcmp((fh), &nullfh2, sizeof (fhandle_t)) == 0)
676
677 #define PUBLIC_FH3(fh) \
678 ((fh)->fh3_length == 0)
679
680 extern int makefh4(nfs_fh4 *, struct vnode *, struct exportinfo *);
681 extern vnode_t *nfs4_fhtovp(nfs_fh4 *, struct exportinfo *, nfsstat4 *);
682
683 #endif /* _KERNEL */
684
685 #ifdef __cplusplus
686 }
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2018 Nexenta Systems, Inc.
24 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
25 * Copyright 2016 Jason King.
26 */
27
28 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
29 /* All Rights Reserved */
30
31 #ifndef _NFS_EXPORT_H
32 #define _NFS_EXPORT_H
33
34 #include <nfs/nfs_sec.h>
35 #include <nfs/auth.h>
36 #include <sys/vnode.h>
37 #include <nfs/nfs4.h>
38 #include <sys/kiconv.h>
39 #include <sys/avl.h>
40
41 #ifdef _KERNEL
42 #include <sys/pkp_hash.h> /* for PKP_HASH_SIZE */
43 #endif /* _KERNEL */
44
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48
49 /*
50 * nfs pseudo flavor number is owned by IANA. Need to make sure the
51 * Solaris specific NFS_FLAVOR_NOMAP number will not overlap with any
52 * new IANA defined pseudo flavor numbers. The chance for the overlap
53 * is very small since the growth of new flavor numbers is expected
54 * to be limited.
55 */
56 #define NFS_FLAVOR_NOMAP 999999 /* no nfs flavor mapping */
57
58 /*
59 * As duplicate flavors can be passed into exportfs in the arguments, we
60 * allocate a cleaned up array with non duplicate flavors on the stack.
61 * So we need to know how much to allocate.
62 */
63 #define MAX_FLAVORS 6 /* none, sys, dh, krb5, krb5i krb5p */
64
176 #define EX_ACLOK 0x02 /* exported with maximal access if acl exists */
177 #define EX_PUBLIC 0x04 /* exported with public filehandle */
178 #define EX_NOSUB 0x08 /* no nfs_getfh or MCL below export point */
179 #define EX_INDEX 0x10 /* exported with index file specified */
180 #define EX_LOG 0x20 /* logging enabled */
181 #define EX_LOG_ALLOPS 0x40 /* logging of all RPC operations enabled */
182 /* by default only operations which affect */
183 /* transaction logging are enabled */
184 #define EX_PSEUDO 0x80 /* pseudo filesystem export */
185 #ifdef VOLATILE_FH_TEST
186 #define EX_VOLFH 0x100 /* XXX nfsv4 fh may expire anytime */
187 #define EX_VOLRNM 0x200 /* XXX nfsv4 fh expire at rename */
188 #define EX_VOLMIG 0x400 /* XXX nfsv4 fh expire at migration */
189 #define EX_NOEXPOPEN 0x800 /* XXX nfsv4 fh no expire with open */
190 #endif /* VOLATILE_FH_TEST */
191
192 #define EX_CHARMAP 0x1000 /* NFS may need a character set conversion */
193 #define EX_NOACLFAB 0x2000 /* If set, NFSv2 and v3 servers won't */
194 /* fabricate an aclent_t ACL on file systems */
195 /* that don't support aclent_t ACLs */
196 #define EX_NOHIDE 0x4000 /* traversable from exported parent */
197
198 #ifdef _KERNEL
199
200 #define RPC_IDEMPOTENT 0x1 /* idempotent or not */
201 /*
202 * Be very careful about which NFS procedures get the RPC_ALLOWANON bit.
203 * Right now, if this bit is on, we ignore the results of per NFS request
204 * access control.
205 */
206 #define RPC_ALLOWANON 0x2 /* allow anonymous access */
207 #define RPC_MAPRESP 0x4 /* use mapped response buffer */
208 #define RPC_AVOIDWORK 0x8 /* do work avoidance for dups */
209 #define RPC_PUBLICFH_OK 0x10 /* allow use of public filehandle */
210
211 /*
212 * RPC_ALL is an or of all above bits to be used with "don't care"
213 * nfsv4 ops. The flags of an nfsv4 request is the bit-AND of the
214 * per-op flags.
215 */
216 #define RPC_ALL (RPC_IDEMPOTENT|RPC_ALLOWANON|RPC_AVOIDWORK|RPC_PUBLICFH_OK)
464 /* support for generic n-ary trees */
465 struct treenode *tree_parent;
466 struct treenode *tree_child_first;
467 struct treenode *tree_sibling; /* next sibling */
468 /* private, nfs specific part */
469 struct exportinfo *tree_exi;
470 struct exp_visible *tree_vis;
471 } treenode_t;
472
473 /*
474 * TREE_ROOT checks if the node corresponds to a filesystem root
475 * TREE_EXPORTED checks if the node is explicitly shared
476 */
477
478 #define TREE_ROOT(t) \
479 ((t)->tree_exi && (t)->tree_exi->exi_vp->v_flag & VROOT)
480
481 #define TREE_EXPORTED(t) \
482 ((t)->tree_exi && !PSEUDO((t)->tree_exi))
483
484 #define EXPTABLESIZE 256
485
486 struct exp_hash {
487 struct exportinfo *prev; /* ptr to the previous exportinfo */
488 struct exportinfo *next; /* ptr to the next exportinfo */
489 struct exportinfo **bckt; /* backpointer to the hash bucket */
490 };
491
492 /*
493 * A node associated with an export entry on the
494 * list of exported filesystems.
495 *
496 * exi_count+exi_lock protects an individual exportinfo from being freed
497 * when in use.
498 *
499 * You must have the writer lock on exported_lock to add/delete an exportinfo
500 * structure to/from the list.
501 *
502 * exi_volatile_dev maps to VSW_VOLATILEDEV. It means that the
503 * underlying fs devno can change on each mount. When set, the server
514 struct exp_hash fid_hash;
515 struct exp_hash path_hash;
516 struct treenode *exi_tree;
517 fhandle_t exi_fh;
518 krwlock_t exi_cache_lock;
519 kmutex_t exi_lock;
520 uint_t exi_count;
521 vnode_t *exi_vp;
522 vnode_t *exi_dvp;
523 avl_tree_t *exi_cache[AUTH_TABLESIZE];
524 struct log_buffer *exi_logbuffer;
525 struct exp_visible *exi_visible;
526 struct charset_cache *exi_charset;
527 unsigned exi_volatile_dev:1;
528 unsigned exi_moved:1;
529 #ifdef VOLATILE_FH_TEST
530 uint32_t exi_volatile_id;
531 struct ex_vol_rename *exi_vol_rename;
532 kmutex_t exi_vol_rename_lock;
533 #endif /* VOLATILE_FH_TEST */
534 int exi_id;
535 avl_node_t exi_id_link;
536 struct exp_kstats *exi_kstats;
537 zoneid_t exi_zoneid;
538 };
539
540 typedef struct exportinfo exportinfo_t;
541 typedef struct exportdata exportdata_t;
542 typedef struct secinfo secinfo_t;
543
544 /*
545 * exp_visible is a visible list per filesystem. It is for filesystems
546 * that may need a limited view of its contents. A pseudo export and
547 * a real export at the mount point (VROOT) which has a subtree shared
548 * has a visible list.
549 *
550 * The exi_visible field is NULL for normal, non-pseudo filesystems
551 * which do not have any subtree exported. If the field is non-null,
552 * it points to a list of visible entries, identified by vis_fid and/or
553 * vis_ino. The presence of a "visible" list means that if this export
554 * can only have a limited view, it can only view the entries in the
555 * exp_visible list. The directories in the fid list comprise paths that
556 * lead to exported directories.
557 *
596 (EQFSID(&(exi)->exi_fsid, (fsid)) && EQFID(&(exi)->exi_fid, (fid)))
597
598 /*
599 * Returns true iff exported filesystem is read-only to the given host.
600 *
601 * Note: this macro should be as fast as possible since it's called
602 * on each NFS modification request.
603 */
604 #define rdonly(ro, vp) ((ro) || vn_is_readonly(vp))
605 #define rdonly4(req, cs) \
606 (vn_is_readonly((cs)->vp) || \
607 (nfsauth4_access((cs)->exi, (cs)->vp, (req), (cs)->basecr, NULL, \
608 NULL, NULL, NULL) & (NFSAUTH_RO | NFSAUTH_LIMITED)))
609
610 extern int nfsauth4_access(struct exportinfo *, vnode_t *,
611 struct svc_req *, cred_t *, uid_t *, gid_t *, uint_t *, gid_t **);
612 extern int nfsauth4_secinfo_access(struct exportinfo *,
613 struct svc_req *, int, int, cred_t *);
614 extern int nfsauth_cache_clnt_compar(const void *, const void *);
615 extern int nfs_fhbcmp(char *, char *, int);
616 extern void nfs_exportinit(void);
617 extern void nfs_exportfini(void);
618 extern int chk_clnt_sec(struct exportinfo *, struct svc_req *);
619 extern int makefh(fhandle_t *, struct vnode *, struct exportinfo *);
620 extern int makefh_ol(fhandle_t *, struct exportinfo *, uint_t);
621 extern int makefh3(nfs_fh3 *, struct vnode *, struct exportinfo *);
622 extern int makefh3_ol(nfs_fh3 *, struct exportinfo *, uint_t);
623 extern vnode_t *nfs_fhtovp(fhandle_t *, struct exportinfo *);
624 extern vnode_t *nfs3_fhtovp(nfs_fh3 *, struct exportinfo *);
625 extern struct exportinfo *checkexport(fsid_t *, struct fid *);
626 extern struct exportinfo *checkexport4(fsid_t *, struct fid *, vnode_t *);
627 extern void exi_hold(struct exportinfo *);
628 extern void exi_rele(struct exportinfo **);
629 extern struct exportinfo *nfs_vptoexi(vnode_t *, vnode_t *, cred_t *, int *,
630 int *, bool_t);
631 extern int nfs_check_vpexi(vnode_t *, vnode_t *, cred_t *,
632 struct exportinfo **);
633 extern vnode_t *untraverse(vnode_t *);
634 extern int vn_is_nfs_reparse(vnode_t *, cred_t *);
635 extern int client_is_downrev(struct svc_req *);
636 extern char *build_symlink(vnode_t *, cred_t *, size_t *);
637
638 extern fhandle_t nullfh2; /* for comparing V2 filehandles */
639
640 typedef struct nfs_export {
641 /* Root of nfs pseudo namespace */
642 treenode_t *ns_root;
643
644 struct exportinfo *exptable_path_hash[PKP_HASH_SIZE];
645 struct exportinfo *exptable[EXPTABLESIZE];
646
647 /*
648 * Read/Write lock that protects the exportinfo list. This lock
649 * must be held when searching or modifiying the exportinfo list.
650 */
651 krwlock_t exported_lock;
652
653 /* "public" and default (root) location for public filehandle */
654 struct exportinfo *exi_public, *exi_root;
655 /* For checking default public file handle */
656 fid_t exi_rootfid;
657 /* For comparing V2 filehandles */
658 fhandle_t nullfh2;
659
660 /* The change attribute value of the root of nfs pseudo namespace */
661 timespec_t ns_root_change;
662 } nfs_export_t;
663
664 /*
665 * Functions that handle the NFSv4 server namespace
666 */
667 extern exportinfo_t *vis2exi(treenode_t *);
668 extern int treeclimb_export(struct exportinfo *);
669 extern void treeclimb_unexport(nfs_export_t *, struct exportinfo *);
670 extern int nfs_visible(struct exportinfo *, vnode_t *, int *);
671 extern int nfs_visible_inode(struct exportinfo *, ino64_t,
672 struct exp_visible **);
673 extern int has_visible(struct exportinfo *, vnode_t *);
674 extern void free_visible(struct exp_visible *);
675 extern int nfs_exported(struct exportinfo *, vnode_t *);
676 extern struct exportinfo *pseudo_exportfs(nfs_export_t *, vnode_t *, fid_t *,
677 struct exp_visible *, struct exportdata *);
678 extern int vop_fid_pseudo(vnode_t *, fid_t *);
679 extern int nfs4_vget_pseudo(struct exportinfo *, vnode_t **, fid_t *);
680 extern bool_t nfs_visible_change(struct exportinfo *, vnode_t *,
681 timespec_t *);
682 extern void tree_update_change(nfs_export_t *, treenode_t *, timespec_t *);
683
684 /*
685 * Functions that handle the NFSv4 server namespace security flavors
686 * information.
687 */
688 extern void srv_secinfo_exp2pseu(struct exportdata *, struct exportdata *);
689 extern void srv_secinfo_list_free(struct secinfo *, int);
690
691 extern nfs_export_t *nfs_get_export();
692 extern void export_link(nfs_export_t *, struct exportinfo *);
693 extern void export_unlink(nfs_export_t *, struct exportinfo *);
694
695 /*
696 * exi_id support
697 */
698 extern kmutex_t nfs_exi_id_lock;
699 extern avl_tree_t exi_id_tree;
700 extern int exi_id_get_next(void);
701
702 /*
703 * Two macros for identifying public filehandles.
704 * A v2 public filehandle is 32 zero bytes.
705 * A v3 public filehandle is zero length.
706 */
707 #define PUBLIC_FH2(fh) \
708 ((fh)->fh_fsid.val[1] == 0 && \
709 bcmp((fh), &nullfh2, sizeof (fhandle_t)) == 0)
710
711 #define PUBLIC_FH3(fh) \
712 ((fh)->fh3_length == 0)
713
714 extern int makefh4(nfs_fh4 *, struct vnode *, struct exportinfo *);
715 extern vnode_t *nfs4_fhtovp(nfs_fh4 *, struct exportinfo *, nfsstat4 *);
716
717 #endif /* _KERNEL */
718
719 #ifdef __cplusplus
720 }
|