Annotation of driverkit/notes/autoconfigScan, revision 1.1

1.1     ! root        1: struct device_slot {
        !             2:        dev_num
        !             3:        slot_id
        !             4:        dev_type
        !             5:        link
        !             6: }
        !             7: 
        !             8: config_scan(
        !             9:        boolean_t all_devices,
        !            10:        slot_id_t slot_id,
        !            11:        dev_type_t dev_type) 
        !            12: {
        !            13:        dev_num = 0;
        !            14:        
        !            15:        /*
        !            16:         * Scan hardware
        !            17:         */
        !            18:        do {
        !            19:                get_dev_type(dev_num);
        !            20:                if error
        !            21:                        continue;
        !            22:                if all_devices or dev_type and slot_id match our args
        !            23:                        make a new device_slot, add to dev_slot_list;   
        !            24:        } while drtn != no more devices;
        !            25:        
        !            26:        /*
        !            27:         * Create new dev_entry's
        !            28:         */
        !            29:        for each entry in dev_slot_list {
        !            30:                if get_driver_entry(dev_num) != NULL
        !            31:                        continue;               // already have it
        !            32:                if(fid = get_driver_file(device_slot) != NULL) {
        !            33:                        if(get_driver_entry(fid) != NULL) {
        !            34:                                create_dev_entry(driver_entry, dev_num,
        !            35:                                        dev_type, slot_id);
        !            36:                        }
        !            37:                        else {
        !            38:                                driver_entry = create_driver_entry(fid,
        !            39:                                        filename);
        !            40:                                create_dev_entry(driver_entry, dev_num,
        !            41:                                        dev_type, slot_id);
        !            42:                        }
        !            43:                }
        !            44:                else log no driver for this device;
        !            45:        }
        !            46:        
        !            47:        /*
        !            48:         * exec new drivers. have to do after last loop complete so each 
        !            49:         * driver sees all of its dev_ports.
        !            50:         */
        !            51:        for each entry in driver_list {
        !            52:                if(!running)
        !            53:                        exec_driver(driver_entry);
        !            54:        }
        !            55: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.