*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->FreeBSD man pages -> disk (9)              
Title
Content
Arch
Section
 

DISK(9)

Contents


NAME    [Toc]    [Back]

     disk -- Kernel disk storage API

SYNOPSIS    [Toc]    [Back]

     #include <geom/geom_disk.h>

     void
     disk_create(int unit, struct disk *disk, int flags, void *unused,
	 void *unused2);

     void
     disk_destroy(struct disk *disk);

DESCRIPTION    [Toc]    [Back]

     The disk storage API permits kernel device drivers providing access to
     disk-like storage devices to advertise the device to other kernel components,
 including GEOM(4), and devfs(5).

     Each disk device is described by a struct disk structure, which contains
     a variety of parameters for the disk device, function pointers for various
 methods that may be performed on the device, as well as private data
     storage for the device driver.  In addition, some fields are reserved for
     use by GEOM in managing access to the device and its statistics.  Because
     of storage driver framework private data stored in struct disk, instances
     of the structure should be allocated out of writable, pre-zero'd memory.

     Public fields in the structure will generally be assumed not to change
     once the structure is submitted to disk_create(), and so no explicit
     locking is employed; drivers that change the values of any of these
     fields do so at their own risk.

     Memory associated with the struct disk is owned by the device driver, but
     should not be released until after the completion of a call to
     disk_destroy().

   Descriptive Fields    [Toc]    [Back]
     The following fields identify the disk device described by the structure
     instance, and must be filled in prior to submitting the structure to
     disk_create():

     u_int d_flags
	  Optional flags indicating to the storage framework what optional
	  features or descriptions the storage device driver supports.	Currently
 supported flags are DISKFLAG_NOGIANT (maintained by device
	  driver), DISKFLAG_OPEN (maintained by storage framework), and
	  DISKFLAG_CANDELETE (maintained by device driver).

     const char * d_name
	  Holds the name of the storage device class, e.g., ``ahd''.  This
	  value typically uniquely identifies a particular driver device, and
	  must not conflict with devices serviced by other device drivers.

     u_int d_unit
	  Holds the instance of the storage device class, e.g., ``4''.	This
	  namespace is managed by the device driver, and assignment of unit
	  numbers might be a property of probe order, or in some cases topology.
	Together, the d_name and d_unit values will uniquely identify
	  a disk storage device.

   Disk Device Methods    [Toc]    [Back]
     The following fields identify various disk device methods, if implemented:


     disk_open_t * d_open
	  Invoked when the disk device is opened.

     disk_close_t * d_close
	  Invoked when the disk device is closed.

     disk_strategy_t * d_strategy
	  Invoked when a new struct bio is to be initiated on the disk device.

     disk_ioctl_t * d_ioctl
	  Invoked when a I/O control operation is initiated on the disk
	  device.

     dumper_t * d_dump
	  Invoked when a kernel crash dump is performed on the disk device.

   Media Properties    [Toc]    [Back]
     The following fields identify the size, layout, and other media properties
 of the disk device.

     u_int d_sectorsize
	  The sectorsize of the disk device.

     off_t d_mediasize
	  The size of the disk device in bytes.

     u_int d_fwsectors
	  The number of sectors advertised on the disk device by the firmware
	  or BIOS.

     u_int d_fwheads
	  The number of heads advertised on the disk device by the firmeware
	  or BIOS.

     u_int d_maxsize
	  The maximum I/O request the disk device supports.

     u_int d_stripeoffset
	  If the disk device supports an optimal stripe size and offset, such
	  as a RAID device, it may advertise that offset using this field.

     u_int d_stripesize
	  If the disk device supports an optimal stripe size and offset, such
	  as a RAID device, it may advertise that size using this field.

   Driver Private Data    [Toc]    [Back]
     This field may be used by the device driver to store a pointer to private
     data to implement the disk service.

     void * d_drv1
	  Private data pointer.

SEE ALSO    [Toc]    [Back]

      
      
     GEOM(4), devfs(5)

AUTHORS    [Toc]    [Back]

     This manual page was written by Robert Watson.


FreeBSD 5.2.1		      September 26, 2003		 FreeBSD 5.2.1
[ Back ]
 Similar pages
Name OS Title
prealloc HP-UX preallocate disk storage
prealloc HP-UX preallocate fast disk storage
voldisksetup Tru64 Sets up a disk for use with the Logical Storage Manager (LSM)
radisk Tru64 Digital Storage Architecture (DSA) disk maintenance program
voldg Tru64 Manages Logical Storage Manager disk groups
volsetup Tru64 Initializes Logical Storage Manager (LSM) by creating the rootdg disk group
lsmsetup Tru64 Initializes Logical Storage Manager (LSM) by creating the rootdg disk group
voliod Tru64 Starts, stops, and reports on Logical Storage Manager kernel I/O daemons
krs_flush HP-UX flush kernel registry services data to disk
disklabel Tru64 Reads and writes a disk pack label and formats disk partitions
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service