From 94b320527eee0c7ba1d3818816e7d59cb863bf3f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 22 Aug 2013 08:49:07 +0000 Subject: smbd: Simplify find_oplock_types Signed-off-by: Volker Lendecke Reviewed-by: Michael Adam --- source3/smbd/open.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 53f8b8e093..c28d2a39fa 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1237,19 +1237,20 @@ static void find_oplock_types(files_struct *fsp, } for (i=0; idata->num_share_modes; i++) { - if (!is_valid_share_mode_entry(&lck->data->share_modes[i])) { + struct share_mode_entry *e = &lck->data->share_modes[i]; + + if (!is_valid_share_mode_entry(e)) { continue; } - if (lck->data->share_modes[i].op_type == NO_OPLOCK && - is_stat_open(lck->data->share_modes[i].access_mask)) { + if (e->op_type == NO_OPLOCK && is_stat_open(e->access_mask)) { /* We ignore stat opens in the table - they always have NO_OPLOCK and never get or cause breaks. JRA. */ continue; } - if (BATCH_OPLOCK_TYPE(lck->data->share_modes[i].op_type)) { + if (BATCH_OPLOCK_TYPE(e->op_type)) { /* batch - can only be one. */ if (share_mode_stale_pid(lck->data, i)) { DEBUG(10, ("Found stale batch oplock\n")); @@ -1258,10 +1259,10 @@ static void find_oplock_types(files_struct *fsp, if (*pp_ex_or_batch || *pp_batch || *got_level2 || *got_no_oplock) { smb_panic("Bad batch oplock entry."); } - *pp_batch = &lck->data->share_modes[i]; + *pp_batch = e; } - if (EXCLUSIVE_OPLOCK_TYPE(lck->data->share_modes[i].op_type)) { + if (EXCLUSIVE_OPLOCK_TYPE(e->op_type)) { if (share_mode_stale_pid(lck->data, i)) { DEBUG(10, ("Found stale duplicate oplock\n")); continue; @@ -1270,10 +1271,10 @@ static void find_oplock_types(files_struct *fsp, if (*pp_ex_or_batch || *got_level2 || *got_no_oplock) { smb_panic("Bad exclusive or batch oplock entry."); } - *pp_ex_or_batch = &lck->data->share_modes[i]; + *pp_ex_or_batch = e; } - if (LEVEL_II_OPLOCK_TYPE(lck->data->share_modes[i].op_type)) { + if (LEVEL_II_OPLOCK_TYPE(e->op_type)) { if (*pp_batch || *pp_ex_or_batch) { if (share_mode_stale_pid(lck->data, i)) { DEBUG(10, ("Found stale LevelII " @@ -1285,7 +1286,7 @@ static void find_oplock_types(files_struct *fsp, *got_level2 = true; } - if (lck->data->share_modes[i].op_type == NO_OPLOCK) { + if (e->op_type == NO_OPLOCK) { if (*pp_batch || *pp_ex_or_batch) { if (share_mode_stale_pid(lck->data, i)) { DEBUG(10, ("Found stale NO_OPLOCK " -- cgit