From 072974935c12ee9e3a512933d8246b5dc5a251e0 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Thu, 9 Jul 2009 13:17:27 +0100 Subject: [PATCH] Prototype the afsmonitor directory Prototypes and code cleanup for afsmonitor Reviewed-on: http://gerrit.openafs.org/13 Verified-by: Derrick Brashear Reviewed-by: Derrick Brashear --- src/afsmonitor/afsmon-output.c | 76 +++++----------- src/afsmonitor/afsmon-win.c | 201 +++++++++++++---------------------------- src/afsmonitor/afsmonitor.c | 170 +++++++++++----------------------- src/afsmonitor/afsmonitor.h | 13 +++ 4 files changed, 153 insertions(+), 307 deletions(-) diff --git a/src/afsmonitor/afsmon-output.c b/src/afsmonitor/afsmon-output.c index 8f2f2f8..7b4cb37 100644 --- a/src/afsmonitor/afsmon-output.c +++ b/src/afsmonitor/afsmon-output.c @@ -27,6 +27,7 @@ RCSID #include #include +#include "afsmonitor.h" /* Extern Variables */ @@ -34,8 +35,6 @@ extern int afsmon_debug; /* debugging on ? */ extern FILE *debugFD; /* debug file FD */ extern char errMsg[256]; /* error message buffer */ -extern int afsmon_Exit(); /* exit routine */ - static FILE *fs_outFD; /* fs output file descriptor */ static FILE *cm_outFD; /* cm output file descriptor */ @@ -111,9 +110,7 @@ static char *xferOpNames[] = { *------------------------------------------------------------------------*/ void -Print_fs_OverallPerfInfo(a_ovP) - struct afs_PerfStats *a_ovP; - +Print_fs_OverallPerfInfo(struct afs_PerfStats *a_ovP) { /*Print_fs_OverallPerfInfo */ fprintf(fs_outFD, "\t%10d numPerfCalls\n\n", a_ovP->numPerfCalls); @@ -254,10 +251,7 @@ Print_fs_OverallPerfInfo(a_ovP) *------------------------------------------------------------------------*/ void -Print_fs_OpTiming(a_opIdx, a_opTimeP) - int a_opIdx; - struct fs_stats_opTimingData *a_opTimeP; - +Print_fs_OpTiming(int a_opIdx, struct fs_stats_opTimingData *a_opTimeP) { /*Print_fs_OpTiming */ fprintf(fs_outFD, @@ -291,10 +285,7 @@ Print_fs_OpTiming(a_opIdx, a_opTimeP) *------------------------------------------------------------------------*/ void -Print_fs_XferTiming(a_opIdx, a_xferP) - int a_opIdx; - struct fs_stats_xferData *a_xferP; - +Print_fs_XferTiming(int a_opIdx, struct fs_stats_xferData *a_xferP) { /*Print_fs_XferTiming */ fprintf(fs_outFD, @@ -334,9 +325,7 @@ Print_fs_XferTiming(a_opIdx, a_xferP) *------------------------------------------------------------------------*/ void -Print_fs_DetailedPerfInfo(a_detP) - struct fs_stats_DetailedStats *a_detP; - +Print_fs_DetailedPerfInfo(struct fs_stats_DetailedStats *a_detP) { /*Print_fs_DetailedPerfInfo */ int currIdx; /*Loop variable */ @@ -373,11 +362,8 @@ Print_fs_DetailedPerfInfo(a_detP) *------------------------------------------------------------------------*/ void -Print_fs_FullPerfInfo(a_fs_Results) - struct xstat_fs_ProbeResults *a_fs_Results; /* ptr to fs results */ +Print_fs_FullPerfInfo(struct xstat_fs_ProbeResults *a_fs_Results) { /*Print_fs_FullPerfInfo */ - - static char rn[] = "Print_fs_FullPerfInfo"; /*Routine name */ static afs_int32 fullPerfLongs = (sizeof(struct fs_stats_FullPerfStats) >> 2); /*Correct # longs to rcv */ afs_int32 numLongs; /*# longwords received */ struct fs_stats_FullPerfStats *fullPerfP; /*Ptr to full perf stats */ @@ -432,9 +418,8 @@ Print_fs_FullPerfInfo(a_fs_Results) * As advertised. *------------------------------------------------------------------------*/ int -afsmon_fsOutput(a_outfile, a_detOutput) - char *a_outfile; /* ptr to output file name */ - int a_detOutput; /* detailed output ? */ +afsmon_fsOutput(char *a_outfile, /* ptr to output file name */ + int a_detOutput) /* detailed output ? */ { static char rn[] = "afsmon_fsOutput"; /* routine name */ @@ -525,9 +510,7 @@ afsmon_fsOutput(a_outfile, a_detOutput) *------------------------------------------------------------------------*/ void -Print_cm_UpDownStats(a_upDownP) - struct afs_stats_SrvUpDownInfo *a_upDownP; /*Ptr to server up/down info */ - +Print_cm_UpDownStats(struct afs_stats_SrvUpDownInfo *a_upDownP) /*Ptr to server up/down info */ { /*Print_cm_UpDownStats */ /* @@ -606,9 +589,7 @@ Print_cm_UpDownStats(a_upDownP) *------------------------------------------------------------------------*/ void -Print_cm_OverallPerfInfo(a_ovP) - struct afs_stats_CMPerf *a_ovP; - +Print_cm_OverallPerfInfo(struct afs_stats_CMPerf *a_ovP) { /*Print_cm_OverallPerfInfo */ fprintf(cm_outFD, "\t%10d numPerfCalls\n", a_ovP->numPerfCalls); @@ -697,10 +678,8 @@ Print_cm_OverallPerfInfo(a_ovP) *------------------------------------------------------------------------*/ void -Print_cm_PerfInfo() +Print_cm_PerfInfo(void) { /*Print_cm_PerfInfo */ - - static char rn[] = "Print_cm_PerfInfo"; /*Routine name */ static afs_int32 perfLongs = (sizeof(struct afs_stats_CMPerf) >> 2); /*Correct # longs to rcv */ afs_int32 numLongs; /*# longwords received */ struct afs_stats_CMPerf *perfP; /*Ptr to performance stats */ @@ -754,11 +733,8 @@ Print_cm_PerfInfo() *------------------------------------------------------------------------*/ void -Print_cm_OpTiming(a_opIdx, a_opNames, a_opTimeP) - int a_opIdx; - char *a_opNames[]; - struct afs_stats_opTimingData *a_opTimeP; - +Print_cm_OpTiming(int a_opIdx, char *a_opNames[], + struct afs_stats_opTimingData *a_opTimeP) { /*Print_cm_OpTiming */ fprintf(cm_outFD, @@ -792,11 +768,8 @@ Print_cm_OpTiming(a_opIdx, a_opNames, a_opTimeP) *------------------------------------------------------------------------*/ void -Print_cm_XferTiming(a_opIdx, a_opNames, a_xferP) - int a_opIdx; - char *a_opNames[]; - struct afs_stats_xferData *a_xferP; - +Print_cm_XferTiming(int a_opIdx, char *a_opNames[], + struct afs_stats_xferData *a_xferP) { /*Print_cm_XferTiming */ fprintf(cm_outFD, @@ -838,11 +811,8 @@ Print_cm_XferTiming(a_opIdx, a_opNames, a_xferP) *------------------------------------------------------------------------*/ void -Print_cm_ErrInfo(a_opIdx, a_opNames, a_opErrP) - int a_opIdx; - char *a_opNames[]; - struct afs_stats_RPCErrors *a_opErrP; - +Print_cm_ErrInfo(int a_opIdx, char *a_opNames[], + struct afs_stats_RPCErrors *a_opErrP) { /*Print_cm_ErrInfo */ fprintf(cm_outFD, @@ -874,9 +844,7 @@ Print_cm_ErrInfo(a_opIdx, a_opNames, a_opErrP) *------------------------------------------------------------------------*/ void -Print_cm_RPCPerfInfo(a_rpcP) - struct afs_stats_RPCOpInfo *a_rpcP; - +Print_cm_RPCPerfInfo(struct afs_stats_RPCOpInfo *a_rpcP) { /*Print_cm_RPCPerfInfo */ int currIdx; /*Loop variable */ @@ -924,10 +892,9 @@ Print_cm_RPCPerfInfo(a_rpcP) *------------------------------------------------------------------------*/ void -Print_cm_FullPerfInfo() +Print_cm_FullPerfInfo(void) { /*Print_cm_FullPerfInfo */ - static char rn[] = "Print_cm_FullPerfInfo"; /* routine name */ struct afs_stats_AuthentInfo *authentP; /*Ptr to authentication stats */ struct afs_stats_AccessInfo *accessinfP; /*Ptr to access stats */ static afs_int32 fullPerfLongs = (sizeof(struct afs_stats_CMFullPerf) >> 2); /*Correct #longs */ @@ -1017,9 +984,8 @@ Print_cm_FullPerfInfo() * As advertised. *------------------------------------------------------------------------*/ int -afsmon_cmOutput(a_outfile, a_detOutput) - char *a_outfile; /* ptr to output file name */ - int a_detOutput; /* detailed output ? */ +afsmon_cmOutput(char *a_outfile, /* ptr to output file name */ + int a_detOutput) /* detailed output ? */ { static char rn[] = "afsmon_cmOutput"; /* routine name */ diff --git a/src/afsmonitor/afsmon-win.c b/src/afsmonitor/afsmon-win.c index 7cbaf03..c9b120e 100644 --- a/src/afsmonitor/afsmon-win.c +++ b/src/afsmonitor/afsmon-win.c @@ -28,6 +28,7 @@ RCSID #include /*Generic window package */ #include /*Object definitions */ +#include #if 0 #include /*Text object circular buffer interface */ #include /*Text object interface */ @@ -325,16 +326,9 @@ struct onode **cmLabels_o[3]; *------------------------------------------------------------------------*/ static struct onode * -initLightObject(a_name, a_x, a_y, a_width, a_win) - char *a_name; - int a_x; - int a_y; - int a_width; - struct gwin *a_win; - +initLightObject(char *a_name, int a_x, int a_y, int a_width, + struct gwin *a_win) { /*initLightObject */ - - static char rn[] = "initLightObject"; /*Routine name */ struct onode *newlightp; /*Ptr to new light onode */ struct gator_light_crparams light_crparams; /*Light creation params */ char *truncname; /*Truncated name, if needed */ @@ -427,13 +421,8 @@ initLightObject(a_name, a_x, a_y, a_width, a_win) *------------------------------------------------------------------------*/ int -justify_light(a_srcbuff, a_dstbuff, a_dstwidth, a_justification, a_rightTrunc) - char *a_srcbuff; - char *a_dstbuff; - int a_dstwidth; - int a_justification; - int a_rightTrunc; - +justify_light(char *a_srcbuff, char *a_dstbuff, int a_dstwidth, + int a_justification, int a_rightTrunc) { /*justify_light */ static char rn[] = "justify_light"; /*Routine name */ @@ -555,7 +544,7 @@ justify_light(a_srcbuff, a_dstbuff, a_dstwidth, a_justification, a_rightTrunc) *----------------------------------------------------------------------*/ int -afsmonExit_gtx() +afsmonExit_gtx(void *d1, void *d2) { static char rn[] = "afsmonExit_gtx"; @@ -585,9 +574,8 @@ afsmonExit_gtx() *----------------------------------------------------------------------*/ int -ovw_refresh(a_pageNum, a_updateType) - int a_pageNum; /* page to refresh overview display */ - int a_updateType; /* OVW_UPDATE_FS = update fs column only, +ovw_refresh(int a_pageNum, /* page to refresh overview display */ + int a_updateType) /* OVW_UPDATE_FS = update fs column only, * OVW_UPDATE_CM = update cm column only, * OVW_UPDATE_BOTH = update fs & cm columns. Note that * we do not want to update a column until the @@ -602,8 +590,6 @@ ovw_refresh(a_pageNum, a_updateType) struct cm_Display_Data *cmDataP; /* ptr to CM display data array */ int fsIdx; /* for counting # of CM hosts */ int cmIdx; /* for counting # of CM hosts */ - int next_page = 0; /* is there a next ovw page ? */ - int prev_page = 0; /* is there a previous ovw page */ char cmdLine[80]; /* buffer for command line */ char printBuf[256]; /* buffer to print to screen */ int i; @@ -713,9 +699,6 @@ ovw_refresh(a_pageNum, a_updateType) strcat(cmdLine, "]? "); - - - /* display the command line */ tmp_lightobj = (struct gator_lightobj *)ovw_cmd_o->o_data; sprintf(printBuf, "%s", cmdLine); @@ -732,8 +715,6 @@ ovw_refresh(a_pageNum, a_updateType) RIGHT_JUSTIFY, 1); gator_light_set(ovw_probeNum_o, 1); - - /* update the file server names column if we are asked to */ if (numFS && (a_updateType & OVW_UPDATE_FS)) { @@ -902,7 +883,7 @@ ovw_refresh(a_pageNum, a_updateType) * Switch from the overview screen to the FS screen *----------------------------------------------------------------------*/ int -Switch_ovw_2_fs() +Switch_ovw_2_fs(void *d1, void *d2) { static char rn[] = "Switch_ovw_2_fs"; @@ -924,7 +905,7 @@ Switch_ovw_2_fs() * Switch from the overview screen to the CM screen *----------------------------------------------------------------------*/ int -Switch_ovw_2_cm() +Switch_ovw_2_cm(void *d1, void *d2) { static char rn[] = "Switch_ovw_2_cm"; @@ -946,7 +927,7 @@ Switch_ovw_2_cm() * Switch to the next page in overview screen *----------------------------------------------------------------------*/ int -Switch_ovw_next() +Switch_ovw_next(void *d1, void *d2) { static char rn[] = "Switch_ovw_next"; @@ -970,7 +951,7 @@ Switch_ovw_next() * Switch to the last page in the overview screen *----------------------------------------------------------------------*/ int -Switch_ovw_last() +Switch_ovw_last(void *d1, void *d2) { static char rn[] = "Switch_ovw_last"; @@ -994,7 +975,7 @@ Switch_ovw_last() * Switch to the previous page in the overview screen *----------------------------------------------------------------------*/ int -Switch_ovw_prev() +Switch_ovw_prev(void *d1, void *d2) { static char rn[] = "Switch_ovw_prev"; @@ -1017,7 +998,7 @@ Switch_ovw_prev() * Switch to the first page in the overview screen *----------------------------------------------------------------------*/ int -Switch_ovw_first() +Switch_ovw_first(void *d1, void *d2) { static char rn[] = "Switch_ovw_first"; @@ -1050,7 +1031,7 @@ Switch_ovw_first() *----------------------------------------------------------------------*/ int -create_ovwFrame_objects() +create_ovwFrame_objects(void) { /* create_ovwFrame_objects */ static char rn[] = "create_ovwFrame_objects"; @@ -1298,23 +1279,21 @@ create_ovwFrame_objects() *----------------------------------------------------------------------*/ int -resolve_CmdLine(a_buffer, a_currFrame, a_currPage, a_numPages, a_numCols, - a_curr_LCol, a_cols_perPage, a_Data_Available) - char *a_buffer; /* buffer to copy command line */ - int a_currFrame; /* current frame ovw, fs or cm? */ - int a_currPage; /* current page number */ - int a_numPages; /* number of pages of data */ - int a_numCols; /* number of columns of data to display */ - int a_curr_LCol; /* current number of leftmost column */ - int a_cols_perPage; /* number of columns per page */ - +resolve_CmdLine(char *a_buffer, /* buffer to copy command line */ + int a_currFrame, /* current frame ovw, fs or cm? */ + int a_currPage, /* current page number */ + int a_numPages, /* number of pages of data */ + int a_numCols, /* number of columns of data to display */ + int a_curr_LCol, /* current number of leftmost column */ + int a_cols_perPage, /* number of columns per page */ + int a_Data_Available) { /* resolve_CmdLine */ static char rn[] = "resolve_CmdLine"; int pageType; if (afsmon_debug) { fprintf(debugFD, - "[ %s ] Called, a_buffer= %d, a_currFrame= %d, a_currPage= %d, a_numPages= %d, a_numCols= %d, a_curr_LCol= %d, a_cols_perPage= %d\n", + "[ %s ] Called, a_buffer= %p, a_currFrame= %d, a_currPage= %d, a_numPages= %d, a_numCols= %d, a_curr_LCol= %d, a_cols_perPage= %d\n", rn, a_buffer, a_currFrame, a_currPage, a_numPages, a_numCols, a_curr_LCol, a_cols_perPage); fflush(debugFD); @@ -1390,16 +1369,12 @@ resolve_CmdLine(a_buffer, a_currFrame, a_currPage, a_numPages, a_numCols, * 0 always *----------------------------------------------------------------------*/ int -display_Server_datum(a_srcBuf, a_firstObj_o, a_secondObj_o, a_probeOK, a_just, - a_highlight) - - char *a_srcBuf; /* source buffer */ - struct onode *a_firstObj_o; /* first object */ - struct onode *a_secondObj_o; /* second object */ - int a_probeOK; /* probe OK ? */ - int a_just; /* justification */ - int a_highlight; /* highlight object ? */ - +display_Server_datum(char *a_srcBuf, /* source buffer */ + struct onode *a_firstObj_o, /* first object */ + struct onode *a_secondObj_o, /* second object */ + int a_probeOK, /* probe OK ? */ + int a_just, /* justification */ + int a_highlight) /* highlight object ? */ { /* display_Server_datum */ static char rn[] = "display_Server_datum"; @@ -1412,7 +1387,7 @@ display_Server_datum(a_srcBuf, a_firstObj_o, a_secondObj_o, a_probeOK, a_just, if (afsmon_debug) { if (a_highlight) fprintf(debugFD, - "[ %s ] Called, a_srcBuf= %s, a_firstObj_o= %d, a_secondObj_o= %d, a_probeOK= %d, a_just= %d, a_highlight= %d\n", + "[ %s ] Called, a_srcBuf= %s, a_firstObj_o= %p, a_secondObj_o= %p, a_probeOK= %d, a_just= %d, a_highlight= %d\n", rn, a_srcBuf, a_firstObj_o, a_secondObj_o, a_probeOK, a_just, a_highlight); fflush(debugFD); @@ -1500,14 +1475,11 @@ display_Server_datum(a_srcBuf, a_firstObj_o, a_secondObj_o, a_probeOK, a_just, *----------------------------------------------------------------------*/ int -display_Server_label(a_srcBuf, a_firstObj_o, a_secondObj_o, a_thirdObj_o) - char *a_srcBuf; - struct onode *a_firstObj_o; /* first object */ - struct onode *a_secondObj_o; /* second object */ - struct onode *a_thirdObj_o; /* third object */ - +display_Server_label(char *a_srcBuf, + struct onode *a_firstObj_o, /* first object */ + struct onode *a_secondObj_o, /* second object */ + struct onode *a_thirdObj_o) /* third object */ { /* display_Server_label */ - static char rn[] = "display_Server_label"; char part[3][20]; /* buffer for three parts of label */ char *strPtr; @@ -1580,7 +1552,7 @@ display_Server_label(a_srcBuf, a_firstObj_o, a_secondObj_o, a_thirdObj_o) } } } - + return 0; } /* display_Server_label */ @@ -1605,10 +1577,8 @@ display_Server_label(a_srcBuf, a_firstObj_o, a_secondObj_o, a_thirdObj_o) int -fs_refresh(a_pageNum, a_LcolNum) - int a_pageNum; /* page to display */ - int a_LcolNum; /* starting (leftmost) column number */ - +fs_refresh(int a_pageNum, /* page to display */ + int a_LcolNum) /* starting (leftmost) column number */ { /* fs_refresh */ static char rn[] = "fs_refresh"; /* routine name */ @@ -1694,7 +1664,7 @@ fs_refresh(a_pageNum, a_LcolNum) fs_pageType = resolve_CmdLine(cmdLine, 1 /* fs frame */ , a_pageNum, fs_numPages, fs_numCols, a_LcolNum, - fs_cols_perPage); + fs_cols_perPage, 0); /* display the command line */ tmp_lightobj = (struct gator_lightobj *)fs_cmd_o->o_data; @@ -1924,7 +1894,7 @@ fs_refresh(a_pageNum, a_LcolNum) * Switch from the File Server screen to the Overview Screen *----------------------------------------------------------------------*/ int -Switch_fs_2_ovw() +Switch_fs_2_ovw(void *d1, void *d2) { /* bind the overview frame to the window */ gtxframe_SetFrame(afsmon_win, ovwFrame); @@ -1938,7 +1908,7 @@ Switch_fs_2_ovw() * Switch from the File Server screen to the Cache Managers screen. *----------------------------------------------------------------------*/ int -Switch_fs_2_cm() +Switch_fs_2_cm(void *d1, void *d2) { if (fs_pageType & CMD_CM) { /* bind the overview Cache Managers to the window */ @@ -1954,10 +1924,8 @@ Switch_fs_2_cm() * Switch to next page of file server screen *----------------------------------------------------------------------*/ int -Switch_fs_next() +Switch_fs_next(void *d1, void *d2) { - static char rn[] = "Switch_fs_next"; - if (fs_pageType & CMD_NEXT) { /* we have a next page, refresh with next page number */ fs_refresh(fs_currPage + 1, fs_curr_LCol); @@ -1973,11 +1941,8 @@ Switch_fs_next() * Switch to last page of file server screen *----------------------------------------------------------------------*/ int -Switch_fs_last() +Switch_fs_last(void *d1, void *d2) { - static char rn[] = "Switch_fs_last"; - - if (fs_pageType & CMD_NEXT) { /* we have a next page, refresh with the last page number */ fs_refresh(fs_numPages, fs_curr_LCol); @@ -1993,10 +1958,8 @@ Switch_fs_last() * Switch to previous page of file server screen *----------------------------------------------------------------------*/ int -Switch_fs_prev() +Switch_fs_prev(void *d1, void *d2) { - static char rn[] = "Switch_fs_prev"; - if (fs_pageType & CMD_PREV) { /* we have a previous page, refresh with the rpevious page number */ fs_refresh(fs_currPage - 1, fs_curr_LCol); @@ -2011,10 +1974,8 @@ Switch_fs_prev() * Switch to first page of file server screen *----------------------------------------------------------------------*/ int -Switch_fs_first() +Switch_fs_first(void *d1, void *d2) { - static char rn[] = "Switch_fs_first"; - if (fs_pageType & CMD_PREV) { /* we have a previous page, got to first page */ fs_refresh(1, fs_curr_LCol); @@ -2029,10 +1990,8 @@ Switch_fs_first() * Scroll left on the file server screen *----------------------------------------------------------------------*/ int -Switch_fs_left() +Switch_fs_left(void *d1, void *d2) { - static char rn[] = "Switch_fs_left"; - if (fs_pageType & CMD_LEFT) { /* we have columns on left, refresh with new column number */ fs_refresh(fs_currPage, fs_curr_LCol - fs_cols_perPage); @@ -2048,10 +2007,8 @@ Switch_fs_left() * Scroll to first column on the file server screen *----------------------------------------------------------------------*/ int -Switch_fs_leftmost() +Switch_fs_leftmost(void *d1, void *d2) { - static char rn[] = "Switch_fs_leftmost"; - if (fs_pageType & CMD_LEFT) { /* we have columns on left, go to the first */ fs_refresh(fs_currPage, 0); @@ -2066,10 +2023,8 @@ Switch_fs_leftmost() * Scroll right on the file server screen *----------------------------------------------------------------------*/ int -Switch_fs_right() +Switch_fs_right(void *d1, void *d2) { - static char rn[] = "Switch_fs_right"; - if (fs_pageType & CMD_RIGHT) { /* we have columns on right, refresh with new column number */ fs_refresh(fs_currPage, fs_curr_LCol + fs_cols_perPage); @@ -2084,12 +2039,10 @@ Switch_fs_right() * Scroll to last column on the file server screen *----------------------------------------------------------------------*/ int -Switch_fs_rightmost() +Switch_fs_rightmost(void *d1, void *d2) { - static char rn[] = "Switch_fs_rightmost"; int curr_LCol; - if (fs_pageType & CMD_RIGHT) { /* we have columns on right, go to the last column */ if (fs_numCols % fs_cols_perPage) @@ -2121,7 +2074,7 @@ Switch_fs_rightmost() *----------------------------------------------------------------------*/ int -create_FSframe_objects() +create_FSframe_objects(void) { /* create_FSframe_objects */ static char rn[] = "create_FSframe_objects"; struct ServerInfo_line *fs_lines_Ptr; @@ -2407,10 +2360,8 @@ create_FSframe_objects() *----------------------------------------------------------------------*/ int -cm_refresh(a_pageNum, a_LcolNum) - int a_pageNum; /* page to display */ - int a_LcolNum; /* starting (leftmost) column number */ - +cm_refresh(int a_pageNum, /* page to display */ + int a_LcolNum) /* starting (leftmost) column number */ { /* cm_refresh */ static char rn[] = "cm_refresh"; /* routine name */ @@ -2496,7 +2447,7 @@ cm_refresh(a_pageNum, a_LcolNum) cm_pageType = resolve_CmdLine(cmdLine, 2 /* cm frame */ , a_pageNum, cm_numPages, cm_numCols, a_LcolNum, - cm_cols_perPage); + cm_cols_perPage, 0); /* display the command line */ tmp_lightobj = (struct gator_lightobj *)cm_cmd_o->o_data; @@ -2725,7 +2676,7 @@ cm_refresh(a_pageNum, a_LcolNum) * Switch from the Cache Manager screen to the Overview Screen *----------------------------------------------------------------------*/ int -Switch_cm_2_ovw() +Switch_cm_2_ovw(void *d1, void *d2) { /* bind the overview frame to the window */ gtxframe_SetFrame(afsmon_win, ovwFrame); @@ -2739,7 +2690,7 @@ Switch_cm_2_ovw() * Switch from the Cache Manager screen to the File Servers screen *----------------------------------------------------------------------*/ int -Switch_cm_2_fs() +Switch_cm_2_fs(void *d1, void *d2) { if (cm_pageType & CMD_FS) { /* bind the file servers frame to the window */ @@ -2755,10 +2706,8 @@ Switch_cm_2_fs() * Switch to next page of cache managers screen *----------------------------------------------------------------------*/ int -Switch_cm_next() +Switch_cm_next(void *d1, void *d2) { - static char rn[] = "Switch_cm_next"; - if (cm_pageType & CMD_NEXT) { /* we have a next page, refresh with next page number */ cm_refresh(cm_currPage + 1, cm_curr_LCol); @@ -2774,11 +2723,8 @@ Switch_cm_next() * Switch to last page of file server screen *----------------------------------------------------------------------*/ int -Switch_cm_last() +Switch_cm_last(void *d1, void *d2) { - static char rn[] = "Switch_cm_last"; - - if (cm_pageType & CMD_NEXT) { /* we have a next page, refresh with last page number */ cm_refresh(cm_numPages, cm_curr_LCol); @@ -2794,10 +2740,8 @@ Switch_cm_last() * Switch to previous page of cache managers screen *----------------------------------------------------------------------*/ int -Switch_cm_prev() +Switch_cm_prev(void *d1, void *d2) { - static char rn[] = "Switch_cm_prev"; - if (cm_pageType & CMD_PREV) { /* we have a previous page, refresh to previous page */ cm_refresh(cm_currPage - 1, cm_curr_LCol); @@ -2812,10 +2756,8 @@ Switch_cm_prev() * Switch to first page of cache managers screen *----------------------------------------------------------------------*/ int -Switch_cm_first() +Switch_cm_first(void *d1, void *d2) { - static char rn[] = "Switch_cm_first"; - if (cm_pageType & CMD_PREV) { /* we have a previous page, refresh to first page */ cm_refresh(1, cm_curr_LCol); @@ -2830,10 +2772,8 @@ Switch_cm_first() * Scroll left on the cache managers screen *----------------------------------------------------------------------*/ int -Switch_cm_left() +Switch_cm_left(void *d1, void *d2) { - static char rn[] = "Switch_cm_left"; - if (cm_pageType & CMD_LEFT) { /* we have columns on left, refresh with new column number */ cm_refresh(cm_currPage, cm_curr_LCol - cm_cols_perPage); @@ -2849,10 +2789,8 @@ Switch_cm_left() * Scroll to first column on the cache managers screen *----------------------------------------------------------------------*/ int -Switch_cm_leftmost() +Switch_cm_leftmost(void *d1, void *d2) { - static char rn[] = "Switch_cm_leftmost"; - if (cm_pageType & CMD_LEFT) { /* we have columns on left, go to the first column */ cm_refresh(cm_currPage, 0); @@ -2867,10 +2805,8 @@ Switch_cm_leftmost() * Scroll right on the cache managers screen *----------------------------------------------------------------------*/ int -Switch_cm_right() +Switch_cm_right(void *d1, void *d2) { - static char rn[] = "Switch_cm_right"; - if (cm_pageType & CMD_RIGHT) { /* we have columns on right, refresh with new column number */ cm_refresh(cm_currPage, cm_curr_LCol + cm_cols_perPage); @@ -2885,12 +2821,10 @@ Switch_cm_right() * Scroll to last column on the cache managers screen *----------------------------------------------------------------------*/ int -Switch_cm_rightmost() +Switch_cm_rightmost(void *d1, void *d2) { - static char rn[] = "Switch_cm_rightmost"; int curr_LCol; - if (cm_pageType & CMD_RIGHT) { /* we have columns on right, go to the last column */ if (cm_numCols % cm_cols_perPage) @@ -2921,7 +2855,7 @@ Switch_cm_rightmost() *----------------------------------------------------------------------*/ int -create_CMframe_objects() +create_CMframe_objects(void) { /* create_CMframe_objects */ static char rn[] = "create_CMframe_objects"; struct ServerInfo_line *cm_lines_Ptr; @@ -3157,11 +3091,6 @@ create_CMframe_objects() } - - - - - /* initialize the column & page counters */ cm_currPage = 1; @@ -3205,7 +3134,7 @@ create_CMframe_objects() * for the overview, File Servers & Cache Managers screens. *----------------------------------------------------------------------*/ int -gtx_initialize() +gtx_initialize(void) { /* gtx_initialize */ static char rn[] = "gtx_initialize"; /* routine name */ int code; diff --git a/src/afsmonitor/afsmonitor.c b/src/afsmonitor/afsmonitor.c index b23da9c..2f31a3c 100644 --- a/src/afsmonitor/afsmonitor.c +++ b/src/afsmonitor/afsmonitor.c @@ -41,16 +41,13 @@ RCSID #include /*Dumb terminal window package */ #include /*X11 window package */ #include /*Frame package */ - - +#include #include #include - #include "afsmonitor.h" - /* command line parameter indices */ #define P_CONFIG 0 @@ -126,7 +123,7 @@ static struct afsmon_hostEntry *last_hostEntry; /* names of the last host processed in the config file */ static char last_fsHost[HOST_NAME_LEN]; static char last_cmHost[HOST_NAME_LEN]; -static lastHostType = 0; /* 0 = no host entries processed +static int lastHostType = 0; /* 0 = no host entries processed * 1 = last host was file server * 2 = last host was cache manager. */ @@ -203,17 +200,8 @@ struct cm_Display_Data *curr_cmData = (struct cm_Display_Data *)0; /* for previous probe cycle */ struct cm_Display_Data *prev_cmData = (struct cm_Display_Data *)0; - /* EXTERN DEFINITIONS */ -extern struct hostent *hostutil_GetHostByName(); - - - -/* routines from afsmon-output.c */ -extern int afsmon_fsOutput(); -extern int afsmon_cmOutput(); - /* file server and cache manager variable names (from afsmon_labels.h) */ extern char *fs_varNames[]; extern char *cm_varNames[]; @@ -236,8 +224,8 @@ int numHosts_oncm_alerts; /* flag to indicate that atleast one probe cycle has completed and data is available for updating the display */ -extern fs_Data_Available; -extern cm_Data_Available; +extern int fs_Data_Available; +extern int cm_Data_Available; extern int gtx_initialized; /* gtx initialized ? */ @@ -308,8 +296,7 @@ strcasestr(s1, s2) #endif struct hostent * -GetHostByName(name) - char *name; +GetHostByName(char *name) { struct hostent *he; #ifdef AFS_SUN5_ENV @@ -347,8 +334,7 @@ GetHostByName(name) *----------------------------------------------------------------------*/ int -afsmon_Exit(a_exitVal) - int a_exitVal; /* exit code */ +afsmon_Exit(int a_exitVal) /* exit code */ { /* afsmon_Exit */ static char rn[] = "afsmon_Exit"; struct afsmon_fs_Results_list *tmp_fslist; @@ -558,10 +544,8 @@ afsmon_Exit(a_exitVal) *----------------------------------------------------------------------*/ int -insert_FS(a_hostName) - char *a_hostName; /* name of cache manager to be inserted in list */ +insert_FS(char *a_hostName) /* name of cache manager to be inserted in list */ { /* insert_FS() */ - static char rn[] = "insert_FS"; /* routine name */ static struct afsmon_hostEntry *curr_item; static struct afsmon_hostEntry *prev_item; @@ -603,7 +587,7 @@ insert_FS(a_hostName) * Nothing. *----------------------------------------------------------------------*/ void -print_FS() +print_FS(void) { /* print_FS() */ static char rn[] = "print_FS"; struct afsmon_hostEntry *tempFS; @@ -647,10 +631,8 @@ print_FS() *----------------------------------------------------------------------*/ int -insert_CM(a_hostName) - char *a_hostName; /* name of cache manager to be inserted in list */ +insert_CM(char *a_hostName) /* name of cache manager to be inserted in list */ { /* insert_CM */ - static char rn[] = "insert_CM"; /* routine name */ static struct afsmon_hostEntry *curr_item; static struct afsmon_hostEntry *prev_item; @@ -693,7 +675,7 @@ insert_CM(a_hostName) * Nothing. *----------------------------------------------------------------------*/ int -print_CM() +print_CM(void) { /* print_CM() */ static char rn[] = "print_CM"; struct afsmon_hostEntry *tempCM; @@ -745,8 +727,7 @@ print_CM() *----------------------------------------------------------------------*/ int -parse_hostEntry(a_line) - char *a_line; +parse_hostEntry(char *a_line) { /* parse_hostEntry */ static char rn[] = "parse_hostEntry"; /* routine name */ @@ -823,8 +804,7 @@ parse_hostEntry(a_line) *----------------------------------------------------------------------*/ int -parse_threshEntry(a_line) - char *a_line; +parse_threshEntry(char *a_line) { /* parse_threshEntry */ static char rn[] = "parse_threshEntry"; /* routine name */ char opcode[CFG_STR_LEN]; /* specifies type of config entry */ @@ -928,12 +908,10 @@ parse_threshEntry(a_line) *----------------------------------------------------------------------*/ int -store_threshold(a_type, a_varName, a_value, a_handler) - int a_type; /* 1 = fs , 2 = cm */ - char *a_varName; /* threshold name */ - char *a_value; /* threshold value */ - char *a_handler; /* threshold overflow handler */ - +store_threshold(int a_type, /* 1 = fs , 2 = cm */ + char *a_varName, /* threshold name */ + char *a_value, /* threshold value */ + char *a_handler) /* threshold overflow handler */ { /* store_thresholds */ static char rn[] = "store_thresholds"; /* routine name */ @@ -1107,8 +1085,7 @@ store_threshold(a_type, a_varName, a_value, a_handler) *----------------------------------------------------------------------*/ int -parse_showEntry(a_line) - char *a_line; +parse_showEntry(char *a_line) { /* parse_showEntry */ static char rn[] = "parse_showEntry"; char opcode[CFG_STR_LEN]; /* specifies type of config entry */ @@ -1357,12 +1334,6 @@ parse_showEntry(a_line) idx++; numGroups--; } /* for each group in section */ - - - - - - } else { /* it is a variable name */ for (i = 0; i < NUM_CM_STAT_ENTRIES; i++) { @@ -1390,8 +1361,6 @@ parse_showEntry(a_line) } /* it is an cm entry */ return (0); - - } /* parse_showEntry */ @@ -1415,8 +1384,7 @@ parse_showEntry(a_line) *----------------------------------------------------------------------*/ int -process_config_file(a_config_filename) - char *a_config_filename; +process_config_file(char *a_config_filename) { /* process_config_file() */ static char rn[] = "process_config_file"; /* routine name */ FILE *configFD; /* config file descriptor */ @@ -1668,7 +1636,7 @@ process_config_file(a_config_filename) *----------------------------------------------------------------------*/ void -Print_FS_CB() +Print_FS_CB(void) { /* Print_FS_CB() */ struct afsmon_fs_Results_list *fslist; @@ -1726,9 +1694,7 @@ Print_FS_CB() * Failure: Exits afsmonitor. *----------------------------------------------------------------------*/ int -save_FS_results_inCB(a_newProbeCycle) - int a_newProbeCycle; /* start of a new probe cycle ? */ - +save_FS_results_inCB(int a_newProbeCycle) /* start of a new probe cycle ? */ { /* save_FS_results_inCB() */ static char rn[] = "save_FS_results_inCB"; /* routine name */ struct afsmon_fs_Results_list *tmp_fslist_item; /* temp fs list item */ @@ -1829,9 +1795,8 @@ save_FS_results_inCB(a_newProbeCycle) *----------------------------------------------------------------------*/ int -fs_Results_ltoa(a_fsData, a_fsResults) - struct fs_Display_Data *a_fsData; /* target buffer */ - struct xstat_fs_ProbeResults *a_fsResults; /* ptr to xstat fs Results */ +fs_Results_ltoa(struct fs_Display_Data *a_fsData, /* target buffer */ + struct xstat_fs_ProbeResults *a_fsResults) /* ptr to xstat fs Results */ { /* fs_Results_ltoa */ static char rn[] = "fs_Results_ltoa"; /* routine name */ @@ -1842,7 +1807,7 @@ fs_Results_ltoa(a_fsData, a_fsResults) afs_int32 *tmpbuf; if (afsmon_debug) { - fprintf(debugFD, "[ %s ] Called, a_fsData= %d, a_fsResults= %d\n", rn, + fprintf(debugFD, "[ %s ] Called, a_fsData= %p, a_fsResults= %p\n", rn, a_fsData, a_fsResults); fflush(debugFD); } @@ -1960,15 +1925,12 @@ fs_Results_ltoa(a_fsData, a_fsResults) *----------------------------------------------------------------------*/ int -execute_thresh_handler(a_handler, a_hostName, a_hostType, a_threshName, - a_threshValue, a_actValue) - char *a_handler; /* ptr to handler function + args */ - char *a_hostName; /* host name for which threshold crossed */ - int a_hostType; /* fs or cm ? */ - char *a_threshName; /* threshold variable name */ - char *a_threshValue; /* threshold value */ - char *a_actValue; /* actual value */ - +execute_thresh_handler(char *a_handler, /* ptr to handler function + args */ + char *a_hostName, /* host name for which threshold crossed */ + int a_hostType, /* fs or cm ? */ + char *a_threshName, /* threshold variable name */ + char *a_threshValue, /* threshold value */ + char *a_actValue) /* actual value */ { /* execute_thresh_handler */ static char rn[] = "execute_thresh_handler"; @@ -2067,10 +2029,8 @@ execute_thresh_handler(a_handler, a_hostName, a_hostType, a_threshName, *----------------------------------------------------------------------*/ int -check_fs_thresholds(a_hostEntry, a_Data) - struct afsmon_hostEntry *a_hostEntry; /* ptr to hostEntry */ - struct fs_Display_Data *a_Data; /* ptr to fs data to be displayed */ - +check_fs_thresholds(struct afsmon_hostEntry *a_hostEntry, /* ptr to hostEntry */ + struct fs_Display_Data *a_Data) /* ptr to fs data to be displayed */ { /* check_fs_thresholds */ static char rn[] = "check_fs_thresholds"; @@ -2082,7 +2042,7 @@ check_fs_thresholds(a_hostEntry, a_Data) int count; /* number of thresholds exceeded */ if (afsmon_debug) { - fprintf(debugFD, "[ %s ] Called, a_hostEntry= %d, a_Data= %d\n", rn, + fprintf(debugFD, "[ %s ] Called, a_hostEntry= %p, a_Data= %p\n", rn, a_hostEntry, a_Data); fflush(debugFD); } @@ -2162,8 +2122,7 @@ check_fs_thresholds(a_hostEntry, a_Data) *----------------------------------------------------------------------*/ int -save_FS_data_forDisplay(a_fsResults) - struct xstat_fs_ProbeResults *a_fsResults; +save_FS_data_forDisplay(struct xstat_fs_ProbeResults *a_fsResults) { /* save_FS_data_forDisplay */ static char rn[] = "save_FS_data_forDisplay"; /* routine name */ @@ -2181,12 +2140,10 @@ save_FS_data_forDisplay(a_fsResults) if (afsmon_debug) { - fprintf(debugFD, "[ %s ] Called, a_fsResults= %d\n", rn, a_fsResults); + fprintf(debugFD, "[ %s ] Called, a_fsResults= %p\n", rn, a_fsResults); fflush(debugFD); } - - /* store results in the display array */ okay = 0; @@ -2252,9 +2209,6 @@ save_FS_data_forDisplay(a_fsResults) afsmon_Exit(75); } - - - /* print the info we just saved */ if (afsmon_debug) { @@ -2359,7 +2313,7 @@ save_FS_data_forDisplay(a_fsResults) *----------------------------------------------------------------------*/ int -afsmon_FS_Handler() +afsmon_FS_Handler(void) { /* afsmon_FS_Handler() */ static char rn[] = "afsmon_FS_Handler"; /* routine name */ int newProbeCycle; /* start of new probe cycle ? */ @@ -2429,7 +2383,7 @@ afsmon_FS_Handler() *----------------------------------------------------------------------*/ void -Print_CM_CB() +Print_CM_CB(void) { /* Print_CM_CB() */ struct afsmon_cm_Results_list *cmlist; @@ -2489,9 +2443,7 @@ Print_CM_CB() *----------------------------------------------------------------------*/ int -save_CM_results_inCB(a_newProbeCycle) - int a_newProbeCycle; /* start of new probe cycle ? */ - +save_CM_results_inCB(int a_newProbeCycle) /* start of new probe cycle ? */ { /* save_CM_results_inCB() */ static char rn[] = "save_CM_results_inCB"; /* routine name */ struct afsmon_cm_Results_list *tmp_cmlist_item; /* temp cm list item */ @@ -2598,9 +2550,8 @@ save_CM_results_inCB(a_newProbeCycle) *----------------------------------------------------------------------*/ int -cm_Results_ltoa(a_cmData, a_cmResults) - struct cm_Display_Data *a_cmData; /* target buffer */ - struct xstat_cm_ProbeResults *a_cmResults; /* ptr to xstat cm Results */ +cm_Results_ltoa(struct cm_Display_Data *a_cmData, /* target buffer */ + struct xstat_cm_ProbeResults *a_cmResults) /* ptr to xstat cm Results */ { /* cm_Results_ltoa */ static char rn[] = "cm_Results_ltoa"; /* routine name */ @@ -2612,7 +2563,7 @@ cm_Results_ltoa(a_cmData, a_cmResults) afs_int32 numLongs; if (afsmon_debug) { - fprintf(debugFD, "[ %s ] Called, a_cmData= %d, a_cmResults= %d\n", rn, + fprintf(debugFD, "[ %s ] Called, a_cmData= %p, a_cmResults= %p\n", rn, a_cmData, a_cmResults); fflush(debugFD); } @@ -2847,10 +2798,8 @@ cm_Results_ltoa(a_cmData, a_cmResults) *----------------------------------------------------------------------*/ int -check_cm_thresholds(a_hostEntry, a_Data) - struct afsmon_hostEntry *a_hostEntry; /* ptr to hostEntry */ - struct cm_Display_Data *a_Data; /* ptr to cm data to be displayed */ - +check_cm_thresholds(struct afsmon_hostEntry *a_hostEntry, /* ptr to hostEntry */ + struct cm_Display_Data *a_Data) /* ptr to cm data to be displayed */ { /* check_cm_thresholds */ static char rn[] = "check_cm_thresholds"; @@ -2862,7 +2811,7 @@ check_cm_thresholds(a_hostEntry, a_Data) int count; /* number of thresholds exceeded */ if (afsmon_debug) { - fprintf(debugFD, "[ %s ] Called, a_hostEntry= %d, a_Data= %d\n", rn, + fprintf(debugFD, "[ %s ] Called, a_hostEntry= %p, a_Data= %p\n", rn, a_hostEntry, a_Data); fflush(debugFD); } @@ -2944,8 +2893,7 @@ check_cm_thresholds(a_hostEntry, a_Data) *----------------------------------------------------------------------*/ int -save_CM_data_forDisplay(a_cmResults) - struct xstat_cm_ProbeResults *a_cmResults; +save_CM_data_forDisplay(struct xstat_cm_ProbeResults *a_cmResults) { /* save_CM_data_forDisplay */ static char rn[] = "save_CM_data_forDisplay"; /* routine name */ @@ -2962,7 +2910,7 @@ save_CM_data_forDisplay(a_cmResults) int i; if (afsmon_debug) { - fprintf(debugFD, "[ %s ] Called, a_cmResults= %d\n", rn, a_cmResults); + fprintf(debugFD, "[ %s ] Called, a_cmResults= %p\n", rn, a_cmResults); fflush(debugFD); } @@ -3033,7 +2981,6 @@ save_CM_data_forDisplay(a_cmResults) afsmon_Exit(105); } - /* print the info we just saved */ if (afsmon_debug) { fprintf(debugFD, "\n\t\t ----- CM display data ------\n"); @@ -3177,7 +3124,7 @@ save_CM_data_forDisplay(a_cmResults) *----------------------------------------------------------------------*/ int -afsmon_CM_Handler() +afsmon_CM_Handler(void) { /* afsmon_CM_Handler() */ static char rn[] = "afsmon_CM_Handler"; /* routine name */ int code; /* return status */ @@ -3246,7 +3193,7 @@ afsmon_CM_Handler() *----------------------------------------------------------------------*/ int -init_fs_buffers() +init_fs_buffers(void) { /* init_fs_buffers() */ static char rn[] = "init_fs_buffers"; /* routine name */ struct afsmon_fs_Results_list *new_fslist_item; /* ptr for new struct */ @@ -3364,7 +3311,7 @@ init_fs_buffers() *----------------------------------------------------------------------*/ int -init_cm_buffers() +init_cm_buffers(void) { /* init_cm_buffers() */ static char rn[] = "init_cm_buffers"; /* routine name */ struct afsmon_cm_Results_list *new_cmlist_item; /* ptr for new struct */ @@ -3487,7 +3434,7 @@ init_cm_buffers() *------------------------------------------------------------------------*/ int -init_print_buffers() +init_print_buffers(void) { /* init_print_buffers */ static char rn[] = "init_print_buffers"; /* routine name */ @@ -3546,8 +3493,6 @@ init_print_buffers() } - - /* if file servers to monitor */ /* allocate numCM blocks of the CM print structure */ /* we need two instances of this structure for the same reasons as above */ @@ -3598,11 +3543,8 @@ init_print_buffers() *----------------------------------------------------------------------*/ void -quit_signal(sig) - int sig; +quit_signal(int sig) { /* quit_signal */ - static char *rn = "quit_signal"; /* routine name */ - fprintf(stderr, "Received signal %d \n", sig); afsmon_Exit(120); } /* quit_signal */ @@ -3626,7 +3568,7 @@ quit_signal(sig) *----------------------------------------------------------------------*/ int -afsmon_execute() +afsmon_execute(void) { /* afsmon_execute() */ static char rn[] = "afsmon_execute"; /* routine name */ static char fullhostname[128]; /* full host name */ @@ -3828,7 +3770,7 @@ afsmon_execute() } /* start the gtx input server */ - code = gtx_InputServer(afsmon_win); + code = (int) gtx_InputServer(afsmon_win); if (code) { fprintf(stderr, "[ %s ] Failed to start input server \n", rn); afsmon_Exit(140); @@ -3888,7 +3830,7 @@ afsmonInit(struct cmd_syndesc *as, void *arock) int i; if (afsmon_debug) { - fprintf(debugFD, "[ %s ] Called, as= %d\n", rn, as); + fprintf(debugFD, "[ %s ] Called, as= %p\n", rn, as); fflush(debugFD); } @@ -4153,12 +4095,8 @@ afsmonInit(struct cmd_syndesc *as, void *arock) #include "AFS_component_version_number.c" int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { /* main() */ - - static char rn[] = "main"; /* routine name */ afs_int32 code; /*Return code */ struct cmd_syndesc *ts; /*Ptr to cmd line syntax descriptor */ diff --git a/src/afsmonitor/afsmonitor.h b/src/afsmonitor/afsmonitor.h index 00d544d..06359df 100644 --- a/src/afsmonitor/afsmonitor.h +++ b/src/afsmonitor/afsmonitor.h @@ -83,3 +83,16 @@ what he wants displayed. */ /* Set this enable detailed debugging with the -debug switch */ #define DETAILED_DEBUG 0 + +/* afsmon-output.c */ + +extern int afsmon_fsOutput(char *, int); +extern int afsmon_cmOutput(char *, int); + +/* afsmon-win.c */ + +extern int ovw_refresh(int, int); +extern int fs_refresh(int, int); +extern int cm_refresh(int, int); +extern int gtx_initialize(void); + -- 1.9.4