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


C++ destroy_dev函数代码示例

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


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

示例1: mem_modevent

static int
mem_modevent(module_t mod, int type, void *data)
{
	switch(type) {
	case MOD_LOAD:
		if (bootverbose)
			printf("mem: <memory & I/O>\n");
		/* Initialise memory range handling */
		if (mem_range_softc.mr_op != NULL)
			mem_range_softc.mr_op->init(&mem_range_softc);

		memdev = make_dev(&mem_cdevsw, 0, UID_ROOT, GID_KMEM,
			0640, "mem");
		kmemdev = make_dev(&mem_cdevsw, 1, UID_ROOT, GID_KMEM,
			0640, "kmem");
		iodev = make_dev(&mem_cdevsw, 14, UID_ROOT, GID_WHEEL,
			0600, "io");
		return (0);

	case MOD_UNLOAD:
		destroy_dev(memdev);
		destroy_dev(kmemdev);
		destroy_dev(iodev);
		return (0);

	case MOD_SHUTDOWN:
		return (0);

	default:
		return (EOPNOTSUPP);
	}
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:32,代码来源:mem.c

示例2: streams_modevent

static	int
streams_modevent(module_t mod, int type, void *unused)
{
	switch (type) {
	case MOD_LOAD:
		dt_ptm = make_dev(&streams_cdevsw, dev_ptm, 0, 0, 0666,
			"ptm");
		dt_arp = make_dev(&streams_cdevsw, dev_arp, 0, 0, 0666,
			"arp");
		dt_icmp = make_dev(&streams_cdevsw, dev_icmp, 0, 0, 0666,
			"icmp");
		dt_ip = make_dev(&streams_cdevsw, dev_ip, 0, 0, 0666,
			"ip");
		dt_tcp = make_dev(&streams_cdevsw, dev_tcp, 0, 0, 0666,
			"tcp");
		dt_udp = make_dev(&streams_cdevsw, dev_udp, 0, 0, 0666,
			"udp");
		dt_rawip = make_dev(&streams_cdevsw, dev_rawip, 0, 0, 0666,
			"rawip");
		dt_unix_dgram = make_dev(&streams_cdevsw, dev_unix_dgram,
			0, 0, 0666, "ticlts");
		dt_unix_stream = make_dev(&streams_cdevsw, dev_unix_stream,
			0, 0, 0666, "ticots");
		dt_unix_ord_stream = make_dev(&streams_cdevsw,
			dev_unix_ord_stream, 0, 0, 0666, "ticotsord");

		if (! (dt_ptm && dt_arp && dt_icmp && dt_ip && dt_tcp &&
				dt_udp && dt_rawip && dt_unix_dgram &&
				dt_unix_stream && dt_unix_ord_stream)) {
			printf("WARNING: device config for STREAMS failed\n");
			printf("Suggest unloading streams KLD\n");
		}
		return 0;
	case MOD_UNLOAD:
	  	/* XXX should check to see if it's busy first */
		destroy_dev(dt_ptm);
		destroy_dev(dt_arp);
		destroy_dev(dt_icmp);
		destroy_dev(dt_ip);
		destroy_dev(dt_tcp);
		destroy_dev(dt_udp);
		destroy_dev(dt_rawip);
		destroy_dev(dt_unix_dgram);
		destroy_dev(dt_unix_stream);
		destroy_dev(dt_unix_ord_stream);

		return 0;
	default:
		return EOPNOTSUPP;
		break;
	}
	return 0;
}
开发者ID:JabirTech,项目名称:Source,代码行数:53,代码来源:streams.c

示例3: pti_done

/*
 * pti_done() releases the reference and checks to see if both sides have
 * been closed on a unix98 pty, allowing us to destroy the device and
 * release resources.
 *
 * We do not release resources on non-unix98 ptys.  Those are left
 * statically allocated.
 */
static void
pti_done(struct pt_ioctl *pti)
{
	lwkt_gettoken(&tty_token);
	if (--pti->pt_refs == 0) {
#ifdef UNIX98_PTYS
		cdev_t dev;
		int uminor_no;

		/*
		 * Only unix09 ptys are freed up
		 */
		if ((pti->pt_flags & PF_UNIX98) == 0) {
			lwkt_reltoken(&tty_token);
			return;
		}

		/*
		 * Interlock open attempts against termination by setting
		 * PF_TERMINATED.  This allows us to block while cleaning
		 * out the device infrastructure.
		 *
		 * Do not terminate the tty if it still has a session
		 * association (t_refs).
		 */
		if ((pti->pt_flags & (PF_SOPEN|PF_MOPEN)) == 0 &&
		    pti->pt_tty.t_refs == 0) {
			pti->pt_flags |= PF_TERMINATED;
			uminor_no = pti->pt_uminor;

			if ((dev = pti->devs) != NULL) {
				dev->si_drv1 = NULL;
				pti->devs = NULL;
				destroy_dev(dev);
			}
			if ((dev = pti->devc) != NULL) {
				dev->si_drv1 = NULL;
				pti->devc = NULL;
				destroy_dev(dev);
			}
			ttyunregister(&pti->pt_tty);
			devfs_clone_bitmap_put(&DEVFS_CLONE_BITMAP(pty),
					       uminor_no);
			kfree(pti, M_PTY);
		}
#endif
	}
	lwkt_reltoken(&tty_token);
}
开发者ID:Gwenio,项目名称:DragonFlyBSD,代码行数:57,代码来源:tty_pty.c

示例4: dektec_detach

static int
dektec_detach (device_t dev)
{
	struct dektec_sc *sc = (struct dektec_sc *) device_get_softc (dev);

	if (sc->legacy_plx)
		reset_plx (dev);

	free_buffer (dev, sc, &sc->rx_buffer);
	free_buffer (dev, sc, &sc->tx_buffer);

	destroy_buffer (sc, &sc->tx_buffer);
	destroy_buffer (sc, &sc->rx_buffer);

	bus_dma_tag_destroy (sc->desc_dma_tag);
	bus_dma_tag_destroy (sc->buffer_dma_tag);

	bus_teardown_intr (dev, sc->irq_res, sc->irq_cookie);

	bus_release_resource (dev, SYS_RES_IRQ, sc->irq_id, sc->irq_res);

	if (sc->legacy_plx) {
		bus_release_resource (dev, SYS_RES_MEMORY, sc->dta_base_id, sc->dta_base_res);
		bus_release_resource (dev, SYS_RES_MEMORY, sc->plx_base_id, sc->plx_base_res);
	} else {
		bus_release_resource (dev, SYS_RES_MEMORY, sc->dta_base_id, sc->dta_base_res);
	}

	destroy_dev (sc->cdev);

	mtx_destroy (&sc->dektec_mtx);

	return 0;
}
开发者ID:olgeni,项目名称:freebsd-dektec,代码行数:34,代码来源:dektec.c

示例5: pccard_device_destroy

int
pccard_device_destroy(struct pccard_softc *sc)
{
	if (sc->cisdev)
		destroy_dev(sc->cisdev);
	return (0);
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:7,代码来源:pccard_device.c

示例6: sms1xxx_ir_exit

/* Stop IR module */
int
sms1xxx_ir_exit(struct sms1xxx_softc *sc)
{
    TRACE(TRACE_IR,"\n");

    if(!sc->ir.module_started) {
        return (ENXIO);
    }

    /* Wake up reader */
    if(sc->ir.state & IR_SLEEP) {
        wakeup(&sc->ir);
    }

    /* Destroy device */
    if(sc->ir.dev != NULL) {
        TRACE(TRACE_MODULE,"destroying ir0, addr=%p\n",sc->ir.dev);
        destroy_dev(sc->ir.dev);
        sc->ir.dev = NULL;
    }

    /* Un-initialize data handling */
    sc->ir.woff =
    sc->ir.wavail =
    sc->ir.roff =
    sc->ir.ravail = 0;
    mtx_destroy(&sc->ir.lock);

    sc->ir.module_started = 0;
    return (0);
}
开发者ID:martymac,项目名称:sms1xxx,代码行数:32,代码来源:sms1xxx-ir.c

示例7: nand_destroy_dev

void
nand_destroy_dev(struct nand_chip *chip)
{

	if (chip->cdev)
		destroy_dev(chip->cdev);
}
开发者ID:hmatyschok,项目名称:MeshBSD,代码行数:7,代码来源:nand_cdev.c

示例8: ips_adapter_free

/* clean up so we can unload the driver. */
int ips_adapter_free(ips_softc_t *sc)
{
	int error = 0;
	intrmask_t mask;
	if(sc->state & IPS_DEV_OPEN)
		return EBUSY;
	if((error = ips_diskdev_free(sc)))
		return error;
	if(ips_cmdqueue_free(sc)){
		device_printf(sc->dev,
		     "trying to exit when command queue is not empty!\n");
		return EBUSY;
	}
	DEVICE_PRINTF(1, sc->dev, "free\n");
	mask = splbio();
	untimeout(ips_timeout, sc, sc->timer);
	splx(mask);
	if (mtx_initialized(&sc->cmd_mtx))
		mtx_destroy(&sc->cmd_mtx);

	if(sc->sg_dmatag)
		bus_dma_tag_destroy(sc->sg_dmatag);
	if(sc->command_dmatag)
		bus_dma_tag_destroy(sc->command_dmatag);
	if(sc->device_file)
	        destroy_dev(sc->device_file);
        return 0;
}
开发者ID:MarginC,项目名称:kame,代码行数:29,代码来源:ips.c

示例9: ipf_modunload

static int
ipf_modunload(void)
{
	int error, i;

	if (fr_refcnt)
		return EBUSY;

	if (fr_running >= 0) {
		ipf_pfil_unhook();
		ipf_event_dereg();
		WRITE_ENTER(&ipf_global);
		error = ipfdetach();
		RWLOCK_EXIT(&ipf_global);
		if (error != 0)
			return error;
	} else
		error = 0;

	RW_DESTROY(&ipf_global);
	RW_DESTROY(&ipf_mutex);
	RW_DESTROY(&ipf_frcache);

	fr_running = -2;

	for (i = 0; ipf_devfiles[i]; i++) {
		if (ipf_devs[i] != NULL)
			destroy_dev(ipf_devs[i]);
	}

	printf("%s unloaded\n", ipfilter_version);

	return error;
}
开发者ID:VargMon,项目名称:netbsd-cvs-mirror,代码行数:34,代码来源:mlfk_ipl.c

示例10: nsmb_dev_close

int
nsmb_dev_close(dev_t dev, int flag, int fmt, struct proc *p)
{
	struct smb_dev *sdp;
	struct smb_vc *vcp;
	struct smb_share *ssp;
	struct smb_cred scred;
	int s;

	SMB_CHECKMINOR(dev);
	s = splnet();
	if ((sdp->sd_flags & NSMBFL_OPEN) == 0) {
		splx(s);
		return EBADF;
	}
	smb_makescred(&scred, p, NULL);
	ssp = sdp->sd_share;
	if (ssp != NULL)
		smb_share_rele(ssp, &scred);
	vcp = sdp->sd_vc;
	if (vcp != NULL)
		smb_vc_rele(vcp, &scred);
/*
	smb_flushq(&sdp->sd_rqlist);
	smb_flushq(&sdp->sd_rplist);
*/
	smb_devtbl[minor(dev)] = NULL;
	free(sdp, M_SMBDATA);
#ifndef __NetBSD__
	destroy_dev(dev);
#endif
	splx(s);
	return 0;
}
开发者ID:MarginC,项目名称:kame,代码行数:34,代码来源:smb_dev.c

示例11: cyapa_detach

static int
cyapa_detach(device_t dev)
{
	struct cyapa_softc *sc;

	sc = device_get_softc(dev);

	/* Cleanup poller thread */
	cyapa_lock(sc);
	while (sc->poll_thread_running) {
		sc->detaching = 1;
		mtx_sleep(&sc->detaching, &sc->mutex, PCATCH, "cyapadet", hz);
	}
	cyapa_unlock(sc);

	destroy_dev(sc->devnode);

	knlist_clear(&sc->selinfo.si_note, 0);
	seldrain(&sc->selinfo);
	knlist_destroy(&sc->selinfo.si_note);

	mtx_destroy(&sc->mutex);

	return (0);
}
开发者ID:mishurov,项目名称:double_down,代码行数:25,代码来源:cyapa.c

示例12: mac_static_exit

static void __exit mac_static_exit(void)
{
	destroy_dev(bdgfndev);

	// revert to the default netmap learning bridge
	bdgfnreg(0, bdg_learning);
}
开发者ID:Fruglemonkey,项目名称:xennet,代码行数:7,代码来源:mac-static.c

示例13: twe_free

/********************************************************************************
 * Free all of the resources associated with (sc).
 *
 * Should not be called if the controller is active.
 */
static void
twe_free(struct twe_softc *sc)
{
    struct twe_request	*tr;

    debug_called(4);

    /* throw away any command buffers */
    while ((tr = twe_dequeue_free(sc)) != NULL)
	twe_free_request(tr);

    /* destroy the data-transfer DMA tag */
    if (sc->twe_buffer_dmat)
	bus_dma_tag_destroy(sc->twe_buffer_dmat);

    /* disconnect the interrupt handler */
    if (sc->twe_intr)
	bus_teardown_intr(sc->twe_dev, sc->twe_irq, sc->twe_intr);
    if (sc->twe_irq != NULL)
	bus_release_resource(sc->twe_dev, SYS_RES_IRQ, 0, sc->twe_irq);

    /* destroy the parent DMA tag */
    if (sc->twe_parent_dmat)
	bus_dma_tag_destroy(sc->twe_parent_dmat);

    /* release the register window mapping */
    if (sc->twe_io != NULL)
	bus_release_resource(sc->twe_dev, SYS_RES_IOPORT, TWE_IO_CONFIG_REG, sc->twe_io);

    /* destroy control device */
    if (sc->twe_dev_t != (dev_t)NULL)
	destroy_dev(sc->twe_dev_t);
}
开发者ID:MarginC,项目名称:kame,代码行数:38,代码来源:twe_freebsd.c

示例14: dcons_detach

static int
dcons_detach(int port)
{
	struct	tty *tp;
	struct dcons_softc *dc;

	dc = &sc[port];

	tp = dc->dev->si_tty;

	if (tp->t_state & TS_ISOPEN) {
		printf("dcons: still opened\n");
		(*linesw[tp->t_line].l_close)(tp, 0);
		tp->t_gen++;
		ttyclose(tp);
		ttwakeup(tp);
		ttwwakeup(tp);
	}
	/* XXX
	 * must wait until all device are closed.
	 */
	tsleep((void *)dc, PWAIT, "dcodtc", hz/4);
	destroy_dev(dc->dev);

	return(0);
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:26,代码来源:dcons.c

示例15: pci_iov_detach_method

int
pci_iov_detach_method(device_t bus, device_t dev)
{
	struct pci_devinfo *dinfo;
	struct pcicfg_iov *iov;

	mtx_lock(&Giant);
	dinfo = device_get_ivars(dev);
	iov = dinfo->cfg.iov;

	if (iov == NULL) {
		mtx_unlock(&Giant);
		return (0);
	}

	if (iov->iov_num_vfs != 0 || iov->iov_flags & IOV_BUSY) {
		mtx_unlock(&Giant);
		return (EBUSY);
	}

	dinfo->cfg.iov = NULL;

	if (iov->iov_cdev) {
		destroy_dev(iov->iov_cdev);
		iov->iov_cdev = NULL;
	}
	nvlist_destroy(iov->iov_schema);

	free(iov, M_SRIOV);
	mtx_unlock(&Giant);

	return (0);
}
开发者ID:hmatyschok,项目名称:MeshBSD,代码行数:33,代码来源:pci_iov.c


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