From faaf36c32b8e24bf27c41c3ab8b774b3d5843ebc Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Sun, 24 Apr 2011 15:52:08 -0400 Subject: [PATCH] viced: Remove old /vice/file/parms config file This commit removes support for overriding command line options with the contents of /vice/file/parms. This option has never been documented, and only supports setting at most 15 command options. Replace the old function with one which checks for the existence of this file, and outputs a warning if it is found. Change-Id: I933475c0eb31e78dbc8a9d31b2486aa14f57bfb0 Reviewed-on: http://gerrit.openafs.org/4716 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/viced/viced.c | 84 +++++++++-------------------------------------- 1 file changed, 15 insertions(+), 69 deletions(-) diff --git a/src/viced/viced.c b/src/viced/viced.c index 13ddbf5ee0..6e79eaf29d 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -86,7 +86,6 @@ extern int etext; void *ShutDown(void *); static void ClearXStatValues(void); -static void NewParms(int); static void PrintCounters(void); static void ResetCheckDescriptors(void); static void ResetCheckSignal(void); @@ -1515,75 +1514,21 @@ ParseArgs(int argc, char *argv[]) } /*ParseArgs */ - -#define MAXPARMS 15 - +/* Once upon a time, in a galaxy far far away, IBM AFS supported the use of + * a file /vice/file/parms, the contents of which would override any command + * line parameters. We no longer support the use of such a file, but we warn + * if we encounter its presence from an older release + */ static void -NewParms(int initializing) +CheckParms(void) { - static struct afs_stat sbuf; - int i, fd; - char *parms; - char *argv[MAXPARMS]; - int argc; - - if (!(afs_stat("/vice/file/parms", &sbuf))) { - parms = (char *)malloc(sbuf.st_size); - if (!parms) - return; - fd = afs_open("parms", O_RDONLY, 0666); - if (fd <= 0) { - ViceLog(0, ("Open for parms failed with errno = %d\n", errno)); - return; - } - - i = read(fd, parms, sbuf.st_size); - close(fd); - if (i != sbuf.st_size) { - if (i < 0) { - ViceLog(0, ("Read on parms failed with errno = %d\n", errno)); - } else { - ViceLog(0, - ("Read on parms failed; expected %ld bytes but read %d\n", - (long) sbuf.st_size, i)); - } - free(parms); - return; - } - - for (i = 0; i < MAXPARMS; argv[i++] = 0); - - for (argc = i = 0; i < sbuf.st_size; i++) { - if ((*(parms + i) != ' ') && (*(parms + i) != '\n')) { - if (argv[argc] == 0) - argv[argc] = (parms + i); - } else { - *(parms + i) = '\0'; - if (argv[argc] != 0) { - if (++argc == MAXPARMS) - break; - } - while ((*(parms + i + 1) == ' ') - || (*(parms + i + 1) == '\n')) - i++; - } - } - if (ParseArgs(argc, argv) == 0) { - ViceLog(0, ("Change parameters to:")); - } else { - ViceLog(0, ("Invalid parameter in:")); - } - for (i = 0; i < argc; i++) { - ViceLog(0, (" %s", argv[i])); - } - ViceLog(0, ("\n")); - free(parms); - } else if (!initializing) - ViceLog(0, - ("Received request to change parms but no parms file exists\n")); - -} /*NewParms */ + struct afs_stat sbuf; + if (afs_stat("/vice/file/parms", &sbuf) == 0) { + ViceLog(0, ("Using /vice/file/parms to override command line " + "options is no longer supported")); + } +} /* Miscellaneous routines */ void @@ -1999,6 +1944,9 @@ main(int argc, char *argv[]) /* set ihandle package defaults prior to parsing args */ ih_PkgDefaults(); + /* check for the parameter file */ + CheckParms(); + if (ParseArgs(argc, argv)) { FlagMsg(); exit(-1); @@ -2021,8 +1969,6 @@ main(int argc, char *argv[]) exit(-1); } - NewParms(1); - /* Open FileLog on stdout, stderr, fd 1 and fd2 (for perror), sigh. */ #ifndef AFS_NT40_ENV serverLogSyslogTag = "fileserver";