1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

opendb: add odb_update_oplock() call

metze
(This used to be commit df576d69c6981a4879a0e9447069fcfacb3588db)
This commit is contained in:
Stefan Metzmacher 2008-02-21 16:12:27 +01:00
parent 6cb9c1c61d
commit 71943b209b
4 changed files with 66 additions and 3 deletions

View File

@ -450,6 +450,19 @@ static NTSTATUS odb_ctdb_close_file(struct odb_lock *lck, void *file_handle)
return odb_push_record(lck, &file);
}
/*
update the oplock level of the client
*/
static NTSTATUS odb_ctdb_update_oplock(struct odb_lock *lck, void *file_handle,
uint32_t oplock_level)
{
/*
* as this file will went away and isn't used yet,
* copy the implementation from the tdb backend
* --metze
*/
return NT_STATUS_FOOBAR;
}
/*
remove a pending opendb entry
@ -628,7 +641,8 @@ static const struct opendb_ops opendb_ctdb_ops = {
.odb_rename = odb_ctdb_rename,
.odb_set_delete_on_close = odb_ctdb_set_delete_on_close,
.odb_get_delete_on_close = odb_ctdb_get_delete_on_close,
.odb_can_open = odb_ctdb_can_open
.odb_can_open = odb_ctdb_can_open,
.odb_update_oplock = odb_ctdb_update_oplock
};

View File

@ -170,3 +170,9 @@ _PUBLIC_ NTSTATUS odb_can_open(struct odb_lock *lck,
{
return ops->odb_can_open(lck, share_access, create_options, access_mask);
}
_PUBLIC_ NTSTATUS odb_update_oplock(struct odb_lock *lck, void *file_handle,
uint32_t oplock_level)
{
return ops->odb_update_oplock(lck, file_handle, oplock_level);
}

View File

@ -41,6 +41,8 @@ struct opendb_ops {
NTSTATUS (*odb_can_open)(struct odb_lock *lck,
uint32_t share_access, uint32_t create_options,
uint32_t access_mask);
NTSTATUS (*odb_update_oplock)(struct odb_lock *lck, void *file_handle,
uint32_t oplock_level);
};
struct opendb_oplock_break {

View File

@ -2,7 +2,8 @@
Unix SMB/CIFS implementation.
Copyright (C) Andrew Tridgell 2004
Copyright (C) Stefan Metzmacher 2008
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
@ -463,6 +464,45 @@ static NTSTATUS odb_tdb_close_file(struct odb_lock *lck, void *file_handle)
return odb_push_record(lck, &file);
}
/*
update the oplock level of the client
*/
static NTSTATUS odb_tdb_update_oplock(struct odb_lock *lck, void *file_handle,
uint32_t oplock_level)
{
struct odb_context *odb = lck->odb;
struct opendb_file file;
int i;
NTSTATUS status;
status = odb_pull_record(lck, &file);
NT_STATUS_NOT_OK_RETURN(status);
/* find the entry, and update it */
for (i=0;i<file.num_entries;i++) {
if (file_handle == file.entries[i].file_handle &&
cluster_id_equal(&odb->ntvfs_ctx->server_id, &file.entries[i].server)) {
file.entries[i].oplock_level = oplock_level;
break;
}
}
if (i == file.num_entries) {
return NT_STATUS_UNSUCCESSFUL;
}
/* send any pending notifications, removing them once sent */
for (i=0;i<file.num_pending;i++) {
messaging_send_ptr(odb->ntvfs_ctx->msg_ctx,
file.pending[i].server,
MSG_PVFS_RETRY_OPEN,
file.pending[i].notify_ptr);
}
file.num_pending = 0;
return odb_push_record(lck, &file);
}
/*
remove a pending opendb entry
@ -641,7 +681,8 @@ static const struct opendb_ops opendb_tdb_ops = {
.odb_rename = odb_tdb_rename,
.odb_set_delete_on_close = odb_tdb_set_delete_on_close,
.odb_get_delete_on_close = odb_tdb_get_delete_on_close,
.odb_can_open = odb_tdb_can_open
.odb_can_open = odb_tdb_can_open,
.odb_update_oplock = odb_tdb_update_oplock
};