예제 #1
0
DevMgr::ReturnCode
DevMgr::port_remove(port_t port_num)
{
  // TODO: check if port is taken...
  assert(!bmi_port_interface_remove(port_mgr, port_num));
  return ReturnCode::SUCCESS;
}
예제 #2
0
  ReturnCode port_remove_(port_t port_num) override {
    if (bmi_port_interface_remove(port_mgr, port_num))
      return ReturnCode::ERROR;

    Lock lock(mutex);
    port_info.erase(port_num);

    return ReturnCode::SUCCESS;
  }
예제 #3
0
int bmi_port_destroy_mgr(bmi_port_mgr_t *port_mgr) {
  int i;
  for(i = 0; i < PORT_COUNT_MAX; i++) {
    bmi_port_t *port = get_port(port_mgr, i);
    if(port_in_use(port)) bmi_port_interface_remove(port_mgr, i);
  }

  port_mgr->max_fd = -1;  // used to signal the thread it needs to terminate

  pthread_join(port_mgr->select_thread, NULL);

  pthread_mutex_destroy(&port_mgr->lock);
      
  free(port_mgr);

  return 0;
}
예제 #4
0
static int del_port(int iface) {
    fprintf(stderr, "switch is deleting port %d\n", iface);
    return bmi_port_interface_remove(port_mgr, iface);
}