Print this page
document DKIOCFREE


 501         Typical code fragment:
 502 
 503           enable->vc_set |= DKV_ABR_SET;
 504           retval = ioctl(filedes, DKIOSETVOLCAP, enable);
 505           if (retval != EINVAL || retval != ENOTSUP) {
 506                   if (info->vc_set & DKV_DMR_SET) {
 507                           dr->vdr_flags      |= DKV_DMR_NEXT_SIDE;
 508                           dr->vdr_side = DKV_SIDE_INIT;
 509                           dr->vdr_nbytes = 1024;
 510                           dr->vdr_offset = 0xff00;
 511                           do {
 512                                   rval = ioctl(fildes, DKIODMR, dr);
 513                                   if (rval != EINVAL) {
 514                                           /* Process data */
 515                                   }
 516                           } while (rval != EINVAL || dr->vdr_flags &
 517                               (DKV_DMR_DONE | DKV_DMR_ERROR | DKV_DMR_SHORT)
 518                   }
 519           }
 520 

















































 521    RETURN VALUES
 522      Upon successful completion, the value returned is 0.  Otherwise, -1 is
 523      returned and errno is set to indicate the error.
 524 
 525    x86 Only
 526      The following ioctl(2) requests set and/or retrieve the current disk
 527      controller, partitions, or geometry information on the x86 architecture.
 528 
 529      DKIOCG_PHYGEOM
 530 
 531         The argument is a pointer to a dk_geom structure (described below).
 532         This ioctl(2) gets the driver's notion of the physical geometry of the
 533         disk drive.  It is functionally identical to the DKIOCGGEOM ioctl(2).
 534 
 535      DKIOCG_VIRTGEOM
 536 
 537         The argument is a pointer to a dk_geom structure (described below).
 538         This ioctl(2) gets the controller's (and hence the driver's) notion of
 539         the virtual geometry of the disk drive.  Virtual geometry is a view of
 540         the disk geometry maintained by the firmware in a host bus adapter or


 624      cdio(7I), fdio(7I), hdio(7I)
 625 
 626 NOTES
 627      Blocksize information provided in DKIOCGMEDIAINFO is the size (in bytes)
 628      of the device's basic unit of operation and can differ from the blocksize
 629      that the Solaris operating environment exports to the user.  Capacity
 630      information provided in the DKIOCGMEDIAINFO are for reference only and
 631      you are advised to use the values returned by DKIOCGGEOM or other
 632      appropriate ioctl(2) for accessing data using the standard interfaces.
 633 
 634      For x86 only: If the DKIOCSMBOOT command is used to modify the Solaris
 635      partitions, the VTOC information should also be set appropriately to
 636      reflect the changes to partition.  Failure to do so leads to unexpected
 637      results when the device is closed and reopened fresh at a later time.
 638      This is because a default VTOC is assumed by driver when a Solaris
 639      partition is changed.  The default VTOC persists until the ioctl
 640      DKIOCSVTOC is called to modify VTOC or the device is closed and reopened.
 641      At that point, the old valid VTOC is read from the disk if it is still
 642      available.
 643 
 644 illumos                        October 23, 2017                        illumos


 501         Typical code fragment:
 502 
 503           enable->vc_set |= DKV_ABR_SET;
 504           retval = ioctl(filedes, DKIOSETVOLCAP, enable);
 505           if (retval != EINVAL || retval != ENOTSUP) {
 506                   if (info->vc_set & DKV_DMR_SET) {
 507                           dr->vdr_flags      |= DKV_DMR_NEXT_SIDE;
 508                           dr->vdr_side = DKV_SIDE_INIT;
 509                           dr->vdr_nbytes = 1024;
 510                           dr->vdr_offset = 0xff00;
 511                           do {
 512                                   rval = ioctl(fildes, DKIODMR, dr);
 513                                   if (rval != EINVAL) {
 514                                           /* Process data */
 515                                   }
 516                           } while (rval != EINVAL || dr->vdr_flags &
 517                               (DKV_DMR_DONE | DKV_DMR_ERROR | DKV_DMR_SHORT)
 518                   }
 519           }
 520 
 521      DKIOCFREE
 522 
 523         The argument is a pointer to a dkioc_free_list_t structure (described
 524         below).  The structure consists of a header followed by one or more
 525         dkioc_free_list_ext_t strctures (described below) that list the
 526         extents that the device should free.
 527 
 528           typedef struct dkioc_free_list_ext_s {
 529                   uint64_t                dfle_start;
 530                   uint64_t                dfle_length;
 531           } dkioc_free_list_ext_t;
 532 
 533           typedef struct dkioc_free_list_s {
 534                   uint64_t                dfl_flags;
 535                   uint64_t                dfl_num_exts;
 536                   uint64_t                dfl_offset;
 537                   dkioc_free_list_ext_t   dfl_exts[1];
 538           } dkioc_free_list_t;
 539 
 540         The dfle_start, dfle_length, and dfl_offset fields are in units of
 541         bytes (not blocks).
 542 
 543         The values for dfl_flags are:
 544 
 545         DF_WAIT_SYNC  Wait for the device to complete freeing the space before
 546                       returning.
 547 
 548         The dfl_num_exts field indicates the number of dkioc_free_list_ext_t
 549         structures follow the dkioc_free_list_t structure (including the first
 550         entry in dfl_exts).  There must be at least one dkioc_free_list_ext_t
 551         in the ioctl(2) request (i.e.  dfl_num_exts must be >= 1).
 552 
 553         The dfl_offset field is added to all of the values of dfle_start when
 554         processed by the device.
 555 
 556         The dfl_exts field contains the first extent to free, immediately
 557         followed by any additional dkioc_free_list_ext_t structures if there
 558         are more than one extent to free.
 559 
 560         The DFL_SZ(num_exts) macro can be used to calculate the amount of
 561         memory required to hold num_exts extents.
 562 
 563      DKIOC_CANFREE
 564         The argument is a pointer to an int that is populated by the ioctl(2)
 565         request.  Upon a successful return, if a non-zero value has been set
 566         in the int parameter, it indicates that the device supports the
 567         DKIOCFREE ioctl(2).  If the int parameter has been set to zero, the
 568         DKIOCFREE ioctl(2) is not supported by the device.
 569 
 570    RETURN VALUES
 571      Upon successful completion, the value returned is 0.  Otherwise, -1 is
 572      returned and errno is set to indicate the error.
 573 
 574    x86 Only
 575      The following ioctl(2) requests set and/or retrieve the current disk
 576      controller, partitions, or geometry information on the x86 architecture.
 577 
 578      DKIOCG_PHYGEOM
 579 
 580         The argument is a pointer to a dk_geom structure (described below).
 581         This ioctl(2) gets the driver's notion of the physical geometry of the
 582         disk drive.  It is functionally identical to the DKIOCGGEOM ioctl(2).
 583 
 584      DKIOCG_VIRTGEOM
 585 
 586         The argument is a pointer to a dk_geom structure (described below).
 587         This ioctl(2) gets the controller's (and hence the driver's) notion of
 588         the virtual geometry of the disk drive.  Virtual geometry is a view of
 589         the disk geometry maintained by the firmware in a host bus adapter or


 673      cdio(7I), fdio(7I), hdio(7I)
 674 
 675 NOTES
 676      Blocksize information provided in DKIOCGMEDIAINFO is the size (in bytes)
 677      of the device's basic unit of operation and can differ from the blocksize
 678      that the Solaris operating environment exports to the user.  Capacity
 679      information provided in the DKIOCGMEDIAINFO are for reference only and
 680      you are advised to use the values returned by DKIOCGGEOM or other
 681      appropriate ioctl(2) for accessing data using the standard interfaces.
 682 
 683      For x86 only: If the DKIOCSMBOOT command is used to modify the Solaris
 684      partitions, the VTOC information should also be set appropriately to
 685      reflect the changes to partition.  Failure to do so leads to unexpected
 686      results when the device is closed and reopened fresh at a later time.
 687      This is because a default VTOC is assumed by driver when a Solaris
 688      partition is changed.  The default VTOC persists until the ioctl
 689      DKIOCSVTOC is called to modify VTOC or the device is closed and reopened.
 690      At that point, the old valid VTOC is read from the disk if it is still
 691      available.
 692 
 693 illumos                        February 14, 2020                       illumos