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

s3:smbstatus: add stream name to share_entry_forall()

Add stream name argument to share_entry_forall machinery so smbstatus
can print the stream name of a file.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11550

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2015-10-11 09:38:18 +02:00 committed by Jeremy Allison
parent d643aafe59
commit cd0c2a5eca
4 changed files with 30 additions and 11 deletions

View File

@ -202,7 +202,8 @@ 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 char *,
int share_entry_forall(int (*fn)(const struct share_mode_entry *,
const char *, const char *,
const char *, void *),
void *private_data);
bool share_mode_cleanup_disconnected(struct file_id id,

View File

@ -728,7 +728,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 char *service_path, const char *base_name,
const char *service_path,
const char *base_name,
const char *stream_name,
void *private_data);
void *private_data;
};
@ -744,7 +746,9 @@ static int share_entry_traverse_fn(struct file_id fid,
int ret;
ret = state->fn(&data->share_modes[i],
data->servicepath, data->base_name,
data->servicepath,
data->base_name,
data->stream_name,
state->private_data);
if (ret != 0) {
return ret;
@ -760,7 +764,8 @@ static int share_entry_traverse_fn(struct file_id fid,
********************************************************************/
int share_entry_forall(int (*fn)(const struct share_mode_entry *,
const char *, const char *, void *),
const char *, const char *,
const char *, void *),
void *private_data)
{
struct share_entry_forall_state state = {

View File

@ -80,7 +80,9 @@ struct share_conn_stat {
********************************************************************/
static int enum_file_fn(const struct share_mode_entry *e,
const char *sharepath, const char *fname,
const char *sharepath,
const char *fname,
const char *sname,
void *private_data)
{
struct file_enum_count *fenum =
@ -129,8 +131,9 @@ static int enum_file_fn(const struct share_mode_entry *e,
if ( strcmp( fname, "." ) == 0 ) {
fullpath = talloc_asprintf(fenum->ctx, "C:%s", sharepath );
} else {
fullpath = talloc_asprintf(fenum->ctx, "C:%s/%s",
sharepath, fname );
fullpath = talloc_asprintf(fenum->ctx, "C:%s/%s%s",
sharepath, fname,
sname ? sname : "");
}
if (!fullpath) {
return 0;
@ -829,7 +832,9 @@ static WERROR init_srv_sess_info_0(struct pipes_struct *p,
**********************************************************************/
static int count_sess_files_fn(const struct share_mode_entry *e,
const char *sharepath, const char *fname,
const char *sharepath,
const char *fname,
const char *sname,
void *data)
{
struct sess_file_info *info = data;
@ -954,7 +959,9 @@ static WERROR init_srv_sess_info_1(struct pipes_struct *p,
********************************************************************/
static int share_file_fn(const struct share_mode_entry *e,
const char *sharepath, const char *fname,
const char *sharepath,
const char *fname,
const char *sname,
void *data)
{
struct share_file_stat *sfs = data;
@ -2692,7 +2699,9 @@ struct enum_file_close_state {
};
static int enum_file_close_fn(const struct share_mode_entry *e,
const char *sharepath, const char *fname,
const char *sharepath,
const char *fname,
const char *sname,
void *private_data)
{
char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE];

View File

@ -117,6 +117,7 @@ static bool Ucrit_addPid( struct server_id pid )
static int print_share_mode(const struct share_mode_entry *e,
const char *sharepath,
const char *fname,
const char *sname,
void *dummy)
{
static int count;
@ -190,7 +191,10 @@ static int print_share_mode(const struct share_mode_entry *e,
d_printf("NONE ");
}
d_printf(" %s %s %s",sharepath, fname, time_to_asc((time_t)e->time.tv_sec));
d_printf(" %s %s%s %s",
sharepath, fname,
sname ? sname : "",
time_to_asc((time_t)e->time.tv_sec));
}
return 0;