当前位置: 首页>>代码示例>>C++>>正文


C++ device_lookup_private函数代码示例

本文整理汇总了C++中device_lookup_private函数的典型用法代码示例。如果您正苦于以下问题:C++ device_lookup_private函数的具体用法?C++ device_lookup_private怎么用?C++ device_lookup_private使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了device_lookup_private函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: m41t00_open

/*ARGSUSED*/
int
m41t00_open(dev_t dev, int flag, int fmt, struct lwp *l)
{
	struct m41t00_softc *sc;

	if ((sc = device_lookup_private(&m41trtc_cd, minor(dev))) == NULL)
		return ENXIO;

	/* XXX: Locking */

	if (sc->sc_open)
		return EBUSY;

	sc->sc_open = 1;
	return 0;
}
开发者ID:Tommmster,项目名称:netbsd-avr32,代码行数:17,代码来源:m41t00.c

示例2: stty_stop

void
stty_stop(struct tty *tp, int flags)
{
	struct stty_softc *sc = device_lookup_private(&stty_cd,
						      SPIF_CARD(tp->t_dev));
	struct stty_port *sp = &sc->sc_port[SPIF_PORT(tp->t_dev)];
	int s;

	s = spltty();
	if (ISSET(tp->t_state, TS_BUSY)) {
		if (!ISSET(tp->t_state, TS_TTSTOP))
			SET(tp->t_state, TS_FLUSH);
		SET(sp->sp_flags, STTYF_STOP);
	}
	splx(s);
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:16,代码来源:spif.c

示例3: radioopen

static int
radioopen(dev_t dev, int flags, int fmt, struct lwp *l)
{
	int	unit;
	struct radio_softc *sc;

	unit = RADIOUNIT(dev);
	sc = device_lookup_private(&radio_cd, unit);
	if (sc == NULL || sc->hw_if == NULL)
		return (ENXIO);

	if (sc->hw_if->open != NULL)
		return (sc->hw_if->open(sc->hw_hdl, flags, fmt, l->l_proc));
	else
		return (0);
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:16,代码来源:radio.c

示例4: at91usart_stop

/*
 * Stop output on a line.
 */
void
at91usart_stop(struct tty *tp, int flag)
{
	struct at91usart_softc *sc
		= device_lookup_private(&at91usart_cd, COMUNIT(tp->t_dev));
	int s;

	s = spltty();
	if (ISSET(tp->t_state, TS_BUSY)) {
		/* Stop transmitting at the next chunk. */
		sc->sc_tbc = 0;
		if (!ISSET(tp->t_state, TS_TTSTOP))
			SET(tp->t_state, TS_FLUSH);
	}
	splx(s);
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:19,代码来源:at91usart.c

示例5: ukclose

static int
ukclose(dev_t dev, int flag, int fmt, struct lwp *l)
{
	struct uk_softc *uk = device_lookup_private(&uk_cd, minor(dev));
	struct scsipi_periph *periph = uk->sc_periph;
	struct scsipi_adapter *adapt = periph->periph_channel->chan_adapter;

	SC_DEBUG(uk->sc_periph, SCSIPI_DB1, ("closing\n"));

	scsipi_wait_drain(periph);

	scsipi_adapter_delref(adapt);
	periph->periph_flags &= ~PERIPH_OPEN;

	return 0;
}
开发者ID:ryoon,项目名称:netbsd-xhci,代码行数:16,代码来源:uk.c

示例6: maxrtc_open

/*ARGSUSED*/
int
maxrtc_open(dev_t dev, int flag, int fmt, struct lwp *l)
{
	struct maxrtc_softc *sc;

	if ((sc = device_lookup_private(&maxrtc_cd, minor(dev))) == NULL)
		return (ENXIO);

	/* XXX: Locking */

	if (sc->sc_open)
		return (EBUSY);

	sc->sc_open = 1;
	return (0);
}
开发者ID:goroutines,项目名称:rumprun,代码行数:17,代码来源:max6900.c

示例7: chclose

static int
chclose(dev_t dev, int flags, int fmt, struct lwp *l)
{
	struct ch_softc *sc = device_lookup_private(&ch_cd, CHUNIT(dev));
	struct scsipi_periph *periph = sc->sc_periph;
	struct scsipi_adapter *adapt = periph->periph_channel->chan_adapter;

	scsipi_wait_drain(periph);

	scsipi_adapter_delref(adapt);

	sc->sc_events = 0;

	periph->periph_flags &= ~PERIPH_OPEN;
	return (0);
}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:16,代码来源:ch.c

示例8: sscomstart

void
sscomstart(struct tty *tp)
{
	struct sscom_softc *sc = device_lookup_private(&sscom_cd, SSCOMUNIT(tp->t_dev));
	int s;

	if (SSCOM_ISALIVE(sc) == 0)
		return;

	s = spltty();
	if (ISSET(tp->t_state, TS_BUSY | TS_TIMEOUT | TS_TTSTOP))
		goto out;
	if (sc->sc_tx_stopped)
		goto out;
	if (!ttypull(tp))
		goto out;

	/* Grab the first contiguous region of buffer space. */
	{
		u_char *tba;
		int tbc;

		tba = tp->t_outq.c_cf;
		tbc = ndqb(&tp->t_outq, 0);

		(void)splserial();
		SSCOM_LOCK(sc);

		sc->sc_tba = tba;
		sc->sc_tbc = tbc;
	}

	SET(tp->t_state, TS_BUSY);
	sc->sc_tx_busy = 1;

	/* Output the first chunk of the contiguous buffer. */
	sscom_output_chunk(sc);

	/* Enable transmit completion interrupts if necessary. */
	if ((sc->sc_hwflags & SSCOM_HW_TXINT) == 0)
		sscom_enable_txint(sc);

	SSCOM_UNLOCK(sc);
out:
	splx(s);
	return;
}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:47,代码来源:sscom.c

示例9: grfioctl

/*ARGSUSED*/
int
grfioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
{
	int unit = GRFUNIT(dev);
	struct grf_softc *gp = device_lookup_private(&grf_cd, GRFUNIT(dev));
	int error;

	if ((gp->g_flags & GF_ALIVE) == 0)
		return ENXIO;

	error = 0;
	switch (cmd) {

	case GRFIOCGINFO:
		memcpy(data, (void *)&gp->g_display, sizeof(struct grfinfo));
		break;

	case GRFIOCON:
		error = grfon(gp);
		break;

	case GRFIOCOFF:
		error = grfoff(gp);
		break;

	case GRFIOCMAP:
		error = grfmap(dev, (void **)data, l->l_proc);
		break;

	case GRFIOCUNMAP:
		error = grfunmap(dev, *(void **)data, l->l_proc);
		break;

	case GRFSETVMODE:
		error = (*gp->g_sw->gd_mode)(gp, GM_GRFSETVMODE, data);
		if (error == 0)
			ite_reinit(unit);
		break;

	default:
		error = EINVAL;
		break;

	}
	return error;
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:47,代码来源:grf.c

示例10: parclose

int
parclose(dev_t dev, int flags, int mode, struct lwp *l)
{
	int unit = UNIT(dev);
	int s;
	struct par_softc *sc = device_lookup_private(&par_cd, unit);
	
	sc->sc_flags &= ~(PARF_OPEN|PARF_OWRITE);

	/* don't allow interrupts any longer */
	s = spl1();
	intio_set_sicilian_intr(intio_get_sicilian_intr() &
				~SICILIAN_INTR_PAR);
	splx(s);

	return (0);
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:17,代码来源:par.c

示例11: clmpccstop

/*
 * Stop output on a line.
 */
void
clmpccstop(struct tty *tp, int flag)
{
	struct clmpcc_softc *sc =
	    device_lookup_private(&clmpcc_cd, CLMPCCUNIT(tp->t_dev));
	struct clmpcc_chan *ch = &sc->sc_chans[CLMPCCCHAN(tp->t_dev)];
	int s;

	s = splserial();

	if ( ISSET(tp->t_state, TS_BUSY) ) {
		if ( ISCLR(tp->t_state, TS_TTSTOP) )
			SET(tp->t_state, TS_FLUSH);
		ch->ch_obuf_size = 0;
	}
	splx(s);
}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:20,代码来源:clmpcc.c

示例12: kbdclose

/*
 * Close:
 * Turn off event mode, dump the queue, and close the keyboard
 * unless it is supplying console input.
 */
int
kbdclose(dev_t dev, int flags, int mode, struct lwp *l)
{
	struct kbd_softc *k;

	k = device_lookup_private(&kbd_cd, minor(dev));
	k->k_evmode = 0;
	ev_fini(&k->k_events);
	k->k_events.ev_io = NULL;

	if (k->k_ops != NULL && k->k_ops->close != NULL) {
		int error;
		if ((error = (*k->k_ops->close)(k)) != 0)
			return error;
	}
	return 0;
}
开发者ID:Tommmster,项目名称:netbsd-avr32,代码行数:22,代码来源:kbd.c

示例13: wsmouseclose

int
wsmouseclose(dev_t dev, int flags, int mode,
    struct lwp *l)
{
	struct wsmouse_softc *sc =
	    device_lookup_private(&wsmouse_cd, minor(dev));
	struct wseventvar *evar = sc->sc_base.me_evp;

	if (evar == NULL)
		/* not open for read */
		return (0);
	sc->sc_base.me_evp = NULL;
	(*sc->sc_accessops->disable)(sc->sc_accesscookie);
	wsevent_fini(evar);

	return (0);
}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:17,代码来源:wsmouse.c

示例14: gtmpscparam

STATIC int
gtmpscparam(struct tty *tp, struct termios *t)
{
	struct gtmpsc_softc *sc =
	    device_lookup_private(&gtmpsc_cd, GTMPSCUNIT(tp->t_dev));

	/* Check requested parameters. */
	if (compute_cdv(t->c_ospeed) < 0)
		return EINVAL;
	if (t->c_ispeed && t->c_ispeed != t->c_ospeed)
		return EINVAL;

	/*
	 * If there were no changes, don't do anything.  This avoids dropping
	 * input and improves performance when all we did was frob things like
	 * VMIN and VTIME.
	 */
	if (tp->t_ospeed == t->c_ospeed &&
	    tp->t_cflag == t->c_cflag)
		return 0;

	mutex_spin_enter(&sc->sc_lock);

	/* And copy to tty. */
	tp->t_ispeed = 0;
	tp->t_ospeed = t->c_ospeed;
	tp->t_cflag = t->c_cflag;

	sc->sc_baudrate = t->c_ospeed;

	if (!sc->sc_heldchange) {
		if (sc->sc_tx_busy) {
			sc->sc_heldtbc = sc->sc_tbc;
			sc->sc_tbc = 0;
			sc->sc_heldchange = 1;
		} else
			gtmpsc_loadchannelregs(sc);
	}

	mutex_spin_exit(&sc->sc_lock);

	/* Fake carrier on */
	(void) (*tp->t_linesw->l_modem)(tp, 1);

	return 0;
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:46,代码来源:gtmpsc.c

示例15: apmpoll

int
apmpoll(dev_t dev, int events, struct lwp *l)
{
	struct apm_softc *sc = device_lookup_private(&apm_cd, APMUNIT(dev));
	int revents = 0;

	APM_LOCK(sc);
	if (events & (POLLIN | POLLRDNORM)) {
		if (sc->sc_event_count)
			revents |= events & (POLLIN | POLLRDNORM);
		else
			selrecord(l, &sc->sc_rsel);
	}
	APM_UNLOCK(sc);

	return (revents);
}
开发者ID:goroutines,项目名称:rumprun,代码行数:17,代码来源:apm.c


注:本文中的device_lookup_private函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。