| 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 | DATA_BLOB (*odb_get_key)(TALLOC_CTX *mem_ctx, struct odb_lock *lck);
|
|---|
| 28 | NTSTATUS (*odb_open_file)(struct odb_lock *lck,
|
|---|
| 29 | void *file_handle, const char *path,
|
|---|
| 30 | int *fd, NTTIME open_write_time,
|
|---|
| 31 | bool allow_level_II_oplock,
|
|---|
| 32 | uint32_t oplock_level, uint32_t *oplock_granted);
|
|---|
| 33 | NTSTATUS (*odb_open_file_pending)(struct odb_lock *lck, void *private_data);
|
|---|
| 34 | NTSTATUS (*odb_close_file)(struct odb_lock *lck, void *file_handle,
|
|---|
| 35 | const char **delete_path);
|
|---|
| 36 | NTSTATUS (*odb_remove_pending)(struct odb_lock *lck, void *private_data);
|
|---|
| 37 | NTSTATUS (*odb_rename)(struct odb_lock *lck, const char *path);
|
|---|
| 38 | NTSTATUS (*odb_get_path)(struct odb_lock *lck, const char **path);
|
|---|
| 39 | NTSTATUS (*odb_set_delete_on_close)(struct odb_lock *lck, bool del_on_close);
|
|---|
| 40 | NTSTATUS (*odb_set_write_time)(struct odb_lock *lck,
|
|---|
| 41 | NTTIME write_time, bool force);
|
|---|
| 42 | NTSTATUS (*odb_get_file_infos)(struct odb_context *odb, DATA_BLOB *key,
|
|---|
| 43 | bool *del_on_close, NTTIME *write_time);
|
|---|
| 44 | NTSTATUS (*odb_can_open)(struct odb_lock *lck,
|
|---|
| 45 | uint32_t stream_id, uint32_t share_access,
|
|---|
| 46 | uint32_t access_mask, bool delete_on_close,
|
|---|
| 47 | uint32_t open_disposition, bool break_to_none);
|
|---|
| 48 | NTSTATUS (*odb_update_oplock)(struct odb_lock *lck, void *file_handle,
|
|---|
| 49 | uint32_t oplock_level);
|
|---|
| 50 | NTSTATUS (*odb_break_oplocks)(struct odb_lock *lck);
|
|---|
| 51 | };
|
|---|
| 52 |
|
|---|
| 53 | struct opendb_oplock_break {
|
|---|
| 54 | void *file_handle;
|
|---|
| 55 | uint8_t level;
|
|---|
| 56 | };
|
|---|
| 57 |
|
|---|
| 58 | void odb_set_ops(const struct opendb_ops *new_ops);
|
|---|
| 59 | void odb_tdb_init_ops(void);
|
|---|
| 60 | void odb_ctdb_init_ops(void);
|
|---|