/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
- *
+ *
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
#include <afsconfig.h>
#include <afs/param.h>
-RCSID
- ("$Header$");
-
#include <stdio.h>
+#include <string.h>
#include <signal.h>
#include <math.h>
-#include <cmd.h>
+#include <afs/cmd.h>
#include <string.h>
#undef IN
#include <time.h>
-#include <gtxwindows.h> /*Generic window package */
-#include <gtxobjects.h> /*Object definitions */
-#include <gtxkeymap.h>
-#if 0
-#include <gtxtextcb.h> /*Text object circular buffer interface */
-#include <gtxtextobj.h> /*Text object interface */
-#endif
-#include <gtxlightobj.h> /*Light object interface */
-#include <gtxcurseswin.h> /*Curses window package */
-#include <gtxdumbwin.h> /*Dumb terminal window package */
-#include <gtxX11win.h> /*X11 window package */
-#include <gtxframe.h> /*Frame package */
+#include <afs/gtxwindows.h> /*Generic window package */
+#include <afs/gtxobjects.h> /*Object definitions */
+#include <afs/gtxkeymap.h>
+#include <afs/gtxlightobj.h> /*Light object interface */
+#include <afs/gtxcurseswin.h> /*Curses window package */
+#include <afs/gtxdumbwin.h> /*Dumb terminal window package */
+#include <afs/gtxX11win.h> /*X11 window package */
+#include <afs/gtxframe.h> /*Frame package */
#include <afs/xstat_fs.h>
#include <afs/xstat_cm.h>
+#include <roken.h>
#include "afsmonitor.h"
#include "afsmon-labels.h"
{ /*initLightObject */
struct onode *newlightp; /*Ptr to new light onode */
struct gator_light_crparams light_crparams; /*Light creation params */
- char *truncname; /*Truncated name, if needed */
- int name_len; /*True length of name */
/* the following debug statement floods the debug file */
#ifdef DEBUG_DETAILED
* received.
*/
light_crparams.onode_params.cr_type = GATOR_OBJ_LIGHT;
- name_len = strlen(a_name);
- if (name_len <= a_width)
- sprintf(light_crparams.onode_params.cr_name, "%s", a_name);
- else {
- /*
- * We need to truncate the given name, leaving a `*' at the end to
- * show us it's been truncated.
- */
- truncname = light_crparams.onode_params.cr_name;
- strncpy(truncname, a_name, a_width - 1);
- truncname[a_width - 1] = '*';
- truncname[a_width] = 0;
- }
+ if (a_width >= sizeof(light_crparams.onode_params.cr_name))
+ a_width = sizeof(light_crparams.onode_params.cr_name) - 1;
+
+ if (a_width < 1)
+ a_width = 1;
+
+ if (strlcpy(light_crparams.onode_params.cr_name, a_name, a_width + 1) >= a_width + 1)
+ /* The name is truncated, put a '*' at the end to note */
+ light_crparams.onode_params.cr_name[a_width - 1] = '*';
+
light_crparams.onode_params.cr_x = a_x;
light_crparams.onode_params.cr_y = a_y;
light_crparams.onode_params.cr_width = a_width;
*------------------------------------------------------------------------*/
int
-justify_light(char *a_srcbuff, char *a_dstbuff, int a_dstwidth,
+justify_light(char *a_srcbuff, char *a_dstbuff, int a_dstwidth,
int a_justification, int a_rightTrunc)
{ /*justify_light */
* we automatically shorten up.
*/
if (a_dstwidth > GATOR_LABEL_CHARS) {
- /*
+ /*
* if (afsmon_debug) {
* fprintf(debugFD,
* "[%s] Dest width (%d) > gtx buflen (%d), shrinking dest width\n",
*
* Description:
* Call the exit routine. This function is mapped
- * to the keys Q and \ 3 in all the frames and is called by the
+ * to the keys Q and \ 3 in all the frames and is called by the
* gtx input server.
*----------------------------------------------------------------------*/
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
+ * OVW_UPDATE_BOTH = update fs & cm columns. Note that
+ * we do not want to update a column until the
* corresponding probe cycle has completed */
{ /* ovw_refresh */
fflush(debugFD);
}
- /* if the data is not yet available ie., not one probe cycle has
+ /* if the data is not yet available ie., not one probe cycle has
* completed, do nothing */
if ((a_updateType & OVW_UPDATE_FS) && !fs_Data_Available)
/* highlighten if overflowed or probe failed */
if (fsDataP->ovfCount || !fsDataP->probeOK)
- code = gator_light_set(*tmp_fsNames_o, 1);
+ gator_light_set(*tmp_fsNames_o, 1);
else
- code = gator_light_set(*tmp_fsNames_o, 0);
+ gator_light_set(*tmp_fsNames_o, 0);
} else { /* no more hosts, blank the rest of the entries */
/* highlighten if overflow or if probe failed */
if (cmDataP->ovfCount || !cmDataP->probeOK)
- code = gator_light_set(*tmp_cmNames_o, 1);
+ gator_light_set(*tmp_cmNames_o, 1);
else
- code = gator_light_set(*tmp_cmNames_o, 0);
+ gator_light_set(*tmp_cmNames_o, 0);
} else { /* no more hosts, blank the rest of the entries */
int hostLines; /* number of lines of host names to display */
struct onode **ovw_fsNames_o_Ptr; /* index to list of fs names onodes */
struct onode **ovw_cmNames_o_Ptr; /* index to list of cm names onodes */
- int code;
int i;
if (afsmon_debug) {
sprintf(errMsg, "[ %s ] Failed to create initMsg_o onode\n", rn);
afsmon_Exit(250);
}
- code = gtxframe_AddToList(ovwFrame, initMsg_o);
- code = gator_light_set(initMsg_o, HIGHLIGHT);
+ gtxframe_AddToList(ovwFrame, initMsg_o);
+ gator_light_set(initMsg_o, HIGHLIGHT);
initMsg_on = 1;
sprintf(errMsg, "[ %s ] Failed to create command onode\n", rn);
afsmon_Exit(265);
}
- code = gtxframe_AddToList(ovwFrame, ovw_cmd_o);
- code = gator_light_set(ovw_cmd_o, HIGHLIGHT);
+ gtxframe_AddToList(ovwFrame, ovw_cmd_o);
+ gator_light_set(ovw_cmd_o, HIGHLIGHT);
/* create the program name object */
sprintf(errMsg, "[ %s ] Failed to create programName onode\n", rn);
afsmon_Exit(255);
}
- code = gtxframe_AddToList(ovwFrame, ovw_progName_o);
- code = gator_light_set(ovw_progName_o, HIGHLIGHT);
+ gtxframe_AddToList(ovwFrame, ovw_progName_o);
+ gator_light_set(ovw_progName_o, HIGHLIGHT);
/* create the page number object */
sprintf(errMsg, "[ %s ] Failed to create pageNumber onode\n", rn);
afsmon_Exit(260);
}
- code = gtxframe_AddToList(ovwFrame, ovw_pageNum_o);
- code = gator_light_set(ovw_pageNum_o, HIGHLIGHT);
+ gtxframe_AddToList(ovwFrame, ovw_pageNum_o);
+ gator_light_set(ovw_pageNum_o, HIGHLIGHT);
/* create the probe number object */
ovw_probeNum_o =
sprintf(errMsg, "[ %s ] Failed to create probe number onode\n", rn);
afsmon_Exit(270);
}
- code = gtxframe_AddToList(ovwFrame, ovw_probeNum_o);
- code = gator_light_set(ovw_probeNum_o, HIGHLIGHT);
+ gtxframe_AddToList(ovwFrame, ovw_probeNum_o);
+ gator_light_set(ovw_probeNum_o, HIGHLIGHT);
/* create the numFS monitored object */
ovw_numFS_o = initLightObject("", 0, 2, FC_NUMHOSTS_O_WIDTH, afsmon_win);
sprintf(errMsg, "[ %s ] Failed to create numFS onode\n", rn);
afsmon_Exit(275);
}
- code = gtxframe_AddToList(ovwFrame, ovw_numFS_o);
+ gtxframe_AddToList(ovwFrame, ovw_numFS_o);
/* create the numCM monitored object */
ovw_numCM_o =
sprintf(errMsg, "[ %s ] Failed to create numCM_o onode\n", rn);
afsmon_Exit(280);
}
- code = gtxframe_AddToList(ovwFrame, ovw_numCM_o);
+ gtxframe_AddToList(ovwFrame, ovw_numCM_o);
/* create the number-of-FS-alerts object */
ovw_FSalerts_o =
sprintf(errMsg, "[ %s ] Failed to create FSalerts_o onode\n", rn);
afsmon_Exit(285);
}
- code = gtxframe_AddToList(ovwFrame, ovw_FSalerts_o);
+ gtxframe_AddToList(ovwFrame, ovw_FSalerts_o);
/* create the number-of-CM-alerts object */
ovw_CMalerts_o =
sprintf(errMsg, "[ %s ] Failed to create CMalerts_o onode\n", rn);
afsmon_Exit(290);
}
- code = gtxframe_AddToList(ovwFrame, ovw_CMalerts_o);
+ gtxframe_AddToList(ovwFrame, ovw_CMalerts_o);
/* create file-server-name and cache-manager-names objects */
ovw_numHosts_perPage = maxY - OVW_NUM_FIXED_LINES;
/* allocate memory for a list of onode pointers for file server names */
- ovw_fsNames_o =
- (struct onode **)malloc(sizeof(struct onode *) *
- ovw_numHosts_perPage);
+ ovw_fsNames_o = malloc(sizeof(struct onode *) * ovw_numHosts_perPage);
if (ovw_fsNames_o == NULL) {
sprintf(errMsg, "[ %s ] Failed to allocate memory for FS onodes\n",
rn);
* fflush(debugFD);
* }
*/
- code = gtxframe_AddToList(ovwFrame, *ovw_fsNames_o_Ptr);
+ gtxframe_AddToList(ovwFrame, *ovw_fsNames_o_Ptr);
ovw_fsNames_o_Ptr++;
}
/* allocate memory for a list of onode pointers for cache manager names */
- ovw_cmNames_o =
- (struct onode **)malloc(sizeof(struct onode *) *
- ovw_numHosts_perPage);
+ ovw_cmNames_o = malloc(sizeof(struct onode *) * ovw_numHosts_perPage);
if (ovw_cmNames_o == NULL) {
sprintf(errMsg, "[ %s ] Failed to allocate memory for CM onodes\n",
rn);
sprintf(errMsg, "[ %s ] Failed to create a CM name onode\n", rn);
afsmon_Exit(310);
}
- code = gtxframe_AddToList(ovwFrame, *ovw_cmNames_o_Ptr);
+ gtxframe_AddToList(ovwFrame, *ovw_cmNames_o_Ptr);
ovw_cmNames_o_Ptr++;
}
* The data in the file server & cache manager frames are displayed
* in two objects, one below the other. If the data is too long to
* fit in the first object it will overflow into the next. This is
- * to conserve real estate on the screen. This function copies the
+ * to conserve real estate on the screen. This function copies the
* contents of the source buffer adjusted to the two objects if the
- * probe had succeded. Otherwise it enters "--" in the first object
+ * probe had succeded. Otherwise it enters "--" in the first object
* blanks out the second. If the object needs to be highlightned
* (due to a threshold crossing) it is done.
*
part[i][j] = '\0';
}
- /*
+ /*
* if (afsmon_debug) {
* fprintf(debugFD,"[ %s ] LABELS %s -> %s %s %s\n",
* rn, a_srcBuf, part[0], part[1], part[2]);
*
* Description:
* Refresh the File Servers screen with the given page number starting
- * at the given left-column number. The appropriate contents of
- * prev_fsData are displayed.
+ * at the given left-column number. The appropriate contents of
+ * prev_fsData are displayed.
* First the status labels at the four corners of the screen are
* updated. Next the column labels are updated and then each row
* of statistics.
- *
+ *
* Returns:
* Success: 0
* Failure: Exits afsmoitor on a severe error.
int code;
int fsIdx;
int labelIdx;
- int dataIndex; /* index to the data[] field of
+ int dataIndex; /* index to the data[] field of
* struct fs_Display_Data */
if (afsmon_debug) {
}
- /* if the data is not yet available, ie., not one probe cycle has
+ /* if the data is not yet available, ie., not one probe cycle has
* completed, do nothing */
if (!fs_Data_Available)
/* command line */
/* figure out what we need to show in the prompt & set the page type */
- /* the fs_pageType variable is in turn used by the keyboard handler
+ /* the fs_pageType variable is in turn used by the keyboard handler
* routines to call fs_refresh() with the correct parameters */
fs_pageType = resolve_CmdLine(cmdLine, 1 /* fs frame */ , a_pageNum,
if (labelIdx < fs_numCols) {
dataIndex = fs_Display_map[labelIdx];
- code =
- display_Server_label(fs_labels[dataIndex], *fsLabels_o_Ptr1,
- *fsLabels_o_Ptr2, *fsLabels_o_Ptr3);
+ display_Server_label(fs_labels[dataIndex], *fsLabels_o_Ptr1,
+ *fsLabels_o_Ptr2, *fsLabels_o_Ptr3);
labelIdx++; /* next label */
} else {
- code =
- display_Server_label("//", *fsLabels_o_Ptr1, *fsLabels_o_Ptr2,
- *fsLabels_o_Ptr3);
+ display_Server_label("//", *fsLabels_o_Ptr1, *fsLabels_o_Ptr2,
+ *fsLabels_o_Ptr3);
}
fsLabels_o_Ptr1++; /* next onode in label row 1 */
/* display the hostname , first names only please! */
- sprintf(printBuf, fsDataP->hostName);
+ sprintf(printBuf, "%s", fsDataP->hostName);
for (j = 0; j < strlen(printBuf); j++) {
if (printBuf[j] == '.') {
printBuf[j] = '\0';
* overflow flag is set and highlight if so. if the probe had failed
* enter "--" is all columns */
- /* each host has two rows of slots for datums. get the pointers to
+ /* each host has two rows of slots for datums. get the pointers to
* both the arrays */
firstSlot_o_Ptr = tmp_fs_lines_P->data_o[0];
dataIndex = fs_Display_map[fs_curr_RCol];
- code =
- display_Server_datum(fsDataP->data[dataIndex],
- *firstSlot_o_Ptr,
- *secondSlot_o_Ptr,
- fsDataP->probeOK, RIGHT_JUSTIFY,
- fsDataP->threshOvf[dataIndex]);
+ display_Server_datum(fsDataP->data[dataIndex],
+ *firstSlot_o_Ptr,
+ *secondSlot_o_Ptr,
+ fsDataP->probeOK, RIGHT_JUSTIFY,
+ fsDataP->threshOvf[dataIndex]);
fs_curr_RCol++;
} else { /* no more data, blank out columns */
- code = display_Server_datum("", *firstSlot_o_Ptr, *secondSlot_o_Ptr, 1, /* probe ok */
- RIGHT_JUSTIFY, 0); /* no overflow */
+ display_Server_datum("", *firstSlot_o_Ptr, *secondSlot_o_Ptr, 1, /* probe ok */
+ RIGHT_JUSTIFY, 0); /* no overflow */
}
secondSlot_o_Ptr = tmp_fs_lines_P->data_o[1];
for (k = 0; k < fs_cols_perPage; k++) {
- code = display_Server_datum("", *firstSlot_o_Ptr, *secondSlot_o_Ptr, 1, /* probe OK */
- RIGHT_JUSTIFY, 0); /* dont highlight */
+ display_Server_datum("", *firstSlot_o_Ptr, *secondSlot_o_Ptr, 1, /* probe OK */
+ RIGHT_JUSTIFY, 0); /* dont highlight */
firstSlot_o_Ptr++;
secondSlot_o_Ptr++;
* Switch_fs_2_cm()
*
* Description:
- * Switch from the File Server screen to the Cache Managers screen.
+ * Switch from the File Server screen to the Cache Managers screen.
*----------------------------------------------------------------------*/
int
Switch_fs_2_cm(void *d1, void *d2)
* Switch_fs_next()
*
* Description:
- * Switch to next page of file server screen
+ * Switch to next page of file server screen
*----------------------------------------------------------------------*/
int
Switch_fs_next(void *d1, void *d2)
* Switch_fs_last()
*
* Description:
- * Switch to last page of file server screen
+ * Switch to last page of file server screen
*----------------------------------------------------------------------*/
int
Switch_fs_last(void *d1, void *d2)
* Switch_fs_prev()
*
* Description:
- * Switch to previous page of file server screen
+ * Switch to previous page of file server screen
*----------------------------------------------------------------------*/
int
Switch_fs_prev(void *d1, void *d2)
* Switch_fs_first()
*
* Description:
- * Switch to first page of file server screen
+ * Switch to first page of file server screen
*----------------------------------------------------------------------*/
int
Switch_fs_first(void *d1, void *d2)
* Switch_fs_left()
*
* Description:
- * Scroll left on the file server screen
+ * Scroll left on the file server screen
*----------------------------------------------------------------------*/
int
Switch_fs_left(void *d1, void *d2)
* Switch_fs_leftmost()
*
* Description:
- * Scroll to first column on the file server screen
+ * Scroll to first column on the file server screen
*----------------------------------------------------------------------*/
int
Switch_fs_leftmost(void *d1, void *d2)
* Switch_fs_right()
*
* Description:
- * Scroll right on the file server screen
+ * Scroll right on the file server screen
*----------------------------------------------------------------------*/
int
Switch_fs_right(void *d1, void *d2)
* Switch_fs_rightmost()
*
* Description:
- * Scroll to last column on the file server screen
+ * Scroll to last column on the file server screen
*----------------------------------------------------------------------*/
int
Switch_fs_rightmost(void *d1, void *d2)
struct onode **fsLabels_o_Ptr;
int x_pos;
int y_pos;
- int code;
int i;
int j;
int numBytes;
sprintf(errMsg, "[ %s ] Failed to create fs command onode\n", rn);
afsmon_Exit(340);
}
- code = gtxframe_AddToList(fsFrame, fs_cmd_o);
- code = gator_light_set(fs_cmd_o, HIGHLIGHT);
+ gtxframe_AddToList(fsFrame, fs_cmd_o);
+ gator_light_set(fs_cmd_o, HIGHLIGHT);
/* we already have the dimensions for the frame - same as the ovw frame */
/* use the ovw program name object for the fs screen too */
- code = gtxframe_AddToList(fsFrame, ovw_progName_o);
+ gtxframe_AddToList(fsFrame, ovw_progName_o);
/* create the page number object */
sprintf(errMsg, "[ %s ] Failed to create pageNumber onode\n", rn);
afsmon_Exit(335);
}
- code = gtxframe_AddToList(fsFrame, fs_pageNum_o);
- code = gator_light_set(fs_pageNum_o, HIGHLIGHT);
+ gtxframe_AddToList(fsFrame, fs_pageNum_o);
+ gator_light_set(fs_pageNum_o, HIGHLIGHT);
/* create the probe number object */
fs_probeNum_o =
sprintf(errMsg, "[ %s ] Failed to create fs probeNum onode\n", rn);
afsmon_Exit(345);
}
- code = gtxframe_AddToList(fsFrame, fs_probeNum_o);
- code = gator_light_set(fs_probeNum_o, HIGHLIGHT);
+ gtxframe_AddToList(fsFrame, fs_probeNum_o);
+ gator_light_set(fs_probeNum_o, HIGHLIGHT);
/* create the numFS monitored object */
"[ %s ] Failed to create numFS onode for the fs frame\n", rn);
afsmon_Exit(350);
}
- code = gtxframe_AddToList(fsFrame, fs_numFS_o);
+ gtxframe_AddToList(fsFrame, fs_numFS_o);
/* create the "more columns to left" indicator */
fs_leftArrows_o =
rn);
afsmon_Exit(355);
}
- code = gtxframe_AddToList(fsFrame, fs_leftArrows_o);
+ gtxframe_AddToList(fsFrame, fs_leftArrows_o);
/* create the "more columns to right" indicator */
fs_rightArrows_o =
rn);
afsmon_Exit(360);
}
- code = gtxframe_AddToList(fsFrame, fs_rightArrows_o);
+ gtxframe_AddToList(fsFrame, fs_rightArrows_o);
* the file server statistics */
numBytes = fs_numHosts_perPage * sizeof(struct ServerInfo_line);
- fs_lines = (struct ServerInfo_line *)malloc(numBytes);
+ fs_lines = malloc(numBytes);
if (fs_lines == (struct ServerInfo_line *)0) {
sprintf(errMsg,
"[ %s ] Failed to allocate %d bytes for FS data lines\n", rn,
afsmon_Exit(365);
}
- /* for each line of server statistics allocate memory to store two arrays
+ /* for each line of server statistics allocate memory to store two arrays
* of data onodes */
fs_lines_Ptr = fs_lines;
for (i = 0; i < fs_numHosts_perPage; i++) {
for (arrIdx = 0; arrIdx < 2; arrIdx++) {
numBytes = fs_cols_perPage * sizeof(struct onode *);
- fs_lines_Ptr->data_o[arrIdx] = (struct onode **)malloc(numBytes);
+ fs_lines_Ptr->data_o[arrIdx] = malloc(numBytes);
if (fs_lines_Ptr->data_o[arrIdx] == NULL) {
sprintf(errMsg,
"[ %s ] Failed to allocate %d bytes for FS data onodes\n",
sprintf(errMsg, "[ %s ] Failed to create an FS name onode\n", rn);
afsmon_Exit(375);
}
- code = gtxframe_AddToList(fsFrame, fs_lines_Ptr->host_o);
+ gtxframe_AddToList(fsFrame, fs_lines_Ptr->host_o);
/* if (afsmon_debug) {
* fprintf(debugFD,"[ %s ] Addr of host_o = %d for line %d\n",
"[ %s ] Failed to create an FS data onode\n", rn);
afsmon_Exit(380);
}
- code = gtxframe_AddToList(fsFrame, *fs_data_o_Ptr);
+ gtxframe_AddToList(fsFrame, *fs_data_o_Ptr);
fs_data_o_Ptr++;
} /* for each column */
* labels */
for (arrIdx = 0; arrIdx < 3; arrIdx++) {
- fsLabels_o[arrIdx] =
- (struct onode **)malloc(sizeof(struct onode *) * fs_cols_perPage);
+ fsLabels_o[arrIdx] = malloc(sizeof(struct onode *) * fs_cols_perPage);
if (fsLabels_o[arrIdx] == NULL) {
sprintf(errMsg,
"[ %s ] Failed to allocate memory for FS label onodes\n",
rn);
afsmon_Exit(390);
}
- code = gtxframe_AddToList(fsFrame, *fsLabels_o_Ptr);
+ gtxframe_AddToList(fsFrame, *fsLabels_o_Ptr);
fsLabels_o_Ptr++;
}
keymap_BindToString(fsFrame->keymap, "Q", afsmonExit_gtx, NULL, NULL);
keymap_BindToString(fsFrame->keymap, "\ 3", afsmonExit_gtx, NULL, NULL);
- /* o = overview, c = cm, n = next, p = prev, l = left, r = right
+ /* o = overview, c = cm, n = next, p = prev, l = left, r = right
* N = last page, P = first page, L = leftmost col, R = rightmost col */
keymap_BindToString(fsFrame->keymap, "o", Switch_fs_2_ovw, NULL, NULL);
*
* Description:
* Refresh the Cache Managers screen with the given page number starting
- * at the given left-column number. The appropriate contents of
- * prev_cmData are displayed.
+ * at the given left-column number. The appropriate contents of
+ * prev_cmData are displayed.
* First the status labels at the four corners of the screen are
* updated. Next the column labels are updated and then each row
* of statistics.
- *
+ *
* Returns:
* Success: 0
* Failure: Exits afsmoitor on a severe error.
int code;
int cmIdx;
int labelIdx;
- int dataIndex; /* index to the data[] field of
+ int dataIndex; /* index to the data[] field of
* struct cm_Display_Data */
if (afsmon_debug) {
}
- /* if the data is not yet available, ie., not one probe cycle has
+ /* if the data is not yet available, ie., not one probe cycle has
* completed, do nothing */
if (!cm_Data_Available)
/* command line */
/* figure out what we need to show in the prompt & set the page type */
- /* the cm_pageType variable is in turn used by the keyboard handler
+ /* the cm_pageType variable is in turn used by the keyboard handler
* routines to call cm_refresh() with the correct parameters */
cm_pageType = resolve_CmdLine(cmdLine, 2 /* cm frame */ , a_pageNum,
if (labelIdx < cm_numCols) {
dataIndex = cm_Display_map[labelIdx];
- code =
- display_Server_label(cm_labels[dataIndex], *cmLabels_o_Ptr1,
- *cmLabels_o_Ptr2, *cmLabels_o_Ptr3);
+ display_Server_label(cm_labels[dataIndex], *cmLabels_o_Ptr1,
+ *cmLabels_o_Ptr2, *cmLabels_o_Ptr3);
labelIdx++; /* next label */
} else {
- code =
- display_Server_label("//", *cmLabels_o_Ptr1, *cmLabels_o_Ptr2,
- *cmLabels_o_Ptr3);
+ display_Server_label("//", *cmLabels_o_Ptr1, *cmLabels_o_Ptr2,
+ *cmLabels_o_Ptr3);
}
cmLabels_o_Ptr1++; /* next onode in label row 1 */
/* display the hostname , first names only please! */
- sprintf(printBuf, cmDataP->hostName);
+ sprintf(printBuf, "%s", cmDataP->hostName);
for (j = 0; j < strlen(printBuf); j++) {
if (printBuf[j] == '.') {
printBuf[j] = '\0';
* overflow flag is set and highlight if so. if the probe had failed
* enter "--" is all columns */
- /* each host has two rows of slots for datums. get the pointers to
+ /* each host has two rows of slots for datums. get the pointers to
* both the arrays */
firstSlot_o_Ptr = tmp_cm_lines_P->data_o[0];
dataIndex = cm_Display_map[cm_curr_RCol];
- code =
- display_Server_datum(cmDataP->data[dataIndex],
- *firstSlot_o_Ptr,
- *secondSlot_o_Ptr,
- cmDataP->probeOK, RIGHT_JUSTIFY,
- cmDataP->threshOvf[dataIndex]);
+ display_Server_datum(cmDataP->data[dataIndex],
+ *firstSlot_o_Ptr,
+ *secondSlot_o_Ptr,
+ cmDataP->probeOK, RIGHT_JUSTIFY,
+ cmDataP->threshOvf[dataIndex]);
cm_curr_RCol++;
} else { /* no more data, blank out columns */
- code = display_Server_datum("", *firstSlot_o_Ptr, *secondSlot_o_Ptr, 1, /* probe ok */
- RIGHT_JUSTIFY, 0); /* no overflow */
+ display_Server_datum("", *firstSlot_o_Ptr, *secondSlot_o_Ptr, 1, /* probe ok */
+ RIGHT_JUSTIFY, 0); /* no overflow */
}
secondSlot_o_Ptr = tmp_cm_lines_P->data_o[1];
for (k = 0; k < cm_cols_perPage; k++) {
- code = display_Server_datum("", *firstSlot_o_Ptr, *secondSlot_o_Ptr, 1, /* probe OK */
+ display_Server_datum("", *firstSlot_o_Ptr, *secondSlot_o_Ptr, 1, /* probe OK */
RIGHT_JUSTIFY, 0); /* dont highlight */
firstSlot_o_Ptr++;
* Switch_cm_2_fs()
*
* Description:
- * Switch from the Cache Manager screen to the File Servers screen
+ * Switch from the Cache Manager screen to the File Servers screen
*----------------------------------------------------------------------*/
int
Switch_cm_2_fs(void *d1, void *d2)
* Switch_cm_next()
*
* Description:
- * Switch to next page of cache managers screen
+ * Switch to next page of cache managers screen
*----------------------------------------------------------------------*/
int
Switch_cm_next(void *d1, void *d2)
* Switch_cm_last()
*
* Description:
- * Switch to last page of file server screen
+ * Switch to last page of file server screen
*----------------------------------------------------------------------*/
int
Switch_cm_last(void *d1, void *d2)
* Switch_cm_prev()
*
* Description:
- * Switch to previous page of cache managers screen
+ * Switch to previous page of cache managers screen
*----------------------------------------------------------------------*/
int
Switch_cm_prev(void *d1, void *d2)
* Switch_cm_first()
*
* Description:
- * Switch to first page of cache managers screen
+ * Switch to first page of cache managers screen
*----------------------------------------------------------------------*/
int
Switch_cm_first(void *d1, void *d2)
* Switch_cm_left()
*
* Description:
- * Scroll left on the cache managers screen
+ * Scroll left on the cache managers screen
*----------------------------------------------------------------------*/
int
Switch_cm_left(void *d1, void *d2)
* Switch_cm_leftmost()
*
* Description:
- * Scroll to first column on the cache managers screen
+ * Scroll to first column on the cache managers screen
*----------------------------------------------------------------------*/
int
Switch_cm_leftmost(void *d1, void *d2)
* Switch_cm_right()
*
* Description:
- * Scroll right on the cache managers screen
+ * Scroll right on the cache managers screen
*----------------------------------------------------------------------*/
int
Switch_cm_right(void *d1, void *d2)
* Switch_cm_rightmost()
*
* Description:
- * Scroll to last column on the cache managers screen
+ * Scroll to last column on the cache managers screen
*----------------------------------------------------------------------*/
int
Switch_cm_rightmost(void *d1, void *d2)
struct onode **cmLabels_o_Ptr;
int x_pos;
int y_pos;
- int code;
int i;
int j;
int numBytes;
sprintf(errMsg, "[ %s ] Failed to create cm command onode\n", rn);
afsmon_Exit(420);
}
- code = gtxframe_AddToList(cmFrame, cm_cmd_o);
- code = gator_light_set(cm_cmd_o, HIGHLIGHT);
+ gtxframe_AddToList(cmFrame, cm_cmd_o);
+ gator_light_set(cm_cmd_o, HIGHLIGHT);
/* we already have the dimensions for the frame - same as the ovw frame */
/* use the ovw program name object for the cm screen too */
- code = gtxframe_AddToList(cmFrame, ovw_progName_o);
+ gtxframe_AddToList(cmFrame, ovw_progName_o);
/* create the page number object */
sprintf(errMsg, "[ %s ] Failed to create pageNumber onode\n", rn);
afsmon_Exit(415);
}
- code = gtxframe_AddToList(cmFrame, cm_pageNum_o);
- code = gator_light_set(cm_pageNum_o, HIGHLIGHT);
+ gtxframe_AddToList(cmFrame, cm_pageNum_o);
+ gator_light_set(cm_pageNum_o, HIGHLIGHT);
/* create the probe number object */
cm_probeNum_o =
sprintf(errMsg, "[ %s ] Failed to create cm probeNum onode\n", rn);
afsmon_Exit(425);
}
- code = gtxframe_AddToList(cmFrame, cm_probeNum_o);
- code = gator_light_set(cm_probeNum_o, HIGHLIGHT);
+ gtxframe_AddToList(cmFrame, cm_probeNum_o);
+ gator_light_set(cm_probeNum_o, HIGHLIGHT);
/* create the numCM monitored object */
"[ %s ] Failed to create numCM onode for the cm frame\n", rn);
afsmon_Exit(430);
}
- code = gtxframe_AddToList(cmFrame, cm_numCM_o);
+ gtxframe_AddToList(cmFrame, cm_numCM_o);
/* create the "more columns to left" indicator */
cm_leftArrows_o =
rn);
afsmon_Exit(435);
}
- code = gtxframe_AddToList(cmFrame, cm_leftArrows_o);
+ gtxframe_AddToList(cmFrame, cm_leftArrows_o);
/* create the "more columns to right" indicator */
cm_rightArrows_o =
rn);
afsmon_Exit(440);
}
- code = gtxframe_AddToList(cmFrame, cm_rightArrows_o);
+ gtxframe_AddToList(cmFrame, cm_rightArrows_o);
* the file server statistics */
numBytes = cm_numHosts_perPage * sizeof(struct ServerInfo_line);
- cm_lines = (struct ServerInfo_line *)malloc(numBytes);
+ cm_lines = malloc(numBytes);
if (cm_lines == (struct ServerInfo_line *)0) {
sprintf(errMsg,
"[ %s ] Failed to allocate %d bytes for CM data lines\n", rn,
afsmon_Exit(445);
}
- /* for each line of server statistics allocate memory to store two arrays
+ /* for each line of server statistics allocate memory to store two arrays
* of data onodes */
cm_lines_Ptr = cm_lines;
for (i = 0; i < cm_numHosts_perPage; i++) {
for (arrIdx = 0; arrIdx < 2; arrIdx++) {
numBytes = cm_cols_perPage * sizeof(struct onode *);
- cm_lines_Ptr->data_o[arrIdx] = (struct onode **)malloc(numBytes);
+ cm_lines_Ptr->data_o[arrIdx] = malloc(numBytes);
if (cm_lines_Ptr->data_o[arrIdx] == NULL) {
sprintf(errMsg,
"[ %s ] Failed to allocate %d bytes for CM data onodes\n",
sprintf(errMsg, "[ %s ] Failed to create an CM name onode\n", rn);
afsmon_Exit(455);
}
- code = gtxframe_AddToList(cmFrame, cm_lines_Ptr->host_o);
+ gtxframe_AddToList(cmFrame, cm_lines_Ptr->host_o);
/* if (afsmon_debug) {
* fprintf(debugFD,"[ %s ] Addr of host_o = %d for line %d\n",
"[ %s ] Failed to create an CM data onode\n", rn);
afsmon_Exit(460);
}
- code = gtxframe_AddToList(cmFrame, *cm_data_o_Ptr);
+ gtxframe_AddToList(cmFrame, *cm_data_o_Ptr);
cm_data_o_Ptr++;
} /* for each column */
* labels */
for (arrIdx = 0; arrIdx < 3; arrIdx++) {
- cmLabels_o[arrIdx] =
- (struct onode **)malloc(sizeof(struct onode *) * cm_cols_perPage);
+ cmLabels_o[arrIdx] = malloc(sizeof(struct onode *) * cm_cols_perPage);
if (cmLabels_o[arrIdx] == NULL) {
sprintf(errMsg,
"[ %s ] Failed to allocate memory for CM label onodes\n",
rn);
afsmon_Exit(470);
}
- code = gtxframe_AddToList(cmFrame, *cmLabels_o_Ptr);
+ gtxframe_AddToList(cmFrame, *cmLabels_o_Ptr);
cmLabels_o_Ptr++;
}
keymap_BindToString(cmFrame->keymap, "Q", afsmonExit_gtx, NULL, NULL);
keymap_BindToString(cmFrame->keymap, "\ 3", afsmonExit_gtx, NULL, NULL);
- /* o = overview, c = cm, n = next, p = prev, l = left, r = right
+ /* o = overview, c = cm, n = next, p = prev, l = left, r = right
* N = last page, P = first page, L = leftmost col, R = rightmost col */
keymap_BindToString(cmFrame->keymap, "o", Switch_cm_2_ovw, NULL, NULL);