getdiskbyname(3) — Subroutines
NAME
getdiskbyname, getdiskbyname_r − Get the disk description using a disk name
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <sys/disklabel.h>
#include <sys/types.h> struct disklabel ∗getdiskbyname(
char ∗name); int getdiskbyname_r(
char ∗name,
struct disklabel ∗disk,
char ∗boot,
int boot_len,
PARAMETERS
nameSpecifies a common name for the disk drive whose geometry and partition characteristics are sought.
diskPoints to the structure that will contain the returned disk description.
bootPoints to the buffer that will contain the optional names of the primary and secondary bootstraps.
boot_lenSpecifies the length of boot. This should be BUFSIZ.
DESCRIPTION
The getdiskbyname() function uses a disk (disk drive) name to return a pointer to a structure that describes the geometry and standard partition characteristics of the named disk drive. Information obtained from the /etc/disktab database file is written to the type disklabel structure space referenced by the returned pointer.
The getdiskbyname_r() function is the reentrant version of getdiskbyname(). Upon success, the returned structure is pointed at by disk.
RETURN VALUES
Upon successful completion of the getdiskbyname() function, a pointer to a type disklabel structure is returned.
Upon successful completion of the getdiskbyname_r() function, a value of 0 (zero) is returned. Upon error, a value of -1 is returned, and errno may be set to [EINVAL].
ERRORS
If the following condition occurs, the getdiskbyname() function sets errno to the value that corresponds to the condition.
[EINVAL]Either disk or boot is NULL, or boot_len is not equal to BUFSIZ.
RELATED INFORMATION
Files: disklabel(4), disktab(4).
Commands: disklabel(8).