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

s3:locking: simplify the non cluster case of brl_get_locks_readonly()

Pair-Programmed-With: Michael Adam <obnox@samba.org>

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Mar 18 13:00:51 CET 2011 on sn-devel-104
This commit is contained in:
Stefan Metzmacher 2011-03-17 10:08:56 +01:00
parent e8411d6f9f
commit 2f048e458b

View File

@ -1946,34 +1946,15 @@ struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp)
TALLOC_FREE(fsp->brlock_rec); TALLOC_FREE(fsp->brlock_rec);
br_lock = brl_get_locks_internal(talloc_tos(), fsp, false); br_lock = brl_get_locks_internal(talloc_tos(), fsp, true);
if (br_lock == NULL) { if (br_lock == NULL) {
return NULL; return NULL;
} }
fsp->brlock_seqnum = brlock_db->get_seqnum(brlock_db); fsp->brlock_seqnum = brlock_db->get_seqnum(brlock_db);
fsp->brlock_rec = talloc_zero(fsp, struct byte_range_lock); fsp->brlock_rec = talloc_move(fsp, &br_lock);
if (fsp->brlock_rec == NULL) {
goto fail;
}
fsp->brlock_rec->fsp = fsp;
fsp->brlock_rec->num_locks = br_lock->num_locks;
fsp->brlock_rec->read_only = true;
fsp->brlock_rec->key = br_lock->key;
fsp->brlock_rec->lock_data = (struct lock_struct *)
talloc_memdup(fsp->brlock_rec, br_lock->lock_data,
sizeof(struct lock_struct) * br_lock->num_locks);
if (fsp->brlock_rec->lock_data == NULL) {
goto fail;
}
TALLOC_FREE(br_lock);
return fsp->brlock_rec; return fsp->brlock_rec;
fail:
TALLOC_FREE(br_lock);
TALLOC_FREE(fsp->brlock_rec);
return NULL;
} }
struct brl_revalidate_state { struct brl_revalidate_state {