Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getdiskbyna(3C) — HP-UX 10.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

disktab(4)

getdiskbyname(3C)

NAME

getdiskbyname(), getdiskbyname_r() − get disk description by its name

SYNOPSIS

#include <disktab.h>

struct disktab *getdiskbyname(const char *name);

int getdiskbyname_r(

const char *name,
struct disktab *result,
char *buffer,
int buflen);

DESCRIPTION

getdiskbyname() takes a disk name (such as hp7959B) and returns a pointer to a structure that describes its geometry information and the standard disk partition tables.  All information is obtained from the disktab database file (see disktab(4)).

The contents of the structure disktab include the following members.  Note that there is not necessarily any correlation between the placement in this list and the order in the structure. 

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[NSECTIONS];

The constant NSECTIONS is defined in <disktab.h>. 

Reentrant Interfaces

getdiskbyname_r() expects to be passed three extra parameters:

1.  The address of a struct disktab where the result will be stored. 

2.  A buffer to store character strings to which fields in the struct disktab will point. 

3.  The length of the user-supplied buffer. 

A buffer length of 100 is recommended.  The struct disktab is defined in the file <disktab.h>.  A -1 will be returned if the end-of-file or an error is encountered, or if the supplied buffer is of insufficient length.  If the operation is successful, 0 is returned. 

DIAGNOSTICS

A NULL pointer is returned in case of an error, or if name is not found in the disktab database file. 

WARNINGS

The return value for getdiskbyname() points to static data whose content is overwritten by each call.  Thus, getdiskbyname() is unsafe in multi-thread applications.  getdiskbyname_r() is MT-Safe and should be used instead. 

AUTHOR

getdiskbyname() was developed by HP and the University of California, Berkeley. 

SEE ALSO

disktab(4). 
 

Hewlett-Packard Company  —  HP-UX Release 10.20:  July 1996

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026