From 242927bd5cae1d2ab8739b1c424e702ab97726b5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 5 Mar 2007 20:09:27 +0000 Subject: r21706: get_delete_on_close_flag() is the perfect candidate for tdb_parse_record() (This used to be commit b73685d20751ac343faab79332552cd7ee92d831) --- source3/locking/locking.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'source3/locking') diff --git a/source3/locking/locking.c b/source3/locking/locking.c index ffac43aff5..7326ea08c0 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -858,15 +858,29 @@ BOOL rename_share_filename(struct share_mode_lock *lck, return True; } -BOOL get_delete_on_close_flag(SMB_DEV_T dev, SMB_INO_T inode) +static int pull_delete_on_close_flag(TDB_DATA key, TDB_DATA dbuf, + void *private_data) { - BOOL result; - struct share_mode_lock *lck = get_share_mode_lock(NULL, dev, inode, NULL, NULL); - if (!lck) { - return False; + BOOL *result = (BOOL *)private_data; + struct locking_data *data; + + if (dbuf.dsize < sizeof(struct locking_data)) { + smb_panic("PANIC: parse_share_modes: buffer too short.\n"); } - result = lck->delete_on_close; - TALLOC_FREE(lck); + + data = (struct locking_data *)dbuf.dptr; + + *result = data->u.s.delete_on_close; + return 0; +} + +BOOL get_delete_on_close_flag(SMB_DEV_T dev, SMB_INO_T inode) +{ + TDB_DATA key = locking_key(dev, inode); + BOOL result = False; + + tdb_parse_record(tdb, key, pull_delete_on_close_flag, + (void *)&result); return result; } -- cgit