xref: /illumos-gate/usr/src/uts/common/smbsrv/smb_fsops.h (revision d8849d7dee03b84a3fa281ec65eb9e3d86d3756b)
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  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  *
25  * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
26  */
27 
28 #ifndef _SMBSRV_SMB_FSOPS_H
29 #define	_SMBSRV_SMB_FSOPS_H
30 
31 /*
32  * This header file contains all the functions for the interface between
33  * the smb layer and the fs layer.
34  */
35 #include <smbsrv/string.h>
36 #include <smbsrv/smbinfo.h>
37 #include <smbsrv/smb_ktypes.h>
38 #include <smbsrv/smb_vops.h>
39 #include <sys/callb.h>
40 #include <sys/flock.h>
41 
42 #ifdef	__cplusplus
43 extern "C" {
44 #endif
45 
46 int smb_fsop_amask_to_omode(uint32_t);
47 
48 int smb_fsop_open(smb_node_t *, int, cred_t *);
49 void smb_fsop_close(smb_node_t *, int, cred_t *);
50 
51 int smb_fsop_oplock_install(smb_node_t *, int);
52 void smb_fsop_oplock_uninstall(smb_node_t *);
53 
54 int smb_fsop_create(smb_request_t *, cred_t *, smb_node_t *,
55     char *, smb_attr_t *, smb_node_t **);
56 
57 int smb_fsop_mkdir(smb_request_t *, cred_t *, smb_node_t *,
58     char *, smb_attr_t *, smb_node_t **);
59 
60 int smb_fsop_remove(smb_request_t *sr, cred_t *cr, smb_node_t *,
61     char *, uint32_t);
62 
63 int smb_fsop_rmdir(smb_request_t *, cred_t *, smb_node_t *, char *, uint32_t);
64 
65 int smb_fsop_getattr(smb_request_t *, cred_t *, smb_node_t *, smb_attr_t *);
66 
67 int smb_maybe_mangled_name(char *);
68 
69 int smb_fsop_link(smb_request_t *, cred_t *, smb_node_t *, smb_node_t *,
70     char *);
71 
72 int smb_fsop_rename(smb_request_t *, cred_t *,
73     smb_node_t *, char *, smb_node_t *,	char *);
74 
75 int smb_fsop_setattr(smb_request_t *, cred_t *, smb_node_t *, smb_attr_t *);
76 
77 int smb_fsop_freesp(smb_request_t *sr, cred_t *cr, smb_ofile_t *,
78 		    off64_t, off64_t);
79 
80 int smb_fsop_read(smb_request_t *, cred_t *, smb_node_t *, smb_ofile_t *,
81     uio_t *, int);
82 
83 int smb_fsop_write(smb_request_t *, cred_t *, smb_node_t *, smb_ofile_t *,
84     uio_t *, uint32_t *, int);
85 
86 int smb_fsop_next_alloc_range(cred_t *, smb_node_t *, off64_t *, off64_t *);
87 
88 int smb_fsop_statfs(cred_t *, smb_node_t *, struct statvfs64 *);
89 
90 uint32_t smb_fsop_remove_streams(smb_request_t *, cred_t *, smb_node_t *);
91 
92 int smb_fsop_access(smb_request_t *, cred_t *, smb_node_t *, uint32_t);
93 
94 void smb_fsop_eaccess(smb_request_t *, cred_t *, smb_node_t *, uint32_t *);
95 
96 int smb_fsop_lookup_name(smb_request_t *, cred_t *, int,
97     smb_node_t *, smb_node_t *, char *, smb_node_t **);
98 
99 int smb_fsop_lookup(smb_request_t *, cred_t *, int,
100     smb_node_t *, smb_node_t *, char *, smb_node_t **);
101 
102 int smb_fsop_commit(smb_request_t *, cred_t *, smb_node_t *);
103 
104 int smb_fsop_aclread(smb_request_t *, cred_t *, smb_node_t *, smb_fssd_t *);
105 int smb_fsop_aclwrite(smb_request_t *, cred_t *, smb_node_t *, smb_fssd_t *);
106 acl_type_t smb_fsop_acltype(smb_node_t *);
107 int smb_fsop_sdread(smb_request_t *, cred_t *, smb_node_t *, smb_fssd_t *);
108 int smb_fsop_sdwrite(smb_request_t *, cred_t *, smb_node_t *, smb_fssd_t *,
109     int);
110 
111 uint32_t smb_fsop_shrlock(cred_t *, smb_node_t *, uint32_t, uint32_t, uint32_t);
112 void smb_fsop_unshrlock(cred_t *, smb_node_t *, uint32_t);
113 int smb_fsop_frlock(smb_node_t *, smb_lock_t *, boolean_t, cred_t *);
114 
115 /*
116  * Lookup-related flags
117  *
118  * SMB_FOLLOW_LINKS	Follow symbolic links.
119  * SMB_IGNORE_CASE	Perform case-insensitive lookup.
120  * SMB_CATIA		Perform CATIA character substitution.
121  * SMB_ABE		Perform Access based enumeration/lookup.
122  * SMB_CASE_SENSITIVE	Don't set SMB_IGNORE_CASE based on tree.
123  */
124 
125 #define	SMB_FOLLOW_LINKS	0x00000001
126 #define	SMB_IGNORE_CASE		0x00000002
127 #define	SMB_CATIA		0x00000004
128 #define	SMB_ABE			0x00000008
129 #define	SMB_CASE_SENSITIVE	0x00000010
130 #define	SMB_EDIRENT		0x00000020
131 
132 /*
133  * Increased MAXPATHLEN for SMB.  Essentially, we want to allow a
134  * share path up to MAXPATHLEN plus a relative path of MAXPATHLEN.
135  */
136 #define	SMB_MAXPATHLEN	(2 * MAXPATHLEN)
137 
138 #ifdef	__cplusplus
139 }
140 #endif
141 
142 #endif /* _SMBSRV_SMB_FSOPS_H */
143