1 /* 2 * CDDL HEADER START 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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 24 * Copyright 2018 Nexenta Systems, Inc. All rights reserved. 25 */ 26 27 /* 28 * Function prototypes needed by the "testoplock" program 29 * (a small subset of what the SMB server uses) 30 */ 31 32 #ifndef _SMB_KPROTO_H_ 33 #define _SMB_KPROTO_H_ 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 #include <sys/types.h> 40 #include <sys/param.h> 41 #include <sys/varargs.h> 42 #include <sys/cmn_err.h> 43 #include <smbsrv/smb.h> 44 #include <smbsrv/smb_ktypes.h> 45 46 boolean_t smb_ofile_is_open(smb_ofile_t *); 47 boolean_t smb_node_is_file(smb_node_t *); 48 49 /* 50 * SMB locked list function prototypes 51 */ 52 void smb_llist_init(void); 53 void smb_llist_fini(void); 54 void smb_llist_constructor(smb_llist_t *, size_t, size_t); 55 void smb_llist_destructor(smb_llist_t *); 56 void smb_llist_enter(smb_llist_t *ll, krw_t); 57 void smb_llist_exit(smb_llist_t *); 58 void smb_llist_post(smb_llist_t *, void *, smb_dtorproc_t); 59 void smb_llist_flush(smb_llist_t *); 60 void smb_llist_insert_head(smb_llist_t *ll, void *obj); 61 void smb_llist_insert_tail(smb_llist_t *ll, void *obj); 62 void smb_llist_remove(smb_llist_t *ll, void *obj); 63 int smb_llist_upgrade(smb_llist_t *ll); 64 uint32_t smb_llist_get_count(smb_llist_t *ll); 65 #define smb_llist_head(ll) list_head(&(ll)->ll_list) 66 #define smb_llist_next(ll, obj) list_next(&(ll)->ll_list, obj) 67 int smb_account_connected(smb_user_t *user); 68 69 /* 70 * Common oplock functions 71 */ 72 uint32_t smb_oplock_request(smb_request_t *, smb_ofile_t *, uint32_t *); 73 uint32_t smb_oplock_ack_break(smb_request_t *, smb_ofile_t *, uint32_t *); 74 uint32_t smb_oplock_break_PARENT(smb_node_t *, smb_ofile_t *); 75 uint32_t smb_oplock_break_OPEN(smb_node_t *, smb_ofile_t *, 76 uint32_t DesiredAccess, uint32_t CreateDisposition); 77 uint32_t smb_oplock_break_BATCH(smb_node_t *, smb_ofile_t *, 78 uint32_t DesiredAccess, uint32_t CreateDisposition); 79 uint32_t smb_oplock_break_HANDLE(smb_node_t *, smb_ofile_t *); 80 void smb_oplock_break_CLOSE(smb_node_t *, smb_ofile_t *); 81 uint32_t smb_oplock_break_READ(smb_node_t *, smb_ofile_t *); 82 uint32_t smb_oplock_break_WRITE(smb_node_t *, smb_ofile_t *); 83 uint32_t smb_oplock_break_SETINFO(smb_node_t *, 84 smb_ofile_t *ofile, uint32_t InfoClass); 85 uint32_t smb_oplock_break_DELETE(smb_node_t *, smb_ofile_t *); 86 87 void smb_oplock_move(smb_node_t *, smb_ofile_t *, smb_ofile_t *); 88 89 /* 90 * Protocol-specific oplock functions 91 * (and "server-level" functions) 92 */ 93 void smb1_oplock_acquire(smb_request_t *, boolean_t); 94 void smb1_oplock_break_notification(smb_request_t *, uint32_t); 95 void smb2_oplock_break_notification(smb_request_t *, uint32_t); 96 void smb2_lease_break_notification(smb_request_t *, uint32_t, boolean_t); 97 void smb_oplock_ind_break(smb_ofile_t *, uint32_t, boolean_t, uint32_t); 98 void smb_oplock_ind_break_in_ack(smb_request_t *, smb_ofile_t *, 99 uint32_t, boolean_t); 100 void smb_oplock_send_brk(smb_request_t *); 101 uint32_t smb_oplock_wait_break(smb_node_t *, int); 102 103 int smb_lock_range_access(smb_request_t *, smb_node_t *, 104 uint64_t, uint64_t, boolean_t); 105 106 107 #ifdef __cplusplus 108 } 109 #endif 110 111 #endif /* _SMB_KPROTO_H_ */ 112