The HIS_STATS_? features have always bothered me...because we used to differentiate stats by case-sensitive single characters, the features system had to use case-sensitive matching when looking up the feature name. Now that /stats has long names, it would make sense to rename all those case-sensitively named features to names that match the long names of the /stats they're controlling. This patch not only does that renaming, but also adds support for deprecated aliases, allowing us to release a backwards-compatible server that warns users that they need to update their .conf. Note that I was too lazy to update the documentation--oops! Anyway, I didn't want to commit without checking with Entrope first, since he's doing the release engineering for the .12 release, so figured I'd post it here first for him to review...
? db ? his_stats_rename.diff Index: ChangeLog =================================================================== RCS file: /cvsroot/undernet-ircu/ircu2.10/ChangeLog,v retrieving revision 1.710.2.106 diff -u -r1.710.2.106 ChangeLog --- ChangeLog 31 May 2006 02:43:00 -0000 1.710.2.106 +++ ChangeLog 31 May 2006 05:21:58 -0000 @@ -1,3 +1,16 @@ +2006-05-31 Kevin L. Mitchell <[EMAIL PROTECTED]> + + * ircd/s_stats.c: use new names for controlling features + + * ircd/ircd_features.c: add support for deprecated aliases for + features--allows a feature to be accessed by user or .conf by two + names, but warns when the deprecated name is used; change all + HIS_STATS_? features to aliases for the new names; remove + unnecessary HIS_STATS_M + + * include/ircd_features.h: add features covering new names for + FEAT_HIS_STATS_?; remove unnecessary FEAT_HIS_STATS_M + 2006-05-28 Michael Poole <[EMAIL PROTECTED]> * doc/readme.features (MAXBANS): Update default value. Index: include/ircd_features.h =================================================================== RCS file: /cvsroot/undernet-ircu/ircu2.10/include/ircd_features.h,v retrieving revision 1.38.2.5 diff -u -r1.38.2.5 ircd_features.h --- include/ircd_features.h 16 Feb 2006 03:49:54 -0000 1.38.2.5 +++ include/ircd_features.h 31 May 2006 05:21:58 -0000 @@ -108,33 +108,59 @@ FEAT_HIS_LINKS, FEAT_HIS_TRACE, FEAT_HIS_STATS_a, + FEAT_HIS_STATS_NAMESERVERS, FEAT_HIS_STATS_c, + FEAT_HIS_STATS_CONNECT, FEAT_HIS_STATS_d, + FEAT_HIS_STATS_CRULES, FEAT_HIS_STATS_e, + FEAT_HIS_STATS_ENGINE, FEAT_HIS_STATS_f, + FEAT_HIS_STATS_FEATURES, FEAT_HIS_STATS_g, + FEAT_HIS_STATS_GLINES, FEAT_HIS_STATS_i, + FEAT_HIS_STATS_ACCESS, FEAT_HIS_STATS_j, + FEAT_HIS_STATS_HISTOGRAM, FEAT_HIS_STATS_J, + FEAT_HIS_STATS_JUPES, FEAT_HIS_STATS_k, + FEAT_HIS_STATS_KLINES, FEAT_HIS_STATS_l, + FEAT_HIS_STATS_LINKS, FEAT_HIS_STATS_L, - FEAT_HIS_STATS_M, + FEAT_HIS_STATS_MODULES, FEAT_HIS_STATS_m, + FEAT_HIS_STATS_COMMANDS, FEAT_HIS_STATS_o, + FEAT_HIS_STATS_OPERATORS, FEAT_HIS_STATS_p, + FEAT_HIS_STATS_PORTS, FEAT_HIS_STATS_q, + FEAT_HIS_STATS_QUARANTINES, FEAT_HIS_STATS_R, + FEAT_HIS_STATS_MAPPINGS, FEAT_HIS_STATS_r, + FEAT_HIS_STATS_USAGE, FEAT_HIS_STATS_t, + FEAT_HIS_STATS_LOCALS, FEAT_HIS_STATS_T, + FEAT_HIS_STATS_MOTDS, FEAT_HIS_STATS_u, + FEAT_HIS_STATS_UPTIME, FEAT_HIS_STATS_U, + FEAT_HIS_STATS_UWORLD, FEAT_HIS_STATS_v, + FEAT_HIS_STATS_VSERVERS, FEAT_HIS_STATS_w, + FEAT_HIS_STATS_USERLOAD, FEAT_HIS_STATS_x, + FEAT_HIS_STATS_MEMUSAGE, FEAT_HIS_STATS_y, + FEAT_HIS_STATS_CLASSES, FEAT_HIS_STATS_z, + FEAT_HIS_STATS_MEMORY, FEAT_HIS_STATS_IAUTH, FEAT_HIS_WHOIS_SERVERNAME, FEAT_HIS_WHOIS_IDLETIME, Index: ircd/ircd_features.c =================================================================== RCS file: /cvsroot/undernet-ircu/ircu2.10/ircd/ircd_features.c,v retrieving revision 1.50.2.5 diff -u -r1.50.2.5 ircd_features.c --- ircd/ircd_features.c 16 Feb 2006 03:49:54 -0000 1.50.2.5 +++ ircd/ircd_features.c 31 May 2006 05:21:58 -0000 @@ -238,6 +238,7 @@ #define FEAT_INT 0x0001 /**< set if entry contains an integer value */ #define FEAT_BOOL 0x0002 /**< set if entry contains a boolean value */ #define FEAT_STR 0x0003 /**< set if entry contains a string value */ +#define FEAT_ALIAS 0x0004 /**< set if entry is alias for another entry */ #define FEAT_MASK 0x000f /**< possible value types */ #define FEAT_MARK 0x0010 /**< set if entry has been changed */ @@ -266,6 +267,10 @@ #define F_S(type, flags, v_str, notify) \ { FEAT_ ## type, #type, FEAT_STR | (flags), 0, 0, 0, (v_str), \ 0, 0, 0, (notify), 0, 0, 0 } +/** Declare a feature as an alias for another feature. */ +#define F_A(type, alias) \ + { FEAT_ ## type, #type, FEAT_ALIAS, 0, FEAT_ ## alias, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0 } /** Table of feature descriptions. */ static struct FeatureDesc { @@ -360,34 +365,60 @@ F_B(HIS_MAP, 0, 1, 0), F_B(HIS_LINKS, 0, 1, 0), F_B(HIS_TRACE, 0, 1, 0), - F_B(HIS_STATS_a, 0, 1, 0), - F_B(HIS_STATS_c, 0, 1, 0), - F_B(HIS_STATS_d, 0, 1, 0), - F_B(HIS_STATS_e, 0, 1, 0), - F_B(HIS_STATS_f, 0, 1, 0), - F_B(HIS_STATS_g, 0, 1, 0), - F_B(HIS_STATS_i, 0, 1, 0), - F_B(HIS_STATS_j, 0, 1, 0), - F_B(HIS_STATS_J, 0, 1, 0), - F_B(HIS_STATS_k, 0, 1, 0), - F_B(HIS_STATS_l, 0, 1, 0), - F_B(HIS_STATS_L, 0, 1, 0), - F_B(HIS_STATS_M, 0, 1, 0), - F_B(HIS_STATS_m, 0, 1, 0), - F_B(HIS_STATS_o, 0, 1, 0), - F_B(HIS_STATS_p, 0, 1, 0), - F_B(HIS_STATS_q, 0, 1, 0), - F_B(HIS_STATS_R, 0, 1, 0), - F_B(HIS_STATS_r, 0, 1, 0), - F_B(HIS_STATS_t, 0, 1, 0), - F_B(HIS_STATS_T, 0, 1, 0), - F_B(HIS_STATS_u, 0, 0, 0), - F_B(HIS_STATS_U, 0, 1, 0), - F_B(HIS_STATS_v, 0, 1, 0), - F_B(HIS_STATS_w, 0, 0, 0), - F_B(HIS_STATS_x, 0, 1, 0), - F_B(HIS_STATS_y, 0, 1, 0), - F_B(HIS_STATS_z, 0, 1, 0), + F_A(HIS_STATS_a, HIS_STATS_NAMESERVERS), + F_B(HIS_STATS_NAMESERVERS, 0, 1, 0), + F_A(HIS_STATS_c, HIS_STATS_CONNECT), + F_B(HIS_STATS_CONNECT, 0, 1, 0), + F_A(HIS_STATS_d, HIS_STATS_CRULES), + F_B(HIS_STATS_CRULES, 0, 1, 0), + F_A(HIS_STATS_e, HIS_STATS_ENGINE), + F_B(HIS_STATS_ENGINE, 0, 1, 0), + F_A(HIS_STATS_f, HIS_STATS_FEATURES), + F_B(HIS_STATS_FEATURES, 0, 1, 0), + F_A(HIS_STATS_g, HIS_STATS_GLINES), + F_B(HIS_STATS_GLINES, 0, 1, 0), + F_A(HIS_STATS_i, HIS_STATS_ACCESS), + F_B(HIS_STATS_ACCESS, 0, 1, 0), + F_A(HIS_STATS_j, HIS_STATS_HISTOGRAM), + F_B(HIS_STATS_HISTOGRAM, 0, 1, 0), + F_A(HIS_STATS_J, HIS_STATS_JUPES), + F_B(HIS_STATS_JUPES, 0, 1, 0), + F_A(HIS_STATS_k, HIS_STATS_KLINES), + F_B(HIS_STATS_KLINES, 0, 1, 0), + F_A(HIS_STATS_l, HIS_STATS_LINKS), + F_B(HIS_STATS_LINKS, 0, 1, 0), + F_A(HIS_STATS_L, HIS_STATS_MODULES), + F_B(HIS_STATS_MODULES, 0, 1, 0), + F_A(HIS_STATS_m, HIS_STATS_COMMANDS), + F_B(HIS_STATS_COMMANDS, 0, 1, 0), + F_A(HIS_STATS_o, HIS_STATS_OPERATORS), + F_B(HIS_STATS_OPERATORS, 0, 1, 0), + F_A(HIS_STATS_p, HIS_STATS_PORTS), + F_B(HIS_STATS_PORTS, 0, 1, 0), + F_A(HIS_STATS_q, HIS_STATS_QUARANTINES), + F_B(HIS_STATS_QUARANTINES, 0, 1, 0), + F_A(HIS_STATS_R, HIS_STATS_MAPPINGS), + F_B(HIS_STATS_MAPPINGS, 0, 1, 0), + F_A(HIS_STATS_r, HIS_STATS_USAGE), + F_B(HIS_STATS_USAGE, 0, 1, 0), + F_A(HIS_STATS_t, HIS_STATS_LOCALS), + F_B(HIS_STATS_LOCALS, 0, 1, 0), + F_A(HIS_STATS_T, HIS_STATS_MOTDS), + F_B(HIS_STATS_MOTDS, 0, 1, 0), + F_A(HIS_STATS_u, HIS_STATS_UPTIME), + F_B(HIS_STATS_UPTIME, 0, 0, 0), + F_A(HIS_STATS_U, HIS_STATS_UWORLD), + F_B(HIS_STATS_UWORLD, 0, 1, 0), + F_A(HIS_STATS_v, HIS_STATS_VSERVERS), + F_B(HIS_STATS_VSERVERS, 0, 1, 0), + F_A(HIS_STATS_w, HIS_STATS_USERLOAD), + F_B(HIS_STATS_USERLOAD, 0, 0, 0), + F_A(HIS_STATS_x, HIS_STATS_MEMUSAGE), + F_B(HIS_STATS_MEMUSAGE, 0, 1, 0), + F_A(HIS_STATS_y, HIS_STATS_CLASSES), + F_B(HIS_STATS_CLASSES, 0, 1, 0), + F_A(HIS_STATS_z, HIS_STATS_MEMORY), + F_B(HIS_STATS_MEMORY, 0, 1, 0), F_B(HIS_STATS_IAUTH, 0, 1, 0), F_B(HIS_WHOIS_SERVERNAME, 0, 1, 0), F_B(HIS_WHOIS_IDLETIME, 0, 1, 0), @@ -428,8 +459,21 @@ assert(0 != feature); for (i = 0; features[i].type; i++) /* find appropriate descriptor */ - if (!strcmp(feature, features[i].type)) + if (!strcmp(feature, features[i].type)) { + if ((features[i].flags & FEAT_MASK) == FEAT_ALIAS) { + Debug((DEBUG_NOTICE, "Deprecated feature \"%s\" referenced", feature)); + if (from) /* report a warning */ + send_reply(from, SND_EXPLICIT | ERR_NOFEATURE, + "%s :Feature deprecated, use %s", feature, + features[features[i].def_int].type); + else + log_write(LS_CONFIG, L_WARNING, 0, "Feature \"%s\" deprecated, " + "use \"%s\"", feature, features[features[i].def_int].type); + + return &features[features[i].def_int]; + } return &features[i]; + } Debug((DEBUG_ERROR, "Unknown feature \"%s\"", feature)); if (from) /* report an error */ Index: ircd/s_stats.c =================================================================== RCS file: /cvsroot/undernet-ircu/ircu2.10/ircd/s_stats.c,v retrieving revision 1.44.2.4 diff -u -r1.44.2.4 s_stats.c --- ircd/s_stats.c 14 Mar 2006 14:56:50 -0000 1.44.2.4 +++ ircd/s_stats.c 31 May 2006 05:21:59 -0000 @@ -529,95 +529,95 @@ /** Contains information about all statistics. */ struct StatDesc statsinfo[] = { - { 'a', "nameservers", STAT_FLAG_OPERFEAT|STAT_FLAG_LOCONLY, FEAT_HIS_STATS_a, + { 'a', "nameservers", STAT_FLAG_OPERFEAT|STAT_FLAG_LOCONLY, FEAT_HIS_STATS_NAMESERVERS, report_dns_servers, 0, "DNS servers." }, - { 'c', "connect", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_c, + { 'c', "connect", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_CONNECT, stats_configured_links, CONF_SERVER, "Remote server connection lines." }, - { 'd', "maskrules", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_d, + { 'd', "maskrules", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_CRULES, stats_crule_list, CRULE_MASK, "Dynamic routing configuration." }, - { 'D', "crules", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_d, + { 'D', "crules", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_CRULES, stats_crule_list, CRULE_ALL, "Dynamic routing configuration." }, - { 'e', "engine", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_e, + { 'e', "engine", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_ENGINE, stats_engine, 0, "Report server event loop engine." }, - { 'f', "features", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_f, + { 'f', "features", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_FEATURES, feature_report, 0, "Feature settings." }, - { 'g', "glines", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_g, + { 'g', "glines", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_GLINES, gline_stats, 0, "Global bans (G-lines)." }, - { 'i', "access", (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM), FEAT_HIS_STATS_i, + { 'i', "access", (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM), FEAT_HIS_STATS_ACCESS, stats_access, CONF_CLIENT, "Connection authorization lines." }, - { 'j', "histogram", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_j, + { 'j', "histogram", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_HISTOGRAM, msgq_histogram, 0, "Message length histogram." }, - { 'J', "jupes", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_J, + { 'J', "jupes", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_JUPES, stats_nickjupes, 0, "Nickname jupes." }, - { 'k', "klines", (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM), FEAT_HIS_STATS_k, + { 'k', "klines", (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM), FEAT_HIS_STATS_KLINES, stats_klines, 0, "Local bans (K-Lines)." }, { 'l', "links", (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM | STAT_FLAG_CASESENS), - FEAT_HIS_STATS_l, + FEAT_HIS_STATS_LINKS, stats_links, 0, "Current connections information." }, { 'L', "modules", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), - FEAT_HIS_STATS_L, + FEAT_HIS_STATS_MODULES, stats_modules, 0, "Dynamically loaded modules." }, - { 'm', "commands", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_m, + { 'm', "commands", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_COMMANDS, stats_commands, 0, "Message usage information." }, - { 'o', "operators", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_o, + { 'o', "operators", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_OPERATORS, stats_configured_links, CONF_OPERATOR, "Operator information." }, - { 'p', "ports", (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM), FEAT_HIS_STATS_p, + { 'p', "ports", (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM), FEAT_HIS_STATS_PORTS, show_ports, 0, "Listening ports." }, - { 'q', "quarantines", (STAT_FLAG_OPERONLY | STAT_FLAG_VARPARAM), FEAT_HIS_STATS_q, + { 'q', "quarantines", (STAT_FLAG_OPERONLY | STAT_FLAG_VARPARAM), FEAT_HIS_STATS_QUARANTINES, stats_quarantine, 0, "Quarantined channels list." }, - { 'R', "mappings", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_R, + { 'R', "mappings", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_MAPPINGS, stats_mapping, 0, "Service mappings." }, #ifdef DEBUGMODE - { 'r', "usage", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_r, + { 'r', "usage", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_USAGE, send_usage, 0, "System resource usage (Debug only)." }, #endif - { 'T', "motds", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_T, + { 'T', "motds", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_MOTDS, motd_report, 0, "Configured Message Of The Day files." }, - { 't', "locals", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_t, + { 't', "locals", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_LOCALS, tstats, 0, "Local connection statistics (Total SND/RCV, etc)." }, - { 'U', "uworld", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_U, + { 'U', "uworld", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_UWORLD, stats_configured_links, CONF_UWORLD, "Service server information." }, - { 'u', "uptime", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_u, + { 'u', "uptime", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_UPTIME, stats_uptime, 0, "Current uptime & highest connection count." }, - { 'v', "vservers", (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM | STAT_FLAG_CASESENS), FEAT_HIS_STATS_v, + { 'v', "vservers", (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM | STAT_FLAG_CASESENS), FEAT_HIS_STATS_VSERVERS, stats_servers_verbose, 1, "Verbose server information." }, - { 'V', "vserversmach", (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM | STAT_FLAG_CASESENS), FEAT_HIS_STATS_v, + { 'V', "vserversmach", (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM | STAT_FLAG_CASESENS), FEAT_HIS_STATS_VSERVERS, stats_servers_verbose, 0, "Verbose server information." }, - { 'w', "userload", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_w, + { 'w', "userload", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_USERLOAD, calc_load, 0, "Userload statistics." }, - { 'x', "memusage", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_x, + { 'x', "memusage", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_MEMUSAGE, stats_meminfo, 0, "List usage information." }, - { 'y', "classes", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_y, + { 'y', "classes", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_CLASSES, report_classes, 0, "Connection classes." }, - { 'z', "memory", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_z, + { 'z', "memory", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_MEMORY, count_memory, 0, "Memory/Structure allocation information." }, { ' ', "iauth", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_IAUTH, (hmmm...I think I should go to bed, now...) -- Kevin L. Mitchell <[EMAIL PROTECTED]>
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Patches mailing list Patches@undernet.org http://undernet.sbg.org/mailman/listinfo/patches