Extended Library Functions efiallocandinit(3EXT)
NAME
efiallocandinit, efiallocandread, efifree, efiwrite,
efiusewholedisk - manipulate a disk's EFI Partition Table
SYNOPSIS
cc [ flag ... ] file... -lefi [ library ... ]
#include
#include
int efiallocandinit(int fd, uint32t nparts, dkgptt **vtoc);
int efiallocandread(int fd, dkgptt **vtoc);
void efifree(dkgptt *vtoc);
int efiwrite(int fd, dkgptt *vtoc);
int efiusewholedisk(int fd);
DESCRIPTION
The efiallocandinit() function initializes the dkgptt
structure specified by vtoc in preparation for a call to
efiwrite(). It calculates and initializes the efiversion,
efilbasize, efinparts, efifirstulba, efilastlba, and
efilastulba members of this sturcture. The caller can
then set the efinparts member.
The efiallocandread() function allocates memory and
returns the partition table.
The efifree() function frees the memory allocated by
efiallocandinit() and efiallocandread().
The efiwrite() function writes the EFI partition table.
The efiusewholedisk() function takes any space that is
not contained in the disk label and adds it to the last phy-
sically non-zero area before the reserved slice (from slice
0 to slice 6 or unallocated space).
The fd argument refers to any slice on a raw disk, opened
with ONDELAY. See open(2).
SunOS 5.11 Last change: 8 May 2008 1
Extended Library Functions efiallocandinit(3EXT)
The nparts argument specifies the number of desired parti-
tions.
The vtoc argument is a dkgptt structure that describes an
EFI partition table and contains at least the following
members:
uintt efiversion; /* set to EFIVERSIONCURENT */
uintt efinparts; /* number of partitions in efiparts */
uintt efilbasize; /* size of block in bytes */
diskaddrt efilastlba; /* last block on the disk */
diskaddrt efifirstulba; /* first block after labels */
diskaddrt efilastulba; /* last block before backup labels */
struct dkpart efiparts[]; /* array of partitions */
RETURN VALUES
Upon successful completion, efiallocandinit() returns 0.
Otherwise it returns VTEIO if an I/O operation to the disk
fails.
Upon successful completion, efiallocandread() returns a
positive integer indicating the slice index associated with
the open file descriptor. Otherwise, it returns a negative
integer to indicate one of the following:
VTEIO An I/O error occurred.
VTEROR An unknown error occurred.
VTEINVAL An EFI label was not found.
Upon successful completion, efiwrite() returns 0. Other-
wise, it returns a negative integer to indicate one of the
following:
VTEIO An I/O error occurred.
VTEROR An unknown error occurred.
VTEINVAL The label contains incorrect data.
SunOS 5.11 Last change: 8 May 2008 2
Extended Library Functions efiallocandinit(3EXT)
Upon successfully completion, efiusewholedisk() returns
0. Otherwise, it returns a negative integer to indicate one
of the following:
VTEIO An I/O error occurred.
VTEROR An unknown error occurred.
VTEINVAL The label contains incorrect data.
VTENOSPC Space out of label was not found.
USAGE
The EFI label is used on disks with more than 1^32-1 blocks.
For compatibility reasons, the readvtoc(3EXT) and
writevtoc() functions should be used on smaller disks. The
application should attempt the readvtoc() or writevtoc()
call, check for an error of VTENOTSUP, then call the analo-
gous EFI function.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Committed
MT-Level Unsafe
SEE ALSO
fmthard(1M), format(1M), prtvtoc(1M), ioctl(2), open(2),
libefi(3LIB), readvtoc(3EXT), attributes(5), dkio(7I)
SunOS 5.11 Last change: 8 May 2008 3
|