Removable Media
---------------
The header file <sys/gdkernel.h> has a new flag, CTF_REMOVABLE, for the controller state flags field, ctstate, in the controller data structure, gdctl. The SCSI driver sets this flag when a response to a SCSI inquiry command (0x12) indicates that the device is removable; see page 70 of the SCSI 1 specification (ANSI X3.131-1986) for more information. The inquiry command is sent to each device during the initialization phase of the SCSI driver state machine. A userðlevel application may issue an inquiry command directly using the GD_DRIVEINQUIRY ioctl.
For the (at most) seven devices on the virtual "Macintosh" bus, this information is also accessible through the removable field of the scsi_t type array defined in <sys/ss_scan.h> and returned by the UI_GETSCSIID ioctl of the user interface device, /dev/uinter0. The A/UX Macintosh Toolbox disk driver uses these values to determine if any of these devices should be checked for media; if media is present, the driver generates a disk insert event. Subsequently, these volumes may be ejected from the Finder by dragging to the Trash icon.
The SCSI driver performs an eject on all removable media using the CCS stop unit command (0x1B). For devices other than CD-ROMs, the SCSI 2 load/eject flag is not set, since some devices do not support this capability. The user should be able to eject the media manually at this point (the Toolbox driver does issue prevent/allow media removable commands (0x1E)).
Note: The development team discovered that after a stop unit command, some removables require a start unit command before coming on-line ð even after new media has been inserted. Since this is unusual behavior, the Toolbox driver contains a mechanism, based on the vendor and product strings returned in response to an inquiry command, to prevent eject commands from being issued. Contact DTS for more information.
Compatibility: Apple has done limited testing of removable media. We can't make specific recommendations on compatibility, but our testing has indicated that the Apple drive, Iomega Beta90 and Syquest models SQ5110 and SQ5110C all pass our preliminary compatibility looks. The Pinnacle drives model OHD-130 and OHD-650 both fail. All of these quick-look tests were as data disks only. We do not support or recommend ANY of these as a system disk or install target.
Write-Protected Media
---------------------
The header file <sys/gdkernel.h> has a new flag, CTF_RDONLY, for the controller state flags field, ctstate, in the controller data structure, gdctl. The SCSI driver sets this flag when the response to a SCSI mode sense command (0x1A) indicates that the device is write-protected; see pages 108ð110 of the SCSI 1 specification for more information. The mode sense command is sent to each device during the initialization phase of the SCSI driver state machine, if the device indicates that it supports the CCS during the inquiry command described above; for more information, see page 11 of the CCS specification (ANSI X3T9.2/85-52 Rev 4.B).
During the partition initialization phase of the generic disk driver, the CTF_RDONLY flag is used to set the PTF_RONLY flag in the partition flags field, ptflags, of the partition data structure, gdpart, of each partition on that device controller. The partition flags may be accessed directly using the GD_GETPARTFLAGS ioctl.
On HFS volumes, the A/UX Macintosh Toolbox disk driver uses this ioctl to set the locked bit in the flags field of the drive queue entry for that volume; see page 128 of Inside Macintosh Volume II for more information. If the Finder detects this bit, it displays the lock icon in the left-hand corner of its windows and refuses to copy files to the volume.
For write-protected media containing UNIX filesystems, the kernel will return an error and set errno to EROFS if an application attempts to mount the device for writing.
Support for Third-Party CD-ROM Drives
-------------------------------------
The A/UX SCSI driver and higher-level disk subsystem assume that all disks support 512ðbyte blocks. If a device reports that its default block size is greater than 512 bytes (in response to a read capacity command), the SCSI driver issues a mode select command to change the block size to 512 bytes. Previously, the driver assumed this command always succeeded.
This has been a problem, particularly for 3rd party CD-ROMs, since the "natural" block size for a CD-ROM is 2K and the mode select command is in the optional part of the SCSI CCS.
In A/UX 3.1, after the mode select command, the SCSI driver will detect that a device's block size is still greater than 512 bytes and handle read requests to that device specially, aligning requests on 2K boundaries and allocating temporary buffer space as necessary. Since only reads are allowed on CD-ROMs, there is no need to maintain consistency between this low-level buffer and the system's buffer cache.
Note: The performance impact of this data buffering is significant and is intended only for light data loads, such as system installation. Vendors should support the mode select command in new devices.
Support Information Services