From: Michael Adam Date: Thu, 15 Jan 2009 21:27:52 +0000 (+0100) Subject: s3: make better use of ccache by not including version.h in every C-file. X-Git-Tag: samba-4.0.0alpha6~90 X-Git-Url: http://git.samba.org/samba.git/?p=ira%2Fwip.git;a=commitdiff_plain;h=39ec8791f874a0a9a853aa1497099a57c1aa1dbc s3: make better use of ccache by not including version.h in every C-file. version.h changes rather frequently. Since it is included via includes.h, this means each C file will be a cache miss. This applies to the following situations: * When building a new package with a new Samba version * building in a git branch after calling mkversion.sh after a new commit (i.e. virtually always) This patch improves the situation in the following way: * remove inlude "version.h" from includes.h * Use samba_version_string() instead of SAMBA_VERSION_STRING in files that use no other macro from version.h instead of SAMBA_VERSION_STRING. * explicitly include "version.h" in those files that use more macros from "version.h" than just SAMBA_VERSION_STRING. Michael --- diff --git a/source3/client/client.c b/source3/client/client.c index 7172bf98a95..2f9e3c0d497 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -4974,7 +4974,7 @@ static int do_message_op(struct user_auth_info *auth_info) cli_cm_set_credentials(auth_info); - DEBUG(3,("Client started (version %s).\n", SAMBA_VERSION_STRING)); + DEBUG(3,("Client started (version %s).\n", samba_version_string())); if (tar_type) { if (cmdstr) diff --git a/source3/include/includes.h b/source3/include/includes.h index 10d37eefd95..63b567d419d 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -594,7 +594,6 @@ struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx); #include "dynconfig.h" #include "util_getent.h" #include "debugparse.h" -#include "version.h" #include "privileges.h" #include "messages.h" #include "locking.h" diff --git a/source3/lib/fault.c b/source3/lib/fault.c index c24fea1ca91..a1530987f3b 100644 --- a/source3/lib/fault.c +++ b/source3/lib/fault.c @@ -38,7 +38,7 @@ static void fault_report(int sig) counter++; DEBUGSEP(0); - DEBUG(0,("INTERNAL ERROR: Signal %d in pid %d (%s)",sig,(int)sys_getpid(),SAMBA_VERSION_STRING)); + DEBUG(0,("INTERNAL ERROR: Signal %d in pid %d (%s)",sig,(int)sys_getpid(),samba_version_string())); DEBUG(0,("\nPlease read the Trouble-Shooting section of the Samba3-HOWTO\n")); DEBUG(0,("\nFrom: http://www.samba.org/samba/docs/Samba3-HOWTO.pdf\n")); DEBUGSEP(0); diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c index 115133089c7..e14477c9799 100644 --- a/source3/lib/popt_common.c +++ b/source3/lib/popt_common.c @@ -73,7 +73,7 @@ static void popt_common_callback(poptContext con, if (reason == POPT_CALLBACK_REASON_POST) { if (PrintSambaVersionString) { - printf( "Version %s\n", SAMBA_VERSION_STRING); + printf( "Version %s\n", samba_version_string()); exit(0); } diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index acfe55d7617..b4f5f70fa05 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -659,7 +659,7 @@ char *alloc_sub_basic(const char *smb_name, const char *domain_name, : ""); break; case 'v' : - a_string = realloc_string_sub(a_string, "%v", SAMBA_VERSION_STRING); + a_string = realloc_string_sub(a_string, "%v", samba_version_string()); break; case 'w' : a_string = realloc_string_sub(a_string, "%w", lp_winbind_separator()); diff --git a/source3/lib/version.c b/source3/lib/version.c index 55fb53c5db7..e81f463586e 100644 --- a/source3/lib/version.c +++ b/source3/lib/version.c @@ -19,7 +19,7 @@ */ #include "includes.h" -#include +#include "version.h" const char *samba_version_string(void) { diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 18743aad552..be6943bad97 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -470,7 +470,7 @@ static ADS_STATUS libnet_join_set_os_attributes(TALLOC_CTX *mem_ctx, return ADS_ERROR(LDAP_NO_MEMORY); } - os_sp = talloc_asprintf(mem_ctx, "Samba %s", SAMBA_VERSION_STRING); + os_sp = talloc_asprintf(mem_ctx, "Samba %s", samba_version_string()); if (!os_sp) { return ADS_ERROR(LDAP_NO_MEMORY); } diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index b446879140e..9e4266de5a5 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -224,7 +224,7 @@ static NTSTATUS cli_session_setup_plaintext(struct cli_state *cli, char *p; fstring lanman; - fstr_sprintf( lanman, "Samba %s", SAMBA_VERSION_STRING); + fstr_sprintf( lanman, "Samba %s", samba_version_string()); memset(cli->outbuf, '\0', smb_size); cli_set_message(cli->outbuf,13,0,True); diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c index becee17f655..66329e28605 100644 --- a/source3/libsmb/libsmb_context.c +++ b/source3/libsmb/libsmb_context.c @@ -619,7 +619,7 @@ smbc_init_context(SMBCCTX *context) const char * smbc_version(void) { - return SAMBA_VERSION_STRING; + return samba_version_string(); } diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 659db85e69f..10d6fe23782 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -847,7 +847,7 @@ static bool open_sockets(bool isdaemon, int port) reopen_logs(); - DEBUG(0,("nmbd version %s started.\n", SAMBA_VERSION_STRING)); + DEBUG(0,("nmbd version %s started.\n", samba_version_string())); DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE)); if (!lp_load_initial_only(get_dyn_CONFIGFILE())) { diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index a874ce29d85..6438888942f 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -4773,7 +4773,7 @@ static void init_globals(bool first_time_only) string_set(&Globals.szPidDir, get_dyn_PIDDIR()); string_set(&Globals.szSocketAddress, "0.0.0.0"); - if (asprintf(&s, "Samba %s", SAMBA_VERSION_STRING) < 0) { + if (asprintf(&s, "Samba %s", samba_version_string()) < 0) { smb_panic("init_globals: ENOMEM"); } string_set(&Globals.szServerString, s); diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 6be8e9b83e7..00e939e2b80 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -1231,7 +1231,7 @@ extern void build_options(bool screen); reopen_logs(); - DEBUG(0,("smbd version %s started.\n", SAMBA_VERSION_STRING)); + DEBUG(0,("smbd version %s started.\n", samba_version_string())); DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE)); DEBUG(2,("uid=%d gid=%d euid=%d egid=%d\n", diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index b8e0c86833e..a2ad56bea16 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -71,7 +71,7 @@ static int push_signature(uint8 **outbuf) if (tmp == -1) return -1; result += tmp; - if (asprintf(&lanman, "Samba %s", SAMBA_VERSION_STRING) != -1) { + if (asprintf(&lanman, "Samba %s", samba_version_string()) != -1) { tmp = message_push_string(outbuf, lanman, STR_TERMINATE); SAFE_FREE(lanman); } diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 9644e3d1ad0..52340d53703 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -24,6 +24,7 @@ */ #include "includes.h" +#include "version.h" #include "smbd/globals.h" extern enum protocol_types Protocol; diff --git a/source3/utils/status.c b/source3/utils/status.c index 1a66af949a1..590444a42f6 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -406,7 +406,7 @@ static int traverse_sessionid(struct db_record *db, void *state) if (!db) { d_printf("sessionid.tdb not initialised\n"); } else { - d_printf("\nSamba version %s\n",SAMBA_VERSION_STRING); + d_printf("\nSamba version %s\n",samba_version_string()); d_printf("PID Username Group Machine \n"); d_printf("-------------------------------------------------------------------\n"); diff --git a/source3/web/statuspage.c b/source3/web/statuspage.c index e684a075c25..cb8485a6ebb 100644 --- a/source3/web/statuspage.c +++ b/source3/web/statuspage.c @@ -345,7 +345,7 @@ void status_page(void) printf("\n"); - printf("", _("version:"), SAMBA_VERSION_STRING); + printf("", _("version:"), samba_version_string()); fflush(stdout); printf("\n", _("smbd:"), smbd_running()?_("running"):_("not running")); diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 8f94f8ad70f..821812925c6 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -1121,7 +1121,7 @@ int main(int argc, char **argv, char **envp) setup_logging("winbindd", log_stdout); reopen_logs(); - DEBUG(0,("winbindd version %s started.\n", SAMBA_VERSION_STRING)); + DEBUG(0,("winbindd version %s started.\n", samba_version_string())); DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE)); if (!lp_load_initial_only(get_dyn_CONFIGFILE())) { diff --git a/source3/winbindd/winbindd_misc.c b/source3/winbindd/winbindd_misc.c index 0e34615c3a2..737fd08d2a2 100644 --- a/source3/winbindd/winbindd_misc.c +++ b/source3/winbindd/winbindd_misc.c @@ -742,7 +742,7 @@ void winbindd_info(struct winbindd_cli_state *state) DEBUG(3, ("[%5lu]: request misc info\n", (unsigned long)state->pid)); state->response.data.info.winbind_separator = *lp_winbind_separator(); - fstrcpy(state->response.data.info.samba_version, SAMBA_VERSION_STRING); + fstrcpy(state->response.data.info.samba_version, samba_version_string()); request_ok(state); }
%s%s
%s%s
%s%s