Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
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);
The read_vtoc() and read_extvtoc() functions return the VTOC (volume table of contents) structure that is stored on the disk associated 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.
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.
This operation is not supported on this disk.
An unknown error occurred.
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 following errors: VT_EINVAL
The VTOC contains an incorrect field.
An I/O error occurred.
This operation is not supported on this disk.
An unknown error occurred.
The caller attempted an operation that is illegal on the disk and may overflow the fields in the data structure.
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE ATTRIBUTE VALUE |
MT-Level Unsafe |
ioctl (2), efi_alloc_and_init (3EXT), dkio (4I), attributes (7), fmthard (8), format (8), prtvtoc (8)
The write_vtoc() function cannot write a VTOC on an unlabeled disk. Use format(8) for this purpose.