1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

opendb: only return delete_on_close on odb_get_delete_on_close()

metze
This commit is contained in:
Stefan Metzmacher 2008-02-27 22:16:55 +01:00
parent 73f12be7c6
commit e699633db2
4 changed files with 9 additions and 31 deletions

View File

@ -563,20 +563,20 @@ static NTSTATUS odb_ctdb_set_delete_on_close(struct odb_lock *lck, bool del_on_c
people still have the file open
*/
static NTSTATUS odb_ctdb_get_delete_on_close(struct odb_context *odb,
DATA_BLOB *key, bool *del_on_close,
int *open_count, char **path)
DATA_BLOB *key, bool *del_on_close)
{
NTSTATUS status;
struct opendb_file file;
struct odb_lock *lck;
(*del_on_close) = false;
lck = odb_lock(odb, odb, key);
NT_STATUS_HAVE_NO_MEMORY(lck);
status = odb_pull_record(lck, &file);
if (NT_STATUS_EQUAL(NT_STATUS_OBJECT_NAME_NOT_FOUND, status)) {
talloc_free(lck);
(*del_on_close) = false;
return NT_STATUS_OK;
}
if (!NT_STATUS_IS_OK(status)) {
@ -585,16 +585,6 @@ static NTSTATUS odb_ctdb_get_delete_on_close(struct odb_context *odb,
}
(*del_on_close) = file.delete_on_close;
if (open_count != NULL) {
(*open_count) = file.num_entries;
}
if (path != NULL) {
*path = talloc_strdup(odb, file.path);
NT_STATUS_HAVE_NO_MEMORY(*path);
if (file.num_entries == 1 && file.entries[0].delete_on_close) {
(*del_on_close) = true;
}
}
talloc_free(lck);

View File

@ -155,10 +155,9 @@ _PUBLIC_ NTSTATUS odb_set_delete_on_close(struct odb_lock *lck, bool del_on_clos
people still have the file open
*/
_PUBLIC_ NTSTATUS odb_get_delete_on_close(struct odb_context *odb,
DATA_BLOB *key, bool *del_on_close,
int *open_count, char **path)
DATA_BLOB *key, bool *del_on_close)
{
return ops->odb_get_delete_on_close(odb, key, del_on_close, open_count, path);
return ops->odb_get_delete_on_close(odb, key, del_on_close);
}

View File

@ -38,8 +38,7 @@ struct opendb_ops {
NTSTATUS (*odb_rename)(struct odb_lock *lck, const char *path);
NTSTATUS (*odb_set_delete_on_close)(struct odb_lock *lck, bool del_on_close);
NTSTATUS (*odb_get_delete_on_close)(struct odb_context *odb,
DATA_BLOB *key, bool *del_on_close,
int *open_count, char **path);
DATA_BLOB *key, bool *del_on_close);
NTSTATUS (*odb_can_open)(struct odb_lock *lck,
uint32_t stream_id, uint32_t share_access,
uint32_t access_mask, bool delete_on_close,

View File

@ -734,20 +734,20 @@ static NTSTATUS odb_tdb_set_delete_on_close(struct odb_lock *lck, bool del_on_cl
people still have the file open
*/
static NTSTATUS odb_tdb_get_delete_on_close(struct odb_context *odb,
DATA_BLOB *key, bool *del_on_close,
int *open_count, char **path)
DATA_BLOB *key, bool *del_on_close)
{
NTSTATUS status;
struct opendb_file file;
struct odb_lock *lck;
(*del_on_close) = false;
lck = odb_lock(odb, odb, key);
NT_STATUS_HAVE_NO_MEMORY(lck);
status = odb_pull_record(lck, &file);
if (NT_STATUS_EQUAL(NT_STATUS_OBJECT_NAME_NOT_FOUND, status)) {
talloc_free(lck);
(*del_on_close) = false;
return NT_STATUS_OK;
}
if (!NT_STATUS_IS_OK(status)) {
@ -756,16 +756,6 @@ static NTSTATUS odb_tdb_get_delete_on_close(struct odb_context *odb,
}
(*del_on_close) = file.delete_on_close;
if (open_count != NULL) {
(*open_count) = file.num_entries;
}
if (path != NULL) {
*path = talloc_strdup(odb, file.path);
NT_STATUS_HAVE_NO_MEMORY(*path);
if (file.num_entries == 1 && file.entries[0].delete_on_close) {
(*del_on_close) = true;
}
}
talloc_free(lck);