s3 OneFS: Refactor config code and cleanup includes
[gd/samba/.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 SMB_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                            const char *fname,
50                            uint32_t create_file_flags,
51                            uint32_t access_mask,
52                            uint32_t share_access,
53                            uint32_t create_disposition,
54                            uint32_t create_options,
55                            uint32_t file_attributes,
56                            uint32_t oplock_request,
57                            uint64_t allocation_size,
58                            struct security_descriptor *sd,
59                            struct ea_list *ea_list,
60                            files_struct **result,
61                            int *pinfo,
62                            SMB_STRUCT_STAT *psbuf);
63
64 int onefs_close(vfs_handle_struct *handle, struct files_struct *fsp);
65
66 int onefs_rename(vfs_handle_struct *handle, const char *oldname,
67                  const char *newname);
68
69 int onefs_stat(vfs_handle_struct *handle, const char *fname,
70                SMB_STRUCT_STAT *sbuf);
71
72 int onefs_fstat(vfs_handle_struct *handle, struct files_struct *fsp,
73                 SMB_STRUCT_STAT *sbuf);
74
75 int onefs_lstat(vfs_handle_struct *handle, const char *path,
76                 SMB_STRUCT_STAT *sbuf);
77
78 int onefs_unlink(vfs_handle_struct *handle, const char *path);
79
80 int onefs_chflags(vfs_handle_struct *handle, const char *path,
81                   unsigned int flags);
82
83 NTSTATUS onefs_streaminfo(vfs_handle_struct *handle,
84                           struct files_struct *fsp,
85                           const char *fname,
86                           TALLOC_CTX *mem_ctx,
87                           unsigned int *num_streams,
88                           struct stream_struct **streams);
89
90 int onefs_vtimes_streams(vfs_handle_struct *handle, const char *fname,
91                          int flags, struct timespec times[3]);
92
93 NTSTATUS onefs_brl_lock_windows(vfs_handle_struct *handle,
94                                 struct byte_range_lock *br_lck,
95                                 struct lock_struct *plock,
96                                 bool blocking_lock,
97                                 struct blocking_lock_record *blr);
98
99 bool onefs_brl_unlock_windows(vfs_handle_struct *handle,
100                               struct messaging_context *msg_ctx,
101                               struct byte_range_lock *br_lck,
102                               const struct lock_struct *plock);
103
104 bool onefs_brl_cancel_windows(vfs_handle_struct *handle,
105                               struct byte_range_lock *br_lck,
106                               struct lock_struct *plock,
107                               struct blocking_lock_record *blr);
108
109 NTSTATUS onefs_notify_watch(vfs_handle_struct *vfs_handle,
110                             struct sys_notify_context *ctx,
111                             struct notify_entry *e,
112                             void (*callback)(struct sys_notify_context *ctx,
113                                         void *private_data,
114                                         struct notify_event *ev),
115                             void *private_data,
116                             void *handle_p);
117
118 NTSTATUS onefs_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
119                            uint32 security_info, SEC_DESC **ppdesc);
120
121 NTSTATUS onefs_get_nt_acl(vfs_handle_struct *handle, const char* name,
122                           uint32 security_info, SEC_DESC **ppdesc);
123
124 NTSTATUS onefs_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
125                            uint32 security_info_sent, SEC_DESC *psd);
126
127 /*
128  * Utility functions
129  */
130 struct ifs_security_descriptor;
131 NTSTATUS onefs_samba_sd_to_sd(uint32 security_info_sent, SEC_DESC *psd,
132                               struct ifs_security_descriptor *sd, int snum);
133
134 NTSTATUS onefs_split_ntfs_stream_name(TALLOC_CTX *mem_ctx, const char *fname,
135                                       char **pbase, char **pstream);
136
137 int onefs_rdp_add_dir_state(connection_struct *conn, SMB_STRUCT_DIR *dirp);
138
139 /*
140  * System Interfaces
141  */
142 int onefs_sys_create_file(connection_struct *conn,
143                           int base_fd,
144                           const char *path,
145                           uint32_t access_mask,
146                           uint32_t open_access_mask,
147                           uint32_t share_access,
148                           uint32_t create_options,
149                           int flags,
150                           mode_t mode,
151                           int oplock_request,
152                           uint64_t id,
153                           struct security_descriptor *sd,
154                           uint32_t ntfs_flags,
155                           int *granted_oplock);
156
157 ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd,
158                            const DATA_BLOB *header, SMB_OFF_T offset,
159                            size_t count);
160
161 ssize_t onefs_sys_recvfile(int fromfd, int tofd, SMB_OFF_T offset,
162                            size_t count);
163
164 #endif /* _ONEFS_H */