creatediskbyname(3x) [ultrix man page]
creatediskbyname(3x) creatediskbyname(3x) Name creatediskbyname - get the disk description associated with a file name Syntax #include <disktab.h> struct disktab * creatediskbyname(name) char *name; Description The subroutine takes the name of the character device special file representing a disk device (for example, and returns a structure pointer describing its geometry information and the default disk partition tables. It obtains this information by polling the controlling disk device driver. The subroutine returns information only for MSCP and SCSI disks. The file has the following form: #define DISKTAB "/etc/disktab" struct disktab { char *d_name; /* drive name */ char *d_type; /* drive type */ int d_secsize; /* sector size in bytes */ int d_ntracks; /* # tracks/cylinder */ int d_nsectors; /* # sectors/track */ int d_ncylinders; /* # cylinders */ int d_rpm; /* revolutions/minute */ struct partition { int p_size; /* #sectors in partition */ short p_bsize; /* block size in bytes */ short p_fsize; /* frag size in bytes */ } d_partitions[8]; }; struct disktab *getdiskbyname(); struct disktab *creatediskbyname(); Diagnostics Successful completion of the subroutine returns a pointer to a valid disktab structure. Failure of this subroutine returns a null pointer. The subroutine fails if it cannot obtain the necessary information from the device driver or disktab file. A check is done to ensure that the disktab file exists and is readable. This check ensures that the subroutine is not being called because the disktab file was accidentally removed. If there is no disktab file, the subroutine fails. The subroutine also fails if it cannot determine disk geometry attributes by polling the driver. This can occur if the disk is not an MSCP or SCSI disk. In some cases where the disk consists of removable media and the media is not loaded, the driver will be unable to determine disk attributes. Restrictions The subroutine returns information only for MSCP and SCSI disks. See Also getdiskbyname(3x), ra(4), rz(4), disktab(5) creatediskbyname(3x)
Check Out this Related Man Page
devio(4) Kernel Interfaces Manual devio(4) Name devio - device information interface Syntax #include <sys/ioctl.h> #include <sys/devio.h> Description The interface obtains status, device attributes, and other information by polling the controlling device driver. There are two ioctl requests associated with this interface: DEVIOCGET and DEVGETGEOM. The file contains the needed structure and definitions to use the DEVIOCGET and DEVGETGEOM ioctl requests. The DEVIOCGET ioctl request is used to obtain generic device information by polling the underlying device driver. The following example shows the basic structure used by this request: /* Structure for DEVIOCGET ioctl - device get status command */ struct devget { short category; /* Category */ short bus; /* Bus */ char interface[DEV_SIZE]; /* Interface (string) */ char device[DEV_SIZE]; /* Device (string) */ short adpt_num; /* Adapter number */ short nexus_num; /* Nexus or node on adapter # */ short bus_num; /* Bus number */ short ctlr_num; /* Controller number */ short slave_num; /* Plug or line number */ char dev_name[DEV_SIZE]; /* ULTRIX device mnemonic */ short unit_num; /* ULTRIX device unit number */ unsigned soft_count; /* Driver soft error count */ unsigned hard_count; /* Driver hard error count */ long stat; /* Generic status mask */ long category_stat; /* Category specific mask */ }; The DEVGETGEOM ioctl request is used to obtain disk geometry and attributes by polling the underlying device driver. This ioctl request is only supported on MSCP and SCSI disk drivers. The ioctl fails on other types of drivers which do not support DEVGETGEOM. The ioctl may fail if the device driver is unable to obtain geometry information. This could happen if the disk media is removable and there is no media loaded in the drive. The following example shows the basic structure used by this request: /* Structure for DEVGETGEOM ioctl - disk geometry information */ typedef union devgeom { struct { unsigned long dev_size; /* number of blocks in user area */ unsigned short ntracks; /* number of tracks per cylinder */ unsigned short nsectors; /* number of sectors per track */ unsigned short ncylinders; /* total number of cylinders */ unsigned long attributes; /* Device attributes */ } geom_info; unsigned char pad[124]; /* Allocate space for expansion */ } DEVGEOMST; The following is a description of the fields of the DEVGEOMST data structure. Many of the fields correspond to attributes that are often specified in the disk description file This ioctl is used by the subroutine to dynamically generate disktab entries. dev_size This field contains the number of user accessible blocks on the disk. The corresponding disktab field is which describes the size of the "c" partition. ntracks This field contains the number of tracks per cylinder and corresponds to the field of a disktab entry. nsectors This field contains the number of sectors per track and corresponds to the field of a disktab entry. ncylinders This field contains the number of cylinders on the disk and corresponds to the field of a disktab entry. attributes This field represents disk attributes. pad This field is not used to store disk information. The pad element of the DEVGEOMST is used to provide room for future expan- sion of the information fields. Restrictions The DEVGETGEOM ioctl request is only supported on MSCP and SCSI disk drivers. See Also creatediskbyname(3x), ra(4), rz(4), disktab(5) devio(4)