Annotation of driverkit/notes/LogDiskAndInsertion, revision 1.1.1.1

1.1       root        1:                logical disks and insertion detection
                      2:                
                      3: * no multi-volume support. One unit per physical drive. Disallow eject 
                      4:   while volume is open, just like disallow umount while root vnode is
                      5:   referenced. (Poll OS group to find what they think of this...)
                      6:   
                      7: * definition : unit = physical drive.
                      8: 
                      9: * each physDevice always has a rawDevice (its first logicalDisk).
                     10:   label is valid.
                     11: 
                     12: * a physDevice has blockDevices if a label is valid and the label has
                     13:   valid partitions (one blockDev per partition).
                     14:   
                     15: * Probe time: 
                     16:   for each unit {
                     17:        live partition is DiskObject subclass;
                     18:        LD +probe {
                     19:                if label present {
                     20:                        create a raw disk Logical Unit;
                     21:                        create a Block Device LD for each partition;
                     22:                }
                     23:        }
                     24:        if removable {
                     25:                start a vol_check thread;
                     26:        }
                     27:   }
                     28:   
                     29:   actions on physDevice
                     30:     
                     31:     boot
                     32:        set one-time only params in subclass-private init
                     33:        set phys params in getPhysParams
                     34:        UnixDisk +probe (create live device, raw/block if necessary)
                     35:                
                     36:     setFormatted:flag
                     37:         if any logicalDevices open
                     38:                reject;
                     39:          self labelValid, formatted = 0
                     40:         delete raw devices and blockDevices
                     41: 
                     42:     setLabelValid:1
                     43:        set labelValid
                     44:        UnixDisk +probe
                     45: 
                     46:     setLabelValid:0
                     47:         if any logicalDevices open
                     48:                reject;
                     49:          self labelValid = 0
                     50:         delete raw devices and blockDevices
                     51:        
                     52:     eject
                     53:        if any logicalDisks open
                     54:                reject;
                     55:        labelValid, formatted = 0
                     56:        delete raw devices and blockDevices
                     57:        
                     58:     insert detection
                     59:        set phys params in getPhysParams
                     60:        UnixDisk +probe (create live device, raw/block if necessary)
                     61: 
                     62: DiskObject/subclass
                     63:        created:
                     64:                subclass's probe:
                     65:        one-time only init:
                     66:                subclass-private init
                     67:        physical parameter init (dev_size, block_size)
                     68:                subclass getPhysParams (mandatory for all subclasses)
                     69:                
                     70: UnixDisk probe:physDevice
                     71:        read label;
                     72:        if bad
                     73:                return;
                     74:        create rawDevice per label info;
                     75:        registerUnixDisk:rawDevice type:DISK_TYPE_RAW
                     76:        create blockDevice for each valid partition;
                     77:        
                     78: todo on thursd:
                     79:        old unixdisk class
                     80:                rename
                     81:                add devEjectDisk, getPhysParams
                     82:                make it work wirth new DiskObject, UnixDisk.
                     83:        write a disk insertion detection thread (somewhere....)

unix.superglobalmegacorp.com

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