r24712: No longer expose the 'BOOL' data type in any interfaces.
[jra/samba/.git] / source4 / ntvfs / common / opendb.h
1 /* 
2    Unix SMB/CIFS implementation.
3
4    open database code - common include
5
6    Copyright (C) Andrew Tridgell 2007
7    
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3 of the License, or
11    (at your option) any later version.
12    
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17    
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 struct opendb_ops {
23         struct odb_context *(*odb_init)(TALLOC_CTX *mem_ctx, 
24                                         struct ntvfs_context *ntvfs_ctx);
25         struct odb_lock *(*odb_lock)(TALLOC_CTX *mem_ctx,
26                                      struct odb_context *odb, DATA_BLOB *file_key);
27         NTSTATUS (*odb_open_file)(struct odb_lock *lck, void *file_handle,
28                                   uint32_t stream_id, uint32_t share_access, 
29                                   uint32_t access_mask, bool delete_on_close,
30                                   const char *path, 
31                                   uint32_t oplock_level, uint32_t *oplock_granted);
32         NTSTATUS (*odb_open_file_pending)(struct odb_lock *lck, void *private);
33         NTSTATUS (*odb_close_file)(struct odb_lock *lck, void *file_handle);
34         NTSTATUS (*odb_remove_pending)(struct odb_lock *lck, void *private);
35         NTSTATUS (*odb_rename)(struct odb_lock *lck, const char *path);
36         NTSTATUS (*odb_set_delete_on_close)(struct odb_lock *lck, bool del_on_close);
37         NTSTATUS (*odb_get_delete_on_close)(struct odb_context *odb, 
38                                             DATA_BLOB *key, bool *del_on_close, 
39                                             int *open_count, char **path);
40         NTSTATUS (*odb_can_open)(struct odb_lock *lck,
41                                  uint32_t share_access, uint32_t create_options, 
42                                  uint32_t access_mask);
43 };
44
45
46 void odb_set_ops(const struct opendb_ops *new_ops);
47 void odb_tdb_init_ops(void);
48 void odb_ctdb_init_ops(void);