xref: /titanic_52/usr/src/uts/common/smbsrv/smb_fsops.h (revision a9da3307db733eb1739ba859952610bba3d894ab)
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 2008 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
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/smb_i18n.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 
50 int smb_fsop_close(smb_node_t *, int, cred_t *);
51 
52 int smb_fsop_oplock_install(smb_node_t *, int);
53 
54 void smb_fsop_oplock_uninstall(smb_node_t *);
55 
56 int smb_fsop_create(smb_request_t *, cred_t *, smb_node_t *,
57     char *name, smb_attr_t *attr, smb_node_t **ret_snode, smb_attr_t *ret_attr);
58 
59 int smb_fsop_mkdir(struct smb_request *sr, cred_t *cr, smb_node_t *snode,
60     char *name, smb_attr_t *attr, smb_node_t **ret_snode, smb_attr_t *ret_attr);
61 
62 int smb_fsop_remove(struct smb_request *sr, cred_t *cr, smb_node_t *dir_snode,
63     char *name, int od);
64 
65 int smb_fsop_rmdir(struct smb_request *sr, cred_t *cr, smb_node_t *dir_snode,
66     char *name, int od);
67 
68 int smb_fsop_getattr(struct smb_request *sr, cred_t *cr, smb_node_t *snode,
69     smb_attr_t *attr);
70 
71 int smb_fsop_readdir(struct smb_request *sr, cred_t *cr, smb_node_t *snode,
72     uint32_t *cookie, char *name, int *namelen, ino64_t *fileid,
73     struct fs_stream_info *stream_info, smb_node_t **ret_snode,
74     smb_attr_t *ret_attr);
75 
76 int smb_fsop_getdents(struct smb_request *sr, cred_t *cr,
77     struct smb_node *dir_snode, uint32_t *cookie, uint64_t *verifierp,
78     int32_t *maxcnt, char *args, char *pattern);
79 
80 int smb_maybe_mangled_name(char *name);
81 
82 int smb_fsop_rename(struct smb_request *sr, cred_t *cr,
83     smb_node_t *from_snode, char *from_name, smb_node_t *to_snode,
84     char *to_name);
85 
86 int smb_fsop_setattr(struct smb_request *sr, cred_t *cr, smb_node_t *snode,
87     smb_attr_t *set_attr, smb_attr_t *ret_attr);
88 
89 int smb_fsop_read(struct smb_request *sr, cred_t *cr,
90     smb_node_t *snode, uio_t *uio, smb_attr_t *ret_attr);
91 
92 int smb_fsop_write(struct smb_request *sr, cred_t *cr, smb_node_t *snode,
93     uio_t *uio, uint32_t *lcount, smb_attr_t *ret_attr,
94     uint32_t *stability);
95 
96 int smb_fsop_statfs(cred_t *cr, struct smb_node *snode,
97     struct statvfs64 *statp);
98 
99 int smb_fsop_remove_streams(struct smb_request *sr, cred_t *cr,
100     smb_node_t *fnode);
101 
102 int smb_fsop_access(smb_request_t *sr, cred_t *cr, smb_node_t *snode,
103     uint32_t faccess);
104 
105 void smb_fsop_eaccess(smb_request_t *sr, cred_t *cr, smb_node_t *snode,
106     uint32_t *faccess);
107 
108 int smb_fsop_lookup_name(struct smb_request *sr, cred_t *cr, int flags,
109     smb_node_t *root_node, smb_node_t *dir_snode, char *name,
110     smb_node_t **ret_snode, smb_attr_t *ret_attr);
111 
112 int smb_fsop_lookup(struct smb_request *sr, cred_t *cr, int flags,
113     smb_node_t *root_node, smb_node_t *dir_snode, char *name,
114     smb_node_t **ret_snode, smb_attr_t *ret_attr, char *ret_shortname,
115     char *ret_name83);
116 
117 int smb_fsop_commit(smb_request_t *sr, cred_t *cr, struct smb_node *snode);
118 
119 int smb_fsop_stream_readdir(struct smb_request *sr, cred_t *cr,
120     smb_node_t *fnode, uint32_t *cookiep, struct fs_stream_info *stream_info,
121     smb_node_t **ret_snode, smb_attr_t *ret_attr);
122 
123 int smb_fsop_aclread(smb_request_t *, cred_t *, smb_node_t *, smb_fssd_t *);
124 int smb_fsop_aclwrite(smb_request_t *, cred_t *, smb_node_t *, smb_fssd_t *);
125 acl_type_t smb_fsop_acltype(smb_node_t *);
126 int smb_fsop_sdread(smb_request_t *, cred_t *, smb_node_t *, smb_fssd_t *);
127 int smb_fsop_sdwrite(smb_request_t *, cred_t *, smb_node_t *, smb_fssd_t *,
128     int);
129 
130 uint32_t smb_fsop_shrlock(cred_t *, smb_node_t *, uint32_t, uint32_t, uint32_t);
131 void smb_fsop_unshrlock(cred_t *cr, smb_node_t *node, uint32_t uniq_fid);
132 
133 int smb_fsop_frlock(smb_node_t *, smb_lock_t *, boolean_t, cred_t *);
134 
135 /*
136  * Lookup-related flags
137  *
138  * SMB_FOLLOW_LINKS	Follow symbolic links.
139  * SMB_IGNORE_CASE	Perform case-insensitive lookup.
140  *
141  * Misc flags
142  *
143  * SMB_STREAM_RDDIR	use eflags=0 for streams readdirs this
144  *			is currently a workaround because the
145  *			vfs isn't filling in this flag
146  */
147 
148 #define	SMB_FOLLOW_LINKS	0x00000001
149 #define	SMB_IGNORE_CASE		0x00000002
150 #define	SMB_STREAM_RDDIR	0x00000004
151 
152 #ifdef	__cplusplus
153 }
154 #endif
155 
156 #endif /* _SMBSRV_SMB_FSOPS_H */
157