The argument is a pointer to a dk_geom structure (described below). This ioctl() gets the controller's notion of the current geometry of the disk drive.

DKIOCSGEOM

The argument is a pointer to a dk_geom structure (described below). This ioctl() sets the controller's notion of the geometry without changing the disk itself.

DKIOCGVTOC

The argument is a pointer to a vtoc structure (described below). This ioctl() returns the device's current volume table of contents (VTOC.) For disks larger than 1TB, DKIOCGEXTVTOC must be used instead.

DKIOCSVTOC

The argument is a pointer to a vtoc structure (described below). This ioctl() changes the VTOC associated with the device. For disks larger than 1TB, DKIOCSEXTVTOC must be used instead.

If DKIOCSVTOC is used with a floppy diskette, the p_start field must be the first sector of a cylinder. To compute the number of sectors per cylinder, multiply the number of heads by the number of sectors per track.

The argument is a pointer to an extvtoc structure (described below). This ioctl returns the device's current volume table of contents (VTOC). VTOC is extended to support a disk up to 2TB in size. For disks larger than 1TB this ioctl must be used instead
of DKIOCGVTOC.

DKIOCSEXTVTOC

The argument is a pointer to an extvtoc structure (described below). This ioctl changes the VTOC associated with the device. VTOC is extended to support a disk up to 2TB in size. For disks larger than 1TB this ioctl must be used instead of DKIOCSVTOC.

If the drive supports removable media, this ioctl() requests the disk drive to eject its disk.

DKIOCREMOVABLE

The argument to this ioctl() is an integer. After successful completion, this ioctl() sets that integer to a non-zero value if the drive in question has removable media. If the media is not removable, the integer is set to 0.

DKIOCHOTPLUGGABLE

The argument to this ioctl() is an integer. After successful completion, this ioctl() sets that integer to a non-zero value if the drive in question is hotpluggable. If the media is not hotpluggable, the integer is set to 0.

DKIOCREADONLY

The argument to this ioctl() is an integer. After successful completion, this ioctl() sets that integer to a non-zero value if the drive in question has read-only media. If the media is writable, or not present, the integer is set to 0.

DKIOCSTATE

This ioctl() blocks until the state of the drive, inserted or ejected, is changed. The argument is a pointer to a dkio_state, enum, whose possible enumerations are listed below. The initial value should be either the last reported state of
the drive, or DKIO_NONE. Upon return, the enum pointed to by the argument is updated with the current state of the drive.

For devices with removable media, this ioctl() requests the disk drive to lock the door.

DKIOCUNLOCK

For devices with removable media, this ioctl() requests the disk drive to unlock the door.

DKIOCGMEDIAINFO

The argument to this ioctl() is a pointer to a dk_minfo structure. The structure indicates the type of media or the command set profile used by the drive to operate on the media. The dk_minfo structure also indicates the
logical media block size the drive uses as the basic unit block size of operation and the raw formatted capacity of the media in number of logical blocks.

DKIOCGMEDIAINFOEXT

The argument to this ioctl() is a pointer to a dk_minfo_ext structure. The structure indicates the type of media or the command set profile used by the drive to operate on the media. The dk_minfo_ext structure also indicates
the logical media block size the drive uses as the basic unit block size of operation, the raw formatted capacity of the media in number of logical blocks and the physical block size of the media.

If the media exists and the host can obtain a current profile list, the command succeeds and returns the dk_minfo structure with data representing that media.

If there is no media in the drive, the command fails and the host returns an ENXIO error, indicating that it cannot gather the information requested.

If the profile list is not available, the host attempts to identify the media-type based on the available information.

If identification is not possible, the host returns media type DK_UNKNOWN. See NOTES for blocksize usage and capacity information.

DKIOCSMBOOT

The argument is a pointer to struct mboot.

Copies the mboot information supplied in the argument to the absolute sector 0 of the device. Prior to copying the information, this ioctl() performs the following checks on the mboot data:

Ensures that the signature field is set to 0xAA55.

Ensures that partitions do not overlap.

On SPARC platforms, determines if the device is a removable media.

If the above verification fails, errno is set to EINVAL and the ioctl() command fails.

x86 Platforms — Upon successful write of mboot, the partition map structure maintained in the driver is updated. If the new Solaris partition is different from the previous one, the internal VTOC table maintained in the driver is set as follows:

If _SUNOS_VTOC_8 is defined:

Partition: 0. Start: 0. Capacity = Capacity of device.

Partition: 2. Start: 0. Capacity = Capacity of device.

If _SUNOS_VTOC_16 is defined:

Partition: 2. Start: 0. Size = Size specified in mboot - 2 cylinders.

Partition: 8. Start: 0. Size = Sectors/cylinder.

Partition: 9. Start: Sectors/cylinder. Size = 2 * sectors/cylinder

To determine if the Solaris partition has changed:

If either offset or the size of the Solaris partition is different from the previous one then it shall be deemed to have changed. In all other cases, the internal VTOC info remains as before.

SPARC Platforms — The VTOC label and mboot both occupy the same location, namely sector 0. As a result, following the successful write of mboot info, the internal VTOC table maintained in the driver is set as follows:

Partition: 0. Start: 0. Size = Capacity of device.

Partition: 2. Start: 0. Size = Capacity of device.

See the NOTES section for usage of DKIOCSMBOOT when modifying Solaris partitions.

DKIOCGETVOLCAP

This ioctl provides information and status of available capabilities.

vc_info is a bitmap and the valid flag values are:

DKV_ABR_CAP - Capable of application-based recovery
DKV_DMR_CAP - Ability to read specific copy of data when
multiple copies exist. For example, in a two
way mirror, this ioctl is used to read each
side of the mirror.

vc_set is a bitmap and the valid flag values are:

DKV_ABR_CAP - This flag is set if ABR has been set on a device
that supports ABR functionality.
DKV_DMR_CAP - Directed read has been enabled.

These capabilities are not required to be persistent across a system reboot and their persistence depends upon the implementation. For example, if the ABR capability for a DRL mirror simply clears the dirty-region list and subsequently stops updating this list, there is no reason for persistence
because the VM recovery is a no-op. Conversely, if the ABR capability is applied to a non-DRL mirror to indicate that the VM should not perform a full recovery of the mirror following a system crash, the capability must be persistent so that the VM know whether or not to perform recovery.

Return Errors:

EINVAL

Invalid device for this operation.

ENOTSUP

Functionality that is attempted to be set is not supported.

DKIOCSETVOLCAP

This ioctl sets the available capabilities for the device. If a capability flag is not set in vc_set, that capability is cleared.

vc_info flags are ignored

vc_set valid flags are:

DKV_ABR_CAP - Flag to set application-based recovery. A device can
successfully support ABR only if it is capable.
DKV_DMR_CAP - Flag to set directed read.
int
ioctl(int , DKIODMR, vol_directed_rd *);

DKIODMR

This ioctl allows highly available applications to perform round-robin reads from the underlying devices of a replicated device.

vdr_offset - offset at which the read should occur.
vdr_nbytes - number of bytes to be read
vdr_bytesread - number of bytes successfully read by the kernel.
vdr_data - pointer to a user allocated buffer to return the
data read
vdr_side - side to be read. Initialized to DKV_SIDE_INIT
vdr_side_name - The volume name that has been read.
Valid vdr_flags are:
DKV_DMR_NEXT_SIDE (set by user)
DKV_DMR_DONE (return value)
DKV_DMR_ERROR (return value)
DKV_DMR_SUCCESS(return value)
DKV_DMR_SHORT(return value)

The calling sequence is as follows: The caller sets the vdr_flags to DK_DMR_NEXT_SIDE and vdr_side to DKV_SIDE_INIT at the start. Subsequent calls should be made without any changes to these values.
If they are changed the results of the ioctl are indeterminate.

When DKV_SIDE_INIT is set, the call results in the kernel reading from the first side. The kernel updates vdr_side to indicate the side that was read, and vdr_side_name to contain the name of that side. vdr_data contains the data that was read. Therefore to perform a round-robin read all of the valid sides, there is no need for the caller to change the contents of vdr_side.

Subsequent ioctl calls result in reads from the next valid side until all valid sides have been read. On success, the kernel sets DKV_DMR_SUCCESS. The following table shows the values of vdr_flags that are returned when an error occurs:

RETURN VALUES

Upon successful completion, the value returned is 0. Otherwise, -1 is returned and errno is set to indicate the error.

x86 Only

The following ioctl() requests set and/or retrieve the current disk controller, partitions, or geometry information on the x86 architecture.

DKIOCG_PHYGEOM

The argument is a pointer to a dk_geom structure (described below). This ioctl() gets the driver's notion of the physical geometry of the disk drive. It is functionally identical to the DKIOCGGEOMioctl().

DKIOCG_VIRTGEOM

The argument is a pointer to a dk_geom structure (described below). This ioctl() gets the controller's (and hence the driver's) notion of the virtual geometry of the disk drive. Virtual geometry is a view of the disk geometry maintained by
the firmware in a host bus adapter or disk controller. If the disk is larger than 8 Gbytes, this ioctl fails because a CHS-based geometry is not relevant or useful for this drive.

This ioctl() forces the driver to re-examine the alternates slice and rebuild the internal bad block map accordingly. It should be used whenever the alternates slice is changed by any method other than the addbadsec(1M) or format(1M) utilities. DKIOCADDBAD can only be
used for software remapping on IDE drives; SCSI drives use hardware remapping of alternate sectors.

DKIOCPARTINFO

The argument is a pointer to a part_info structure (described below). This ioctl() gets the driver's notion of the size and extent of the partition or slice indicated by the file descriptor argument.

The argument is a pointer to an extpart_info structure (described below). This ioctl gets the driver's notion of the size and extent of the partition or slice indicated by the file descriptor argument. On disks larger than 1TB, this ioctl must be used instead
of DKIOCPARTINFO.

This ioctl is used to update the in-memory copy of the logical drive information maintained by the driver. The ioctl takes no arguments. It causes a re-read of the partition information and recreation of minor nodes if required. Prior to updating the data structures, the ioctl
ensures that the partitions do not overlap. Device nodes are created only for valid partition entries. If there is any change in the partition offset, size or ID from the previous read, the partition is deemed to have been changed and hence the device nodes are recreated. Any modification to any
of the logical partitions results in the recreation of all logical device nodes.

See Also

Notes

Blocksize information provided in DKIOCGMEDIAINFO is the size (in bytes) of the device's basic unit of operation and can differ from the blocksize that the Solaris operating environment exports to the user. Capacity information provided in the DKIOCGMEDIAINFO are
for reference only and you are advised to use the values returned by DKIOCGGEOM or other appropriate ioctl for accessing data using the standard interfaces.

For x86 only: If the DKIOCSMBOOT command is used to modify the Solaris partitions, the VTOC information should also be set appropriately to reflect the changes to partition. Failure to do so leads to unexpected results when the device is closed and reopened fresh
at a later time. This is because a default VTOC is assumed by driver when a Solaris partition is changed. The default VTOC persists until the ioctl DKIOCSVTOC is called to modify VTOC or the device is closed and reopened. At that point, the old valid VTOC is read from the disk
if it is still available.