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