xref: /illumos-gate/usr/src/uts/common/smbsrv/smb_fsops.h (revision a194faf8907a6722dcf10ad16c6ca72c9b7bd0ba)
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 2007 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_vops.h>
38 #include <smbsrv/smbvar.h>
39 
40 #ifdef	__cplusplus
41 extern "C" {
42 #endif
43 
44 int smb_fsop_open(smb_ofile_t *of);
45 
46 int smb_fsop_close(smb_ofile_t *of);
47 
48 int smb_fsop_create(struct smb_request *sr, cred_t *cr, smb_node_t *snode,
49     char *name, smb_attr_t *attr, smb_node_t **ret_snode, smb_attr_t *ret_attr);
50 
51 int smb_fsop_mkdir(struct smb_request *sr, cred_t *cr, smb_node_t *snode,
52     char *name, smb_attr_t *attr, smb_node_t **ret_snode, smb_attr_t *ret_attr);
53 
54 int smb_fsop_remove(struct smb_request *sr, cred_t *cr, smb_node_t *dir_snode,
55     char *name, int od);
56 
57 int smb_fsop_rmdir(struct smb_request *sr, cred_t *cr, smb_node_t *dir_snode,
58     char *name, int od);
59 
60 int smb_fsop_getattr(struct smb_request *sr, cred_t *cr, smb_node_t *snode,
61     smb_attr_t *attr);
62 
63 int smb_fsop_readdir(struct smb_request *sr, cred_t *cr, smb_node_t *snode,
64     uint32_t *cookie, char *name, int *namelen, ino64_t *fileid,
65     struct fs_stream_info *stream_info, smb_node_t **ret_snode,
66     smb_attr_t *ret_attr);
67 
68 int smb_fsop_getdents(struct smb_request *sr, cred_t *cr,
69     struct smb_node *dir_snode, uint32_t *cookie, uint64_t *verifierp,
70     int32_t *maxcnt, char *args, char *pattern);
71 
72 int smb_maybe_mangled_name(char *name);
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(struct smb_request *sr, cred_t *cr, smb_node_t *snode,
85     uio_t *uio, uint32_t *lcount, smb_attr_t *ret_attr,
86     uint32_t *stability);
87 
88 int smb_fsop_statfs(cred_t *cr, struct smb_node *snode,
89     struct statvfs64 *statp);
90 
91 int smb_fsop_remove_streams(struct smb_request *sr, cred_t *cr,
92     smb_node_t *fnode);
93 
94 int smb_fsop_access(smb_request_t *sr, cred_t *cr, smb_node_t *snode,
95     uint32_t faccess);
96 
97 void smb_fsop_eaccess(smb_request_t *sr, cred_t *cr, smb_node_t *snode,
98     uint32_t *faccess);
99 
100 int smb_fsop_lookup_name(struct smb_request *sr, cred_t *cr, int flags,
101     smb_node_t *root_node, smb_node_t *dir_snode, char *name,
102     smb_node_t **ret_snode, smb_attr_t *ret_attr);
103 
104 int smb_fsop_lookup(struct smb_request *sr, cred_t *cr, int flags,
105     smb_node_t *root_node, smb_node_t *dir_snode, char *name,
106     smb_node_t **ret_snode, smb_attr_t *ret_attr, char *ret_shortname,
107     char *ret_name83);
108 
109 int smb_fsop_commit(smb_request_t *sr, cred_t *cr, struct smb_node *snode);
110 
111 int smb_fsop_stream_readdir(struct smb_request *sr, cred_t *cr,
112     smb_node_t *fnode, uint32_t *cookiep, struct fs_stream_info *stream_info,
113     smb_node_t **ret_snode, smb_attr_t *ret_attr);
114 
115 int smb_fsop_aclread(smb_request_t *, cred_t *, smb_node_t *, smb_fssd_t *);
116 int smb_fsop_aclwrite(smb_request_t *, cred_t *, smb_node_t *, smb_fssd_t *);
117 acl_type_t smb_fsop_acltype(smb_node_t *);
118 int smb_fsop_sdread(smb_request_t *, cred_t *, smb_node_t *, smb_fssd_t *);
119 int smb_fsop_sdwrite(smb_request_t *, cred_t *, smb_node_t *, smb_fssd_t *,
120     int);
121 
122 void smb_get_caller_context(smb_request_t *sr, caller_context_t *ct);
123 
124 /*
125  * Lookup-related flags
126  *
127  * SMB_FOLLOW_LINKS	Follow symbolic links.
128  * SMB_IGNORE_CASE	Perform case-insensitive lookup.
129  *
130  * Misc flags
131  *
132  * SMB_STREAM_RDDIR	use eflags=0 for streams readdirs this
133  *			is currently a workaround because the
134  *			vfs isn't filling in this flag
135  */
136 
137 #define	SMB_FOLLOW_LINKS	0x00000001
138 #define	SMB_IGNORE_CASE		0x00000002
139 #define	SMB_STREAM_RDDIR	0x00000004
140 
141 #ifdef	__cplusplus
142 }
143 #endif
144 
145 #endif /* _SMBSRV_SMB_FSOPS_H */
146