diff --git a/source3/locking/proto.h b/source3/locking/proto.h index 403729c934a..b615a4ae6d0 100644 --- a/source3/locking/proto.h +++ b/source3/locking/proto.h @@ -212,10 +212,10 @@ int share_mode_forall(int (*fn)(struct file_id fid, const struct share_mode_data *data, void *private_data), void *private_data); -int share_entry_forall(int (*fn)(const struct share_mode_entry *, - const struct file_id *id, - const char *, const char *, - const char *, void *), +int share_entry_forall(int (*fn)(struct file_id fid, + const struct share_mode_data *data, + const struct share_mode_entry *entry, + void *private_data), void *private_data); bool share_mode_cleanup_disconnected(struct file_id id, uint64_t open_persistent_id); diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index fce0c335ec3..f62a3b4ff3d 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -878,11 +878,9 @@ int share_mode_forall(int (*fn)(struct file_id fid, } struct share_entry_forall_state { - int (*fn)(const struct share_mode_entry *e, - const struct file_id *id, - const char *service_path, - const char *base_name, - const char *stream_name, + int (*fn)(struct file_id fid, + const struct share_mode_data *data, + const struct share_mode_entry *entry, void *private_data); void *private_data; }; @@ -897,11 +895,9 @@ static int share_entry_traverse_fn(struct file_id fid, for (i=0; inum_share_modes; i++) { int ret; - ret = state->fn(&data->share_modes[i], - &data->id, - data->servicepath, - data->base_name, - data->stream_name, + ret = state->fn(fid, + data, + &data->share_modes[i], state->private_data); if (ret != 0) { return ret; @@ -916,11 +912,11 @@ static int share_entry_traverse_fn(struct file_id fid, share mode system. ********************************************************************/ -int share_entry_forall(int (*fn)(const struct share_mode_entry *, - const struct file_id *id, - const char *, const char *, - const char *, void *), - void *private_data) +int share_entry_forall(int (*fn)(struct file_id fid, + const struct share_mode_data *data, + const struct share_mode_entry *entry, + void *private_data), + void *private_data) { struct share_entry_forall_state state = { .fn = fn, .private_data = private_data }; diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index e1963a40a0c..7138f126be6 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -81,11 +81,9 @@ struct share_conn_stat { /******************************************************************* ********************************************************************/ -static int enum_file_fn(const struct share_mode_entry *e, - const struct file_id *id, - const char *sharepath, - const char *fname, - const char *sname, +static int enum_file_fn(struct file_id id, + const struct share_mode_data *d, + const struct share_mode_entry *e, void *private_data) { struct file_enum_count *fenum = @@ -124,19 +122,25 @@ static int enum_file_fn(const struct share_mode_entry *e, /* need to count the number of locks on a file */ ZERO_STRUCT( fsp ); - fsp.file_id = *id; + fsp.file_id = id; if ( (brl = brl_get_locks(talloc_tos(), &fsp)) != NULL ) { num_locks = brl_num_locks(brl); TALLOC_FREE(brl); } - if ( strcmp( fname, "." ) == 0 ) { - fullpath = talloc_asprintf(fenum->ctx, "C:%s", sharepath ); + if ( strcmp(d->base_name, "." ) == 0 ) { + fullpath = talloc_asprintf( + fenum->ctx, + "C:%s", + d->servicepath); } else { - fullpath = talloc_asprintf(fenum->ctx, "C:%s/%s%s", - sharepath, fname, - sname ? sname : ""); + fullpath = talloc_asprintf( + fenum->ctx, + "C:%s/%s%s", + d->servicepath, + d->base_name, + (d->stream_name != NULL) ? d->stream_name : ""); } if (!fullpath) { return 0; @@ -841,11 +845,9 @@ static WERROR init_srv_sess_info_0(struct pipes_struct *p, * find out the session on which this file is open and bump up its count **********************************************************************/ -static int count_sess_files_fn(const struct share_mode_entry *e, - const struct file_id *id, - const char *sharepath, - const char *fname, - const char *sname, +static int count_sess_files_fn(struct file_id fid, + const struct share_mode_data *d, + const struct share_mode_entry *e, void *data) { struct sess_file_info *info = data; @@ -969,18 +971,16 @@ static WERROR init_srv_sess_info_1(struct pipes_struct *p, find the share connection on which this open exists. ********************************************************************/ -static int share_file_fn(const struct share_mode_entry *e, - const struct file_id *id, - const char *sharepath, - const char *fname, - const char *sname, +static int share_file_fn(struct file_id fid, + const struct share_mode_data *d, + const struct share_mode_entry *e, void *data) { struct share_file_stat *sfs = data; uint32_t i; uint32_t offset = sfs->total_entries - sfs->resp_entries; - if (strequal(sharepath, sfs->in_sharepath)) { + if (strequal(d->servicepath, sfs->in_sharepath)) { for (i=0; i < sfs->resp_entries; i++) { if (serverid_equal(&e->pid, &sfs->svrid_arr[offset + i])) { sfs->netconn_arr[i].num_open ++; @@ -2681,11 +2681,9 @@ struct enum_file_close_state { struct messaging_context *msg_ctx; }; -static int enum_file_close_fn(const struct share_mode_entry *e, - const struct file_id *id, - const char *sharepath, - const char *fname, - const char *sname, +static int enum_file_close_fn(struct file_id id, + const struct share_mode_data *d, + const struct share_mode_entry *e, void *private_data) { char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE]; @@ -2702,10 +2700,10 @@ static int enum_file_close_fn(const struct share_mode_entry *e, } /* Ok - send the close message. */ - DBG_DEBUG("request to close file %s, %s\n", sharepath, - share_mode_str(talloc_tos(), 0, id, e)); + DBG_DEBUG("request to close file %s, %s\n", d->servicepath, + share_mode_str(talloc_tos(), 0, &id, e)); - share_mode_entry_to_message(msg, id, e); + share_mode_entry_to_message(msg, &id, e); state->r->out.result = ntstatus_to_werror( messaging_send_buf(state->msg_ctx, diff --git a/source3/utils/status.c b/source3/utils/status.c index d04efedee3f..9f8729c2910 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -116,12 +116,10 @@ static bool Ucrit_addPid( struct server_id pid ) return True; } -static int print_share_mode(const struct share_mode_entry *e, - const struct file_id *id, - const char *sharepath, - const char *fname, - const char *sname, - void *dummy) +static int print_share_mode(struct file_id fid, + const struct share_mode_data *d, + const struct share_mode_entry *e, + void *private_data) { static int count; @@ -195,8 +193,8 @@ static int print_share_mode(const struct share_mode_entry *e, } d_printf(" %s %s%s %s", - sharepath, fname, - sname ? sname : "", + d->servicepath, d->base_name, + (d->stream_name != NULL) ? d->stream_name : "", time_to_asc((time_t)e->time.tv_sec)); }