nfs-utiles: rename xlog_from_conffile() to xlog_set_debug()
Subsystems (2)
PATCH 1/1 nfs-utiles: rename xlog_from_conffile() to xlog_set_debug()
Standardized how config setting are set as
well as the rename
Signed-off-by Steve Dickson <[email protected]>
--- support/include/xlog.h | 2 +- support/nfs/xlog.c | 2 +- utils/exportfs/exportfs.c | 12 +++++++++--- utils/mountd/mountd.c | 9 +++------ utils/nfsd/nfsd.c | 11 +++++++++-- utils/nfsdcltrack/nfsdcltrack.c | 20 ++++++++++++-------- utils/statd/sm-notify.c | 7 ++++--- utils/statd/statd.c | 8 ++++---- 8 files changed, 43 insertions(+), 28 deletions(-)
support/include/xlog.h +1 -1
@@ -51,7 +51,7 @@ void xlog_stderr(int on);void xlog_syslog (int on);void xlog_config (int fac,int on);void xlog_sconfig (char *,int on); -void xlog_from_conffile (char *); +void xlog_set_debug (char *);int xlog_enabled (int fac); void xlog(int fac, const char *fmt, ...) XLOG_FORMAT((printf, 2, 3)); void xlog_warn(const char *fmt, ...) XLOG_FORMAT((printf, 1, 2));
support/nfs/xlog.c +1 -1
@@ -129,7 +129,7 @@ xlog_sconfig(char *kind, int on) }void -xlog_from_conffile (char *service) +xlog_set_debug (char *service) {struct conf_list *kinds;struct conf_list_node *n;
utils/exportfs/exportfs.c +9 -3
@@ -91,7 +91,12 @@ release_lockfile() _lockfd =-1 ; } } - +inline static void +read_exportfs_conf (void ) +{ +conf_init_file (NFS_CONFFILE ); +xlog_set_debug ("exportfs" ); +}int main (int argc,char **argv) {
@@ -116,8 +121,9 @@ main(int argc, char **argv)xlog_stderr (1 );xlog_syslog (0 ); -conf_init_file (NFS_CONFFILE ); -xlog_from_conffile ("exportfs" ); +/* Read in config setting */ +read_exportfs_conf (); +nfsd_path_init ();/* NOTE: following uses "mountd" section of nfs.conf !!!! */
utils/mountd/mountd.c +3 -6
@@ -666,13 +666,13 @@ int port = 0;int descriptors =0 ;inline static void -read_mount_conf (char **argv) +read_mountd_conf (char **argv) {char *s;conf_init_file (NFS_CONFFILE ); -xlog_from_conffile ("mountd" ); +xlog_set_debug ("mountd" ); manage_gids =conf_get_bool ("mountd" ,"manage-gids" , manage_gids); descriptors =conf_get_num ("mountd" ,"descriptors" , descriptors); port =conf_get_num ("mountd" ,"port" , port);
@@ -684,9 +684,6 @@ read_mount_conf(char **argv)if (s && !state_setup_basedir (argv[0 ], s))exit (1 ); -if ((s =conf_get_str ("mountd" ,"debug" )) !=NULL ) -xlog_sconfig (s,1 ); -/* NOTE: following uses "nfsd" section of nfs.conf !!!! */ if (conf_get_bool ("nfsd" ,"udp" ,NFSCTL_UDPISSET (_rpcprotobits)))NFSCTL_UDPSET (_rpcprotobits);
@@ -726,7 +723,7 @@ main(int argc, char **argv)xlog_open (progname);/* Read in config setting */ -read_mount_conf (argv); +read_mountd_conf (argv);/* Parse the command line options and arguments. */ opterr =0 ;
utils/nfsd/nfsd.c +9 -2
@@ -56,6 +56,13 @@ static struct option longopts[] = { NULL, 0, 0, 0 } }; +inline static void +read_nfsd_conf (void ) +{ +conf_init_file (NFS_CONFFILE ); +xlog_set_debug ("nfsd" ); +} +int main (int argc,char **argv) {
@@ -81,8 +88,8 @@ main(int argc, char **argv)xlog_syslog (0 );xlog_stderr (1 ); -conf_init_file (NFS_CONFFILE ); -xlog_from_conffile ("nfsd" ); +/* Read in config setting */ +read_nfsd_conf ();nfssvc_get_minormask (&minormask);
utils/nfsdcltrack/nfsdcltrack.c +12 -8
@@ -549,7 +549,17 @@ find_cmd(char *cmdname) __func__, cmdname);return NULL ; } +inline static void +read_nfsdcltrack_conf (void ) +{ +char *val; +conf_init_file (NFS_CONFFILE ); +xlog_set_debug ("nfsdcltrack" ); + val =conf_get_str ("nfsdcltrack" ,"storagedir" ); +if (val) + storagedir = val; +}int main (int argc,char **argv) {
@@ -564,14 +574,8 @@ main(int argc, char **argv)xlog_syslog (1 );xlog_stderr (0 ); -conf_init_file (NFS_CONFFILE ); -xlog_from_conffile ("nfsdcltrack" ); - val =conf_get_str ("nfsdcltrack" ,"storagedir" ); -if (val) - storagedir = val; - rc =conf_get_num ("nfsdcltrack" ,"debug" ,0 ); -if (rc >0 ) -xlog_config (D_ALL ,1 ); +/* Read in config setting */ +read_nfsdcltrack_conf ();/* process command-line options */ while ((arg = getopt_long(argc, argv, "hdfs:", longopts,
utils/statd/sm-notify.c +4 -3
@@ -482,12 +482,12 @@ nsm_lift_grace_period(void)return ; }inline static void -read_nfsconf (char **argv) +read_smnotify_conf (char **argv) {char *s;conf_init_file (NFS_CONFFILE ); -xlog_from_conffile ("sm-notify" ); +xlog_set_debug ("sm-notify" ); opt_max_retry =conf_get_num ("sm-notify" ,"retry-time" , opt_max_retry /60 ) *60 ; opt_srcport =conf_get_str ("sm-notify" ,"outgoing-port" ); opt_srcaddr =conf_get_str ("sm-notify" ,"outgoing-addr" );
@@ -512,7 +512,8 @@ main(int argc, char **argv)else progname = argv[0 ]; -read_nfsconf (argv); +/* Read in config setting */ +read_smnotify_conf (argv);while ((c =getopt (argc, argv,"dm:np:v:P:f" )) !=-1 ) {switch (c) {
utils/statd/statd.c +4 -4
@@ -243,12 +243,12 @@ int port = 0, out_port = 0;int nlm_udp =0 , nlm_tcp =0 ;inline static void -read_nfsconf (char **argv) +read_statd_conf (char **argv) {char *s;conf_init_file (NFS_CONFFILE ); -xlog_from_conffile ("statd" ); +xlog_set_debug ("statd" ); out_port =conf_get_num ("statd" ,"outgoing-port" , out_port); port =conf_get_num ("statd" ,"port" , port);
@@ -306,8 +306,8 @@ int main (int argc, char **argv)/* Set hostname */ MY_NAME =NULL ; -/* Read nfs.conf */ -read_nfsconf (argv); +/* Read in config setting */ +read_statd_conf (argv);/* Process command line switches */ while ((arg =getopt_long (argc, argv,"h?vVFNH:dn:p:o:P:LT:U:" , longopts,NULL )) !=EOF ) {
Signature · 1 line
2.29.2
NeilBrown
reviewerQuoted 4 lines · Steve Dickson
Standardized how config setting are set as
well as the renameSigned-off-by Steve Dickson <[email protected]>
Looks good to me - thanks.
NeilBrown
Quoted 4 lines · Steve Dickson
Standardized how config setting are set as
well as the renameSigned-off-by Steve Dickson <[email protected]>
Committed...
steved.
Quoted 234 lines
--- support/include/xlog.h | 2 +- support/nfs/xlog.c | 2 +- utils/exportfs/exportfs.c | 12 +++++++++--- utils/mountd/mountd.c | 9 +++------ utils/nfsd/nfsd.c | 11 +++++++++-- utils/nfsdcltrack/nfsdcltrack.c | 20 ++++++++++++-------- utils/statd/sm-notify.c | 7 ++++--- utils/statd/statd.c | 8 ++++---- 8 files changed, 43 insertions(+), 28 deletions(-)support/include/xlog.h +1
-1@@ -51,7 +51,7 @@ void xlog_stderr(int on);void xlog_syslog (int on);void xlog_config (int fac,int on);void xlog_sconfig (char *,int on); -void xlog_from_conffile (char *); +void xlog_set_debug (char *);int xlog_enabled (int fac); void xlog(int fac, const char *fmt, ...) XLOG_FORMAT((printf, 2, 3)); void xlog_warn(const char *fmt, ...) XLOG_FORMAT((printf, 1, 2));support/nfs/xlog.c +1
-1@@ -129,7 +129,7 @@ xlog_sconfig(char *kind, int on) }void -xlog_from_conffile (char *service) +xlog_set_debug (char *service) {struct conf_list *kinds;struct conf_list_node *n;utils/exportfs/exportfs.c +9
-3@@ -91,7 +91,12 @@ release_lockfile() _lockfd =-1 ; } } - +inline static void +read_exportfs_conf (void ) +{ +conf_init_file (NFS_CONFFILE ); +xlog_set_debug ("exportfs" ); +}int main (int argc,char **argv) {@@ -116,8 +121,9 @@ main(int argc, char **argv)xlog_stderr (1 );xlog_syslog (0 ); -conf_init_file (NFS_CONFFILE ); -xlog_from_conffile ("exportfs" ); +/* Read in config setting */ +read_exportfs_conf (); +nfsd_path_init ();/* NOTE: following uses "mountd" section of nfs.conf !!!! */ utils/mountd/mountd.c +3
-6@@ -666,13 +666,13 @@ int port = 0;int descriptors =0 ;inline static void -read_mount_conf (char **argv) +read_mountd_conf (char **argv) {char *s;conf_init_file (NFS_CONFFILE ); -xlog_from_conffile ("mountd" ); +xlog_set_debug ("mountd" ); manage_gids =conf_get_bool ("mountd" ,"manage-gids" , manage_gids); descriptors =conf_get_num ("mountd" ,"descriptors" , descriptors); port =conf_get_num ("mountd" ,"port" , port);@@ -684,9 +684,6 @@ read_mount_conf(char **argv)if (s && !state_setup_basedir (argv[0 ], s))exit (1 ); -if ((s =conf_get_str ("mountd" ,"debug" )) !=NULL ) -xlog_sconfig (s,1 ); -/* NOTE: following uses "nfsd" section of nfs.conf !!!! */ if (conf_get_bool ("nfsd" ,"udp" ,NFSCTL_UDPISSET (_rpcprotobits)))NFSCTL_UDPSET (_rpcprotobits);@@ -726,7 +723,7 @@ main(int argc, char **argv)xlog_open (progname);/* Read in config setting */ -read_mount_conf (argv); +read_mountd_conf (argv);/* Parse the command line options and arguments. */ opterr =0 ;utils/nfsd/nfsd.c +9
-2@@ -56,6 +56,13 @@ static struct option longopts[] = { NULL, 0, 0, 0 } }; +inline static void +read_nfsd_conf (void ) +{ +conf_init_file (NFS_CONFFILE ); +xlog_set_debug ("nfsd" ); +} +int main (int argc,char **argv) {@@ -81,8 +88,8 @@ main(int argc, char **argv)xlog_syslog (0 );xlog_stderr (1 ); -conf_init_file (NFS_CONFFILE ); -xlog_from_conffile ("nfsd" ); +/* Read in config setting */ +read_nfsd_conf ();nfssvc_get_minormask (&minormask);utils/nfsdcltrack/nfsdcltrack.c +12
-8@@ -549,7 +549,17 @@ find_cmd(char *cmdname) __func__, cmdname);return NULL ; } +inline static void +read_nfsdcltrack_conf (void ) +{ +char *val; +conf_init_file (NFS_CONFFILE ); +xlog_set_debug ("nfsdcltrack" ); + val =conf_get_str ("nfsdcltrack" ,"storagedir" ); +if (val) + storagedir = val; +}int main (int argc,char **argv) {@@ -564,14 +574,8 @@ main(int argc, char **argv)xlog_syslog (1 );xlog_stderr (0 ); -conf_init_file (NFS_CONFFILE ); -xlog_from_conffile ("nfsdcltrack" ); - val =conf_get_str ("nfsdcltrack" ,"storagedir" ); -if (val) - storagedir = val; - rc =conf_get_num ("nfsdcltrack" ,"debug" ,0 ); -if (rc >0 ) -xlog_config (D_ALL ,1 ); +/* Read in config setting */ +read_nfsdcltrack_conf ();/* process command-line options */ while ((arg = getopt_long(argc, argv, "hdfs:", longopts,utils/statd/sm-notify.c +4
-3@@ -482,12 +482,12 @@ nsm_lift_grace_period(void)return ; }inline static void -read_nfsconf (char **argv) +read_smnotify_conf (char **argv) {char *s;conf_init_file (NFS_CONFFILE ); -xlog_from_conffile ("sm-notify" ); +xlog_set_debug ("sm-notify" ); opt_max_retry =conf_get_num ("sm-notify" ,"retry-time" , opt_max_retry /60 ) *60 ; opt_srcport =conf_get_str ("sm-notify" ,"outgoing-port" ); opt_srcaddr =conf_get_str ("sm-notify" ,"outgoing-addr" );@@ -512,7 +512,8 @@ main(int argc, char **argv)else progname = argv[0 ]; -read_nfsconf (argv); +/* Read in config setting */ +read_smnotify_conf (argv);while ((c =getopt (argc, argv,"dm:np:v:P:f" )) !=-1 ) {switch (c) {utils/statd/statd.c +4
-4@@ -243,12 +243,12 @@ int port = 0, out_port = 0;int nlm_udp =0 , nlm_tcp =0 ;inline static void -read_nfsconf (char **argv) +read_statd_conf (char **argv) {char *s;conf_init_file (NFS_CONFFILE ); -xlog_from_conffile ("statd" ); +xlog_set_debug ("statd" ); out_port =conf_get_num ("statd" ,"outgoing-port" , out_port); port =conf_get_num ("statd" ,"port" , port);@@ -306,8 +306,8 @@ int main (int argc, char **argv)/* Set hostname */ MY_NAME =NULL ; -/* Read nfs.conf */ -read_nfsconf (argv); +/* Read in config setting */ +read_statd_conf (argv);/* Process command line switches */ while ((arg =getopt_long (argc, argv,"h?vVFNH:dn:p:o:P:LT:U:" , longopts,NULL )) !=EOF ) {