summaryrefslogtreecommitdiff
path: root/source3/smbd/oplock.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-01-09 14:02:18 +0100
committerStefan Metzmacher <metze@samba.org>2009-01-22 12:37:29 +0100
commit196028ab7b578526179d4fcff42a5d73ba07ccbb (patch)
tree554ea6ba2d01138fc5f85ac746a8720150fe2cde /source3/smbd/oplock.c
parent048f8dba141c2f9898aad67e09925f03394a946e (diff)
downloadsamba-196028ab7b578526179d4fcff42a5d73ba07ccbb.tar.gz
samba-196028ab7b578526179d4fcff42a5d73ba07ccbb.tar.bz2
samba-196028ab7b578526179d4fcff42a5d73ba07ccbb.zip
s3:smbd: restructure kernel oplocks code
This converts the irix oplocks code to use a fd event and removes the last special case for file descriptors for the main sys_select(). metze
Diffstat (limited to 'source3/smbd/oplock.c')
-rw-r--r--source3/smbd/oplock.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 3fd5afef22..e4b5016538 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -36,9 +36,9 @@ int32 get_number_of_exclusive_open_oplocks(void)
Return True if an oplock message is pending.
****************************************************************************/
-bool oplock_message_waiting(fd_set *fds)
+bool oplock_message_waiting(void)
{
- if (koplocks && koplocks->msg_waiting(fds)) {
+ if (koplocks && koplocks->ops->msg_waiting(koplocks)) {
return True;
}
@@ -52,7 +52,7 @@ bool oplock_message_waiting(fd_set *fds)
we're calling this in a shutting down state.
****************************************************************************/
-void process_kernel_oplocks(struct messaging_context *msg_ctx, fd_set *pfds)
+void process_kernel_oplocks(struct messaging_context *msg_ctx)
{
/*
* We need to check for kernel oplocks before going into the select
@@ -64,11 +64,11 @@ void process_kernel_oplocks(struct messaging_context *msg_ctx, fd_set *pfds)
return;
}
- while (koplocks->msg_waiting(pfds)) {
+ while (koplocks->ops->msg_waiting(koplocks)) {
files_struct *fsp;
char msg[MSG_SMB_KERNEL_BREAK_SIZE];
- fsp = koplocks->receive_message(pfds);
+ fsp = koplocks->ops->receive_message(koplocks);
if (fsp == NULL) {
DEBUG(3, ("Kernel oplock message announced, but none "
@@ -99,7 +99,7 @@ bool set_file_oplock(files_struct *fsp, int oplock_type)
if ((fsp->oplock_type != NO_OPLOCK) &&
(fsp->oplock_type != FAKE_LEVEL_II_OPLOCK) &&
koplocks &&
- !koplocks->set_oplock(fsp, oplock_type)) {
+ !koplocks->ops->set_oplock(koplocks, fsp, oplock_type)) {
return False;
}
@@ -129,7 +129,7 @@ void release_file_oplock(files_struct *fsp)
if ((fsp->oplock_type != NO_OPLOCK) &&
(fsp->oplock_type != FAKE_LEVEL_II_OPLOCK) &&
koplocks) {
- koplocks->release_oplock(fsp);
+ koplocks->ops->release_oplock(koplocks, fsp);
}
if (fsp->oplock_type == LEVEL_II_OPLOCK) {
@@ -161,7 +161,7 @@ void release_file_oplock(files_struct *fsp)
static void downgrade_file_oplock(files_struct *fsp)
{
if (koplocks) {
- koplocks->release_oplock(fsp);
+ koplocks->ops->release_oplock(koplocks, fsp);
}
fsp->oplock_type = LEVEL_II_OPLOCK;
exclusive_oplocks_open--;
@@ -227,19 +227,6 @@ bool downgrade_oplock(files_struct *fsp)
}
/****************************************************************************
- Return the fd (if any) used for receiving oplock notifications.
-****************************************************************************/
-
-int oplock_notify_fd(void)
-{
- if (koplocks) {
- return koplocks->notification_fd;
- }
-
- return -1;
-}
-
-/****************************************************************************
Set up an oplock break message.
****************************************************************************/
@@ -914,9 +901,9 @@ bool init_oplocks(struct messaging_context *msg_ctx)
if (lp_kernel_oplocks()) {
#if HAVE_KERNEL_OPLOCKS_IRIX
- koplocks = irix_init_kernel_oplocks();
+ koplocks = irix_init_kernel_oplocks(talloc_autofree_context());
#elif HAVE_KERNEL_OPLOCKS_LINUX
- koplocks = linux_init_kernel_oplocks();
+ koplocks = linux_init_kernel_oplocks(talloc_autofree_context());
#endif
}