Skip to content

Commit

Permalink
s3-profile: reduce dependencies of smbprofile.h
Browse files Browse the repository at this point in the history
Signed-off-by: Uri Simchoni <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
  • Loading branch information
urisimchoni authored and jrasamba committed Mar 28, 2016
1 parent 644e697 commit f1c84e4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion source3/include/smbprofile.h
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,9 @@ static inline void smbprofile_cleanup(pid_t pid, pid_t dst)
#endif /* WITH_PROFILE */

/* The following definitions come from profile/profile.c */
struct server_id;

void set_profile_level(int level, struct server_id src);
void set_profile_level(int level, const struct server_id *src);

struct messaging_context;
bool profile_setup(struct messaging_context *msg_ctx, bool rdonly);
Expand Down
12 changes: 6 additions & 6 deletions source3/profile/profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct smbprofile_global_state smbprofile_state;
/****************************************************************************
Set a profiling level.
****************************************************************************/
void set_profile_level(int level, struct server_id src)
void set_profile_level(int level, const struct server_id *src)
{
SMB_ASSERT(smbprofile_state.internal.db != NULL);

Expand All @@ -48,25 +48,25 @@ void set_profile_level(int level, struct server_id src)
smbprofile_state.config.do_count = false;
smbprofile_state.config.do_times = false;
DEBUG(1,("INFO: Profiling turned OFF from pid %d\n",
(int)procid_to_pid(&src)));
(int)procid_to_pid(src)));
break;
case 1: /* turn on counter profiling only */
smbprofile_state.config.do_count = true;
smbprofile_state.config.do_times = false;
DEBUG(1,("INFO: Profiling counts turned ON from pid %d\n",
(int)procid_to_pid(&src)));
(int)procid_to_pid(src)));
break;
case 2: /* turn on complete profiling */
smbprofile_state.config.do_count = true;
smbprofile_state.config.do_times = true;
DEBUG(1,("INFO: Full profiling turned ON from pid %d\n",
(int)procid_to_pid(&src)));
(int)procid_to_pid(src)));
break;
case 3: /* reset profile values */
ZERO_STRUCT(profile_p->values);
tdb_wipe_all(smbprofile_state.internal.db->tdb);
DEBUG(1,("INFO: Profiling values cleared from pid %d\n",
(int)procid_to_pid(&src)));
(int)procid_to_pid(src)));
break;
}
}
Expand All @@ -88,7 +88,7 @@ static void profile_message(struct messaging_context *msg_ctx,
}

memcpy(&level, data->data, sizeof(level));
set_profile_level(level, src);
set_profile_level(level, &src);
}

/****************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion source3/profile/profile_dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ bool profile_setup(struct messaging_context *msg_ctx, bool rdonly)
return true;
}

void set_profile_level(int level, struct server_id src)
void set_profile_level(int level, const struct server_id *src)
{
DEBUG(1,("INFO: Profiling support unavailable in this build.\n"));
}
4 changes: 3 additions & 1 deletion source3/smbd/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,7 @@ extern void build_options(bool screen);
int opt;
poptContext pc;
bool print_build_options = False;
struct server_id main_server_id = {0};
enum {
OPT_DAEMON = 1000,
OPT_INTERACTIVE,
Expand Down Expand Up @@ -1444,7 +1445,8 @@ extern void build_options(bool screen);
} else {
profiling_level = lp_smbd_profiling_level();
}
set_profile_level(profiling_level, messaging_server_id(msg_ctx));
main_server_id = messaging_server_id(msg_ctx);
set_profile_level(profiling_level, &main_server_id);

if (!is_daemon && !is_a_socket(0)) {
if (!interactive) {
Expand Down

0 comments on commit f1c84e4

Please sign in to comment.