--- old/usr/src/uts/common/smbsrv/smb_kproto.h	Mon Aug  5 17:34:32 2019
+++ new/usr/src/uts/common/smbsrv/smb_kproto.h	Mon Aug  5 17:34:32 2019
@@ -21,8 +21,8 @@
 
 /*
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  * Copyright 2016 Syneto S.R.L.  All rights reserved.
+ * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
  */
 
 /*
@@ -38,6 +38,7 @@
 
 #include <sys/types.h>
 #include <sys/param.h>
+#include <sys/varargs.h>
 #include <sys/systm.h>
 #include <sys/debug.h>
 #include <sys/kmem.h>
@@ -55,61 +56,11 @@
 #include <smbsrv/smb_ktypes.h>
 #include <smbsrv/smb_ioctl.h>
 
-/*
- * DTrace SDT probes have different signatures in userland than they do in
- * kernel.  If we're compiling for user mode (libfksmbsrv) define them as
- * either no-op (for the SMB dtrace provider) or libfksmbsrv functions for
- * the other SDT probe sites.
- */
-#ifndef	_KERNEL
-
-extern void smb_dtrace1(const char *f, const char *n,
-			const char *t1, long v1);
-extern void smb_dtrace2(const char *f, const char *n,
-			const char *t1, long v1,
-			const char *t2, long v2);
-extern void smb_dtrace3(const char *f, const char *n,
-			const char *t1, long v1,
-			const char *t2, long v2,
-			const char *t3, long v3);
-
-/*
- * These are for the SMB dtrace proivder, which for a user-mode build
- * are largely redundant with the fbt probes so make these no-ops.
- */
-#undef	DTRACE_SMB_1
-#define	DTRACE_SMB_1(n, a, b)			((void)b)
-#undef	DTRACE_SMB_2
-#define	DTRACE_SMB_2(n, a, b, c, d)		((void)b, (void)d)
-
-/*
- * These are for the other (specialized) dtrace SDT probes sprinkled
- * through the smbsrv code.  In libfksmbsrv map these to functions.
- */
-
-#undef	DTRACE_PROBE1
-#define	DTRACE_PROBE1(n, a, b) \
-	smb_dtrace1(__func__, #n, #a, (long)b)
-
-#undef	DTRACE_PROBE2
-#define	DTRACE_PROBE2(n, a, b, c, d) \
-	smb_dtrace2(__func__, #n, #a, (long)b, #c, (long)d)
-
-#undef	DTRACE_PROBE3
-#define	DTRACE_PROBE3(n, a, b, c, d, e, f) \
-	smb_dtrace3(__func__, #n, #a, (long)b, #c, (long)d, #e, (long)f)
-
-#endif	/* _KERNEL */
-
 extern	int smb_maxbufsize;
 extern	int smb_flush_required;
 extern	int smb_dirsymlink_enable;
-extern	int smb_oplock_levelII;
-extern	int smb_oplock_timeout;
-extern	int smb_oplock_min_timeout;
 extern	int smb_shortnames;
 extern	int smb_sign_debug;
-extern	int smb_raw_mode;
 extern	uint_t smb_audit_flags;
 extern	int smb_ssetup_threshold;
 extern	int smb_tcon_threshold;
@@ -117,6 +68,7 @@
 extern	int smb_ssetup_timeout;
 extern	int smb_tcon_timeout;
 extern	int smb_opipe_timeout;
+extern	int smb_allow_advisory_locks;
 extern const uint32_t smb_vop_dosattr_settable;
 
 /* Thread priorities - see smb_init.c */
@@ -135,6 +87,7 @@
 extern	kmem_cache_t		*smb_cache_odir;
 extern	kmem_cache_t		*smb_cache_opipe;
 extern	kmem_cache_t		*smb_cache_event;
+extern	kmem_cache_t		*smb_cache_lock;
 
 extern	kmem_cache_t		*smb_kshare_cache_vfs;
 
@@ -278,6 +231,7 @@
 
 void smb_query_shortname(smb_node_t *, smb_queryinfo_t *);
 
+uint32_t smb_dfs_fsctl(smb_request_t *, smb_fsctl_t *);
 uint32_t smb_dfs_get_referrals(smb_request_t *, smb_fsctl_t *);
 
 int smb1_newrq_negotiate(smb_request_t *);
@@ -299,33 +253,57 @@
  * Logging functions
  */
 void smb_log_flush(void);
-void smb_correct_keep_alive_values(uint32_t new_keep_alive);
 void smb_close_all_connections(void);
 
 int smb_net_id(uint32_t);
 
 /*
- * oplock functions - node operations
+ * Common oplock functions
  */
-void smb_oplock_acquire(smb_request_t *sr, smb_node_t *, smb_ofile_t *);
-void smb_oplock_release(smb_node_t *, smb_ofile_t *);
-int smb_oplock_break(smb_request_t *, smb_node_t *, uint32_t);
-void smb_oplock_break_levelII(smb_node_t *);
-void smb_oplock_ack(smb_node_t *, smb_ofile_t *, uint8_t);
-void smb_oplock_broadcast(smb_node_t *);
+uint32_t smb_oplock_request(smb_request_t *, smb_ofile_t *, uint32_t *);
+uint32_t smb_oplock_ack_break(smb_request_t *, smb_ofile_t *, uint32_t *);
+uint32_t smb_oplock_break_PARENT(smb_node_t *, smb_ofile_t *);
+uint32_t smb_oplock_break_OPEN(smb_node_t *, smb_ofile_t *,
+    uint32_t DesiredAccess, uint32_t CreateDisposition);
+uint32_t smb_oplock_break_BATCH(smb_node_t *, smb_ofile_t *,
+    uint32_t DesiredAccess, uint32_t CreateDisposition);
+uint32_t smb_oplock_break_HANDLE(smb_node_t *, smb_ofile_t *);
+void smb_oplock_break_CLOSE(smb_node_t *, smb_ofile_t *);
+uint32_t smb_oplock_break_READ(smb_node_t *, smb_ofile_t *);
+uint32_t smb_oplock_break_WRITE(smb_node_t *, smb_ofile_t *);
+uint32_t smb_oplock_break_SETINFO(smb_node_t *,
+    smb_ofile_t *ofile, uint32_t InfoClass);
+uint32_t smb_oplock_break_DELETE(smb_node_t *, smb_ofile_t *);
 
-void smb1_oplock_break_notification(smb_request_t *, uint8_t);
-void smb2_oplock_break_notification(smb_request_t *, uint8_t);
+void smb_oplock_move(smb_node_t *, smb_ofile_t *, smb_ofile_t *);
 
 /*
+ * Protocol-specific oplock functions
+ * (and "server-level" functions)
+ */
+void smb1_oplock_acquire(smb_request_t *, boolean_t);
+void smb1_oplock_break_notification(smb_request_t *, uint32_t);
+void smb2_oplock_break_notification(smb_request_t *, uint32_t);
+void smb2_lease_break_notification(smb_request_t *, uint32_t, boolean_t);
+void smb_oplock_ind_break(smb_ofile_t *, uint32_t, boolean_t, uint32_t);
+void smb_oplock_ind_break_in_ack(smb_request_t *, smb_ofile_t *,
+    uint32_t, boolean_t);
+void smb_oplock_send_brk(smb_request_t *);
+uint32_t smb_oplock_wait_break(smb_node_t *, int);
+
+/*
  * range lock functions - node operations
  */
 uint32_t smb_lock_get_lock_count(smb_node_t *, smb_ofile_t *);
-uint32_t smb_unlock_range(smb_request_t *, smb_node_t *,
-    uint64_t, uint64_t);
+uint32_t smb_unlock_range(smb_request_t *, uint64_t, uint64_t, uint32_t);
 uint32_t smb_lock_range(smb_request_t *, uint64_t, uint64_t, uint32_t,
-    uint32_t locktype);
+    uint32_t, uint32_t);
+uint32_t smb_lock_range_cancel(smb_request_t *, uint64_t, uint64_t, uint32_t);
 void smb_lock_range_error(smb_request_t *, uint32_t);
+
+int smb_lock_range_access(smb_request_t *, smb_node_t *,
+    uint64_t, uint64_t, boolean_t);
+
 DWORD smb_nbl_conflict(smb_node_t *, uint64_t, uint64_t, nbl_op_t);
 
 void smb_mangle(const char *, ino64_t, char *, size_t);
@@ -351,6 +329,7 @@
 
 uint32_t smb_common_create(smb_request_t *);
 uint32_t smb_common_open(smb_request_t *);
+
 int smb_common_write(smb_request_t *, smb_rw_param_t *);
 
 void smb_pathname_init(smb_request_t *, smb_pathname_t *, char *);
@@ -359,6 +338,8 @@
 boolean_t smb_validate_object_name(smb_request_t *, smb_pathname_t *);
 boolean_t smb_validate_stream_name(smb_request_t *, smb_pathname_t *);
 boolean_t smb_is_stream_name(char *);
+boolean_t smb_strname_restricted(char *);
+
 void smb_stream_parse_name(char *, char *, char *);
 
 
@@ -366,9 +347,6 @@
 
 void	sshow_distribution_info(char *);
 
-uint32_t smb2sr_go_async(smb_request_t *sr,
-	smb_sdrc_t (*async_func)(smb_request_t *));
-
 void	smb_dispatch_stats_init(smb_server_t *);
 void	smb_dispatch_stats_fini(smb_server_t *);
 void	smb_dispatch_stats_update(smb_server_t *,
@@ -375,6 +353,7 @@
 		smb_kstat_req_t *, int, int);
 
 int	smb1sr_newrq(smb_request_t *);
+int	smb1sr_newrq_cancel(smb_request_t *);
 void	smb1sr_work(smb_request_t *);
 
 int	smbsr_encode_empty_result(smb_request_t *);
@@ -410,13 +389,11 @@
 int	smb_mbc_poke(mbuf_chain_t *, int, const char *, ...);
 int	smb_mbc_put_mem(mbuf_chain_t *, void *, int);
 int	smb_mbc_copy(mbuf_chain_t *, const mbuf_chain_t *, int, int);
+int	smb_mbc_put_align(mbuf_chain_t *, int);
 
 void	smbsr_encode_header(smb_request_t *sr, int wct,
 		    int bcc, const char *fmt, ...);
 
-int smb_lock_range_access(smb_request_t *, smb_node_t *,
-    uint64_t, uint64_t, boolean_t);
-
 void smb_encode_sd(mbuf_chain_t *, smb_sd_t *, uint32_t);
 void smb_encode_sid(mbuf_chain_t *, smb_sid_t *);
 smb_sid_t *smb_decode_sid(mbuf_chain_t *, uint32_t);
@@ -439,7 +416,7 @@
  * SMB RPC interface
  */
 void smb_opipe_dealloc(smb_opipe_t *);
-int smb_opipe_open(smb_request_t *, uint32_t);
+int smb_opipe_open(smb_request_t *, smb_ofile_t *);
 void smb_opipe_close(smb_ofile_t *);
 int smb_opipe_read(smb_request_t *, struct uio *);
 int smb_opipe_write(smb_request_t *, struct uio *);
@@ -446,6 +423,7 @@
 int smb_opipe_getattr(smb_ofile_t *, smb_attr_t *);
 int smb_opipe_getname(smb_ofile_t *, char *, size_t);
 uint32_t smb_opipe_fsctl(smb_request_t *, smb_fsctl_t *);
+uint32_t smb_opipe_transceive(smb_request_t *, smb_fsctl_t *);
 
 void smb_kdoor_init(smb_server_t *);
 void smb_kdoor_fini(smb_server_t *);
@@ -462,7 +440,7 @@
 int smb_server_g_init(void);
 void smb_server_g_fini(void);
 int smb_server_create(void);
-int smb_server_delete(void);
+int smb_server_delete(smb_server_t *);
 int smb_server_configure(smb_ioc_cfg_t *);
 int smb_server_start(smb_ioc_start_t *);
 int smb_server_stop(void);
@@ -475,9 +453,11 @@
 int smb_server_enum(smb_ioc_svcenum_t *);
 int smb_server_session_close(smb_ioc_session_t *);
 int smb_server_file_close(smb_ioc_fileid_t *);
-int smb_server_sharevp(smb_server_t *, const char *, vnode_t **);
+int smb_server_share_lookup(smb_server_t *, const char *, smb_node_t **);
 int smb_server_unshare(const char *);
 
+smb_user_t *smb_server_lookup_ssnid(smb_server_t *, uint64_t);
+
 void smb_server_get_cfg(smb_server_t *, smb_kmod_cfg_t *);
 
 int smb_server_spooldoc(smb_ioc_spooldoc_t *);
@@ -500,6 +480,8 @@
 void smb_server_add_txb(smb_server_t *, int64_t);
 void smb_server_inc_req(smb_server_t *);
 
+void smb_server_post_session(smb_session_t *);
+
 smb_event_t *smb_event_create(smb_server_t *, int);
 void smb_event_destroy(smb_event_t *);
 uint32_t smb_event_txid(smb_event_t *);
@@ -548,10 +530,10 @@
 DWORD smb_node_delete_check(smb_node_t *);
 boolean_t smb_node_share_check(smb_node_t *);
 
-void smb_node_fcn_subscribe(smb_node_t *, smb_request_t *);
-void smb_node_fcn_unsubscribe(smb_node_t *, smb_request_t *);
+void smb_node_fcn_subscribe(smb_node_t *);
+void smb_node_fcn_unsubscribe(smb_node_t *);
 void smb_node_notify_change(smb_node_t *, uint_t, const char *);
-void smb_node_notify_parents(smb_node_t *);
+
 int smb_node_getattr(smb_request_t *, smb_node_t *, cred_t *,
     smb_ofile_t *, smb_attr_t *);
 int smb_node_setattr(smb_request_t *, smb_node_t *, cred_t *,
@@ -558,8 +540,10 @@
     smb_ofile_t *, smb_attr_t *);
 uint32_t smb_node_set_delete_on_close(smb_node_t *, cred_t *, uint32_t);
 void smb_node_reset_delete_on_close(smb_node_t *);
+void smb_node_delete_on_close(smb_node_t *);
 boolean_t smb_node_file_is_readonly(smb_node_t *);
 int smb_node_getpath(smb_node_t *, vnode_t *, char *, uint32_t);
+void smb_node_getpath_nofail(smb_node_t *, vnode_t *, char *, uint32_t);
 int smb_node_getmntpath(smb_node_t *, char *, uint32_t);
 int smb_node_getshrpath(smb_node_t *, smb_tree_t *, char *, uint32_t);
 
@@ -571,22 +555,18 @@
     const char *, smb_node_t *, smb_node_t *, smb_node_t **, char *);
 
 int smb_pathname(smb_request_t *, char *, int, smb_node_t *,
-    smb_node_t *, smb_node_t **, smb_node_t **, cred_t *);
+    smb_node_t *, smb_node_t **, smb_node_t **, cred_t *, pathname_t *);
 
 /*
- * smb_vfs functions
+ * smb_notify.c
  */
+uint32_t smb_notify_act1(smb_request_t *, uint32_t, uint32_t);
+uint32_t smb_notify_act2(smb_request_t *);
+uint32_t smb_notify_act3(smb_request_t *);
+void smb_notify_ofile(smb_ofile_t *, uint_t, const char *);
+void smb_nt_transact_notify_finish(void *);
+void smb2_change_notify_finish(void *);
 
-int smb_vfs_hold(smb_export_t *, vfs_t *);
-void smb_vfs_rele(smb_export_t *, vfs_t *);
-void smb_vfs_rele_all(smb_export_t *);
-
-/* NOTIFY CHANGE */
-
-uint32_t smb_notify_common(smb_request_t *, mbuf_chain_t *, uint32_t);
-void smb_notify_event(smb_node_t *, uint_t, const char *);
-void smb_notify_file_closed(smb_ofile_t *);
-
 int smb_fem_fcn_install(smb_node_t *);
 void smb_fem_fcn_uninstall(smb_node_t *);
 int smb_fem_oplock_install(smb_node_t *);
@@ -602,12 +582,14 @@
 unsigned short smb_worker_getnum();
 
 /* SMB signing routines smb_signing.c */
-int smb_sign_begin(smb_request_t *, smb_token_t *);
+void smb_sign_begin(smb_request_t *, smb_token_t *);
 int smb_sign_check_request(smb_request_t *);
 int smb_sign_check_secondary(smb_request_t *, unsigned int);
 void smb_sign_reply(smb_request_t *, mbuf_chain_t *);
 /* SMB2, but here because it's called from common code. */
-int smb2_sign_begin(smb_request_t *, smb_token_t *);
+void smb2_sign_begin(smb_request_t *, smb_token_t *);
+void smb3_encrypt_begin(smb_request_t *, smb_token_t *);
+void smb3_encrypt_fini(smb_session_t *);
 
 boolean_t smb_sattr_check(uint16_t, uint16_t);
 
@@ -619,15 +601,19 @@
  */
 int smb_authenticate_ext(smb_request_t *);
 int smb_authenticate_old(smb_request_t *);
-void smb_authsock_close(smb_user_t *);
+void smb_authsock_close(smb_user_t *, ksocket_t);
 
 /*
  * session functions (file smb_session.c)
  */
 smb_session_t *smb_session_create(ksocket_t, uint16_t, smb_server_t *, int);
+smb_session_t *smb_server_find_session_byptr(smb_server_t *, void *);
+
+void smb_session_hold(smb_session_t *);
+void smb_session_release(smb_session_t *);
 void smb_session_receiver(smb_session_t *);
 void smb_session_disconnect(smb_session_t *);
-void smb_session_timers(smb_llist_t *);
+void smb_session_timers(smb_server_t *);
 void smb_session_delete(smb_session_t *session);
 void smb_session_cancel_requests(smb_session_t *, smb_tree_t *,
     smb_request_t *);
@@ -634,11 +620,10 @@
 void smb_session_config(smb_session_t *session);
 void smb_session_disconnect_from_share(smb_llist_t *, char *);
 smb_user_t *smb_session_dup_user(smb_session_t *, char *, char *);
+smb_user_t *smb_session_lookup_ssnid(smb_session_t *, uint64_t);
 smb_user_t *smb_session_lookup_uid(smb_session_t *, uint16_t);
-smb_user_t *smb_session_lookup_uid_st(smb_session_t *session,
-    uint16_t uid, smb_user_state_t st);
-void smb_session_post_user(smb_session_t *, smb_user_t *);
-void smb_session_post_tree(smb_session_t *, smb_tree_t *);
+smb_user_t *smb_session_lookup_uid_st(smb_session_t *,
+    uint64_t, uint16_t, smb_user_state_t);
 smb_tree_t *smb_session_lookup_tree(smb_session_t *, uint16_t);
 smb_tree_t *smb_session_lookup_share(smb_session_t *, const char *,
     smb_tree_t *);
@@ -646,12 +631,11 @@
     smb_tree_t *);
 void smb_session_close_pid(smb_session_t *, uint32_t);
 void smb_session_disconnect_owned_trees(smb_session_t *, smb_user_t *);
-void smb_session_disconnect_trees(smb_session_t *);
 void smb_session_disconnect_share(smb_session_t *, const char *);
+void smb_session_logoff(smb_session_t *);
 void smb_session_getclient(smb_session_t *, char *, size_t);
 boolean_t smb_session_isclient(smb_session_t *, const char *);
 void smb_session_correct_keep_alive_values(smb_llist_t *, uint32_t);
-void smb_session_oplock_break(smb_request_t *, uint8_t);
 int smb_session_send(smb_session_t *, uint8_t type, mbuf_chain_t *);
 int smb_session_xprt_gethdr(smb_session_t *, smb_xprt_t *);
 boolean_t smb_session_oplocks_enable(smb_session_t *);
@@ -667,19 +651,20 @@
  */
 smb_ofile_t *smb_ofile_lookup_by_fid(smb_request_t *, uint16_t);
 smb_ofile_t *smb_ofile_lookup_by_uniqid(smb_tree_t *, uint32_t);
+smb_ofile_t *smb_ofile_lookup_by_persistid(smb_request_t *, uint64_t);
 boolean_t smb_ofile_disallow_fclose(smb_ofile_t *);
-smb_ofile_t *smb_ofile_open(smb_request_t *, smb_node_t *,
-    smb_arg_open_t *, uint16_t, uint32_t, smb_error_t *);
+smb_ofile_t *smb_ofile_alloc(smb_request_t *, smb_arg_open_t *, smb_node_t *,
+    uint16_t, uint16_t);
+void smb_ofile_open(smb_request_t *, smb_arg_open_t *, smb_ofile_t *);
 void smb_ofile_close(smb_ofile_t *, int32_t);
-void smb_ofile_delete(void *);
+void smb_ofile_free(smb_ofile_t *);
 uint32_t smb_ofile_access(smb_ofile_t *, cred_t *, uint32_t);
 int smb_ofile_seek(smb_ofile_t *, ushort_t, int32_t, uint32_t *);
 void smb_ofile_flush(smb_request_t *, smb_ofile_t *);
 boolean_t smb_ofile_hold(smb_ofile_t *);
+boolean_t smb_ofile_hold_olbrk(smb_ofile_t *);
 void smb_ofile_release(smb_ofile_t *);
-void smb_ofile_request_complete(smb_ofile_t *);
-void smb_ofile_close_all(smb_tree_t *);
-void smb_ofile_close_all_by_pid(smb_tree_t *, uint16_t);
+void smb_ofile_close_all(smb_tree_t *, uint32_t);
 void smb_ofile_set_flags(smb_ofile_t *, uint32_t);
 boolean_t smb_ofile_is_open(smb_ofile_t *);
 int smb_ofile_enum(smb_ofile_t *, smb_svcenum_t *);
@@ -688,10 +673,14 @@
 uint32_t smb_ofile_delete_check(smb_ofile_t *);
 boolean_t smb_ofile_share_check(smb_ofile_t *);
 cred_t *smb_ofile_getcred(smb_ofile_t *);
-void smb_ofile_set_delete_on_close(smb_ofile_t *);
+void smb_ofile_set_delete_on_close(smb_request_t *, smb_ofile_t *);
 void smb_delayed_write_timer(smb_llist_t *);
 void smb_ofile_set_quota_resume(smb_ofile_t *, char *);
 void smb_ofile_get_quota_resume(smb_ofile_t *, char *, int);
+void smb_ofile_del_persistid(smb_ofile_t *);
+void smb_ofile_set_persistid_dh(smb_ofile_t *);
+void smb_ofile_set_persistid_ph(smb_ofile_t *);
+int smb_ofile_insert_persistid(smb_ofile_t *, uint64_t);
 
 #define	SMB_OFILE_GET_SESSION(of)	((of)->f_session)
 #define	SMB_OFILE_GET_TREE(of)		((of)->f_tree)
@@ -712,7 +701,6 @@
 void smb_odir_close(smb_odir_t *);
 boolean_t smb_odir_hold(smb_odir_t *);
 void smb_odir_release(smb_odir_t *);
-void smb_odir_delete(void *);
 
 int smb_odir_read(smb_request_t *, smb_odir_t *,
     smb_odirent_t *, boolean_t *);
@@ -732,9 +720,9 @@
 smb_user_t *smb_user_new(smb_session_t *);
 int smb_user_logon(smb_user_t *, cred_t *,
     char *, char *, uint32_t, uint32_t, uint32_t);
-smb_user_t *smb_user_dup(smb_user_t *);
 void smb_user_logoff(smb_user_t *);
-void smb_user_delete(void *);
+void smb_user_auth_tmo(void *);
+
 boolean_t smb_user_is_admin(smb_user_t *);
 boolean_t smb_user_namecmp(smb_user_t *, const char *);
 int smb_user_enum(smb_user_t *, smb_svcenum_t *);
@@ -747,17 +735,17 @@
 void smb_user_netinfo_fini(smb_netuserinfo_t *);
 int smb_user_netinfo_encode(smb_user_t *, uint8_t *, size_t, uint32_t *);
 smb_token_t *smb_get_token(smb_session_t *, smb_logon_t *);
-cred_t *smb_cred_create(smb_token_t *);
+cred_t *smb_cred_create(smb_token_t *, smb_session_t *);
+cred_t *smb_kcred_create(void);
 void smb_user_setcred(smb_user_t *, cred_t *, uint32_t);
+boolean_t smb_is_same_user(cred_t *, cred_t *);
 
 /*
  * SMB tree functions (file smb_tree.c)
  */
 uint32_t smb_tree_connect(smb_request_t *);
+uint32_t smb_tree_connect_disk(smb_request_t *, smb_arg_tcon_t *);
 void smb_tree_disconnect(smb_tree_t *, boolean_t);
-void smb_tree_dealloc(void *);
-void smb_tree_post_ofile(smb_tree_t *, smb_ofile_t *);
-void smb_tree_post_odir(smb_tree_t *, smb_odir_t *);
 void smb_tree_close_pid(smb_tree_t *, uint32_t);
 boolean_t smb_tree_has_feature(smb_tree_t *, uint_t);
 int smb_tree_enum(smb_tree_t *, smb_svcenum_t *);
@@ -767,7 +755,8 @@
 void smb_tree_release(smb_tree_t *);
 smb_odir_t *smb_tree_lookup_odir(smb_request_t *, uint16_t);
 boolean_t smb_tree_is_connected(smb_tree_t *);
-#define	SMB_TREE_GET_TID(tree)		((tree)->t_tid)
+smb_tree_t *smb_tree_alloc(smb_request_t *, const smb_kshare_t *,
+    smb_node_t *, uint32_t, uint32_t);
 
 smb_xa_t *smb_xa_create(smb_session_t *session, smb_request_t *sr,
     uint32_t total_parameter_count, uint32_t total_data_count,
@@ -785,9 +774,6 @@
 struct mbuf *smb_mbuf_allocate(struct uio *uio);
 void smb_mbuf_trim(struct mbuf *mhead, int nbytes);
 
-void smb_check_status(void);
-int smb_handle_write_raw(smb_session_t *session, smb_request_t *sr);
-
 int32_t smb_time_gmt_to_local(smb_request_t *, int32_t);
 int32_t smb_time_local_to_gmt(smb_request_t *, int32_t);
 int32_t	smb_time_dos_to_unix(int16_t, int16_t);
@@ -814,6 +800,7 @@
 void	smb_llist_fini(void);
 void	smb_llist_constructor(smb_llist_t *, size_t, size_t);
 void	smb_llist_destructor(smb_llist_t *);
+void	smb_llist_enter(smb_llist_t *ll, krw_t);
 void	smb_llist_exit(smb_llist_t *);
 void	smb_llist_post(smb_llist_t *, void *, smb_dtorproc_t);
 void	smb_llist_flush(smb_llist_t *);
@@ -822,7 +809,6 @@
 void	smb_llist_remove(smb_llist_t *ll, void *obj);
 int	smb_llist_upgrade(smb_llist_t *ll);
 uint32_t smb_llist_get_count(smb_llist_t *ll);
-#define	smb_llist_enter(ll, mode)	rw_enter(&(ll)->ll_lock, mode)
 #define	smb_llist_head(ll)		list_head(&(ll)->ll_list)
 #define	smb_llist_next(ll, obj)		list_next(&(ll)->ll_list, obj)
 int	smb_account_connected(smb_user_t *user);
@@ -845,13 +831,10 @@
 
 void    smb_rwx_init(smb_rwx_t *rwx);
 void    smb_rwx_destroy(smb_rwx_t *rwx);
-#define	smb_rwx_rwenter(rwx, mode)	rw_enter(&(rwx)->rwx_lock, mode)
+void	smb_rwx_rwenter(smb_rwx_t *rwx, krw_t);
 void    smb_rwx_rwexit(smb_rwx_t *rwx);
-int	smb_rwx_rwwait(smb_rwx_t *rwx, clock_t timeout);
-#define	smb_rwx_xenter(rwx)		mutex_enter(&(rwx)->rwx_mutex)
-#define	smb_rwx_xexit(rwx)		mutex_exit(&(rwx)->rwx_mutex)
-krw_t   smb_rwx_rwupgrade(smb_rwx_t *rwx);
-void    smb_rwx_rwdowngrade(smb_rwx_t *rwx, krw_t mode);
+int	smb_rwx_cvwait(smb_rwx_t *rwx, clock_t timeout);
+void    smb_rwx_cvbcast(smb_rwx_t *rwx);
 
 void	smb_thread_init(smb_thread_t *, char *, smb_thread_ep_t,
 		void *, pri_t);
@@ -883,9 +866,9 @@
 boolean_t smb_ace_is_audit(int);
 
 uint32_t smb_vss_enum_snapshots(smb_request_t *, smb_fsctl_t *);
-int smb_vss_lookup_nodes(smb_request_t *, smb_node_t *, smb_node_t *,
-    char *, smb_node_t **, smb_node_t **);
+int smb_vss_lookup_nodes(smb_request_t *, smb_node_t *, smb_node_t **, char *);
 vnode_t *smb_lookuppathvptovp(smb_request_t *, char *, vnode_t *, vnode_t *);
+int smb_vss_extract_gmttoken(char *, char *);
 
 void smb_panic(char *, const char *, int);
 #pragma	does_not_return(smb_panic)
@@ -959,6 +942,21 @@
 void smb_threshold_exit(smb_cmd_threshold_t *);
 void smb_threshold_wake_all(smb_cmd_threshold_t *);
 
+/* SMB hash function prototypes */
+smb_hash_t *smb_hash_create(size_t, size_t, uint32_t);
+void smb_hash_destroy(smb_hash_t *);
+uint_t smb_hash_uint64(smb_hash_t *, uint64_t);
+
+/* SMB auditing helper functions */
+boolean_t smb_audit_init(smb_request_t *);
+void smb_audit_fini(smb_request_t *, uint32_t, smb_node_t *, boolean_t);
+boolean_t smb_audit_rename_init(smb_request_t *);
+void smb_audit_rename_fini(smb_request_t *, char *, smb_node_t *, char *,
+    boolean_t, boolean_t);
+void smb_audit_save(void);
+void smb_audit_load(void);
+vnode_t *smb_audit_rootvp(smb_request_t *);
+
 #ifdef	__cplusplus
 }
 #endif
