}
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;
};
for (i=0; i<data->num_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;
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 };
/*******************************************************************
********************************************************************/
-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 =
/* 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;
* 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;
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 ++;
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];
}
/* 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,