Beispiel #1
0
// force link down, end channels and generate all events
link_t link_down(link_t link)
{
  if(!link) return NULL;

  LOG("forcing link down for %s",hashname_short(link->id));

  // generate down event if up
  if(link_up(link))
  {
    e3x_exchange_down(link->x);
    mesh_link(link->mesh, link);
  }

  // end all channels
  chan_t c, cnext;
  for(c = link->chans;c;c = cnext)
  {
    cnext = chan_next(c);
    chan_err(c, "disconnected");
    chan_process(c, 0);
  }

  // remove pipe
  if(link->send_cb)
  {
    link->send_cb(link, NULL, link->send_arg); // notify jic
    link->send_cb = NULL;
    link->send_arg = NULL;
  }

  return NULL;
}
int chan_sysfs_create(struct dahdi_chan *chan)
{
	char chan_name[32];
	void *dummy;
	int res = 0;

	if (chan->channo >= 250)
		return 0;
	if (test_bit(DAHDI_FLAGBIT_DEVFILE, &chan->flags))
		return 0;
	snprintf(chan_name, sizeof(chan_name), "dahdi!%d", chan->channo);
	dummy = (void *)MAKE_DAHDI_DEV(chan->channo, chan_name);
	if (IS_ERR(dummy)) {
		res = PTR_ERR(dummy);
		chan_err(chan, "Failed creating sysfs device: %d\n",
				res);
		return res;
	}
	set_bit(DAHDI_FLAGBIT_DEVFILE, &chan->flags);
	return 0;
}