cvs commit: src/sys/modules Makefile

Roman Kurakin rik at cronyx.ru
Tue Aug 3 07:41:32 PDT 2004


Mark Murray wrote:

>"David O'Brien" writes:
>  
>
>>Please find a way for all your /dev KO's to detect if they are already
>>active and not panic if loaded(initialized) twice.  Many of the network
>>and SCSI device KO's DTRT.  Maybe you can copy their method of handling
>>this.
>>    
>>
>
>I am investigating. In the meanwhile, please back out this commit, and
>keep it as a local patch if you feel that strongly about it.
>  
>
Take a look how ctau(4)/cx(4)/cp(4) solve this problem. I guess that you 
may use same
technic:

static int cp_modevent (module_t mod, int type, void *unused)
{
#if __FreeBSD_version >= 500000
        struct cdev *dev;
#else
        dev_t dev;
#endif
        static int load_count = 0;
        struct cdevsw *cdsw;

#if __FreeBSD_version >= 502117
        dev = findcdev (makedev(CDEV_MAJOR, 0));
#elif __FreeBSD_version >= 502103
        dev = udev2dev (makeudev(CDEV_MAJOR, 0));
#else
        dev = makedev (CDEV_MAJOR, 0);
#endif
        switch (type) {
        case MOD_LOAD:
#if __FreeBSD_version >= 502117
                if (dev != NULL &&
#else
                if (dev != NODEV &&
#endif
                    (cdsw = devsw (dev)) &&
                    cdsw->d_maj == CDEV_MAJOR) {
                        printf ("Tau-PCI driver is already in system\n");
                        return (ENXIO);
                }

rik

>M
>--
>Mark Murray
>iumop ap!sdn w,I idlaH
>
>
>  
>





More information about the cvs-all mailing list