Skip to content
Snippets Groups Projects
Commit 9ad73dee authored by Adam Wujek's avatar Adam Wujek :speech_balloon: Committed by Alessandro Rubini
Browse files

userspace/tools: remove SHOW_SNMP_PORTS and option "p" from wr_mon


Since commit "userspace/snmpd: make snmpd use shm for HAL requests"
snmpd uses shm to get information from HAL instead of wr_mon.

Signed-off-by: default avatarAdam Wujek <adam.wujek@cern.ch>
parent 977ff991
Branches
Tags
No related merge requests found
......@@ -589,11 +589,13 @@ use @t{ppsi_g} for globals and @t{ppsi_p} for the per-port table.
To keep the code compact and extensible, I chose to @t{popen(3)} a
connection to existing tools. The tools report information to
@i{stdout} in a line-oriented tagged-format: ``@t{<key>: <value>\n}''.
Thus, @t{wr_mon} now supports @t{-g} (``@t{SHOW_SNMP_GLOBALS}'') and
@t{-p} (``@t{SHOW_SNMP_PORTS}''). By pre-setting environment variables
Thus, @t{wr_mon} now supports @t{-g} (``@t{SHOW_SNMP_GLOBALS}'').
By pre-setting environment variables
it's also possible to override the command names, for testing; see
source code for details.
To get information about ports shm is used instead of wr_mon.
Parsing is implemented using a @t{pickinfo} structure, where each key
is associated to a data type, a pointer and a size. This is is used
to actually @t{sscanf} the value into a global structure. The same
......
......@@ -14,7 +14,6 @@
#define SHOW_GUI 0
#define SHOW_STATS 1
#define SHOW_SNMP_PORTS 2
#define SHOW_SNMP_GLOBALS 3
int mode = SHOW_GUI;
......@@ -156,25 +155,6 @@ void show_ports(void)
}
printf("\n");
}
else if (mode == SHOW_SNMP_PORTS) {
for (i = 0; i < hal_nports_local; ++i) {
char if_name[10];
printf("PORT %i\n", i);
snprintf(if_name, 10, "wr%d", i);
port_state = hal_lookup_port(hal_ports_local_copy,
hal_nports_local, if_name);
if (!port_state)
continue;
printf("linkup: %d\n", state_up(port_state->state));
printf("mode: %d\n",
port_state->mode == HEXP_PORT_MODE_WR_SLAVE
? 0 : 1);
printf("locked: %d\n", port_state->locked);
printf("peer_id: ff:ff:ff:ff:ff:ff:ff:ff\n"); /* FIXME */
}
}
}
/*
......@@ -330,7 +310,7 @@ int main(int argc, char *argv[])
int opt;
int usecolor = 1;
init_shm();
while((opt=getopt(argc, argv, "sbgpw")) != -1)
while((opt=getopt(argc, argv, "sbgw")) != -1)
{
switch(opt)
{
......@@ -344,10 +324,6 @@ int main(int argc, char *argv[])
mode = SHOW_SNMP_GLOBALS;
show_all();
exit(0);
case 'p':
mode = SHOW_SNMP_PORTS;
show_all();
exit(0);
case 'w': /* for the web interface */
show_unadorned_ports();
exit(0);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment