926138bdabcefe38dce3d088313385161489dbc0
[nivanova/samba-autobuild/.git] / source3 / modules / onefs.h
1 /*
2  * Unix SMB/CIFS implementation.
3  * Support for OneFS
4  *
5  * Copyright (C) Steven Danneman, 2008
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #ifndef _ONEFS_H
22 #define _ONEFS_H
23
24 /*
25  * vfs interface handlers
26  */
27 SMB_STRUCT_DIR *onefs_opendir(struct vfs_handle_struct *handle,
28                               const char *fname, const char *mask,
29                               uint32 attributes);
30
31 struct dirent *onefs_readdir(struct vfs_handle_struct *handle,
32                                  SMB_STRUCT_DIR *dirp, SMB_STRUCT_STAT *sbuf);
33
34 void onefs_seekdir(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp,
35                    long offset);
36
37 long onefs_telldir(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp);
38
39 void onefs_rewinddir(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp);
40
41 int onefs_closedir(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dir);
42
43 void onefs_init_search_op(struct vfs_handle_struct *handle,
44                           SMB_STRUCT_DIR *dirp);
45
46 NTSTATUS onefs_create_file(vfs_handle_struct *handle,
47                            struct smb_request *req,
48                            uint16_t root_dir_fid,
49                            struct smb_filename *smb_fname,
50                            uint32_t access_mask,
51                            uint32_t share_access,
52                            uint32_t create_disposition,
53                            uint32_t create_options,
54                            uint32_t file_attributes,
55                            uint32_t oplock_request,
56                            uint64_t allocation_size,
57                            struct security_descriptor *sd,
58                            struct ea_list *ea_list,
59                            files_struct **result,
60                            int *pinfo);
61
62 int onefs_close(vfs_handle_struct *handle, struct files_struct *fsp);
63
64 int onefs_rename(vfs_handle_struct *handle,
65                  const struct smb_filename *smb_fname_src,
66                  const struct smb_filename *smb_fname_dst);
67
68 int onefs_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname);
69
70 int onefs_fstat(vfs_handle_struct *handle, struct files_struct *fsp,
71                 SMB_STRUCT_STAT *sbuf);
72
73 int onefs_lstat(vfs_handle_struct *handle, struct smb_filename *smb_fname);
74
75 int onefs_unlink(vfs_handle_struct *handle,
76                  const struct smb_filename *smb_fname);
77
78 NTSTATUS onefs_streaminfo(vfs_handle_struct *handle,
79                           struct files_struct *fsp,
80                           const char *fname,
81                           TALLOC_CTX *mem_ctx,
82                           unsigned int *num_streams,
83                           struct stream_struct **streams);
84
85 int onefs_vtimes_streams(vfs_handle_struct *handle,
86                          const struct smb_filename *smb_fname,
87                          int flags, struct timespec times[3]);
88
89 NTSTATUS onefs_brl_lock_windows(vfs_handle_struct *handle,
90                                 struct byte_range_lock *br_lck,
91                                 struct lock_struct *plock,
92                                 bool blocking_lock,
93                                 struct blocking_lock_record *blr);
94
95 bool onefs_brl_unlock_windows(vfs_handle_struct *handle,
96                               struct messaging_context *msg_ctx,
97                               struct byte_range_lock *br_lck,
98                               const struct lock_struct *plock);
99
100 bool onefs_brl_cancel_windows(vfs_handle_struct *handle,
101                               struct byte_range_lock *br_lck,
102                               struct lock_struct *plock,
103                               struct blocking_lock_record *blr);
104
105 bool onefs_strict_lock(vfs_handle_struct *handle,
106                         files_struct *fsp,
107                         struct lock_struct *plock);
108
109 void onefs_strict_unlock(vfs_handle_struct *handle,
110                         files_struct *fsp,
111                         struct lock_struct *plock);
112
113 NTSTATUS onefs_notify_watch(vfs_handle_struct *vfs_handle,
114                             struct sys_notify_context *ctx,
115                             struct notify_entry *e,
116                             void (*callback)(struct sys_notify_context *ctx,
117                                         void *private_data,
118                                         struct notify_event *ev),
119                             void *private_data,
120                             void *handle_p);
121
122 NTSTATUS onefs_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
123                            uint32 security_info, struct security_descriptor **ppdesc);
124
125 NTSTATUS onefs_get_nt_acl(vfs_handle_struct *handle, const char* name,
126                           uint32 security_info, struct security_descriptor **ppdesc);
127
128 NTSTATUS onefs_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
129                            uint32 security_info_sent,
130                            const struct security_descriptor *psd);
131
132 /*
133  * Utility functions
134  */
135 struct ifs_security_descriptor;
136 NTSTATUS onefs_samba_sd_to_sd(uint32_t security_info_sent,
137                               const struct security_descriptor *psd,
138                               struct ifs_security_descriptor *sd, int snum,
139                               uint32_t *security_info_effective);
140
141 NTSTATUS onefs_stream_prep_smb_fname(TALLOC_CTX *ctx,
142                                      const struct smb_filename *smb_fname_in,
143                                      struct smb_filename **smb_fname_out);
144
145 int onefs_rdp_add_dir_state(connection_struct *conn, SMB_STRUCT_DIR *dirp);
146
147 /*
148  * System Interfaces
149  */
150 int onefs_sys_create_file(connection_struct *conn,
151                           int base_fd,
152                           const char *path,
153                           uint32_t access_mask,
154                           uint32_t open_access_mask,
155                           uint32_t share_access,
156                           uint32_t create_options,
157                           int flags,
158                           mode_t mode,
159                           int oplock_request,
160                           uint64_t id,
161                           struct security_descriptor *sd,
162                           uint32_t ntfs_flags,
163                           int *granted_oplock);
164
165 ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd,
166                            const DATA_BLOB *header, SMB_OFF_T offset,
167                            size_t count);
168
169 ssize_t onefs_sys_recvfile(int fromfd, int tofd, SMB_OFF_T offset,
170                            size_t count);
171
172 void init_stat_ex_from_onefs_stat(struct stat_ex *dst, const struct stat *src);
173
174 int onefs_sys_stat(const char *fname, SMB_STRUCT_STAT *sbuf);
175
176 int onefs_sys_fstat(int fd, SMB_STRUCT_STAT *sbuf);
177
178 int onefs_sys_fstat_at(int base_fd, const char *fname, SMB_STRUCT_STAT *sbuf,
179                        int flags);
180
181 int onefs_sys_lstat(const char *fname, SMB_STRUCT_STAT *sbuf);
182
183
184
185 #endif /* _ONEFS_H */