1da6c28aaSamw /* 2da6c28aaSamw * CDDL HEADER START 3da6c28aaSamw * 4da6c28aaSamw * The contents of this file are subject to the terms of the 5da6c28aaSamw * Common Development and Distribution License (the "License"). 6da6c28aaSamw * You may not use this file except in compliance with the License. 7da6c28aaSamw * 8da6c28aaSamw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9da6c28aaSamw * or http://www.opensolaris.org/os/licensing. 10da6c28aaSamw * See the License for the specific language governing permissions 11da6c28aaSamw * and limitations under the License. 12da6c28aaSamw * 13da6c28aaSamw * When distributing Covered Code, include this CDDL HEADER in each 14da6c28aaSamw * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15da6c28aaSamw * If applicable, add the following below this CDDL HEADER, with the 16da6c28aaSamw * fields enclosed by brackets "[]" replaced with your own identifying 17da6c28aaSamw * information: Portions Copyright [yyyy] [name of copyright owner] 18da6c28aaSamw * 19da6c28aaSamw * CDDL HEADER END 20da6c28aaSamw */ 21148c5f43SAlan Wright 22da6c28aaSamw /* 23c5866007SKeyur Desai * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 24*a90cf9f2SGordon Ross * Copyright 2015 Nexenta Systems, Inc. All rights reserved. 25da6c28aaSamw */ 26da6c28aaSamw 27da6c28aaSamw /* 28da6c28aaSamw * Function prototypes for the SMB module. 29da6c28aaSamw */ 30da6c28aaSamw 31da6c28aaSamw #ifndef _SMB_KPROTO_H_ 32da6c28aaSamw #define _SMB_KPROTO_H_ 33da6c28aaSamw 34da6c28aaSamw #ifdef __cplusplus 35da6c28aaSamw extern "C" { 36da6c28aaSamw #endif 37da6c28aaSamw 38bbf6f00cSJordan Brown #include <sys/types.h> 39bbf6f00cSJordan Brown #include <sys/param.h> 40da6c28aaSamw #include <sys/systm.h> 41b819cea2SGordon Ross #include <sys/debug.h> 42b819cea2SGordon Ross #include <sys/kmem.h> 43da6c28aaSamw #include <sys/socket.h> 440f1702c5SYu Xiangning #include <sys/ksocket.h> 45da6c28aaSamw #include <sys/cred.h> 46bc7c423fSGordon Ross #include <sys/nbmlock.h> 47bbf6f00cSJordan Brown #include <sys/sunddi.h> 48b819cea2SGordon Ross #include <sys/atomic.h> 49bbf6f00cSJordan Brown #include <smbsrv/smb.h> 50bbf6f00cSJordan Brown #include <smbsrv/string.h> 51da6c28aaSamw #include <smbsrv/smb_vops.h> 52da6c28aaSamw #include <smbsrv/smb_xdr.h> 53da6c28aaSamw #include <smbsrv/smb_token.h> 54faa1795aSjb150015 #include <smbsrv/smb_ktypes.h> 55faa1795aSjb150015 #include <smbsrv/smb_ioctl.h> 56faa1795aSjb150015 57b819cea2SGordon Ross /* 58b819cea2SGordon Ross * DTrace SDT probes have different signatures in userland than they do in 59*a90cf9f2SGordon Ross * kernel. If we're compiling for user mode (libfksmbsrv) define them as 60*a90cf9f2SGordon Ross * either no-op (for the SMB dtrace provider) or libfksmbsrv functions for 61*a90cf9f2SGordon Ross * the other SDT probe sites. 62b819cea2SGordon Ross */ 63b819cea2SGordon Ross #ifndef _KERNEL 64*a90cf9f2SGordon Ross 65*a90cf9f2SGordon Ross extern void smb_dtrace1(const char *f, const char *n, 66*a90cf9f2SGordon Ross const char *t1, long v1); 67*a90cf9f2SGordon Ross extern void smb_dtrace2(const char *f, const char *n, 68*a90cf9f2SGordon Ross const char *t1, long v1, 69*a90cf9f2SGordon Ross const char *t2, long v2); 70*a90cf9f2SGordon Ross extern void smb_dtrace3(const char *f, const char *n, 71*a90cf9f2SGordon Ross const char *t1, long v1, 72*a90cf9f2SGordon Ross const char *t2, long v2, 73*a90cf9f2SGordon Ross const char *t3, long v3); 74*a90cf9f2SGordon Ross 75*a90cf9f2SGordon Ross /* 76*a90cf9f2SGordon Ross * These are for the SMB dtrace proivder, which for a user-mode build 77*a90cf9f2SGordon Ross * are largely redundant with the fbt probes so make these no-ops. 78*a90cf9f2SGordon Ross */ 79b819cea2SGordon Ross #undef DTRACE_SMB_1 80*a90cf9f2SGordon Ross #define DTRACE_SMB_1(n, a, b) ((void)b) 81b819cea2SGordon Ross #undef DTRACE_SMB_2 82*a90cf9f2SGordon Ross #define DTRACE_SMB_2(n, a, b, c, d) ((void)b, (void)d) 83*a90cf9f2SGordon Ross 84*a90cf9f2SGordon Ross /* 85*a90cf9f2SGordon Ross * These are for the other (specialized) dtrace SDT probes sprinkled 86*a90cf9f2SGordon Ross * through the smbsrv code. In libfksmbsrv map these to functions. 87*a90cf9f2SGordon Ross */ 88*a90cf9f2SGordon Ross 89b819cea2SGordon Ross #undef DTRACE_PROBE1 90*a90cf9f2SGordon Ross #define DTRACE_PROBE1(n, a, b) \ 91*a90cf9f2SGordon Ross smb_dtrace1(__func__, #n, #a, (long)b) 92*a90cf9f2SGordon Ross 93b819cea2SGordon Ross #undef DTRACE_PROBE2 94*a90cf9f2SGordon Ross #define DTRACE_PROBE2(n, a, b, c, d) \ 95*a90cf9f2SGordon Ross smb_dtrace2(__func__, #n, #a, (long)b, #c, (long)d) 96*a90cf9f2SGordon Ross 97b819cea2SGordon Ross #undef DTRACE_PROBE3 98*a90cf9f2SGordon Ross #define DTRACE_PROBE3(n, a, b, c, d, e, f) \ 99*a90cf9f2SGordon Ross smb_dtrace3(__func__, #n, #a, (long)b, #c, (long)d, #e, (long)f) 100*a90cf9f2SGordon Ross 101b819cea2SGordon Ross #endif /* _KERNEL */ 102b819cea2SGordon Ross 103faa1795aSjb150015 extern int smb_maxbufsize; 104faa1795aSjb150015 extern int smb_flush_required; 105faa1795aSjb150015 extern int smb_dirsymlink_enable; 106cb174861Sjoyce mcintosh extern int smb_oplock_levelII; 1072c2961f8Sjose borrego extern int smb_oplock_timeout; 108cb174861Sjoyce mcintosh extern int smb_oplock_min_timeout; 109cb174861Sjoyce mcintosh extern int smb_shortnames; 110c8ec8eeaSjose borrego extern int smb_sign_debug; 111cb174861Sjoyce mcintosh extern int smb_raw_mode; 1122c2961f8Sjose borrego extern uint_t smb_audit_flags; 113cb174861Sjoyce mcintosh extern int smb_ssetup_threshold; 114cb174861Sjoyce mcintosh extern int smb_tcon_threshold; 115cb174861Sjoyce mcintosh extern int smb_opipe_threshold; 116cb174861Sjoyce mcintosh extern int smb_ssetup_timeout; 117cb174861Sjoyce mcintosh extern int smb_tcon_timeout; 118cb174861Sjoyce mcintosh extern int smb_opipe_timeout; 1195fd03bc0SGordon Ross extern const uint32_t smb_vop_dosattr_settable; 120faa1795aSjb150015 12108344b29SGordon Ross /* Thread priorities - see smb_init.c */ 12208344b29SGordon Ross extern int smbsrv_base_pri; 12308344b29SGordon Ross extern int smbsrv_listen_pri; 12408344b29SGordon Ross extern int smbsrv_receive_pri; 12508344b29SGordon Ross extern int smbsrv_worker_pri; 12608344b29SGordon Ross extern int smbsrv_notify_pri; 12708344b29SGordon Ross extern int smbsrv_timer_pri; 12808344b29SGordon Ross 1298622ec45SGordon Ross extern kmem_cache_t *smb_cache_request; 1308622ec45SGordon Ross extern kmem_cache_t *smb_cache_session; 1318622ec45SGordon Ross extern kmem_cache_t *smb_cache_user; 1328622ec45SGordon Ross extern kmem_cache_t *smb_cache_tree; 1338622ec45SGordon Ross extern kmem_cache_t *smb_cache_ofile; 1348622ec45SGordon Ross extern kmem_cache_t *smb_cache_odir; 1358622ec45SGordon Ross extern kmem_cache_t *smb_cache_opipe; 1368622ec45SGordon Ross extern kmem_cache_t *smb_cache_event; 1378622ec45SGordon Ross 1388622ec45SGordon Ross extern kmem_cache_t *smb_kshare_cache_vfs; 1398622ec45SGordon Ross 140*a90cf9f2SGordon Ross time_t smb_get_boottime(void); 1418622ec45SGordon Ross int smb_server_lookup(smb_server_t **); 1428622ec45SGordon Ross void smb_server_release(smb_server_t *); 1438622ec45SGordon Ross 144da6c28aaSamw /* 145f96bd5c8SAlan Wright * SMB request handers called from the dispatcher. Each SMB request 146f96bd5c8SAlan Wright * is handled in three phases: pre, com (command) and post. 147f96bd5c8SAlan Wright * 148f96bd5c8SAlan Wright * The pre-handler is primarily to set things up for the DTrace start 149f96bd5c8SAlan Wright * probe. Typically, the SMB request is unmarshalled so that request 150f96bd5c8SAlan Wright * specific context can be traced. This is also a useful place to 151f96bd5c8SAlan Wright * allocate memory that will be used throughout the processing of the 152f96bd5c8SAlan Wright * command. 153f96bd5c8SAlan Wright * 154f96bd5c8SAlan Wright * The com-handler performs the requested operation: request validation, 155f96bd5c8SAlan Wright * bulk (write) incoming data decode, implementation of the appropriate 156f96bd5c8SAlan Wright * algorithm and transmission of a response (as appropriate). 157f96bd5c8SAlan Wright * 158f96bd5c8SAlan Wright * The post-handler is always called, regardless of success or failure 159f96bd5c8SAlan Wright * of the pre or com functions, to trigger the DTrace done probe and 160f96bd5c8SAlan Wright * deallocate memory allocated in the pre-handler. 1617b59d02dSjb150015 */ 162faa1795aSjb150015 #define SMB_SDT_OPS(NAME) \ 163faa1795aSjb150015 smb_pre_##NAME, \ 164faa1795aSjb150015 smb_com_##NAME, \ 165faa1795aSjb150015 smb_post_##NAME 1667b59d02dSjb150015 167faa1795aSjb150015 #define SMB_COM_DECL(NAME) \ 168faa1795aSjb150015 smb_sdrc_t smb_pre_##NAME(smb_request_t *); \ 169faa1795aSjb150015 smb_sdrc_t smb_com_##NAME(smb_request_t *); \ 170faa1795aSjb150015 void smb_post_##NAME(smb_request_t *) 171faa1795aSjb150015 172faa1795aSjb150015 SMB_COM_DECL(check_directory); 173faa1795aSjb150015 SMB_COM_DECL(close); 174faa1795aSjb150015 SMB_COM_DECL(close_and_tree_disconnect); 175faa1795aSjb150015 SMB_COM_DECL(close_print_file); 176faa1795aSjb150015 SMB_COM_DECL(create); 177faa1795aSjb150015 SMB_COM_DECL(create_directory); 178faa1795aSjb150015 SMB_COM_DECL(create_new); 179faa1795aSjb150015 SMB_COM_DECL(create_temporary); 180faa1795aSjb150015 SMB_COM_DECL(delete); 181faa1795aSjb150015 SMB_COM_DECL(delete_directory); 182faa1795aSjb150015 SMB_COM_DECL(echo); 183faa1795aSjb150015 SMB_COM_DECL(find); 184faa1795aSjb150015 SMB_COM_DECL(find_close); 185faa1795aSjb150015 SMB_COM_DECL(find_close2); 186faa1795aSjb150015 SMB_COM_DECL(find_unique); 187faa1795aSjb150015 SMB_COM_DECL(flush); 188faa1795aSjb150015 SMB_COM_DECL(get_print_queue); 189faa1795aSjb150015 SMB_COM_DECL(invalid); 190faa1795aSjb150015 SMB_COM_DECL(ioctl); 191faa1795aSjb150015 SMB_COM_DECL(lock_and_read); 192faa1795aSjb150015 SMB_COM_DECL(lock_byte_range); 193faa1795aSjb150015 SMB_COM_DECL(locking_andx); 194faa1795aSjb150015 SMB_COM_DECL(logoff_andx); 195faa1795aSjb150015 SMB_COM_DECL(negotiate); 196faa1795aSjb150015 SMB_COM_DECL(nt_cancel); 197faa1795aSjb150015 SMB_COM_DECL(nt_create_andx); 198b1352070SAlan Wright SMB_COM_DECL(nt_rename); 199faa1795aSjb150015 SMB_COM_DECL(nt_transact); 200faa1795aSjb150015 SMB_COM_DECL(nt_transact_secondary); 201faa1795aSjb150015 SMB_COM_DECL(open); 202faa1795aSjb150015 SMB_COM_DECL(open_andx); 203faa1795aSjb150015 SMB_COM_DECL(open_print_file); 204faa1795aSjb150015 SMB_COM_DECL(process_exit); 205faa1795aSjb150015 SMB_COM_DECL(query_information); 206faa1795aSjb150015 SMB_COM_DECL(query_information2); 207faa1795aSjb150015 SMB_COM_DECL(query_information_disk); 208faa1795aSjb150015 SMB_COM_DECL(read); 209faa1795aSjb150015 SMB_COM_DECL(read_andx); 210faa1795aSjb150015 SMB_COM_DECL(read_raw); 211faa1795aSjb150015 SMB_COM_DECL(rename); 212faa1795aSjb150015 SMB_COM_DECL(search); 213faa1795aSjb150015 SMB_COM_DECL(seek); 214faa1795aSjb150015 SMB_COM_DECL(session_setup_andx); 215faa1795aSjb150015 SMB_COM_DECL(set_information); 216faa1795aSjb150015 SMB_COM_DECL(set_information2); 217faa1795aSjb150015 SMB_COM_DECL(transaction); 218faa1795aSjb150015 SMB_COM_DECL(transaction2); 219faa1795aSjb150015 SMB_COM_DECL(transaction2_secondary); 220faa1795aSjb150015 SMB_COM_DECL(transaction_secondary); 221faa1795aSjb150015 SMB_COM_DECL(tree_connect); 222faa1795aSjb150015 SMB_COM_DECL(tree_connect_andx); 223faa1795aSjb150015 SMB_COM_DECL(tree_disconnect); 224faa1795aSjb150015 SMB_COM_DECL(unlock_byte_range); 225faa1795aSjb150015 SMB_COM_DECL(write); 226faa1795aSjb150015 SMB_COM_DECL(write_and_close); 227faa1795aSjb150015 SMB_COM_DECL(write_and_unlock); 228faa1795aSjb150015 SMB_COM_DECL(write_andx); 229faa1795aSjb150015 SMB_COM_DECL(write_print_file); 230faa1795aSjb150015 SMB_COM_DECL(write_raw); 231faa1795aSjb150015 232faa1795aSjb150015 #define SMB_NT_TRANSACT_DECL(NAME) \ 233faa1795aSjb150015 smb_sdrc_t smb_pre_##NAME(smb_request_t *, smb_xa_t *); \ 234faa1795aSjb150015 smb_sdrc_t smb_##NAME(smb_request_t *, smb_xa_t *); \ 235faa1795aSjb150015 void smb_post_##NAME(smb_request_t *, smb_xa_t *) 236faa1795aSjb150015 237faa1795aSjb150015 SMB_NT_TRANSACT_DECL(nt_transact_create); 238faa1795aSjb150015 239037cac00Sjoyce mcintosh smb_sdrc_t smb_nt_transact_notify_change(smb_request_t *, smb_xa_t *); 240037cac00Sjoyce mcintosh smb_sdrc_t smb_nt_transact_query_security_info(smb_request_t *, smb_xa_t *); 241037cac00Sjoyce mcintosh smb_sdrc_t smb_nt_transact_set_security_info(smb_request_t *, smb_xa_t *); 242037cac00Sjoyce mcintosh smb_sdrc_t smb_nt_transact_ioctl(smb_request_t *, smb_xa_t *); 243bbf6f00cSJordan Brown smb_sdrc_t smb_nt_transact_rename(smb_request_t *, smb_xa_t *); 2449fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States smb_sdrc_t smb_nt_transact_query_quota(smb_request_t *, smb_xa_t *); 2459fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States smb_sdrc_t smb_nt_transact_set_quota(smb_request_t *, smb_xa_t *); 2467b59d02dSjb150015 2472c2961f8Sjose borrego smb_sdrc_t smb_com_trans2_open2(smb_request_t *, smb_xa_t *); 248037cac00Sjoyce mcintosh smb_sdrc_t smb_com_trans2_create_directory(smb_request_t *, smb_xa_t *); 249037cac00Sjoyce mcintosh smb_sdrc_t smb_com_trans2_find_first2(smb_request_t *, smb_xa_t *); 250037cac00Sjoyce mcintosh smb_sdrc_t smb_com_trans2_find_next2(smb_request_t *, smb_xa_t *); 251037cac00Sjoyce mcintosh smb_sdrc_t smb_com_trans2_query_fs_information(smb_request_t *, smb_xa_t *); 2529fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States smb_sdrc_t smb_com_trans2_set_fs_information(smb_request_t *, smb_xa_t *); 253037cac00Sjoyce mcintosh smb_sdrc_t smb_com_trans2_query_path_information(smb_request_t *, smb_xa_t *); 254037cac00Sjoyce mcintosh smb_sdrc_t smb_com_trans2_query_file_information(smb_request_t *, smb_xa_t *); 255037cac00Sjoyce mcintosh smb_sdrc_t smb_com_trans2_set_path_information(smb_request_t *, smb_xa_t *); 256037cac00Sjoyce mcintosh smb_sdrc_t smb_com_trans2_set_file_information(smb_request_t *, smb_xa_t *); 2579fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States smb_sdrc_t smb_com_trans2_get_dfs_referral(smb_request_t *, smb_xa_t *); 2587b59d02dSjb150015 259*a90cf9f2SGordon Ross uint32_t smb_query_stream_info(smb_request_t *, mbuf_chain_t *, 260*a90cf9f2SGordon Ross smb_queryinfo_t *); 261*a90cf9f2SGordon Ross int smb_fssize(smb_request_t *, smb_fssize_t *); 262*a90cf9f2SGordon Ross 263*a90cf9f2SGordon Ross /* smb_quota.c */ 2649fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States uint32_t smb_quota_query_user_quota(smb_request_t *, uid_t, smb_quota_t *); 265*a90cf9f2SGordon Ross int smb_quota_query(smb_server_t *, smb_quota_query_t *, 266*a90cf9f2SGordon Ross smb_quota_response_t *); 267*a90cf9f2SGordon Ross int smb_quota_set(smb_server_t *, smb_quota_set_t *, uint32_t *); 268*a90cf9f2SGordon Ross uint32_t smb_quota_init_sids(mbuf_chain_t *, smb_quota_query_t *, 269*a90cf9f2SGordon Ross smb_ofile_t *); 270*a90cf9f2SGordon Ross uint32_t smb_quota_decode_sids(mbuf_chain_t *, list_t *); 271*a90cf9f2SGordon Ross void smb_quota_free_sids(smb_quota_query_t *); 272*a90cf9f2SGordon Ross void smb_quota_max_quota(mbuf_chain_t *, smb_quota_query_t *); 273*a90cf9f2SGordon Ross uint32_t smb_quota_decode_quotas(mbuf_chain_t *, list_t *); 274*a90cf9f2SGordon Ross uint32_t smb_quota_encode_quotas(mbuf_chain_t *, smb_quota_query_t *, 275*a90cf9f2SGordon Ross smb_quota_response_t *, smb_ofile_t *); 276*a90cf9f2SGordon Ross void smb_quota_free_quotas(list_t *); 277*a90cf9f2SGordon Ross 278*a90cf9f2SGordon Ross void smb_query_shortname(smb_node_t *, smb_queryinfo_t *); 279*a90cf9f2SGordon Ross 280*a90cf9f2SGordon Ross uint32_t smb_dfs_get_referrals(smb_request_t *, smb_fsctl_t *); 281*a90cf9f2SGordon Ross 282*a90cf9f2SGordon Ross int smb1_newrq_negotiate(smb_request_t *); 283*a90cf9f2SGordon Ross smb_sdrc_t smb1_negotiate_smb2(smb_request_t *sr); 284*a90cf9f2SGordon Ross 285*a90cf9f2SGordon Ross uint32_t smb_set_basic_info(smb_request_t *, smb_setinfo_t *); 286*a90cf9f2SGordon Ross uint32_t smb_set_eof_info(smb_request_t *, smb_setinfo_t *); 287*a90cf9f2SGordon Ross uint32_t smb_set_alloc_info(smb_request_t *, smb_setinfo_t *); 288*a90cf9f2SGordon Ross uint32_t smb_set_disposition_info(smb_request_t *, smb_setinfo_t *); 289*a90cf9f2SGordon Ross 290*a90cf9f2SGordon Ross uint32_t smb_setinfo_rename(smb_request_t *, smb_node_t *, char *, int); 291*a90cf9f2SGordon Ross uint32_t smb_common_rename(smb_request_t *, smb_fqi_t *, smb_fqi_t *); 292*a90cf9f2SGordon Ross 293*a90cf9f2SGordon Ross uint32_t smb_setinfo_link(smb_request_t *, smb_node_t *, char *, int); 294*a90cf9f2SGordon Ross uint32_t smb_make_link(smb_request_t *, smb_fqi_t *, smb_fqi_t *); 295*a90cf9f2SGordon Ross 2969fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 2977b59d02dSjb150015 /* 298da6c28aaSamw * Logging functions 299da6c28aaSamw */ 300da6c28aaSamw void smb_log_flush(void); 301da6c28aaSamw void smb_correct_keep_alive_values(uint32_t new_keep_alive); 302da6c28aaSamw void smb_close_all_connections(void); 303da6c28aaSamw 304da6c28aaSamw int smb_net_id(uint32_t); 305da6c28aaSamw 306cb174861Sjoyce mcintosh /* 307cb174861Sjoyce mcintosh * oplock functions - node operations 308cb174861Sjoyce mcintosh */ 309cb174861Sjoyce mcintosh void smb_oplock_acquire(smb_request_t *sr, smb_node_t *, smb_ofile_t *); 3102c2961f8Sjose borrego void smb_oplock_release(smb_node_t *, smb_ofile_t *); 311cb174861Sjoyce mcintosh int smb_oplock_break(smb_request_t *, smb_node_t *, uint32_t); 312cb174861Sjoyce mcintosh void smb_oplock_break_levelII(smb_node_t *); 313cb174861Sjoyce mcintosh void smb_oplock_ack(smb_node_t *, smb_ofile_t *, uint8_t); 314cb174861Sjoyce mcintosh void smb_oplock_broadcast(smb_node_t *); 315da6c28aaSamw 316*a90cf9f2SGordon Ross void smb1_oplock_break_notification(smb_request_t *, uint8_t); 317*a90cf9f2SGordon Ross void smb2_oplock_break_notification(smb_request_t *, uint8_t); 318*a90cf9f2SGordon Ross 3198c10a865Sas200622 /* 320cb174861Sjoyce mcintosh * range lock functions - node operations 3218c10a865Sas200622 */ 322148c5f43SAlan Wright uint32_t smb_lock_get_lock_count(smb_node_t *, smb_ofile_t *); 323037cac00Sjoyce mcintosh uint32_t smb_unlock_range(smb_request_t *, smb_node_t *, 324da6c28aaSamw uint64_t, uint64_t); 3256537f381Sas200622 uint32_t smb_lock_range(smb_request_t *, uint64_t, uint64_t, uint32_t, 3266537f381Sas200622 uint32_t locktype); 327dc20a302Sas200622 void smb_lock_range_error(smb_request_t *, uint32_t); 328bc7c423fSGordon Ross DWORD smb_nbl_conflict(smb_node_t *, uint64_t, uint64_t, nbl_op_t); 329da6c28aaSamw 330148c5f43SAlan Wright void smb_mangle(const char *, ino64_t, char *, size_t); 331148c5f43SAlan Wright int smb_unmangle(smb_node_t *, char *, char *, int, uint32_t); 332148c5f43SAlan Wright boolean_t smb_needs_mangled(const char *); 333148c5f43SAlan Wright boolean_t smb_maybe_mangled(char *); 334cb174861Sjoyce mcintosh boolean_t smb_is_reserved_dos_name(const char *); 3352c2961f8Sjose borrego boolean_t smb_is_invalid_filename(const char *); 336da6c28aaSamw 337037cac00Sjoyce mcintosh void smbsr_cleanup(smb_request_t *sr); 338da6c28aaSamw 339037cac00Sjoyce mcintosh int smbsr_connect_tree(smb_request_t *); 340da6c28aaSamw 341037cac00Sjoyce mcintosh int smb_common_create_directory(smb_request_t *); 3427b59d02dSjb150015 343fe1c642dSBill Krier void smb_convert_wildcards(char *); 344fe1c642dSBill Krier boolean_t smb_contains_wildcards(const char *); 345037cac00Sjoyce mcintosh int smb_ascii_or_unicode_strlen(smb_request_t *, char *); 346037cac00Sjoyce mcintosh int smb_ascii_or_unicode_strlen_null(smb_request_t *, char *); 347037cac00Sjoyce mcintosh int smb_ascii_or_unicode_null_len(smb_request_t *); 348da6c28aaSamw 349037cac00Sjoyce mcintosh int smb_search(smb_request_t *); 350da6c28aaSamw 351f96bd5c8SAlan Wright uint32_t smb_common_create(smb_request_t *); 3527b59d02dSjb150015 uint32_t smb_common_open(smb_request_t *); 353f96bd5c8SAlan Wright int smb_common_write(smb_request_t *, smb_rw_param_t *); 354eb1d736bSafshin salek ardakani - Sun Microsystems - Irvine United States 355fe1c642dSBill Krier void smb_pathname_init(smb_request_t *, smb_pathname_t *, char *); 356fe1c642dSBill Krier boolean_t smb_pathname_validate(smb_request_t *, smb_pathname_t *); 357fe1c642dSBill Krier boolean_t smb_validate_dirname(smb_request_t *, smb_pathname_t *); 358fe1c642dSBill Krier boolean_t smb_validate_object_name(smb_request_t *, smb_pathname_t *); 359fe1c642dSBill Krier boolean_t smb_validate_stream_name(smb_request_t *, smb_pathname_t *); 360eb1d736bSafshin salek ardakani - Sun Microsystems - Irvine United States boolean_t smb_is_stream_name(char *); 361eb1d736bSafshin salek ardakani - Sun Microsystems - Irvine United States void smb_stream_parse_name(char *, char *, char *); 362eb1d736bSafshin salek ardakani - Sun Microsystems - Irvine United States 363da6c28aaSamw 364da6c28aaSamw uint32_t smb_omode_to_amask(uint32_t desired_access); 365da6c28aaSamw 366da6c28aaSamw void sshow_distribution_info(char *); 367da6c28aaSamw 368*a90cf9f2SGordon Ross uint32_t smb2sr_go_async(smb_request_t *sr, 369*a90cf9f2SGordon Ross smb_sdrc_t (*async_func)(smb_request_t *)); 370*a90cf9f2SGordon Ross 3718622ec45SGordon Ross void smb_dispatch_stats_init(smb_server_t *); 3728622ec45SGordon Ross void smb_dispatch_stats_fini(smb_server_t *); 3738622ec45SGordon Ross void smb_dispatch_stats_update(smb_server_t *, 3748622ec45SGordon Ross smb_kstat_req_t *, int, int); 375148c5f43SAlan Wright 376*a90cf9f2SGordon Ross int smb1sr_newrq(smb_request_t *); 377*a90cf9f2SGordon Ross void smb1sr_work(smb_request_t *); 378*a90cf9f2SGordon Ross 379037cac00Sjoyce mcintosh int smbsr_encode_empty_result(smb_request_t *); 3802c2961f8Sjose borrego void smbsr_lookup_file(smb_request_t *); 381e3f2c991SKeyur Desai void smbsr_release_file(smb_request_t *); 382da6c28aaSamw 383*a90cf9f2SGordon Ross int smbsr_decode_vwv(smb_request_t *sr, const char *, ...); 384*a90cf9f2SGordon Ross int smbsr_decode_data(smb_request_t *sr, const char *, ...); 385148c5f43SAlan Wright boolean_t smbsr_decode_data_avail(smb_request_t *); 386*a90cf9f2SGordon Ross int smbsr_encode_result(smb_request_t *, int, int, const char *, ...); 387da6c28aaSamw smb_xa_t *smbsr_lookup_xa(smb_request_t *sr); 388037cac00Sjoyce mcintosh void smbsr_send_reply(smb_request_t *); 389da6c28aaSamw 390*a90cf9f2SGordon Ross uint32_t smb_errno2status(int); 391*a90cf9f2SGordon Ross uint16_t smb_status2doserr(uint32_t); 392dc20a302Sas200622 void smbsr_map_errno(int, smb_error_t *); 393dc20a302Sas200622 void smbsr_set_error(smb_request_t *, smb_error_t *); 394037cac00Sjoyce mcintosh void smbsr_errno(smb_request_t *, int); 395148c5f43SAlan Wright void smbsr_status(smb_request_t *, DWORD, uint16_t, uint16_t); 396148c5f43SAlan Wright #define smbsr_error(SR, ST, CL, CO) \ 397148c5f43SAlan Wright smbsr_status(SR, ST, CL, CO) 398148c5f43SAlan Wright #define smbsr_warn(SR, ST, CL, CO) \ 399148c5f43SAlan Wright smbsr_status(SR, ST, CL, CO) 400*a90cf9f2SGordon Ross void smbsr_status_smb2(smb_request_t *, DWORD); 401da6c28aaSamw 402da6c28aaSamw int clock_get_milli_uptime(void); 403da6c28aaSamw 404*a90cf9f2SGordon Ross int smb_mbc_vencodef(mbuf_chain_t *, const char *, va_list); 405*a90cf9f2SGordon Ross int smb_mbc_vdecodef(mbuf_chain_t *, const char *, va_list); 406*a90cf9f2SGordon Ross int smb_mbc_decodef(mbuf_chain_t *, const char *, ...); 407*a90cf9f2SGordon Ross int smb_mbc_encodef(mbuf_chain_t *, const char *, ...); 408*a90cf9f2SGordon Ross int smb_mbc_peek(mbuf_chain_t *, int, const char *, ...); 409*a90cf9f2SGordon Ross int smb_mbc_poke(mbuf_chain_t *, int, const char *, ...); 4107f3ef643SGordon Ross int smb_mbc_put_mem(mbuf_chain_t *, void *, int); 4117f3ef643SGordon Ross int smb_mbc_copy(mbuf_chain_t *, const mbuf_chain_t *, int, int); 412da6c28aaSamw 413037cac00Sjoyce mcintosh void smbsr_encode_header(smb_request_t *sr, int wct, 414*a90cf9f2SGordon Ross int bcc, const char *fmt, ...); 415da6c28aaSamw 416037cac00Sjoyce mcintosh int smb_lock_range_access(smb_request_t *, smb_node_t *, 417dc20a302Sas200622 uint64_t, uint64_t, boolean_t); 418da6c28aaSamw 419*a90cf9f2SGordon Ross void smb_encode_sd(mbuf_chain_t *, smb_sd_t *, uint32_t); 420*a90cf9f2SGordon Ross void smb_encode_sid(mbuf_chain_t *, smb_sid_t *); 421*a90cf9f2SGordon Ross smb_sid_t *smb_decode_sid(mbuf_chain_t *, uint32_t); 422*a90cf9f2SGordon Ross uint32_t smb_decode_sd(mbuf_chain_t *, smb_sd_t *); 42355bf511dSas200622 4249fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States uint32_t smb_pad_align(uint32_t, uint32_t); 4259fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 426da6c28aaSamw /* 427da6c28aaSamw * Socket functions 428da6c28aaSamw */ 4290f1702c5SYu Xiangning ksocket_t smb_socreate(int domain, int type, int protocol); 4300f1702c5SYu Xiangning void smb_soshutdown(ksocket_t so); 4310f1702c5SYu Xiangning void smb_sodestroy(ksocket_t so); 4320f1702c5SYu Xiangning int smb_sorecv(ksocket_t so, void *msg, size_t len); 4335cdbe942Sjb150015 void smb_net_txl_constructor(smb_txlst_t *); 4345cdbe942Sjb150015 void smb_net_txl_destructor(smb_txlst_t *); 435*a90cf9f2SGordon Ross int smb_net_send_uio(smb_session_t *, struct uio *); 436da6c28aaSamw 437da6c28aaSamw /* 438da6c28aaSamw * SMB RPC interface 439da6c28aaSamw */ 4409fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_opipe_dealloc(smb_opipe_t *); 44168b2bbf2SGordon Ross int smb_opipe_open(smb_request_t *, uint32_t); 4423db3f65cSamw void smb_opipe_close(smb_ofile_t *); 4433db3f65cSamw int smb_opipe_read(smb_request_t *, struct uio *); 4443db3f65cSamw int smb_opipe_write(smb_request_t *, struct uio *); 445*a90cf9f2SGordon Ross int smb_opipe_getattr(smb_ofile_t *, smb_attr_t *); 446*a90cf9f2SGordon Ross int smb_opipe_getname(smb_ofile_t *, char *, size_t); 447*a90cf9f2SGordon Ross uint32_t smb_opipe_fsctl(smb_request_t *, smb_fsctl_t *); 448da6c28aaSamw 4498622ec45SGordon Ross void smb_kdoor_init(smb_server_t *); 4508622ec45SGordon Ross void smb_kdoor_fini(smb_server_t *); 4518622ec45SGordon Ross int smb_kdoor_open(smb_server_t *, int); 4528622ec45SGordon Ross void smb_kdoor_close(smb_server_t *); 4538622ec45SGordon Ross int smb_kdoor_upcall(smb_server_t *, uint32_t, 4548622ec45SGordon Ross void *, xdrproc_t, void *, xdrproc_t); 455b819cea2SGordon Ross void fksmb_kdoor_open(smb_server_t *, void *); 4569fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 457da6c28aaSamw /* 458faa1795aSjb150015 * SMB server functions (file smb_server.c) 459faa1795aSjb150015 */ 460*a90cf9f2SGordon Ross int smb_server_get_count(void); 4618622ec45SGordon Ross int smb_server_g_init(void); 462*a90cf9f2SGordon Ross void smb_server_g_fini(void); 463faa1795aSjb150015 int smb_server_create(void); 464faa1795aSjb150015 int smb_server_delete(void); 46529bd2886SAlan Wright int smb_server_configure(smb_ioc_cfg_t *); 46629bd2886SAlan Wright int smb_server_start(smb_ioc_start_t *); 4679fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States int smb_server_stop(void); 4688622ec45SGordon Ross boolean_t smb_server_is_stopping(smb_server_t *); 4698622ec45SGordon Ross void smb_server_cancel_event(smb_server_t *, uint32_t); 4709fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States int smb_server_notify_event(smb_ioc_event_t *); 4718622ec45SGordon Ross uint32_t smb_server_get_session_count(smb_server_t *); 47229bd2886SAlan Wright int smb_server_set_gmtoff(smb_ioc_gmt_t *); 4731fcced4cSJordan Brown int smb_server_numopen(smb_ioc_opennum_t *); 4741fcced4cSJordan Brown int smb_server_enum(smb_ioc_svcenum_t *); 4751fcced4cSJordan Brown int smb_server_session_close(smb_ioc_session_t *); 4761fcced4cSJordan Brown int smb_server_file_close(smb_ioc_fileid_t *); 4778622ec45SGordon Ross int smb_server_sharevp(smb_server_t *, const char *, vnode_t **); 478148c5f43SAlan Wright int smb_server_unshare(const char *); 479faa1795aSjb150015 480faa1795aSjb150015 void smb_server_get_cfg(smb_server_t *, smb_kmod_cfg_t *); 481faa1795aSjb150015 482cb174861Sjoyce mcintosh int smb_server_spooldoc(smb_ioc_spooldoc_t *); 4838622ec45SGordon Ross int smb_spool_add_doc(smb_tree_t *, smb_kspooldoc_t *); 48486d7016bSGordon Ross void smb_spool_add_fid(smb_server_t *, uint16_t); 485cb174861Sjoyce mcintosh 486148c5f43SAlan Wright void smb_server_inc_nbt_sess(smb_server_t *); 487148c5f43SAlan Wright void smb_server_dec_nbt_sess(smb_server_t *); 488148c5f43SAlan Wright void smb_server_inc_tcp_sess(smb_server_t *); 489148c5f43SAlan Wright void smb_server_dec_tcp_sess(smb_server_t *); 490148c5f43SAlan Wright void smb_server_inc_users(smb_server_t *); 491148c5f43SAlan Wright void smb_server_dec_users(smb_server_t *); 492148c5f43SAlan Wright void smb_server_inc_trees(smb_server_t *); 493148c5f43SAlan Wright void smb_server_dec_trees(smb_server_t *); 494148c5f43SAlan Wright void smb_server_inc_files(smb_server_t *); 495148c5f43SAlan Wright void smb_server_dec_files(smb_server_t *); 496148c5f43SAlan Wright void smb_server_inc_pipes(smb_server_t *); 497148c5f43SAlan Wright void smb_server_dec_pipes(smb_server_t *); 498148c5f43SAlan Wright void smb_server_add_rxb(smb_server_t *, int64_t); 499148c5f43SAlan Wright void smb_server_add_txb(smb_server_t *, int64_t); 500148c5f43SAlan Wright void smb_server_inc_req(smb_server_t *); 501148c5f43SAlan Wright 5028622ec45SGordon Ross smb_event_t *smb_event_create(smb_server_t *, int); 5039fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_event_destroy(smb_event_t *); 5049fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States uint32_t smb_event_txid(smb_event_t *); 5059fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States int smb_event_wait(smb_event_t *); 506cb174861Sjoyce mcintosh void smb_event_notify(smb_server_t *, uint32_t); 50729bd2886SAlan Wright 508faa1795aSjb150015 /* 509da6c28aaSamw * SMB node functions (file smb_node.c) 510da6c28aaSamw */ 5118622ec45SGordon Ross void smb_node_init(void); 512faa1795aSjb150015 void smb_node_fini(void); 513148c5f43SAlan Wright smb_node_t *smb_node_lookup(smb_request_t *, smb_arg_open_t *, 514037cac00Sjoyce mcintosh cred_t *, vnode_t *, char *, smb_node_t *, smb_node_t *); 515037cac00Sjoyce mcintosh smb_node_t *smb_stream_node_lookup(smb_request_t *, cred_t *, 516037cac00Sjoyce mcintosh smb_node_t *, vnode_t *, vnode_t *, char *); 517037cac00Sjoyce mcintosh 518037cac00Sjoyce mcintosh void smb_node_ref(smb_node_t *); 519037cac00Sjoyce mcintosh void smb_node_release(smb_node_t *); 520037cac00Sjoyce mcintosh void smb_node_rename(smb_node_t *, smb_node_t *, smb_node_t *, char *); 5218622ec45SGordon Ross int smb_node_root_init(smb_server_t *, smb_node_t **); 522037cac00Sjoyce mcintosh void smb_node_add_lock(smb_node_t *, smb_lock_t *); 523037cac00Sjoyce mcintosh void smb_node_destroy_lock(smb_node_t *, smb_lock_t *); 524037cac00Sjoyce mcintosh void smb_node_destroy_lock_by_ofile(smb_node_t *, smb_ofile_t *); 5252c2961f8Sjose borrego void smb_node_start_crit(smb_node_t *, krw_t); 5262c2961f8Sjose borrego void smb_node_end_crit(smb_node_t *); 5272c2961f8Sjose borrego int smb_node_in_crit(smb_node_t *); 5282c2961f8Sjose borrego void smb_node_rdlock(smb_node_t *); 5292c2961f8Sjose borrego void smb_node_wrlock(smb_node_t *); 5302c2961f8Sjose borrego void smb_node_unlock(smb_node_t *); 5312c2961f8Sjose borrego void smb_node_add_ofile(smb_node_t *, smb_ofile_t *); 5322c2961f8Sjose borrego void smb_node_rem_ofile(smb_node_t *, smb_ofile_t *); 5332c2961f8Sjose borrego void smb_node_inc_open_ofiles(smb_node_t *); 5345fd03bc0SGordon Ross uint32_t smb_node_dec_open_ofiles(smb_node_t *); 535cb174861Sjoyce mcintosh void smb_node_inc_opening_count(smb_node_t *); 536cb174861Sjoyce mcintosh void smb_node_dec_opening_count(smb_node_t *); 5379fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States boolean_t smb_node_is_file(smb_node_t *); 538037cac00Sjoyce mcintosh boolean_t smb_node_is_dir(smb_node_t *); 5399fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States boolean_t smb_node_is_symlink(smb_node_t *); 5409fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States boolean_t smb_node_is_dfslink(smb_node_t *); 5419fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States boolean_t smb_node_is_reparse(smb_node_t *); 5429fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States boolean_t smb_node_is_vfsroot(smb_node_t *); 5439fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States boolean_t smb_node_is_system(smb_node_t *); 544dc20a302Sas200622 5459fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States uint32_t smb_node_open_check(smb_node_t *, uint32_t, uint32_t); 546dc20a302Sas200622 DWORD smb_node_rename_check(smb_node_t *); 547dc20a302Sas200622 DWORD smb_node_delete_check(smb_node_t *); 548cb174861Sjoyce mcintosh boolean_t smb_node_share_check(smb_node_t *); 549ccc71be5SGordon Ross 550ccc71be5SGordon Ross void smb_node_fcn_subscribe(smb_node_t *, smb_request_t *); 551ccc71be5SGordon Ross void smb_node_fcn_unsubscribe(smb_node_t *, smb_request_t *); 552ccc71be5SGordon Ross void smb_node_notify_change(smb_node_t *, uint_t, const char *); 5539fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_node_notify_parents(smb_node_t *); 5545fd03bc0SGordon Ross int smb_node_getattr(smb_request_t *, smb_node_t *, cred_t *, 5555fd03bc0SGordon Ross smb_ofile_t *, smb_attr_t *); 556037cac00Sjoyce mcintosh int smb_node_setattr(smb_request_t *, smb_node_t *, cred_t *, 557037cac00Sjoyce mcintosh smb_ofile_t *, smb_attr_t *); 5585496c117SAlek Pinchuk uint32_t smb_node_set_delete_on_close(smb_node_t *, cred_t *, uint32_t); 559da6c28aaSamw void smb_node_reset_delete_on_close(smb_node_t *); 560037cac00Sjoyce mcintosh boolean_t smb_node_file_is_readonly(smb_node_t *); 561c5866007SKeyur Desai int smb_node_getpath(smb_node_t *, vnode_t *, char *, uint32_t); 5629fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States int smb_node_getmntpath(smb_node_t *, char *, uint32_t); 5639fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States int smb_node_getshrpath(smb_node_t *, smb_tree_t *, char *, uint32_t); 564037cac00Sjoyce mcintosh 565da6c28aaSamw /* 566da6c28aaSamw * Pathname functions 567da6c28aaSamw */ 568da6c28aaSamw 569037cac00Sjoyce mcintosh int smb_pathname_reduce(smb_request_t *, cred_t *, 570da6c28aaSamw const char *, smb_node_t *, smb_node_t *, smb_node_t **, char *); 571da6c28aaSamw 572037cac00Sjoyce mcintosh int smb_pathname(smb_request_t *, char *, int, smb_node_t *, 573da6c28aaSamw smb_node_t *, smb_node_t **, smb_node_t **, cred_t *); 574da6c28aaSamw 575da6c28aaSamw /* 576da6c28aaSamw * smb_vfs functions 577da6c28aaSamw */ 578da6c28aaSamw 579148c5f43SAlan Wright int smb_vfs_hold(smb_export_t *, vfs_t *); 580148c5f43SAlan Wright void smb_vfs_rele(smb_export_t *, vfs_t *); 581148c5f43SAlan Wright void smb_vfs_rele_all(smb_export_t *); 582c8ec8eeaSjose borrego 583da6c28aaSamw /* NOTIFY CHANGE */ 584ccc71be5SGordon Ross 585*a90cf9f2SGordon Ross uint32_t smb_notify_common(smb_request_t *, mbuf_chain_t *, uint32_t); 586ccc71be5SGordon Ross void smb_notify_event(smb_node_t *, uint_t, const char *); 587*a90cf9f2SGordon Ross void smb_notify_file_closed(smb_ofile_t *); 588da6c28aaSamw 5898622ec45SGordon Ross int smb_fem_fcn_install(smb_node_t *); 590c8ec8eeaSjose borrego void smb_fem_fcn_uninstall(smb_node_t *); 5918622ec45SGordon Ross int smb_fem_oplock_install(smb_node_t *); 5928622ec45SGordon Ross void smb_fem_oplock_uninstall(smb_node_t *); 593da6c28aaSamw 594da6c28aaSamw /* FEM */ 595da6c28aaSamw 596faa1795aSjb150015 int smb_fem_init(void); 597faa1795aSjb150015 void smb_fem_fini(void); 598da6c28aaSamw 599037cac00Sjoyce mcintosh int smb_try_grow(smb_request_t *sr, int64_t new_size); 600da6c28aaSamw 601da6c28aaSamw unsigned short smb_worker_getnum(); 602da6c28aaSamw 603da6c28aaSamw /* SMB signing routines smb_signing.c */ 604b819cea2SGordon Ross int smb_sign_begin(smb_request_t *, smb_token_t *); 605037cac00Sjoyce mcintosh int smb_sign_check_request(smb_request_t *); 606037cac00Sjoyce mcintosh int smb_sign_check_secondary(smb_request_t *, unsigned int); 607037cac00Sjoyce mcintosh void smb_sign_reply(smb_request_t *, mbuf_chain_t *); 608*a90cf9f2SGordon Ross /* SMB2, but here because it's called from common code. */ 609*a90cf9f2SGordon Ross int smb2_sign_begin(smb_request_t *, smb_token_t *); 610da6c28aaSamw 6112c2961f8Sjose borrego boolean_t smb_sattr_check(uint16_t, uint16_t); 612da6c28aaSamw 6132c2961f8Sjose borrego void smb_request_cancel(smb_request_t *); 6142c2961f8Sjose borrego void smb_request_wait(smb_request_t *); 615da6c28aaSamw 616faa1795aSjb150015 /* 61712b65585SGordon Ross * authentication support (smb_authenticate.c) 61812b65585SGordon Ross */ 61912b65585SGordon Ross int smb_authenticate_ext(smb_request_t *); 62012b65585SGordon Ross int smb_authenticate_old(smb_request_t *); 62112b65585SGordon Ross void smb_authsock_close(smb_user_t *); 62212b65585SGordon Ross 62312b65585SGordon Ross /* 624faa1795aSjb150015 * session functions (file smb_session.c) 625faa1795aSjb150015 */ 6267f667e74Sjose borrego smb_session_t *smb_session_create(ksocket_t, uint16_t, smb_server_t *, int); 6274163af6aSjose borrego void smb_session_receiver(smb_session_t *); 6284163af6aSjose borrego void smb_session_disconnect(smb_session_t *); 6294163af6aSjose borrego void smb_session_timers(smb_llist_t *); 630da6c28aaSamw void smb_session_delete(smb_session_t *session); 631c8ec8eeaSjose borrego void smb_session_cancel_requests(smb_session_t *, smb_tree_t *, 632c8ec8eeaSjose borrego smb_request_t *); 633da6c28aaSamw void smb_session_config(smb_session_t *session); 6344163af6aSjose borrego void smb_session_disconnect_from_share(smb_llist_t *, char *); 635b89a8333Snatalie li - Sun Microsystems - Irvine United States smb_user_t *smb_session_dup_user(smb_session_t *, char *, char *); 6369fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States smb_user_t *smb_session_lookup_uid(smb_session_t *, uint16_t); 63712b65585SGordon Ross smb_user_t *smb_session_lookup_uid_st(smb_session_t *session, 63812b65585SGordon Ross uint16_t uid, smb_user_state_t st); 6399fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_session_post_user(smb_session_t *, smb_user_t *); 6403b13a1efSThomas Keiser void smb_session_post_tree(smb_session_t *, smb_tree_t *); 6413b13a1efSThomas Keiser smb_tree_t *smb_session_lookup_tree(smb_session_t *, uint16_t); 6423b13a1efSThomas Keiser smb_tree_t *smb_session_lookup_share(smb_session_t *, const char *, 6433b13a1efSThomas Keiser smb_tree_t *); 6443b13a1efSThomas Keiser smb_tree_t *smb_session_lookup_volume(smb_session_t *, const char *, 6453b13a1efSThomas Keiser smb_tree_t *); 646*a90cf9f2SGordon Ross void smb_session_close_pid(smb_session_t *, uint32_t); 6473b13a1efSThomas Keiser void smb_session_disconnect_owned_trees(smb_session_t *, smb_user_t *); 6483b13a1efSThomas Keiser void smb_session_disconnect_trees(smb_session_t *); 6499fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_session_disconnect_share(smb_session_t *, const char *); 6501fcced4cSJordan Brown void smb_session_getclient(smb_session_t *, char *, size_t); 6511fcced4cSJordan Brown boolean_t smb_session_isclient(smb_session_t *, const char *); 6524163af6aSjose borrego void smb_session_correct_keep_alive_values(smb_llist_t *, uint32_t); 653*a90cf9f2SGordon Ross void smb_session_oplock_break(smb_request_t *, uint8_t); 6542c2961f8Sjose borrego int smb_session_send(smb_session_t *, uint8_t type, mbuf_chain_t *); 6552c2961f8Sjose borrego int smb_session_xprt_gethdr(smb_session_t *, smb_xprt_t *); 6562c2961f8Sjose borrego boolean_t smb_session_oplocks_enable(smb_session_t *); 657cb174861Sjoyce mcintosh boolean_t smb_session_levelII_oplocks(smb_session_t *); 6582c2961f8Sjose borrego 6592c2961f8Sjose borrego #define SMB_SESSION_GET_ID(s) ((s)->s_kid) 6602c2961f8Sjose borrego 661faa1795aSjb150015 smb_request_t *smb_request_alloc(smb_session_t *, int); 662faa1795aSjb150015 void smb_request_free(smb_request_t *); 663da6c28aaSamw 664da6c28aaSamw /* 665da6c28aaSamw * ofile functions (file smb_ofile.c) 666da6c28aaSamw */ 6673b13a1efSThomas Keiser smb_ofile_t *smb_ofile_lookup_by_fid(smb_request_t *, uint16_t); 6681fcced4cSJordan Brown smb_ofile_t *smb_ofile_lookup_by_uniqid(smb_tree_t *, uint32_t); 6691fcced4cSJordan Brown boolean_t smb_ofile_disallow_fclose(smb_ofile_t *); 67068b2bbf2SGordon Ross smb_ofile_t *smb_ofile_open(smb_request_t *, smb_node_t *, 671148c5f43SAlan Wright smb_arg_open_t *, uint16_t, uint32_t, smb_error_t *); 6725fd03bc0SGordon Ross void smb_ofile_close(smb_ofile_t *, int32_t); 6739fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_ofile_delete(void *); 674c8ec8eeaSjose borrego uint32_t smb_ofile_access(smb_ofile_t *, cred_t *, uint32_t); 675c8ec8eeaSjose borrego int smb_ofile_seek(smb_ofile_t *, ushort_t, int32_t, uint32_t *); 6761fcced4cSJordan Brown boolean_t smb_ofile_hold(smb_ofile_t *); 677c8ec8eeaSjose borrego void smb_ofile_release(smb_ofile_t *); 678cb174861Sjoyce mcintosh void smb_ofile_request_complete(smb_ofile_t *); 679c8ec8eeaSjose borrego void smb_ofile_close_all(smb_tree_t *); 680c8ec8eeaSjose borrego void smb_ofile_close_all_by_pid(smb_tree_t *, uint16_t); 681c8ec8eeaSjose borrego void smb_ofile_set_flags(smb_ofile_t *, uint32_t); 682c8ec8eeaSjose borrego boolean_t smb_ofile_is_open(smb_ofile_t *); 6831fcced4cSJordan Brown int smb_ofile_enum(smb_ofile_t *, smb_svcenum_t *); 6849fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States uint32_t smb_ofile_open_check(smb_ofile_t *, uint32_t, uint32_t); 6853ad684d6Sjb150015 uint32_t smb_ofile_rename_check(smb_ofile_t *); 6863ad684d6Sjb150015 uint32_t smb_ofile_delete_check(smb_ofile_t *); 687cb174861Sjoyce mcintosh boolean_t smb_ofile_share_check(smb_ofile_t *); 688b89a8333Snatalie li - Sun Microsystems - Irvine United States cred_t *smb_ofile_getcred(smb_ofile_t *); 6898b2cc8acSafshin salek ardakani - Sun Microsystems - Irvine United States void smb_ofile_set_delete_on_close(smb_ofile_t *); 690037cac00Sjoyce mcintosh void smb_delayed_write_timer(smb_llist_t *); 6919fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_ofile_set_quota_resume(smb_ofile_t *, char *); 6929fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_ofile_get_quota_resume(smb_ofile_t *, char *, int); 693037cac00Sjoyce mcintosh 6942c2961f8Sjose borrego #define SMB_OFILE_GET_SESSION(of) ((of)->f_session) 6952c2961f8Sjose borrego #define SMB_OFILE_GET_TREE(of) ((of)->f_tree) 6962c2961f8Sjose borrego #define SMB_OFILE_GET_FID(of) ((of)->f_fid) 6972c2961f8Sjose borrego #define SMB_OFILE_GET_NODE(of) ((of)->f_node) 6988c10a865Sas200622 699da6c28aaSamw #define smb_ofile_granted_access(_of_) ((_of_)->f_granted_access) 700da6c28aaSamw 701da6c28aaSamw /* 702da6c28aaSamw * odir functions (file smb_odir.c) 703da6c28aaSamw */ 704*a90cf9f2SGordon Ross uint32_t smb_odir_openpath(smb_request_t *, char *, uint16_t, uint32_t, 705*a90cf9f2SGordon Ross smb_odir_t **); 706*a90cf9f2SGordon Ross uint32_t smb_odir_openfh(smb_request_t *, const char *, uint16_t, 707*a90cf9f2SGordon Ross smb_odir_t **); 708*a90cf9f2SGordon Ross uint32_t smb_odir_openat(smb_request_t *, smb_node_t *, smb_odir_t **); 709*a90cf9f2SGordon Ross void smb_odir_reopen(smb_odir_t *, const char *, uint16_t); 7107f667e74Sjose borrego void smb_odir_close(smb_odir_t *); 7117f667e74Sjose borrego boolean_t smb_odir_hold(smb_odir_t *); 7127f667e74Sjose borrego void smb_odir_release(smb_odir_t *); 7139fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_odir_delete(void *); 7147f667e74Sjose borrego 7157f667e74Sjose borrego int smb_odir_read(smb_request_t *, smb_odir_t *, 7167f667e74Sjose borrego smb_odirent_t *, boolean_t *); 7177f667e74Sjose borrego int smb_odir_read_fileinfo(smb_request_t *, smb_odir_t *, 718bfbce3c1SGordon Ross smb_fileinfo_t *, uint16_t *); 7197f667e74Sjose borrego int smb_odir_read_streaminfo(smb_request_t *, smb_odir_t *, 7207f667e74Sjose borrego smb_streaminfo_t *, boolean_t *); 7217f667e74Sjose borrego 7227f667e74Sjose borrego void smb_odir_save_cookie(smb_odir_t *, int, uint32_t cookie); 723bfbce3c1SGordon Ross void smb_odir_save_fname(smb_odir_t *, uint32_t, const char *); 724bfbce3c1SGordon Ross 7257f667e74Sjose borrego void smb_odir_resume_at(smb_odir_t *, smb_odir_resume_t *); 726da6c28aaSamw 727da6c28aaSamw /* 728da6c28aaSamw * SMB user functions (file smb_user.c) 729da6c28aaSamw */ 73012b65585SGordon Ross smb_user_t *smb_user_new(smb_session_t *); 73112b65585SGordon Ross int smb_user_logon(smb_user_t *, cred_t *, 732da6c28aaSamw char *, char *, uint32_t, uint32_t, uint32_t); 733da6c28aaSamw smb_user_t *smb_user_dup(smb_user_t *); 734c8ec8eeaSjose borrego void smb_user_logoff(smb_user_t *); 7359fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_user_delete(void *); 736c8ec8eeaSjose borrego boolean_t smb_user_is_admin(smb_user_t *); 7371fcced4cSJordan Brown boolean_t smb_user_namecmp(smb_user_t *, const char *); 7381fcced4cSJordan Brown int smb_user_enum(smb_user_t *, smb_svcenum_t *); 7391fcced4cSJordan Brown boolean_t smb_user_hold(smb_user_t *); 7403b13a1efSThomas Keiser void smb_user_hold_internal(smb_user_t *); 741c8ec8eeaSjose borrego void smb_user_release(smb_user_t *); 742b89a8333Snatalie li - Sun Microsystems - Irvine United States cred_t *smb_user_getcred(smb_user_t *); 743b89a8333Snatalie li - Sun Microsystems - Irvine United States cred_t *smb_user_getprivcred(smb_user_t *); 7441fcced4cSJordan Brown void smb_user_netinfo_init(smb_user_t *, smb_netuserinfo_t *); 7451fcced4cSJordan Brown void smb_user_netinfo_fini(smb_netuserinfo_t *); 7461fcced4cSJordan Brown int smb_user_netinfo_encode(smb_user_t *, uint8_t *, size_t, uint32_t *); 7478622ec45SGordon Ross smb_token_t *smb_get_token(smb_session_t *, smb_logon_t *); 748b819cea2SGordon Ross cred_t *smb_cred_create(smb_token_t *); 749b819cea2SGordon Ross void smb_user_setcred(smb_user_t *, cred_t *, uint32_t); 750da6c28aaSamw 751da6c28aaSamw /* 752da6c28aaSamw * SMB tree functions (file smb_tree.c) 753da6c28aaSamw */ 754*a90cf9f2SGordon Ross uint32_t smb_tree_connect(smb_request_t *); 75529bd2886SAlan Wright void smb_tree_disconnect(smb_tree_t *, boolean_t); 7569fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_tree_dealloc(void *); 7579fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_tree_post_ofile(smb_tree_t *, smb_ofile_t *); 7589fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_tree_post_odir(smb_tree_t *, smb_odir_t *); 759*a90cf9f2SGordon Ross void smb_tree_close_pid(smb_tree_t *, uint32_t); 760c8ec8eeaSjose borrego boolean_t smb_tree_has_feature(smb_tree_t *, uint_t); 7611fcced4cSJordan Brown int smb_tree_enum(smb_tree_t *, smb_svcenum_t *); 7621fcced4cSJordan Brown int smb_tree_fclose(smb_tree_t *, uint32_t); 763c8ec8eeaSjose borrego boolean_t smb_tree_hold(smb_tree_t *); 764*a90cf9f2SGordon Ross void smb_tree_hold_internal(smb_tree_t *); 765c8ec8eeaSjose borrego void smb_tree_release(smb_tree_t *); 7663b13a1efSThomas Keiser smb_odir_t *smb_tree_lookup_odir(smb_request_t *, uint16_t); 7678b2cc8acSafshin salek ardakani - Sun Microsystems - Irvine United States boolean_t smb_tree_is_connected(smb_tree_t *); 7682c2961f8Sjose borrego #define SMB_TREE_GET_TID(tree) ((tree)->t_tid) 769da6c28aaSamw 770da6c28aaSamw smb_xa_t *smb_xa_create(smb_session_t *session, smb_request_t *sr, 771da6c28aaSamw uint32_t total_parameter_count, uint32_t total_data_count, 772da6c28aaSamw uint32_t max_parameter_count, uint32_t max_data_count, 773da6c28aaSamw uint32_t max_setup_count, uint32_t setup_word_count); 774da6c28aaSamw void smb_xa_delete(smb_xa_t *xa); 775da6c28aaSamw smb_xa_t *smb_xa_hold(smb_xa_t *xa); 776da6c28aaSamw void smb_xa_rele(smb_session_t *session, smb_xa_t *xa); 777da6c28aaSamw int smb_xa_open(smb_xa_t *xa); 778da6c28aaSamw void smb_xa_close(smb_xa_t *xa); 779da6c28aaSamw int smb_xa_complete(smb_xa_t *xa); 780*a90cf9f2SGordon Ross smb_xa_t *smb_xa_find(smb_session_t *session, uint32_t pid, uint16_t mid); 781da6c28aaSamw 782da6c28aaSamw struct mbuf *smb_mbuf_get(uchar_t *buf, int nbytes); 783da6c28aaSamw struct mbuf *smb_mbuf_allocate(struct uio *uio); 784da6c28aaSamw void smb_mbuf_trim(struct mbuf *mhead, int nbytes); 785da6c28aaSamw 786da6c28aaSamw void smb_check_status(void); 787da6c28aaSamw int smb_handle_write_raw(smb_session_t *session, smb_request_t *sr); 788da6c28aaSamw 789e3f2c991SKeyur Desai int32_t smb_time_gmt_to_local(smb_request_t *, int32_t); 790e3f2c991SKeyur Desai int32_t smb_time_local_to_gmt(smb_request_t *, int32_t); 791e3f2c991SKeyur Desai int32_t smb_time_dos_to_unix(int16_t, int16_t); 792e3f2c991SKeyur Desai void smb_time_unix_to_dos(int32_t, int16_t *, int16_t *); 793e3f2c991SKeyur Desai void smb_time_nt_to_unix(uint64_t nt_time, timestruc_t *unix_time); 794e3f2c991SKeyur Desai uint64_t smb_time_unix_to_nt(timestruc_t *); 795da6c28aaSamw 796da6c28aaSamw int netbios_name_isvalid(char *in, char *out); 797da6c28aaSamw 798da6c28aaSamw int uioxfer(struct uio *src_uio, struct uio *dst_uio, int n); 799da6c28aaSamw 800da6c28aaSamw /* 801da6c28aaSamw * Pool ID function prototypes 802da6c28aaSamw */ 803da6c28aaSamw int smb_idpool_constructor(smb_idpool_t *pool); 804da6c28aaSamw void smb_idpool_destructor(smb_idpool_t *pool); 805da6c28aaSamw int smb_idpool_alloc(smb_idpool_t *pool, uint16_t *id); 806da6c28aaSamw void smb_idpool_free(smb_idpool_t *pool, uint16_t id); 807da6c28aaSamw 808da6c28aaSamw /* 809da6c28aaSamw * SMB locked list function prototypes 810da6c28aaSamw */ 8119fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_llist_init(void); 8129fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_llist_fini(void); 813da6c28aaSamw void smb_llist_constructor(smb_llist_t *, size_t, size_t); 814da6c28aaSamw void smb_llist_destructor(smb_llist_t *); 8159fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_llist_exit(smb_llist_t *); 8169fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_llist_post(smb_llist_t *, void *, smb_dtorproc_t); 817c5866007SKeyur Desai void smb_llist_flush(smb_llist_t *); 818da6c28aaSamw void smb_llist_insert_head(smb_llist_t *ll, void *obj); 819da6c28aaSamw void smb_llist_insert_tail(smb_llist_t *ll, void *obj); 820da6c28aaSamw void smb_llist_remove(smb_llist_t *ll, void *obj); 821da6c28aaSamw int smb_llist_upgrade(smb_llist_t *ll); 822da6c28aaSamw uint32_t smb_llist_get_count(smb_llist_t *ll); 823da6c28aaSamw #define smb_llist_enter(ll, mode) rw_enter(&(ll)->ll_lock, mode) 824da6c28aaSamw #define smb_llist_head(ll) list_head(&(ll)->ll_list) 825da6c28aaSamw #define smb_llist_next(ll, obj) list_next(&(ll)->ll_list, obj) 826da6c28aaSamw int smb_account_connected(smb_user_t *user); 827da6c28aaSamw 828da6c28aaSamw /* 829da6c28aaSamw * SMB Synchronized list function prototypes 830da6c28aaSamw */ 831da6c28aaSamw void smb_slist_constructor(smb_slist_t *, size_t, size_t); 832da6c28aaSamw void smb_slist_destructor(smb_slist_t *); 833da6c28aaSamw void smb_slist_insert_head(smb_slist_t *sl, void *obj); 834da6c28aaSamw void smb_slist_insert_tail(smb_slist_t *sl, void *obj); 835da6c28aaSamw void smb_slist_remove(smb_slist_t *sl, void *obj); 836da6c28aaSamw void smb_slist_wait_for_empty(smb_slist_t *sl); 837da6c28aaSamw void smb_slist_exit(smb_slist_t *sl); 838da6c28aaSamw uint32_t smb_slist_move_tail(list_t *lst, smb_slist_t *sl); 839da6c28aaSamw void smb_slist_obj_move(smb_slist_t *dst, smb_slist_t *src, void *obj); 840da6c28aaSamw #define smb_slist_enter(sl) mutex_enter(&(sl)->sl_mutex) 841da6c28aaSamw #define smb_slist_head(sl) list_head(&(sl)->sl_list) 842da6c28aaSamw #define smb_slist_next(sl, obj) list_next(&(sl)->sl_list, obj) 843da6c28aaSamw 844da6c28aaSamw void smb_rwx_init(smb_rwx_t *rwx); 845da6c28aaSamw void smb_rwx_destroy(smb_rwx_t *rwx); 846da6c28aaSamw #define smb_rwx_rwenter(rwx, mode) rw_enter(&(rwx)->rwx_lock, mode) 847da6c28aaSamw void smb_rwx_rwexit(smb_rwx_t *rwx); 848da6c28aaSamw int smb_rwx_rwwait(smb_rwx_t *rwx, clock_t timeout); 849da6c28aaSamw #define smb_rwx_xenter(rwx) mutex_enter(&(rwx)->rwx_mutex) 850da6c28aaSamw #define smb_rwx_xexit(rwx) mutex_exit(&(rwx)->rwx_mutex) 851da6c28aaSamw krw_t smb_rwx_rwupgrade(smb_rwx_t *rwx); 852da6c28aaSamw void smb_rwx_rwdowngrade(smb_rwx_t *rwx, krw_t mode); 853da6c28aaSamw 85408344b29SGordon Ross void smb_thread_init(smb_thread_t *, char *, smb_thread_ep_t, 85508344b29SGordon Ross void *, pri_t); 856da6c28aaSamw void smb_thread_destroy(smb_thread_t *); 857da6c28aaSamw int smb_thread_start(smb_thread_t *); 858da6c28aaSamw void smb_thread_stop(smb_thread_t *); 859da6c28aaSamw void smb_thread_signal(smb_thread_t *); 860da6c28aaSamw boolean_t smb_thread_continue(smb_thread_t *); 861da6c28aaSamw boolean_t smb_thread_continue_nowait(smb_thread_t *); 862da6c28aaSamw boolean_t smb_thread_continue_timedwait(smb_thread_t *, int /* seconds */); 863da6c28aaSamw 864da6c28aaSamw uint32_t smb_denymode_to_sharemode(uint32_t desired_access, char *fname); 865da6c28aaSamw uint32_t smb_ofun_to_crdisposition(uint16_t ofun); 866da6c28aaSamw 867da6c28aaSamw /* 100's of ns between 1/1/1970 and 1/1/1601 */ 868da6c28aaSamw #define NT_TIME_BIAS (134774LL * 24LL * 60LL * 60LL * 10000000LL) 869da6c28aaSamw 87055bf511dSas200622 uint32_t smb_sd_read(smb_request_t *, smb_sd_t *, uint32_t); 87155bf511dSas200622 uint32_t smb_sd_write(smb_request_t *, smb_sd_t *, uint32_t); 87255bf511dSas200622 8739fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States acl_t *smb_fsacl_inherit(acl_t *, int, int, cred_t *); 87455bf511dSas200622 acl_t *smb_fsacl_merge(acl_t *, acl_t *); 87555bf511dSas200622 void smb_fsacl_split(acl_t *, acl_t **, acl_t **, int); 87655bf511dSas200622 acl_t *smb_fsacl_from_vsa(vsecattr_t *, acl_type_t); 87755bf511dSas200622 int smb_fsacl_to_vsa(acl_t *, vsecattr_t *, int *); 87855bf511dSas200622 87955bf511dSas200622 boolean_t smb_ace_is_generic(int); 88055bf511dSas200622 boolean_t smb_ace_is_access(int); 88155bf511dSas200622 boolean_t smb_ace_is_audit(int); 88255bf511dSas200622 883*a90cf9f2SGordon Ross uint32_t smb_vss_enum_snapshots(smb_request_t *, smb_fsctl_t *); 88489dc44ceSjose borrego int smb_vss_lookup_nodes(smb_request_t *, smb_node_t *, smb_node_t *, 88589dc44ceSjose borrego char *, smb_node_t **, smb_node_t **); 88689dc44ceSjose borrego vnode_t *smb_lookuppathvptovp(smb_request_t *, char *, vnode_t *, vnode_t *); 88789dc44ceSjose borrego 8882c2961f8Sjose borrego void smb_panic(char *, const char *, int); 8892c2961f8Sjose borrego #pragma does_not_return(smb_panic) 8902c2961f8Sjose borrego #define SMB_PANIC() smb_panic(__FILE__, __func__, __LINE__) 8912c2961f8Sjose borrego 892148c5f43SAlan Wright void smb_latency_init(smb_latency_t *); 893148c5f43SAlan Wright void smb_latency_destroy(smb_latency_t *); 894148c5f43SAlan Wright void smb_latency_add_sample(smb_latency_t *, hrtime_t); 895148c5f43SAlan Wright void smb_srqueue_init(smb_srqueue_t *); 896148c5f43SAlan Wright void smb_srqueue_destroy(smb_srqueue_t *); 897148c5f43SAlan Wright void smb_srqueue_waitq_enter(smb_srqueue_t *); 898148c5f43SAlan Wright void smb_srqueue_runq_exit(smb_srqueue_t *); 899148c5f43SAlan Wright void smb_srqueue_waitq_to_runq(smb_srqueue_t *); 900148c5f43SAlan Wright void smb_srqueue_update(smb_srqueue_t *, smb_kstat_utilization_t *); 901148c5f43SAlan Wright 9029fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void *smb_mem_alloc(size_t); 9039fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void *smb_mem_zalloc(size_t); 9049fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void *smb_mem_realloc(void *, size_t); 9059fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void *smb_mem_rezalloc(void *, size_t); 9069fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_mem_free(void *); 9079fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_mem_zfree(void *); 9089fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States char *smb_mem_strdup(const char *); 9099fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_srm_init(smb_request_t *); 9109fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_srm_fini(smb_request_t *); 9119fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void *smb_srm_alloc(smb_request_t *, size_t); 9129fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void *smb_srm_zalloc(smb_request_t *, size_t); 9139fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void *smb_srm_realloc(smb_request_t *, void *, size_t); 9149fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void *smb_srm_rezalloc(smb_request_t *, void *, size_t); 915148c5f43SAlan Wright char *smb_srm_strdup(smb_request_t *, const char *); 916148c5f43SAlan Wright 9178622ec45SGordon Ross void smb_export_start(smb_server_t *); 9188622ec45SGordon Ross void smb_export_stop(smb_server_t *); 919148c5f43SAlan Wright 920b819cea2SGordon Ross #ifdef _KERNEL 921b819cea2SGordon Ross struct __door_handle; 922b819cea2SGordon Ross struct __door_handle *smb_kshare_door_init(int); 923b819cea2SGordon Ross void smb_kshare_door_fini(struct __door_handle *); 924b819cea2SGordon Ross int smb_kshare_upcall(struct __door_handle *, void *, boolean_t); 925b819cea2SGordon Ross #endif /* _KERNEL */ 926148c5f43SAlan Wright 9278622ec45SGordon Ross void smb_kshare_g_init(void); 9288622ec45SGordon Ross void smb_kshare_g_fini(void); 9298622ec45SGordon Ross void smb_kshare_init(smb_server_t *); 9308622ec45SGordon Ross void smb_kshare_fini(smb_server_t *); 9318622ec45SGordon Ross int smb_kshare_start(smb_server_t *); 9328622ec45SGordon Ross void smb_kshare_stop(smb_server_t *); 9338622ec45SGordon Ross 934148c5f43SAlan Wright int smb_kshare_export_list(smb_ioc_share_t *); 935148c5f43SAlan Wright int smb_kshare_unexport_list(smb_ioc_share_t *); 936cb174861Sjoyce mcintosh int smb_kshare_info(smb_ioc_shareinfo_t *); 9378622ec45SGordon Ross void smb_kshare_enum(smb_server_t *, smb_enumshare_info_t *); 9388622ec45SGordon Ross smb_kshare_t *smb_kshare_lookup(smb_server_t *, const char *); 9398622ec45SGordon Ross void smb_kshare_release(smb_server_t *, smb_kshare_t *); 9408622ec45SGordon Ross int smb_kshare_exec(smb_server_t *, smb_shr_execinfo_t *); 9418622ec45SGordon Ross uint32_t smb_kshare_hostaccess(smb_kshare_t *, smb_session_t *); 942148c5f43SAlan Wright 943148c5f43SAlan Wright 9448622ec45SGordon Ross void smb_avl_create(smb_avl_t *, size_t, size_t, const smb_avl_nops_t *); 945148c5f43SAlan Wright void smb_avl_destroy(smb_avl_t *); 946148c5f43SAlan Wright int smb_avl_add(smb_avl_t *, void *); 947148c5f43SAlan Wright void smb_avl_remove(smb_avl_t *, void *); 948148c5f43SAlan Wright void *smb_avl_lookup(smb_avl_t *, void *); 949148c5f43SAlan Wright void smb_avl_release(smb_avl_t *, void *); 950148c5f43SAlan Wright void smb_avl_iterinit(smb_avl_t *, smb_avl_cursor_t *); 951148c5f43SAlan Wright void *smb_avl_iterate(smb_avl_t *, smb_avl_cursor_t *); 9529fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 953856399cfSGordon Ross void smb_threshold_init(smb_cmd_threshold_t *, 954856399cfSGordon Ross char *, uint_t, uint_t); 955cb174861Sjoyce mcintosh void smb_threshold_fini(smb_cmd_threshold_t *); 956cb174861Sjoyce mcintosh int smb_threshold_enter(smb_cmd_threshold_t *); 957856399cfSGordon Ross void smb_threshold_exit(smb_cmd_threshold_t *); 958856399cfSGordon Ross void smb_threshold_wake_all(smb_cmd_threshold_t *); 959856399cfSGordon Ross 960da6c28aaSamw #ifdef __cplusplus 961da6c28aaSamw } 962da6c28aaSamw #endif 963da6c28aaSamw 964da6c28aaSamw #endif /* _SMB_KPROTO_H_ */ 965