summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-09-16 14:02:48 -0700
committerJeremy Allison <jra@samba.org>2013-10-08 14:42:40 -0700
commit0cc212385c4b622bb1fa5055cde87ab43de36e45 (patch)
treeb504b1a5b0772fbf57ee64be54d8410a312656c1
parentb8b7e855ce1fd4bfdd06addcb824396418025dc8 (diff)
downloadsamba-0cc212385c4b622bb1fa5055cde87ab43de36e45.tar.gz
samba-0cc212385c4b622bb1fa5055cde87ab43de36e45.tar.bz2
samba-0cc212385c4b622bb1fa5055cde87ab43de36e45.zip
smbd: Simplify set_share_mode
With the find_share_mode simplification we don't need fill_share_mode anymore. So this coalesces add_share_mode as well. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--source3/locking/locking.c45
1 files changed, 15 insertions, 30 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index d7ba65395d..b9db27cb86 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -693,14 +693,22 @@ bool share_mode_stale_pid(struct share_mode_data *d, uint32_t idx)
return true;
}
-/*******************************************************************
- Fill a share mode entry.
-********************************************************************/
-
-static void fill_share_mode_entry(struct share_mode_entry *e,
- files_struct *fsp,
- uid_t uid, uint64_t mid, uint16 op_type)
+bool set_share_mode(struct share_mode_lock *lck, files_struct *fsp,
+ uid_t uid, uint64_t mid, uint16 op_type)
{
+ struct share_mode_data *d = lck->data;
+ struct share_mode_entry *tmp, *e;
+
+ tmp = talloc_realloc(d, d->share_modes, struct share_mode_entry,
+ d->num_share_modes+1);
+ if (tmp == NULL) {
+ return false;
+ }
+ d->share_modes = tmp;
+ e = &d->share_modes[d->num_share_modes];
+ d->num_share_modes += 1;
+ d->modified = true;
+
ZERO_STRUCTP(e);
e->pid = messaging_server_id(fsp->conn->sconn->msg_ctx);
e->share_access = fsp->share_access;
@@ -715,33 +723,10 @@ static void fill_share_mode_entry(struct share_mode_entry *e,
e->uid = (uint32)uid;
e->flags = fsp->posix_open ? SHARE_MODE_FLAG_POSIX_OPEN : 0;
e->name_hash = fsp->name_hash;
-}
-
-static bool add_share_mode_entry(struct share_mode_data *d,
- const struct share_mode_entry *entry)
-{
- struct share_mode_entry *tmp;
- tmp = talloc_realloc(d, d->share_modes, struct share_mode_entry,
- d->num_share_modes+1);
- if (tmp == NULL) {
- return false;
- }
- d->share_modes = tmp;
- d->share_modes[d->num_share_modes] = *entry;
- d->num_share_modes += 1;
- d->modified = true;
return true;
}
-bool set_share_mode(struct share_mode_lock *lck, files_struct *fsp,
- uid_t uid, uint64_t mid, uint16 op_type)
-{
- struct share_mode_entry entry;
- fill_share_mode_entry(&entry, fsp, uid, mid, op_type);
- return add_share_mode_entry(lck->data, &entry);
-}
-
static struct share_mode_entry *find_share_mode_entry(
struct share_mode_lock *lck, files_struct *fsp)
{