vfs: Make function pointer names consistent. They all end in _fn
[Samba/gebeck_regimport.git] / source3 / lib / smbd_shim.c
blob72ae366ec36e74e3eb30b52fbc710344affe1387
1 /*
2 Unix SMB/CIFS implementation.
3 RPC pipe client
5 Copyright (C) Gerald (Jerry) Carter 2004.
6 Copyright (C) Andrew Bartlett 2011.
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.
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.
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/>.
22 /* Shim functions required due to the horrible dependency mess
23 in Samba. */
25 #include "includes.h"
26 #include "smbd_shim.h"
27 #include "smbd/proto.h"
29 static struct smbd_shim shim;
31 void set_smbd_shim(const struct smbd_shim *shim_functions)
33 shim = *shim_functions;
36 void cancel_pending_lock_requests_by_fid(files_struct *fsp,
37 struct byte_range_lock *br_lck,
38 enum file_close_type close_type)
40 if (shim.cancel_pending_lock_requests_by_fid) {
42 shim.cancel_pending_lock_requests_by_fid(fsp, br_lck, close_type);
46 void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
47 const char *name)
49 if (shim.send_stat_cache_delete_message) {
50 shim.send_stat_cache_delete_message(msg_ctx, name);
54 NTSTATUS can_delete_directory(struct connection_struct *conn,
55 const char *dirname)
57 if (shim.can_delete_directory) {
58 return shim.can_delete_directory(conn, dirname);
60 return NT_STATUS_OK;
63 bool change_to_root_user(void)
65 if (shim.change_to_root_user) {
66 return shim.change_to_root_user();
68 return false;
71 /**
72 * The following two functions need to be called from inside the low-level BRL
73 * code for oplocks correctness in smbd. Since other utility binaries also
74 * link in some of the brl code directly, these dummy functions are necessary
75 * to avoid needing to link in the oplocks code and its dependencies to all of
76 * the utility binaries.
78 void contend_level2_oplocks_begin(files_struct *fsp,
79 enum level2_contention_type type)
81 if (shim.contend_level2_oplocks_begin) {
82 shim.contend_level2_oplocks_begin(fsp, type);
84 return;
87 void contend_level2_oplocks_end(files_struct *fsp,
88 enum level2_contention_type type)
90 if (shim.contend_level2_oplocks_end) {
91 shim.contend_level2_oplocks_end(fsp, type);
93 return;
96 void become_root(void)
98 if (shim.become_root) {
99 shim.become_root();
101 return;
104 void unbecome_root(void)
106 if (shim.unbecome_root) {
107 shim.unbecome_root();
109 return;