Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

write_vtoc(3ext) [opensolaris man page]

read_vtoc(3EXT) 					    Extended Library Functions						   read_vtoc(3EXT)

NAME
read_vtoc, write_vtoc - read and write a disk's VTOC SYNOPSIS
cc [ flag ... ] file ... -ladm [ library ... ] #include <sys/vtoc.h> int read_vtoc(int fd, struct vtoc *vtoc); int write_vtoc(int fd, struct vtoc *vtoc); int read_extvtoc(int fd, struct extvtoc *extvtoc); int write_extvtoc(int fd, struct extvtoc *extvtoc); DESCRIPTION
The read_vtoc() and read_extvtoc() functions return the VTOC (volume table of contents) structure that is stored on the disk associ- ated with the open file descriptor fd. On disks larger than 1 TB read_extvtoc() must be used. The write_vtoc() and write_extvtoc() function stores the VTOC structure on the disk associated with the open file descriptor fd. On disks larger then 1TB write_extvtoc() function must be used. The fd argument refers to any slice on a raw disk. RETURN VALUES
Upon successful completion, read_vtoc() and read_extvtoc() return a positive integer indicating the slice index associated with the open file descriptor. Otherwise, they return a negative integer indicating one of the following errors: VT_EIO An I/O error occurred. VT_ENOTSUP This operation is not supported on this disk. VT_ERROR An unknown error occurred. VT_OVERFLOW The caller attempted an operation that is illegal on the disk and may overflow the fields in the data structure. Upon successful completion, write_vtoc() and write_extvtoc() return 0. Otherwise, they return a negative integer indicating one of the fol- lowing errors: VT_EINVAL The VTOC contains an incorrect field. VT_EIO An I/O error occurred. VT_ENOTSUP This operation is not supported on this disk. VT_ERROR An unknown error occurred. VT_OVERFLOW The caller attempted an operation that is illegal on the disk and may overflow the fields in the data structure. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
fmthard(1M), format(1M), prtvtoc(1M), ioctl(2), efi_alloc_and_init(3EXT), attributes(5), dkio(7I) BUGS
The write_vtoc() function cannot write a VTOC on an unlabeled disk. Use format(1M) for this purpose. SunOS 5.11 7 Oct 2008 read_vtoc(3EXT)

Check Out this Related Man Page

efi_alloc_and_init(3EXT)				    Extended Library Functions					  efi_alloc_and_init(3EXT)

NAME
efi_alloc_and_init, efi_alloc_and_read, efi_free, efi_write - manipulate a disk's EFI Partition Table SYNOPSIS
cc [ flag ... ] file... -lefi [ library ... ] #include <sys/vtoc.h> #include <sys/efi_partition.h> int efi_alloc_and_init(int fd, uint32_t nparts, dk_gpt_t **vtoc); int efi_alloc_and_read(int fd, dk_gpt_t **vtoc); void efi_free(dk_gpt_t *vtoc); int efi_write(int fd, dk_gpt_t *vtoc); DESCRIPTION
The efi_alloc_and_init() function initializes the dk_gpt_t structure specified by vtoc in preparation for a call to efi_write(). It calcu- lates and initializes the efi_version, efi_lbasize, efi_nparts, efi_first_u_lba, efi_last_lba, and efi_last_u_lba members of this sturcture. The caller can then set the efi_nparts member. The efi_alloc_and_read() function allocates memory and returns the partition table. The efi_free() function frees the memory allocated by efi_alloc_and_init() and efi_alloc_and_read(). The efi_write() function writes the EFI partition table. The fd argument refers to any slice on a raw disk, opened with O_NDELAY. See open(2). The nparts argument specifies the number of desired partitions. The vtoc argument is a dk_gpt_t structure that describes an EFI partition table and contains at least the following members: uint_t efi_version; /* set to EFI_VERSION_CURRENT */ uint_t efi_nparts; /* number of partitions in efi_parts */ uint_t efi_lbasize; /* size of block in bytes */ diskaddr_t efi_last_lba; /* last block on the disk */ diskaddr_t efi_first_u_lba; /* first block after labels */ diskaddr_t efi_last_u_lba; /* last block before backup labels */ struct dk_part efi_parts[]; /* array of partitions */ RETURN VALUES
Upon successful completion, efi_alloc_and_init() returns 0. Otherwise it returns VT_EIO if an I/O operation to the disk fails. Upon successful completion, efi_alloc_and_read() 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: VT_EIO An I/O error occurred. VT_ERROR An unknown error occurred. VT_EINVAL An EFI label was not found. Upon successful completion, efi_write() returns 0. Otherwise, it returns a negative integer to indicate one of the following: VT_EIO An I/O error occurred. VT_ERROR An unknown error occurred. VT_EINVAL The label contains incorrect data. USAGE
The EFI label is used on disks with more than 1**32-1 blocks. For compatibility reasons, the read_vtoc(3EXT) and write_vtoc() functions should be used on smaller disks. The application should attempt the read_vtoc() or write_vtoc() call, check for an error of VT_ENOTSUP, then call the analogous EFI function. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
fmthard(1M), format(1M), prtvtoc(1M), ioctl(2), open(2), libefi(3LIB), read_vtoc(3EXT), attributes(5), dkio(7I) SunOS 5.10 23 Jul 2002 efi_alloc_and_init(3EXT)
Man Page