Пример #1
0
static void
print_info(struct cfg *cfg)
{
	const char *c;
	int i;
	
	c = strrchr(cfg->controlfile, '/');
	if (c != NULL)
		c = c + 1;
	else
		c = cfg->controlfile;
	if (cfg->verbose) {
		printf("%s: %s with %d ports and %d VLAN groups\n", c,
		    cfg->info.es_name, cfg->info.es_nports,
		    cfg->info.es_nvlangroups);
		printf("%s: ", c);
		printb("VLAN capabilities",  cfg->info.es_vlan_caps,
		    ETHERSWITCH_VLAN_CAPS_BITS);
		printf("\n");
	}
	print_config(cfg);
	for (i=0; i<cfg->info.es_nports; i++) {
		print_port(cfg, i);
	}
	for (i=0; i<cfg->info.es_nvlangroups; i++) {
		print_vlangroup(cfg, i);
	}
}
Пример #2
0
static void
newmode(struct cfg *cfg, enum cmdmode mode)
{
	if (mode == cfg->mode)
		return;
	switch (cfg->mode) {
	case MODE_NONE:
		break;
	case MODE_PORT:
		print_port(cfg, cfg->unit);
		break;
	case MODE_VLANGROUP:
		print_vlangroup(cfg, cfg->unit);
		break;
	case MODE_REGISTER:
	case MODE_PHYREG:
		break;
	}
	cfg->mode = mode;
}
Пример #3
0
static void
print_info(struct cfg *cfg)
{
	const char *c;
	int i;
	
	c = strrchr(cfg->controlfile, '/');
	if (c != NULL)
		c = c + 1;
	else
		c = cfg->controlfile;
	if (cfg->verbose)
		printf("%s: %s with %d ports and %d VLAN groups\n",
			c, cfg->info.es_name, cfg->info.es_nports, cfg->info.es_nvlangroups);
	for (i=0; i<cfg->info.es_nports; i++) {
		print_port(cfg, i);
	}
	for (i=0; i<cfg->info.es_nvlangroups; i++) {
		print_vlangroup(cfg, i);
	}
}