xref: /titanic_50/usr/src/uts/common/smbsrv/smb_fsops.h (revision 9f773e288f99c442ca8578e3006a51f82fb49aab)
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/smb_i18n.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 
48 void smb_fsop_close(smb_node_t *, int, cred_t *);
49 
50 int smb_fsop_oplock_install(smb_node_t *, int);
51 
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 *name, smb_attr_t *attr, smb_node_t **ret_snode, smb_attr_t *ret_attr);
56 
57 int smb_fsop_mkdir(struct smb_request *sr, cred_t *cr, smb_node_t *snode,
58     char *name, smb_attr_t *attr, smb_node_t **ret_snode, smb_attr_t *ret_attr);
59 
60 int smb_fsop_remove(struct smb_request *sr, cred_t *cr, smb_node_t *dir_snode,
61     char *name, uint32_t flags);
62 
63 int smb_fsop_rmdir(struct smb_request *sr, cred_t *cr, smb_node_t *dir_snode,
64     char *name, uint32_t flags);
65 
66 int smb_fsop_getattr(struct smb_request *sr, cred_t *cr, smb_node_t *snode,
67     smb_attr_t *attr);
68 
69 int smb_maybe_mangled_name(char *name);
70 
71 int smb_fsop_link(smb_request_t *, cred_t *, smb_node_t *, smb_node_t *,
72     char *);
73 
74 int smb_fsop_rename(struct smb_request *sr, cred_t *cr,
75     smb_node_t *from_snode, char *from_name, smb_node_t *to_snode,
76     char *to_name);
77 
78 int smb_fsop_setattr(struct smb_request *sr, cred_t *cr, smb_node_t *snode,
79     smb_attr_t *set_attr, smb_attr_t *ret_attr);
80 
81 int smb_fsop_read(struct smb_request *sr, cred_t *cr,
82     smb_node_t *snode, uio_t *uio, smb_attr_t *ret_attr);
83 
84 int smb_fsop_write(smb_request_t *, cred_t *, smb_node_t *, uio_t *,
85     uint32_t *, smb_attr_t *, int);
86 
87 int smb_fsop_statfs(cred_t *cr, struct smb_node *snode,
88     struct statvfs64 *statp);
89 
90 int smb_fsop_remove_streams(struct smb_request *sr, cred_t *cr,
91     smb_node_t *fnode);
92 
93 int smb_fsop_access(smb_request_t *sr, cred_t *cr, smb_node_t *snode,
94     uint32_t faccess);
95 
96 void smb_fsop_eaccess(smb_request_t *sr, cred_t *cr, smb_node_t *snode,
97     uint32_t *faccess);
98 
99 int smb_fsop_lookup_name(struct smb_request *sr, cred_t *cr, int flags,
100     smb_node_t *root_node, smb_node_t *dir_snode, char *name,
101     smb_node_t **ret_snode, smb_attr_t *ret_attr);
102 
103 int smb_fsop_lookup(struct smb_request *sr, cred_t *cr, int flags,
104     smb_node_t *root_node, smb_node_t *dir_snode, char *name,
105     smb_node_t **ret_snode, smb_attr_t *ret_attr);
106 
107 int smb_fsop_commit(smb_request_t *sr, cred_t *cr, struct smb_node *snode);
108 
109 int smb_fsop_aclread(smb_request_t *, cred_t *, smb_node_t *, smb_fssd_t *);
110 int smb_fsop_aclwrite(smb_request_t *, cred_t *, smb_node_t *, smb_fssd_t *);
111 acl_type_t smb_fsop_acltype(smb_node_t *);
112 int smb_fsop_sdread(smb_request_t *, cred_t *, smb_node_t *, smb_fssd_t *);
113 int smb_fsop_sdwrite(smb_request_t *, cred_t *, smb_node_t *, smb_fssd_t *,
114     int);
115 
116 uint32_t smb_fsop_shrlock(cred_t *, smb_node_t *, uint32_t, uint32_t, uint32_t);
117 void smb_fsop_unshrlock(cred_t *cr, smb_node_t *node, uint32_t uniq_fid);
118 
119 int smb_fsop_frlock(smb_node_t *, smb_lock_t *, boolean_t, cred_t *);
120 
121 /*
122  * Lookup-related flags
123  *
124  * SMB_FOLLOW_LINKS	Follow symbolic links.
125  * SMB_IGNORE_CASE	Perform case-insensitive lookup.
126  * SMB_CATIA		Perform CATIA character substitution
127  */
128 
129 #define	SMB_FOLLOW_LINKS	0x00000001
130 #define	SMB_IGNORE_CASE		0x00000002
131 #define	SMB_CATIA		0x00000004
132 
133 #ifdef	__cplusplus
134 }
135 #endif
136 
137 #endif /* _SMBSRV_SMB_FSOPS_H */
138